- Ensure
.agents/state/INDEX.mdexists; if missing, create it fromdocs/STATE_INDEX_TEMPLATE.md. - Require the caller to resolve the target binding first:
- new task: explicit
TASK_IDandTASK_TITLE - continue: explicit
task-id, exactTASK_TITLE, or a caller-confirmed candidate selected after workflow-side matching
- Ensure the selected task state file exists under
.agents/state/tasks/; if missing for a caller-confirmed new workflow task, create it fromdocs/TASK_STATE_TEMPLATE.md. - Validate required header fields:
TASK_IDTASK_TITLETASK_TYPEPLAN_FROZENCURRENT_ROLEWORKFLOW_STATUSSTARTED_ATLAST_UPDATED_AT
- Validate required sections exist:
目标下一步 Top 3阻塞项关键决策索引(最近 3 条)关键决策日志(全量追加,不覆盖历史)验收证据(Evidence)未验证清单(Gaps)Review Findings(闭环)提交计划Execution Contract
- Repair missing structure in place while preserving existing history and user-written details.
- Sync
.agents/state/INDEX.mdwithCURRENT_TASKplusActive / Blocked / Completedsummaries, using the stable entry formattask-id | TASK_TITLE | task-type | role | status. - Return a concise state summary such as
[STATE] <task-id> | <role> | <status> | 已检查/已更新for the caller to echo when helpful. - When todo items, decisions, Evidence, Gaps, Review Findings closure, or role/freeze/status change, update the relevant blocks before control returns to the caller. 9.5. For low-risk non-copy-edit work, allow multiple closely related small edits within the same execution burst to be recorded as one material update, as long as the task state still reflects:
- current Top 3 completion
- new Evidence
- current role / freeze / status
- updated
LAST_UPDATED_ATIn this context,same execution burstmeans from Contract freeze until the caller's next user-facing reply; do not carry a batched write across turns. Cap one batched write at3declared steps or roughly50net changed lines; if the burst exceeds that size, require another state update before the caller finishes. 9.6. For low-risk non-copy-edit work, append关键决策日志only when a real scope, wording, routing, or consistency decision was made; do not require artificial decision entries for trivial wording-only edits. 9.7. When a lightweight execution burst touches or nearly touches the batching cap, allowEvidenceorGapsto record a short threshold observation such as阈值可接受/阈值偏紧/阈值偏松, so later workflow tuning has fresh evidence to reference.
- For docs-only tasks, allow
Checks/Evidenceto record consistency review instead of pretending code builds ran.
Outputs:
- complete active task state structure
- updated
.agents/state/INDEX.md - current state summary
- repaired state ready for planning / execution / review
Hard rules:
- Treat the active task state file as the current workflow source of truth, with
.agents/state/INDEX.mdas the task registry. - Do not infer a continue target from partial wording when multiple unfinished tasks could match; candidate matching may narrow choices, but the caller must still confirm the final
TASK_TITLEortask-id. - Do not create a new task file until the caller has explicitly chosen
new taskinstead ofcontinue. - Do not continue planner / executor / reviewer work while required structure is missing.
- Preserve existing history in decision logs; append instead of overwriting.
- Never leave stale
CURRENT_ROLE,PLAN_FROZEN, orWORKFLOW_STATUSvalues after a phase change.