@fitlab-ai/agent-infra 0.9.10 → 0.9.11

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 (269) hide show
  1. package/README.md +13 -3
  2. package/README.zh-CN.md +13 -3
  3. package/bin/cli.ts +17 -4
  4. package/dist/bin/cli.js +19 -4
  5. package/dist/bin/internal-cli.js +50 -4
  6. package/dist/lib/agent-client.js +0 -1
  7. package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
  8. package/dist/lib/agent-clients/adapters/traecli.js +7 -8
  9. package/dist/lib/agent-clients/config.js +14 -99
  10. package/dist/lib/agent-clients/reconcile.js +1 -11
  11. package/dist/lib/agent-clients/schema.js +5 -4
  12. package/dist/lib/agent-clients/tokens.js +5 -15
  13. package/dist/lib/decide.js +14 -30
  14. package/dist/lib/defaults.json +4 -0
  15. package/dist/lib/init.js +2 -2
  16. package/dist/lib/internal/release-workflow.js +0 -1
  17. package/dist/lib/internal/task-finalization.js +19 -9
  18. package/dist/lib/internal/task-ledger.js +8 -2
  19. package/dist/lib/internal/task-lifecycle.js +17 -93
  20. package/dist/lib/internal/task-orchestration.js +30 -216
  21. package/dist/lib/internal/task-validate.js +2 -1
  22. package/dist/lib/merge.js +205 -103
  23. package/dist/lib/process-data/normalize.js +2 -9
  24. package/dist/lib/run/host.js +46 -16
  25. package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
  26. package/dist/lib/sandbox/commands/create.js +3 -3
  27. package/dist/lib/sandbox/commands/enter.js +18 -4
  28. package/dist/lib/sandbox/config.js +3 -12
  29. package/dist/lib/sandbox/control/executor.js +131 -39
  30. package/dist/lib/sandbox/control/lifecycle.js +29 -20
  31. package/dist/lib/sandbox/control/server.js +18 -16
  32. package/dist/lib/sandbox/mounts.js +3 -2
  33. package/dist/lib/sandbox/recovery.js +123 -22
  34. package/dist/lib/sandbox/workspace-identity.js +14 -0
  35. package/dist/lib/sandbox/workspace-view.js +8 -9
  36. package/dist/lib/self-update.js +278 -0
  37. package/dist/lib/server/protocol.js +5 -5
  38. package/dist/lib/task/activity-log.js +4 -1
  39. package/dist/lib/task/artifact-lifecycle.js +4 -2
  40. package/dist/lib/task/codex-orchestration.js +1 -1
  41. package/dist/lib/task/command-options.js +1 -3
  42. package/dist/lib/task/commands/cat.js +0 -5
  43. package/dist/lib/task/commands/decisions.js +76 -92
  44. package/dist/lib/task/commands/files.js +6 -6
  45. package/dist/lib/task/commands/grep.js +25 -61
  46. package/dist/lib/task/commands/issue-body.js +6 -6
  47. package/dist/lib/task/commands/log.js +25 -10
  48. package/dist/lib/task/commands/show.js +5 -6
  49. package/dist/lib/task/commands/status.js +8 -8
  50. package/dist/lib/task/commit-operation.js +21 -25
  51. package/dist/lib/task/commit-policy.js +1 -1
  52. package/dist/lib/task/control-authority.js +431 -0
  53. package/dist/lib/task/create.js +6 -1
  54. package/dist/lib/task/current-contract.js +35 -0
  55. package/dist/lib/task/decision-details.js +263 -0
  56. package/dist/lib/task/decision-intents.js +5 -2
  57. package/dist/lib/task/events.js +11 -5
  58. package/dist/lib/task/index.js +19 -20
  59. package/dist/lib/task/ledger-intents.js +8 -9
  60. package/dist/lib/task/ledger.js +13 -6
  61. package/dist/lib/task/lifecycle.js +16 -0
  62. package/dist/lib/task/orchestration.js +50 -13
  63. package/dist/lib/task/review-artifacts.js +31 -12
  64. package/dist/lib/task/review-finalization.js +19 -6
  65. package/dist/lib/task/verification-engine.js +38 -15
  66. package/dist/lib/task/verification-review.js +1 -1
  67. package/dist/lib/task/workspace-snapshot.js +5 -11
  68. package/dist/lib/task/write.js +11 -1
  69. package/dist/lib/update.js +6 -37
  70. package/dist/lib/version.js +5 -1
  71. package/dist/lifecycle-build-manifest.json +3 -3
  72. package/lib/agent-client.ts +0 -1
  73. package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
  74. package/lib/agent-clients/adapters/traecli.ts +7 -8
  75. package/lib/agent-clients/config.ts +14 -144
  76. package/lib/agent-clients/reconcile.ts +1 -12
  77. package/lib/agent-clients/schema.ts +5 -4
  78. package/lib/agent-clients/tokens.ts +5 -18
  79. package/lib/decide.ts +12 -22
  80. package/lib/defaults.json +4 -0
  81. package/lib/init.ts +2 -2
  82. package/lib/internal/release-workflow.ts +0 -1
  83. package/lib/internal/task-finalization.ts +27 -13
  84. package/lib/internal/task-ledger.ts +8 -2
  85. package/lib/internal/task-lifecycle.ts +33 -76
  86. package/lib/internal/task-orchestration.ts +33 -190
  87. package/lib/internal/task-validate.ts +3 -2
  88. package/lib/merge.ts +236 -120
  89. package/lib/process-data/normalize.ts +2 -8
  90. package/lib/run/host.ts +63 -14
  91. package/lib/sandbox/agent-client-reconciler.ts +5 -15
  92. package/lib/sandbox/commands/create.ts +4 -4
  93. package/lib/sandbox/commands/enter.ts +24 -4
  94. package/lib/sandbox/config.ts +2 -14
  95. package/lib/sandbox/control/container-identity.ts +2 -2
  96. package/lib/sandbox/control/executor.ts +148 -51
  97. package/lib/sandbox/control/lifecycle.ts +34 -28
  98. package/lib/sandbox/control/protocol.ts +1 -3
  99. package/lib/sandbox/control/server.ts +15 -12
  100. package/lib/sandbox/control/state.ts +7 -7
  101. package/lib/sandbox/mounts.ts +4 -3
  102. package/lib/sandbox/recovery.ts +162 -34
  103. package/lib/sandbox/tools.ts +1 -1
  104. package/lib/sandbox/workspace-identity.ts +28 -0
  105. package/lib/sandbox/workspace-view.ts +14 -10
  106. package/lib/self-update.ts +341 -0
  107. package/lib/server/protocol.ts +5 -5
  108. package/lib/task/activity-log.ts +6 -1
  109. package/lib/task/artifact-lifecycle.ts +5 -3
  110. package/lib/task/codex-orchestration.ts +2 -1
  111. package/lib/task/command-options.ts +1 -2
  112. package/lib/task/commands/cat.ts +0 -4
  113. package/lib/task/commands/decisions.ts +80 -75
  114. package/lib/task/commands/files.ts +6 -6
  115. package/lib/task/commands/grep.ts +23 -51
  116. package/lib/task/commands/issue-body.ts +6 -6
  117. package/lib/task/commands/log.ts +22 -10
  118. package/lib/task/commands/show.ts +5 -6
  119. package/lib/task/commands/status.ts +8 -8
  120. package/lib/task/commit-operation.ts +25 -30
  121. package/lib/task/commit-policy.ts +1 -2
  122. package/lib/task/control-authority.ts +563 -0
  123. package/lib/task/create.ts +6 -1
  124. package/lib/task/current-contract.ts +49 -0
  125. package/lib/task/decision-details.ts +340 -0
  126. package/lib/task/decision-intents.ts +7 -2
  127. package/lib/task/events.ts +10 -5
  128. package/lib/task/index.ts +19 -20
  129. package/lib/task/ledger-intents.ts +6 -8
  130. package/lib/task/ledger.ts +17 -7
  131. package/lib/task/lifecycle.ts +20 -0
  132. package/lib/task/orchestration.ts +40 -15
  133. package/lib/task/review-artifacts.ts +53 -15
  134. package/lib/task/review-finalization.ts +33 -7
  135. package/lib/task/verification-engine.ts +33 -18
  136. package/lib/task/verification-review.ts +1 -1
  137. package/lib/task/workspace-snapshot.ts +4 -13
  138. package/lib/task/write.ts +20 -1
  139. package/lib/update.ts +6 -40
  140. package/lib/version.ts +6 -1
  141. package/package.json +1 -1
  142. package/templates/.agents/README.en.md +5 -3
  143. package/templates/.agents/README.zh-CN.md +5 -3
  144. package/templates/.agents/rules/compatibility-policy.en.md +5 -4
  145. package/templates/.agents/rules/compatibility-policy.zh-CN.md +5 -4
  146. package/templates/.agents/rules/create-issue.github.en.md +1 -1
  147. package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
  148. package/templates/.agents/rules/human-decision-context.en.md +9 -7
  149. package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
  150. package/templates/.agents/rules/issue-fields.github.en.md +1 -1
  151. package/templates/.agents/rules/issue-fields.github.zh-CN.md +1 -1
  152. package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
  153. package/templates/.agents/rules/issue-pr-commands.github.en.md +1 -1
  154. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +1 -1
  155. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
  156. package/templates/.agents/rules/issue-sync.github.en.md +1 -1
  157. package/templates/.agents/rules/issue-sync.github.zh-CN.md +2 -2
  158. package/templates/.agents/rules/milestone-inference.github.en.md +1 -1
  159. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +1 -1
  160. package/templates/.agents/rules/next-step-output.en.md +3 -3
  161. package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
  162. package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
  163. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
  164. package/templates/.agents/rules/pr-sync.en.md +1 -1
  165. package/templates/.agents/rules/pr-sync.github.en.md +1 -1
  166. package/templates/.agents/rules/pr-sync.github.zh-CN.md +1 -1
  167. package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
  168. package/templates/.agents/rules/release-commands.github.en.md +6 -0
  169. package/templates/.agents/rules/release-commands.github.zh-CN.md +6 -0
  170. package/templates/.agents/rules/review-handshake.en.md +1 -1
  171. package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
  172. package/templates/.agents/rules/task-management.en.md +1 -2
  173. package/templates/.agents/rules/task-management.zh-CN.md +1 -2
  174. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
  175. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
  176. package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
  177. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  178. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  179. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  180. package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
  181. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
  182. package/templates/.agents/skills/close-codescan/SKILL.en.md +1 -1
  183. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -1
  184. package/templates/.agents/skills/close-dependabot/SKILL.en.md +1 -1
  185. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -1
  186. package/templates/.agents/skills/code-task/SKILL.en.md +3 -3
  187. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +3 -3
  188. package/templates/.agents/skills/commit/SKILL.en.md +27 -7
  189. package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -4
  190. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -5
  191. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -5
  192. package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
  193. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
  194. package/templates/.agents/skills/create-pr/SKILL.en.md +5 -7
  195. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +5 -7
  196. package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -4
  197. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -4
  198. package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
  199. package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
  200. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
  201. package/templates/.agents/skills/create-task/SKILL.en.md +1 -1
  202. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -1
  203. package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
  204. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
  205. package/templates/.agents/skills/plan-task/SKILL.en.md +3 -3
  206. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +3 -3
  207. package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
  208. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
  209. package/templates/.agents/skills/review-analysis/SKILL.en.md +5 -3
  210. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +5 -3
  211. package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
  212. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
  213. package/templates/.agents/skills/review-code/SKILL.en.md +5 -3
  214. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -3
  215. package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
  216. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
  217. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +2 -1
  218. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +2 -1
  219. package/templates/.agents/skills/review-plan/SKILL.en.md +5 -3
  220. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +5 -3
  221. package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
  222. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
  223. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +4 -0
  224. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +4 -0
  225. package/templates/.agents/skills/run-task/SKILL.en.md +4 -0
  226. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +4 -0
  227. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
  228. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
  229. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +140 -109
  230. package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
  231. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
  232. package/templates/.agents/templates/task.en.md +1 -1
  233. package/templates/.agents/templates/task.zh-CN.md +1 -1
  234. package/templates/.claude/commands/analyze-task.en.md +1 -1
  235. package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
  236. package/templates/.claude/commands/block-task.en.md +1 -1
  237. package/templates/.claude/commands/block-task.zh-CN.md +1 -1
  238. package/templates/.claude/commands/cancel-task.en.md +1 -1
  239. package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
  240. package/templates/.claude/commands/check-task.en.md +1 -1
  241. package/templates/.claude/commands/check-task.zh-CN.md +1 -1
  242. package/templates/.claude/commands/code-task.en.md +1 -1
  243. package/templates/.claude/commands/code-task.zh-CN.md +1 -1
  244. package/templates/.claude/commands/commit.en.md +1 -1
  245. package/templates/.claude/commands/commit.zh-CN.md +1 -1
  246. package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
  247. package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
  248. package/templates/.claude/commands/complete-task.en.md +1 -1
  249. package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
  250. package/templates/.claude/commands/create-pr.en.md +1 -1
  251. package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
  252. package/templates/.claude/commands/plan-task.en.md +1 -1
  253. package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
  254. package/templates/.claude/commands/review-analysis.en.md +1 -1
  255. package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
  256. package/templates/.claude/commands/review-code.en.md +1 -1
  257. package/templates/.claude/commands/review-code.zh-CN.md +1 -1
  258. package/templates/.claude/commands/review-plan.en.md +1 -1
  259. package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
  260. package/templates/.claude/commands/run-manual-validation.en.md +1 -1
  261. package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
  262. package/templates/.claude/commands/run-task.en.md +1 -1
  263. package/templates/.claude/commands/run-task.zh-CN.md +1 -1
  264. package/templates/.claude/commands/watch-pr.en.md +1 -1
  265. package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
  266. package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.en.md +0 -1
  267. package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.zh-CN.md +0 -1
  268. package/dist/lib/builtin-tuis.js +0 -40
  269. package/lib/builtin-tuis.ts +0 -56
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Create Pull Request
9
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
9
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
12
  Create a Pull Request and, when task-related, sync the essential metadata and reviewer summary immediately.
@@ -19,7 +19,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
19
19
 
20
20
  ## Task Context Resolution
21
21
 
22
- > The entry point may omit the task ref and also accepts a legacy positional ref or `--task <ref>` / `-t <ref>`. Separate task scope from the full arguments while preserving every business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty, one positional ref, or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to that full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
22
+ > The entry point may omit the task ref; explicit task scope accepts only `--task <ref>` or `-t <ref>`, and positional task refs are not interpreted. Preserve every other business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to the full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
23
23
 
24
24
  ## Step Start: started Marker
25
25
 
@@ -45,9 +45,7 @@ No Pull Request is required; run instead:
45
45
 
46
46
  ### 1. Parse Command Arguments
47
47
 
48
- Identify arguments from the command input:
49
- - arguments matching `TASK-{yyyyMMdd-HHmmss}` -> `{task-id}`
50
- - remaining arguments -> `{target-branch}`
48
+ Parse the task scope first: an optional `--task <ref>` or `-t <ref>` selects `{task-id}`; a positional task ref is not interpreted. The remaining positional argument, when present, is `{target-branch}`.
51
49
 
52
50
  If `{task-id}` is provided, read `.agents/workspace/active/{task-id}/task.md` to load task metadata such as `issue_number` and `type`.
53
51
  If `{task-id}` is omitted, try to resolve it from the current session context; if it still cannot be determined, skip task-association logic in later steps.
@@ -80,9 +78,9 @@ Capture the `result` field from `platform-pr create` (`pr_created`, `pr_reused`,
80
78
 
81
79
  ### 7. Generate the PR Code Change Report
82
80
 
83
- After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` to classify the complete PR additions/deletions, renames, and potentially unnecessary changes. Read that reference before this step.
81
+ After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` to classify the complete PR line counts, Git blob byte sizes, renames, and potentially unnecessary changes. Read that reference before this step.
84
82
 
85
- The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only a grand total or inspect only the last commit.
83
+ The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only total lines, omit byte changes, or inspect only the last commit.
86
84
 
87
85
  ### 8. Publish the Review Summary
88
86
 
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # 创建 Pull Request
9
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
9
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
12
  创建 Pull Request,并在与任务关联时立即补齐核心元数据和 reviewer 摘要。
@@ -19,7 +19,7 @@ description: >
19
19
 
20
20
  ## 任务上下文解析
21
21
 
22
- > 入口允许省略 task ref,也接受旧位置 task ref 或 `--task <ref>` / `-t <ref>`。先从完整参数中分离 task scope 并原样保留其他业务操作数,再调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空、位置 ref 或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为该完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
22
+ > 入口可省略 task ref;显式 task scope 仅接受 `--task <ref>` 或 `-t <ref>`,不再解释位置 task ref。保留其余业务操作数后调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
23
23
 
24
24
  ## 步骤开始:started 标记
25
25
 
@@ -45,9 +45,7 @@ description: >
45
45
 
46
46
  ### 1. 解析命令参数
47
47
 
48
- 从命令参数中识别:
49
- - 匹配 `TASK-{yyyyMMdd-HHmmss}` 格式的参数 -> `{task-id}`
50
- - 其余参数 -> `{target-branch}`
48
+ 先解析 task scope:可选的 `--task <ref>` 或 `-t <ref>` 绑定 `{task-id}`;位置 task ref 不再解释。剩余的可选位置参数绑定为 `{target-branch}`。
51
49
 
52
50
  如果提供了 `{task-id}`,读取 `.agents/workspace/active/{task-id}/task.md` 获取任务信息(例如 `issue_number`、`type` 等)。
53
51
  如果未提供,可从当前 session 上下文获取;仍无法确定 `{task-id}` 时,后续步骤中的任务关联逻辑跳过。
@@ -80,9 +78,9 @@ description: >
80
78
 
81
79
  ### 7. 生成 PR 代码增减报告
82
80
 
83
- 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类增减、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
81
+ 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类行数、Git blob 字节数、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
84
82
 
85
- 报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数或只统计最后一个 commit。
83
+ 报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数、忽略字节变化或只统计最后一个 commit。
86
84
 
87
85
  ### 8. 发布审查摘要
88
86
 
@@ -1,7 +1,7 @@
1
1
  # PR Code Change Report
2
2
 
3
3
  <!-- pr-change-report-contract
4
- {"version":1,"source":"platform-pr-inspect","diff":"three-dot-find-renames-numstat","publish":["pr-summary","user-response"]}
4
+ {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
5
  -->
6
6
 
7
7
  After a PR is created or uniquely reused, use the authoritative `base.sha` and `head.sha` returned by `platform-pr inspect` to measure the complete PR diff. Do not substitute the last commit or current worktree state.
@@ -9,12 +9,14 @@ After a PR is created or uniquely reused, use the authoritative `base.sha` and `
9
9
  ## Evidence Commands
10
10
 
11
11
  ```bash
12
- git diff --find-renames --numstat {base-sha}...{head-sha}
12
+ node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
13
13
  git diff --find-renames --name-status {base-sha}...{head-sha}
14
14
  git diff --find-renames --summary {base-sha}...{head-sha}
15
15
  ```
16
16
 
17
- Count binary files in the file total but do not invent line counts for `-` numstat values. Explain renames and copies from `name-status` and `summary` separately so moves are not reported as full rewrites.
17
+ The script calculates both `numstat` line counts and exact Git blob byte sizes between the merge base and head. Bytes provide a stable unit, cover binary files, and reveal same-line compaction; submodules are not blobs and contribute zero bytes. Added files have zero old bytes, deleted files have zero new bytes, pure renames have zero net bytes, and copies count only the new destination content.
18
+
19
+ Count binary files in the file total but do not invent line counts for `-` numstat values. Explain renames and copies from the script's per-file records, `name-status`, and `summary` so moves are not reported as full rewrites.
18
20
 
19
21
  ## Classification and Reconciliation
20
22
 
@@ -27,13 +29,16 @@ Using the repository's actual structure, assign every file to exactly one closes
27
29
  - Documentation
28
30
  - Configuration, dependencies, and other files
29
31
 
30
- The table must contain component, file count, additions, deletions, and net change, followed by a total row. Category totals must reconcile exactly with the complete numstat total. Then list the largest changed files and distinguish source, tests, template mirrors, and pure renames.
32
+ The table must contain component, file count, added lines, deleted lines, net lines, old bytes, new bytes, and net bytes, followed by a total row. Byte columns describe the blob content size of files involved in this change, not disk usage for the entire repository or worktree. Use exact integers; optional KiB/MiB values may aid readability but must not replace byte counts.
33
+
34
+ Category line and byte totals must each reconcile exactly with the script's `totals`. Then list the largest files by line change and absolute net-byte change, distinguishing source, tests, template mirrors, and pure renames.
31
35
 
32
36
  ## Required Analysis
33
37
 
34
38
  Briefly explain:
35
39
 
36
40
  - where growth is concentrated and how runtime code compares with tests, docs, and templates;
41
+ - whether net line and net byte changes tell different stories, especially for substantial same-line compaction or expansion;
37
42
  - which line changes are path moves, bilingual mirrors, or mechanical synchronization;
38
43
  - whether any change cannot be traced directly to the PR goal and may be unnecessary; if none, state the evidence;
39
44
  - when a test fixture is much larger than production changes, what risk it covers instead of judging it only by size.
@@ -1,7 +1,7 @@
1
1
  # PR 代码增减报告
2
2
 
3
3
  <!-- pr-change-report-contract
4
- {"version":1,"source":"platform-pr-inspect","diff":"three-dot-find-renames-numstat","publish":["pr-summary","user-response"]}
4
+ {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
5
  -->
6
6
 
7
7
  PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base.sha` 与 `head.sha` 统计完整 PR 差异,不以最后一个 commit 或工作树状态代替。
@@ -9,12 +9,14 @@ PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base
9
9
  ## 证据命令
10
10
 
11
11
  ```bash
12
- git diff --find-renames --numstat {base-sha}...{head-sha}
12
+ node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
13
13
  git diff --find-renames --name-status {base-sha}...{head-sha}
14
14
  git diff --find-renames --summary {base-sha}...{head-sha}
15
15
  ```
16
16
 
17
- `numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据 `name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
17
+ 脚本在 merge base 与 head 之间同时计算 `numstat` 行数和 Git blob 的精确字节数。字节比字符具有稳定口径,也能覆盖二进制文件和同行内缩减;子模块不是 blob,按 0 字节贡献核算。新增文件的旧字节数为 0,删除文件的新字节数为 0,纯 rename 的净字节数为 0,copy 只计新增目标内容。
18
+
19
+ `numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据脚本的逐文件记录、`name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
18
20
 
19
21
  ## 分类与核算
20
22
 
@@ -27,13 +29,16 @@ git diff --find-renames --summary {base-sha}...{head-sha}
27
29
  - 文档
28
30
  - 配置、依赖与其他
29
31
 
30
- 输出表格必须包含“部分、文件数、新增、删除、净增”,并有合计行。各类别之和必须与完整 `numstat` 总计一致。随后列出增减最大的文件,并区分源码、测试、模板镜像和纯 rename。
32
+ 输出表格必须包含“部分、文件数、新增行、删除行、净增行、旧字节、新字节、净字节”,并有合计行。字节列表示本次变更涉及文件的 blob 内容体积,不表示整个仓库或工作树的磁盘占用。使用精确整数;可附加 KiB/MiB 便于阅读,但不能替代字节数。
33
+
34
+ 各类别的行数和字节数之和必须分别与脚本的 `totals` 一致。随后分别列出行数变化和绝对净字节变化最大的文件,并区分源码、测试、模板镜像和纯 rename。
31
35
 
32
36
  ## 分析要求
33
37
 
34
38
  用简短结论回答:
35
39
 
36
40
  - 增长主要集中在哪里,运行时代码与测试/文档/模板各占多少;
41
+ - 行数净变化与净字节变化是否给出不同结论,尤其指出同行内明显缩减或膨胀;
37
42
  - 哪些行数只是路径迁移、双语镜像或机械同步;
38
43
  - 是否存在与 PR 目标无法直接对应、疑似不必要的变化;若没有,明确说明判断依据;
39
44
  - 若某个测试 fixture 明显大于生产改动,解释它覆盖的风险,而不是仅以行数评价。
@@ -0,0 +1,203 @@
1
+ import { execFileSync } from "node:child_process";
2
+
3
+ function fail(message) {
4
+ process.stderr.write(`${message}\n`);
5
+ process.exit(1);
6
+ }
7
+
8
+ function parseArgs(argv) {
9
+ const options = { cwd: process.cwd() };
10
+
11
+ for (let index = 0; index < argv.length; index += 1) {
12
+ const argument = argv[index];
13
+ const value = argv[index + 1];
14
+
15
+ if ((argument === "--base" || argument === "--head" || argument === "--cwd") && value) {
16
+ options[argument.slice(2)] = value;
17
+ index += 1;
18
+ continue;
19
+ }
20
+
21
+ fail(`Unknown or incomplete argument: ${argument}`);
22
+ }
23
+
24
+ if (!options.base || !options.head) {
25
+ fail("Usage: change-report.mjs --base <sha> --head <sha> [--cwd <repository>]");
26
+ }
27
+
28
+ return options;
29
+ }
30
+
31
+ function git(args, options, encoding = "utf8") {
32
+ return execFileSync("git", args, {
33
+ cwd: options.cwd,
34
+ encoding,
35
+ maxBuffer: 64 * 1024 * 1024
36
+ });
37
+ }
38
+
39
+ function parseRawDiff(buffer) {
40
+ const tokens = buffer.toString("utf8").split("\0");
41
+ const files = [];
42
+
43
+ for (let index = 0; index < tokens.length && tokens[index];) {
44
+ const header = tokens[index++];
45
+ const [oldMode, newMode, oldOid, newOid, status] = header.slice(1).split(" ");
46
+ const firstPath = tokens[index++];
47
+ const hasPathPair = status.startsWith("R") || status.startsWith("C");
48
+ const secondPath = hasPathPair ? tokens[index++] : firstPath;
49
+
50
+ files.push({
51
+ status,
52
+ oldMode,
53
+ newMode,
54
+ oldOid,
55
+ newOid,
56
+ oldPath: status.startsWith("A") ? null : firstPath,
57
+ newPath: status.startsWith("D") ? null : secondPath
58
+ });
59
+ }
60
+
61
+ return files;
62
+ }
63
+
64
+ function parseNumstat(buffer) {
65
+ const tokens = buffer.toString("utf8").split("\0");
66
+ const stats = new Map();
67
+
68
+ for (let index = 0; index < tokens.length && tokens[index];) {
69
+ const record = tokens[index++];
70
+ const firstTab = record.indexOf("\t");
71
+ const secondTab = record.indexOf("\t", firstTab + 1);
72
+ const additions = record.slice(0, firstTab);
73
+ const deletions = record.slice(firstTab + 1, secondTab);
74
+ const path = record.slice(secondTab + 1);
75
+
76
+ if (path) {
77
+ stats.set(`path:${path}`, { additions, deletions });
78
+ continue;
79
+ }
80
+
81
+ const oldPath = tokens[index++];
82
+ const newPath = tokens[index++];
83
+ stats.set(`pair:${oldPath}\0${newPath}`, { additions, deletions });
84
+ }
85
+
86
+ return stats;
87
+ }
88
+
89
+ function objectSizes(files, options) {
90
+ const objectIds = new Set();
91
+
92
+ for (const file of files) {
93
+ if (file.oldMode !== "000000" && file.oldMode !== "160000" && !file.status.startsWith("C")) {
94
+ objectIds.add(file.oldOid);
95
+ }
96
+ if (file.newMode !== "000000" && file.newMode !== "160000") {
97
+ objectIds.add(file.newOid);
98
+ }
99
+ }
100
+
101
+ if (objectIds.size === 0) return new Map();
102
+
103
+ const ids = [...objectIds];
104
+ const output = execFileSync(
105
+ "git",
106
+ ["cat-file", "--batch-check=%(objectname) %(objecttype) %(objectsize)"],
107
+ {
108
+ cwd: options.cwd,
109
+ input: `${ids.join("\n")}\n`,
110
+ encoding: "utf8",
111
+ maxBuffer: 64 * 1024 * 1024
112
+ }
113
+ );
114
+ const sizes = new Map();
115
+
116
+ for (const line of output.trim().split("\n")) {
117
+ const [oid, type, size] = line.split(" ");
118
+ if (type === "blob") sizes.set(oid, Number(size));
119
+ }
120
+
121
+ return sizes;
122
+ }
123
+
124
+ function numericLineCount(value) {
125
+ return value === "-" ? null : Number(value);
126
+ }
127
+
128
+ function main() {
129
+ const options = parseArgs(process.argv.slice(2));
130
+ const mergeBase = git(["merge-base", options.base, options.head], options).trim();
131
+ const diffArgs = ["diff", "--no-ext-diff", "--find-renames", "-z", mergeBase, options.head];
132
+ const files = parseRawDiff(git([...diffArgs.slice(0, 2), "--raw", "--abbrev=64", ...diffArgs.slice(2)], options, null));
133
+ const numstat = parseNumstat(git([...diffArgs.slice(0, 2), "--numstat", ...diffArgs.slice(2)], options, null));
134
+ const sizes = objectSizes(files, options);
135
+
136
+ const reportFiles = files.map((file) => {
137
+ const key = file.status.startsWith("R") || file.status.startsWith("C")
138
+ ? `pair:${file.oldPath}\0${file.newPath}`
139
+ : `path:${file.newPath || file.oldPath}`;
140
+ const lines = numstat.get(key);
141
+ if (!lines) fail(`Missing numstat record for ${file.newPath || file.oldPath}`);
142
+
143
+ const oldBytes = file.oldMode === "000000" || file.oldMode === "160000" || file.status.startsWith("C")
144
+ ? 0
145
+ : sizes.get(file.oldOid);
146
+ const newBytes = file.newMode === "000000" || file.newMode === "160000"
147
+ ? 0
148
+ : sizes.get(file.newOid);
149
+ if (oldBytes === undefined || newBytes === undefined) {
150
+ fail(`Unable to resolve blob size for ${file.newPath || file.oldPath}`);
151
+ }
152
+
153
+ return {
154
+ status: file.status,
155
+ oldPath: file.oldPath,
156
+ newPath: file.newPath,
157
+ additions: numericLineCount(lines.additions),
158
+ deletions: numericLineCount(lines.deletions),
159
+ oldBytes,
160
+ newBytes,
161
+ netBytes: newBytes - oldBytes
162
+ };
163
+ });
164
+
165
+ const totals = reportFiles.reduce((result, file) => {
166
+ result.files += 1;
167
+ result.oldBytes += file.oldBytes;
168
+ result.newBytes += file.newBytes;
169
+ result.netBytes += file.netBytes;
170
+ if (file.additions === null || file.deletions === null) {
171
+ result.binaryFiles += 1;
172
+ } else {
173
+ result.textFiles += 1;
174
+ result.additions += file.additions;
175
+ result.deletions += file.deletions;
176
+ }
177
+ return result;
178
+ }, {
179
+ files: 0,
180
+ textFiles: 0,
181
+ binaryFiles: 0,
182
+ additions: 0,
183
+ deletions: 0,
184
+ oldBytes: 0,
185
+ newBytes: 0,
186
+ netBytes: 0
187
+ });
188
+
189
+ process.stdout.write(`${JSON.stringify({
190
+ version: 1,
191
+ base: options.base,
192
+ head: options.head,
193
+ mergeBase,
194
+ files: reportFiles,
195
+ totals
196
+ }, null, 2)}\n`);
197
+ }
198
+
199
+ try {
200
+ main();
201
+ } catch (error) {
202
+ fail(error instanceof Error ? error.message : String(error));
203
+ }
@@ -109,13 +109,12 @@ If no historical release notes exist, use the following default Markdown format:
109
109
  - Commit co-authors from the typed context's commit `authors`
110
110
  - Issue reporters from typed `closingIssues[].author`
111
111
  - **Contribution count**: `PR count + co-authored commit count` for the same identity, merged across both sources
112
- - **Name -> `@login` mapping**:
113
- - For `platform-user` or `platform-noreply`, use the lowercased `login`
114
- - Only for `unresolved`, use the Name heuristic: take the first token before a space and lowercase it
115
- - If the login already appears in the PR author list, merge counts into that login so `Claude` and `@claude` do not become separate entries
116
- - Merge all Name variants that map to the same login before counting and sorting; for example, `Claude` and `Claude Opus 4.6 (1M context)` should both collapse into `@claude`
112
+ - **`@login` mapping**: follow the identity safety boundary in `.agents/rules/release-commands.md`
113
+ - For `platform-user` or `platform-noreply` with a non-empty `login`, use the lowercased `login`
114
+ - Exclude `unresolved` identities from the contributor list; never infer a login from a name, email address, domain, brand, or same-named platform account
115
+ - Merge all Name variants carrying the same typed login before counting and sorting
117
116
  - Preserve bot identities as-is, for example `dependabot[bot]`
118
- - If the login still cannot be determined reliably, output `@{lowercased first Name token}` and append `<!-- TODO(reviewer): confirm platform login for {original Name <email>} -->` below the `Contributors` section
117
+ - Do not add unresolved identity emails, placeholder mentions, or identity-verification TODOs to publishable notes
119
118
  - **Sorting**: descending by contribution count, then lexicographically by login for ties
120
119
  - **Deduplication**: use the final mapped `@login` as the key
121
120
  - **Issue reporter rules**:
@@ -109,13 +109,12 @@ agent-infra-internal platform-release-notes context \
109
109
  - Commit co-authors:来自步骤 3 typed context 的 commit `authors`
110
110
  - Issue reporters:来自步骤 3 typed context 的 `closingIssues[].author`
111
111
  - **贡献数定义**:`该人的 PR 数 + 该人作为 co-author 的 commit 数`(同一身份跨来源合并计数)
112
- - **Name → `@login` 映射**:
113
- - `resolution` 为 `platform-user` 或 `platform-noreply` 时直接采用小写 `login`
114
- - 仅当 `resolution` 为 `unresolved` 时按 Name 启发式:取首个空格前的 token 并转为小写
115
- - 已出现在 PR author 列表中的 login,必须按该 login 合并计数,避免把 `Claude` 和 `@claude` 拆成两个条目
116
- - 同一 login 的所有 Name 变体都必须归并后再计数与排序;例如 `Claude` 与 `Claude Opus 4.6 (1M context)` 都映射到 `@claude` 时,应先合并为同一个贡献者
112
+ - **`@login` 映射**:遵循 `.agents/rules/release-commands.md` 的身份安全边界
113
+ - `resolution` 为 `platform-user` 或 `platform-noreply` 且 `login` 非空时,采用小写 `login`
114
+ - `resolution` 为 `unresolved` 时从贡献者列表中排除;不得从 Name、邮箱、域名、品牌或同名平台账号推断 login
115
+ - 同一 typed login 的所有 Name 变体必须归并后再计数与排序
117
116
  - Bot 身份保留原样(如 `dependabot[bot]`)
118
- - 若仍无法可靠确定 login,则输出 `@{Name 首 token 小写}`,并在 `Contributors` 段落下追加 `<!-- TODO(reviewer): 确认 {原始 Name <email>} 的 platform login -->`
117
+ - 不得在可发布 notes 中加入未解析身份的邮箱、占位 mention 或身份确认 TODO
119
118
  - **排序**:按贡献数降序;贡献数相同时按 login 字典序
120
119
  - **去重**:以最终映射后的 `@login` 为键
121
120
  - **Issue reporter 规则**:
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Create Task
9
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
9
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
12
  ## Boundary / Critical Rules
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # 创建任务
9
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
9
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
12
  ## 行为边界 / 关键规则
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Import Issue
9
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
9
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
12
  Import the specified Issue and create a task. Argument: issue number.
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # 导入 Issue
9
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
9
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
12
  导入指定的 Issue 并创建任务。参数:issue 编号。
@@ -7,7 +7,7 @@ description: >
7
7
  ---
8
8
 
9
9
  # Design Technical Plan
10
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
10
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
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.
13
13
 
@@ -24,7 +24,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
24
24
 
25
25
  After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first. Reading instruction files does not count as an external-state action or conclusion.
26
26
 
27
- Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
27
+ Run these commands and paste the raw output into this round's `## State Check` section:
28
28
 
29
29
  ```bash
30
30
  agent-infra-internal task-snapshot {task-id} --format text
@@ -34,7 +34,7 @@ Before the state check is complete, do not make external-state assertions such a
34
34
 
35
35
  ## Task Context Resolution
36
36
 
37
- > The entry point may omit the task ref and also accepts a legacy positional ref or `--task <ref>` / `-t <ref>`. Separate task scope from the full arguments while preserving every business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty, one positional ref, or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to that full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
37
+ > The entry point may omit the task ref; explicit task scope accepts only `--task <ref>` or `-t <ref>`, and positional task refs are not interpreted. Preserve every other business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to the full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
38
38
 
39
39
  > Resolve the task reference, then confirm that the task is in a state or directory supported by this skill and that `task.md` exists; if it cannot be located, handle it as a missing task and stop.
40
40
 
@@ -7,7 +7,7 @@ description: >
7
7
  ---
8
8
 
9
9
  # 设计技术方案
10
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
10
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
12
  若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。
13
13
 
@@ -24,7 +24,7 @@ description: >
24
24
 
25
25
  在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
26
26
 
27
- 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
27
+ 运行以下命令,并把原文粘贴到本轮产物的 `## 状态核对` 段:
28
28
 
29
29
  ```bash
30
30
  agent-infra-internal task-snapshot {task-id} --format text
@@ -34,7 +34,7 @@ agent-infra-internal task-snapshot {task-id} --format text
34
34
 
35
35
  ## 任务上下文解析
36
36
 
37
- > 入口允许省略 task ref,也接受旧位置 task ref 或 `--task <ref>` / `-t <ref>`。先从完整参数中分离 task scope 并原样保留其他业务操作数,再调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空、位置 ref 或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为该完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
37
+ > 入口可省略 task ref;显式 task scope 仅接受 `--task <ref>` 或 `-t <ref>`,不再解释位置 task ref。保留其余业务操作数后调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
38
38
 
39
39
  > 解析任务引用,并确认任务位于本技能支持的状态或目录且存在 `task.md`;无法定位时按未找到任务处理并停止。
40
40
 
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Restore Task
9
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
9
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
12
  Restore local task workspace files from platform Issue comments that contain sync markers.
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # 还原任务
9
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
9
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
12
  从带有 sync 标记的平台 Issue 评论中恢复本地任务工作区文件。
@@ -7,7 +7,7 @@ description: >
7
7
  ---
8
8
 
9
9
  # Requirement Analysis Review
10
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
10
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
11
11
 
12
12
  If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to both the summary finalizer and completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts.
13
13
 
@@ -24,7 +24,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
24
24
 
25
25
  After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first.
26
26
 
27
- Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
27
+ Run these commands and paste the raw output into this round's `## State Check` section:
28
28
 
29
29
  ```bash
30
30
  agent-infra-internal task-snapshot {task-id} --format text
@@ -32,7 +32,7 @@ agent-infra-internal task-snapshot {task-id} --format text
32
32
 
33
33
  ## Task Context Resolution
34
34
 
35
- > The entry point may omit the task ref and also accepts a legacy positional ref or `--task <ref>` / `-t <ref>`. Separate task scope from the full arguments while preserving every business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty, one positional ref, or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to that full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
35
+ > The entry point may omit the task ref; explicit task scope accepts only `--task <ref>` or `-t <ref>`, and positional task refs are not interpreted. Preserve every other business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to the full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
36
36
 
37
37
  > Resolve the task reference, then confirm that the task is in a state or directory supported by this skill and that `task.md` exists; if it cannot be located, handle it as a missing task and stop.
38
38
 
@@ -85,6 +85,8 @@ The intent atomically finalizes the report summary and returns the same ledger s
85
85
 
86
86
  If task.md has a valid `issue_number`, 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 {review-artifact} --agent {standard-agent-token}`.
87
87
 
88
+ Before writing the summary, the finalization intent checks decision-detail ids; it auto-removes a duplicate only when exactly one formal `[needs-human-decision]` block remains and every other same-id block is clearly short and informal, then reruns the read-only check. Ambiguous duplicates fail closed. If this check or repair fails, stop before the completion event.
89
+
88
90
  ### 7. Run Completion Gate
89
91
 
90
92
  ```bash
@@ -7,7 +7,7 @@ description: >
7
7
  ---
8
8
 
9
9
  # 需求分析审查
10
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
10
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
12
  若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 summary finalizer 与 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。
13
13
 
@@ -24,7 +24,7 @@ description: >
24
24
 
25
25
  在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
26
26
 
27
- 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
27
+ 运行以下命令,并把原文粘贴到本轮产物的 `## 状态核对` 段:
28
28
 
29
29
  ```bash
30
30
  agent-infra-internal task-snapshot {task-id} --format text
@@ -34,7 +34,7 @@ agent-infra-internal task-snapshot {task-id} --format text
34
34
 
35
35
  ## 任务上下文解析
36
36
 
37
- > 入口允许省略 task ref,也接受旧位置 task ref 或 `--task <ref>` / `-t <ref>`。先从完整参数中分离 task scope 并原样保留其他业务操作数,再调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空、位置 ref 或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为该完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
37
+ > 入口可省略 task ref;显式 task scope 仅接受 `--task <ref>` 或 `-t <ref>`,不再解释位置 task ref。保留其余业务操作数后调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
38
38
 
39
39
  > 解析任务引用,并确认任务位于本技能支持的状态或目录且存在 `task.md`;无法定位时按未找到任务处理并停止。
40
40
 
@@ -88,6 +88,8 @@ agent-infra-internal task-snapshot {task-id} --format text
88
88
 
89
89
  如果 task.md 中存在有效的 `issue_number`,调用 `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 {review-artifact} --agent {standard-agent-token}`;失败按 `.agents/rules/issue-sync.md` 记录 warning。
90
90
 
91
+ 最终化 intent 会在写入摘要前检查详情块 ID;只有“一个正式 `[needs-human-decision]` 块 + 明确的简短非正式重复块”才会自动删除重复块并重新做只读检查,无法唯一判断时失败关闭。该检查或自动修复失败时,停止在完成事件之前。
92
+
91
93
  ### 7. 完成校验
92
94
 
93
95
  ```bash
@@ -36,6 +36,7 @@
36
36
  "^\\$ "
37
37
  ]
38
38
  },
39
+ "decision-details": {},
39
40
  "review-summary": {
40
41
  "stage": "analysis"
41
42
  },
@@ -36,6 +36,7 @@
36
36
  "^\\$ "
37
37
  ]
38
38
  },
39
+ "decision-details": {},
39
40
  "review-summary": {
40
41
  "stage": "analysis"
41
42
  },