diff --git a/src/prompts/META_PROMPTS.md b/src/prompts/META_PROMPTS.md index 92b8a8c..dbbdbdb 100644 --- a/src/prompts/META_PROMPTS.md +++ b/src/prompts/META_PROMPTS.md @@ -51,12 +51,14 @@ MUST 3: Run these commands in this order: Exit 0 = lock acquired, proceed. Exit 3 = race lost, go back to step 3. 6) Execute selected prompt from src/prompts/daily/ 7) Run repository checks (for example: npm run lint) -8) Publish completion before writing `_completed.md`: + - If any validation command exits non-zero, do not call `lock:complete`. + - Instead, write `_failed.md` with the failing command and reason, then stop. +8) Publish completion before writing `_completed.md` (only after step 7 passes): AGENT_PLATFORM= npm run lock:complete -- --agent --cadence daily (Equivalent command allowed: torch-lock complete --agent --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. -9) Only after step 8 succeeds, write final task log (`_completed.md` for success, `_failed.md` for failure), commit, push +9) Only after step 8 succeeds, write final task log (`_completed.md` for success). For any failure in step 7 or step 8, write `_failed.md`, then stop. Worked example (required order): - `AGENT_PLATFORM=codex npm run lock:lock -- --agent content-audit-agent --cadence daily` @@ -64,6 +66,13 @@ MUST 3: Run these commands in this order: - `AGENT_PLATFORM=codex npm run lock:complete -- --agent content-audit-agent --cadence daily` (complete, permanent) - write `task-logs/daily/__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/__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`. ``` @@ -114,12 +123,14 @@ MUST 3: Run these commands in this order: Exit 0 = lock acquired, proceed. Exit 3 = race lost, go back to step 3. 6) Execute selected prompt from src/prompts/weekly/ 7) Run repository checks (for example: npm run lint) -8) Publish completion before writing `_completed.md`: + - If any validation command exits non-zero, do not call `lock:complete`. + - Instead, write `_failed.md` with the failing command and reason, then stop. +8) Publish completion before writing `_completed.md` (only after step 7 passes): AGENT_PLATFORM= npm run lock:complete -- --agent --cadence weekly (Equivalent command allowed: torch-lock complete --agent --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. -9) Only after step 8 succeeds, write final task log (`_completed.md` for success, `_failed.md` for failure), commit, push +9) Only after step 8 succeeds, write final task log (`_completed.md` for success). For any failure in step 7 or step 8, write `_failed.md`, then stop. Worked example (required order): - `AGENT_PLATFORM=codex npm run lock:lock -- --agent bug-reproducer-agent --cadence weekly` @@ -127,5 +138,12 @@ MUST 3: Run these commands in this order: - `AGENT_PLATFORM=codex npm run lock:complete -- --agent bug-reproducer-agent --cadence weekly` (complete, permanent) - write `task-logs/weekly/__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/__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`. ``` diff --git a/src/prompts/scheduler-flow.md b/src/prompts/scheduler-flow.md index ff1ba92..77d58ed 100644 --- a/src/prompts/scheduler-flow.md +++ b/src/prompts/scheduler-flow.md @@ -30,8 +30,9 @@ Every agent prompt invoked by the schedulers (daily/weekly) MUST enforce this co 3. **Capture reusable failures and unresolved issues**: - Record reusable failures in `docs/agent-handoffs/incidents/` - Record active unresolved reproducible items in `KNOWN_ISSUES.md` -4. **Publish lock completion before writing success logs**: +4. **Publish lock completion only after validation passes and before writing success logs**: - Run `npm run lock:complete -- --agent --cadence ` (or equivalent `complete`) successfully + - If any validation command exits non-zero, do **not** call `lock:complete`; write `_failed.md` with the validation failure reason and stop - Only after completion publish succeeds may the agent write final `*_completed.md` log files ## Numbered MUST Procedure @@ -126,6 +127,9 @@ Every agent prompt invoked by the schedulers (daily/weekly) MUST enforce this co 9. Run repository checks (for example: `npm run lint`). + - If any validation command exits non-zero: **fail the run immediately**, write `_failed.md` with the failing command and reason, and stop. + - When step 9 fails, step 10 MUST NOT be executed (`lock:complete` is forbidden until validation passes). + 10. Publish completion before writing final success log: ```bash @@ -141,7 +145,7 @@ Every agent prompt invoked by the schedulers (daily/weekly) MUST enforce this co 11. Create final task log only after step 10 succeeds: - `_completed.md` MUST be created only after completion publish succeeds. - - `_failed.md` is required when step 10 fails, and should include the failure reason and next retry action. + - `_failed.md` is required when step 9 or step 10 fails, and should include the failure reason and next retry action. 12. Commit and push. @@ -151,3 +155,11 @@ Worked post-task example (MUST order): 2. Execute `src/prompts/daily/content-audit-agent.md` 3. `AGENT_PLATFORM=codex npm run lock:complete -- --agent content-audit-agent --cadence daily` (complete, permanent) 4. Write `task-logs/daily/2026-02-14T10-00-00Z__content-audit-agent__completed.md` + +Worked validation-failure example (MUST behavior): + +1. `AGENT_PLATFORM=codex npm run lock:lock -- --agent content-audit-agent --cadence daily` +2. Execute `src/prompts/daily/content-audit-agent.md` +3. `npm run lint` exits non-zero (or `npm test` exits non-zero) +4. Write `task-logs/daily/2026-02-14T10-00-00Z__content-audit-agent__failed.md` with the failing command and reason +5. Stop the run **without** calling `npm run lock:complete -- --agent content-audit-agent --cadence daily`