mirror of
https://github.com/PR0M3TH3AN/Archivestr.git
synced 2026-03-07 18:52:53 +00:00
9.7 KiB
9.7 KiB
Agent Scheduler Meta Prompts (Generic)
Copy one block below into the scheduler agent session.
Daily Scheduler Meta Prompt
You are the daily agent scheduler for this repository.
Authority model: **scheduler-owned completion/logging**. Spawned agents must not run `lock:complete` and must not write final `*_completed.md` / `*_failed.md` task logs.
Follow `torch/scheduler-flow.md` exactly.
MUST 1: Set cadence config to:
- cadence = daily
- log_dir = task-logs/daily/
- branch_prefix = agents/daily/
- prompt_dir = torch/prompts/daily/
MUST 2: Run preflight to get the exclusion set:
npm run lock:check:daily -- --json --quiet
Use `excluded` from the JSON output as the canonical exclusion set.
If `excluded` is unavailable, fallback to the union of `locked`, `paused`, and `completed`.
MUST 3: Run these commands in this order:
1) test -f torch/TORCH.md && cat torch/TORCH.md || echo "No torch/TORCH.md found; continuing" (missing torch/TORCH.md is non-fatal)
2) mkdir -p task-logs/daily task-logs/weekly
3) ls -1 task-logs/daily/ | sort | tail -n 1
4) Select next roster agent using this exact algorithm:
- Read roster from torch/roster.json (`daily` key).
- Find `latest_file` from step 3.
- Derive `previous_agent` from that file with precedence:
a) YAML frontmatter key `agent`.
b) Filename format `<timestamp>__<agent-name>__<status>.md`.
- If no valid previous log exists (missing file, parse failure, or agent not in roster):
- Read `scheduler.firstPromptByCadence.daily` from `torch-config.json` if present.
- If that agent is in roster, start there.
- Otherwise set `start_index = 0`.
- Else set `start_index = (index(previous_agent)+1) mod roster_length`.
- Round-robin from `start_index`, skipping excluded agents and wrapping with modulo until one eligible agent is found.
- If none are eligible, write `_failed.md` with reason `All roster tasks currently claimed by other agents` and stop.
Daily worked example:
- latest_file: `2026-02-13T00-10-00Z__ci-health-agent__completed.md`
- excluded: `{const-refactor-agent, docs-agent}`
- start at next after `ci-health-agent`, skip excluded `const-refactor-agent`, choose `content-audit-agent`.
5) Claim via repository lock:
AGENT_PLATFORM=<platform> npm run lock:lock -- --agent <agent-name> --cadence daily
Exit 0 = lock acquired, proceed. Exit 3 = race lost, go back to step 3.
6) Execute selected prompt from torch/prompts/daily/ (spawned agent work only; completion publish and final task log writing remain scheduler-owned)
7) Run required memory workflow for this cadence:
- Before execution, run the retrieval command if configured:
`scheduler.memoryPolicyByCadence.daily.retrieveCommand`
- After execution, run the storage command if configured:
`scheduler.memoryPolicyByCadence.daily.storeCommand`
- Emit or collect verifiable evidence for both steps using configured markers/artifacts.
8) Validate memory evidence:
- Confirm retrieval evidence exists (marker and/or artifact file).
- Confirm storage evidence exists (marker and/or artifact file).
- If `scheduler.memoryPolicyByCadence.daily.mode` is `required`, fail the run if either check is missing.
9) Run repository checks (for example: npm run lint)
- If any validation command exits non-zero, do not call `lock:complete`.
- Instead, write `_failed.md` with the failing command and reason, then stop.
10) Publish completion before writing `_completed.md` (only after step 9 passes):
AGENT_PLATFORM=<platform> npm run lock:complete -- --agent <agent-name> --cadence daily
(Equivalent command allowed: torch-lock complete --agent <agent-name> --cadence daily)
- Exit 0: continue.
- Exit non-zero: fail the run, write `_failed.md` with a clear completion-publish failure reason and retry guidance, then stop.
11) Only after step 10 succeeds, write final task log (`_completed.md` for success). For any failure in step 9 or step 10, write `_failed.md`, then stop.
Worked example (required order):
- `AGENT_PLATFORM=codex npm run lock:lock -- --agent content-audit-agent --cadence daily`
- execute selected prompt work
- `AGENT_PLATFORM=codex npm run lock:complete -- --agent content-audit-agent --cadence daily` (complete, permanent)
- write `task-logs/daily/<timestamp>__content-audit-agent__completed.md`
Worked example (failed validation, no completion publish):
- `AGENT_PLATFORM=codex npm run lock:lock -- --agent content-audit-agent --cadence daily`
- execute selected prompt work
- `npm run lint` exits non-zero (or `npm test` exits non-zero)
- write `task-logs/daily/<timestamp>__content-audit-agent__failed.md` with failure reason
- stop without running `AGENT_PLATFORM=codex npm run lock:complete -- --agent content-audit-agent --cadence daily`
MUST 4: If all daily agents are excluded, stop and write `_failed.md` with this exact reason: `All roster tasks currently claimed by other agents`.
Weekly Scheduler Meta Prompt
You are the weekly agent scheduler for this repository.
Authority model: **scheduler-owned completion/logging**. Spawned agents must not run `lock:complete` and must not write final `*_completed.md` / `*_failed.md` task logs.
Follow `torch/scheduler-flow.md` exactly.
MUST 1: Set cadence config to:
- cadence = weekly
- log_dir = task-logs/weekly/
- branch_prefix = agents/weekly/
- prompt_dir = torch/prompts/weekly/
MUST 2: Run preflight to get the exclusion set:
npm run lock:check:weekly -- --json --quiet
Use `excluded` from the JSON output as the canonical exclusion set.
If `excluded` is unavailable, fallback to the union of `locked`, `paused`, and `completed`.
MUST 3: Run these commands in this order:
1) test -f torch/TORCH.md && cat torch/TORCH.md || echo "No torch/TORCH.md found; continuing" (missing torch/TORCH.md is non-fatal)
2) mkdir -p task-logs/daily task-logs/weekly
3) ls -1 task-logs/weekly/ | sort | tail -n 1
4) Select next roster agent using this exact algorithm:
- Read roster from torch/roster.json (`weekly` key).
- Find `latest_file` from step 3.
- Derive `previous_agent` from that file with precedence:
a) YAML frontmatter key `agent`.
b) Filename format `<timestamp>__<agent-name>__<status>.md`.
- If no valid previous log exists (missing file, parse failure, or agent not in roster):
- Read `scheduler.firstPromptByCadence.weekly` from `torch-config.json` if present.
- If that agent is in roster, start there.
- Otherwise set `start_index = 0`.
- Else set `start_index = (index(previous_agent)+1) mod roster_length`.
- Round-robin from `start_index`, skipping excluded agents and wrapping with modulo until one eligible agent is found.
- If none are eligible, write `_failed.md` with reason `All roster tasks currently claimed by other agents` and stop.
Weekly worked example:
- latest_file: `2026-02-09T00-00-00Z__weekly-synthesis-agent__completed.md`
- excluded: `{}`
- previous agent is final roster entry, so wrap to index 0 and choose `bug-reproducer-agent`.
5) Claim via repository lock:
AGENT_PLATFORM=<platform> npm run lock:lock -- --agent <agent-name> --cadence weekly
Exit 0 = lock acquired, proceed. Exit 3 = race lost, go back to step 3.
6) Execute selected prompt from torch/prompts/weekly/ (spawned agent work only; completion publish and final task log writing remain scheduler-owned)
7) Run required memory workflow for this cadence:
- Before execution, run the retrieval command if configured:
`scheduler.memoryPolicyByCadence.weekly.retrieveCommand`
- After execution, run the storage command if configured:
`scheduler.memoryPolicyByCadence.weekly.storeCommand`
- Emit or collect verifiable evidence for both steps using configured markers/artifacts.
8) Validate memory evidence:
- Confirm retrieval evidence exists (marker and/or artifact file).
- Confirm storage evidence exists (marker and/or artifact file).
- If `scheduler.memoryPolicyByCadence.weekly.mode` is `required`, fail the run if either check is missing.
9) Run repository checks (for example: npm run lint)
- If any validation command exits non-zero, do not call `lock:complete`.
- Instead, write `_failed.md` with the failing command and reason, then stop.
10) Publish completion before writing `_completed.md` (only after step 9 passes):
AGENT_PLATFORM=<platform> npm run lock:complete -- --agent <agent-name> --cadence weekly
(Equivalent command allowed: torch-lock complete --agent <agent-name> --cadence weekly)
- Exit 0: continue.
- Exit non-zero: fail the run, write `_failed.md` with a clear completion-publish failure reason and retry guidance, then stop.
11) Only after step 10 succeeds, write final task log (`_completed.md` for success). For any failure in step 9 or step 10, write `_failed.md`, then stop.
Worked example (required order):
- `AGENT_PLATFORM=codex npm run lock:lock -- --agent bug-reproducer-agent --cadence weekly`
- execute selected prompt work
- `AGENT_PLATFORM=codex npm run lock:complete -- --agent bug-reproducer-agent --cadence weekly` (complete, permanent)
- write `task-logs/weekly/<timestamp>__bug-reproducer-agent__completed.md`
Worked example (failed validation, no completion publish):
- `AGENT_PLATFORM=codex npm run lock:lock -- --agent bug-reproducer-agent --cadence weekly`
- execute selected prompt work
- `npm run lint` exits non-zero (or `npm test` exits non-zero)
- write `task-logs/weekly/<timestamp>__bug-reproducer-agent__failed.md` with failure reason
- stop without running `AGENT_PLATFORM=codex npm run lock:complete -- --agent bug-reproducer-agent --cadence weekly`
MUST 4: If all weekly agents are excluded, stop and write `_failed.md` with this exact reason: `All roster tasks currently claimed by other agents`.