mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
2.7 KiB
2.7 KiB
Scheduler Flow (Single Source of Truth)
Use this document for all scheduler runs. Do not redefine preflight or claim logic in other scheduler prompts.
Required Steps (Strict Order)
-
Load policy files first
- Read
AGENTS.mdandCLAUDE.md.
- Read
-
Set cadence config
cadence:dailyorweeklylog_dir:docs/agents/task-logs/<cadence>/branch_prefix:agents/<cadence>/prompt_dir:docs/agents/prompts/<cadence>/
-
Run preflight claim audit (required, fail-closed)
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)}'ls <log_dir> | sortnode scripts/agents/claim-audit.mjs --cadence <cadence>- Use
excludedAgentsfrom claim-audit output as the only exclusion list. - If claim-audit fails,
globalLockWarning=true, orexclusionListResolved=false, stop and logfailed.
-
Select next agent from cadence roster
- Read latest file in
<log_dir>(alphabetical sort). - Advance to next agent in that cadence's roster.
- Skip excluded agents.
- If all are excluded, log
failedwithAll roster tasks currently claimed by other agentsand stop.
- Read latest file in
-
Claim task before execution (required sequence)
- Create branch.
- Create minimal claim commit.
- Push branch.
- Attempt draft PR.
- Create and push
<timestamp>_<agent>_started.mdin<log_dir>. - Re-run open PR check.
- Race decision:
- If earlier matching PR exists:
RACE CHECK: lost (agent already claimed by PR #<number>), abandon branch, go back to Step 4. - Otherwise:
RACE CHECK: won, continue.
- If earlier matching PR exists:
-
Execute selected agent prompt
- Open
<prompt_dir>/<prompt-file>. - Run required workflow end-to-end.
- Open
-
Write final status log
- Create
<timestamp>_<agent>_completed.mdor_failed.mdin<log_dir>. - Never edit existing log files.
- Create
-
Validate and submit
- Verify log files exist and are correctly named.
- Run required checks (default:
npm run lint). - Commit and push changes.
Reference (Optional / Explanatory)
- File format for each log entry:
YYYY-MM-DD_HH-MM-SS_<agent-name>_<status>.md- Include: Date, Agent, Prompt, Status, Branch, Summary.
- Draft PR creation is recommended for visibility; if unavailable, branch + started log still act as lock.
started+ final status files provide crash recovery and clean chronological rotation.- Directory-based logs avoid CSV merge conflicts during concurrent scheduler runs.