workflow-state
workflow-state.json은 실행(run)의 단일 진실 공급원(Single Source of Truth)입니다. 스키마:
templates/workflow-state.template.json. 이 파일은 모든 아티팩트 쓰기 시 post-write-state 훅에 의해, 그리고 scripts/approve_event.py / scripts/reject_event.py에 의해 업데이트됩니다.
에이전트는 수동으로 편집해서는 안 됩니다.
키(Keys)
| 키 | 의미 |
|---|---|
run_id | 반드시 실행 폴더 이름(runs/<run-id>)과 일치해야 함 |
requirements_hash | artifacts/01-requirements.md의 SHA-256 해시 (작성될 때 설정됨) |
execution_plan | 정렬된 단계: step, name, agents, depends_on, status (pending/running/done/failed), attempts |
artifacts | 실행 기준 상대 경로 → {owner, status, sha256, updated_at} 맵 |
gate_results | G1..G8 맵 → {status: PASS/FAIL/PASS-N/A, attempts, findings, responsible_agent} |
retry_counters | G1..G8 맵 → 이미 소비된 재시도 라운드 수 |
approval | {status: pending/approved/rejected, approved_at, plan_sha256, rejected_count, feedback[]} |
notes | 추가 전용 자유 형식 로그 (결정사항, 건너뛴 에이전트 + 사유) |
업데이트 규칙
- 해시는 파일 바이트의 SHA-256 (16진수, 소문자)입니다. 단계가 아티팩트가
done상태이고 디스크의 해시가 일치하여 건너뛰어진 경우, 새로운 것을 기록하지 마십시오. - 상태 전이:
pending → running → done|failed. 대상 재시도는 담당 에이전트의 단계와 그 하위 종속 단계만 다시 실행합니다. 해당 단계의attempts와retry_counters[gate]를 증가시킵니다. - 건너뛴 에이전트는
notes에 기록되며(예:"entertainment-planner skipped: no entertainment required"), 해당 아티팩트는 여전히Not applicable — <reason>으로 작성됩니다. - 게이트 결과는 게이트별로 findings 및
responsible_agent와 함께 기록됩니다.status: FAIL및attempts: 3인 게이트는 종속 실행을 중단합니다. 다운스트림 단계를failed로 표시하고 명확한 보고서로 실행을 종료합니다. - 승인:
scripts/approve_event.py만이approval.status = "approved"및approval.plan_sha256을 설정할 수 있습니다.scripts/reject_event.py는approval.feedback에 추가하고rejected_count를 증가시킵니다.06-event-plan.md의 개정은 해당 필드가 오래된 경우에도 가드를 위해plan_sha256을 무효화합니다. - 쓰기는 원자적입니다(임시 파일 + 이름 변경).
updated_at을 UTC ISO-8601 (...Z)로 유지하십시오.
재개 계약 (/plan-event --resume <run-id>)
- 상태를 로드합니다.
workflow-state.json이 없거나 유효하지 않으면 → 오류와 함께 중단합니다. - 디스크에 있는
artifacts의 모든 경로를 다시 해시합니다. 불일치 시 해당 아티팩트를stale로 표시합니다. status가pending/running/failed인 단계만 실행하고, 아티팩트가stale인 단계(및 해당 하위 종속 단계)도 실행합니다.- 아티팩트가
done이고 해시가 일치하는 단계는 절대 반복하지 않습니다. - 각 아티팩트 완료 시 훅이 상태를 자동으로 업데이트합니다. 코디네이터는
execution_plan,gate_results,retry_counters및notes만 업데이트합니다.