3.4 KiB
Scheduler Flow (Single Source of Truth)
Use this document for all scheduler runs.
Numbered MUST Procedure
-
MUST set cadence variables before any command:
cadence=dailyorweeklylog_dir=docs/agents/task-logs/<cadence>/branch_prefix=agents/<cadence>/prompt_dir=docs/agents/prompts/<cadence>/
-
MUST run this command first and save the JSON output as the preflight exclusion set:
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/<cadence>/(?<agent>[^/]+)/")?.agent) // (.title | capture("(?<agent>[A-Za-z0-9-]+-agent)")?.agent // null))}] | sort_by(.created_at, .number)}' -
MUST derive excluded agents from command output using this order only:
- parse
head.refasagents/<cadence>/<agent-name>/...; 2) fallback to title regex; 3) if still unknown, stop with a global lock message.
- parse
-
MUST run this command and read both policy files before selecting an agent:
cat AGENTS.md CLAUDE.md -
MUST run this command to identify the latest cadence log file, then choose the next roster agent not excluded by Step 2:
ls -1 <log_dir> | sort | tail -n 1 -
MUST stop and write a
_failed.mdlog withAll roster tasks currently claimed by other agentswhen every roster agent is excluded. -
MUST claim the selected agent in this exact order:
- create branch,
- create and commit
<timestamp>_<agent>_started.mdin<log_dir>, - push branch and commit.
-
MUST re-run the same PR preflight command from Step 2 immediately after push. If an earlier claim exists for the same derived agent, print
RACE CHECK: lost (agent already claimed by PR #<number>), abandon the run, and return to Step 5. Otherwise printRACE CHECK: won. -
MUST execute
<prompt_dir>/<prompt-file>end-to-end. -
MUST create exactly one final status file (
_completed.mdor_failed.md), runnpm run lint, then commit and push.
Canonical Example Run Output
$ 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)}'
{ "count": 12, "prs": [ ... ] }
$ cat AGENTS.md CLAUDE.md
# bitvid — AI Agent Guide
...
$ ls -1 docs/agents/task-logs/daily/ | sort | tail -n 1
2026-02-13_18-40-00_load-test-agent_completed.md
Selected agent: nip-research-agent
Created: docs/agents/task-logs/daily/2026-02-14_00-00-00_nip-research-agent_started.md
Pushed branch: agents/daily/nip-research-agent/2026-02-14-run
$ 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)}'
{ "count": 13, "prs": [ ... ] }
RACE CHECK: won
$ npm run lint
> lint passed
Wrote: docs/agents/task-logs/daily/2026-02-14_00-12-00_nip-research-agent_completed.md