@fitlab-ai/agent-infra 0.9.0 → 0.9.2

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 (327) hide show
  1. package/README.md +22 -5
  2. package/README.zh-CN.md +21 -5
  3. package/bin/cli.ts +12 -0
  4. package/dist/bin/cli.js +14 -0
  5. package/dist/bin/internal-cli.js +20 -0
  6. package/dist/lib/agent-client.js +163 -0
  7. package/dist/lib/agent-clients/adapter.js +294 -0
  8. package/dist/lib/agent-clients/adapters/claude-code.js +62 -0
  9. package/dist/lib/agent-clients/adapters/codex-sandbox.js +210 -0
  10. package/dist/lib/agent-clients/adapters/codex.js +54 -0
  11. package/dist/lib/agent-clients/adapters/gemini-cli.js +64 -0
  12. package/dist/lib/agent-clients/adapters/index.js +20 -0
  13. package/dist/lib/agent-clients/adapters/opencode.js +64 -0
  14. package/dist/lib/agent-clients/config.js +177 -0
  15. package/dist/lib/agent-clients/custom-tuis.js +99 -0
  16. package/dist/lib/agent-clients/invocation.js +9 -0
  17. package/dist/lib/agent-clients/next-steps.js +38 -0
  18. package/dist/lib/agent-clients/project-assets.js +45 -0
  19. package/dist/lib/agent-clients/reconcile.js +235 -0
  20. package/dist/lib/agent-clients/registry.js +72 -0
  21. package/dist/lib/agent-clients/schema.js +57 -0
  22. package/dist/lib/agent-clients/types.js +29 -0
  23. package/dist/lib/builtin-tuis.js +9 -14
  24. package/dist/lib/defaults.json +85 -73
  25. package/dist/lib/git/review-snapshot.js +25 -10
  26. package/dist/lib/git/reviewed-commit-equivalence.js +110 -0
  27. package/dist/lib/init.js +47 -91
  28. package/dist/lib/internal/agent-client.js +117 -0
  29. package/dist/lib/internal/git-workflow.js +1 -1
  30. package/dist/lib/internal/platform-release-notes.js +53 -0
  31. package/dist/lib/internal/release-workflow.js +175 -17
  32. package/dist/lib/internal/task-orchestration.js +151 -0
  33. package/dist/lib/internal/task-review.js +65 -0
  34. package/dist/lib/merge.js +2 -1
  35. package/dist/lib/platform/adapters.js +38 -1
  36. package/dist/lib/platform/change-request-git-evidence.js +113 -0
  37. package/dist/lib/platform/github-release-notes.js +96 -0
  38. package/dist/lib/platform/issues.js +4 -2
  39. package/dist/lib/platform/merged-pr-equivalence.js +84 -0
  40. package/dist/lib/platform/pr-checks.js +43 -15
  41. package/dist/lib/platform/pull-requests.js +113 -7
  42. package/dist/lib/platform/release-notes.js +143 -0
  43. package/dist/lib/platform/releases.js +1 -1
  44. package/dist/lib/platform/verification-required.js +31 -9
  45. package/dist/lib/prompt.js +15 -3
  46. package/dist/lib/release/channels.js +4 -1
  47. package/dist/lib/release/workflow.js +4 -2
  48. package/dist/lib/remove-dir.js +25 -0
  49. package/dist/lib/run/tui.js +8 -2
  50. package/dist/lib/sandbox/agent-client-reconciler.js +234 -0
  51. package/dist/lib/sandbox/build-proxy.js +63 -0
  52. package/dist/lib/sandbox/clipboard/linux.js +2 -1
  53. package/dist/lib/sandbox/commands/create.js +133 -189
  54. package/dist/lib/sandbox/commands/enter.js +17 -1
  55. package/dist/lib/sandbox/commands/prune.js +2 -2
  56. package/dist/lib/sandbox/commands/rebuild.js +24 -7
  57. package/dist/lib/sandbox/commands/rm.js +3 -2
  58. package/dist/lib/sandbox/config.js +21 -4
  59. package/dist/lib/sandbox/constants.js +3 -0
  60. package/dist/lib/sandbox/dockerfile.js +2 -1
  61. package/dist/lib/sandbox/image-build.js +2 -1
  62. package/dist/lib/sandbox/managed-fs.js +10 -5
  63. package/dist/lib/sandbox/recovery.js +52 -36
  64. package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +24 -3
  65. package/dist/lib/sandbox/runtimes/base.dockerfile +8 -1
  66. package/dist/lib/sandbox/runtimes/java17.dockerfile +8 -1
  67. package/dist/lib/sandbox/runtimes/java21.dockerfile +8 -1
  68. package/dist/lib/sandbox/runtimes/node20.dockerfile +8 -1
  69. package/dist/lib/sandbox/runtimes/node22.dockerfile +8 -1
  70. package/dist/lib/sandbox/runtimes/python3.dockerfile +8 -1
  71. package/dist/lib/sandbox/shell.js +3 -2
  72. package/dist/lib/sandbox/tool-types.js +8 -0
  73. package/dist/lib/sandbox/tools.js +2 -126
  74. package/dist/lib/task/artifact-lifecycle.js +1 -49
  75. package/dist/lib/task/commands/decisions.js +50 -20
  76. package/dist/lib/task/commands/issue-body.js +10 -5
  77. package/dist/lib/task/delegation-receipts.js +107 -0
  78. package/dist/lib/task/events.js +101 -2
  79. package/dist/lib/task/issue-form.js +2 -0
  80. package/dist/lib/task/orchestration.js +420 -0
  81. package/dist/lib/task/review-artifacts.js +143 -59
  82. package/dist/lib/task/review-finalization.js +166 -0
  83. package/dist/lib/task/review-fingerprint.js +13 -0
  84. package/dist/lib/task/verification-checks.js +2 -1
  85. package/dist/lib/task/verification-engine.js +168 -23
  86. package/dist/lib/task/verification-review.js +1 -1
  87. package/dist/lib/task/verification.js +4 -2
  88. package/dist/lib/task/workspace-snapshot.js +34 -0
  89. package/dist/lib/update.js +42 -161
  90. package/lib/agent-client.ts +214 -0
  91. package/lib/agent-clients/adapter.ts +461 -0
  92. package/lib/agent-clients/adapters/claude-code.ts +70 -0
  93. package/lib/agent-clients/adapters/codex-sandbox.ts +245 -0
  94. package/lib/agent-clients/adapters/codex.ts +58 -0
  95. package/lib/agent-clients/adapters/gemini-cli.ts +65 -0
  96. package/lib/agent-clients/adapters/index.ts +27 -0
  97. package/lib/agent-clients/adapters/opencode.ts +66 -0
  98. package/lib/agent-clients/config.ts +278 -0
  99. package/lib/agent-clients/custom-tuis.ts +149 -0
  100. package/lib/agent-clients/invocation.ts +19 -0
  101. package/lib/agent-clients/next-steps.ts +72 -0
  102. package/lib/agent-clients/project-assets.ts +96 -0
  103. package/lib/agent-clients/reconcile.ts +324 -0
  104. package/lib/agent-clients/registry.ts +144 -0
  105. package/lib/agent-clients/schema.ts +62 -0
  106. package/lib/agent-clients/types.ts +78 -0
  107. package/lib/benchmark/schemas/v1.0.0/case-manifest.schema.json +120 -0
  108. package/lib/benchmark/schemas/v1.0.0/common.schema.json +109 -0
  109. package/lib/benchmark/schemas/v1.0.0/grader-result.schema.json +160 -0
  110. package/lib/benchmark/schemas/v1.0.0/run-manifest.schema.json +122 -0
  111. package/lib/benchmark/schemas/v1.0.0/subject.schema.json +227 -0
  112. package/lib/builtin-tuis.ts +16 -15
  113. package/lib/defaults.json +24 -12
  114. package/lib/git/review-snapshot.ts +39 -9
  115. package/lib/git/reviewed-commit-equivalence.ts +135 -0
  116. package/lib/init.ts +53 -121
  117. package/lib/internal/agent-client.ts +131 -0
  118. package/lib/internal/git-workflow.ts +1 -1
  119. package/lib/internal/platform-release-notes.ts +55 -0
  120. package/lib/internal/release-workflow.ts +172 -18
  121. package/lib/internal/task-orchestration.ts +132 -0
  122. package/lib/internal/task-review.ts +65 -0
  123. package/lib/merge.ts +2 -1
  124. package/lib/platform/adapters.ts +142 -3
  125. package/lib/platform/change-request-git-evidence.ts +159 -0
  126. package/lib/platform/github-release-notes.ts +132 -0
  127. package/lib/platform/issues.ts +6 -4
  128. package/lib/platform/merged-pr-equivalence.ts +107 -0
  129. package/lib/platform/pr-checks.ts +57 -28
  130. package/lib/platform/pull-requests.ts +140 -25
  131. package/lib/platform/release-notes.ts +167 -0
  132. package/lib/platform/releases.ts +1 -1
  133. package/lib/platform/verification-required.ts +37 -9
  134. package/lib/prompt.ts +16 -3
  135. package/lib/release/channels.ts +4 -1
  136. package/lib/release/workflow.ts +4 -3
  137. package/lib/remove-dir.ts +28 -0
  138. package/lib/run/tui.ts +9 -1
  139. package/lib/sandbox/agent-client-reconciler.ts +378 -0
  140. package/lib/sandbox/build-proxy.ts +94 -0
  141. package/lib/sandbox/clipboard/linux.ts +2 -1
  142. package/lib/sandbox/commands/create.ts +188 -203
  143. package/lib/sandbox/commands/enter.ts +23 -1
  144. package/lib/sandbox/commands/prune.ts +2 -2
  145. package/lib/sandbox/commands/rebuild.ts +29 -7
  146. package/lib/sandbox/commands/rm.ts +3 -2
  147. package/lib/sandbox/config.ts +31 -4
  148. package/lib/sandbox/constants.ts +6 -0
  149. package/lib/sandbox/dockerfile.ts +2 -1
  150. package/lib/sandbox/image-build.ts +4 -1
  151. package/lib/sandbox/managed-fs.ts +18 -5
  152. package/lib/sandbox/recovery.ts +98 -67
  153. package/lib/sandbox/runtimes/ai-tools.dockerfile +24 -3
  154. package/lib/sandbox/runtimes/base.dockerfile +8 -1
  155. package/lib/sandbox/runtimes/java17.dockerfile +8 -1
  156. package/lib/sandbox/runtimes/java21.dockerfile +8 -1
  157. package/lib/sandbox/runtimes/node20.dockerfile +8 -1
  158. package/lib/sandbox/runtimes/node22.dockerfile +8 -1
  159. package/lib/sandbox/runtimes/python3.dockerfile +8 -1
  160. package/lib/sandbox/shell.ts +4 -2
  161. package/lib/sandbox/tool-types.ts +143 -0
  162. package/lib/sandbox/tools.ts +5 -157
  163. package/lib/task/artifact-lifecycle.ts +1 -38
  164. package/lib/task/commands/decisions.ts +53 -20
  165. package/lib/task/commands/issue-body.ts +10 -5
  166. package/lib/task/delegation-receipts.ts +170 -0
  167. package/lib/task/events.ts +111 -3
  168. package/lib/task/issue-form.ts +4 -0
  169. package/lib/task/orchestration.ts +543 -0
  170. package/lib/task/review-artifacts.ts +201 -69
  171. package/lib/task/review-finalization.ts +275 -0
  172. package/lib/task/review-fingerprint.ts +15 -1
  173. package/lib/task/verification-checks.ts +2 -1
  174. package/lib/task/verification-engine.ts +190 -25
  175. package/lib/task/verification-review.ts +2 -0
  176. package/lib/task/verification.ts +6 -3
  177. package/lib/task/workspace-snapshot.ts +36 -0
  178. package/lib/update.ts +48 -184
  179. package/package.json +2 -2
  180. package/templates/.agents/README.en.md +21 -20
  181. package/templates/.agents/README.zh-CN.md +21 -20
  182. package/templates/.agents/hooks/lifecycle-delegation.js +64 -0
  183. package/templates/.agents/rules/README.en.md +2 -0
  184. package/templates/.agents/rules/README.zh-CN.md +2 -0
  185. package/templates/.agents/rules/commit-and-pr.en.md +1 -0
  186. package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -0
  187. package/templates/.agents/rules/human-decision-context.en.md +14 -12
  188. package/templates/.agents/rules/human-decision-context.zh-CN.md +14 -12
  189. package/templates/.agents/rules/lifecycle-orchestration.en.md +21 -0
  190. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +21 -0
  191. package/templates/.agents/rules/next-step-output.en.md +16 -0
  192. package/templates/.agents/rules/next-step-output.zh-CN.md +16 -0
  193. package/templates/.agents/rules/no-mid-flow-questions.en.md +2 -0
  194. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +2 -0
  195. package/templates/.agents/rules/release-commands.en.md +2 -2
  196. package/templates/.agents/rules/release-commands.github.en.md +15 -39
  197. package/templates/.agents/rules/release-commands.github.zh-CN.md +14 -38
  198. package/templates/.agents/rules/release-commands.zh-CN.md +2 -2
  199. package/templates/.agents/rules/review-handshake.en.md +4 -3
  200. package/templates/.agents/rules/review-handshake.zh-CN.md +4 -3
  201. package/templates/.agents/rules/review-method.en.md +113 -0
  202. package/templates/.agents/rules/review-method.zh-CN.md +98 -0
  203. package/templates/.agents/rules/testing-discipline.en.md +20 -2
  204. package/templates/.agents/rules/testing-discipline.zh-CN.md +20 -2
  205. package/templates/.agents/skills/analyze-task/SKILL.en.md +9 -6
  206. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +9 -6
  207. package/templates/.agents/skills/block-task/SKILL.en.md +4 -4
  208. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +4 -4
  209. package/templates/.agents/skills/cancel-task/SKILL.en.md +4 -4
  210. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +5 -5
  211. package/templates/.agents/skills/check-task/SKILL.en.md +16 -16
  212. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -16
  213. package/templates/.agents/skills/close-codescan/SKILL.en.md +4 -4
  214. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +4 -4
  215. package/templates/.agents/skills/close-dependabot/SKILL.en.md +4 -4
  216. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +4 -4
  217. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  218. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +2 -2
  219. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +14 -16
  220. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +14 -16
  221. package/templates/.agents/skills/code-task/reference/output-template.en.md +3 -3
  222. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +3 -3
  223. package/templates/.agents/skills/commit/SKILL.en.md +11 -1
  224. package/templates/.agents/skills/commit/SKILL.zh-CN.md +11 -1
  225. package/templates/.agents/skills/commit/reference/task-status-update.en.md +24 -28
  226. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +24 -28
  227. package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
  228. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
  229. package/templates/.agents/skills/complete-task/config/verify.en.json +0 -1
  230. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +0 -1
  231. package/templates/.agents/skills/create-pr/SKILL.en.md +10 -10
  232. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +10 -10
  233. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +3 -3
  234. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +3 -3
  235. package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -38
  236. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +16 -37
  237. package/templates/.agents/skills/create-task/SKILL.en.md +15 -11
  238. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +15 -11
  239. package/templates/.agents/skills/create-task/reference/context-capture.en.md +29 -0
  240. package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +29 -0
  241. package/templates/.agents/skills/import-codescan/SKILL.en.md +5 -5
  242. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +5 -5
  243. package/templates/.agents/skills/import-dependabot/SKILL.en.md +5 -5
  244. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +5 -5
  245. package/templates/.agents/skills/import-issue/SKILL.en.md +5 -5
  246. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
  247. package/templates/.agents/skills/init-labels/SKILL.en.md +4 -4
  248. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +4 -4
  249. package/templates/.agents/skills/init-milestones/SKILL.en.md +4 -4
  250. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -4
  251. package/templates/.agents/skills/plan-task/SKILL.en.md +5 -5
  252. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -5
  253. package/templates/.agents/skills/refine-title/SKILL.en.md +1 -1
  254. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -1
  255. package/templates/.agents/skills/release/SKILL.en.md +1 -1
  256. package/templates/.agents/skills/review-analysis/SKILL.en.md +13 -2
  257. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +14 -3
  258. package/templates/.agents/skills/review-analysis/config/verify.en.json +6 -0
  259. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +6 -0
  260. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +13 -15
  261. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +13 -15
  262. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +51 -5
  263. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +52 -6
  264. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +25 -22
  265. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +25 -22
  266. package/templates/.agents/skills/review-code/SKILL.en.md +28 -8
  267. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +28 -8
  268. package/templates/.agents/skills/review-code/config/verify.en.json +7 -0
  269. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +7 -0
  270. package/templates/.agents/skills/review-code/reference/concurrency-risks.en.md +25 -0
  271. package/templates/.agents/skills/review-code/reference/concurrency-risks.zh-CN.md +25 -0
  272. package/templates/.agents/skills/review-code/reference/cross-platform-risks.en.md +27 -0
  273. package/templates/.agents/skills/review-code/reference/cross-platform-risks.zh-CN.md +27 -0
  274. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.en.md +13 -0
  275. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.zh-CN.md +13 -0
  276. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +25 -0
  277. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +25 -0
  278. package/templates/.agents/skills/review-code/reference/output-templates.en.md +22 -24
  279. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +22 -24
  280. package/templates/.agents/skills/review-code/reference/report-template.en.md +54 -7
  281. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +54 -7
  282. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +29 -24
  283. package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +29 -24
  284. package/templates/.agents/skills/review-code/reference/security-risks.en.md +25 -0
  285. package/templates/.agents/skills/review-code/reference/security-risks.zh-CN.md +25 -0
  286. package/templates/.agents/skills/review-plan/SKILL.en.md +13 -2
  287. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +14 -3
  288. package/templates/.agents/skills/review-plan/config/verify.en.json +6 -0
  289. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +6 -0
  290. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +13 -15
  291. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +13 -15
  292. package/templates/.agents/skills/review-plan/reference/report-template.en.md +61 -5
  293. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +61 -5
  294. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +21 -24
  295. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +21 -24
  296. package/templates/.agents/skills/run-task/SKILL.en.md +22 -0
  297. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +22 -0
  298. package/templates/.agents/skills/run-task/config/verify.en.json +9 -0
  299. package/templates/.agents/skills/run-task/config/verify.zh-CN.json +9 -0
  300. package/templates/.agents/skills/test/SKILL.en.md +4 -4
  301. package/templates/.agents/skills/test/SKILL.zh-CN.md +4 -4
  302. package/templates/.agents/skills/test-integration/SKILL.en.md +4 -4
  303. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +4 -4
  304. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +5 -5
  305. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +5 -5
  306. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +647 -203
  307. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +4 -4
  308. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +4 -4
  309. package/templates/.agents/skills/watch-pr/SKILL.en.md +8 -8
  310. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +8 -8
  311. package/templates/.agents/templates/task.en.md +18 -0
  312. package/templates/.agents/templates/task.zh-CN.md +18 -0
  313. package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +6 -0
  314. package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +6 -0
  315. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +6 -0
  316. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +6 -0
  317. package/templates/.claude/commands/run-task.en.md +8 -0
  318. package/templates/.claude/commands/run-task.zh-CN.md +8 -0
  319. package/templates/.claude/settings.json +24 -0
  320. package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +3 -0
  321. package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +3 -0
  322. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +3 -0
  323. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +3 -0
  324. package/templates/.gemini/commands/_project_/run-task.en.toml +8 -0
  325. package/templates/.gemini/commands/_project_/run-task.zh-CN.toml +8 -0
  326. package/templates/.opencode/commands/run-task.en.md +11 -0
  327. package/templates/.opencode/commands/run-task.zh-CN.md +11 -0
@@ -17,11 +17,9 @@
17
17
  - 不要混用不同场景的文案
18
18
  - 只要 `Blocker > 0`,就绝对不能输出通过模板
19
19
  - manual-validation 项绝对不能被计入 blocker / major / minor 计数,也不能用作触发场景 B/C/D 的依据
20
- - 所选场景中必须包含所有 TUI 命令格式
20
+ - 所选场景必须通过统一 helper 生成 `{next-step-commands}`
21
21
  - 计数行固定显示 5 个数字。manual-validation(`{e}`)不影响分支;`人工裁决`(`{h}`)是本阶段 `needs-human-decision` 行数,属于未闭环账本状态,因此 `{h} > 0` 时 `canAdvance=false`,必须按 `.agents/rules/next-step-output.md` 的「人工裁决待办前置块」展开详情,并只输出修订与复审路径。
22
22
 
23
- 场景 B/C/D 在修订命令后继续列出复审命令:`/review-code {task-ref}`、`/{{project}}:review-code {task-ref}`、`$review-code {task-ref}`。
24
-
25
23
  ### 场景 A:通过且无问题
26
24
 
27
25
  通过后不得按轮次路由。先比较审查快照树 `T` 与基线 `R` 的树,再读取任务的 `prFlow` / `pr_number`;存在 PR 时调用 `agent-infra-internal platform-checks inspect {task-id}`。只选择以下一个互斥出口:
@@ -45,51 +43,51 @@
45
43
 
46
44
  #### 场景 A1:提交或推送
47
45
 
46
+ 使用 `agent-infra-internal agent-client next-steps --skill commit --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
47
+
48
48
  ```text
49
49
  下一步 - 提交或推送代码:
50
- - Claude Code / OpenCode:/commit {task-ref}
51
- - Gemini CLI:/{{project}}:commit {task-ref}
52
- - Codex CLI:$commit {task-ref}
50
+ {next-step-commands}
53
51
  ```
54
52
 
55
53
  #### 场景 A2:创建 Pull Request
56
54
 
55
+ 使用 `agent-infra-internal agent-client next-steps --skill create-pr --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
56
+
57
57
  ```text
58
58
  下一步 - 创建 Pull Request:
59
- - Claude Code / OpenCode:/create-pr {task-ref}
60
- - Gemini CLI:/{{project}}:create-pr {task-ref}
61
- - Codex CLI:$create-pr {task-ref}
59
+ {next-step-commands}
62
60
  ```
63
61
 
64
62
  #### 场景 A3:监控 required checks
65
63
 
64
+ 使用 `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
65
+
66
66
  ```text
67
67
  下一步 - 监控 PR 检查:
68
- - Claude Code / OpenCode:/watch-pr {task-ref}
69
- - Gemini CLI:/{{project}}:watch-pr {task-ref}
70
- - Codex CLI:$watch-pr {task-ref}
68
+ {next-step-commands}
71
69
  ```
72
70
 
73
71
  #### 场景 A4:完成并归档
74
72
 
73
+ 使用 `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
74
+
75
75
  ```text
76
76
  下一步 - 完成并归档任务:
77
- - Claude Code / OpenCode:/complete-task {task-ref}
78
- - Gemini CLI:/{{project}}:complete-task {task-ref}
79
- - Codex CLI:$complete-task {task-ref}
77
+ {next-step-commands}
80
78
  ```
81
79
 
82
80
  ### 场景 B:需要修改(major / minor)
83
81
 
82
+ 使用 `agent-infra-internal agent-client next-steps --skill code-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
83
+
84
84
  ```text
85
85
  任务 {task-id} 代码审查完成。结论:需要修改。
86
86
  - 阻塞项:0 | 主要问题:{n} | 次要问题:{n} | 人工校验点:{e} | 人工裁决:{h}
87
87
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
88
88
 
89
89
  下一步 - 修复问题:
90
- - Claude Code / OpenCode:/code-task {task-ref}
91
- - Gemini CLI:/{{project}}:code-task {task-ref}
92
- - Codex CLI:$code-task {task-ref}
90
+ {next-step-commands}
93
91
 
94
92
  [当 manual-validation > 0 时,在最后附加一行:]
95
93
  提醒:manual-validation 项需在 PR description 的「待人工验证」清单中承接,不应触发 /code-task。
@@ -97,15 +95,15 @@
97
95
 
98
96
  ### 场景 C:需要修改
99
97
 
98
+ 使用 `agent-infra-internal agent-client next-steps --skill code-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
99
+
100
100
  ```text
101
101
  任务 {task-id} 代码审查完成。结论:需要修改。
102
102
  - 阻塞项:{n} | 主要问题:{n} | 次要问题:{n} | 人工校验点:{e} | 人工裁决:{h}
103
103
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
104
104
 
105
105
  下一步 - 修复问题:
106
- - Claude Code / OpenCode:/code-task {task-ref}
107
- - Gemini CLI:/{{project}}:code-task {task-ref}
108
- - Codex CLI:$code-task {task-ref}
106
+ {next-step-commands}
109
107
 
110
108
  [当 manual-validation > 0 时,在最后附加一行:]
111
109
  提醒:manual-validation 项需在 PR description 的「待人工验证」清单中承接,不应触发 /code-task。
@@ -113,15 +111,15 @@
113
111
 
114
112
  ### 场景 D:拒绝
115
113
 
114
+ 使用 `agent-infra-internal agent-client next-steps --skill plan-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
115
+
116
116
  ```text
117
117
  任务 {task-id} 代码审查完成。结论:拒绝,需要重新设计方案。
118
118
  - 阻塞项:{n} | 主要问题:{n} | 次要问题:{n} | 人工校验点:{e} | 人工裁决:{h}
119
119
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
120
120
 
121
121
  下一步 - 重新设计技术方案:
122
- - Claude Code / OpenCode:/plan-task {task-ref}
123
- - Gemini CLI:/{{project}}:plan-task {task-ref}
124
- - Codex CLI:$plan-task {task-ref}
122
+ {next-step-commands}
125
123
 
126
124
  > 注意:Rejected 表示实现方向需要整体重做,不是局部修复。核心 artifact lifecycle 的分支 #7 会拒绝直接 `/code-task`,要求先重新方案设计。
127
125
 
@@ -21,11 +21,50 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
21
21
  - **Reviewer**: {reviewer-name}
22
22
  - **Review Time**: {timestamp}
23
23
  - **Scope**: {file-count and major modules}
24
- - **Review Baseline Commit**: {raw R captured once for this round} (diff base only; see `.agents/rules/review-handshake.md`)
24
+ - **Review Baseline Commit**: {raw reviewed commit R captured once for this round; must equal this round's HEAD}
25
+ - **Reviewed Diff Base**: {raw D used for the complete diff/fingerprint; the merge-base of R and the PR base SHA when a PR is bound, otherwise R}
25
26
  - **Reviewed Diff Fingerprint**: {fingerprint field from git-workflow snapshot}
26
27
  - **Reviewed Snapshot Tree**: {tree field from git-workflow snapshot}
27
28
  - **Overall Verdict**: {Approved / Changes Requested / Rejected} (pick exactly one; combined phrases will fail the verify gate)
28
- - **Findings (AI-actionable)**: 0 blockers, 0 majors, 0 minors / **Manual validation**: 0
29
+ - **Findings (AI-actionable)**: {unresolved-blockers} blockers, {unresolved-major} majors, {unresolved-minor} minors / **Manual validation**: 0
30
+
31
+ ## Review Coverage Declaration
32
+
33
+ | pass_id | scope | evidence | result | gaps_or_assumptions |
34
+ |---------|-------|----------|--------|---------------------|
35
+ | pass-1..5 | {scope actually reviewed} | {artifact / diff / file:line / command} | {finding or conclusion} | {gap or assumption} |
36
+
37
+ | lens_id | trigger_evidence | loaded | result |
38
+ |---------|------------------|--------|--------|
39
+ | {registry token} | {trigger or non-trigger evidence} | {yes / no / not-applicable} | {lens result} |
40
+
41
+ ## Code Implementation Coverage
42
+
43
+ | context_id | changed_lines | related_context | uncovered_area | result_or_gap |
44
+ |------------|---------------|-----------------|----------------|---------------|
45
+ | {file/module} | {changed line ranges} | {callers/callees/state/data flow} | {not reviewed or none} | {result / gap} |
46
+
47
+ | quality_id | applicability | evidence | result_or_gap |
48
+ |------------|---------------|----------|---------------|
49
+ | responsibility | {applicable / not-applicable} | {code or call evidence} | {result / gap} |
50
+ | cohesion | {applicable / not-applicable} | {code or call evidence} | {result / gap} |
51
+ | coupling | {applicable / not-applicable} | {dependency evidence} | {result / gap} |
52
+ | dependency-direction | {applicable / not-applicable} | {dependency evidence} | {result / gap} |
53
+ | abstraction-fit | {applicable / not-applicable} | {variation evidence} | {result / gap} |
54
+ | pattern-cost | {applicable / not-applicable} | {problem, conditions, cost, simpler alternative} | {result / gap} |
55
+ | change-locality | {applicable / not-applicable} | {change propagation evidence} | {result / gap} |
56
+ | testability | {applicable / not-applicable} | {test seam or behavior evidence} | {result / gap} |
57
+ | architecture-boundary | {applicable / not-applicable} | {approved plan boundary} | {result / gap} |
58
+
59
+ | acceptance_id | plan_source | implementation_location | test_or_validation_evidence | status_or_gap |
60
+ |---------------|-------------|-------------------------|-----------------------------|---------------|
61
+ | {acceptance token} | {approved requirement/plan} | {file:line or diff} | {automated test / manual-validation / explicit gap} | {covered / gap} |
62
+
63
+ ## Traceability Matrix
64
+
65
+ | source_id | upstream | reviewed_target | verification | status_or_gap |
66
+ |-----------|----------|-----------------|--------------|---------------|
67
+ | {requirement/plan step} | {approved requirement or design} | {code diff} | {automated test or manual validation} | {covered / gap} |
29
68
 
30
69
  ## Findings
31
70
 
@@ -33,15 +72,23 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
33
72
 
34
73
  #### 1. {Issue title}
35
74
  **File**: `{file-path}:{line-number}`
36
- **Description**: {details}
37
- **Suggested Fix**: {fix suggestion}
75
+ **Scenario**: {scenario}
76
+ **Impact**: {impact}
77
+ **Evidence**: {evidence_type: test / call-chain / state-transition / data-flow / specification-conflict / file-location} — {reproducible evidence}
78
+ **Confidence**: {high / medium / low}
79
+ **Unverified Assumptions**: {assumptions or none}
80
+ **Fix Direction**: {fix direction}
38
81
 
39
82
  ### Major Issues (should fix)
40
83
 
41
84
  #### 1. {Issue title}
42
85
  **File**: `{file-path}:{line-number}`
43
- **Description**: {details}
44
- **Suggested Fix**: {fix suggestion}
86
+ **Scenario**: {scenario}
87
+ **Impact**: {impact}
88
+ **Evidence**: {evidence_type: test / call-chain / state-transition / data-flow / specification-conflict / file-location} — {reproducible evidence}
89
+ **Confidence**: {high / medium / low}
90
+ **Unverified Assumptions**: {assumptions or none}
91
+ **Fix Direction**: {fix direction}
45
92
 
46
93
  ### Minor Issues (low impact, closure required)
47
94
 
@@ -75,7 +122,7 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
75
122
 
76
123
  ## Evidence
77
124
 
78
- > Pair each "I verified X" claim with the corresponding raw tool output; the gate only checks that this section exists and at least one `$ ` line is present. Every Blocker must be backed by a reproducible command (rg/grep/sed/nl) and its raw output; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
125
+ > Pair each "I verified X" claim with the corresponding raw tool output; the gate only checks that this section exists and at least one `$ ` line is present. Every Blocker must use reproducible test, call-chain, state-transition, data-flow, specification-conflict, or accurate-location evidence; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
79
126
 
80
127
  - Claim: {verified claim}
81
128
  ```text
@@ -21,11 +21,50 @@
21
21
  - **审查者**:{reviewer-name}
22
22
  - **审查时间**:{timestamp}
23
23
  - **审查范围**:{file-count and major modules}
24
- - **审查基线提交**:{本轮一次性捕获的 R 原文}(仅表示 diff base;详见 `.agents/rules/review-handshake.md`)
24
+ - **审查基线提交**:{本轮一次性捕获的审查提交 R 原文;必须等于本轮 HEAD}
25
+ - **审查差异基线**:{用于完整 diff/fingerprint 的 D 原文;已绑定 PR 时为 R 与 PR base SHA 的 merge-base,否则为 R}
25
26
  - **审查差异指纹**:{git-workflow snapshot 输出的 fingerprint 字段}
26
27
  - **审查快照树**:{git-workflow snapshot 输出的 tree 字段}
27
28
  - **总体结论**:{通过 / 需要修改 / 拒绝}(恰取一个;禁止写组合短语,否则 verify gate 失败)
28
- - **发现(AI 可处理)**:0 阻塞项,0 主要,0 次要 / **人工校验**:0
29
+ - **发现(AI 可处理)**:{unresolved-blockers} 阻塞项,{unresolved-major} 主要,{unresolved-minor} 次要 / **人工校验**:0
30
+
31
+ ## 检视覆盖声明
32
+
33
+ | pass_id | scope | evidence | result | gaps_or_assumptions |
34
+ |---------|-------|----------|--------|---------------------|
35
+ | pass-1..5 | {本遍实际范围} | {artifact / diff / file:line / command} | {发现或结论} | {缺口或假设} |
36
+
37
+ | lens_id | trigger_evidence | loaded | result |
38
+ |---------|------------------|--------|--------|
39
+ | {registry token} | {命中或未命中证据} | {yes / no / not-applicable} | {专项结论} |
40
+
41
+ ## 代码实现专项覆盖
42
+
43
+ | context_id | changed_lines | related_context | uncovered_area | result_or_gap |
44
+ |------------|---------------|-----------------|----------------|---------------|
45
+ | {file/module} | {changed line ranges} | {callers/callees/state/data flow} | {not reviewed or none} | {result / gap} |
46
+
47
+ | quality_id | applicability | evidence | result_or_gap |
48
+ |------------|---------------|----------|---------------|
49
+ | responsibility | {applicable / not-applicable} | {code or call evidence} | {result / gap} |
50
+ | cohesion | {applicable / not-applicable} | {code or call evidence} | {result / gap} |
51
+ | coupling | {applicable / not-applicable} | {dependency evidence} | {result / gap} |
52
+ | dependency-direction | {applicable / not-applicable} | {dependency evidence} | {result / gap} |
53
+ | abstraction-fit | {applicable / not-applicable} | {variation evidence} | {result / gap} |
54
+ | pattern-cost | {applicable / not-applicable} | {problem, conditions, cost, simpler alternative} | {result / gap} |
55
+ | change-locality | {applicable / not-applicable} | {change propagation evidence} | {result / gap} |
56
+ | testability | {applicable / not-applicable} | {test seam or behavior evidence} | {result / gap} |
57
+ | architecture-boundary | {applicable / not-applicable} | {approved plan boundary} | {result / gap} |
58
+
59
+ | acceptance_id | plan_source | implementation_location | test_or_validation_evidence | status_or_gap |
60
+ |---------------|-------------|-------------------------|-----------------------------|---------------|
61
+ | {acceptance token} | {approved requirement/plan} | {file:line or diff} | {automated test / manual-validation / explicit gap} | {covered / gap} |
62
+
63
+ ## 追踪矩阵
64
+
65
+ | source_id | upstream | reviewed_target | verification | status_or_gap |
66
+ |-----------|----------|-----------------|--------------|---------------|
67
+ | {需求/方案步骤} | {已批准需求或设计} | {代码 diff} | {自动化测试或人工校验} | {covered / gap} |
29
68
 
30
69
  ## 问题清单
31
70
 
@@ -33,15 +72,23 @@
33
72
 
34
73
  #### 1. {问题标题}
35
74
  **文件**:`{file-path}:{line-number}`
36
- **说明**:{details}
37
- **修复建议**:{fix suggestion}
75
+ **场景**:{scenario}
76
+ **影响**:{impact}
77
+ **证据**:{evidence_type: test / call-chain / state-transition / data-flow / specification-conflict / file-location} — {reproducible evidence}
78
+ **置信度**:{high / medium / low}
79
+ **未验证假设**:{assumptions or none}
80
+ **修复方向**:{fix direction}
38
81
 
39
82
  ### 主要问题(建议修复)
40
83
 
41
84
  #### 1. {问题标题}
42
85
  **文件**:`{file-path}:{line-number}`
43
- **说明**:{details}
44
- **修复建议**:{fix suggestion}
86
+ **场景**:{scenario}
87
+ **影响**:{impact}
88
+ **证据**:{evidence_type: test / call-chain / state-transition / data-flow / specification-conflict / file-location} — {reproducible evidence}
89
+ **置信度**:{high / medium / low}
90
+ **未验证假设**:{assumptions or none}
91
+ **修复方向**:{fix direction}
45
92
 
46
93
  ### 次要问题(低影响但需闭环)
47
94
 
@@ -75,7 +122,7 @@
75
122
 
76
123
  ## 证据原文
77
124
 
78
- > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。每条 Blocker 必须配可复现命令(rg/grep/sed/nl)及其原文;无法复现的判断须降级或移入「自我质疑」。
125
+ > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。每条 Blocker 必须配可复现的测试、调用链、状态转换、数据流、规范冲突或准确位置证据;无法复现的判断须降级或移入「自我质疑」。
79
126
 
80
127
  - 断言:{verified claim}
81
128
  ```text
@@ -13,10 +13,12 @@ Follow the `code-review` step in `.agents/workflows/feature-development.yaml`.
13
13
  - [ ] Error handling and edge cases
14
14
  - [ ] Performance and security risks
15
15
  - [ ] Comments and documentation
16
+ - [ ] New or changed documentation accurately reflects the current behavior after the change
17
+ - [ ] Documentation changes are deterministically routed to mandatory references by the shared risk-lens registry
16
18
  - [ ] Consistency with the approved technical plan
17
19
  - [ ] The reviewer checked whether the executor missed any key design decision that should be upgraded to `[needs-human-decision]`
18
20
  - [ ] Every `needs-human-decision` detail produced this round follows the self-contained structure in `.agents/rules/human-decision-context.md`
19
- - [ ] Every blocker is backed by reproducible grep/sed/nl evidence; conclusions not directly verified are declared under Self-Doubt
21
+ - [ ] Every blocker/major uses semantic evidence proportionate to the issue; conclusions not directly verified are declared under Self-Doubt
20
22
 
21
23
  **Common anti-examples**:
22
24
  - Checking only whether tests pass without reading the actual diff
@@ -24,35 +26,38 @@ Follow the `code-review` step in `.agents/workflows/feature-development.yaml`.
24
26
  - Misclassifying environment-limited verification gaps as blockers
25
27
  - Asserting a `file:line` or behavior from memory or impression without verifying via rg/nl
26
28
 
27
- ## Common Review Principles
29
+ ## Shared Method and Classification Boundary
28
30
 
29
- 1. **Strict but fair**: identify issues and acknowledge solid work
30
- 2. **Specific**: cite exact file paths and line numbers
31
- 3. **Actionable**: suggest a concrete fix
32
- 4. **Severity-based**: clearly distinguish blockers, major issues, and minor issues
31
+ Read `.agents/rules/review-method.md` first and apply its five-pass protocol, risk lenses, and finding evidence contract. Finding, manual-validation, advisory, and `needs-human-decision` state semantics remain governed by `.agents/rules/review-handshake.md`. This file adds only code-stage criteria.
33
32
 
34
- ## Three-category Decision Tree
33
+ Also inspect `git diff`, the latest code artifact, latest technical-plan review artifact, and `task.md` Activity Log so the report reflects the full change context.
35
34
 
36
- 1. A correctness, completeness, security, performance, test, or acceptance gap in the current implementation is a formal finding. Assign blocker / major / minor by impact; severity does not control closure, so minor findings must also reach a terminal state.
37
- 2. When there is no known defect but validation requires a real environment, permission, or human operation, classify it as manual-validation.
38
- 3. Only a future optimization that does not affect the current implementation's completeness, correctness, or acceptance is an advisory. Put it only in Non-blocking Advisories; do not add it to the ledger, finding counts, or verdict.
35
+ ## Five Code-stage Passes
39
36
 
40
- ## Manual Validation Classification
37
+ | pass_id | code-stage action |
38
+ |---------|-------------------|
39
+ | pass-1 | Read the complete diff, untracked files, implementation/plan artifacts, task source, and raw test results |
40
+ | pass-2 | Map acceptance/plan → implementation → verification and record changed lines, call context, state/data flow, and uncovered areas |
41
+ | pass-3 | Review overall design before per-file semantics; evaluate every shared registry trigger and read each matched reference in full |
42
+ | pass-4 | Check guards, call constraints, test coverage, and narrower impact boundaries as counterevidence |
43
+ | pass-5 | Reconcile findings, manual-validation, advisories, evidence types, unverified assumptions, ledger state, and verdict |
41
44
 
42
- Some findings cannot be closed by an AI agent in the current execution environment, for example:
45
+ Line-by-line diff reading does not replace necessary call-chain, state-transition, or data-flow analysis.
43
46
 
44
- - Missing Docker / sandbox access for end-to-end validation
45
- - Missing a specific OS for macOS-only behavior
46
- - Missing third-party accounts / OAuth
47
- - Missing privileged operations such as root, sudo, or special network access
47
+ ## Structural Design Lenses
48
48
 
49
- **Decision tree**: "Can the AI agent close this item independently without changing the environment?"
50
- - Yes -> blocker / major / minor, based on risk
51
- - No -> **manual-validation** (a manual-validation meta-category, not part of severity ordering)
49
+ | quality_id | review focus |
50
+ |------------|--------------|
51
+ | responsibility | Whether each module or function has a clear responsibility boundary |
52
+ | cohesion | Whether behavior and data in one unit serve the same purpose |
53
+ | coupling | Whether dependency count, knowledge leakage, and coordination cost are justified |
54
+ | dependency-direction | Whether dependencies point toward approved stable boundaries |
55
+ | abstraction-fit | Whether abstractions match real variation without being deficient or excessive |
56
+ | pattern-cost | Whether the problem, applicability, cost, and simpler alternative justify a pattern |
57
+ | change-locality | Whether one business change can remain local |
58
+ | testability | Whether key behavior and failure paths can be observed and controlled reliably |
59
+ | architecture-boundary | Whether implementation follows the approved architecture without reopening major selection during code review |
52
60
 
53
- Where manual-validation items go:
54
- - Record them in an independent review report section named "Manual Validation Items"
55
- - Record the done-note source field as `Manual-validation: 1`; `ai task log` normalizes it into review rows
56
- - Do **not** include them in the code-task fix loop; maintainers carry them in the PR description under manual verification
61
+ ## Evidence Types
57
62
 
58
- Also inspect `git diff`, the latest code artifact, latest technical-plan review artifact, and `task.md` Activity Log so the report reflects the full change context.
63
+ Blocker/major evidence may use `test`, `call-chain`, `state-transition`, `data-flow`, `specification-conflict`, or `file-location`. Commands and `file:line` are location aids, not the only valid evidence; evidence must reproduce the scenario and explain its impact.
@@ -13,10 +13,12 @@
13
13
  - [ ] 错误处理和边界情况
14
14
  - [ ] 性能与安全风险
15
15
  - [ ] 代码注释和文档
16
+ - [ ] 新增或修改的文档准确反映变更后的当前行为
17
+ - [ ] 文档变更由共享风险镜头注册表确定性路由到必读专项 reference
16
18
  - [ ] 与已批准技术方案的一致性
17
19
  - [ ] 已复核执行方是否漏标应升级为 `[needs-human-decision]` 的关键设计决策
18
20
  - [ ] 本轮所有 `needs-human-decision` 详情均符合 `.agents/rules/human-decision-context.md` 的自足结构
19
- - [ ] 每条 blocker 都配可复现的 grep/sed/nl 证据,未直接验证的结论已在「自我质疑」声明
21
+ - [ ] 每条 blocker/major 都配与问题相称的语义证据,未直接验证的结论已在「自我质疑」声明
20
22
 
21
23
  **常见反例**:
22
24
  - 只检查测试是否通过,没有阅读实际 diff
@@ -24,35 +26,38 @@
24
26
  - 把环境缺失导致无法验证的事项误归类为 blocker
25
27
  - 凭印象或记忆断言 `file:line`/行为,没有用 rg/nl 复核就下结论
26
28
 
27
- ## 通用审查原则
29
+ ## 共享方法与分类边界
28
30
 
29
- 1. **严格但公正**:既要指出问题,也要承认做得好的部分
30
- 2. **具体**:引用准确的文件路径和行号
31
- 3. **可执行**:给出明确可落地的修复建议
32
- 4. **按严重程度分类**:明确区分 blocker、major 和 minor
31
+ 先读取 `.agents/rules/review-method.md`,按其五遍协议、风险镜头和 finding 证据契约执行;finding、manual-validation、advisory 与 `needs-human-decision` 的状态语义以 `.agents/rules/review-handshake.md` 为准。本文件只补充代码实现阶段的专项判断。
33
32
 
34
- ## 三类审查项决策树
33
+ 同时检查 `git diff`、最新实现产物、最新技术方案审查产物和 `task.md` Activity Log,确保报告反映完整的变更上下文。
35
34
 
36
- 1. 若问题揭示当前实现或测试存在正确性、完整性、安全性、性能或验收缺口,登记为正式 finding,并按影响赋予 blocker / major / minor;severity 只表示影响大小,minor 也必须闭环。
37
- 2. 若没有已知缺陷,但只能依赖真实环境、权限或人工操作完成验证,归为 manual-validation。
38
- 3. 仅当建议属于未来优化且不影响当前实现的完整性、正确性和验收时,归为 advisory。advisory 只写入「非阻塞建议」,不进入账本、问题计数或 verdict。
35
+ ## 代码阶段五遍动作
39
36
 
40
- ## 人工校验项分类
37
+ | pass_id | code-stage action |
38
+ |---------|-------------------|
39
+ | pass-1 | 读取完整 diff、未跟踪文件、实现/方案产物、任务来源和测试原始结果 |
40
+ | pass-2 | 建立验收/方案—实现—验证映射,并记录 changed lines、调用上下文、状态/数据流和未覆盖区域 |
41
+ | pass-3 | 先检查整体设计,再检查逐文件语义;判断共享注册表的每个触发器并完整加载命中 reference |
42
+ | pass-4 | 检查保护条件、调用约束、测试覆盖和更窄影响范围等反证 |
43
+ | pass-5 | 核对 finding、manual-validation、advisory、证据类型、未验证假设、账本和 verdict |
41
44
 
42
- 某些发现项是 AI agent 在本执行环境**无法闭环**的,例如:
45
+ 逐行 diff 阅读不能替代必要的调用链、状态转换或数据流检查。
43
46
 
44
- - 缺 Docker / 沙箱而无法跑端到端验证
45
- - 缺特定 OS(macOS-only 行为)
46
- - 缺第三方账号 / OAuth
47
- - 缺特权操作(root、sudo、特殊网络)
47
+ ## 结构设计镜头
48
48
 
49
- **分类决策树**:「AI agent 能否在不改环境的前提下独立闭环这一项?」
50
- - 是 -> blocker / major / minor 之一(按风险定档)
51
- - 否 -> **manual-validation**(人工校验元类目,不参与严重程度排序)
49
+ | quality_id | review focus |
50
+ |------------|--------------|
51
+ | responsibility | 单个模块或函数的职责边界是否清晰 |
52
+ | cohesion | 同一单元内的行为和数据是否共同服务一个目的 |
53
+ | coupling | 依赖数量、知识泄漏和跨模块协调成本是否合理 |
54
+ | dependency-direction | 依赖是否指向已批准的稳定边界 |
55
+ | abstraction-fit | 抽象是否匹配实际变化点,避免不足或过度抽象 |
56
+ | pattern-cost | 模式解决的问题、适用条件、成本和更简单替代是否相称 |
57
+ | change-locality | 同一业务变化是否能局部完成 |
58
+ | testability | 关键行为和失败路径能否被可靠观察与控制 |
59
+ | architecture-boundary | 实现是否遵守已批准架构,不在代码审查阶段首次重选重大架构 |
52
60
 
53
- manual-validation 项的去向:
54
- - 写入 review 报告独立段落「人工校验项」
55
- - 在 done note 中写入源字段 `Manual-validation: 1`;`ai task log` 归一化展示到 review 行
56
- - **不**进入 code-task 修复循环;维护者在 PR description 中以「待人工验证」清单形式承接
61
+ ## 证据类型
57
62
 
58
- 同时检查 `git diff`、最新实现产物、最新技术方案审查产物和 `task.md` Activity Log,确保报告反映完整的变更上下文。
63
+ blocker/major 可使用 `test`、`call-chain`、`state-transition`、`data-flow`、`specification-conflict` 或 `file-location`。命令和 `file:line` 是定位手段,不是唯一有效证据;证据必须能复现问题场景并解释影响。
@@ -0,0 +1,25 @@
1
+ # Security Risk Review
2
+
3
+ ## Scope
4
+
5
+ Use when changes touch authentication, authorization, untrusted input, sensitive data, credentials, cryptography, dependencies, or system boundaries.
6
+
7
+ ## Review Questions
8
+
9
+ - Are trust boundaries, permission checks, and deny-by-default behavior explicit?
10
+ - Do input validation, output encoding, secret handling, and logging avoid expanding exposure?
11
+ - Do new dependencies or system calls introduce capabilities or supply-chain risks outside the approved plan?
12
+
13
+ ## Evidence Requirements
14
+
15
+ Trace the call chain or data flow from entry through validation, authorization, use, and failure exits. Support conclusions with tests, specification conflicts, or accurate locations.
16
+
17
+ ## Common Counterexamples
18
+
19
+ - Assuming safety merely because a security-related API is used.
20
+ - Checking only the happy path while ignoring bypasses and failure defaults.
21
+ - Treating unavailable real credentials or external systems as blockers by default.
22
+
23
+ ## When Closure Is Not Possible
24
+
25
+ Record reproducible defects as findings, checks requiring real permissions or external systems as manual-validation, and unsupported uncovered boundaries as a gap. Do not approve unconditionally.
@@ -0,0 +1,25 @@
1
+ # 安全风险检视
2
+
3
+ ## 适用范围
4
+
5
+ 当变更触及认证授权、非可信输入、敏感数据、凭据、加密、依赖或系统边界时使用。
6
+
7
+ ## 检视问题
8
+
9
+ - 信任边界、权限检查和默认拒绝行为是否保持清晰。
10
+ - 输入验证、输出编码、秘密处理和日志记录是否避免扩大暴露面。
11
+ - 新依赖或系统调用是否引入未被方案覆盖的能力或供应链风险。
12
+
13
+ ## 证据要求
14
+
15
+ 沿入口、校验、授权、数据使用和失败出口记录调用链或数据流;用测试、规范冲突或准确位置支撑结论。
16
+
17
+ ## 常见反例
18
+
19
+ - 仅因使用了安全相关 API 就判定安全。
20
+ - 只检查正常路径,不检查绕过路径和失败默认值。
21
+ - 把无法访问真实凭据或外部系统直接归为 blocker。
22
+
23
+ ## 无法闭环时
24
+
25
+ 可复现缺陷形成 finding;必须在真实权限或外部系统中执行的检查进入 manual-validation;证据不足的未覆盖边界记录为 gap,不得无条件通过。
@@ -55,6 +55,7 @@ Read `{plan-artifact}`, the latest analysis artifact, `task.md`, and Issue conte
55
55
 
56
56
  Check simplicity, executability, risk control, test strategy, file coverage, and phase boundaries.
57
57
 
58
+ > Read `.agents/rules/review-method.md` before this step and follow its five-pass protocol for coverage, risk-lens decisions, traceability, and counterevidence.
58
59
  > Read `reference/review-criteria.md` before this step.
59
60
 
60
61
  ### 5. Write Review Report
@@ -65,7 +66,17 @@ Create `.agents/workspace/active/{task-id}/{review-artifact}`.
65
66
 
66
67
  ### 6. Update Task Status
67
68
 
68
- After the report, submit each new finding with `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`; submit prior-response dispositions with `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {evidence}`. Do not scan ids or edit ledger rows. After all ledger writes, call `agent-infra-internal task-ledger {task-id} stage-status --stage plan` exactly once. Derive the verdict and next-step branch from `stageStatus.canAdvance`, and blocker/major/minor event counts from `unresolvedFindingCounts`: only `canAdvance=true` permits `approved`; otherwise use `changes-requested` or `rejected`. Then run `agent-infra-internal task-event {task-id} review-plan.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {n} --major {n} --minor {n} --manual-validation {n}`.
69
+ After the report, submit each new finding with `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`; submit prior-response dispositions with `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {evidence}`. Do not scan ids or edit ledger rows. After all ledger writes, call `agent-infra-internal task-review {task-id} finalize-summary --stage plan --artifact {review-artifact}` exactly once.
70
+
71
+ Bind and reuse this structured mapping from that one response:
72
+
73
+ ```text
74
+ {unresolved-blockers} = stageStatus.unresolvedFindingCounts.blocker
75
+ {unresolved-major} = stageStatus.unresolvedFindingCounts.major
76
+ {unresolved-minor} = stageStatus.unresolvedFindingCounts.minor
77
+ ```
78
+
79
+ The intent atomically finalizes the report summary and returns the same ledger snapshot. Do not call `stage-status`, replace placeholders manually, or rescan the finding list. If finalization fails or a response field is missing, stop before the completion event. Derive the verdict and next-step branch from the same response's `stageStatus.canAdvance`: only `canAdvance=true` permits `approved`; otherwise use `changes-requested` or `rejected`. Then run `agent-infra-internal task-event {task-id} review-plan.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`.
69
80
 
70
81
  `manual-validation` is the data source for the `Manual-validation` count folded into review rows in `ai task log`; do not add a parallel manual-verification field.
71
82
 
@@ -79,6 +90,6 @@ agent-infra-internal task-verify {task-id} review-plan.completed --artifact {rev
79
90
 
80
91
  ### 8. Tell the User
81
92
 
82
- Use the conclusion branch in `reference/output-templates.md` and show all TUI command formats.
93
+ Use the conclusion branch in `reference/output-templates.md` and render the selected next-step commands through the shared helper.
83
94
 
84
95
  > Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form; (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
@@ -58,6 +58,7 @@ agent-infra-internal task-snapshot {task-id} --format text
58
58
 
59
59
  重点检查方案的简洁性、可执行性、风险控制、测试策略、文件清单和阶段边界。
60
60
 
61
+ > 共享检视方法见 `.agents/rules/review-method.md`。执行此步骤前先读取该规则,并按五遍协议完成覆盖声明、风险镜头判断、追踪矩阵和反证检视。
61
62
  > 详细审查标准见 `reference/review-criteria.md`。执行此步骤前先读取 `reference/review-criteria.md`。
62
63
 
63
64
  ### 5. 编写审查报告
@@ -68,7 +69,17 @@ agent-infra-internal task-snapshot {task-id} --format text
68
69
 
69
70
  ### 6. 更新任务状态
70
71
 
71
- 报告完成后,新 finding 逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`;复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。不得扫描编号或手写账本行。全部账本写入完成后只调用一次 `agent-infra-internal task-ledger {task-id} stage-status --stage plan`,以 `stageStatus.canAdvance` 决定 verdict 和下一步,并以 `unresolvedFindingCounts` 填写 blocker/major/minor:仅 `canAdvance=true` 可用 `approved`,否则必须用 `changes-requested` 或 `rejected`。随后执行 `agent-infra-internal task-event {task-id} review-plan.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {n} --major {n} --minor {n} --manual-validation {n}`。
72
+ 报告完成后,新 finding 逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage plan --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`;复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。不得扫描编号或手写账本行。全部账本写入完成后只调用一次 `agent-infra-internal task-review {task-id} finalize-summary --stage plan --artifact {review-artifact}`。
73
+
74
+ 从该次返回值绑定并复用以下结构化映射:
75
+
76
+ ```text
77
+ {unresolved-blockers} = stageStatus.unresolvedFindingCounts.blocker
78
+ {unresolved-major} = stageStatus.unresolvedFindingCounts.major
79
+ {unresolved-minor} = stageStatus.unresolvedFindingCounts.minor
80
+ ```
81
+
82
+ 该 intent 原子最终化报告摘要并返回同一次账本快照;不得再调用 `stage-status`、手工替换占位符或扫描问题清单。最终化失败或返回字段缺失时,停止在完成事件之前。以同一次返回的 `stageStatus.canAdvance` 决定 verdict 和下一步:仅 `canAdvance=true` 可用 `approved`,否则必须用 `changes-requested` 或 `rejected`。随后执行 `agent-infra-internal task-event {task-id} review-plan.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`。
72
83
 
73
84
  `manual-validation` 是 `ai task log` 中 review 行「人工校验点」(EN `Manual-validation`)计数的数据源;不要新增并行人工验证字段。
74
85
 
@@ -84,7 +95,7 @@ agent-infra-internal task-verify {task-id} review-plan.completed --artifact {rev
84
95
 
85
96
  ### 8. 告知用户
86
97
 
87
- 按 `reference/output-templates.md` 的结论分支输出,并展示所有 TUI 的下一步命令。
98
+ 按 `reference/output-templates.md` 的结论分支输出,并通过统一 helper 渲染已选场景的下一步命令。
88
99
 
89
100
  > 渲染最终输出前先读取 `.agents/rules/next-step-output.md` 并落实其两类规则:(1) 「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件),其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式;(2) 在面向用户输出的绝对最后一行追加 `Completed at` 收尾行(成功、错误、早退等任何面向用户输出都适用,不限于校验通过的成功态)。
90
101
 
@@ -93,7 +104,7 @@ agent-infra-internal task-verify {task-id} review-plan.completed --artifact {rev
93
104
  - [ ] 已审查最新方案上下文
94
105
  - [ ] 已创建 `{review-artifact}`
95
106
  - [ ] 已更新 task.md 并追加 Activity Log
96
- - [ ] 已展示所有 TUI 的下一步命令
107
+ - [ ] 已通过统一 helper 渲染已选场景的下一步命令
97
108
 
98
109
  ## 注意事项
99
110
 
@@ -19,6 +19,9 @@
19
19
  "file_pattern": "review-plan.md|review-plan-r{N}.md",
20
20
  "required_sections": [
21
21
  "Review Summary",
22
+ "Review Coverage Declaration",
23
+ "Technical Plan Architecture Coverage",
24
+ "Traceability Matrix",
22
25
  "Findings",
23
26
  "Non-blocking Advisories",
24
27
  "Manual Validation Items",
@@ -33,6 +36,9 @@
33
36
  "^\\$ "
34
37
  ]
35
38
  },
39
+ "review-summary": {
40
+ "stage": "plan"
41
+ },
36
42
  "activity-log": {
37
43
  "expected_action_pattern": "(Review Plan|Plan Review) \\(Round \\d+\\)"
38
44
  },
@@ -19,6 +19,9 @@
19
19
  "file_pattern": "review-plan.md|review-plan-r{N}.md",
20
20
  "required_sections": [
21
21
  "审查摘要",
22
+ "检视覆盖声明",
23
+ "技术方案架构覆盖",
24
+ "追踪矩阵",
22
25
  "问题清单",
23
26
  "非阻塞建议",
24
27
  "人工校验项",
@@ -33,6 +36,9 @@
33
36
  "^\\$ "
34
37
  ]
35
38
  },
39
+ "review-summary": {
40
+ "stage": "plan"
41
+ },
36
42
  "activity-log": {
37
43
  "expected_action_pattern": "(Review Plan|Plan Review) \\(Round \\d+\\)"
38
44
  },