Verification and Circuit Breakers

April 6, 2026 ยท View on GitHub

Goal-Backward Verification

The verifier works backwards from the spec, not forwards from the tasks. Four levels:

LevelChecks
ExistenceDo expected files, functions, routes, migrations exist?
SubstantiveReal code, not stubs? Detects TODO, hardcoded returns, empty catch, skipped tests, placeholder components.
WiredModule imported where used? Route registered? Middleware applied? Dead code = not satisfied.
RuntimeIf Playwright: E2E tests. If Stripe: webhook handlers. If Vercel: deploy preview. If gh: CI status.

Circuit Breakers

Seven levels of circuit breakers prevent infinite loops and runaway spending. Each escalates to the next when exhausted.

LevelTriggerThresholdAction
1Test failures3 consecutiveEnter DEBUG mode
2Debug attempts2 failuresCodex rescue (different model, fresh perspective)
3Debug exhaustion3 totalRe-decompose task into sub-tasks (T005.1, T005.2)
4Review iterations3 passesAccept with warnings, move on
5No progress2 identical snapshotsBlock for human
6Max iterations100 (configurable)Save state, force exit
7Token budget100% of session or per-taskGraceful handoff to .forge/resume.md