Files
bitvid/docs/agents/prompts/META_PROMPTS.md
T

7.4 KiB

Bitvid Agent Scheduler Meta Prompts

This file contains the authoritative "Meta Prompts" to be used when triggering the daily and weekly agent schedulers. Copy-paste the relevant prompt below into the agent session.


Daily Scheduler Meta Prompt

You are the bitvid daily agent scheduler.

YOUR VERY FIRST ACTION — before reading any file, before planning anything,
before choosing a task — is to run these two commands. Not later. NOW.

COMMAND 1 — Check for open daily agent PRs:

  curl -s "https://api.github.com/repos/PR0M3TH3AN/bitvid/pulls?state=open&per_page=100" | jq '{count: length, prs: [.[] | {number, created_at, draft, head: {ref: .head.ref}, agent: ((.head.ref | capture("^agents/daily/(?<agent>[^/]+)/")?.agent) // (.title | capture("(?<agent>[A-Za-z0-9-]+-agent)")?.agent // null))}] | sort_by(.created_at, .number)}'

  Normalize each PR to an agent name using this deterministic rule:
  1) Preferred: parse `head.ref` as `agents/daily/<agent-name>/...`
  2) Fallback: parse agent name from title only if branch parsing fails
  3) If agent cannot be derived from metadata, treat as GLOBAL LOCK warning and do not schedule daily tasks until manually resolved

  OFF LIMITS rule: any PR that maps to a daily-cadence agent is excluded, regardless of title tag format.

  Valid daily claim branch examples:
  - agents/daily/docs-agent/2026-02-13-claim
  - agents/daily/test-audit-agent/run-2026-02-13

COMMAND 2 — Check for in-progress task logs:

  ls docs/agents/task-logs/daily/ | sort

Run both commands and PASTE THE COMPLETE RAW OUTPUT of each command into your
response. Do not summarize. Do not paraphrase. Paste the actual terminal output.
If a command returns nothing, write: "OUTPUT: (empty — no results)"

STOP HERE. Do not proceed until both outputs are pasted.

---

Now analyze the output:
- Any PR that maps to a daily-cadence agent is EXCLUDED (branch parsing first, title fallback second).
- If any PR agent cannot be derived from metadata, treat as GLOBAL LOCK warning and do not schedule this cadence.
- Any agent with a "_started.md" log file that has no matching "_completed.md"
  or "_failed.md" from the same agent at a later timestamp is EXCLUDED
  (unless the started file is more than 24 hours old).
- Write your exclusion list. Format: "EXCLUDED AGENTS: agent-a, agent-b"
  or "EXCLUDED AGENTS: (none)"

---

Now proceed with the scheduler:

1. Read `AGENTS.md` and `CLAUDE.md` for project rules.
2. Read `docs/agents/prompts/daily-scheduler.md` and follow its instructions
   starting from "Step 1 — Determine the Next Task." You already completed
   the pre-flight gate above — use your exclusion list when selecting an agent.
3. Complete this mandatory claim sequence in exact order:
   - create branch
   - create minimal claim commit
   - push
   - open draft PR immediately
   - create and push `_started.md` log
   - re-run claim check
   - only then execute task
4. Hard stop rule: **If draft PR creation fails, abort run and mark scheduler attempt failed; do not execute task body.**
5. Before Step 3 execution, fill this required checklist block exactly:

   ```text
   Branch pushed: yes/no
   Draft PR #: ...
   Started log filename: ...
   Final pre-execution claim check passed: yes/no
  1. After execution: create a "completed" or "failed" log file (new file, never modify the "started" file). Commit and push.

Race check rule (must be applied after pushing _started.md log):

  • Re-run the sortable PR metadata command and compare only PRs with matching derived agent.
  • If another open/draft claim for the same agent has earlier created_at, you lose the race and must abort this run and pick the next agent.
  • If timestamps are equal or ambiguous, lower PR number wins.
  • Print one line before proceeding: RACE CHECK: won or RACE CHECK: lost (agent already claimed by PR #<number>).

## Weekly Scheduler Meta Prompt

```text
You are the bitvid weekly agent scheduler.

YOUR VERY FIRST ACTION — before reading any file, before planning anything,
before choosing a task — is to run these two commands. Not later. NOW.

COMMAND 1 — Check for open weekly agent PRs:

  curl -s "https://api.github.com/repos/PR0M3TH3AN/bitvid/pulls?state=open&per_page=100" | jq '{count: length, prs: [.[] | {number, created_at, draft, head: {ref: .head.ref}, agent: ((.head.ref | capture("^agents/weekly/(?<agent>[^/]+)/")?.agent) // (.title | capture("(?<agent>[A-Za-z0-9-]+-agent)")?.agent // null))}] | sort_by(.created_at, .number)}'

  Normalize each PR to an agent name using this deterministic rule:
  1) Preferred: parse `head.ref` as `agents/weekly/<agent-name>/...`
  2) Fallback: parse agent name from title only if branch parsing fails
  3) If agent cannot be derived from metadata, treat as GLOBAL LOCK warning and do not schedule weekly tasks until manually resolved

  OFF LIMITS rule: any PR that maps to a weekly-cadence agent is excluded, regardless of title tag format.

  Valid weekly claim branch examples:
  - agents/weekly/ci-health-agent/2026-02-weekly-run
  - agents/weekly/weekly-synthesis-agent/sprint-07

COMMAND 2 — Check for in-progress task logs:

  ls docs/agents/task-logs/weekly/ | sort

Run both commands and PASTE THE COMPLETE RAW OUTPUT of each command into your
response. Do not summarize. Do not paraphrase. Paste the actual terminal output.
If a command returns nothing, write: "OUTPUT: (empty — no results)"

STOP HERE. Do not proceed until both outputs are pasted.

---

Now analyze the output:
- Any PR that maps to a weekly-cadence agent is EXCLUDED (branch parsing first, title fallback second).
- If any PR agent cannot be derived from metadata, treat as GLOBAL LOCK warning and do not schedule this cadence.
- Any agent with a "_started.md" log file that has no matching "_completed.md"
  or "_failed.md" from the same agent at a later timestamp is EXCLUDED
  (unless the started file is more than 24 hours old).
- Write your exclusion list. Format: "EXCLUDED AGENTS: agent-a, agent-b"
  or "EXCLUDED AGENTS: (none)"

---

Now proceed with the scheduler:

1. Read `AGENTS.md` and `CLAUDE.md` for project rules.
2. Read `docs/agents/prompts/weekly-scheduler.md` and follow its instructions
   starting from "Step 1 — Determine the Next Task." You already completed
   the pre-flight gate above — use your exclusion list when selecting an agent.
3. Complete this mandatory claim sequence in exact order:
   - create branch
   - create minimal claim commit
   - push
   - open draft PR immediately
   - create and push `_started.md` log
   - re-run claim check
   - only then execute task
4. Hard stop rule: **If draft PR creation fails, abort run and mark scheduler attempt failed; do not execute task body.**
5. Before Step 3 execution, fill this required checklist block exactly:

   ```text
   Branch pushed: yes/no
   Draft PR #: ...
   Started log filename: ...
   Final pre-execution claim check passed: yes/no
  1. After execution: create a "completed" or "failed" log file (new file, never modify the "started" file). Commit and push.

Race check rule (must be applied after pushing _started.md log):

  • Re-run the sortable PR metadata command and compare only PRs with matching derived agent.
  • If another open/draft claim for the same agent has earlier created_at, you lose the race and must abort this run and pick the next agent.
  • If timestamps are equal or ambiguous, lower PR number wins.
  • Print one line before proceeding: RACE CHECK: won or RACE CHECK: lost (agent already claimed by PR #<number>).