@fitlab-ai/agent-infra 0.9.1 → 0.9.3

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 (476) hide show
  1. package/README.md +24 -11
  2. package/README.zh-CN.md +24 -11
  3. package/bin/cli.ts +12 -0
  4. package/dist/bin/cli.js +14 -0
  5. package/dist/bin/internal-cli.js +30 -0
  6. package/dist/lib/agent-client.js +163 -0
  7. package/dist/lib/agent-clients/adapter.js +337 -0
  8. package/dist/lib/agent-clients/adapters/antigravity-cli.js +64 -0
  9. package/dist/lib/agent-clients/adapters/claude-code.js +71 -0
  10. package/dist/lib/agent-clients/adapters/codex-sandbox.js +210 -0
  11. package/dist/lib/agent-clients/adapters/codex.js +63 -0
  12. package/dist/lib/agent-clients/adapters/index.js +20 -0
  13. package/dist/lib/agent-clients/adapters/opencode.js +73 -0
  14. package/dist/lib/agent-clients/config.js +215 -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 +47 -0
  18. package/dist/lib/agent-clients/project-assets.js +45 -0
  19. package/dist/lib/agent-clients/reconcile.js +236 -0
  20. package/dist/lib/agent-clients/registry.js +78 -0
  21. package/dist/lib/agent-clients/schema.js +75 -0
  22. package/dist/lib/agent-clients/tokens.js +49 -0
  23. package/dist/lib/agent-clients/types.js +29 -0
  24. package/dist/lib/builtin-tuis.js +9 -14
  25. package/dist/lib/defaults.json +85 -73
  26. package/dist/lib/git/review-snapshot.js +25 -10
  27. package/dist/lib/git/reviewed-commit-equivalence.js +110 -0
  28. package/dist/lib/git/workflow.js +54 -1
  29. package/dist/lib/init.js +47 -91
  30. package/dist/lib/internal/agent-client.js +174 -0
  31. package/dist/lib/internal/git-workflow.js +7 -2
  32. package/dist/lib/internal/platform-checks.js +3 -3
  33. package/dist/lib/internal/platform-comment.js +29 -2
  34. package/dist/lib/internal/platform-issue.js +7 -0
  35. package/dist/lib/internal/platform-pr-review.js +132 -0
  36. package/dist/lib/internal/platform-pr.js +20 -2
  37. package/dist/lib/internal/platform-release-notes.js +52 -16
  38. package/dist/lib/internal/pr-review-grade.js +140 -0
  39. package/dist/lib/internal/release-workflow.js +82 -20
  40. package/dist/lib/internal/task-activity.js +73 -0
  41. package/dist/lib/internal/task-event.js +17 -1
  42. package/dist/lib/internal/task-lifecycle.js +7 -0
  43. package/dist/lib/internal/task-orchestration.js +196 -0
  44. package/dist/lib/internal/task-review.js +70 -0
  45. package/dist/lib/merge.js +2 -1
  46. package/dist/lib/platform/adapters.js +45 -1
  47. package/dist/lib/platform/change-request-git-evidence.js +113 -0
  48. package/dist/lib/platform/completion-backfill.js +122 -0
  49. package/dist/lib/platform/issue-comments.js +3 -2
  50. package/dist/lib/platform/merged-pr-equivalence.js +156 -16
  51. package/dist/lib/platform/pr-checks.js +101 -50
  52. package/dist/lib/platform/pr-review.js +166 -0
  53. package/dist/lib/platform/pull-requests.js +432 -7
  54. package/dist/lib/platform/release-notes.js +85 -3
  55. package/dist/lib/platform/releases.js +1 -1
  56. package/dist/lib/platform/verification-required.js +8 -10
  57. package/dist/lib/pr-review/evidence-grading.js +229 -0
  58. package/dist/lib/prompt.js +15 -3
  59. package/dist/lib/release/channels.js +4 -1
  60. package/dist/lib/release/workflow.js +4 -2
  61. package/dist/lib/remove-dir.js +25 -0
  62. package/dist/lib/run/tui.js +11 -7
  63. package/dist/lib/sandbox/agent-client-reconciler.js +234 -0
  64. package/dist/lib/sandbox/clipboard/linux.js +2 -1
  65. package/dist/lib/sandbox/commands/create.js +76 -200
  66. package/dist/lib/sandbox/commands/enter.js +17 -1
  67. package/dist/lib/sandbox/commands/prune.js +2 -2
  68. package/dist/lib/sandbox/commands/rm.js +3 -2
  69. package/dist/lib/sandbox/commands/show.js +1 -1
  70. package/dist/lib/sandbox/config.js +21 -4
  71. package/dist/lib/sandbox/constants.js +3 -0
  72. package/dist/lib/sandbox/dockerfile.js +2 -1
  73. package/dist/lib/sandbox/managed-fs.js +10 -5
  74. package/dist/lib/sandbox/recovery.js +52 -36
  75. package/dist/lib/sandbox/shell.js +1 -1
  76. package/dist/lib/sandbox/tool-types.js +8 -0
  77. package/dist/lib/sandbox/tools.js +2 -126
  78. package/dist/lib/task/activity-intent.js +101 -0
  79. package/dist/lib/task/artifact-lifecycle.js +3 -50
  80. package/dist/lib/task/commands/decisions.js +50 -20
  81. package/dist/lib/task/commands/log.js +15 -14
  82. package/dist/lib/task/delegation-receipts.js +128 -0
  83. package/dist/lib/task/events.js +146 -8
  84. package/dist/lib/task/finalization-artifacts.js +35 -0
  85. package/dist/lib/task/lifecycle-execution.js +46 -0
  86. package/dist/lib/task/orchestration.js +784 -0
  87. package/dist/lib/task/review-artifacts.js +143 -59
  88. package/dist/lib/task/review-finalization.js +186 -0
  89. package/dist/lib/task/review-fingerprint.js +4 -0
  90. package/dist/lib/task/task-execution-lock.js +231 -0
  91. package/dist/lib/task/verification-checks.js +2 -1
  92. package/dist/lib/task/verification-engine.js +372 -28
  93. package/dist/lib/task/verification-review.js +1 -1
  94. package/dist/lib/task/verification.js +5 -2
  95. package/dist/lib/task/workspace-snapshot.js +46 -0
  96. package/dist/lib/update.js +42 -161
  97. package/lib/agent-client.ts +214 -0
  98. package/lib/agent-clients/adapter.ts +534 -0
  99. package/lib/agent-clients/adapters/antigravity-cli.ts +65 -0
  100. package/lib/agent-clients/adapters/claude-code.ts +79 -0
  101. package/lib/agent-clients/adapters/codex-sandbox.ts +245 -0
  102. package/lib/agent-clients/adapters/codex.ts +67 -0
  103. package/lib/agent-clients/adapters/index.ts +27 -0
  104. package/lib/agent-clients/adapters/opencode.ts +75 -0
  105. package/lib/agent-clients/config.ts +323 -0
  106. package/lib/agent-clients/custom-tuis.ts +149 -0
  107. package/lib/agent-clients/invocation.ts +19 -0
  108. package/lib/agent-clients/next-steps.ts +85 -0
  109. package/lib/agent-clients/project-assets.ts +96 -0
  110. package/lib/agent-clients/reconcile.ts +325 -0
  111. package/lib/agent-clients/registry.ts +154 -0
  112. package/lib/agent-clients/schema.ts +80 -0
  113. package/lib/agent-clients/tokens.ts +53 -0
  114. package/lib/agent-clients/types.ts +92 -0
  115. package/lib/benchmark/schemas/v1.0.0/case-manifest.schema.json +120 -0
  116. package/lib/benchmark/schemas/v1.0.0/common.schema.json +109 -0
  117. package/lib/benchmark/schemas/v1.0.0/grader-result.schema.json +160 -0
  118. package/lib/benchmark/schemas/v1.0.0/run-manifest.schema.json +122 -0
  119. package/lib/benchmark/schemas/v1.0.0/subject.schema.json +227 -0
  120. package/lib/builtin-tuis.ts +16 -15
  121. package/lib/defaults.json +24 -12
  122. package/lib/git/review-snapshot.ts +39 -9
  123. package/lib/git/reviewed-commit-equivalence.ts +135 -0
  124. package/lib/git/workflow.ts +66 -2
  125. package/lib/init.ts +53 -121
  126. package/lib/internal/agent-client.ts +186 -0
  127. package/lib/internal/git-workflow.ts +6 -2
  128. package/lib/internal/platform-checks.ts +4 -4
  129. package/lib/internal/platform-comment.ts +17 -2
  130. package/lib/internal/platform-issue.ts +4 -0
  131. package/lib/internal/platform-pr-review.ts +104 -0
  132. package/lib/internal/platform-pr.ts +14 -1
  133. package/lib/internal/platform-release-notes.ts +59 -16
  134. package/lib/internal/pr-review-grade.ts +130 -0
  135. package/lib/internal/release-workflow.ts +79 -20
  136. package/lib/internal/task-activity.ts +55 -0
  137. package/lib/internal/task-event.ts +9 -1
  138. package/lib/internal/task-lifecycle.ts +4 -0
  139. package/lib/internal/task-orchestration.ts +171 -0
  140. package/lib/internal/task-review.ts +70 -0
  141. package/lib/merge.ts +2 -1
  142. package/lib/platform/adapters.ts +169 -3
  143. package/lib/platform/change-request-git-evidence.ts +159 -0
  144. package/lib/platform/completion-backfill.ts +134 -0
  145. package/lib/platform/issue-comments.ts +3 -2
  146. package/lib/platform/merged-pr-equivalence.ts +178 -19
  147. package/lib/platform/pr-checks.ts +121 -66
  148. package/lib/platform/pr-review.ts +201 -0
  149. package/lib/platform/pull-requests.ts +529 -27
  150. package/lib/platform/release-notes.ts +100 -4
  151. package/lib/platform/releases.ts +1 -1
  152. package/lib/platform/verification-required.ts +12 -10
  153. package/lib/pr-review/evidence-grading.ts +318 -0
  154. package/lib/prompt.ts +16 -3
  155. package/lib/release/channels.ts +4 -1
  156. package/lib/release/workflow.ts +4 -3
  157. package/lib/remove-dir.ts +28 -0
  158. package/lib/run/tui.ts +12 -5
  159. package/lib/sandbox/agent-client-reconciler.ts +378 -0
  160. package/lib/sandbox/clipboard/linux.ts +2 -1
  161. package/lib/sandbox/commands/create.ts +111 -212
  162. package/lib/sandbox/commands/enter.ts +23 -1
  163. package/lib/sandbox/commands/prune.ts +2 -2
  164. package/lib/sandbox/commands/rm.ts +3 -2
  165. package/lib/sandbox/commands/show.ts +1 -1
  166. package/lib/sandbox/config.ts +31 -4
  167. package/lib/sandbox/constants.ts +6 -0
  168. package/lib/sandbox/dockerfile.ts +2 -1
  169. package/lib/sandbox/managed-fs.ts +18 -5
  170. package/lib/sandbox/recovery.ts +98 -67
  171. package/lib/sandbox/shell.ts +1 -1
  172. package/lib/sandbox/tool-types.ts +143 -0
  173. package/lib/sandbox/tools.ts +5 -157
  174. package/lib/server/server.schema.json +2 -2
  175. package/lib/task/activity-intent.ts +128 -0
  176. package/lib/task/artifact-lifecycle.ts +3 -39
  177. package/lib/task/commands/decisions.ts +53 -20
  178. package/lib/task/commands/log.ts +15 -14
  179. package/lib/task/delegation-receipts.ts +199 -0
  180. package/lib/task/events.ts +164 -11
  181. package/lib/task/finalization-artifacts.ts +58 -0
  182. package/lib/task/lifecycle-execution.ts +106 -0
  183. package/lib/task/orchestration.ts +1022 -0
  184. package/lib/task/review-artifacts.ts +201 -69
  185. package/lib/task/review-finalization.ts +306 -0
  186. package/lib/task/review-fingerprint.ts +5 -0
  187. package/lib/task/task-execution-lock.ts +296 -0
  188. package/lib/task/verification-checks.ts +2 -1
  189. package/lib/task/verification-engine.ts +424 -28
  190. package/lib/task/verification-review.ts +1 -0
  191. package/lib/task/verification.ts +8 -3
  192. package/lib/task/workspace-snapshot.ts +57 -0
  193. package/lib/update.ts +48 -184
  194. package/package.json +4 -4
  195. package/templates/.agents/QUICKSTART.en.md +25 -8
  196. package/templates/.agents/QUICKSTART.zh-CN.md +25 -8
  197. package/templates/.agents/README.en.md +29 -25
  198. package/templates/.agents/README.zh-CN.md +29 -25
  199. package/templates/.agents/hooks/lifecycle-delegation.js +75 -0
  200. package/templates/.agents/rules/README.en.md +2 -0
  201. package/templates/.agents/rules/README.zh-CN.md +2 -0
  202. package/templates/.agents/rules/commit-and-pr.en.md +1 -0
  203. package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -0
  204. package/templates/.agents/rules/create-issue.github.en.md +4 -2
  205. package/templates/.agents/rules/create-issue.github.zh-CN.md +4 -2
  206. package/templates/.agents/rules/human-decision-context.en.md +14 -12
  207. package/templates/.agents/rules/human-decision-context.zh-CN.md +14 -12
  208. package/templates/.agents/rules/issue-fields.github.en.md +3 -1
  209. package/templates/.agents/rules/issue-fields.github.zh-CN.md +3 -1
  210. package/templates/.agents/rules/issue-pr-commands.en.md +5 -3
  211. package/templates/.agents/rules/issue-pr-commands.github.en.md +5 -3
  212. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +5 -3
  213. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +5 -3
  214. package/templates/.agents/rules/issue-sync.github.en.md +7 -3
  215. package/templates/.agents/rules/issue-sync.github.zh-CN.md +8 -4
  216. package/templates/.agents/rules/lifecycle-orchestration.en.md +24 -0
  217. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +24 -0
  218. package/templates/.agents/rules/milestone-inference.github.en.md +4 -2
  219. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +4 -2
  220. package/templates/.agents/rules/next-step-output.en.md +18 -0
  221. package/templates/.agents/rules/next-step-output.zh-CN.md +18 -0
  222. package/templates/.agents/rules/no-mid-flow-questions.en.md +19 -0
  223. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +19 -0
  224. package/templates/.agents/rules/pr-checks-commands.en.md +3 -3
  225. package/templates/.agents/rules/pr-checks-commands.github.en.md +2 -2
  226. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +2 -2
  227. package/templates/.agents/rules/pr-checks-commands.zh-CN.md +3 -3
  228. package/templates/.agents/rules/pr-sync.en.md +3 -1
  229. package/templates/.agents/rules/pr-sync.github.en.md +11 -1
  230. package/templates/.agents/rules/pr-sync.github.zh-CN.md +11 -1
  231. package/templates/.agents/rules/pr-sync.zh-CN.md +3 -1
  232. package/templates/.agents/rules/release-commands.en.md +1 -1
  233. package/templates/.agents/rules/release-commands.github.en.md +21 -5
  234. package/templates/.agents/rules/release-commands.github.zh-CN.md +21 -5
  235. package/templates/.agents/rules/release-commands.zh-CN.md +1 -1
  236. package/templates/.agents/rules/review-handshake.en.md +4 -4
  237. package/templates/.agents/rules/review-handshake.zh-CN.md +4 -4
  238. package/templates/.agents/rules/review-method.en.md +113 -0
  239. package/templates/.agents/rules/review-method.zh-CN.md +98 -0
  240. package/templates/.agents/rules/task-management.en.md +11 -0
  241. package/templates/.agents/rules/task-management.zh-CN.md +11 -0
  242. package/templates/.agents/skills/analyze-task/SKILL.en.md +15 -12
  243. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +15 -12
  244. package/templates/.agents/skills/block-task/SKILL.en.md +11 -9
  245. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +11 -9
  246. package/templates/.agents/skills/cancel-task/SKILL.en.md +10 -8
  247. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +11 -9
  248. package/templates/.agents/skills/check-task/SKILL.en.md +16 -16
  249. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -16
  250. package/templates/.agents/skills/close-codescan/SKILL.en.md +7 -5
  251. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -5
  252. package/templates/.agents/skills/close-dependabot/SKILL.en.md +7 -5
  253. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -5
  254. package/templates/.agents/skills/code-task/SKILL.en.md +10 -7
  255. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +13 -10
  256. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +14 -16
  257. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +14 -16
  258. package/templates/.agents/skills/code-task/reference/output-template.en.md +3 -3
  259. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +3 -3
  260. package/templates/.agents/skills/commit/SKILL.en.md +13 -1
  261. package/templates/.agents/skills/commit/SKILL.zh-CN.md +13 -1
  262. package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -1
  263. package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -1
  264. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
  265. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
  266. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  267. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  268. package/templates/.agents/skills/commit/reference/task-status-update.en.md +24 -28
  269. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +24 -28
  270. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +6 -4
  271. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +6 -4
  272. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
  273. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
  274. package/templates/.agents/skills/complete-task/SKILL.en.md +23 -8
  275. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +23 -8
  276. package/templates/.agents/skills/complete-task/config/verify.en.json +1 -0
  277. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -0
  278. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +17 -0
  279. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +17 -0
  280. package/templates/.agents/skills/create-pr/SKILL.en.md +13 -11
  281. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +13 -11
  282. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
  283. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
  284. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +3 -3
  285. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +3 -3
  286. package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -16
  287. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +17 -16
  288. package/templates/.agents/skills/create-task/SKILL.en.md +16 -14
  289. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +16 -14
  290. package/templates/.agents/skills/import-codescan/SKILL.en.md +5 -5
  291. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +5 -5
  292. package/templates/.agents/skills/import-dependabot/SKILL.en.md +5 -5
  293. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +5 -5
  294. package/templates/.agents/skills/import-issue/SKILL.en.md +10 -8
  295. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +10 -8
  296. package/templates/.agents/skills/init-labels/SKILL.en.md +4 -4
  297. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +4 -4
  298. package/templates/.agents/skills/init-milestones/SKILL.en.md +4 -4
  299. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -4
  300. package/templates/.agents/skills/plan-task/SKILL.en.md +13 -10
  301. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +13 -10
  302. package/templates/.agents/skills/post-release/SKILL.en.md +2 -0
  303. package/templates/.agents/skills/post-release/SKILL.zh-CN.md +2 -0
  304. package/templates/.agents/skills/refine-title/SKILL.en.md +1 -1
  305. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -1
  306. package/templates/.agents/skills/release/SKILL.en.md +16 -10
  307. package/templates/.agents/skills/release/SKILL.zh-CN.md +16 -10
  308. package/templates/.agents/skills/restore-task/SKILL.en.md +4 -1
  309. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -1
  310. package/templates/.agents/skills/review-analysis/SKILL.en.md +18 -4
  311. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +19 -5
  312. package/templates/.agents/skills/review-analysis/config/verify.en.json +6 -0
  313. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +6 -0
  314. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +13 -15
  315. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +13 -15
  316. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +51 -5
  317. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +52 -6
  318. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +25 -22
  319. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +25 -22
  320. package/templates/.agents/skills/review-code/SKILL.en.md +35 -12
  321. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +35 -12
  322. package/templates/.agents/skills/review-code/config/verify.en.json +7 -0
  323. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +7 -0
  324. package/templates/.agents/skills/review-code/reference/concurrency-risks.en.md +25 -0
  325. package/templates/.agents/skills/review-code/reference/concurrency-risks.zh-CN.md +25 -0
  326. package/templates/.agents/skills/review-code/reference/cross-platform-risks.en.md +27 -0
  327. package/templates/.agents/skills/review-code/reference/cross-platform-risks.zh-CN.md +27 -0
  328. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.en.md +13 -0
  329. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.zh-CN.md +13 -0
  330. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +25 -0
  331. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +25 -0
  332. package/templates/.agents/skills/review-code/reference/output-templates.en.md +22 -24
  333. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +22 -24
  334. package/templates/.agents/skills/review-code/reference/report-template.en.md +54 -7
  335. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +54 -7
  336. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +29 -24
  337. package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +29 -24
  338. package/templates/.agents/skills/review-code/reference/security-risks.en.md +25 -0
  339. package/templates/.agents/skills/review-code/reference/security-risks.zh-CN.md +25 -0
  340. package/templates/.agents/skills/review-plan/SKILL.en.md +18 -4
  341. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +19 -5
  342. package/templates/.agents/skills/review-plan/config/verify.en.json +6 -0
  343. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +6 -0
  344. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +13 -15
  345. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +13 -15
  346. package/templates/.agents/skills/review-plan/reference/report-template.en.md +61 -5
  347. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +61 -5
  348. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +21 -24
  349. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +21 -24
  350. package/templates/.agents/skills/review-pr/SKILL.en.md +158 -0
  351. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +158 -0
  352. package/templates/.agents/skills/review-pr/config/verify.en.json +37 -0
  353. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +37 -0
  354. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +65 -0
  355. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +65 -0
  356. package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +18 -0
  357. package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +18 -0
  358. package/templates/.agents/skills/review-pr/reference/report-template.en.md +85 -0
  359. package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +85 -0
  360. package/templates/.agents/skills/run-task/SKILL.en.md +22 -0
  361. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +22 -0
  362. package/templates/.agents/skills/run-task/config/verify.en.json +10 -0
  363. package/templates/.agents/skills/run-task/config/verify.zh-CN.json +10 -0
  364. package/templates/.agents/skills/run-task/reference/host-validation.en.md +20 -0
  365. package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +20 -0
  366. package/templates/.agents/skills/test/SKILL.en.md +4 -4
  367. package/templates/.agents/skills/test/SKILL.zh-CN.md +4 -4
  368. package/templates/.agents/skills/test-integration/SKILL.en.md +4 -4
  369. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +4 -4
  370. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +5 -5
  371. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +5 -5
  372. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +664 -246
  373. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +4 -4
  374. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +4 -4
  375. package/templates/.agents/skills/watch-pr/SKILL.en.md +21 -21
  376. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +21 -21
  377. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +27 -6
  378. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +26 -5
  379. package/templates/.agents/templates/task.en.md +1 -1
  380. package/templates/.agents/templates/task.zh-CN.md +1 -1
  381. package/templates/.agents/workflows/bug-fix.en.yaml +3 -3
  382. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +3 -3
  383. package/templates/.agents/workflows/code-review.en.yaml +1 -1
  384. package/templates/.agents/workflows/code-review.zh-CN.yaml +1 -1
  385. package/templates/.agents/workflows/feature-development.en.yaml +4 -4
  386. package/templates/.agents/workflows/feature-development.zh-CN.yaml +4 -4
  387. package/templates/.agents/workflows/refactoring.en.yaml +3 -3
  388. package/templates/.agents/workflows/refactoring.zh-CN.yaml +3 -3
  389. package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +6 -0
  390. package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +6 -0
  391. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +6 -0
  392. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +6 -0
  393. package/templates/.claude/commands/post-release.en.md +1 -0
  394. package/templates/.claude/commands/post-release.zh-CN.md +1 -0
  395. package/templates/.claude/commands/review-pr.en.md +8 -0
  396. package/templates/.claude/commands/review-pr.zh-CN.md +8 -0
  397. package/templates/.claude/commands/run-task.en.md +8 -0
  398. package/templates/.claude/commands/run-task.zh-CN.md +8 -0
  399. package/templates/.claude/settings.json +24 -0
  400. package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +3 -0
  401. package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +3 -0
  402. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +3 -0
  403. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +3 -0
  404. package/templates/.gemini/commands/_project_/review-pr.en.toml +10 -0
  405. package/templates/.gemini/commands/_project_/review-pr.zh-CN.toml +10 -0
  406. package/templates/.opencode/commands/post-release.en.md +2 -0
  407. package/templates/.opencode/commands/post-release.zh-CN.md +2 -0
  408. package/templates/.opencode/commands/review-pr.en.md +11 -0
  409. package/templates/.opencode/commands/review-pr.zh-CN.md +11 -0
  410. package/templates/.opencode/commands/run-task.en.md +11 -0
  411. package/templates/.opencode/commands/run-task.zh-CN.md +11 -0
  412. package/templates/.gemini/commands/_project_/analyze-task.en.toml +0 -10
  413. package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +0 -10
  414. package/templates/.gemini/commands/_project_/archive-tasks.en.toml +0 -10
  415. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +0 -10
  416. package/templates/.gemini/commands/_project_/block-task.en.toml +0 -10
  417. package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +0 -10
  418. package/templates/.gemini/commands/_project_/cancel-task.en.toml +0 -10
  419. package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +0 -10
  420. package/templates/.gemini/commands/_project_/check-task.en.toml +0 -10
  421. package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +0 -10
  422. package/templates/.gemini/commands/_project_/close-codescan.en.toml +0 -8
  423. package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +0 -8
  424. package/templates/.gemini/commands/_project_/close-dependabot.en.toml +0 -8
  425. package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +0 -8
  426. package/templates/.gemini/commands/_project_/code-task.en.toml +0 -10
  427. package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +0 -10
  428. package/templates/.gemini/commands/_project_/commit.en.toml +0 -10
  429. package/templates/.gemini/commands/_project_/commit.zh-CN.toml +0 -10
  430. package/templates/.gemini/commands/_project_/complete-manual-validation.en.toml +0 -10
  431. package/templates/.gemini/commands/_project_/complete-manual-validation.zh-CN.toml +0 -10
  432. package/templates/.gemini/commands/_project_/complete-task.en.toml +0 -10
  433. package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +0 -10
  434. package/templates/.gemini/commands/_project_/create-pr.en.toml +0 -10
  435. package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +0 -10
  436. package/templates/.gemini/commands/_project_/create-release-note.en.toml +0 -8
  437. package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +0 -8
  438. package/templates/.gemini/commands/_project_/create-task.en.toml +0 -8
  439. package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +0 -8
  440. package/templates/.gemini/commands/_project_/import-codescan.en.toml +0 -8
  441. package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +0 -8
  442. package/templates/.gemini/commands/_project_/import-dependabot.en.toml +0 -8
  443. package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +0 -8
  444. package/templates/.gemini/commands/_project_/import-issue.en.toml +0 -8
  445. package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +0 -8
  446. package/templates/.gemini/commands/_project_/init-labels.en.toml +0 -8
  447. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +0 -8
  448. package/templates/.gemini/commands/_project_/init-milestones.en.toml +0 -10
  449. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +0 -10
  450. package/templates/.gemini/commands/_project_/plan-task.en.toml +0 -10
  451. package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +0 -10
  452. package/templates/.gemini/commands/_project_/post-release.en.toml +0 -6
  453. package/templates/.gemini/commands/_project_/post-release.zh-CN.toml +0 -6
  454. package/templates/.gemini/commands/_project_/refine-title.en.toml +0 -8
  455. package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +0 -8
  456. package/templates/.gemini/commands/_project_/release.en.toml +0 -8
  457. package/templates/.gemini/commands/_project_/release.zh-CN.toml +0 -8
  458. package/templates/.gemini/commands/_project_/restore-task.en.toml +0 -8
  459. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +0 -8
  460. package/templates/.gemini/commands/_project_/review-analysis.en.toml +0 -10
  461. package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +0 -10
  462. package/templates/.gemini/commands/_project_/review-code.en.toml +0 -10
  463. package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +0 -10
  464. package/templates/.gemini/commands/_project_/review-plan.en.toml +0 -10
  465. package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +0 -10
  466. package/templates/.gemini/commands/_project_/test-integration.en.toml +0 -6
  467. package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +0 -6
  468. package/templates/.gemini/commands/_project_/test.en.toml +0 -6
  469. package/templates/.gemini/commands/_project_/test.zh-CN.toml +0 -6
  470. package/templates/.gemini/commands/_project_/update-agent-infra.en.toml +0 -6
  471. package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +0 -6
  472. package/templates/.gemini/commands/_project_/upgrade-dependency.en.toml +0 -8
  473. package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +0 -8
  474. package/templates/.gemini/commands/_project_/watch-pr.en.toml +0 -10
  475. package/templates/.gemini/commands/_project_/watch-pr.zh-CN.toml +0 -10
  476. package/templates/.gemini/settings.json +0 -3
@@ -0,0 +1,24 @@
1
+ # 通用规则 - 生命周期总控
2
+
3
+ ## 保证边界
4
+
5
+ - 总控只路由和委派;阶段技能仍是业务规则与产物格式的单一事实源。
6
+ - 每个阶段和每轮返工都创建 fresh executor;每轮审查创建 fresh reviewer,禁止 follow-up 复用。
7
+ - reviewer 只能写当前审查产物和核心生成的任务元数据。业务代码、HEAD 或暂存区变化会使 receipt 失效。
8
+ - active run 中只有一个 pending delegation。缺失、错配、fork、重放、hook 不可用或工作区漂移一律暂停。
9
+ - 首版成功终点是一次通过既有安全门禁的 `commit`;不创建 PR、不监控 checks、不执行 `complete-task`。
10
+
11
+ ## 恢复语义
12
+
13
+ `orchestration.json` 是详细状态源。v2 run 保存完整策略、来源与 append-only 恢复历史。只有无 pending delegation 且零历史 receipt 的 v1 run 可在补齐完整策略后原地升级;任一历史 receipt 因缺 effort 证据保持暂停。其他阻塞、未封存 receipt 或基线漂移继续保持暂停。迁移是 forward-only,旧二进制不得推进 v2 active run。
14
+
15
+ ## 模型策略
16
+
17
+ - 新 run 必须固化 executor/reviewer 各自的 model 与 reasoning effort;显式策略必须四字段原子完整,完全没有显式字段时才读取当前 client 的 `agentClients[].orchestration`。重入不得静默改写策略。
18
+ - route 按 role 返回 requested model/effort,prepare 必须在工作区快照前精确匹配两者;原生 spawn 不能继承会话默认值。
19
+ - 原生 start 必须记录宿主观察到的 actual model/effort。任一字段与 requested 不同时必须记录独立 fallback reason;requested 值不得补造 actual 证据。
20
+ - 模型选择能力必须标记 complete catalog、partial catalog 或 interactive-only guidance;局部 override 枚举不得冒充完整目录。
21
+
22
+ ## 稳定暂停条件
23
+
24
+ 人工裁决、人工验证、握手或总步骤上限、权限/网络失败、用户工作区冲突、客户端 capability 不支持及未知 hook schema 都持久化为暂停原因。总控不得中途询问或降级为同上下文自审。
@@ -1,13 +1,15 @@
1
1
  # Milestone Inference
2
2
 
3
+ > `--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.
4
+
3
5
  Milestones narrow through declarative Issue intents:
4
6
 
5
7
  ```bash
6
8
  # create/import phase
7
- agent-infra-internal platform-issue sync {task-id} --agent {agent} --milestone initial
9
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone initial
8
10
 
9
11
  # code phase
10
- agent-infra-internal platform-issue sync {task-id} --agent {agent} --milestone specific
12
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific
11
13
  ```
12
14
 
13
15
  `initial` prefers a valid task milestone, otherwise the lowest open `X.Y.x`, then `General Backlog`. `specific` narrows a release line to the highest open patch version using main/release-line ancestry. Missing facts or triage permission preserve the remote value and return skipped/degraded. `create-pr` reuses the Issue milestone in the 09/10 PR adapter.
@@ -1,11 +1,13 @@
1
1
  # Milestone 推断规则
2
2
 
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
4
+
3
5
  Milestone 继续按生命周期逐步收窄,但候选读取、分支判断、权限降级和写入统一由 `platform-issue` 处理。
4
6
 
5
7
  ## 阶段 1:创建或导入
6
8
 
7
9
  ```bash
8
- agent-infra-internal platform-issue sync {task-id} --agent {agent} --milestone initial
10
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone initial
9
11
  ```
10
12
 
11
13
  优先使用 task.md 中存在且有效的显式 milestone;否则从 open milestones 选择最低 `X.Y.x` 版本线,最后回退 `General Backlog`。`triage=false` 或外部事实不足时保持远端值并返回 skipped/degraded。
@@ -13,7 +15,7 @@ agent-infra-internal platform-issue sync {task-id} --agent {agent} --milestone i
13
15
  ## 阶段 2:`code-task`
14
16
 
15
17
  ```bash
16
- agent-infra-internal platform-issue sync {task-id} --agent {agent} --milestone specific
18
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific
17
19
  ```
18
20
 
19
21
  版本线收窄规则保持不变:主干模式在当前版本线取最高 patch;多版本分支模式依据 release-line/main 祖先关系选择版本线。无法可靠判断时保持原值。完成门禁仍拒绝 `X.Y.x`。
@@ -20,6 +20,24 @@ This file defines four **independent** rules for a skill's "notify-user / Next s
20
20
  - **"Task info" / "Task status" structured field lines** → show full id and short id together: `- Task ID: {task-id} (short id {task-ref})`.
21
21
  - **Report titles** (`Task {task-id} ... completed`) and **artifact paths** (`.agents/workspace/active/{task-id}/...`) → keep the full `{task-id}` (physical path and archive key, must not change).
22
22
 
23
+ ## Unified Client Command Rendering
24
+
25
+ Next-step client commands must come from the shared helper; skills and output templates must not assemble client command tables themselves:
26
+
27
+ ```bash
28
+ agent-infra-internal agent-client next-steps \
29
+ --skill {next-skill-name} \
30
+ [--task-ref {task-ref}] \
31
+ [--version {version}]
32
+ ```
33
+
34
+ - Pass the next skill name for the already-selected scenario. Include `--task-ref` only when that command needs a task reference.
35
+ - Include `--version` only for a versioned release command. It must start with a digit and satisfy `semver.valid(raw) === raw`; never pass an action, complete command, shell fragment, whitespace, or a `v` / `V` / `=` prefix.
36
+ - The helper lists only built-in clients enabled in `.agents/.airc.json` `agentClients`, followed by valid `customTUIs` in configuration order.
37
+ - Insert non-empty stdout verbatim at `{next-step-commands}` below the current "Next steps" heading. When stdout is empty, omit the client command block while still rendering reminders, warnings, and `Completed at`.
38
+ - If the helper writes stderr or exits non-zero, use the current skill's error path and stop; never fall back to a hard-coded client table.
39
+ - A complex skill selects one scenario first and invokes the helper once for that scenario; it must not pre-render every branch.
40
+
23
41
  ## Obtaining the short id (`{task-ref}`)
24
42
 
25
43
  The single source of truth for short ids is the registry `.agents/workspace/active/.short-ids.json` (via `task-short-id.js`). **Never** read the `short_id` field from task.md frontmatter (that field is not authoritative).
@@ -20,6 +20,24 @@
20
20
  - **「任务信息」/「任务状态」结构化字段行** → 完整 ID 与短号同显:`- 任务 ID:{task-id}(短号 {task-ref})`。
21
21
  - **报告标题**(`任务 {task-id} ... 完成`)与**产出文件路径**(`.agents/workspace/active/{task-id}/...`)→ 保持完整 `{task-id}`(物理路径与归档键,不可改)。
22
22
 
23
+ ## 统一客户端命令渲染
24
+
25
+ 下一步客户端命令必须由统一 helper 生成,skill 和输出模板不得自行拼接客户端命令表:
26
+
27
+ ```bash
28
+ agent-infra-internal agent-client next-steps \
29
+ --skill {next-skill-name} \
30
+ [--task-ref {task-ref}] \
31
+ [--version {version}]
32
+ ```
33
+
34
+ - 静态传入当前已选场景的下一 skill 名;只有命令需要任务引用时才传 `--task-ref`。
35
+ - 只有版本化发布命令需要版本时才传 `--version`;值必须是以数字开头且 `semver.valid(raw) === raw` 的规范 SemVer。不得传 action、完整命令、shell 片段、空白或 `v` / `V` / `=` 前缀。
36
+ - helper 只展示 `.agents/.airc.json` 中 `agentClients` 已启用的内建客户端,并在其后按配置顺序追加合法的 `customTUIs`。
37
+ - 将非空 stdout 原样放入当前“下一步”标题后的 `{next-step-commands}`;stdout 为空时省略整个客户端命令块,但继续输出提醒、告警和 `Completed at`。
38
+ - helper 写 stderr 或返回非零时,按当前 skill 的错误路径报告并停止;禁止回退到硬编码客户端表。
39
+ - 复杂 skill 先选定唯一场景,再只为该场景调用一次 helper,不得提前渲染所有分支。
40
+
23
41
  ## 取短号(`{task-ref}`)
24
42
 
25
43
  短号唯一真源是注册表 `.agents/workspace/active/.short-ids.json`(经 `task-short-id.js`)。**禁止**读取 task.md frontmatter 的 `short_id` 字段(该字段不可信)。
@@ -39,6 +39,23 @@ SKILLs currently covered by this exemption:
39
39
 
40
40
  - `analyze-task`: when the task description/requirements are insufficient for a reliable analysis, it may ask questions one at a time at the entry point to converge the requirements
41
41
 
42
+ ### Exemption 4: Remote-publish authorization for the current snapshot
43
+
44
+ After preparation in the current session and presentation of the latest snapshot or exact content, one question may ask whether to perform that remote publish. Authorization never carries across sessions or snapshots. Denial, adjustment, a question, ambiguity, or interruption fails closed without a remote write.
45
+
46
+ SKILLs currently covered by this exemption:
47
+
48
+ - `release`: may confirm publish after presenting the latest release snapshot
49
+ - `create-release-note`: may confirm publish after presenting exact staged notes and their digest
50
+
51
+ ### Exemption 5: Complete model policy missing at lifecycle start
52
+
53
+ Only when `run-task` receives `ORCHESTRATION_MODEL_POLICY_REQUIRED` before any run, baseline, receipt, or child is created may it show model-selection context with its completeness label and ask once for complete executor/reviewer model + reasoning effort. Partial explicit policy, a missing client, active delegation, and other pause causes do not qualify. No answer means no run is created.
54
+
55
+ SKILLs currently covered by this exemption:
56
+
57
+ - `run-task`: may collect only the atomic model policy explicitly required by core
58
+
42
59
  ## No-Mid-Flow-Questions Clause (default behavior)
43
60
 
44
61
  For every SKILL execution context not covered by any exemption above, the default behavior is:
@@ -78,6 +95,8 @@ A mandatory human review checkpoint means:
78
95
 
79
96
  If a key decision needs human judgment during execution, follow the rule above and register the detail identity through the structured `decision-next-id` / `decision-upsert` commands for the user to address at the review checkpoint; ordinary open questions still go to `## Open Questions` / `未决问题`.
80
97
 
98
+ The `run-task` orchestrator may continue after a child skill artifact only when core mechanical state permits it; this does not bypass human decisions. When core reports a human decision, manual validation, or another stable pause condition, the orchestrator must stop without asking mid-flow or approving it itself.
99
+
81
100
  ## Anchor Location
82
101
 
83
102
  This rule's sole global anchor lives in the project-level AGENTS.md "AI Behavior Principles" preamble, which every AI tool loads. Individual SKILL.md files no longer reference this rule, so no per-skill duplicate bullet needs to be maintained.
@@ -39,6 +39,23 @@
39
39
 
40
40
  - `analyze-task`:任务描述/需求信息不足以支撑可靠分析时,可在入口处逐个提问收敛需求
41
41
 
42
+ ### 例外 4:当前快照的远端发布授权
43
+
44
+ 仅允许在当前会话已完成准备、已展示待发布的最新快照或精确内容后,询问一次是否执行对应远端发布。确认不跨会话、不跨快照复用;否定、调整、疑问、歧义或中断均 fail closed,不得写入远端。
45
+
46
+ 当前归入本例外的 SKILL:
47
+
48
+ - `release`:展示最新 release snapshot 后确认是否 publish
49
+ - `create-release-note`:展示 stage 后的精确 notes 与摘要后确认是否 publish
50
+
51
+ ### 例外 5:生命周期启动缺少完整模型策略
52
+
53
+ 仅当 `run-task` 在创建任何 run、baseline、receipt 或 child 之前收到核心错误 `ORCHESTRATION_MODEL_POLICY_REQUIRED` 时,可展示带完整性标签的模型选择上下文,并一次询问 executor/reviewer 的完整 model + reasoning effort。部分显式策略、缺少 client、active delegation 或其他暂停原因不适用;用户未回答时不得创建 run。
54
+
55
+ 当前归入本例外的 SKILL:
56
+
57
+ - `run-task`:仅补齐核心明确要求的原子模型策略
58
+
42
59
  ## 禁言条款(默认行为)
43
60
 
44
61
  不属于上述任一例外的所有 SKILL 执行场景,遵循以下默认行为:
@@ -78,6 +95,8 @@
78
95
 
79
96
  如果在执行过程中发现需要用户裁定的关键决策,按上文「关键设计决策标记与落账」处理:通过 `decision-next-id` / `decision-upsert` 结构化命令登记详情块与账本身份,由用户在审查检查点统一回应;普通未决问题仍写 `## 未决问题` / `Open Questions`。
80
97
 
98
+ `run-task` 总控可以在子技能产出后依据核心机械状态继续到下一阶段;这不构成绕过人工裁决。只要核心返回人工裁决、人工验证或其他稳定暂停条件,总控必须停止,不能向用户中途提问,也不能自行批准。
99
+
81
100
  ## 锚点位置
82
101
 
83
102
  本规则的唯一全局锚点在项目级 AGENTS.md 的「AI 行为准则」preamble,所有 AI 工具加载 AGENTS.md 时即可见。各 SKILL.md 不再单独引用本规则,避免在每个 SKILL 顶部维护重复 bullet。
@@ -1,6 +1,6 @@
1
- # Required-checks Platform Intents
1
+ # PR Readiness Platform Intents
2
2
 
3
- Typed intents own required-only selection, polling deadlines, run/job resolution, and log retrieval. The skill/model owns failure classification, root-cause analysis, minimum fixes, tests, and authorized commit/push actions.
3
+ Typed intents own required-check selection, PR mergeability, polling deadlines, run/job resolution, and logs. Every inspect/poll aggregates facts from one PR head snapshot; facts are never mixed across heads.
4
4
 
5
5
  ```bash
6
6
  agent-infra-internal platform-checks inspect {task-id}
@@ -15,4 +15,4 @@ agent-infra-internal platform-checks logs {task-id} \
15
15
  --run {run-id} [--job {job-id}]
16
16
  ```
17
17
 
18
- `checks.state` is `passed|failed|pending|timed-out|cancelled|no-required`. Green/no-required exits 0; definite failure/cancellation exits 1; pending, timeout, or network blocking exits 2. Each platform adapter validates its own dependencies before operations and preserves dependency or deterministic platform errors without compatibility degradation. Run resolution prefers a validated details URL and otherwise requires one exact PR-head/check-name match. Platform intents never edit business code or push.
18
+ `readiness.state` is `ready|conflicting|checks-failed|pending|timed-out|cancelled` and carries `headSha`. Only `ready` exits 0; conflicting/check failures exit 1; all other readiness or network blocking exits 2. `checks.state` remains available as check-only diagnostics. Adapter dependency and deterministic platform errors are preserved without degradation. Platform intents never edit business code or push.
@@ -1,4 +1,4 @@
1
- # Required-checks Platform Intents
1
+ # GitHub PR Readiness Intents
2
2
 
3
3
  The GitHub adapter requires `gh >= 2.16.0`. Platform context checks this dependency before any GitHub API, PR, or checks operation. Projects that do not select GitHub neither probe nor depend on `gh`.
4
4
 
@@ -15,4 +15,4 @@ agent-infra-internal platform-checks logs {task-id} \
15
15
  --run {run-id} [--job {job-id}]
16
16
  ```
17
17
 
18
- The core owns required-only selection, deadlines, exact run/job resolution, and faithful logs. Green/no-required exits 0; definite failure exits 1; pending, timeout, or network blocking exits 2. Missing dependencies, unsupported versions, and deterministic platform failures preserve their structured errors without compatibility degradation. The skill/model still owns diagnosis, fixes, tests, and authorized commit/push actions.
18
+ The adapter normalizes REST `mergeable=false` to `conflicting`, null/missing to `unknown`, and true to `mergeable`; `mergeable=true` plus diagnostic `dirty` is contradictory and becomes `unknown`. Other diagnostics such as `blocked` do not override REST true. Core combines that fact with required checks for one `headSha`: only `ready` exits 0, `conflicting|checks-failed` exit 1, and pending/timeout/cancel/network blocking exit 2. Dependency and deterministic platform errors are preserved without degradation.
@@ -1,4 +1,4 @@
1
- # PR required checks 平台意图
1
+ # GitHub PR readiness 平台意图
2
2
 
3
3
  required checks 的筛选、轮询 deadline、失败 run/job 定位和日志获取统一由 typed internal intent 执行。SKILL/模型只负责失败分类、根因分析、最小修复和授权后的提交推送。
4
4
 
@@ -13,7 +13,7 @@ agent-infra-internal platform-checks watch {task-id} \
13
13
  --interval-seconds 30 --deadline-seconds 1800
14
14
  ```
15
15
 
16
- 结构化 `checks.state` 为 `passed|failed|pending|timed-out|cancelled|no-required`。`passed|no-required` 退出 0;确定失败/取消退出 1;pending、timeout 或网络阻塞退出 2。依赖缺失、版本过低和确定性平台错误直接返回其原始结构化错误,不执行兼容降级。
16
+ adapter 把 REST `mergeable=false` 规范化为 `conflicting`,null/缺失为 `unknown`,true 为 `mergeable`;true 与诊断 `dirty` 矛盾时降为 `unknown`。`blocked` 等其他诊断不覆盖 REST true。core 在同一 `headSha` 上与 required checks 聚合:仅 `ready` 退出 0,`conflicting|checks-failed` 退出 1,pending/timeout/cancel/网络阻塞退出 2。依赖与确定性平台错误不降级。
17
17
 
18
18
  ## 定位失败 run/job
19
19
 
@@ -1,6 +1,6 @@
1
- # PR required checks 平台意图
1
+ # PR readiness 平台意图
2
2
 
3
- required checks 的筛选、轮询 deadline、失败 run/job 定位和日志获取统一由 typed internal intent 执行。SKILL/模型只负责失败分类、根因分析、最小修复和授权后的提交推送。
3
+ required checks、PR mergeability、轮询 deadline、失败 run/job 定位和日志获取统一由 typed internal intent 执行。每次 inspect/poll 都在同一 PR head 快照上聚合,不跨 head 拼接事实。
4
4
 
5
5
  ## 快照与监控
6
6
 
@@ -11,7 +11,7 @@ agent-infra-internal platform-checks watch {task-id} \
11
11
  --interval-seconds 30 --deadline-seconds 1800
12
12
  ```
13
13
 
14
- 结构化 `checks.state` 为 `passed|failed|pending|timed-out|cancelled|no-required`。`passed|no-required` 退出 0;确定失败/取消退出 1;pending、timeout 或网络阻塞退出 2。平台 adapter 必须在操作前验证自身依赖;依赖或确定性平台错误直接透传,不执行兼容降级。
14
+ 结构化 `readiness.state` 为 `ready|conflicting|checks-failed|pending|timed-out|cancelled`,并携带 `headSha`。仅 `ready` 退出 0;`conflicting|checks-failed` 退出 1;其余或网络阻塞退出 2。`checks.state` 仍保留 check-only 诊断;平台 adapter 的依赖和确定性错误不降级。
15
15
 
16
16
  ## 定位失败 run/job
17
17
 
@@ -1,5 +1,7 @@
1
1
  # PR Summary Synchronization
2
2
 
3
+ > `--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.
4
+
3
5
  The model writes the semantic reviewer summary. Typed core owns canonical artifact selection, the marker, current HEAD, paginated comment lookup, and create/update/no-op reconciliation.
4
6
 
5
7
  ## Inputs
@@ -16,7 +18,7 @@ Write only the summary body to a file, without marker or SHA:
16
18
 
17
19
  ```bash
18
20
  agent-infra-internal platform-pr summary-sync {task-id} \
19
- --agent {agent} --body-file {summary-body-file}
21
+ --agent {standard-agent-token} --body-file {summary-body-file}
20
22
  ```
21
23
 
22
24
  The core wraps `<!-- sync-pr:{task-id}:summary -->` and current `<!-- last-commit: ... -->`, then creates, updates in place, or returns no-op. Duplicate markers fail deterministically. Callers never assemble shell/heredoc comment commands.
@@ -1,12 +1,22 @@
1
1
  # PR Summary Synchronization
2
2
 
3
+ > `--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.
4
+
3
5
  The model writes the semantic reviewer summary. Typed core owns canonical artifact selection, marker/HEAD wrapping, paginated comment lookup, and reconciliation.
4
6
 
7
+ ## Three-Layer Isolation
8
+
9
+ - `sync-pr:{task-id}:summary` (`platform-pr summary-sync`) is an updatable reviewer summary; it is neither a process copy nor a formal Review.
10
+ - The full `pr-review*` process copy lives in the Issue artifact comment (`platform-comment sync --kind artifact`) and is restored by `restore-task` under its Issue-only contract.
11
+ - A formal PR Review (`platform-pr-review publish`) is the only formal conclusion carrier published to the PR, bound to the reviewed head SHA, and includes conclusion, findings, receipt, and the Issue artifact link.
12
+
13
+ The three never cross: a regular PR comment does not carry the full process copy; an Issue artifact comment is not treated as a formal Review; a summary is not presented as a formal Review.
14
+
5
15
  ```bash
6
16
  agent-infra-internal platform-pr summary-context {task-id}
7
17
 
8
18
  agent-infra-internal platform-pr summary-sync {task-id} \
9
- --agent {agent} --body-file {summary-body-file}
19
+ --agent {standard-agent-token} --body-file {summary-body-file}
10
20
  ```
11
21
 
12
22
  Use only canonical inputs returned by the context command. Write the plain body without marker or SHA. The core owns `<!-- sync-pr:{task-id}:summary -->`, current `<!-- last-commit: ... -->`, create/update/no-op behavior, and duplicate-marker conflicts. Summary failure never rolls back a PR or commit.
@@ -1,7 +1,17 @@
1
1
  # PR 摘要同步
2
2
 
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
4
+
3
5
  PR 摘要的语义聚合由模型完成;canonical 产物选择、marker、当前 HEAD、分页评论查找和 create/update/no-op 由 typed core 负责。
4
6
 
7
+ ## 三层隔离
8
+
9
+ - `sync-pr:{task-id}:summary`(`platform-pr summary-sync`)是可更新的 reviewer 摘要,不是过程原文,也不是正式 Review。
10
+ - `pr-review*` 完整过程原文在 Issue artifact 评论(`platform-comment sync --kind artifact`),由 `restore-task` 按 Issue-only 契约恢复。
11
+ - 正式 PR Review(`platform-pr-review publish`)是唯一发布到 PR 的正式结论载体,绑定被审 head SHA,含结论、finding、receipt 与 Issue artifact 链接。
12
+
13
+ 三者不串用:PR 普通评论不承载完整过程原文;Issue artifact 评论不当作正式 Review;摘要不冒充正式 Review。
14
+
5
15
  ## 聚合输入
6
16
 
7
17
  ```bash
@@ -35,7 +45,7 @@ core 最终包装出的 canonical 评论结构为:
35
45
 
36
46
  ```bash
37
47
  agent-infra-internal platform-pr summary-sync {task-id} \
38
- --agent {agent} --body-file {summary-body-file}
48
+ --agent {standard-agent-token} --body-file {summary-body-file}
39
49
  ```
40
50
 
41
51
  core 会包装唯一 `<!-- sync-pr:{task-id}:summary -->` 和当前 `<!-- last-commit: ... -->`,分页查找 PR 普通评论:不存在则创建、正文变化则原地更新、无差异则 no-op、重复 marker 则稳定失败。正文通过文件输入,调用方不得拼 shell/heredoc。
@@ -1,5 +1,7 @@
1
1
  # PR 摘要同步
2
2
 
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
4
+
3
5
  PR 摘要的语义聚合由模型完成;canonical 产物选择、marker、当前 HEAD、分页评论查找和 create/update/no-op 由 typed core 负责。
4
6
 
5
7
  ## 聚合输入
@@ -23,7 +25,7 @@ agent-infra-internal platform-pr summary-context {task-id}
23
25
 
24
26
  ```bash
25
27
  agent-infra-internal platform-pr summary-sync {task-id} \
26
- --agent {agent} --body-file {summary-body-file}
28
+ --agent {standard-agent-token} --body-file {summary-body-file}
27
29
  ```
28
30
 
29
31
  core 会包装唯一 `<!-- sync-pr:{task-id}:summary -->` 和当前 `<!-- last-commit: ... -->`,分页查找 PR 普通评论:不存在则创建、正文变化则原地更新、无差异则 no-op、重复 marker 则稳定失败。正文通过文件输入,调用方不得拼 shell/heredoc。
@@ -2,4 +2,4 @@
2
2
 
3
3
  This code platform does not provide a release-note adapter.
4
4
 
5
- Use `agent-infra-internal platform-release-notes context` to receive a structured `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op. Do not probe another platform client. Publishing remains a no-op until an adapter is provided.
5
+ Local `agent-infra-internal platform-release-notes stage --notes-file "{notes-file}"` still normalizes an external file and returns its digest. Use `context` to receive a structured `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op and do not probe another platform client. Publish with `--expected-sha256` remains a no-op until an adapter is provided.
@@ -6,17 +6,33 @@ Release-note platform operations use a typed internal intent. Callers consume st
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-release-notes context \
9
- --from-tag "v{prev-version}" --to-tag "v{version}" \
10
- --branch "{branch}" --history-limit 3
9
+ --from-tag "v{prev-version}" \
10
+ --to-tag "v{version}" \
11
+ --branch "{branch}" \
12
+ --history-limit 3
11
13
  ```
12
14
 
13
- The result contains release history, pull requests, closing Issues, and normalized contributor identities. Unsupported platforms return a stable `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op.
15
+ The result contains `history`, `pullRequests`, `closingIssues`, and commit `authors` with normalized `login` / `resolution` values. `status: no-op` with error code `PLATFORM_RELEASE_NOTES_UNSUPPORTED` means the current platform does not support remote release-note operations.
16
+
17
+ ## Stage Release Notes
18
+
19
+ ```bash
20
+ agent-infra-internal platform-release-notes stage \
21
+ --notes-file "{notes-file}"
22
+ ```
23
+
24
+ The command accepts only an external regular file, normalizes it atomically, and returns SHA-256 for its exact bytes.
14
25
 
15
26
  ## Publish Release Notes
16
27
 
28
+ Call this only after user confirmation:
29
+
17
30
  ```bash
18
31
  agent-infra-internal platform-release-notes publish \
19
- --tag "v{version}" --title "v{version}" --notes-file "{notes-file}"
32
+ --tag "v{version}" \
33
+ --title "v{version}" \
34
+ --notes-file "{notes-file}" \
35
+ --expected-sha256 "{preview-sha256}"
20
36
  ```
21
37
 
22
- The command updates an existing Release or creates a missing one. `--dry-run` only plans the operation. Exit codes `0/1/2` mean success, failure, and blocked.
38
+ The command recomputes the digest before platform access and performs no platform write on mismatch. On a match it updates an existing Release or creates it when missing; `--dry-run` returns only the planned operation. Exit code `0` means success, `1` means a stable failure, and `2` means a network or platform block.
@@ -6,17 +6,33 @@
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-release-notes context \
9
- --from-tag "v{prev-version}" --to-tag "v{version}" \
10
- --branch "{branch}" --history-limit 3
9
+ --from-tag "v{prev-version}" \
10
+ --to-tag "v{version}" \
11
+ --branch "{branch}" \
12
+ --history-limit 3
11
13
  ```
12
14
 
13
- 结果包含历史发布、PR、关联 Issue 和规范化贡献者身份。不支持的平台返回稳定的 `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op。
15
+ 结果包含 `history`、`pullRequests`、`closingIssues` 和带规范化 `login` / `resolution` 的 commit `authors`。`status: no-op` 且错误码为 `PLATFORM_RELEASE_NOTES_UNSUPPORTED` 表示当前平台不支持远端发布说明能力。
16
+
17
+ ## Stage Release notes
18
+
19
+ ```bash
20
+ agent-infra-internal platform-release-notes stage \
21
+ --notes-file "{notes-file}"
22
+ ```
23
+
24
+ 命令只接受工作树外普通文件,原子规范化并返回精确 bytes 的 SHA-256。
14
25
 
15
26
  ## 发布 Release notes
16
27
 
28
+ 用户确认后调用:
29
+
17
30
  ```bash
18
31
  agent-infra-internal platform-release-notes publish \
19
- --tag "v{version}" --title "v{version}" --notes-file "{notes-file}"
32
+ --tag "v{version}" \
33
+ --title "v{version}" \
34
+ --notes-file "{notes-file}" \
35
+ --expected-sha256 "{preview-sha256}"
20
36
  ```
21
37
 
22
- 命令更新既有 Release,缺失时创建;`--dry-run` 只规划操作。退出码 `0/1/2` 分别表示成功、失败和阻塞。
38
+ 命令在平台访问前复算摘要,不匹配时零写入;匹配时更新已有 Release,缺失时创建。`--dry-run` 只返回 planned operation。退出码为 `0` 时成功,`1` 表示稳定失败,`2` 表示网络或平台阻塞。
@@ -2,4 +2,4 @@
2
2
 
3
3
  当前代码平台未提供发布说明 adapter。
4
4
 
5
- 调用 `agent-infra-internal platform-release-notes context` 会返回结构化的 `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op,不得探测其他平台 client。在提供 adapter 前,发布操作同样保持 no-op。
5
+ 本地 `agent-infra-internal platform-release-notes stage --notes-file "{notes-file}"` 仍可规范化工作树外文件并返回摘要。调用 `context` 会返回结构化的 `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op,不得探测其他平台 client;提供 adapter 前,带 `--expected-sha256` 的 publish 同样保持 no-op。
@@ -84,16 +84,16 @@ When an executor judges an item to be a key design decision that needs human rul
84
84
  - `evidence` points to the stable anchor `<artifact>#HD-N` (e.g. `plan-r2.md#HD-1`), not a drift-prone line number.
85
85
  - A human records the ruling with `ai decide <task-ref> <ordinal|ledger-id> <decision>`; the command flips the target row to `human-decided` and points `evidence` to an independent `HDR-N` ruling record.
86
86
 
87
- > Viewing, deciding, and typed verification share the `lib/task/ledger.ts` domain semantics.
87
+ > Viewing, deciding, and typed verification share the `lib/task/ledger.ts` domain semantics; no second parser is maintained.
88
88
 
89
89
  ## post-review commit gate (code stage only)
90
90
 
91
- - `review-code` captures the review baseline `R` (diff base), full-worktree diff fingerprint `F`, and normalized snapshot tree `T`. An Approved clean snapshot may set `B=R`; an Approved snapshot with uncommitted changes clears or omits `B`.
91
+ - `review-code` captures the reviewed commit `R` (this round's HEAD) and an independent diff base `D` exactly once. `F` covers the complete difference from D to the current worktree, while normalized snapshot tree `T` represents the current worktree. An Approved snapshot with `T == R^{tree}` may set `B=R`; an Approved snapshot with uncommitted changes clears or omits `B`.
92
92
  - `commit` reads only the highest-round Approved `review-code` artifact. Before committing it requires `pre_head == R`, complete worktree tree `W == T`, and normalized staged tree `S == T`; any mismatch blocks before `git commit` and reports added, missing, and different paths for both comparisons.
93
93
  - After a successful commit it sets `B=last_reviewed_commit=<new_head>`; B means only a reviewed snapshot anchored to a Git commit.
94
94
  - The `complete-task` `post-review-commit` gate uses only B. When B is absent, malformed, or missing as a Git object, it reports `reviewed snapshot was not anchored` and never falls back to R.
95
- - If new commits touch code / rule paths after B, the gate blocks and requires a fresh `review-code`. The only automatic exception is a bound merged GitHub PR whose platform snapshot proves B is the original PR head, whose merge commit is in local HEAD history, whose reviewed changes exactly match the normalized patch of a single-parent squash commit, and whose protected paths have no later commits. Missing platform or Git evidence fails closed.
96
- - Required checks remain a pre-merge responsibility of branch protection / rulesets and the `review-code` / `watch-pr` routes. The post-review-commit gate still applies the strict / squash-equivalent relation above independently.
95
+ - If new commits touch code / rule paths after B, the gate blocks and requires a fresh `review-code`. Automatic exceptions are limited to: (1) a bound platform change request (PR/MR) is merged and its platform adapter supplies an authoritative snapshot plus remote Git evidence refs; the gate fetches the reviewed head and target branch into an isolated temporary repository and proves B is the original change-request head, its merge commit is in authoritative target history, its reviewed changes exactly match the normalized patch of a single-parent squash commit, and its protected paths have no later commits; or (2) no valid change request, exactly one protected-path commit after B, that commit is a single-parent local rewrite in HEAD history, it has the same full tree or protected content as B, and no protected-path commits follow it. An unsupported adapter capability, missing required platform / Git evidence, or Git credentials that cannot read those remote refs fails closed.
96
+ - Required checks remain a pre-merge responsibility of branch protection / rulesets and the `review-code` / `watch-pr` routes. The post-review-commit gate still applies the applicable strict, PR-squash, or local-rewrite equivalence independently.
97
97
  - **Exemption**: append a ledger row `| PRC-1 | post-review-commit | - | - | human-decided | <ruling note> |` recording that a human explicitly allowed those commits without re-review.
98
98
 
99
99
  ## Gate behavior cheat sheet
@@ -84,16 +84,16 @@
84
84
  - `evidence` 指向稳定锚点 `<artifact>#HD-N`(如 `plan-r2.md#HD-1`),不依赖易漂移的行号。
85
85
  - 人工使用 `ai decide <task-ref> <序号|账本ID> <裁决内容>` 记录裁定;命令把目标行翻为 `human-decided`,并让 `evidence` 指向独立 `HDR-N` 裁定记录。
86
86
 
87
- > 查看、裁决与 typed verification 共用 `lib/task/ledger.ts` 的领域语义。
87
+ > 查看、裁决与 typed verification 共用 `lib/task/ledger.ts` 的领域语义,不维护第二 parser。
88
88
 
89
89
  ## post-review commit 门禁(仅 code 阶段)
90
90
 
91
- - `review-code` 一次性捕获审查基线 `R`(diff base)、完整工作区差异指纹 `F` 与规范化快照树 `T`;Approved 且快照干净时可令 `B=R`,Approved 且含未提交差异时清除/不写 `B`。
91
+ - `review-code` 一次性捕获审查提交 `R`(本轮 HEAD)与独立差异基线 `D`;`F` 覆盖 `D` 到当前工作区的完整差异,规范化快照树 `T` 表示当前工作区。Approved 且 `T == R^{tree}` 时可令 `B=R`,Approved 且含未提交差异时清除/不写 `B`。
92
92
  - `commit` 只读取最高轮 Approved `review-code` 产物;提交前比较 `pre_head == R`、完整工作区树 `W == T`、规范化暂存树 `S == T`,任一失配都在 `git commit` 前阻断并报告两组 added/missing/different 路径。
93
93
  - 成功提交后令 `B=last_reviewed_commit=<new_head>`;`B` 只表示已经落到 Git commit 的审查锚点。
94
94
  - `complete-task` 的 `post-review-commit` gate 只使用 B;B 缺失、畸形或对象不存在时报告 `reviewed snapshot was not anchored`,不得回退 R。
95
- - 若 B 之后代码 / 规则路径出现新提交,gate 会拦截,要求重新 `review-code`。唯一自动例外是绑定 GitHub PR 已合并,且平台快照证明 B 是原 PR head、merge commit 位于本地 HEAD 历史中、受审查变更与单父 squash commit 的规范化补丁完全一致,并且 merge 后受保护路径没有新提交;缺少任一平台或 Git 证据时 fail closed。
96
- - required checks 由合并前的分支保护 / ruleset 与 `review-code` / `watch-pr` 路由负责。post-review-commit 仍独立执行上述严格 / squash 等价判定。
95
+ - 若 B 之后代码 / 规则路径出现新提交,gate 会拦截,要求重新 `review-code`。自动例外仅限两类:(1) 绑定的平台变更请求(PR/MR)已合并,且平台适配器提供权威快照与远端 Git 证据引用;gate 在隔离的临时仓库中抓取受审查 head 与目标分支,证明 B 是原变更请求 head、merge commit 位于权威目标分支历史中、受审查变更与单父 squash commit 的规范化补丁完全一致,并且 merge 后受保护路径没有新提交;(2) 无有效变更请求,B 后恰有一个受保护路径提交,该提交是本地 HEAD 历史中的单父重写,且它与 B 的完整 tree 相同或受保护内容相同,重写后也没有受保护路径提交。适配器不支持该能力,缺少所需平台 / Git 证据,或当前 Git 凭据不能读取这些远端 refs 时 fail closed。
96
+ - required checks 由合并前的分支保护 / ruleset 与 `review-code` / `watch-pr` 路由负责。post-review-commit 仍独立执行适用的严格 / PR squash / 本地重写等价判定。
97
97
  - **豁免**:在账本追加一行 `| PRC-1 | post-review-commit | - | - | human-decided | <裁定说明> |`,记录人工明确允许该批提交免复审。
98
98
 
99
99
  ## gate 行为速查
@@ -0,0 +1,113 @@
1
+ # Shared Review Method
2
+
3
+ This rule defines the lightweight review protocol shared by the `analysis`, `plan`,
4
+ and `code` stages. Stage-specific checks remain in each skill's
5
+ `reference/review-criteria.md`; finding state, human decisions, and ledger writes
6
+ remain governed by [review-handshake.md](review-handshake.md); risk lenses only route
7
+ an observed risk to references that must then be loaded.
8
+
9
+ ## Responsibility Boundary
10
+
11
+ - This rule defines review order, evidence shape, and completion conditions without duplicating stage checklists.
12
+ - Observable evidence triggers risk lenses; every matched reference must be read and recorded in the report.
13
+ - Automation supplies facts; the reviewer judges completeness, impact, severity, confidence, and counterevidence.
14
+ - Report structure makes review claims traceable; it does not automatically prove that semantic judgments are correct.
15
+
16
+ ## Readiness
17
+
18
+ Before forming candidate findings, confirm that:
19
+
20
+ 1. The task, input artifact, upstream sources, and review scope are resolved and readable.
21
+ 2. The state snapshot, diff, or other factual evidence required by the skill has been captured.
22
+ 3. The reviewed artifact, baseline, and context boundary can be identified accurately in the report.
23
+
24
+ If any prerequisite is missing, an Approved verdict is forbidden; follow the owning
25
+ skill's blocked or failure path.
26
+
27
+ ## Multi-pass Review Protocol
28
+
29
+ Run these five passes in order. Record each pass's scope, evidence, result, and
30
+ gaps/assumptions in the report coverage table.
31
+
32
+ 1. **Pass 1 — Raw evidence**: read source requests, upstream artifacts, changes, and tests before executor summaries can anchor the review; form independent candidate issues.
33
+ 2. **Pass 2 — Traceability and boundaries**: map source → requirement → plan → implementation → test, looking for omissions, broken links, and unexpected scope.
34
+ 3. **Pass 3 — Risk lenses**: evaluate every registry trigger against the complete context, load every matched reference, and record trigger evidence and results.
35
+ 4. **Pass 4 — Counterevidence**: seek evidence that disproves or downgrades each candidate finding and counterexamples that could invalidate an approval.
36
+ 5. **Pass 5 — Classification and convergence**: classify issues as findings, manual-validation, or advisories; reconcile evidence contracts, ledger intents, unverified assumptions, and the verdict.
37
+
38
+ ## Risk Lens Registry
39
+
40
+ Registry rows use stable fields: `lens_id` identifies the lens, `stages` limits its
41
+ scope, `observable_trigger` states observable evidence, `required_reference` is
42
+ mandatory when matched, and `report_evidence` defines the audit trail.
43
+
44
+ | lens_id | stages | observable_trigger | required_reference | report_evidence |
45
+ |---------|--------|--------------------|--------------------|-----------------|
46
+ | documentation-antipatterns | code | The complete change context touches Markdown, rules, skills, CLI help, or user documentation that describes current behavior | `.agents/skills/review-code/reference/documentation-antipatterns.md` | Record triggering files, `loaded=yes`, and the lens result |
47
+ | testing-discipline | code | The complete change context touches tests, fixtures, snapshots, or test helpers | `.agents/rules/testing-discipline.md` | Record triggering files, `loaded=yes`, and the test-discipline result |
48
+ | security-risks | code | Authentication, authorization, untrusted input, sensitive data, credentials, cryptography, dependencies, or system boundaries change | `.agents/skills/review-code/reference/security-risks.md` | Record the changed security boundary, `loaded=yes`, and the lens result |
49
+ | migration-risks | code | Persistent formats, schemas, configuration/frontmatter, compatibility reads, migrations, or rollback behavior change | `.agents/skills/review-code/reference/migration-risks.md` | Record compatibility or migration evidence, `loaded=yes`, and the lens result |
50
+ | concurrency-risks | code | Async coordination, shared state, locks, retries, idempotency, races, cancellation, or timeouts change | `.agents/skills/review-code/reference/concurrency-risks.md` | Record the concurrency path, `loaded=yes`, and the lens result |
51
+ | cross-platform-risks | code | OS branches, paths, shells, permissions, symlinks, newlines, signals, or cross-platform behavior change | `.agents/skills/review-code/reference/cross-platform-risks.md` | Record platform evidence, `loaded=yes`, and the lens result |
52
+
53
+ Unmatched lenses still require reproducible non-trigger evidence. `loaded` accepts
54
+ only `yes`, `no`, or `not-applicable`; a matched but unloaded lens forbids approval.
55
+
56
+ ## Automation and Semantic Judgment
57
+
58
+ | Source | Facts it can support | Semantic judgment it cannot replace |
59
+ |--------|----------------------|-------------------------------------|
60
+ | snapshot, diff, link, test, artifact gate | files, scope, command results, reference existence, section existence | requirement completeness, design soundness, implementation correctness |
61
+ | traceability matrix | explicit mappings and visible gaps | mapping sufficiency, gap impact, priority |
62
+ | risk-lens record | trigger evidence, load status, lens result entry point | acceptable risk, finding severity, confidence |
63
+
64
+ When automated facts and semantic conclusions diverge, record each separately.
65
+ Never present a passing structural gate as proof of semantic completeness.
66
+
67
+ ## Context Coverage and Traceability Contract
68
+
69
+ Reports must contain both coverage tables:
70
+
71
+ | pass_id | scope | evidence | result | gaps_or_assumptions |
72
+ |---------|-------|----------|--------|---------------------|
73
+ | pass-1..5 | scope actually reviewed in this pass | locatable artifact, file, command, or line | finding or conclusion | uncovered item, gap, or assumption |
74
+
75
+ | lens_id | trigger_evidence | loaded | result |
76
+ |---------|------------------|--------|--------|
77
+ | registry token | reproducible trigger or non-trigger evidence | yes / no / not-applicable | lens conclusion |
78
+
79
+ Reports must also contain the shared traceability matrix:
80
+
81
+ | source_id | upstream | reviewed_target | verification | status_or_gap |
82
+ |-----------|----------|-----------------|--------------|---------------|
83
+ | stable source identifier | upstream requirement, decision, or step | object reviewed at this stage | automated or human evidence | covered / gap and impact |
84
+
85
+ Analysis traces sources to requirements, acceptance, impact, and risk. Plan traces
86
+ approved requirements to decisions, implementation steps, and test strategy. Code
87
+ traces requirements and plan steps to the diff and automated tests or human checks.
88
+
89
+ ## Finding Evidence Contract
90
+
91
+ Every blocker or major finding must include:
92
+
93
+ 1. **Scenario**: preconditions and the path that triggers the problem.
94
+ 2. **Impact**: concrete consequences for correctness, security, delivery, or acceptance.
95
+ 3. **Evidence**: reproducible artifact, `file:line`, command, and raw result.
96
+ 4. **Confidence**: stable token `high`, `medium`, or `low`.
97
+ 5. **Unverified assumptions**: claims not directly proven that would change the conclusion if disproved; explicitly state none when empty.
98
+ 6. **Fix direction**: the smallest actionable repair goal without redesigning outside the executor's authority.
99
+
100
+ Minor findings stay lightweight but still need a specific location and actionable
101
+ advice. The finding ledger's `evidence` continues to point to a stable report anchor;
102
+ no ledger fields are added. Handle manual-validation, advisories, and
103
+ `needs-human-decision` through the review handshake and stage rules.
104
+
105
+ ## Completion
106
+
107
+ A final verdict is allowed only when:
108
+
109
+ - All five passes record scope, evidence, result, and gaps/assumptions.
110
+ - Every risk trigger has a decision, and every matched lens was loaded and recorded.
111
+ - The traceability matrix covers the stage responsibility, with gaps classified as a finding, manual-validation, advisory, or explicit assumption.
112
+ - Every blocker/major satisfies the evidence contract and every candidate finding received a counterevidence pass.
113
+ - Ledger intents, manual checks, pending decisions, unverified assumptions, and finding counts agree.