workflow-state
workflow-state.json is the single source of truth for a run's execution. Schema:
templates/workflow-state.template.json. It is updated by the post-write-state hook on
every artifact write and by scripts/approve_event.py / scripts/reject_event.py.
Agents must not edit it by hand.
Keys
| Key | Meaning |
|---|---|
run_id | must equal the run folder name (runs/<run-id>) |
requirements_hash | SHA-256 of artifacts/01-requirements.md (set when it is written) |
execution_plan | ordered steps: step, name, agents, depends_on, status (pending/running/done/failed), attempts |
artifacts | map of run-relative path → {owner, status, sha256, updated_at} |
gate_results | map G1..G8 → {status: PASS/FAIL/PASS-N/A, attempts, findings, responsible_agent} |
retry_counters | map G1..G8 → number of retry rounds already consumed |
approval | {status: pending/approved/rejected, approved_at, plan_sha256, rejected_count, feedback[]} |
notes | append-only free-form log (decisions, skipped agents + reasons) |
Update rules
- Hashes are SHA-256 of file bytes (hex, lowercase). When a step is skipped because
its artifact is
doneand the on-disk hash matches, record nothing new. - Status transitions:
pending → running → done|failed. A targeted retry re-runs only the responsible agent's step and its downstream dependents; bump that step'sattemptsandretry_counters[gate]. - Skipped agents are recorded in
notes(e.g."entertainment-planner skipped: no entertainment required") and their artifact is still written asNot applicable — <reason>. - Gate outcomes are recorded per gate with findings and
responsible_agent; a gate withstatus: FAILandattempts: 3stops dependent execution — mark downstream stepsfailedand end the run with a clear report. - Approval: only
scripts/approve_event.pymay setapproval.status = "approved"andapproval.plan_sha256.scripts/reject_event.pyappends toapproval.feedbackand incrementsrejected_count. A revision of06-event-plan.mdinvalidatesplan_sha256for the guard even if the field is stale. - Writes are atomic (temp file + rename). Keep
updated_atin UTC ISO-8601 (...Z).
Resume contract (/plan-event --resume <run-id>)
- Load state; if
workflow-state.jsonis missing or invalid → stop with an error. - Re-hash every path in
artifactson disk; a mismatch marks that artifactstale. - Execute only steps with
statusinpending/running/failed, plus any step whose artifact isstale(and their downstream dependents). - Never repeat steps whose artifacts are
donewith matching hashes. - On completion of each artifact the hook updates state automatically — the coordinator
only updates
execution_plan,gate_results,retry_countersandnotes.