@fitlab-ai/agent-infra 0.9.1 → 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 (283) hide show
  1. package/README.md +16 -4
  2. package/README.zh-CN.md +16 -4
  3. package/bin/cli.ts +12 -0
  4. package/dist/bin/cli.js +14 -0
  5. package/dist/bin/internal-cli.js +15 -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/release-workflow.js +71 -16
  31. package/dist/lib/internal/task-orchestration.js +151 -0
  32. package/dist/lib/internal/task-review.js +65 -0
  33. package/dist/lib/merge.js +2 -1
  34. package/dist/lib/platform/adapters.js +38 -1
  35. package/dist/lib/platform/change-request-git-evidence.js +113 -0
  36. package/dist/lib/platform/merged-pr-equivalence.js +41 -11
  37. package/dist/lib/platform/pr-checks.js +38 -10
  38. package/dist/lib/platform/pull-requests.js +110 -6
  39. package/dist/lib/platform/releases.js +1 -1
  40. package/dist/lib/platform/verification-required.js +8 -10
  41. package/dist/lib/prompt.js +15 -3
  42. package/dist/lib/release/channels.js +4 -1
  43. package/dist/lib/release/workflow.js +4 -2
  44. package/dist/lib/remove-dir.js +25 -0
  45. package/dist/lib/run/tui.js +8 -2
  46. package/dist/lib/sandbox/agent-client-reconciler.js +234 -0
  47. package/dist/lib/sandbox/clipboard/linux.js +2 -1
  48. package/dist/lib/sandbox/commands/create.js +76 -180
  49. package/dist/lib/sandbox/commands/enter.js +17 -1
  50. package/dist/lib/sandbox/commands/prune.js +2 -2
  51. package/dist/lib/sandbox/commands/rm.js +3 -2
  52. package/dist/lib/sandbox/config.js +21 -4
  53. package/dist/lib/sandbox/constants.js +3 -0
  54. package/dist/lib/sandbox/dockerfile.js +2 -1
  55. package/dist/lib/sandbox/managed-fs.js +10 -5
  56. package/dist/lib/sandbox/recovery.js +52 -36
  57. package/dist/lib/sandbox/shell.js +1 -1
  58. package/dist/lib/sandbox/tool-types.js +8 -0
  59. package/dist/lib/sandbox/tools.js +2 -126
  60. package/dist/lib/task/artifact-lifecycle.js +1 -49
  61. package/dist/lib/task/commands/decisions.js +50 -20
  62. package/dist/lib/task/delegation-receipts.js +107 -0
  63. package/dist/lib/task/events.js +100 -1
  64. package/dist/lib/task/orchestration.js +420 -0
  65. package/dist/lib/task/review-artifacts.js +143 -59
  66. package/dist/lib/task/review-finalization.js +166 -0
  67. package/dist/lib/task/review-fingerprint.js +4 -0
  68. package/dist/lib/task/verification-checks.js +2 -1
  69. package/dist/lib/task/verification-engine.js +156 -28
  70. package/dist/lib/task/verification-review.js +1 -1
  71. package/dist/lib/task/verification.js +3 -1
  72. package/dist/lib/task/workspace-snapshot.js +34 -0
  73. package/dist/lib/update.js +42 -161
  74. package/lib/agent-client.ts +214 -0
  75. package/lib/agent-clients/adapter.ts +461 -0
  76. package/lib/agent-clients/adapters/claude-code.ts +70 -0
  77. package/lib/agent-clients/adapters/codex-sandbox.ts +245 -0
  78. package/lib/agent-clients/adapters/codex.ts +58 -0
  79. package/lib/agent-clients/adapters/gemini-cli.ts +65 -0
  80. package/lib/agent-clients/adapters/index.ts +27 -0
  81. package/lib/agent-clients/adapters/opencode.ts +66 -0
  82. package/lib/agent-clients/config.ts +278 -0
  83. package/lib/agent-clients/custom-tuis.ts +149 -0
  84. package/lib/agent-clients/invocation.ts +19 -0
  85. package/lib/agent-clients/next-steps.ts +72 -0
  86. package/lib/agent-clients/project-assets.ts +96 -0
  87. package/lib/agent-clients/reconcile.ts +324 -0
  88. package/lib/agent-clients/registry.ts +144 -0
  89. package/lib/agent-clients/schema.ts +62 -0
  90. package/lib/agent-clients/types.ts +78 -0
  91. package/lib/benchmark/schemas/v1.0.0/case-manifest.schema.json +120 -0
  92. package/lib/benchmark/schemas/v1.0.0/common.schema.json +109 -0
  93. package/lib/benchmark/schemas/v1.0.0/grader-result.schema.json +160 -0
  94. package/lib/benchmark/schemas/v1.0.0/run-manifest.schema.json +122 -0
  95. package/lib/benchmark/schemas/v1.0.0/subject.schema.json +227 -0
  96. package/lib/builtin-tuis.ts +16 -15
  97. package/lib/defaults.json +24 -12
  98. package/lib/git/review-snapshot.ts +39 -9
  99. package/lib/git/reviewed-commit-equivalence.ts +135 -0
  100. package/lib/init.ts +53 -121
  101. package/lib/internal/agent-client.ts +131 -0
  102. package/lib/internal/git-workflow.ts +1 -1
  103. package/lib/internal/release-workflow.ts +68 -16
  104. package/lib/internal/task-orchestration.ts +132 -0
  105. package/lib/internal/task-review.ts +65 -0
  106. package/lib/merge.ts +2 -1
  107. package/lib/platform/adapters.ts +142 -3
  108. package/lib/platform/change-request-git-evidence.ts +159 -0
  109. package/lib/platform/merged-pr-equivalence.ts +51 -14
  110. package/lib/platform/pr-checks.ts +50 -22
  111. package/lib/platform/pull-requests.ts +134 -25
  112. package/lib/platform/releases.ts +1 -1
  113. package/lib/platform/verification-required.ts +12 -10
  114. package/lib/prompt.ts +16 -3
  115. package/lib/release/channels.ts +4 -1
  116. package/lib/release/workflow.ts +4 -3
  117. package/lib/remove-dir.ts +28 -0
  118. package/lib/run/tui.ts +9 -1
  119. package/lib/sandbox/agent-client-reconciler.ts +378 -0
  120. package/lib/sandbox/clipboard/linux.ts +2 -1
  121. package/lib/sandbox/commands/create.ts +111 -192
  122. package/lib/sandbox/commands/enter.ts +23 -1
  123. package/lib/sandbox/commands/prune.ts +2 -2
  124. package/lib/sandbox/commands/rm.ts +3 -2
  125. package/lib/sandbox/config.ts +31 -4
  126. package/lib/sandbox/constants.ts +6 -0
  127. package/lib/sandbox/dockerfile.ts +2 -1
  128. package/lib/sandbox/managed-fs.ts +18 -5
  129. package/lib/sandbox/recovery.ts +98 -67
  130. package/lib/sandbox/shell.ts +1 -1
  131. package/lib/sandbox/tool-types.ts +143 -0
  132. package/lib/sandbox/tools.ts +5 -157
  133. package/lib/task/artifact-lifecycle.ts +1 -38
  134. package/lib/task/commands/decisions.ts +53 -20
  135. package/lib/task/delegation-receipts.ts +170 -0
  136. package/lib/task/events.ts +110 -2
  137. package/lib/task/orchestration.ts +543 -0
  138. package/lib/task/review-artifacts.ts +201 -69
  139. package/lib/task/review-finalization.ts +275 -0
  140. package/lib/task/review-fingerprint.ts +5 -0
  141. package/lib/task/verification-checks.ts +2 -1
  142. package/lib/task/verification-engine.ts +177 -28
  143. package/lib/task/verification-review.ts +1 -0
  144. package/lib/task/verification.ts +5 -2
  145. package/lib/task/workspace-snapshot.ts +36 -0
  146. package/lib/update.ts +48 -184
  147. package/package.json +2 -2
  148. package/templates/.agents/README.en.md +21 -20
  149. package/templates/.agents/README.zh-CN.md +21 -20
  150. package/templates/.agents/hooks/lifecycle-delegation.js +64 -0
  151. package/templates/.agents/rules/README.en.md +2 -0
  152. package/templates/.agents/rules/README.zh-CN.md +2 -0
  153. package/templates/.agents/rules/commit-and-pr.en.md +1 -0
  154. package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -0
  155. package/templates/.agents/rules/human-decision-context.en.md +14 -12
  156. package/templates/.agents/rules/human-decision-context.zh-CN.md +14 -12
  157. package/templates/.agents/rules/lifecycle-orchestration.en.md +21 -0
  158. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +21 -0
  159. package/templates/.agents/rules/next-step-output.en.md +16 -0
  160. package/templates/.agents/rules/next-step-output.zh-CN.md +16 -0
  161. package/templates/.agents/rules/no-mid-flow-questions.en.md +2 -0
  162. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +2 -0
  163. package/templates/.agents/rules/release-commands.github.en.md +11 -5
  164. package/templates/.agents/rules/release-commands.github.zh-CN.md +11 -5
  165. package/templates/.agents/rules/review-handshake.en.md +4 -4
  166. package/templates/.agents/rules/review-handshake.zh-CN.md +4 -4
  167. package/templates/.agents/rules/review-method.en.md +113 -0
  168. package/templates/.agents/rules/review-method.zh-CN.md +98 -0
  169. package/templates/.agents/skills/analyze-task/SKILL.en.md +5 -5
  170. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +5 -5
  171. package/templates/.agents/skills/block-task/SKILL.en.md +4 -4
  172. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +4 -4
  173. package/templates/.agents/skills/cancel-task/SKILL.en.md +4 -4
  174. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +5 -5
  175. package/templates/.agents/skills/check-task/SKILL.en.md +16 -16
  176. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -16
  177. package/templates/.agents/skills/close-codescan/SKILL.en.md +4 -4
  178. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +4 -4
  179. package/templates/.agents/skills/close-dependabot/SKILL.en.md +4 -4
  180. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +4 -4
  181. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  182. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +2 -2
  183. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +14 -16
  184. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +14 -16
  185. package/templates/.agents/skills/code-task/reference/output-template.en.md +3 -3
  186. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +3 -3
  187. package/templates/.agents/skills/commit/SKILL.en.md +11 -1
  188. package/templates/.agents/skills/commit/SKILL.zh-CN.md +11 -1
  189. package/templates/.agents/skills/commit/reference/task-status-update.en.md +24 -28
  190. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +24 -28
  191. package/templates/.agents/skills/complete-task/SKILL.en.md +2 -2
  192. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +2 -2
  193. package/templates/.agents/skills/create-pr/SKILL.en.md +10 -10
  194. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +10 -10
  195. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +3 -3
  196. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +3 -3
  197. package/templates/.agents/skills/create-task/SKILL.en.md +11 -11
  198. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +11 -11
  199. package/templates/.agents/skills/import-codescan/SKILL.en.md +5 -5
  200. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +5 -5
  201. package/templates/.agents/skills/import-dependabot/SKILL.en.md +5 -5
  202. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +5 -5
  203. package/templates/.agents/skills/import-issue/SKILL.en.md +5 -5
  204. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
  205. package/templates/.agents/skills/init-labels/SKILL.en.md +4 -4
  206. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +4 -4
  207. package/templates/.agents/skills/init-milestones/SKILL.en.md +4 -4
  208. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -4
  209. package/templates/.agents/skills/plan-task/SKILL.en.md +5 -5
  210. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -5
  211. package/templates/.agents/skills/refine-title/SKILL.en.md +1 -1
  212. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -1
  213. package/templates/.agents/skills/release/SKILL.en.md +1 -1
  214. package/templates/.agents/skills/review-analysis/SKILL.en.md +13 -2
  215. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +14 -3
  216. package/templates/.agents/skills/review-analysis/config/verify.en.json +6 -0
  217. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +6 -0
  218. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +13 -15
  219. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +13 -15
  220. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +51 -5
  221. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +52 -6
  222. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +25 -22
  223. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +25 -22
  224. package/templates/.agents/skills/review-code/SKILL.en.md +28 -8
  225. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +28 -8
  226. package/templates/.agents/skills/review-code/config/verify.en.json +7 -0
  227. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +7 -0
  228. package/templates/.agents/skills/review-code/reference/concurrency-risks.en.md +25 -0
  229. package/templates/.agents/skills/review-code/reference/concurrency-risks.zh-CN.md +25 -0
  230. package/templates/.agents/skills/review-code/reference/cross-platform-risks.en.md +27 -0
  231. package/templates/.agents/skills/review-code/reference/cross-platform-risks.zh-CN.md +27 -0
  232. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.en.md +13 -0
  233. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.zh-CN.md +13 -0
  234. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +25 -0
  235. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +25 -0
  236. package/templates/.agents/skills/review-code/reference/output-templates.en.md +22 -24
  237. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +22 -24
  238. package/templates/.agents/skills/review-code/reference/report-template.en.md +54 -7
  239. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +54 -7
  240. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +29 -24
  241. package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +29 -24
  242. package/templates/.agents/skills/review-code/reference/security-risks.en.md +25 -0
  243. package/templates/.agents/skills/review-code/reference/security-risks.zh-CN.md +25 -0
  244. package/templates/.agents/skills/review-plan/SKILL.en.md +13 -2
  245. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +14 -3
  246. package/templates/.agents/skills/review-plan/config/verify.en.json +6 -0
  247. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +6 -0
  248. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +13 -15
  249. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +13 -15
  250. package/templates/.agents/skills/review-plan/reference/report-template.en.md +61 -5
  251. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +61 -5
  252. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +21 -24
  253. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +21 -24
  254. package/templates/.agents/skills/run-task/SKILL.en.md +22 -0
  255. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +22 -0
  256. package/templates/.agents/skills/run-task/config/verify.en.json +9 -0
  257. package/templates/.agents/skills/run-task/config/verify.zh-CN.json +9 -0
  258. package/templates/.agents/skills/test/SKILL.en.md +4 -4
  259. package/templates/.agents/skills/test/SKILL.zh-CN.md +4 -4
  260. package/templates/.agents/skills/test-integration/SKILL.en.md +4 -4
  261. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +4 -4
  262. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +5 -5
  263. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +5 -5
  264. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +647 -203
  265. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +4 -4
  266. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +4 -4
  267. package/templates/.agents/skills/watch-pr/SKILL.en.md +8 -8
  268. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +8 -8
  269. package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +6 -0
  270. package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +6 -0
  271. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +6 -0
  272. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +6 -0
  273. package/templates/.claude/commands/run-task.en.md +8 -0
  274. package/templates/.claude/commands/run-task.zh-CN.md +8 -0
  275. package/templates/.claude/settings.json +24 -0
  276. package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +3 -0
  277. package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +3 -0
  278. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +3 -0
  279. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +3 -0
  280. package/templates/.gemini/commands/_project_/run-task.en.toml +8 -0
  281. package/templates/.gemini/commands/_project_/run-task.zh-CN.toml +8 -0
  282. package/templates/.opencode/commands/run-task.en.md +11 -0
  283. package/templates/.opencode/commands/run-task.zh-CN.md +11 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitlab-ai/agent-infra",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Gemini CLI, and OpenCode",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  "typescript": "~7.0"
74
74
  },
75
75
  "optionalDependencies": {
76
- "@lydell/node-pty": "^1.2.0-beta.12"
76
+ "@lydell/node-pty": "^1.2.0-beta.14"
77
77
  },
78
78
  "overrides": {
79
79
  "axios": "1.18.1"
@@ -218,37 +218,38 @@ Ordinary `managed` files keep their overwrite semantics. A small set of platform
218
218
 
219
219
  `ejected` entries support literal paths or globs, using the same matching rules as `merged`.
220
220
 
221
- ## Built-in TUI Selection
221
+ ## Agent Client Configuration
222
222
 
223
- Use the top-level `.agents/.airc.json` `tuis` array to pick which built-in TUIs (`claude-code`, `codex`, `gemini-cli`, `opencode`) agent-infra should install command files for and keep in sync.
223
+ Use the top-level `.agents/.airc.json` `agentClients` array to configure all four built-in clients (`claude-code`, `codex`, `gemini-cli`, `opencode`). Each canonical entry has three fields:
224
224
 
225
- | Value | Meaning |
225
+ | Field | Meaning |
226
226
  |-------|---------|
227
- | `tuis` missing or `null` | All four built-in TUIs are enabled (backward-compatible default for legacy `.airc.json` predating this field). |
228
- | `tuis: []` | No built-in TUI is managed. Use this when the project only relies on `customTUIs` and does not need any built-in command files installed. |
229
- | `tuis: [<subset>]` | Only the listed TUIs are managed. Unknown ids are ignored. |
227
+ | `id` | Built-in Agent Client id. The canonical array contains exactly one entry for each built-in client. |
228
+ | `enabled` | Whether agent-infra writes and maintains that client's project integration and seed command. |
229
+ | `installInSandbox` | Whether the sandbox image installs that client's CLI. This is independent from `enabled`. |
230
230
 
231
- `ai init` includes an interactive multi-select for this field:
231
+ Manage these settings without hand-editing JSON:
232
232
 
233
- - Press Enter to accept the default (all built-in TUIs enabled).
234
- - Type comma-separated numbers or ids (e.g. `1,3` or `claude-code,opencode`) to keep a subset.
235
- - Type `none` to explicitly disable every built-in TUI (typically combined with a `customTUIs` entry added later).
236
- - Invalid input (duplicate, out-of-range, unknown id, whitespace-only) aborts init with a non-zero exit code.
233
+ ```bash
234
+ ai agent-client list
235
+ ai agent-client status
236
+ ai agent-client enable codex
237
+ ai agent-client disable gemini-cli
238
+ ai agent-client configure
239
+ ```
237
240
 
238
- ### Side effects of disabling a TUI
241
+ `enable` and `disable` only change `enabled`; `configure` edits both dimensions. `ai init` asks which clients to enable and preserves the displayed defaults when you press Enter. All clients default to `installInSandbox: true`.
239
242
 
240
- When you disable a built-in TUI (either via `ai init` or by hand-editing `.airc.json`), the next `ai update` / `update-agent-infra` will:
243
+ Legacy `tuis` and built-in client ids in `sandbox.tools` are migration inputs only. The next config-writing command converts them into the canonical `agentClients` array and removes the legacy fields. If canonical and legacy values conflict, the command stops without modifying files so the conflict can be resolved explicitly.
241
244
 
242
- - skip seed command writes for that TUI (e.g. `.gemini/commands/<project>/update-agent-infra.toml`);
243
- - skip the TUI's owned default entries when backfilling `files.managed` / `files.merged`;
244
- - **clean up existing files** under the TUI's owned path prefix (`.claude/`, `.codex/`, `.gemini/`, `.opencode/`) — these are listed in `report.managed.removed`, mirroring the cleanup behavior when switching `platform`.
245
+ ### Side effects of disabling an Agent Client
245
246
 
246
- To opt a specific file out of this cleanup, list it in `files.ejected`; ejected entries owned by disabled TUIs are preserved as-is and are not re-created by sync.
247
+ When you disable a built-in client, reconciliation stops maintaining its seed command and owned registry entries. An unchanged generated seed may be removed; a locally modified seed is protected and reported instead. Files listed in `files.ejected` remain project-owned and are preserved.
247
248
 
248
249
  ### Relation to other config fields
249
250
 
250
- - `tuis` controls **which TUI command files agent-infra writes and maintains**. It is independent from `sandbox.tools`, which controls **which CLIs the sandbox image installs**. Toggling one does not affect the other; the README for `sandbox.tools` lives in the Sandbox section.
251
- - `tuis` is independent from `customTUIs` (see below). CustomTUI command files are not removed when you disable a built-in TUI, even if the customTUI's `dir` falls under that TUI's owned prefix (e.g. a customTUI configured with `dir: ".codex/commands"` is preserved when `codex` is disabled).
251
+ - `sandbox.tools` now lists non-client tools such as `agent-infra` and custom tools. Built-in client installation belongs in `agentClients[].installInSandbox`.
252
+ - `agentClients` is independent from `customTUIs` (see below). Custom TUI command files are preserved even when their directory is under a disabled built-in client's path prefix.
252
253
 
253
254
  ## Custom TUI Configuration
254
255
 
@@ -300,7 +301,7 @@ Namespaced custom TUI:
300
301
 
301
302
  ## Sandbox Custom Tools
302
303
 
303
- `customTUIs` generates slash-command files but does not change the sandbox image. To install a non-npm CLI or tool (pip / cargo / curl-based / pre-built binary) into the sandbox image and live-mount its credentials, declare it under `sandbox.customTools` in `.agents/.airc.json`. Built-in sandbox tools (`claude-code`, `codex`, `opencode`, `gemini-cli`, `agent-infra`) keep working unchanged; `agent-infra` only provides the in-sandbox `ai` / `agent-infra` CLI and is not part of `tuis` or `customTUIs`.
304
+ `customTUIs` generates slash-command files but does not change the sandbox image. To install a non-npm CLI or tool (pip / cargo / curl-based / pre-built binary) into the sandbox image and live-mount its credentials, declare it under `sandbox.customTools` in `.agents/.airc.json`. Built-in Agent Clients are installed according to `agentClients[].installInSandbox`; `agent-infra` remains a non-client entry in `sandbox.tools` and only provides the in-sandbox `ai` / `agent-infra` CLI.
304
305
 
305
306
  ### Required fields
306
307
 
@@ -218,37 +218,38 @@ disable-model-invocation: true # 可选;由支持该能力的 TUI 适配器
218
218
 
219
219
  `ejected` 条目支持字面路径或 glob,匹配规则与 `merged` 相同。
220
220
 
221
- ## 内建 TUI 选择
221
+ ## Agent Client 配置
222
222
 
223
- `.agents/.airc.json` 顶层 `tuis` 数组用于决定 agent-infra 应当为哪些内建 TUI(`claude-code`、`codex`、`gemini-cli`、`opencode`)安装并维护命令文件。
223
+ `.agents/.airc.json` 顶层 `agentClients` 数组用于配置全部四个内建客户端(`claude-code`、`codex`、`gemini-cli`、`opencode`)。规范化后的每个条目包含三个字段:
224
224
 
225
- | 取值 | 含义 |
225
+ | 字段 | 含义 |
226
226
  |------|------|
227
- | `tuis` 缺失或为 `null` | 启用全部四个内建 TUI(向后兼容默认,适用于本字段引入之前的 `.airc.json`) |
228
- | `tuis: []` | 不维护任何内建 TUI。适用于只依赖 `customTUIs`、不需要安装任何内建命令文件的项目 |
229
- | `tuis: [<子集>]` | 仅维护列出的 TUI;未知 id 会被忽略 |
227
+ | `id` | 内建 Agent Client id。规范数组为每个内建客户端保留且仅保留一个条目。 |
228
+ | `enabled` | agent-infra 是否写入并维护该客户端的项目集成与种子命令。 |
229
+ | `installInSandbox` | 沙箱镜像是否安装该客户端 CLI;此字段与 `enabled` 相互独立。 |
230
230
 
231
- `ai init` 会通过交互式多选询问该字段:
231
+ 无需手工编辑 JSON,可使用:
232
232
 
233
- - 直接回车 = 接受默认值(全部内建 TUI 启用)。
234
- - 输入逗号分隔的编号或 id(如 `1,3` 或 `claude-code,opencode`)= 只保留子集。
235
- - 输入 `none` = 明确不启用任何内建 TUI(通常配合后续在 `customTUIs` 添加条目使用)。
236
- - 非法输入(重复、超界、未知 id、纯空白)会让 init 以非零退出码终止。
233
+ ```bash
234
+ ai agent-client list
235
+ ai agent-client status
236
+ ai agent-client enable codex
237
+ ai agent-client disable gemini-cli
238
+ ai agent-client configure
239
+ ```
237
240
 
238
- ### 取消某个 TUI 的副作用
241
+ `enable` 和 `disable` 只修改 `enabled`;`configure` 同时编辑两个维度。`ai init` 会询问启用哪些客户端,直接回车会保留界面展示的默认值。所有客户端的 `installInSandbox` 默认均为 `true`。
239
242
 
240
- 通过 `ai init` 或手工编辑 `.airc.json` 取消某个内建 TUI 后,下一次 `ai update` / `update-agent-infra` 会:
243
+ 旧 `tuis` 字段和 `sandbox.tools` 中的内建客户端 id 仅作为迁移输入。下一次写配置的命令会将其转换为规范 `agentClients` 数组并移除旧字段。若规范配置与旧配置冲突,命令会在修改文件前停止,要求显式解决冲突。
241
244
 
242
- - 跳过该 TUI 的 seed 命令文件写入(例如 `.gemini/commands/<project>/update-agent-infra.toml`);
243
- - 在回填 `files.managed` / `files.merged` 时跳过该 TUI owned 的默认条目;
244
- - **物理清理**该 TUI owned 路径前缀(`.claude/`、`.codex/`、`.gemini/`、`.opencode/`)下的已有文件——清理列表会出现在 `report.managed.removed`,与切换 `platform` 时的清理行为一致。
245
+ ### 取消 Agent Client 的副作用
245
246
 
246
- 若希望保留某个具体文件,把它加入 `files.ejected`:被 ejected 的、属于已取消 TUI 的条目会保持原状,sync 不会重新创建也不会删除。
247
+ 取消某个内建客户端后,协调流程会停止维护其种子命令和 owned 注册项。未修改的生成种子文件可以被删除;本地修改过的种子文件会受到保护并进入报告。`files.ejected` 中的文件仍由项目所有并会被保留。
247
248
 
248
249
  ### 与其他配置字段的关系
249
250
 
250
- - `tuis` 控制 **agent-infra 写入与维护哪些 TUI 的命令文件**,与 `sandbox.tools`(控制**沙箱镜像里安装哪些 CLI**)相互独立。两者互不影响;`sandbox.tools` 的说明见 Sandbox 一节。
251
- - `tuis` 与 `customTUIs`(见下)相互独立。取消某个内建 TUI 时 customTUI 命令文件不会被清理,即便 customTUI 的 `dir` 落在该 TUI 的 owned 前缀下(例如 `dir: ".codex/commands"` 的 customTUI 在 `codex` 被取消时仍会保留)。
251
+ - `sandbox.tools` 现在只列出 `agent-infra` 和自定义工具等非客户端工具。内建客户端的安装状态由 `agentClients[].installInSandbox` 表达。
252
+ - `agentClients` 与 `customTUIs`(见下)相互独立。即使自定义 TUI 目录落在已取消的内建客户端路径前缀下,其命令文件也会被保留。
252
253
 
253
254
  ## 自定义 TUI 配置
254
255
 
@@ -300,7 +301,7 @@ disable-model-invocation: true # 可选;由支持该能力的 TUI 适配器
300
301
 
301
302
  ## 沙箱自定义工具(Sandbox Custom Tools)
302
303
 
303
- `customTUIs` 只负责生成 slash-command 文件,**不影响沙箱镜像**。如果要把一个非 npm 分发的 CLI 或工具(pip / cargo / curl 脚本 / 裸二进制)装进沙箱镜像、并 live-mount 它的凭证目录,需要在 `.agents/.airc.json` 的 `sandbox.customTools` 中声明。内建 sandbox 工具(`claude-code` / `codex` / `opencode` / `gemini-cli` / `agent-infra`)行为保持不变;其中 `agent-infra` 只提供沙箱内 `ai` / `agent-infra` CLI,不属于 `tuis` 或 `customTUIs` 配置。
304
+ `customTUIs` 只负责生成 slash-command 文件,**不影响沙箱镜像**。如果要把一个非 npm 分发的 CLI 或工具(pip / cargo / curl 脚本 / 裸二进制)装进沙箱镜像、并 live-mount 它的凭证目录,需要在 `.agents/.airc.json` 的 `sandbox.customTools` 中声明。内建 Agent Client 按 `agentClients[].installInSandbox` 安装;`agent-infra` 仍是 `sandbox.tools` 中的非客户端条目,只提供沙箱内的 `ai` / `agent-infra` CLI。
304
305
 
305
306
  ### 必填字段
306
307
 
@@ -0,0 +1,64 @@
1
+ import { execFileSync } from 'node:child_process';
2
+
3
+ const MAX_INPUT_BYTES = 64 * 1024;
4
+ const clientIndex = process.argv.indexOf('--client');
5
+ const client = clientIndex >= 0 ? process.argv[clientIndex + 1] : '';
6
+ if (client !== 'claude-code') {
7
+ process.stderr.write('Lifecycle delegation hook requires a supported --client value\n');
8
+ process.exit(1);
9
+ }
10
+ let input = '';
11
+ process.stdin.setEncoding('utf8');
12
+ process.stdin.on('data', (chunk) => {
13
+ input += chunk;
14
+ if (Buffer.byteLength(input) > MAX_INPUT_BYTES) {
15
+ process.stderr.write('Lifecycle delegation hook input exceeds 64 KiB\n');
16
+ process.exit(1);
17
+ }
18
+ });
19
+ process.stdin.on('end', () => {
20
+ let event;
21
+ try {
22
+ event = JSON.parse(input || '{}');
23
+ } catch {
24
+ process.stderr.write('Lifecycle delegation hook received invalid JSON\n');
25
+ process.exit(1);
26
+ }
27
+ const hook = String(event.hook_event_name || event.event || '').toLowerCase();
28
+ const nativeAgent = event.agent_name || event.agent_type || event.agent?.name;
29
+ if (!String(nativeAgent || '').startsWith('agent-infra-lifecycle-')) process.exit(0);
30
+ const start = hook.includes('start');
31
+ const stop = hook.includes('stop');
32
+ if (!start && !stop) {
33
+ process.stderr.write('Managed lifecycle hook event has an unknown type\n');
34
+ process.exit(1);
35
+ }
36
+ const args = ['task-orchestration', 'auto', start ? 'hook-start' : 'hook-stop', '--client', client];
37
+ if (start) {
38
+ args.push(
39
+ '--native-agent', String(nativeAgent),
40
+ '--child-id', String(event.child_id || event.agent_id || event.thread_id || ''),
41
+ '--parent-id', String(event.parent_id || event.parent_session_id || event.session_id || ''),
42
+ '--spawn-mode', String(event.spawn_mode || 'fresh')
43
+ );
44
+ if (event.model) args.push('--actual-model', String(event.model));
45
+ if (event.model_fallback_reason) args.push('--fallback-reason', String(event.model_fallback_reason));
46
+ } else {
47
+ args.push(
48
+ '--native-agent', String(nativeAgent),
49
+ '--child-id', String(event.child_id || event.agent_id || event.thread_id || '')
50
+ );
51
+ }
52
+ try {
53
+ const output = execFileSync('agent-infra-internal', args, {
54
+ encoding: 'utf8',
55
+ shell: process.platform === 'win32',
56
+ stdio: ['ignore', 'pipe', 'pipe']
57
+ });
58
+ process.stdout.write(output);
59
+ } catch (error) {
60
+ if (error.stdout) process.stdout.write(String(error.stdout));
61
+ if (error.stderr) process.stderr.write(String(error.stderr));
62
+ process.exit(typeof error.status === 'number' ? error.status : 1);
63
+ }
64
+ });
@@ -25,7 +25,9 @@ so you can quickly find "which ones to read" without opening each file.
25
25
  ## Task Workflow
26
26
 
27
27
  - [`task-management.md`](task-management.md) — Task intent detection and workflow-command mapping.
28
+ - [`lifecycle-orchestration.md`](lifecycle-orchestration.md) — Fresh executor/reviewer, one-use receipt, pause/recovery, and safe endpoint rules for `run-task`.
28
29
  - [`review-handshake.md`](review-handshake.md) — Three-stage bidirectional review handshake: four-state disposition, symmetric evidence, disagreement ledger, convergence and post-review commit gate.
30
+ - [`review-method.md`](review-method.md) — Shared three-stage review method: multi-pass review, risk lenses, traceability, and finding evidence.
29
31
  - [`human-decision-context.md`](human-decision-context.md) — Self-contained context and canonical structure for new human-decision details.
30
32
  - [`task-short-id.md`](task-short-id.md) — Resolution, allocation and lifecycle of bare-number short ids.
31
33
  - [`milestone-inference.md`](milestone-inference.md) — Milestone inference for create-task / code-task / create-pr.
@@ -24,7 +24,9 @@
24
24
  ## 任务工作流
25
25
 
26
26
  - [`task-management.md`](task-management.md) — 任务语义识别与工作流命令映射。
27
+ - [`lifecycle-orchestration.md`](lifecycle-orchestration.md) — `run-task` 的 fresh executor/reviewer、一次性 receipt、暂停恢复与安全终点规则。
27
28
  - [`review-handshake.md`](review-handshake.md) — 三阶段双向审查握手协议:四态处置、对称证据、分歧账本、收敛与 post-review commit 门禁。
29
+ - [`review-method.md`](review-method.md) — 三阶段共享检视方法:多遍检视、风险镜头、追踪与 finding 证据契约。
28
30
  - [`human-decision-context.md`](human-decision-context.md) — 新建人工裁决详情的自足上下文与规范结构。
29
31
  - [`task-short-id.md`](task-short-id.md) — 裸数字任务短号的解析、分配与生命周期。
30
32
  - [`milestone-inference.md`](milestone-inference.md) — create-task / code-task / create-pr 的 milestone 推断。
@@ -11,6 +11,7 @@
11
11
 
12
12
  - Never run `git commit` or `git add` automatically
13
13
  - Enter the commit workflow only when the user explicitly requests a commit
14
+ - The only exception is a one-use commit authorization issued by an active `run-task` explicitly started by the user. It authorizes this commit round but does not relax staging, sensitive-file, copyright, test, review-snapshot, HEAD/tree, or push gates.
14
15
  - After finishing code changes, remind the user to use the appropriate TUI commit command
15
16
 
16
17
  ## PR Rules
@@ -11,6 +11,7 @@
11
11
 
12
12
  - 绝对不要自动执行 `git commit` 或 `git add`
13
13
  - 仅在用户明确发起提交命令时才进入提交流程
14
+ - 唯一例外:用户显式启动的 active `run-task` 可签发一次性 commit authorization;它等价于本轮提交授权,但不得放宽暂存、敏感文件、版权、测试、审查快照、HEAD/tree 或 push 门禁。
14
15
  - 完成代码修改后,提醒用户使用对应 TUI 的提交命令
15
16
 
16
17
  ## PR 提交规则
@@ -4,32 +4,34 @@ This rule governs every new `[needs-human-decision]` detail block produced by an
4
4
 
5
5
  ## Self-contained Context
6
6
 
7
- A maintainer must be able to decide without asking a model to reconstruct context. Every item must state its background, decision objective, impact scope, risks, recommended option, and recommendation rationale. It must provide at least two options, each with both benefits and costs.
7
+ A maintainer must be able to understand the issue and choose without knowing the internal workflow or asking a model to reconstruct context. Start in plain language: explain why a decision is needed now, what must be chosen, which choice is recommended, and why. Then explain what the choice affects and what could go wrong if the wrong choice is made or no action is taken.
8
+
9
+ Provide at least two options with short names, and state the benefits and trade-offs of each one. Explain internal terms such as stage, severity, and evidence the first time they appear. IDs and evidence are for lookup and troubleshooting; they do not replace the plain-language explanation.
8
10
 
9
11
  ## Canonical Structure
10
12
 
11
13
  ```markdown
12
14
  ### {AN-N|PL-N|CD-N|HD-N}: {Title} [needs-human-decision]
13
15
 
14
- - **Background**: {facts, constraints, and why a decision is needed}
15
- - **Decision Objective**: {the single choice that must be made}
16
- - **Impact Scope**: {affected behavior, files, users, or precedent}
17
- - **Risks**: {risks of the wrong choice, delay, or no decision}
18
- - **Recommended Option**: {Option A/B/...}
19
- - **Recommendation Rationale**: {reason based on benefits, costs, and constraints}
16
+ - **Why a decision is needed now**: {plain-language facts, constraints, and why work cannot simply continue}
17
+ - **What needs a decision**: {the one choice that must be made}
18
+ - **Recommended choice**: {Option A/B/...}
19
+ - **Why this choice**: {reason based on benefits, trade-offs, and current constraints}
20
+ - **What this affects**: {affected behavior, files, users, or future practice}
21
+ - **What could go wrong**: {problems caused by the wrong choice or no action}
20
22
 
21
23
  #### Option A: {Name}
22
24
 
23
- - **Benefits**: {benefits of this option}
24
- - **Costs**: {costs and limitations of this option}
25
+ - **Benefits**: {what this option provides}
26
+ - **Trade-offs**: {what this option costs and where it falls short}
25
27
 
26
28
  #### Option B: {Name}
27
29
 
28
- - **Benefits**: {benefits of this option}
29
- - **Costs**: {costs and limitations of this option}
30
+ - **Benefits**: {what this option provides}
31
+ - **Trade-offs**: {what this option costs and where it falls short}
30
32
  ```
31
33
 
32
- Option C and supporting evidence may be added, but none of the fields above may be omitted or collapsed into an incomparable one-line option list. The heading ID must match the task.md Review Disagreement Ledger row, whose evidence must point to this stable heading anchor.
34
+ Option C and supporting evidence may be added, but none of the information above may be omitted or collapsed into an incomparable one-line option list. The heading ID must match the task.md Review Disagreement Ledger row. Its evidence (the reference used to find the original explanation) must point to this stable heading anchor.
33
35
 
34
36
  ## Decision Closure
35
37
 
@@ -4,32 +4,34 @@
4
4
 
5
5
  ## 自足性要求
6
6
 
7
- 详情必须让维护者无需模型二次推理即可理解并裁决。每项必须明确说明背景、裁决目标、影响范围、风险、推荐方案与推荐理由,并至少提供两个可选方案;每个方案都必须同时列出收益和代价。
7
+ 详情必须让维护者不需要了解内部流程,也不需要再问模型,就能看懂并做选择。先用大白话说明为什么现在需要决定、具体要选什么、建议选哪个以及原因;再说明会影响什么、选错或暂不处理会怎样。
8
+
9
+ 每项至少提供两个有简短名称的方案,并分别写清好处和代价。第一次出现 stage、severity、evidence 等内部术语时,必须顺手解释它们的意思;ID 和 evidence 只用于后续查找和排查,不能代替问题说明。
8
10
 
9
11
  ## 规范结构
10
12
 
11
13
  ```markdown
12
14
  ### {AN-N|PL-N|CD-N|HD-N}:{标题} [needs-human-decision]
13
15
 
14
- - **背景**:{为何需要裁决;已知事实与约束}
15
- - **裁决目标**:{本次必须确定的唯一选择}
16
- - **影响范围**:{受影响的功能、文件、用户或后续先例}
17
- - **风险**:{错误选择、延期或不裁决的风险}
18
- - **推荐方案**:{方案 A/B/...}
19
- - **推荐理由**:{基于收益、代价和约束的理由}
16
+ - **为什么现在要决定**:{用大白话说明已知情况、限制,以及为什么不能直接继续}
17
+ - **要决定什么**:{本次只需要选定的一件事}
18
+ - **建议选哪个**:{方案 A/B/...}
19
+ - **为什么这样建议**:{结合好处、代价和现有限制说明原因}
20
+ - **会影响什么**:{会受影响的功能、文件、用户或后续做法}
21
+ - **如果选错或暂不处理**:{可能出现的问题}
20
22
 
21
23
  #### 方案 A:{名称}
22
24
 
23
- - **收益**:{选择该方案的收益}
24
- - **代价**:{选择该方案的成本与局限}
25
+ - **好处**:{选择该方案能得到什么}
26
+ - **代价**:{选择该方案要付出什么、有哪些局限}
25
27
 
26
28
  #### 方案 B:{名称}
27
29
 
28
- - **收益**:{选择该方案的收益}
29
- - **代价**:{选择该方案的成本与局限}
30
+ - **好处**:{选择该方案能得到什么}
31
+ - **代价**:{选择该方案要付出什么、有哪些局限}
30
32
  ```
31
33
 
32
- 可增加方案 C 或补充证据,但不得省略上述字段或把多个方案压缩为无法分别比较的一行。标题 ID 必须与 task.md `## 审查分歧账本` 行一致,evidence 必须指向该标题的稳定锚点。
34
+ 可增加方案 C 或补充证据,但不得省略上述信息或把多个方案压缩为无法分别比较的一行。标题 ID 必须与 task.md `## 审查分歧账本` 行一致;evidence(用于定位原始说明的引用)必须指向该标题的稳定锚点。
33
35
 
34
36
  ## 裁决闭环
35
37
 
@@ -0,0 +1,21 @@
1
+ # Common Rule - Lifecycle Orchestration
2
+
3
+ ## Guarantee Boundary
4
+
5
+ - The orchestrator only routes and delegates. Stage skills remain the single source of truth for behavior and artifacts.
6
+ - Every stage and rework round uses a fresh executor. Every review uses a fresh reviewer; follow-up reuse is forbidden.
7
+ - A reviewer may only write its review artifact and core-generated task metadata. Business-code, HEAD, or index changes invalidate the receipt.
8
+ - An active run has one pending delegation. Missing, mismatched, forked, replayed, hook-less, or drifted evidence pauses the run.
9
+ - The first release ends after one existing safely gated `commit`; it does not create a PR, monitor checks, or complete the task.
10
+
11
+ ## Recovery
12
+
13
+ `orchestration.json` is the detailed state source. Re-entry reconciles first: completed runs return idempotently; recoverable pauses continue only after the blocker clears; unproven children, unsealed receipts, and baseline drift stay paused. Reviewer identities are never reused.
14
+
15
+ ## Model Policy
16
+
17
+ Prefer a reviewer model different from the preceding executor. Same-model fallback must record requested model, actual model, and reason; an unrecorded fallback fails closed.
18
+
19
+ ## Stable Pause Conditions
20
+
21
+ Human decisions, manual validation, handshake or step limits, permissions/network failures, worktree conflicts, unsupported client capability, and unknown hook schemas are persisted as pauses. The orchestrator must not ask mid-flow or degrade to same-context self-review.
@@ -0,0 +1,21 @@
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` 是详细状态源。重复入口先 reconcile:已完成 run 幂等返回;可恢复暂停在阻塞解除后继续;无法证明已停止的 child、未封存 receipt 或基线漂移继续保持暂停。旧 reviewer identity 永不复用。
14
+
15
+ ## 模型策略
16
+
17
+ reviewer 优先选择与上一 executor 不同的模型。若客户端只能使用同模型,必须记录 requested model、actual model 和降级原因;缺少降级理由时失败关闭。
18
+
19
+ ## 稳定暂停条件
20
+
21
+ 人工裁决、人工验证、握手或总步骤上限、权限/网络失败、用户工作区冲突、客户端 capability 不支持及未知 hook schema 都持久化为暂停原因。总控不得中途询问或降级为同上下文自审。
@@ -20,6 +20,22 @@ 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
+ ```
32
+
33
+ - Pass the next skill name for the already-selected scenario. Include `--task-ref` only when that command needs a task reference.
34
+ - The helper lists only built-in clients enabled in `.agents/.airc.json` `agentClients`, followed by valid `customTUIs` in configuration order.
35
+ - 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`.
36
+ - 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.
37
+ - A complex skill selects one scenario first and invokes the helper once for that scenario; it must not pre-render every branch.
38
+
23
39
  ## Obtaining the short id (`{task-ref}`)
24
40
 
25
41
  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,22 @@
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
+ ```
32
+
33
+ - 静态传入当前已选场景的下一 skill 名;只有命令需要任务引用时才传 `--task-ref`。
34
+ - helper 只展示 `.agents/.airc.json` 中 `agentClients` 已启用的内建客户端,并在其后按配置顺序追加合法的 `customTUIs`。
35
+ - 将非空 stdout 原样放入当前“下一步”标题后的 `{next-step-commands}`;stdout 为空时省略整个客户端命令块,但继续输出提醒、告警和 `Completed at`。
36
+ - helper 写 stderr 或返回非零时,按当前 skill 的错误路径报告并停止;禁止回退到硬编码客户端表。
37
+ - 复杂 skill 先选定唯一场景,再只为该场景调用一次 helper,不得提前渲染所有分支。
38
+
23
39
  ## 取短号(`{task-ref}`)
24
40
 
25
41
  短号唯一真源是注册表 `.agents/workspace/active/.short-ids.json`(经 `task-short-id.js`)。**禁止**读取 task.md frontmatter 的 `short_id` 字段(该字段不可信)。
@@ -78,6 +78,8 @@ A mandatory human review checkpoint means:
78
78
 
79
79
  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
80
 
81
+ 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.
82
+
81
83
  ## Anchor Location
82
84
 
83
85
  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.
@@ -78,6 +78,8 @@
78
78
 
79
79
  如果在执行过程中发现需要用户裁定的关键决策,按上文「关键设计决策标记与落账」处理:通过 `decision-next-id` / `decision-upsert` 结构化命令登记详情块与账本身份,由用户在审查检查点统一回应;普通未决问题仍写 `## 未决问题` / `Open Questions`。
80
80
 
81
+ `run-task` 总控可以在子技能产出后依据核心机械状态继续到下一阶段;这不构成绕过人工裁决。只要核心返回人工裁决、人工验证或其他稳定暂停条件,总控必须停止,不能向用户中途提问,也不能自行批准。
82
+
81
83
  ## 锚点位置
82
84
 
83
85
  本规则的唯一全局锚点在项目级 AGENTS.md 的「AI 行为准则」preamble,所有 AI 工具加载 AGENTS.md 时即可见。各 SKILL.md 不再单独引用本规则,避免在每个 SKILL 顶部维护重复 bullet。
@@ -6,17 +6,23 @@ 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.
14
16
 
15
17
  ## Publish Release Notes
16
18
 
19
+ Call this only after user confirmation:
20
+
17
21
  ```bash
18
22
  agent-infra-internal platform-release-notes publish \
19
- --tag "v{version}" --title "v{version}" --notes-file "{notes-file}"
23
+ --tag "v{version}" \
24
+ --title "v{version}" \
25
+ --notes-file "{notes-file}"
20
26
  ```
21
27
 
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.
28
+ The command 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,23 @@
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` 表示当前平台不支持远端发布说明能力。
14
16
 
15
17
  ## 发布 Release notes
16
18
 
19
+ 用户确认后调用:
20
+
17
21
  ```bash
18
22
  agent-infra-internal platform-release-notes publish \
19
- --tag "v{version}" --title "v{version}" --notes-file "{notes-file}"
23
+ --tag "v{version}" \
24
+ --title "v{version}" \
25
+ --notes-file "{notes-file}"
20
26
  ```
21
27
 
22
- 命令更新既有 Release,缺失时创建;`--dry-run` 只规划操作。退出码 `0/1/2` 分别表示成功、失败和阻塞。
28
+ 命令会更新已存在的 Release,缺失时创建;`--dry-run` 只返回 planned operation。退出码为 `0` 时成功,`1` 表示稳定失败,`2` 表示网络或平台阻塞。
@@ -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 行为速查