@fitlab-ai/agent-infra 0.11.2 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +17 -8
  2. package/README.zh-CN.md +17 -8
  3. package/dist/bin/internal-cli.js +7 -2
  4. package/dist/lib/agent-clients/adapter.js +3 -0
  5. package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +234 -0
  6. package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +8 -35
  7. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +1 -34
  8. package/dist/lib/agent-clients/adapters/codex.js +10 -0
  9. package/dist/lib/internal/cli-route-inventory.js +1 -1
  10. package/dist/lib/internal/manual-validation.js +22 -27
  11. package/dist/lib/internal/sandbox-control.js +1 -43
  12. package/dist/lib/internal/task-artifact.js +1 -1
  13. package/dist/lib/internal/task-finalization.js +41 -1
  14. package/dist/lib/internal/task-ledger.js +13 -5
  15. package/dist/lib/internal/task-lifecycle.js +1 -1
  16. package/dist/lib/internal/task-operation-registry.js +7 -2
  17. package/dist/lib/platform/completion-backfill.js +63 -17
  18. package/dist/lib/platform/issue-comments.js +2 -31
  19. package/dist/lib/platform/pr-summary.js +7 -2
  20. package/dist/lib/sandbox/control/client.js +3 -44
  21. package/dist/lib/sandbox/control/executor.js +14 -79
  22. package/dist/lib/sandbox/control/protocol.js +5 -64
  23. package/dist/lib/sandbox/control/server.js +49 -343
  24. package/dist/lib/sandbox/control/state.js +1 -7
  25. package/dist/lib/sandbox/control/task-view.js +1 -2
  26. package/dist/lib/sandbox/task-cleanup.js +13 -20
  27. package/dist/lib/task/artifact-command.js +11 -4
  28. package/dist/lib/task/artifact-lifecycle.js +217 -85
  29. package/dist/lib/task/artifact-operations.js +1 -26
  30. package/dist/lib/task/artifact-receipts.js +4 -1
  31. package/dist/lib/task/artifact-schema.js +1 -0
  32. package/dist/lib/task/artifact-selection.js +25 -0
  33. package/dist/lib/task/capabilities.js +158 -39
  34. package/dist/lib/task/commands/status.js +9 -2
  35. package/dist/lib/task/control-authority.js +37 -38
  36. package/dist/lib/task/control-recovery.js +3 -42
  37. package/dist/lib/task/decision-intents.js +12 -0
  38. package/dist/lib/task/delegation-receipts.js +2 -2
  39. package/dist/lib/task/delivery.js +1 -43
  40. package/dist/lib/task/events.js +80 -64
  41. package/dist/lib/task/finalization-artifacts.js +1 -3
  42. package/dist/lib/task/finalization-state.js +1 -1
  43. package/dist/lib/task/finalization.js +319 -234
  44. package/dist/lib/task/ledger-intents.js +157 -15
  45. package/dist/lib/task/lifecycle-path.js +75 -0
  46. package/dist/lib/task/lifecycle.js +11 -1
  47. package/dist/lib/task/local-artifact-finalization.js +1 -20
  48. package/dist/lib/task/manual-validation-receipt.js +8 -3
  49. package/dist/lib/task/orchestration.js +29 -13
  50. package/dist/lib/task/review-finalization.js +3 -16
  51. package/dist/lib/task/rework-intent.js +70 -4
  52. package/dist/lib/task/verification-engine.js +20 -30
  53. package/dist/lib/task/verification.js +1 -0
  54. package/dist/lib/task/workflow-warning-intents.js +21 -6
  55. package/dist/lib/task/workspace-snapshot.js +7 -2
  56. package/dist/lifecycle-build-manifest.json +3 -3
  57. package/lib/agent-clients/adapter.ts +46 -0
  58. package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +297 -0
  59. package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +13 -33
  60. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +1 -44
  61. package/lib/agent-clients/adapters/codex.ts +10 -0
  62. package/lib/internal/cli-route-inventory.ts +1 -1
  63. package/lib/internal/manual-validation.ts +22 -26
  64. package/lib/internal/sandbox-control.ts +0 -42
  65. package/lib/internal/task-artifact.ts +1 -1
  66. package/lib/internal/task-finalization.ts +40 -1
  67. package/lib/internal/task-ledger.ts +12 -5
  68. package/lib/internal/task-lifecycle.ts +2 -2
  69. package/lib/internal/task-operation-registry.ts +8 -4
  70. package/lib/platform/completion-backfill.ts +78 -16
  71. package/lib/platform/issue-comments.ts +1 -35
  72. package/lib/platform/pr-summary.ts +10 -2
  73. package/lib/sandbox/control/client.ts +5 -68
  74. package/lib/sandbox/control/executor.ts +14 -81
  75. package/lib/sandbox/control/protocol.ts +7 -83
  76. package/lib/sandbox/control/server.ts +47 -362
  77. package/lib/sandbox/control/state.ts +1 -9
  78. package/lib/sandbox/control/task-view.ts +1 -2
  79. package/lib/sandbox/task-cleanup.ts +12 -20
  80. package/lib/task/artifact-command.ts +14 -4
  81. package/lib/task/artifact-lifecycle.ts +236 -85
  82. package/lib/task/artifact-operations.ts +1 -26
  83. package/lib/task/artifact-receipts.ts +4 -1
  84. package/lib/task/artifact-schema.ts +1 -0
  85. package/lib/task/artifact-selection.ts +53 -0
  86. package/lib/task/capabilities.ts +154 -40
  87. package/lib/task/commands/status.ts +11 -2
  88. package/lib/task/control-authority.ts +41 -48
  89. package/lib/task/control-recovery.ts +3 -43
  90. package/lib/task/decision-intents.ts +9 -0
  91. package/lib/task/delegation-receipts.ts +2 -2
  92. package/lib/task/delivery.ts +1 -40
  93. package/lib/task/events.ts +82 -64
  94. package/lib/task/finalization-artifacts.ts +1 -3
  95. package/lib/task/finalization-state.ts +1 -1
  96. package/lib/task/finalization.ts +310 -216
  97. package/lib/task/ledger-intents.ts +155 -15
  98. package/lib/task/lifecycle-path.ts +98 -0
  99. package/lib/task/lifecycle.ts +15 -2
  100. package/lib/task/local-artifact-finalization.ts +2 -25
  101. package/lib/task/manual-validation-receipt.ts +8 -2
  102. package/lib/task/orchestration.ts +56 -27
  103. package/lib/task/review-finalization.ts +3 -16
  104. package/lib/task/rework-intent.ts +75 -5
  105. package/lib/task/verification-engine.ts +19 -30
  106. package/lib/task/verification.ts +2 -1
  107. package/lib/task/workflow-warning-intents.ts +18 -6
  108. package/lib/task/workspace-snapshot.ts +3 -2
  109. package/package.json +1 -1
  110. package/templates/.agents/rules/lifecycle-orchestration.en.md +19 -5
  111. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +19 -5
  112. package/templates/.agents/rules/review-handshake.en.md +4 -4
  113. package/templates/.agents/rules/review-handshake.zh-CN.md +4 -4
  114. package/templates/.agents/skills/analyze-task/SKILL.en.md +11 -4
  115. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -4
  116. package/templates/.agents/skills/code-task/SKILL.en.md +14 -8
  117. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +18 -13
  118. package/templates/.agents/skills/code-task/reference/code-rules.en.md +2 -2
  119. package/templates/.agents/skills/code-task/reference/code-rules.zh-CN.md +2 -2
  120. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +4 -4
  121. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +4 -4
  122. package/templates/.agents/skills/code-task/reference/report-template.en.md +1 -1
  123. package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +1 -1
  124. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +2 -2
  125. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +2 -2
  126. package/templates/.agents/skills/complete-task/SKILL.en.md +7 -8
  127. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +7 -8
  128. package/templates/.agents/skills/plan-task/SKILL.en.md +13 -10
  129. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +13 -10
  130. package/templates/.agents/skills/review-analysis/SKILL.en.md +5 -1
  131. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +5 -1
  132. package/templates/.agents/skills/review-code/SKILL.en.md +5 -1
  133. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -1
  134. package/templates/.agents/skills/review-plan/SKILL.en.md +5 -1
  135. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +5 -1
  136. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +2 -2
  137. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +2 -2
  138. package/templates/.agents/skills/run-task/SKILL.en.md +9 -8
  139. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +9 -8
  140. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +18 -2
  141. package/templates/.agents/templates/task.en.md +2 -2
  142. package/templates/.agents/templates/task.zh-CN.md +2 -2
  143. package/templates/.agents/workflows/bug-fix.en.yaml +11 -6
  144. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +11 -6
  145. package/templates/.agents/workflows/feature-development.en.yaml +11 -6
  146. package/templates/.agents/workflows/feature-development.zh-CN.yaml +11 -6
  147. package/templates/.agents/workflows/refactoring.en.yaml +11 -6
  148. package/templates/.agents/workflows/refactoring.zh-CN.yaml +11 -6
  149. package/dist/lib/sandbox/control/finalization-response.js +0 -35
  150. package/dist/lib/sandbox/control/task-workflow.js +0 -74
  151. package/dist/lib/sandbox/control/workflow-executor.js +0 -142
  152. package/dist/lib/task/lifecycle-recovery.js +0 -549
  153. package/dist/lib/task/recovery-warning.js +0 -19
  154. package/dist/lib/task/workflow-command.js +0 -21
  155. package/dist/lib/task/workflow-dispatch.js +0 -213
  156. package/lib/sandbox/control/finalization-response.ts +0 -37
  157. package/lib/sandbox/control/task-workflow.ts +0 -95
  158. package/lib/sandbox/control/workflow-executor.ts +0 -156
  159. package/lib/task/lifecycle-recovery.ts +0 -691
  160. package/lib/task/recovery-warning.ts +0 -21
  161. package/lib/task/workflow-command.ts +0 -22
  162. package/lib/task/workflow-dispatch.ts +0 -214
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
3
  description: >
4
- Implement code from the technical plan and output a report.
5
- Use when an approved technical plan needs implementing, or code review found issues to fix.
4
+ Implement code from the selected lifecycle input and output a report.
5
+ Use when analysis or a technical plan is ready for the selected path, or code review found issues to fix.
6
6
  Only invoke this skill automatically when the conversation includes a resolvable task reference.
7
7
  ---
8
8
 
@@ -11,16 +11,20 @@ description: >
11
11
 
12
12
  If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to the completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts. Lifecycle events also require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request` for initial work and `review-finding` for fixes or decisions. Reuse the same values for started and completed.
13
13
 
14
- Implement the approved plan and produce `code.md` or `code-r{N}.md`. This skill supports initial implementation, fix mode based on `review-code` feedback, and human-decision-driven implementation.
14
+ Implement from the input selected by the lifecycle path and produce `code.md` or `code-r{N}.md`. This skill supports initial implementation, fix mode based on `review-code` feedback, and human-decision-driven implementation.
15
15
 
16
16
  ## Boundary / Critical Rules
17
17
 
18
+ ### Path and rework
19
+
20
+ This stage consumes only the canonical path fact parsed by core from the latest valid analysis artifact; a stage omitted by that path must not create an artifact. When another Changes Requested verdict follows one completed revision-review cycle in the same stage, classify the rework before the next executor artifact and bind it to the finding, source SHA, and stable task-fact digest. A round or filename change is not new evidence.
21
+
18
22
  ### Persisted Report Evidence
19
23
 
20
24
  Before generating the implementation report, read `.agents/rules/evidence-reporting.md`. Successful tests record the command, target scope, status or structured result, actual result, and uncovered parts; failures, blocking conditions, or disputes retain a reproducible entry point, exact location, and decisive excerpt instead of complete successful stdout.
21
25
 
22
26
  - When evaluating candidate qualification or `HD-N`, read `.agents/rules/decision-qualification.md`, audit normalized task constraints/candidates, and record the five qualification-audit tables in the implementation report; unknown or unconfirmed constraints must not automatically exclude a candidate
23
- - Follow the latest plan artifact: `plan.md` or `plan-r{N}.md`
27
+ - Follow the lifecycle input selected by core: `analysis.md` / `analysis-r{N}.md` for the streamlined path, and `plan.md` / `plan-r{N}.md` for the standard or full path
24
28
  - Before generating task or lifecycle Markdown that will be synchronized to an Issue, read `.agents/rules/sync-content-generation.md` and apply its producer-side constraints; the sync path does not parse or rewrite the body
25
29
  - Read `.agents/rules/compatibility-policy.md` before implementation. Implement only the compatibility budget explicitly approved by the plan; never retain old branches, result contracts, or migration shims merely to be “safe”
26
30
  - Fix mode verifies each finding of the latest `review-code` one by one: fix it if it holds, or rebut it and record it under unresolved if it is unfounded/hallucinated; do not expand to issues the review did not list; manual-validation items are out of scope
@@ -56,7 +60,7 @@ After prerequisites and mode are confirmed and before this round's first artifac
56
60
 
57
61
  ### 1. Verify Prerequisites
58
62
 
59
- Require `task.md` and at least one plan artifact: `plan.md` or `plan-r{N}.md`.
63
+ Require `task.md`. Step 4 validates the lifecycle input selected by the chosen path; the skill must not require a plan artifact unconditionally.
60
64
 
61
65
  ### 2. Ensure the Task Branch
62
66
 
@@ -78,6 +82,8 @@ status=$?
78
82
  echo "$result"
79
83
  ```
80
84
 
85
+ When `selection.disposition` is `reuse`, reuse `selection.artifact`, do not run started/init, modify code, or write a new artifact, and continue directly to completion verification and next-step guidance. Otherwise continue with the table below.
86
+
81
87
  Dispatch by `$status` and `result.mode`:
82
88
 
83
89
  - `0` + `"init"`: initial implementation; record `{code-artifact}` and `{code-round}`
@@ -90,11 +96,11 @@ Dispatch by `$status` and `result.mode`:
90
96
 
91
97
  ### 5. Read Structured Inputs
92
98
 
93
- Use only the structured result from step 4: read the selected plan artifact and, in fix mode, the selected review artifact. Use `next.name` as `{code-artifact}` and `next.round` as `{code-round}`. In decision mode, take the unified identity from `implementation_input`, `decision_id`, and `decision_evidence`; do not rescan or construct identities in the skill.
99
+ Use only the structured result from step 4: read `{lifecycle-input-artifact}` from `inputs` (analysis for the streamlined path, plan otherwise) and, in fix mode, the selected review artifact. Use `next.name` as `{code-artifact}` and `next.round` as `{code-round}`. In decision mode, take the unified identity from `implementation_input`, `decision_id`, and `decision_evidence`; do not rescan or construct identities in the skill.
94
100
 
95
- ### 6. Read the Technical Plan
101
+ ### 6. Read the Lifecycle Input
96
102
 
97
- Extract implementation steps, files, test strategy, constraints, risks, and approved tradeoffs. In decision mode, also read the `{input-id}` row and its `{decision-evidence}` record in task.md, and implement only that ruling's requested behavior change.
103
+ Extract implementation steps, files, test strategy, constraints, risks, and approved tradeoffs from `{lifecycle-input-artifact}`. In decision mode, also read the `{input-id}` row and its `{decision-evidence}` record in task.md, and implement only that ruling's requested behavior change.
98
104
 
99
105
  ### 7. Implement the Code
100
106
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
3
  description: >
4
- 根据技术方案编码任务并输出报告。
5
- 当技术方案已批准需要落地实现,或代码审查发现问题需要修复时使用。
4
+ 根据生命周期输入编码任务并输出报告。
5
+ 当分析或技术方案已按所选路径准备完成,或代码审查发现问题需要修复时使用。
6
6
  仅当对话包含可解析的任务引用时才可自动调用本技能。
7
7
  ---
8
8
 
@@ -11,16 +11,20 @@ description: >
11
11
 
12
12
  若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。生命周期事件还必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 初次实现使用 `user-request`,修复或裁决使用 `review-finding`;started 与 completed 使用同一组值。
13
13
 
14
- 根据已批准的技术方案编码任务,并产出 `code.md` 或 `code-r{N}.md`。本技能支持初次实现、基于 `review-code` 反馈的修复,以及人工裁决驱动实现三种模式。
14
+ 根据所选生命周期路径的实现输入编码任务,并产出 `code.md` 或 `code-r{N}.md`。本技能支持初次实现、基于 `review-code` 反馈的修复,以及人工裁决驱动实现三种模式。
15
15
 
16
16
  ## 行为边界 / 关键规则
17
17
 
18
+ ### 路径与返工
19
+
20
+ 本阶段只消费核心从最新有效分析产物解析出的规范路径事实;未被所选路径包含的阶段不得创建产物。同阶段完成一次修订—复审后再次收到 Changes Requested 时,必须在下一执行产物前提交绑定 finding、来源 SHA 和稳定任务事实摘要的返工分类;轮次或文件名变化不是新证据。
21
+
18
22
  ### 持久化报告证据
19
23
 
20
24
  生成实现报告时,先读取 `.agents/rules/evidence-reporting.md`。成功测试记录命令、目标范围、状态/结构化结果、实际结果和未覆盖部分;失败、阻塞或争议保留复现入口、准确位置和决定性摘录,不默认粘贴完整成功 stdout。
21
25
 
22
26
  - 涉及候选资格或 `HD-N` 判断时,先读取 `.agents/rules/decision-qualification.md`,基于 task.md 规范化约束/候选完成资格审计,并在实现报告记录五张资格审计表;不得把来源不明或未确认约束自动升级为排除条件
23
- - 严格遵循最新方案产物:`plan.md` 或 `plan-r{N}.md`
27
+ - 严格遵循核心选择的最新生命周期输入:精简路径为 `analysis.md` / `analysis-r{N}.md`,标准或完整路径为 `plan.md` / `plan-r{N}.md`
24
28
  - 生成会同步到 Issue 的任务或生命周期 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;同步端不解析或改写正文
25
29
  - 实现前读取 `.agents/rules/compatibility-policy.md`;只实现方案明确批准的兼容预算,不以“稳妥”为由保留旧分支、旧结果契约或迁移 shim
26
30
  - 修复模式逐条核实最新 `review-code` 的发现:成立则修复,判定为不成立/幻觉则在报告中反驳并记入 unresolved;不擅自扩大到审查未列出的问题;manual-validation 项不在修复范围
@@ -40,7 +44,7 @@ description: >
40
44
  |------|------|
41
45
  | 「代码太简单,不需要测试」 | 简单代码也会回归;没有"失败→通过"的用例就没有完成标志,先写验证业务行为的测试。 |
42
46
  | 「先写代码再补测试更高效」 | 后补测试常沦为对实现的镜像;目标驱动应先定义可验证用例再让它通过。 |
43
- | 「方案这里不合理,顺手改更好」 | 偏离 `{plan-artifact}` 必须在报告中记录原因;有异议先停下确认,不擅自改方向。 |
47
+ | 「输入这里不合理,顺手改更好」 | 偏离 `{lifecycle-input-artifact}` 必须在报告中记录原因;有异议按任务规则处理,不擅自改方向。 |
44
48
  | 「测试过了,顺便推送一下」 | 本技能只创建本地 checkpoint;远端推送是 `create-pr` 的唯一边界。 |
45
49
  | 「审查既然写了,照着改就行」 | 审查可能基于错误 `file:line` 或幻觉;动手前先 Read/Grep 核实,成立才修,不成立就反驳并记入 unresolved,不盲从。 |
46
50
  | 「保留旧入口更稳妥,反正只多一个分支」 | 未获批准的兼容是范围扩张和长期债务;没有对象、必要性、期限和退出条件就只实现当前契约。 |
@@ -72,9 +76,8 @@ agent-infra-internal task-snapshot {task-id} --format text
72
76
 
73
77
  先检查:
74
78
  - `.agents/workspace/active/{task-id}/task.md`
75
- - 至少一个技术方案产物:`plan.md` 或 `plan-r{N}.md`
76
79
 
77
- 如果缺少任一文件,立即停止并提示用户先完成前置步骤。
80
+ 如果缺少任务文件,立即停止。生命周期输入由步骤 4 的核心查询按已选路径验证;技能不得预先固定要求方案产物。
78
81
 
79
82
  ### 2. 确保任务分支
80
83
 
@@ -105,6 +108,8 @@ status=$?
105
108
  echo "$result"
106
109
  ```
107
110
 
111
+ 若 `selection.disposition` 为 `reuse`,复用 `selection.artifact`,不得执行 started、init、代码修改或写入新产物,并直接进入完成校验与下一步提示。其他状态继续按下表处理。
112
+
108
113
  按 `$status` 与 `result.mode` 分流;二者不一致时按 `$status` 为准并报告异常:
109
114
 
110
115
  | `$status` | `result.mode` | 行动 |
@@ -118,13 +123,13 @@ echo "$result"
118
123
 
119
124
  > 双模式判定规则见 `reference/dual-mode.md`。执行此步骤前先读取 `reference/dual-mode.md`。
120
125
 
121
- ### 5. 确定输入方案
126
+ ### 5. 确定生命周期输入
122
127
 
123
- 只使用步骤 4 的结构化结果:从 `inputs` 取得 `{plan-artifact}`,从 `next_round` / `next_artifact` 取得 `{code-round}` / `{code-artifact}`;修复模式从 `review_artifact` 取得 `{review-artifact}`;裁决模式从 `implementation_input`、`decision_id`、`decision_evidence` 取得统一输入身份。不得自行扫描轮次或拼装文件名。
128
+ 只使用步骤 4 的结构化结果:从 `inputs` 取得核心选择的 `{lifecycle-input-artifact}`(精简路径为 analysis,其他路径为 plan),从 `next_round` / `next_artifact` 取得 `{code-round}` / `{code-artifact}`;修复模式从 `review_artifact` 取得 `{review-artifact}`;裁决模式从 `implementation_input`、`decision_id`、`decision_evidence` 取得统一输入身份。不得自行扫描轮次或拼装文件名。
124
129
 
125
- ### 6. 阅读技术方案
130
+ ### 6. 阅读生命周期输入
126
131
 
127
- 仔细阅读 `{plan-artifact}`,提取:
132
+ 仔细阅读 `{lifecycle-input-artifact}`,提取:
128
133
  - 实施步骤
129
134
  - 需要创建或修改的文件
130
135
  - 测试策略
@@ -237,11 +242,11 @@ agent-infra-internal task-verify {task-id} code.completed --artifact {code-artif
237
242
  ## 注意事项
238
243
 
239
244
  - 首轮实现使用 `code.md`,后续轮次使用 `code-r{N}.md`
240
- - 如偏离 `{plan-artifact}`,必须在报告中记录原因
245
+ - 如偏离 `{lifecycle-input-artifact}`,必须在报告中记录原因
241
246
  - 新测试必须验证有意义的业务行为,而不是机械透传
242
247
 
243
248
  ## 错误处理
244
249
 
245
250
  - 任务未找到:`Task {task-id} not found`
246
- - 缺少方案:`Technical plan not found, please run the plan-task skill first`
251
+ - 缺少生命周期输入:透传步骤 4 返回的 `ARTIFACT_INPUT_MISSING`,按所选路径补充 analysis 或 plan
247
252
  - 本地修复后仍无法通过测试:说明外部阻塞并停止,且不要创建实现产物
@@ -14,7 +14,7 @@ Follow the `code` step in `.agents/workflows/feature-development.yaml`.
14
14
  - [ ] follow project coding standards
15
15
 
16
16
  **Implementation principles**:
17
- 1. **Follow the plan strictly**: do not deviate from the technical plan
17
+ 1. **Follow the input strictly**: do not deviate from the analysis or plan lifecycle input selected by core
18
18
  2. **Work step by step**: execute the planned sequence
19
19
  3. **Keep testing continuously**: run the **fast smoke subset** continuously as work progresses (see the `test` skill)
20
20
  4. **Keep it simple**: do not add unplanned features
@@ -46,7 +46,7 @@ Two-way failure handling:
46
46
 
47
47
  ## Notes
48
48
 
49
- 1. **Prerequisite**: the approved technical plan must exist (`plan.md` or `plan-r{N}.md`)
49
+ 1. **Prerequisite**: the analysis or plan lifecycle input selected by core must exist
50
50
  2. **No auto-commit**: do not run `git commit` or `git add`
51
51
  3. **Test quality**: new tests must validate meaningful business logic
52
52
  4. **Code quality**: follow project coding conventions
@@ -14,7 +14,7 @@
14
14
  - [ ] 遵守项目编码规范
15
15
 
16
16
  **实现原则**:
17
- 1. **严格遵循方案**:不要偏离技术方案
17
+ 1. **严格遵循输入**:不要偏离核心选择的 analysis 或 plan 生命周期输入
18
18
  2. **按步骤推进**:按计划顺序执行
19
19
  3. **持续测试**:实现过程中持续运行 **fast smoke 子集**(参见 `test` skill)
20
20
  4. **保持简单**:不要加入未计划的功能
@@ -46,7 +46,7 @@
46
46
 
47
47
  ## 注意事项
48
48
 
49
- 1. **前置条件**:必须存在已批准的技术方案(`plan.md` 或 `plan-r{N}.md`)
49
+ 1. **前置条件**:必须存在核心按所选路径返回的 analysis 或 plan 生命周期输入
50
50
  2. **禁止自动提交**:不要执行 `git commit` 或 `git add`
51
51
  3. **测试质量**:新增测试必须验证有意义的业务逻辑
52
52
  4. **代码质量**:遵循项目编码规范
@@ -8,9 +8,9 @@ This file documents the core artifact lifecycle's code-mode decision. The `task-
8
8
  agent-infra-internal task-artifact {task-id} inspect --family code
9
9
  ```
10
10
 
11
- The core scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md` in the task directory.
11
+ The core reads the path decision from the latest analysis and selects the lifecycle input: analysis for streamlined, plan for standard or full. The full path also validates review-plan before scanning code and review-code artifacts.
12
12
 
13
- `code.started` persists the plan identity and SHA-256 for the round in task.md frontmatter. `code.completed` uses that start context and verifies the current latest plan; changed input fails closed. The implementation report's `Plan Input` field is reader-facing traceability, not lifecycle identity validation.
13
+ `code.started` persists the lifecycle input identity and SHA-256 for the round in task.md frontmatter. `code.completed` verifies the current latest input against that context; changed input fails closed. The implementation report field is reader-facing traceability only.
14
14
 
15
15
  ## Eight Branches
16
16
 
@@ -18,8 +18,8 @@ The core scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.
18
18
 
19
19
  | Condition | mode | exit | Behavior |
20
20
  |---|---|---:|---|
21
- | no code artifact, and the latest review-plan is exactly `Approved` and references the latest plan | `init` | 0 | initial implementation, output `code.md`; a missing matching approval or `Approved-with-issues` returns an error |
22
- | latest review-plan is exactly `Approved`, references the latest plan, and the latest code completion receipt does not bind the same plan digest | `init` | 0 | enter a new implementation round. `Approved-with-issues` remains parse-compatible for history but is not cross-stage approval; missing or invalid receipts fail closed |
21
+ | no code artifact and the selected lifecycle input is valid; full also requires an exactly `Approved` review-plan bound to the latest plan | `init` | 0 | initial implementation, output `code.md` |
22
+ | the latest analysis or plan lifecycle input is not bound by the latest code completion receipt | `init` | 0 | enter a new implementation round; missing or invalid receipts fail closed |
23
23
  | the latest review-code completion receipt does not bind the latest code identity/SHA | `error` | 2 | latest code is unreviewed; run `review-code`; code and review-code family rounds may advance independently |
24
24
  | latest review-code is Approved and a pending implementation input was decided after that review completed | `decision` | 0 | select the earliest `II-N` and enter decision-driven implementation; false/not-required and consumed inputs do not trigger |
25
25
  | latest review-code is Approved with 0/0/0 | `refused` | 1 | already approved; do not run `code-task` again |
@@ -8,9 +8,9 @@
8
8
  agent-infra-internal task-artifact {task-id} inspect --family code
9
9
  ```
10
10
 
11
- 核心扫描任务目录中的 `plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md` 和 `review-code.md` / `review-code-r{N}.md`。
11
+ 核心读取最新 analysis 的路径裁定,并选择生命周期输入:精简路径使用 analysis,标准或完整路径使用 plan;完整路径还校验对应 review-plan。随后扫描 code 与 review-code 产物。
12
12
 
13
- `code.started` 会在 task.md frontmatter 中绑定本轮方案文件及其 SHA-256。`code.completed` 使用该开始上下文并校验当前最新 plan;内容变化失败关闭。实现报告的“方案输入”/“Plan Input”仅供读者追溯,不参与生命周期身份校验。
13
+ `code.started` 会在 task.md frontmatter 中绑定本轮生命周期输入及其 SHA-256。`code.completed` 使用该开始上下文并校验当前最新输入;内容变化失败关闭。实现报告的“生命周期输入”仅供读者追溯,不参与生命周期身份校验。
14
14
 
15
15
  ## 8 个分支
16
16
 
@@ -18,8 +18,8 @@ agent-infra-internal task-artifact {task-id} inspect --family code
18
18
 
19
19
  | 条件 | mode | exit | 行为 |
20
20
  |---|---|---:|---|
21
- | 无 code 产物,且最新 review-plan 精确为 `Approved` 并引用最新 plan | `init` | 0 | 初次实现,产物为 `code.md`;缺少匹配审批或为 `Approved-with-issues` 时返回 error |
22
- | 最新 review-plan 精确为 `Approved`,且其「审查输入」/「Review Input」字段引用最新 plan,而最新 code 的完成 receipt 未绑定相同 plan 摘要 | `init` | 0 | plan 内容在 code 输入之后获批;进入新一轮实现。`Approved-with-issues` 仅保留历史解析兼容,不构成跨阶段批准;缺失或无效 receipt 失败关闭 |
21
+ | 无 code 产物,且所选生命周期输入有效;完整路径的最新 review-plan 还必须精确为 `Approved` 并引用最新 plan | `init` | 0 | 初次实现,产物为 `code.md` |
22
+ | 最新 analysis 或 plan 生命周期输入未被最新 code 完成 receipt 绑定 | `init` | 0 | 输入在上轮 code 后发生有效变化,进入新一轮实现;缺失或无效 receipt 失败关闭 |
23
23
  | 最新 review-code 的完成收据未绑定最新 code identity/SHA | `error` | 2 | 最新代码未审查,先运行 `review-code`;code 与 review-code 的 family 轮次可独立增长 |
24
24
  | 最新 review-code 为 Approved 且存在审查完成后产生的 pending 实现输入 | `decision` | 0 | 选择最早 `II-N`,进入裁决驱动实现;false/not-required 与 consumed 输入不触发 |
25
25
  | 最新 review-code 为 Approved 且 0/0/0 | `refused` | 1 | 已通过,无需再次运行 `code-task` |
@@ -17,7 +17,7 @@ Use this structure when creating `code.md` or `code-r{N}.md`.
17
17
  ## Implementation Input
18
18
 
19
19
  - **Mode**: {init / fix / decision}
20
- - **Plan Input**: `{plan-artifact}`
20
+ - **Lifecycle Input**: `{lifecycle-input-artifact}`
21
21
  - **Review Input**: `{review-artifact or N/A}`
22
22
  - **Decision Input**: `{implementation-input or N/A}`
23
23
  - **Ledger ID**: `{decision-id or N/A}`
@@ -17,7 +17,7 @@
17
17
  ## 实现输入
18
18
 
19
19
  - **模式**:{init / fix / decision}
20
- - **方案输入**:`{plan-artifact}`
20
+ - **生命周期输入**:`{lifecycle-input-artifact}`
21
21
  - **审查输入**:`{review-artifact 或 N/A}`
22
22
  - **裁决输入**:`{implementation-input 或 N/A}`
23
23
  - **账本 ID**:`{decision-id 或 N/A}`
@@ -21,7 +21,7 @@ Before generating the validation completion report, read `.agents/rules/evidence
21
21
  - This skill closes the manual-validation status in an existing PR summary comment; it does not create a parallel ordinary validation comment.
22
22
  - It must write `manual-validation.md` or `manual-validation-r{N}.md` so later PR summary refreshes can reuse the validation result.
23
23
  - If the `sync-pr` summary comment is missing, fail instead of creating a partial fallback summary; before the receipt, completion log, and final summary are all committed, the remote summary may only be pending/non-pass.
24
- - Before generating manual-validation artifact Markdown that will be synced to an Issue, read `.agents/rules/sync-content-generation.md` and follow its generator-side constraints; Issue sync remains transparent and does not parse or rewrite the body.
24
+ - Before generating manual-validation artifact Markdown referenced by the task comment and PR summary, read `.agents/rules/sync-content-generation.md` and follow its generator-side constraints. Keep the artifact local instead of publishing it as an Issue artifact comment.
25
25
  - After this skill runs, update `task.md` immediately.
26
26
 
27
27
  Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
@@ -106,7 +106,7 @@ The coordinator owns pending summary, receipt, completion log, final promotion,
106
106
 
107
107
  After the transaction coordinator succeeds, the core has atomically recorded `manual-validation.completed` with the same transaction/receipt/head identity. Do not append the Activity Log manually.
108
108
 
109
- If the task has a valid `platform_issue_identity`, run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`, then `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {manual-validation-artifact} --agent {standard-agent-token}`.
109
+ If the task has a valid `platform_issue_identity`, run only `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`. Keep the manual-validation artifact as local evidence and PR-summary input; do not publish it as an Issue comment.
110
110
 
111
111
  ### 8. Verification Gate
112
112
 
@@ -21,7 +21,7 @@ description: >
21
21
  - 本技能用于收尾已有 PR 摘要评论中的人工校验状态,不创建并行的普通验证留言。
22
22
  - 必须写入 `manual-validation.md` 或 `manual-validation-r{N}.md`,让后续 PR 摘要刷新可复用人工验证结果。
23
23
  - 找不到 `sync-pr` 摘要评论时失败,不创建部分摘要兜底;receipt、通过日志和 final summary 未全部提交前,远端只允许 pending/non-pass 状态。
24
- - 生成会同步到 Issue 的人工验证 artifact Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;Issue 同步保持透明,不解析或改写正文。
24
+ - 生成会由 task 评论和 PR 摘要引用的人工验证 artifact Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;人工验证 artifact 保留在本地,不发布为 Issue artifact 评论。
25
25
  - 执行本技能后必须立即更新 `task.md`。
26
26
 
27
27
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
@@ -106,7 +106,7 @@ coordinator 负责 pending summary、receipt、通过日志、final promotion
106
106
 
107
107
  transaction coordinator 成功后,核心已使用同一 transaction/receipt/head identity 原子登记 `manual-validation.completed`;不要手工补写 Activity Log。
108
108
 
109
- 如任务存在有效 `platform_issue_identity`,调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`,再调用 `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {manual-validation-artifact} --agent {standard-agent-token}`。
109
+ 如任务存在有效 `platform_issue_identity`,仅调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`。人工验证 artifact 继续作为本地证据和 PR 摘要输入,不发布为 Issue 评论。
110
110
 
111
111
  ### 8. 完成校验
112
112
 
@@ -9,7 +9,7 @@ description: >
9
9
  # Complete Task
10
10
  > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
11
11
 
12
- Host finalization uses receipt v3 with an immutable `receiptId`, monotonic `revision`, staged summary input, and canonical warnings. Lifecycle/identity/required-PR hard failures return `result: failed|blocked`; after lifecycle succeeds, comment, peripheral verification, and other sync failures return `result: completed_with_warnings` and six-field warnings, retrying only receipt-pending steps.
12
+ Host finalization uses receipt v4 with an immutable `receiptId`, monotonic `revision`, staged summary input, and canonical warnings. Lifecycle/identity/required-PR hard failures return `result: failed|blocked`; after lifecycle succeeds, it retries only receipt-pending peripheral steps or open backfill warnings. Per-check verification warnings transition by observed target: a later observation resolves the prior code while retaining its history, and unobserved targets remain unchanged.
13
13
 
14
14
 
15
15
  ## Boundary / Critical Rules
@@ -59,7 +59,7 @@ If not found in `active/`, check `blocked/` and `completed/`:
59
59
  - If in `completed/` without a matching entry: report the incomplete terminal identity and stop without hand-repairing it
60
60
  - If in `blocked/`: Inform user the task is blocked; suggest unblocking first
61
61
 
62
- Scenario A is the normal active-task path. Scenario B `finalization-retry` retries only the archived task comment and terminal gate.
62
+ Scenario A is the normal active-task path. Scenario B `finalization-retry` retries allowed artifact backfill, the terminal task comment, completion verification, and summary sealing without moving lifecycle backward.
63
63
 
64
64
  ### 2. Verify Completion Prerequisites (Failure Must Stop)
65
65
 
@@ -141,9 +141,8 @@ Check whether task.md has a valid `platform_issue_identity`. If it does not, ski
141
141
 
142
142
  When a valid `platform_issue_identity` exists, execute in this exact order:
143
143
 
144
- 1. Run `agent-infra-internal platform-comment backfill {task-id} --agent {standard-agent-token}` so core publishes only the completion canonical inventory in fixed order and resolves matching historical warnings only after full success.
145
- 2. Run `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --requirements --fields`.
146
- 3. Write the business summary to a temporary file and run `agent-infra-internal platform-comment stage-summary {task-id} --body-file {path}`. This stores the body and SHA-256 in the task's durable staging record; it must not publish the summary comment directly.
144
+ 1. Run `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --requirements --fields`.
145
+ 2. Write the business summary to a temporary file and run `agent-infra-internal platform-comment stage-summary {task-id} --body-file {path}`. This stores the body and SHA-256 in the task's durable staging record; it must not publish the summary comment directly.
147
146
 
148
147
  When the ledger contains a valid `PRC-N` post-review exemption, the summary body must mirror the ruling reason, commit scope, human identity, and time from task.md, and state that this is a human override rather than an automatic verification success. If a matching workflow warning exists, also mirror its original failure code/message. If no warning exists yet, state only that the ruling is recorded and final gate verification is pending; do not claim that the exemption has passed. The same `--kind summary` intent remains the sole owner of the summary marker.
149
148
 
@@ -152,7 +151,7 @@ Do not sync the task comment here; it requires the terminal task.md written by l
152
151
  If any operation fails, the task must remain active and its short id must remain valid. Record the failure with the matching structured warning intent, then continue to Step 5. Platform failures do not block the local lifecycle:
153
152
 
154
153
  ```bash
155
- agent-infra-internal task-warning {task-id} add --step complete-task --severity ACTION_REQUIRED --code {COMMENT_SYNC_FAILED|REQUIREMENTS_SYNC_FAILED|SUMMARY_SYNC_FAILED|NETWORK_RETRY_EXHAUSTED} --target {artifact|issue|summary|platform} --message "{error_code}: {error_message}" --action "Fix the platform sync problem and rerun complete-task"
154
+ agent-infra-internal task-warning {task-id} add --step complete-task --severity ACTION_REQUIRED --code {REQUIREMENTS_SYNC_FAILED|SUMMARY_SYNC_FAILED|NETWORK_RETRY_EXHAUSTED} --target {issue|summary|platform} --message "{error_code}: {error_message}" --action "Fix the platform sync problem and rerun complete-task"
156
155
  ```
157
156
 
158
157
  The core deduplicates the stable `step/code/target` tuple. Callers must not allocate warning ids or edit ledger rows.
@@ -177,11 +176,11 @@ If a summary must mirror a human-decided `post-review-commit` exemption, make a
177
176
  agent-infra-internal task-finalization {task-id} complete --agent {standard-agent-token}
178
177
  ```
179
178
 
180
- Finalization runs lifecycle -> terminal task comment -> core verification -> warning task-comment update -> summary -> post-summary verification in a fixed order and records every step in the host receipt. It clears the staging record only after all steps finish with no open warning. `result=completed` means the host safely completed the task from structured results and the receipt; if peripheral warnings remain, return `result=completed_with_warnings`, warnings, and pending steps. Use `result=failed` or `result=blocked` only for hard or receipt/capability failures, then fix the cause and retry through the same entry point; do not claim completion or hand-repair partial state. A sandbox must not run `ls completed` or a local terminal verification against its historical mount to re-decide this result.
179
+ Finalization runs allowed artifact backfill -> lifecycle -> terminal task comment -> core verification -> warning task-comment update -> summary seal in a fixed order. Every backfill that actually runs must reach a successful terminal result before lifecycle starts; an ordinary replay with a complete receipt and no recovery fact does not rerun backfill, comments, verification, or summary. A completed recovery that may write a managed comment first persists a done summary as pending, then seals it only at the end. Summary seal always reads the durable staging record retained in the task directory; the platform entry point validates marker, owner, and digest, performs any required delete/recreate, and reads back final remote order. `result=completed` means the host safely completed the task from structured results and the receipt; if peripheral warnings or pending steps remain, return `result=completed_with_warnings`, warnings, and pending steps. Use `result=failed` or `result=blocked` only for hard or receipt/capability failures, then fix the cause and retry through the same entry point; do not claim completion or hand-repair partial state. A sandbox must not run `ls completed` or a local terminal verification against its historical mount to re-decide this result.
181
180
 
182
181
  ### 7. Handle Finalization Retries and Results
183
182
 
184
- Both Scenario A and Scenario B `finalization-retry` run the same `task-finalization` entry point from the host. The receipt is only a re-entry hint, not canonical truth: every re-entry revalidates the terminal task comment and completion gate; only an already `completed` task with its short-id registry entry released may skip the irreversible lifecycle. Do not split the operation into the former lifecycle, comment-sync, or completion-gate commands. If the task comment or gate is blocked by the network, preserve the receipt and completed steps, fix the network, and rerun complete-task. If lifecycle has not completed, keep the task active and resume the pending steps from the receipt.
183
+ Both Scenario A and Scenario B `finalization-retry` run the same `task-finalization` entry point from the host. The receipt is only a re-entry hint, not canonical truth: every re-entry revalidates allowed artifact backfill, the terminal task comment, and completion verification, then repeats summary seal from the retained durable staging record; only an already `completed` task with its short-id registry entry released may skip the irreversible lifecycle. Do not split the operation into the former lifecycle, comment-sync, or completion-gate commands. If backfill, the task comment, summary seal, or verification is blocked by the network, preserve the receipt, durable staging record, and completed steps, fix the network, and rerun complete-task. If lifecycle has not completed, keep the task active and resume the pending steps from the receipt.
185
184
 
186
185
  Consume the structured finalization result, receipt, and warning projection directly. Continue only for `completed` or `completed_with_warnings`; preserve the receipt and stop for `failed`, `blocked`, or `unknown`, then retry through the same finalization entry point. Do not run `ls completed` or `task-verify complete-task.completed` from a stale sandbox mount, and do not let that local result overrule the host result.
187
186
 
@@ -9,7 +9,7 @@ description: >
9
9
  # 完成任务
10
10
  > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
- 宿主 finalization 使用 receipt v3(不可变 `receiptId`、单调 `revision`、摘要暂存和 canonical warnings)。生命周期/身份/required PR 等硬失败返回 `result: failed|blocked`;生命周期完成后,评论、外围验证和其他同步失败返回 `result: completed_with_warnings` 及六字段 warning,并仅重试 receipt 中的 pending step。
12
+ 宿主 finalization 使用 receipt v4(不可变 `receiptId`、单调 `revision`、摘要暂存和 canonical warnings)。生命周期/身份/required PR 等硬失败返回 `result: failed|blocked`;生命周期完成后,只重试 receipt 指出的 pending 外围步骤或 open backfill warning。逐检查 verification warning 以 observed target 为单位转换:新观察替代旧 code 时保留旧行 resolved 历史,未观察的 target 不变。
13
13
 
14
14
 
15
15
  ## 行为边界 / 关键规则
@@ -58,7 +58,7 @@ agent-infra-internal task-snapshot {task-id} --format text
58
58
  - 如果在 `completed/` 但缺少匹配日志:告知用户任务已完成但终态身份不完整并停止,不手工修补
59
59
  - 如果在 `blocked/`:告知用户任务被阻塞;建议先解除阻塞
60
60
 
61
- 场景 A 为 active 任务的正常完成路径;场景 B `finalization-retry` 只重试归档后的 task 评论与终态门禁。
61
+ 场景 A 为 active 任务的正常完成路径;场景 B `finalization-retry` 重试允许的 artifact 回填、终态 task 评论、完成校验和摘要封口,不回迁生命周期。
62
62
 
63
63
  ### 2. 验证完成前置条件(未满足则必须停止)
64
64
 
@@ -140,9 +140,8 @@ Please satisfy the hard prerequisite first, then retry complete-task.
140
140
 
141
141
  如果存在有效的 `platform_issue_identity`,严格按以下顺序执行:
142
142
 
143
- 1. 调用 `agent-infra-internal platform-comment backfill {task-id} --agent {standard-agent-token}`,由 core 仅按 completion canonical inventory 固定顺序补发产物并在全部成功后精确恢复目标历史告警。
144
- 2. 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --requirements --fields`。
145
- 3. 把业务摘要写入临时文件,并调用 `agent-infra-internal platform-comment stage-summary {task-id} --body-file {path}`。该命令把正文和 SHA-256 写入 task 目录的 durable staging record;本步骤不得直接发布 summary 评论。
143
+ 1. 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --requirements --fields`。
144
+ 2. 把业务摘要写入临时文件,并调用 `agent-infra-internal platform-comment stage-summary {task-id} --body-file {path}`。该命令把正文和 SHA-256 写入 task 目录的 durable staging record;本步骤不得直接发布 summary 评论。
146
145
 
147
146
  若账本含合法的 `PRC-N` post-review 豁免,摘要正文必须镜像 task.md 中的裁决理由、提交范围、人工身份与时间,并明确这是人工覆盖而非自动校验成功。已有匹配 workflow warning 时,同时镜像其原始 failure code/message;尚无 warning 时只写“裁决已记录、最终门禁待验证”,不得提前宣称豁免已通过。summary marker 仍由同一 `--kind summary` intent 唯一维护。
148
147
 
@@ -151,7 +150,7 @@ Please satisfy the hard prerequisite first, then retry complete-task.
151
150
  任一操作失败时,任务仍必须位于 active 且短号仍有效;按失败类型调用以下结构化 warning intent,随后继续步骤 5。平台失败不会阻止本地生命周期。
152
151
 
153
152
  ```bash
154
- agent-infra-internal task-warning {task-id} add --step complete-task --severity ACTION_REQUIRED --code {COMMENT_SYNC_FAILED|REQUIREMENTS_SYNC_FAILED|SUMMARY_SYNC_FAILED|NETWORK_RETRY_EXHAUSTED} --target {artifact|issue|summary|platform} --message "{error_code}: {error_message}" --action "修复平台同步问题后重跑 complete-task"
153
+ agent-infra-internal task-warning {task-id} add --step complete-task --severity ACTION_REQUIRED --code {REQUIREMENTS_SYNC_FAILED|SUMMARY_SYNC_FAILED|NETWORK_RETRY_EXHAUSTED} --target {issue|summary|platform} --message "{error_code}: {error_message}" --action "修复平台同步问题后重跑 complete-task"
155
154
  ```
156
155
 
157
156
  相同 `step/code/target` 组合由核心幂等去重;调用方不分配 warning id 或手写账本行。
@@ -176,11 +175,11 @@ agent-infra-internal task-verify {task-id} complete-task.preflight --format text
176
175
  agent-infra-internal task-finalization {task-id} complete --agent {standard-agent-token}
177
176
  ```
178
177
 
179
- finalization 按 lifecycle → task 评论 → core verification → warning task 评论更新 → summary → post-summary verification 的固定顺序执行,并将每一步的状态写入宿主 receipt。summary 使用暂存正文;仅在所有步骤完成且无未解决 warning 后清理 staging record。`result=completed` 即表示宿主已依据结构化结果和 receipt 安全完成;若还有外围 warning,返回 `result=completed_with_warnings`、warnings 和 pending steps。`result=failed` 或 `result=blocked` 仅用于硬失败或 receipt/capability 失败,修复原因后以同一入口重试,不得宣称完成或手工补写局部状态。沙箱不得从旧挂载执行 `ls completed` 或本地终态校验来重新裁决该结果。
178
+ finalization 按允许的 artifact backfill → lifecycle → task 评论 → core verification → warning task 评论更新 → summary seal 的固定顺序执行。每项实际运行的 backfill 必须取得成功终态,否则不得进入 lifecycle;完整 receipt 且无恢复事实的普通重入不执行 backfill、评论、验证或 summary。任何可能写入 managed comment 的 completed 恢复会先把 done summary 持久化为 pending,恢复末尾才重新 seal。summary seal 始终读取任务目录中保留的 durable staging record;平台入口负责校验 marker、owner 和 digest,必要时删除并重建摘要,再复读最终远端顺序。`result=completed` 即表示宿主已依据结构化结果和 receipt 安全完成;若还有外围 warning 或 pending step,返回 `result=completed_with_warnings`、warnings 和 pending steps。`result=failed` 或 `result=blocked` 仅用于硬失败或 receipt/capability 失败,修复原因后以同一入口重试,不得宣称完成或手工补写局部状态。沙箱不得从旧挂载执行 `ls completed` 或本地终态校验来重新裁决该结果。
180
179
 
181
180
  ### 7. 处理 finalization 重试与结果
182
181
 
183
- 场景 A 与场景 B `finalization-retry` 都从宿主执行同一个 `task-finalization` 入口。receipt 只是重入提示,不是 canonical truth:每次重入都要重新验证终态 task 评论和完成校验;只有任务已处于 `completed` 且短号 registry 已释放时,才可跳过不可逆的 lifecycle。不得拆开调用旧的 lifecycle、评论同步或完成校验命令。若 task 评论或校验因网络问题返回 `blocked`,保留 receipt 和已完成状态,修复网络后重跑 complete-task;若生命周期仍未完成,任务保持 active 并从 receipt 的待处理步骤继续。
182
+ 场景 A 与场景 B `finalization-retry` 都从宿主执行同一个 `task-finalization` 入口。receipt 只是重入提示,不是 canonical truth:每次重入都要重新核对允许的 artifact 回填、终态 task 评论、完成校验,并使用保留的 durable staging record 重做 summary seal;只有任务已处于 `completed` 且短号 registry 已释放时,才可跳过不可逆的 lifecycle。不得拆开调用旧的 lifecycle、评论同步或完成校验命令。若回填、task 评论、summary seal 或校验因网络问题返回 `blocked`,保留 receipt、durable staging record 和已完成状态,修复网络后重跑 complete-task;若生命周期仍未完成,任务保持 active 并从 receipt 的待处理步骤继续。
184
183
 
185
184
  完成结果必须直接消费本次宿主 finalization 的结构化输出、receipt 和 warning projection。`completed` 或 `completed_with_warnings` 才允许继续;`failed` / `blocked` / `unknown` 必须保留 receipt 并停止,之后通过同一 finalization 入口重试。不要在沙箱旧挂载中另行运行 `ls completed` 或 `task-verify complete-task.completed`,也不要用其结果推翻宿主结果。
186
185
 
@@ -13,13 +13,17 @@ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--or
13
13
 
14
14
  ## Boundary / Critical Rules
15
15
 
16
+ ### Path and rework
17
+
18
+ This stage consumes only the canonical path fact parsed by core from the latest valid analysis artifact; a stage omitted by that path must not create an artifact. When another Changes Requested verdict follows one completed revision-review cycle in the same stage, classify the rework before the next executor artifact and bind it to the finding, source SHA, and stable task-fact digest. A round or filename change is not new evidence.
19
+
16
20
  ### Persisted Report Evidence
17
21
 
18
22
  Before generating the plan report, read `.agents/rules/evidence-reporting.md`. Record the command, target scope, status or structured result, actual result, and uncovered parts for state checks and verification; include decisive raw excerpts only for failures, blocking conditions, or disputes.
19
23
 
20
24
  - When evaluating candidate qualification or `HD-N`, read `.agents/rules/decision-qualification.md`, audit normalized task constraints/candidates, and record the five qualification-audit tables in the plan artifact; unknown or unconfirmed constraints must not automatically exclude a candidate
21
25
  - This skill only outputs a technical plan document (`plan.md` or `plan-r{N}.md`) and does not modify any business code
22
- - This is a **mandatory human review checkpoint**; do not automatically proceed to implementation
26
+ - The full path proceeds to plan review; the standard path may proceed directly to implementation
23
27
  - Before generating task or lifecycle Markdown that will be synchronized to an Issue, read `.agents/rules/sync-content-generation.md` and apply its producer-side constraints; the sync path does not parse or rewrite the body
24
28
  - When the plan touches compatibility, migration, old formats, or old entry points, read `.agents/rules/compatibility-policy.md` first. Do not design adapters, shims, dual writes, or parallel state machines without passing its admission gate
25
29
  - After executing this skill, you **must** immediately update task status in task.md
@@ -62,7 +66,7 @@ If any required file is missing, prompt the user to complete the prerequisite st
62
66
 
63
67
  ### 2. Resolve the Artifact Context
64
68
 
65
- Run `agent-infra-internal task-artifact {task-id} inspect --family plan`. Continue only for `ready`; take the latest `{analysis-artifact}` from `inputs` and `{plan-round}` / `{plan-artifact}` from `next.round` / `next.name`. Do not scan rounds or construct names in the skill. Then run the started event and verify the returned identity.
69
+ Run `agent-infra-internal task-artifact {task-id} inspect --family plan`. Continue only for `ready`. When `selection.disposition` is `reuse`, reuse `selection.artifact`, do not run started/init or write a new artifact, and continue directly to completion verification and next-step guidance. Otherwise take the latest `{analysis-artifact}` from `inputs` and `{plan-round}` / `{plan-artifact}` from `next.round` / `next.name`. Do not scan rounds or construct names in the skill. Then run the started event and verify the returned identity.
66
70
 
67
71
  ### 3. Read Requirements Analysis
68
72
 
@@ -169,7 +173,9 @@ Keep the gate output in your reply as fresh evidence. Do not claim completion wi
169
173
  > Before rendering next steps, read `.agents/rules/next-step-output.md`, invoke the shared helper only for the selected scenario, and insert its stdout at `{next-step-commands}`.
170
174
 
171
175
  Output format:
172
- Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill review-plan --task-ref {task-ref}`.
176
+ Select one command from the canonical path to populate `{next-step-commands}`:
177
+ - Standard: `agent-infra-internal agent-client next-steps --skill code-task --task-ref {task-ref}`
178
+ - Full: `agent-infra-internal agent-client next-steps --skill review-plan --task-ref {task-ref}`
173
179
 
174
180
  ```
175
181
  Technical plan complete for task {task-id}.
@@ -184,10 +190,7 @@ Plan summary:
184
190
  Output file:
185
191
  - Technical plan: .agents/workspace/active/{task-id}/{plan-artifact}
186
192
 
187
- Important: human review checkpoint.
188
- Please review the technical plan before continuing to implementation.
189
-
190
- Next step - review the technical plan:
193
+ Next step - continue on the selected path:
191
194
  {next-step-commands}
192
195
  ```
193
196
 
@@ -201,18 +204,18 @@ Next step - review the technical plan:
201
204
  - [ ] Recorded `{plan-artifact}` as a completed artifact in task.md
202
205
  - [ ] Marked technical-design as complete in workflow progress
203
206
  - [ ] Appended an Activity Log entry to task.md
204
- - [ ] Informed the user that this is a human review checkpoint
207
+ - [ ] Selected code implementation or plan review from the canonical path
205
208
  - [ ] Rendered the selected next-step commands through the shared helper
206
209
 
207
210
  ## STOP
208
211
 
209
212
  After completing the checklist, **stop immediately**.
210
- This is a **mandatory human review checkpoint**; the user must review and approve the plan before implementation can continue.
213
+ The full path proceeds to plan review here; the standard path proceeds directly to code implementation.
211
214
 
212
215
  ## Notes
213
216
 
214
217
  1. **Prerequisite**: at least one round of requirements analysis must already be complete (`analysis.md` or `analysis-r{N}.md` exists)
215
- 2. **Human review**: this is a mandatory checkpoint; do not automatically proceed to implementation
218
+ 2. **Next stage**: standard proceeds to code implementation; full proceeds to plan review
216
219
  3. **Plan quality**: the plan should be detailed enough that another AI agent can implement it without extra context
217
220
  4. **Versioning rule**: the first plan uses `plan.md`; later revisions use `plan-r{N}.md`
218
221
 
@@ -13,6 +13,10 @@ description: >
13
13
 
14
14
  ## 行为边界 / 关键规则
15
15
 
16
+ ### 路径与返工
17
+
18
+ 本阶段只消费核心从最新有效分析产物解析出的规范路径事实;未被所选路径包含的阶段不得创建产物。同阶段完成一次修订—复审后再次收到 Changes Requested 时,必须在下一执行产物前提交绑定 finding、来源 SHA 和稳定任务事实摘要的返工分类;轮次或文件名变化不是新证据。
19
+
16
20
  ### 持久化报告证据
17
21
 
18
22
  生成方案报告时,先读取 `.agents/rules/evidence-reporting.md`。状态核对和验证记录命令、目标范围、状态/结构化结果、实际结果和未覆盖部分;失败、阻塞或争议才附决定性原文摘录。
@@ -20,7 +24,7 @@ description: >
20
24
  - 涉及候选资格或 `HD-N` 判断时,先读取 `.agents/rules/decision-qualification.md`,基于 task.md 规范化约束/候选完成资格审计,并在方案产物记录五张资格审计表;不得把来源不明或未确认约束自动升级为排除条件
21
25
  - 本技能仅产出技术方案文档(`plan.md` 或 `plan-r{N}.md`)—— 不修改任何业务代码
22
26
  - 生成会同步到 Issue 的任务或生命周期 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;同步端不解析或改写正文
23
- - 这是一个**强制性的人工审查检查点** —— 不要自动进入实现阶段
27
+ - 完整路径进入方案审查;标准路径完成方案后可直接进入实现阶段
24
28
  - 方案涉及兼容、迁移、旧格式或旧入口时,先读取 `.agents/rules/compatibility-policy.md`;未通过准入门槛时不得设计 adapter、shim、双写或并行状态机
25
29
  - 执行本技能后,你**必须**立即更新 task.md 中的任务状态
26
30
 
@@ -65,7 +69,7 @@ agent-infra-internal task-event {task-id} plan.started --agent {standard-agent-t
65
69
 
66
70
  ### 2. 解析方案上下文
67
71
 
68
- 运行 `agent-infra-internal task-artifact {task-id} inspect --family plan`。仅当结果为 `ready` 时继续;从 `inputs` 取得最新 `{analysis-artifact}`,从 `next.round` / `next.name` 取得 `{plan-round}` / `{plan-artifact}`。不得自行扫描轮次或拼装文件名。随后执行 started 事件并复核返回身份。
72
+ 运行 `agent-infra-internal task-artifact {task-id} inspect --family plan`。仅当结果为 `ready` 时继续。若 `selection.disposition` 为 `reuse`,复用 `selection.artifact`,不得执行 started、init 或写入新产物,并直接进入完成校验与下一步提示。其他状态从 `inputs` 取得最新 `{analysis-artifact}`,从 `next.round` / `next.name` 取得 `{plan-round}` / `{plan-artifact}`;不得自行扫描轮次或拼装文件名。随后执行 started 事件并复核返回身份。
69
73
 
70
74
  ### 3. 阅读需求分析
71
75
 
@@ -165,7 +169,9 @@ agent-infra-internal task-verify {task-id} plan.completed --artifact {plan-artif
165
169
  > 渲染下一步前先读取 `.agents/rules/next-step-output.md`,仅为已选场景调用统一 helper,并将 stdout 填入 `{next-step-commands}`。
166
170
 
167
171
  输出格式:
168
- 使用 `agent-infra-internal agent-client next-steps --skill review-plan --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
172
+ 按分析中的规范路径选择一条命令生成 `{next-step-commands}`:
173
+ - 标准路径:`agent-infra-internal agent-client next-steps --skill code-task --task-ref {task-ref}`
174
+ - 完整路径:`agent-infra-internal agent-client next-steps --skill review-plan --task-ref {task-ref}`
169
175
 
170
176
  ```
171
177
  任务 {task-id} 技术方案完成。
@@ -180,10 +186,7 @@ agent-infra-internal task-verify {task-id} plan.completed --artifact {plan-artif
180
186
  产出文件:
181
187
  - 技术方案:.agents/workspace/active/{task-id}/{plan-artifact}
182
188
 
183
- 重要:人工审查检查点。
184
- 请在继续实现之前审查技术方案。
185
-
186
- 下一步 - 审查技术方案:
189
+ 下一步 - 按所选路径继续:
187
190
  {next-step-commands}
188
191
  ```
189
192
 
@@ -197,18 +200,18 @@ agent-infra-internal task-verify {task-id} plan.completed --artifact {plan-artif
197
200
  - [ ] 在 task.md 中记录了 `{plan-artifact}` 为已完成产物
198
201
  - [ ] 在工作流进度中标记了 technical-design 为已完成
199
202
  - [ ] 追加了 Activity Log 条目到 task.md
200
- - [ ] 告知了用户这是人工审查检查点
203
+ - [ ] 已按所选路径选择代码实现或方案审查
201
204
  - [ ] 已通过统一 helper 渲染已选场景的下一步命令
202
205
 
203
206
  ## 停止
204
207
 
205
208
  完成检查清单后,**立即停止**。
206
- 这是一个**强制性的人工审查检查点** —— 用户必须审查并批准计划后才能继续实现。
209
+ 完整路径在此进入方案审查;标准路径直接进入代码实现。
207
210
 
208
211
  ## 注意事项
209
212
 
210
213
  1. **前置条件**:必须已完成至少一轮需求分析(`analysis.md` 或 `analysis-r{N}.md` 存在)
211
- 2. **人工审查**:这是强制性检查点 —— 不要自动进入实现阶段
214
+ 2. **后续阶段**:标准路径进入代码实现,完整路径进入方案审查
212
215
  3. **计划质量**:计划应足够具体,使另一个 AI 代理无需额外上下文即可实现
213
216
  4. **版本化规则**:首轮方案使用 `plan.md`;后续修订使用 `plan-r{N}.md`
214
217