@fitlab-ai/agent-infra 0.9.8 → 0.9.10

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 (182) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/bin/internal-cli.js +11 -1
  4. package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +58 -21
  5. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +25 -11
  6. package/dist/lib/agent-clients/adapters/codex-lifecycle/capability-store.js +173 -10
  7. package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-context.js +127 -0
  8. package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +14 -0
  9. package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +63 -92
  10. package/dist/lib/agent-clients/adapters/codex-sandbox.js +72 -11
  11. package/dist/lib/agent-clients/adapters/index.js +3 -1
  12. package/dist/lib/agent-clients/adapters/traecli.js +66 -0
  13. package/dist/lib/agent-clients/tokens.js +2 -2
  14. package/dist/lib/agent-clients/types.js +2 -1
  15. package/dist/lib/defaults.json +5 -0
  16. package/dist/lib/git/workflow.js +10 -1
  17. package/dist/lib/internal/codex-lifecycle.js +20 -6
  18. package/dist/lib/internal/codex-sandbox-controller.js +9 -15
  19. package/dist/lib/internal/git-workflow.js +5 -7
  20. package/dist/lib/internal/platform-pr.js +20 -7
  21. package/dist/lib/internal/release-workflow.js +2 -1
  22. package/dist/lib/internal/sandbox-control.js +79 -2
  23. package/dist/lib/internal/task-finalization.js +54 -0
  24. package/dist/lib/internal/task-orchestration.js +156 -291
  25. package/dist/lib/{task/commands/validate.js → internal/task-validate.js} +75 -42
  26. package/dist/lib/platform/pr-summary.js +48 -10
  27. package/dist/lib/platform/pull-requests.js +205 -41
  28. package/dist/lib/run/tui.js +5 -2
  29. package/dist/lib/sandbox/commands/rm.js +316 -55
  30. package/dist/lib/sandbox/control/client.js +190 -6
  31. package/dist/lib/sandbox/control/controller-registration.js +275 -0
  32. package/dist/lib/sandbox/control/executor.js +140 -5
  33. package/dist/lib/sandbox/control/lifecycle.js +3 -1
  34. package/dist/lib/sandbox/control/protocol.js +67 -6
  35. package/dist/lib/sandbox/index.js +5 -3
  36. package/dist/lib/sandbox/managed-fs.js +5 -0
  37. package/dist/lib/sandbox/task-resolver.js +50 -6
  38. package/dist/lib/sandbox/workspace-identity.js +27 -0
  39. package/dist/lib/sandbox/worktree-safety.js +215 -2
  40. package/dist/lib/task/codex-orchestration.js +161 -39
  41. package/dist/lib/task/commands/status.js +59 -1
  42. package/dist/lib/task/commit-operation.js +335 -0
  43. package/dist/lib/task/commit-policy.js +18 -0
  44. package/dist/lib/task/delegation-receipts.js +248 -6
  45. package/dist/lib/task/finalization.js +593 -0
  46. package/dist/lib/task/index.js +0 -9
  47. package/dist/lib/task/operation-outcome.js +33 -0
  48. package/dist/lib/task/orchestration.js +187 -761
  49. package/dist/lib/task/short-id.js +59 -1
  50. package/dist/lib/task/task-execution-lock.js +6 -1
  51. package/dist/lib/task/verification-engine.js +110 -60
  52. package/dist/lib/task/verification.js +2 -1
  53. package/dist/lib/task/workflow-warning-intents.js +50 -1
  54. package/dist/lifecycle-build-manifest.json +3 -3
  55. package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +61 -19
  56. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +37 -10
  57. package/lib/agent-clients/adapters/codex-lifecycle/capability-store.ts +276 -12
  58. package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +163 -0
  59. package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +19 -0
  60. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +9 -1
  61. package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +91 -118
  62. package/lib/agent-clients/adapters/codex-sandbox.ts +89 -14
  63. package/lib/agent-clients/adapters/index.ts +3 -1
  64. package/lib/agent-clients/adapters/traecli.ts +67 -0
  65. package/lib/agent-clients/tokens.ts +2 -2
  66. package/lib/agent-clients/types.ts +2 -1
  67. package/lib/defaults.json +5 -0
  68. package/lib/git/workflow.ts +11 -2
  69. package/lib/internal/codex-lifecycle.ts +19 -6
  70. package/lib/internal/codex-sandbox-controller.ts +9 -14
  71. package/lib/internal/git-workflow.ts +5 -6
  72. package/lib/internal/platform-pr.ts +14 -7
  73. package/lib/internal/release-workflow.ts +2 -1
  74. package/lib/internal/sandbox-control.ts +92 -2
  75. package/lib/internal/task-finalization.ts +68 -0
  76. package/lib/internal/task-orchestration.ts +20 -103
  77. package/lib/{task/commands/validate.ts → internal/task-validate.ts} +75 -40
  78. package/lib/platform/pr-summary.ts +55 -11
  79. package/lib/platform/pull-requests.ts +211 -41
  80. package/lib/run/tui.ts +5 -3
  81. package/lib/sandbox/commands/rm.ts +413 -61
  82. package/lib/sandbox/control/client.ts +255 -6
  83. package/lib/sandbox/control/controller-registration.ts +352 -0
  84. package/lib/sandbox/control/executor.ts +169 -5
  85. package/lib/sandbox/control/lifecycle.ts +2 -1
  86. package/lib/sandbox/control/protocol.ts +80 -7
  87. package/lib/sandbox/index.ts +5 -3
  88. package/lib/sandbox/managed-fs.ts +5 -0
  89. package/lib/sandbox/task-resolver.ts +58 -7
  90. package/lib/sandbox/workspace-identity.ts +50 -2
  91. package/lib/sandbox/workspace-view.ts +3 -3
  92. package/lib/sandbox/worktree-safety.ts +236 -2
  93. package/lib/task/codex-orchestration.ts +168 -40
  94. package/lib/task/commands/status.ts +78 -1
  95. package/lib/task/commit-operation.ts +430 -0
  96. package/lib/task/commit-policy.ts +30 -0
  97. package/lib/task/delegation-receipts.ts +263 -4
  98. package/lib/task/finalization.ts +761 -0
  99. package/lib/task/index.ts +0 -8
  100. package/lib/task/operation-outcome.ts +48 -0
  101. package/lib/task/orchestration.ts +218 -982
  102. package/lib/task/short-id.ts +65 -1
  103. package/lib/task/task-execution-lock.ts +10 -1
  104. package/lib/task/verification-engine.ts +115 -63
  105. package/lib/task/verification.ts +3 -2
  106. package/lib/task/workflow-warning-intents.ts +57 -2
  107. package/package.json +2 -2
  108. package/templates/.agents/QUICKSTART.en.md +3 -4
  109. package/templates/.agents/QUICKSTART.zh-CN.md +3 -4
  110. package/templates/.agents/hooks/lifecycle-delegation.js +1 -21
  111. package/templates/.agents/rules/README.en.md +1 -0
  112. package/templates/.agents/rules/README.zh-CN.md +1 -0
  113. package/templates/.agents/rules/compatibility-policy.en.md +39 -0
  114. package/templates/.agents/rules/compatibility-policy.zh-CN.md +39 -0
  115. package/templates/.agents/rules/lifecycle-orchestration.en.md +4 -4
  116. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +4 -4
  117. package/templates/.agents/rules/pr-sync.en.md +1 -1
  118. package/templates/.agents/rules/pr-sync.github.en.md +2 -1
  119. package/templates/.agents/rules/pr-sync.github.zh-CN.md +2 -0
  120. package/templates/.agents/rules/pr-sync.zh-CN.md +1 -0
  121. package/templates/.agents/rules/review-method.en.md +1 -0
  122. package/templates/.agents/rules/review-method.zh-CN.md +1 -0
  123. package/templates/.agents/rules/task-management.en.md +2 -2
  124. package/templates/.agents/rules/task-management.zh-CN.md +2 -2
  125. package/templates/.agents/skills/analyze-task/SKILL.en.md +1 -0
  126. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +1 -0
  127. package/templates/.agents/skills/block-task/SKILL.en.md +2 -4
  128. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -4
  129. package/templates/.agents/skills/cancel-task/SKILL.en.md +3 -3
  130. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +3 -3
  131. package/templates/.agents/skills/close-codescan/SKILL.en.md +6 -2
  132. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +6 -2
  133. package/templates/.agents/skills/close-dependabot/SKILL.en.md +6 -2
  134. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +6 -2
  135. package/templates/.agents/skills/code-task/SKILL.en.md +1 -0
  136. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +2 -0
  137. package/templates/.agents/skills/commit/SKILL.en.md +41 -125
  138. package/templates/.agents/skills/commit/SKILL.zh-CN.md +52 -123
  139. package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -1
  140. package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -1
  141. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +14 -43
  142. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +14 -49
  143. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  144. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  145. package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -35
  146. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -35
  147. package/templates/.agents/skills/complete-task/SKILL.en.md +31 -38
  148. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +31 -38
  149. package/templates/.agents/skills/complete-task/config/verify.en.json +1 -0
  150. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -0
  151. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +1 -1
  152. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +1 -1
  153. package/templates/.agents/skills/create-pr/SKILL.en.md +17 -9
  154. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +17 -9
  155. package/templates/.agents/skills/create-pr/reference/change-report.en.md +41 -0
  156. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +41 -0
  157. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +2 -2
  158. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +2 -2
  159. package/templates/.agents/skills/plan-task/SKILL.en.md +2 -1
  160. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +2 -1
  161. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +8 -6
  162. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +8 -6
  163. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +3 -3
  164. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +3 -3
  165. package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +1 -1
  166. package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +1 -1
  167. package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
  168. package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
  169. package/templates/.agents/skills/run-task/SKILL.en.md +6 -6
  170. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +6 -6
  171. package/templates/.agents/skills/run-task/reference/host-validation.en.md +2 -2
  172. package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +2 -2
  173. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +24 -0
  174. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +1 -1
  175. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +1 -1
  176. package/templates/.codex/hooks.json +4 -4
  177. package/templates/.trae/skills/update-agent-infra.en.md +8 -0
  178. package/templates/.trae/skills/update-agent-infra.zh-CN.md +8 -0
  179. package/dist/lib/task/commit-finalization.js +0 -305
  180. package/dist/lib/task/commit-intent.js +0 -165
  181. package/lib/task/commit-finalization.ts +0 -419
  182. package/lib/task/commit-intent.ts +0 -230
@@ -11,6 +11,8 @@ description: >
11
11
 
12
12
  创建 Pull Request,并在与任务关联时立即补齐核心元数据和 reviewer 摘要。
13
13
 
14
+ `platform-pr create` 返回唯一的 `result` / `warnings` 字段;成功结果为 `pr_created`、`pr_reused` 或 `no_op`,同步降级时为对应的 `_with_warnings` 结果(包括 `no_op_with_warnings`)。创建前必须证明任务分支已推送,远端 branch SHA 与本地预期 `HEAD` 一致;缺失、漂移、PR head SHA 不一致或 bind 前竞态都属于 hard failure,不得用 warning 继续绑定。
15
+
14
16
  ## 行为边界 / 关键规则
15
17
 
16
18
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
@@ -64,31 +66,37 @@ description: >
64
66
 
65
67
  ### 4. 检查远程分支状态
66
68
 
67
- 调用 `agent-infra-internal git-workflow inspect` 检查 upstream/remote branch;必要时通过 `git-workflow push` 推送并复核。
69
+ 调用 `agent-infra-internal git-workflow inspect` 检查已交付的 upstream/remote branch;`create-pr` 不执行首次 push,远端 branch 缺失或 SHA 与本地 HEAD 不一致时直接失败并指向 `commit`/push-only。随后在 locate/create/bind 前后再次读取远端 branch SHA,并要求 PR 的精确 repository/ref、base 和 `head.sha` 全部匹配;POST 后的竞态不自动删除已创建 PR 或远端 branch,下一次只按资源身份恢复。
68
70
 
69
71
  ### 5. 创建或恢复 PR
70
72
 
71
- 执行前先读取 `.agents/rules/issue-pr-commands.md`,把标题和正文写入临时文件,并调用其中的 `platform-pr create` intent。core 在任务锁内、任何 Create PR started / POST / reuse-bind 之前检查 commit finalization;active intent、open Commit、审查锚点缺失或 tree 漂移时返回稳定 code 并指向重跑 commit/review-code,不自动恢复。门禁通过后才按 head/base 精确定位:唯一既有 PR 会复用并绑定,零个才创建,多个稳定失败;重放不得产生重复 PR。
73
+ 执行前先读取 `.agents/rules/issue-pr-commands.md`,把标题和正文写入临时文件,并调用其中的 `platform-pr create` intent。core 在任务锁内按 remote branch、head/base 和 PR 身份事实执行:唯一既有 PR 会复用并绑定,零个才创建,多个稳定失败;review 或 task sync 记录不作为创建 PR 的前置门禁,重放不得产生重复 PR。
72
74
 
73
75
  如果获取到 `{task-id}` 且对应任务提供了 `issue_number`,必须在 PR 正文中保留 `Closes #{issue-number}`。
74
76
 
75
77
  ### 6. 同步 PR 元数据
76
78
 
77
- 调用 `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue`。core 从 Issue 复制 type / `in:` labels、assignee 和具体 milestone,并维护 Development 关联;逐项权限不足返回 degraded,不反向更新 Issue。
79
+ 记录 `platform-pr create` 结构化结果中的 `result`(`pr_created`、`pr_reused` 或 `no_op`),并调用 `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue --result {primary-result}`。core 从 Issue 复制 type / `in:` labels、assignee 和具体 milestone,并维护 Development 关联;逐项权限不足返回 degraded,不反向更新 Issue。PR 已成功绑定后,metadata/summary 同步失败只产生与 primary result 对应的 `pr_created_with_warnings`、`pr_reused_with_warnings` 或 `no_op_with_warnings`,保留主动作事实,重试只执行未完成的同步步骤。
80
+
81
+ ### 7. 生成 PR 代码增减报告
82
+
83
+ 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类增减、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
84
+
85
+ 报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数或只统计最后一个 commit。
78
86
 
79
- ### 7. 发布审查摘要
87
+ ### 8. 发布审查摘要
80
88
 
81
89
  读取最新的上下文产物:`plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md`、`review-code.md` / `review-code-r{N}.md`(存在时)。
82
90
 
83
- 基于这些产物聚合 reviewer 摘要,并使用隐藏标记维护唯一且幂等的摘要评论。
91
+ 基于这些产物聚合 reviewer 摘要,并追加第 7 步生成的 `### PR 代码增减` 段落,再使用隐藏标记维护唯一且幂等的摘要评论。调用 `summary-sync` 时继续传递同一个 `--result {primary-result}`,不得根据同步子步骤猜测 PR 是创建还是复用。
84
92
 
85
93
  > canonical context、摘要聚合和 `summary-sync` 调用见 `reference/comment-publish.md`(其引用 `.agents/rules/pr-sync.md`)。发布摘要前先读取该 reference。
86
94
 
87
- ### 8. 确认任务状态
95
+ ### 9. 确认任务状态
88
96
 
89
97
  `platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 `pr_number`、`pr_status`、规范时间/版本和 Create PR 完成日志。调用方只核对结构化结果,不再次编辑这些字段。
90
98
 
91
- ### 9. 完成校验
99
+ ### 10. 完成校验
92
100
 
93
101
  如果本次操作关联了 `{task-id}`,运行完成校验,确认任务元数据和同步状态符合规范;如果没有任务上下文,跳过本步骤。
94
102
 
@@ -103,13 +111,13 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
103
111
 
104
112
  将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
105
113
 
106
- ### 10. 告知用户
114
+ ### 11. 告知用户
107
115
 
108
116
  > 仅在校验通过后执行本步骤。
109
117
 
110
118
  > 渲染下一步前先读取 `.agents/rules/next-step-output.md`,仅为已选场景调用统一 helper,并将 stdout 填入 `{next-step-commands}`。
111
119
 
112
- 说明 PR URL、元数据同步结果、摘要评论结果,并推荐下一步进入 PR 监控(按 `.agents/rules/next-step-output.md` 把 `{task-ref}` 渲染为短号 `NN`):
120
+ 说明 PR URL、元数据同步结果、摘要评论结果,完整展示第 7 步的分类统计表与必要性结论,并推荐下一步进入 PR 监控(按 `.agents/rules/next-step-output.md` 把 `{task-ref}` 渲染为短号 `NN`):
113
121
 
114
122
  使用 `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
115
123
 
@@ -0,0 +1,41 @@
1
+ # PR Code Change Report
2
+
3
+ <!-- pr-change-report-contract
4
+ {"version":1,"source":"platform-pr-inspect","diff":"three-dot-find-renames-numstat","publish":["pr-summary","user-response"]}
5
+ -->
6
+
7
+ After a PR is created or uniquely reused, use the authoritative `base.sha` and `head.sha` returned by `platform-pr inspect` to measure the complete PR diff. Do not substitute the last commit or current worktree state.
8
+
9
+ ## Evidence Commands
10
+
11
+ ```bash
12
+ git diff --find-renames --numstat {base-sha}...{head-sha}
13
+ git diff --find-renames --name-status {base-sha}...{head-sha}
14
+ git diff --find-renames --summary {base-sha}...{head-sha}
15
+ ```
16
+
17
+ Count binary files in the file total but do not invent line counts for `-` numstat values. Explain renames and copies from `name-status` and `summary` separately so moves are not reported as full rewrites.
18
+
19
+ ## Classification and Reconciliation
20
+
21
+ Using the repository's actual structure, assign every file to exactly one closest category and omit categories that do not apply:
22
+
23
+ - Runtime code
24
+ - Tests and test support
25
+ - Skills, workflows, and collaboration rules
26
+ - Templates or generated mirrors
27
+ - Documentation
28
+ - Configuration, dependencies, and other files
29
+
30
+ The table must contain component, file count, additions, deletions, and net change, followed by a total row. Category totals must reconcile exactly with the complete numstat total. Then list the largest changed files and distinguish source, tests, template mirrors, and pure renames.
31
+
32
+ ## Required Analysis
33
+
34
+ Briefly explain:
35
+
36
+ - where growth is concentrated and how runtime code compares with tests, docs, and templates;
37
+ - which line changes are path moves, bilingual mirrors, or mechanical synchronization;
38
+ - whether any change cannot be traced directly to the PR goal and may be unnecessary; if none, state the evidence;
39
+ - when a test fixture is much larger than production changes, what risk it covers instead of judging it only by size.
40
+
41
+ Add the complete report as a `### PR Code Changes` section in the reviewer summary body. Preserve the same table and conclusion in the user-visible create-pr completion response. Do not create a second PR comment for this report.
@@ -0,0 +1,41 @@
1
+ # PR 代码增减报告
2
+
3
+ <!-- pr-change-report-contract
4
+ {"version":1,"source":"platform-pr-inspect","diff":"three-dot-find-renames-numstat","publish":["pr-summary","user-response"]}
5
+ -->
6
+
7
+ PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base.sha` 与 `head.sha` 统计完整 PR 差异,不以最后一个 commit 或工作树状态代替。
8
+
9
+ ## 证据命令
10
+
11
+ ```bash
12
+ git diff --find-renames --numstat {base-sha}...{head-sha}
13
+ git diff --find-renames --name-status {base-sha}...{head-sha}
14
+ git diff --find-renames --summary {base-sha}...{head-sha}
15
+ ```
16
+
17
+ `numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据 `name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
18
+
19
+ ## 分类与核算
20
+
21
+ 结合仓库实际结构,把每个文件唯一归入以下最贴近的类别;不适用的类别省略:
22
+
23
+ - 运行时代码
24
+ - 测试与测试辅助设施
25
+ - Skill / workflow / 协作规则
26
+ - 模板或生成镜像
27
+ - 文档
28
+ - 配置、依赖与其他
29
+
30
+ 输出表格必须包含“部分、文件数、新增、删除、净增”,并有合计行。各类别之和必须与完整 `numstat` 总计一致。随后列出增减最大的文件,并区分源码、测试、模板镜像和纯 rename。
31
+
32
+ ## 分析要求
33
+
34
+ 用简短结论回答:
35
+
36
+ - 增长主要集中在哪里,运行时代码与测试/文档/模板各占多少;
37
+ - 哪些行数只是路径迁移、双语镜像或机械同步;
38
+ - 是否存在与 PR 目标无法直接对应、疑似不必要的变化;若没有,明确说明判断依据;
39
+ - 若某个测试 fixture 明显大于生产改动,解释它覆盖的风险,而不是仅以行数评价。
40
+
41
+ 将完整报告以 `### PR 代码增减` 段落写入 reviewer 摘要正文,并在 create-pr 的用户可见完成回复中原样保留同一张统计表与结论。不要把报告另建成第二条 PR 评论。
@@ -6,7 +6,7 @@ Write the plain summary body to a temporary file, then run:
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-pr summary-sync {task-id} \
9
- --agent {standard-agent-token} --body-file {summary-body-file}
9
+ --agent {standard-agent-token} --body-file {summary-body-file} --result {primary-result}
10
10
  ```
11
11
 
12
- The caller does not add markers, HEAD metadata, or comment API parameters. A summary failure records the existing `create-pr` warning and does not roll back the PR.
12
+ The caller does not add markers, HEAD metadata, or comment API parameters. `--result` is required and must be passed unchanged from `platform-pr create`; `no_op` maps to `no_op_with_warnings` if summary synchronization degrades. Summary failures do not roll back a created or reused PR.
@@ -6,7 +6,7 @@
6
6
 
7
7
  ```bash
8
8
  agent-infra-internal platform-pr summary-sync {task-id} \
9
- --agent {standard-agent-token} --body-file {summary-body-file}
9
+ --agent {standard-agent-token} --body-file {summary-body-file} --result {primary-result}
10
10
  ```
11
11
 
12
- 调用方不添加 marker、HEAD 或评论 API 参数。摘要失败沿用 `create-pr` 错误处理并记录 warning,不回滚已创建 PR。结果映射沿用 `.agents/rules/pr-sync.md`。
12
+ 调用方不添加 marker、HEAD 或评论 API 参数。`--result` 是必填的,必须把 `platform-pr create` 的 `result` 原样传入;摘要失败沿用该 primary result 映射 warning(`no_op` 对应 `no_op_with_warnings`),不回滚已创建或复用的 PR。结果映射沿用 `.agents/rules/pr-sync.md`。
@@ -15,6 +15,7 @@ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--or
15
15
 
16
16
  - This skill only outputs a technical plan document (`plan.md` or `plan-r{N}.md`) and does not modify any business code
17
17
  - This is a **mandatory human review checkpoint**; do not automatically proceed to implementation
18
+ - When the plan touches compatibility, migration, old formats, or old entry points, read `.agents/rules/compatibility-policy.md` first. Do not design adapters, shims, dual writes, or parallel state machines without passing its admission gate
18
19
  - After executing this skill, you **must** immediately update task status in task.md
19
20
 
20
21
  Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
@@ -75,7 +76,7 @@ Use it to understand:
75
76
 
76
77
  - Read the relevant source files identified in the analysis
77
78
  - Understand the current architecture and patterns
78
- - Identify constraints (backward compatibility, performance, etc.)
79
+ - Identify explicit constraints, including evidenced and approved compatibility or performance requirements; do not infer a compatibility promise
79
80
  - Consider edge cases and failure scenarios
80
81
 
81
82
  ### 5. Design the Technical Plan
@@ -15,6 +15,7 @@ description: >
15
15
 
16
16
  - 本技能仅产出技术方案文档(`plan.md` 或 `plan-r{N}.md`)—— 不修改任何业务代码
17
17
  - 这是一个**强制性的人工审查检查点** —— 不要自动进入实现阶段
18
+ - 方案涉及兼容、迁移、旧格式或旧入口时,先读取 `.agents/rules/compatibility-policy.md`;未通过准入门槛时不得设计 adapter、shim、双写或并行状态机
18
19
  - 执行本技能后,你**必须**立即更新 task.md 中的任务状态
19
20
 
20
21
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
@@ -76,7 +77,7 @@ agent-infra-internal task-event {task-id} plan.started --agent {standard-agent-t
76
77
 
77
78
  - 阅读分析中识别的相关源码文件
78
79
  - 理解当前架构和模式
79
- - 识别约束条件(向后兼容性、性能等)
80
+ - 识别明确约束(包括有证据且已获准的兼容性、性能等),不自行推导兼容承诺
80
81
  - 考虑边界情况和错误场景
81
82
 
82
83
  ### 5. 设计技术方案
@@ -6,20 +6,22 @@ Use when changes touch persistent formats, schemas, configuration/frontmatter, c
6
6
 
7
7
  ## Review Questions
8
8
 
9
- - Can old data or configuration be read safely, and is the post-write version boundary explicit?
10
- - Is migration repeatable, and can execution recover or continue after partial failure?
11
- - Does the rollback path match the compatibility window between old and new formats?
9
+ - Does compatibility pass the subject, necessity, window, and exit gate in `.agents/rules/compatibility-policy.md`? If not, should the change be current-only?
10
+ - Is an approved conversion concentrated at one boundary and followed by current-format-only writes, rather than teaching business logic multiple versions?
11
+ - If migration is required, is it repeatable, and can partial failure recover or stop safely?
12
+ - When an old format is removed, are its branches, fixtures, tests, and documentation removed in the same change?
12
13
 
13
14
  ## Evidence Requirements
14
15
 
15
- Record the transition from old input to new state, version decisions, and failure states. Prefer migration tests, fixtures, state transitions, or specification conflicts.
16
+ Record compatibility admission evidence first. For approved compatibility, record the single conversion from old input to current state, version decisions, exit condition, and failure states. Prefer consumer or stored-data evidence, migration tests, fixtures, state transitions, or specification conflicts.
16
17
 
17
18
  ## Common Counterexamples
18
19
 
19
- - Testing only fresh installation and ignoring existing state.
20
+ - Retaining an old read path “just in case” without real consumers or stored data.
21
+ - Dual-writing formats or maintaining several state machines in the normal path.
20
22
  - Assuming migration succeeds once while ignoring retries and partial writes.
21
23
  - Replacing data-semantic validation with format-existence checks.
22
24
 
23
25
  ## When Closure Is Not Possible
24
26
 
25
- Record reproducible corruption or compatibility failures as findings, checks requiring real historical data as manual-validation, and missing samples or rollback evidence as a gap.
27
+ Record unauthorized compatibility, dual writes, and shims without an exit condition as findings. For approved migrations, record reproducible corruption as a finding and checks requiring real historical data as manual-validation. Missing compatibility admission evidence cannot be treated as a harmless gap while approving the change.
@@ -6,20 +6,22 @@
6
6
 
7
7
  ## 检视问题
8
8
 
9
- - 旧数据或旧配置能否被安全读取,写入后的版本边界是否明确。
10
- - 迁移是否可重复执行,部分失败后能否恢复或继续。
11
- - 回滚路径是否与新旧格式的兼容窗口一致。
9
+ - 兼容是否通过 `.agents/rules/compatibility-policy.md` 的对象、必要性、期限和退出条件准入;未准入时是否应直接 current-only。
10
+ - 获准转换是否集中在一个边界,转换后只写当前格式,而不是让业务核心理解多个版本。
11
+ - 若确需迁移,是否可重复执行,部分失败后能否恢复或安全停止。
12
+ - 删除旧格式时,专属分支、fixture、测试和文档是否同轮删除。
12
13
 
13
14
  ## 证据要求
14
15
 
15
- 记录旧输入到新状态的转换、版本判定和失败状态;优先使用迁移测试、fixture、状态转换或规范冲突。
16
+ 先记录兼容准入证据;获准兼容时再记录旧输入到当前状态的唯一转换、版本判定、退出条件和失败状态。优先使用消费者/存量数据证据、迁移测试、fixture、状态转换或规范冲突。
16
17
 
17
18
  ## 常见反例
18
19
 
19
- - 只验证全新安装,不验证已有状态。
20
+ - 没有真实消费者或存量数据,只因“可能需要”就保留旧读取。
21
+ - 同时写新旧格式,或在主路径里维护多套状态机。
20
22
  - 假设迁移一次成功,忽略重试和部分写入。
21
23
  - 用格式存在性测试替代数据语义验证。
22
24
 
23
25
  ## 无法闭环时
24
26
 
25
- 可复现的数据损坏或兼容失败形成 finding;需要真实历史数据的验证进入 manual-validation;缺少样本或回滚证据时记录 gap。
27
+ 未经授权的兼容层、双写或无退出条件 shim 形成 finding。已获准迁移中的可复现数据损坏形成 finding;需要真实历史数据的验证进入 manual-validation;缺少兼容准入证据时不能仅记录 gap 后放行。
@@ -12,7 +12,7 @@ description: >
12
12
 
13
13
  - Select the validation mode, call the sole mechanical entry point, and record evidence; do not mark PR manual validation complete.
14
14
  - `complete-manual-validation` remains the maintainer's final registration after coverage is judged sufficient.
15
- - Never manipulate temporary worktrees, leases, or containers directly; only call `ai task validate`.
15
+ - Never manipulate temporary worktrees, leases, or containers directly; only call `agent-infra-internal task-validate`.
16
16
  - Never record tokens, environment variables, full argv, absolute user paths, or raw transcripts in the artifact.
17
17
 
18
18
  ## Step 0: State Check (pre-execution hard gate)
@@ -28,7 +28,7 @@ agent-infra-internal task-snapshot {task-id} --format text
28
28
  1. Read `reference/discovery-and-execution.md` and parse the input mode. Stop before started without an artifact for invalid or partial input.
29
29
  2. Run `agent-infra-internal task-artifact {task-id} inspect --family validation-run` and read the latest review-code manual-validation items. Then run `agent-infra-internal platform-pr inspect {task-id}` and use the reference status matrix to discover, merge, and number items. Only automatic mode stops before started when reliable sources are empty or the sole possible source is unreadable; valid explicit mode always continues with the user command as effective work.
30
30
  3. Take the round and artifact name from the core result. After confirming valid explicit work or a non-empty discovered list, run `agent-infra-internal task-event {task-id} validation-run.started --agent {standard-agent-token}` and classify each item as `executable|unavailable|unknown|unsafe|unresolved`.
31
- 4. Invoke every executable item separately with `ai task validate {task-ref} --scope snapshot --format json -- {command...}`. Only make a second explicit inplace invocation for that item when evidence proves it is required. If no item is executable, run no fabricated command but still produce coverage-gap evidence.
31
+ 4. Invoke every executable item separately with `agent-infra-internal task-validate {task-ref} --scope snapshot --format json -- {command...}`. Only make a second explicit inplace invocation for that item when evidence proves it is required. If no item is executable, run no fabricated command but still produce coverage-gap evidence.
32
32
  5. Read `reference/report-template.md`, create `validation-run.md|validation-run-r{N}.md`, and record the input mode, discovered list, per-item results, CLI JSON allowlist, and sanitized summaries.
33
33
  6. Run `agent-infra-internal task-event {task-id} validation-run.completed --agent {standard-agent-token} --artifact {artifact}`. When an Issue exists, run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}` and then `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {artifact} --agent {standard-agent-token}`.
34
34
  7. Run `agent-infra-internal task-verify {task-id} validation-run.completed --artifact {artifact} --format text`; fix failures and rerun it.
@@ -36,7 +36,7 @@ agent-infra-internal task-snapshot {task-id} --format text
36
36
 
37
37
  ## Completion Checklist
38
38
 
39
- - [ ] Used `ai task validate` for every executable item, or recorded that none were executable
39
+ - [ ] Used `agent-infra-internal task-validate` for every executable item, or recorded that none were executable
40
40
  - [ ] Recorded sanitized validation-run evidence
41
41
  - [ ] Did not change PR manual validation completion state
42
42
  - [ ] Updated task.md and passed completion verification
@@ -12,7 +12,7 @@ description: >
12
12
 
13
13
  - 本技能负责选择校验模式、调用唯一机械入口并记录证据;不把 PR 人工校验标为完成。
14
14
  - `complete-manual-validation` 仍是维护者确认覆盖充分后的最终登记入口。
15
- - 禁止直接操作临时 worktree、lease 或 container;只调用 `ai task validate`。
15
+ - 禁止直接操作临时 worktree、lease 或 container;只调用 `agent-infra-internal task-validate`。
16
16
  - 产物不得记录 token、环境变量、完整 argv、绝对用户路径或原始 transcript。
17
17
 
18
18
  ## 第 0 步:状态核对(执行前硬约束)
@@ -28,7 +28,7 @@ agent-infra-internal task-snapshot {task-id} --format text
28
28
  1. 读取 `reference/discovery-and-execution.md`,解析输入模式;非法或半截输入在 started 前停止,不写产物。
29
29
  2. 运行 `agent-infra-internal task-artifact {task-id} inspect --family validation-run`,读取最新 review-code 人工校验项;再运行 `agent-infra-internal platform-pr inspect {task-id}`,按 reference 的状态矩阵发现、归并并编号。仅在自动模式下,可靠来源无项或唯一可能来源不可读时才在 started 前停止;合法显式模式始终以用户命令作为有效工作继续。
30
30
  3. 从核心结果取得轮次和产物名;确认存在有效显式工作或非空发现清单后,运行 `agent-infra-internal task-event {task-id} validation-run.started --agent {standard-agent-token}`,并逐项分类为 `executable|unavailable|unknown|unsafe|unresolved`。
31
- 4. 每个可执行项分别调用 `ai task validate {task-ref} --scope snapshot --format json -- {command...}`;只有证据表明必须原位时才对该项进行第二次显式 inplace 调用。零项可执行时不运行伪造命令,但仍继续产出覆盖缺口证据。
31
+ 4. 每个可执行项分别调用 `agent-infra-internal task-validate {task-ref} --scope snapshot --format json -- {command...}`;只有证据表明必须原位时才对该项进行第二次显式 inplace 调用。零项可执行时不运行伪造命令,但仍继续产出覆盖缺口证据。
32
32
  5. 读取 `reference/report-template.md`,创建 `validation-run.md|validation-run-r{N}.md`;记录输入模式、发现清单、逐项结果、CLI JSON allowlist 与去敏摘要。
33
33
  6. 运行 `agent-infra-internal task-event {task-id} validation-run.completed --agent {standard-agent-token} --artifact {artifact}`。存在 Issue 时依次运行 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}` 和 `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {artifact} --agent {standard-agent-token}`。
34
34
  7. 运行 `agent-infra-internal task-verify {task-id} validation-run.completed --artifact {artifact} --format text`;未通过则修复后重跑。
@@ -36,7 +36,7 @@ agent-infra-internal task-snapshot {task-id} --format text
36
36
 
37
37
  ## 完成检查清单
38
38
 
39
- - [ ] 每个可执行项均已使用 `ai task validate`,或已记录零项可执行
39
+ - [ ] 每个可执行项均已使用 `agent-infra-internal task-validate`,或已记录零项可执行
40
40
  - [ ] 已记录去敏 validation-run 证据
41
41
  - [ ] 未修改 PR 人工验证完成状态
42
42
  - [ ] 已更新 task.md 并通过完成校验
@@ -58,7 +58,7 @@ Only `executable` items may run. Commands must not expose credentials, environme
58
58
  1. Invoke each executable item separately:
59
59
 
60
60
  ```bash
61
- ai task validate {task-ref} --scope snapshot --format json -- {command...}
61
+ agent-infra-internal task-validate {task-ref} --scope snapshot --format json -- {command...}
62
62
  ```
63
63
 
64
64
  2. Only when the item or first-run evidence proves a dependency on uncommitted content, original mounts, or in-place permissions, explicitly invoke that item a second time with `--scope inplace` and record the reason.
@@ -58,7 +58,7 @@
58
58
  1. 每个可执行项分别调用:
59
59
 
60
60
  ```bash
61
- ai task validate {task-ref} --scope snapshot --format json -- {command...}
61
+ agent-infra-internal task-validate {task-ref} --scope snapshot --format json -- {command...}
62
62
  ```
63
63
 
64
64
  2. 仅当项目要求或首次证据证明依赖未提交内容、原挂载或原位权限时,再为该项显式调用一次 `--scope inplace`,并记录升级理由。
@@ -37,7 +37,7 @@ $ agent-infra-internal task-snapshot {task-id} --format text
37
37
  ## Structured Evidence
38
38
 
39
39
  ```json
40
- {sanitized-ai-task-validate-json}
40
+ {sanitized-task-validate-json}
41
41
  ```
42
42
 
43
43
  ## Per-item Results
@@ -64,6 +64,6 @@ $ agent-infra-internal task-snapshot {task-id} --format text
64
64
  ## Raw Evidence
65
65
 
66
66
  ```text
67
- $ ai task validate {task-ref} --scope {scope} --format json -- {redacted-command}
67
+ $ agent-infra-internal task-validate {task-ref} --scope {scope} --format json -- {redacted-command}
68
68
  {sanitized-result}
69
69
  ```
@@ -37,7 +37,7 @@ $ agent-infra-internal task-snapshot {task-id} --format text
37
37
  ## 结构化证据
38
38
 
39
39
  ```json
40
- {sanitized-ai-task-validate-json}
40
+ {sanitized-task-validate-json}
41
41
  ```
42
42
 
43
43
  ## 逐项结果
@@ -64,6 +64,6 @@ $ agent-infra-internal task-snapshot {task-id} --format text
64
64
  ## 证据原文
65
65
 
66
66
  ```text
67
- $ ai task validate {task-ref} --scope {scope} --format json -- {redacted-command}
67
+ $ agent-infra-internal task-validate {task-ref} --scope {scope} --format json -- {redacted-command}
68
68
  {sanitized-result}
69
69
  ```
@@ -10,13 +10,13 @@ description: >
10
10
  The orchestrator delegates only and never executes a stage skill itself. First read `.agents/rules/no-mid-flow-questions.md`, `.agents/rules/lifecycle-orchestration.md`, and `reference/host-validation.md`.
11
11
 
12
12
  1. Resolve the canonical task ID, current Agent Client, and optional atomic policy flags, then run `task-snapshot`. If one explicit role field is present, all four are required.
13
- 2. Before `begin-or-resume`, Codex selects a host. Without `AGENT_INFRA_CONTROL_TOKEN`, use direct-host. With task-bound control authority but no `AGENT_INFRA_CODEX_CONTROLLER_CONTEXT`, only run `codex-sandbox-controller run --task-id {task-id} --task-ref {task-ref}` with the complete policy and wait; the outer loop must not create a run, baseline, or receipt. With a context, run `verify-context --task-id {task-id}` first. Stop on any bootstrap, bundle, source/profile discovery, or context failure.
14
- 3. Run `task-orchestration {task-id} begin-or-resume --client {client}` with the complete explicit policy. With no explicit policy, core reads that client's configured policy; existing v2/v3 runs use persisted policy. Stop on paused/completed results.
13
+ 2. Before `begin-or-resume`, Codex selects a host. Without `AGENT_INFRA_CONTROL_TOKEN`, use direct-host. With task-bound control authority but no `AGENT_INFRA_CODEX_CONTROLLER_CONTEXT`, only run `codex-sandbox-controller run` with the complete policy and wait; the outer loop must not create a run, baseline, or receipt. With a context, run `verify-context` first. Stop on protocol, task/controller/process, lease, or source/profile discovery failures. Package/build/contract or hook/profile content drift is delivered as a structured warning and tells the user to rebuild the sandbox.
14
+ 3. Run `task-orchestration {task-id} begin-or-resume --client {client}` with the complete explicit policy. With no explicit policy, core reads that client's configured policy; existing runs use persisted policy. Disk state outside the complete current structure fails closed without rewriting; finish or clear active runs before upgrading. Stop on paused/completed results.
15
15
  4. Run `route`. On `completed`, run `agent-infra-internal task-verify {task-id} run-task.completed --format text` and stop. Only a `running` result with non-null `next` supplies action, role, round, artifact, requested model, and requested effort.
16
- 5. Codex runs `codex-lifecycle capability-arm --task-id {task-id}` once. The current loop's real PostToolUse must attest that ordinary tool response. Pass only its marker token to `prepare --client {client} --capability-token {token}`. Before snapshotting, core atomically consumes it, verifies task, hook source, build, contract, and controller binding, and persists the capability session, turn, and tool-use origin. Activation then verifies that spawn belongs to the same session and turn and uses a distinct tool-use. Other clients use the same prepare without a token. Failure creates no baseline, receipt, or child.
17
- 6. After prepare, run `task-orchestration <task-ref> dispatch` immediately before calling the fresh native child, then use route's exact model/effort and only the short task ref, skill, `--orchestrated`, and stage identity. The trusted hook-spawn first-observation time must fall between dispatch and the deadline. Its first provenance-sensitive command must be `await-activation --stage ... --round ... --artifact ... --role ...`; before `running`, it must not snapshot, emit stage-started, write business files, or start commit. Only explicit `recover-prepared` may clear an expired orphan when the task fingerprint is exact, no commit intent exists, and no matching unconsumed active lifecycle evidence remains.
18
- 7. Codex uses SubagentStart/Stop and App Server actual evidence to activate, consume, and seal one v3 receipt; trusted parent fallback must produce the same provenance. Timed-out waits do nothing. Advance only a sealed receipt and repeat step 4 only while running.
19
- 8. Create a fresh child each round and never follow up with an old reviewer. Each requested/actual mismatch needs its own host fallback reason. Capability, hook, source, controller, build, identity, ledger, or fingerprint failure pauses and fails closed.
16
+ 5. Codex runs `codex-lifecycle capability-arm --task-id {task-id}` once. The current loop's real PostToolUse must attest that ordinary tool response. Pass its marker token, the exact routed model, and the exact routed reasoning effort to `prepare --client {client} --requested-model {requestedModel} --requested-reasoning-effort {requestedReasoningEffort} --capability-token {token}`. Core first validates the exact routed model/effort, capability provenance, and controller binding, then captures a read-only snapshot, builds an in-memory prepared receipt, atomically consumes the token, and saves the prepared state with the capability session, turn, and tool-use origin. Activation then verifies that spawn belongs to the same session and turn and uses a distinct tool-use. Other clients use the same prepare without a token. Failure creates no baseline, receipt, or child.
17
+ 6. After prepare, run `task-orchestration <task-ref> dispatch` immediately before calling the fresh native child, then use route's exact model/effort and only the short task ref, skill, `--orchestrated`, and stage identity. The trusted hook-spawn first-observation time must fall between dispatch and the deadline. Its first provenance-sensitive command must be `await-activation --stage ... --round ... --artifact ... --role ...`; before `running`, it must not snapshot, emit stage-started, write business files, or start commit. Only explicit `recover-prepared` may clear an expired orphan when the task fingerprint is exact and no matching unconsumed active lifecycle evidence remains.
18
+ 7. Codex uses SubagentStart/Stop and App Server actual evidence to activate, consume, and seal one receipt; trusted parent fallback must produce the same complete provenance. Timed-out waits do nothing. Advance only a sealed receipt and repeat step 4 only while running.
19
+ 8. Create a fresh child each round and never follow up with an old reviewer. Each requested/actual mismatch needs its own host fallback reason. Protocol, capability, receipt hook/evidence binding, source, controller, identity, ledger, or fingerprint failure pauses and fails closed; cross-root package/build/contract or hook/profile content drift is delivered as a warning instead of blocking natural evolution.
20
20
  9. On pause or completion, run the matching typed verification and report the structured endpoint.
21
21
 
22
22
  ## Stop
@@ -10,13 +10,13 @@ description: >
10
10
  总控只编排,不直接执行任何阶段技能。执行前先读取 `.agents/rules/no-mid-flow-questions.md`、`.agents/rules/lifecycle-orchestration.md` 与 `reference/host-validation.md`。
11
11
 
12
12
  1. 解析规范任务 ID、当前 Agent Client,以及可选的原子策略 `--executor-model`、`--executor-reasoning-effort`、`--reviewer-model`、`--reviewer-reasoning-effort`,并执行 `agent-infra-internal task-snapshot {task-id} --format text`。任一显式策略字段出现时四个 role 字段必须完整,不得与配置拼接;两个角色可以使用同一模型。
13
- 2. Codex 在 `begin-or-resume` 前选择宿主:没有 `AGENT_INFRA_CONTROL_TOKEN` 时使用 direct-host;有 task-bound control authority 但没有 `AGENT_INFRA_CODEX_CONTROLLER_CONTEXT` 时,只调用 `agent-infra-internal codex-sandbox-controller run --task-id {task-id} --task-ref {task-ref}`(转发完整显式策略)并等待其终态,外层不得创建 run、baseline 或 receipt;已有 context 时先调用 `verify-context --task-id {task-id}`。controller 的 bootstrap、bundle、source/profile discovery 或 context 任一校验失败即停止。
14
- 3. 调用 `agent-infra-internal task-orchestration {task-id} begin-or-resume --client {client}` 并转发完整显式策略。完全没有显式策略时由核心读取当前 client 的 `agentClients[].orchestration`;已有 v2/v3 run 使用持久化策略。仅当核心返回 `ORCHESTRATION_MODEL_POLICY_REQUIRED` 时,先用 `agent-client model-selection` 展示 complete/partial/interactive-only 来源,再一次收集完整策略;未回答则不创建 run。若为 paused/completed,按结构化结果停止。
13
+ 2. Codex 在 `begin-or-resume` 前选择宿主:没有 `AGENT_INFRA_CONTROL_TOKEN` 时使用 direct-host;有 task-bound control authority 但没有 `AGENT_INFRA_CODEX_CONTROLLER_CONTEXT` 时,只调用 `agent-infra-internal codex-sandbox-controller run`(转发完整显式策略)并等待其终态,外层不得创建 run、baseline 或 receipt;已有 context 时先调用 `verify-context`。protocol、task/controller/process、lease 或 source/profile discovery 校验失败即停止;package/build/contract 或 hook/profile 内容漂移只输出结构化 warning,并提示用户重建 sandbox。
14
+ 3. 调用 `agent-infra-internal task-orchestration {task-id} begin-or-resume --client {client}` 并转发完整显式策略。完全没有显式策略时由核心读取当前 client 的 `agentClients[].orchestration`;existing run 使用持久化策略。磁盘状态不符合当前完整结构时核心失败关闭且不改写;升级前必须完成或清空 active run。仅当核心返回 `ORCHESTRATION_MODEL_POLICY_REQUIRED` 时,先用 `agent-client model-selection` 展示 complete/partial/interactive-only 来源,再一次收集完整策略;未回答则不创建 run。若为 paused/completed,按结构化结果停止。
15
15
  4. 调用 `route` 并读取结构化结果。若返回 `completed`,立即运行 `agent-infra-internal task-verify {task-id} run-task.completed --format text` 并停止;仅当返回 `running` 且 `next` 非空时读取唯一 action、role、round、artifact、`requestedModel` 和 `requestedReasoningEffort`,不得自行推断。
16
- 5. Codex 先调用一次 `agent-infra-internal codex-lifecycle capability-arm --task-id {task-id}`。该普通工具调用必须由当前 loop 的真实 PostToolUse 回写 attestation;仅把返回的 marker 中 token 传给 `prepare --client {client} --capability-token {token}`。核心在快照前原子消费 token,校验 task、hook source、build、contract 与 controller binding,并持久化 capability 的 session、turn、tool-use 来源。activation 再校验 spawn 与该来源属于同一 session/turn,且 spawn 使用独立的 tool-use。其他客户端直接调用同一 prepare(无 token)。任一失败不得创建 baseline、receipt 或 child。
17
- 6. prepare 成功后,在调用 fresh 原生子 Agent 的紧邻前一步执行 `task-orchestration <task-ref> dispatch`,再显式覆盖 route 返回的 model/effort;只传短任务引用、skill 名、`--orchestrated` 与 stage/round/artifact/role。可信 hook-spawn 首次观察时间必须位于 dispatch 与 deadline 之间。child 的第一条 provenance-sensitive 命令必须是 `await-activation --stage ... --round ... --artifact ... --role ...`;返回 running 前禁止 snapshot、阶段 started、业务写入或 commit-start。超时由核心暂停;崩溃遗留 prepared receipt 只能在 exact workspace fingerprint、无 commit intent、无匹配的未消费 active lifecycle evidence 且 deadline 已过时显式 `recover-prepared`。
18
- 7. Codex 用 SubagentStart/Stop 与 App Server actual evidence 激活、消费并封存唯一 receipt;受信 parent fallback 仍必须形成相同 v3 provenance。timed-out wait 无动作;只有 empty turns 或协议 `inProgress` 可等待,malformed、身份/传输错误或异常 terminal 均暂停。子 Agent 返回后只对 sealed receipt 调用 `advance`;只有 `running` 才重复步骤 4。
19
- 8. 每轮创建新 child;禁止 follow-up 复用 reviewer。actual model/effort 与 requested 不同时必须有各自的宿主降级理由。任何 capability、hook、source、controller、build、身份、账本或 fingerprint 异常都调用 `pause` 并失败关闭。
16
+ 5. Codex 先调用一次 `agent-infra-internal codex-lifecycle capability-arm --task-id {task-id}`。该普通工具调用必须由当前 loop 的真实 PostToolUse 回写 attestation;把 route 返回的精确 model、effort 和 marker 中 token 一并传给 `prepare --client {client} --requested-model {requestedModel} --requested-reasoning-effort {requestedReasoningEffort} --capability-token {token}`。核心先校验精确的 model/effort、capability provenance 与 controller binding,再只读捕获快照、构造内存中的 prepared receipt,最后原子消费 token 并保存 prepared 状态,同时持久化 capability 的 session、turn、tool-use 来源。activation 再校验 spawn 与该来源属于同一 session/turn,且 spawn 使用独立的 tool-use。其他客户端直接调用同一 prepare(无 token)。任一失败不得创建 baseline、receipt 或 child。
17
+ 6. prepare 成功后,在调用 fresh 原生子 Agent 的紧邻前一步执行 `task-orchestration <task-ref> dispatch`,再显式覆盖 route 返回的 model/effort;只传短任务引用、skill 名、`--orchestrated` 与 stage/round/artifact/role。可信 hook-spawn 首次观察时间必须位于 dispatch 与 deadline 之间。child 的第一条 provenance-sensitive 命令必须是 `await-activation --stage ... --round ... --artifact ... --role ...`;返回 running 前禁止 snapshot、阶段 started、业务写入或 commit。超时由核心暂停;崩溃遗留 prepared receipt 只能在 exact workspace fingerprint、无匹配的未消费 active lifecycle evidence 且 deadline 已过时显式 `recover-prepared`。
18
+ 7. Codex 用 SubagentStart/Stop 与 App Server actual evidence 激活、消费并封存唯一 receipt;受信 parent fallback 仍必须形成相同的完整 provenance。timed-out wait 无动作;只有 empty turns 或协议 `inProgress` 可等待,malformed、身份/传输错误或异常 terminal 均暂停。子 Agent 返回后只对 sealed receipt 调用 `advance`;只有 `running` 才重复步骤 4。
19
+ 8. 每轮创建新 child;禁止 follow-up 复用 reviewer。actual model/effort 与 requested 不同时必须有各自的宿主降级理由。protocol、capability、receipt 内 hook/evidence binding、source、controller、身份、账本或 fingerprint 异常都调用 `pause` 并失败关闭;跨根 package/build/contract 或 hook/profile 内容漂移按 warning 交付,不把自然演进差异当成硬失败。
20
20
  9. 完成或暂停后运行对应 typed verification,并把结构化 run 摘要、暂停原因、commit 终点或 clean completion evidence 告知用户。
21
21
 
22
22
  ## 停止
@@ -10,13 +10,13 @@ Before publishing support for a client, prove the lifecycle evidence chain with
10
10
  - Explicit requested model/effort reaches each executor/reviewer. A fallback of either field reports the corresponding actual value and its own non-empty reason.
11
11
  > claude-code exception: requested reasoning effort does not yet support per-role dispatch to executor/reviewer — `.claude/agents/{executor,reviewer}.md` is a repository-level shared singleton, and writing it per role would race across concurrent tasks. This client only needs to honestly record the actual model/actual reasoning effort observed in native Start/Stop host events (`delegationEvidence.actualReasoningEffort` is declared `spawn-ack`); when not observed it is recorded as missing, which is not treated as a fallback requiring its own reason and does not fail closed. This exception does not apply to any other client.
12
12
  - Candidate-checkout and packed-install behavior match, with model policy, receipts, and verification results auditable in `orchestration.json`.
13
- - Direct-host project/managed source and sandbox isolated-user source preserve the same build, contract, profile, and controller provenance through prepare/start/stop/consume.
13
+ - Direct-host and sandbox controller hooks/profiles must come from trusted sources. Cross-root build/contract/profile content drift emits an actionable warning, while controller/task/process/lease and the receipt's hook/evidence binding remain identical through prepare/start/stop/consume.
14
14
 
15
15
  ## Validation Sequence
16
16
 
17
17
  1. Record client version, feature state, and launch command in a clean temporary repository.
18
18
  2. Start a fresh executor and reviewer, retaining redacted raw stdin and the structured run. Validate both native start/stop and the parent PostTool fallback; timed-out waits must do nothing. Never synthesize a field the host did not emit.
19
- 3. Validate model/effort match paths, single and dual justified fallbacks, and fail-closed behavior for missing actual fields.
19
+ 3. Validate model/effort match paths, single and dual justified fallbacks, and fail-closed behavior for missing actual fields. Confirm package/build/contract or hook/profile content drift produces only an actionable warning telling the user to rebuild the sandbox.
20
20
  4. Validate the same commit from a candidate checkout and an `npm pack` install; record the tarball hash and results.
21
21
  5. Commit only redacted summaries and non-sensitive fixtures. Remove or replace tokens, user-specific absolute paths, transcript content, and credentials.
22
22
  6. For sandbox, run at least ten cold executor starts and ten cold reviewer starts. Record monotonic prepared, spawn-dispatch, SubagentStart, and activation-completed timestamps plus p50/p95/max. Enable only when max plus 20% fits the deadline and symlink/config/plugin/lease/context/build failure injection and terminal cleanup audits pass.
@@ -10,13 +10,13 @@
10
10
  - 显式 requested model/effort 能传给 executor/reviewer;宿主对任一字段回退时,事件能给出对应 actual 值与独立的非空 fallback reason。
11
11
  > claude-code 例外:requested reasoning effort 暂不支持按角色下发给 executor/reviewer——`.claude/agents/{executor,reviewer}.md` 是仓库级共享单例,动态写入存在跨任务竞态,解决该竞态超出本任务范围。该客户端只要求如实记录宿主原生 Start/Stop 事件中能观察到的 actual model/actual reasoning effort(`delegationEvidence.actualReasoningEffort` 声明为 `spawn-ack`);观察不到时记录为缺失,不视为需要独立 fallback reason 的回退场景,也不构成 fail-closed 阻断。此例外不适用于其他客户端。
12
12
  - candidate checkout 与打包安装后的行为一致,且模型策略、receipt 与验证结果可从 `orchestration.json` 复核。
13
- - direct-host 的 project/managed source 与 sandbox controller 的 isolated-user source、build/contract/profile/controller digest 必须在 prepare/start/stop/consume 全链路一致。
13
+ - direct-host 与 sandbox controller 使用的 hook/profile 必须来自受信来源;build/contract/profile 内容在跨根比较中允许漂移并输出可操作 warning,但 controller/task/process/lease 与 receipt 内 hook/evidence binding 仍须在 prepare/start/stop/consume 全链路一致。
14
14
 
15
15
  ## 验证顺序
16
16
 
17
17
  1. 在干净临时仓库记录客户端版本、feature 状态和启动命令。
18
18
  2. 分别启动 fresh executor 与 fresh reviewer,保存去敏后的原始 stdin 和结构化 run;同时验证原生 start/stop 与 parent PostTool fallback。timed-out wait 必须无动作;不得补写宿主未产生的字段。
19
- 3. 分别验证 model/effort 的 requested/actual 一致路径、单项与双项有理由 fallback 路径,并确认缺 actual 字段会失败关闭。
19
+ 3. 分别验证 model/effort 的 requested/actual 一致路径、单项与双项有理由 fallback 路径,并确认缺 actual 字段会失败关闭;对 package/build/contract 或 hook/profile 内容漂移确认只产生可操作 warning,并提示用户重建 sandbox。
20
20
  4. 对同一 commit 执行 candidate checkout 与 `npm pack` 安装验证,记录 tarball 哈希和结果。
21
21
  5. 仅把去敏摘要与非敏感 fixture 纳入版本库;token、绝对用户路径、transcript 内容和凭证必须删除或替换。
22
22
  6. sandbox backend 另做至少 10 次 executor 与 10 次 reviewer 冷启动,记录 prepared、spawn dispatch、SubagentStart、activation completed 的单调时钟及 p50/p95/max;仅当 max 加 20% 余量不超过 deadline,并通过 symlink/config/plugin/lease/context/build 失败注入和终态清理审计时启用。
@@ -48,6 +48,11 @@ const DEFAULTS = {
48
48
  "id": "opencode",
49
49
  "enabled": true,
50
50
  "installInSandbox": true
51
+ },
52
+ {
53
+ "id": "traecli",
54
+ "enabled": true,
55
+ "installInSandbox": true
51
56
  }
52
57
  ],
53
58
  "sandbox": {
@@ -189,6 +194,25 @@ const AGENT_CLIENT_MANIFEST = [
189
194
  },
190
195
  "argumentsToken": "$ARGUMENTS"
191
196
  }
197
+ },
198
+ {
199
+ "id": "traecli",
200
+ "displayName": "TraeCode CLI",
201
+ "invocation": "/${skillName}",
202
+ "ownedPathPrefixes": [
203
+ ".trae/"
204
+ ],
205
+ "managed": [
206
+ ".trae/skills/"
207
+ ],
208
+ "merged": [],
209
+ "ejected": [],
210
+ "customCommand": {
211
+ "target": ".trae/skills/${skillName}.md",
212
+ "frontmatter": {},
213
+ "includeUsage": true,
214
+ "inheritDisableModelInvocation": true
215
+ }
192
216
  }
193
217
  ];
194
218
  const CUSTOM_TUI_CONTRACT = {
@@ -31,7 +31,7 @@ For each failing check, decide "self-heal" vs "ask for help" in this order:
31
31
  - Before fixing, run `git status -s` to record the working tree and ensure only changes related to this failure are included.
32
32
  - Locate and make a minimal fix per the logs (touch only code / tests / config related to that failure).
33
33
  - Run the relevant tests: prefer the local command for the failing job; otherwise read the project `test` skill and select its declared core or full validation command. If neither command is known, ask for help. **Do not commit or push before tests pass.**
34
- - After tests pass, call `git-workflow commit` and `git-workflow push`, then verify the remote SHA.
34
+ - After tests pass, put the paths, message, expected HEAD, expected tree, and push policy (remote, full refs, automatic) into one intent JSON; call `git-workflow commit` once and verify the remote SHA. If the remote push fails, retry the same commit intent with empty `paths` through the push-only path.
35
35
  - Append the fix commit SHA to this run's `repairCommits`, increment the fix count, and return to SKILL step 2. When checks turn green, an empty list routes to `complete-task`; a non-empty list routes to `review-code`.
36
36
  - Never make unrelated "drive-by" optimizations; never loosen / skip the failing assertion to "make it green".
37
37
 
@@ -31,7 +31,7 @@ unknown: help
31
31
  - 自愈前先 `git status -s` 记录当前工作树,确保后续只纳入与本次失败相关的改动。
32
32
  - 在本地按日志定位并最小化修复(只动与该失败相关的代码 / 测试 / 配置)。
33
33
  - 运行对应测试:优先失败 job 对应的本地命令;否则读取项目 `test` skill,选择其中声明的 core 或 full 验证命令。两者均未知时进入求助出口。**测试通过前不得提交或推送。**
34
- - 测试通过后发布修复:把相关路径、message 与 expected HEAD 写入 intent JSON,调用 `git-workflow commit`,再调用 `git-workflow push` 并复核远端 SHA。
34
+ - 测试通过后发布修复:把相关路径、message、expected HEAD、expected tree 和 push policy(remote、完整 refs、automatic)写入同一个 intent JSON,调用一次 `git-workflow commit` 并复核远端 SHA;远端失败时使用相同 commit intent 的空 `paths` push-only 重试。
35
35
  - 将本次修复的 commit SHA 追加到当前运行的 `repairCommits`,修复计数 +1,回到 SKILL 步骤 2 重新监控;全绿时列表为空走 `complete-task`,非空走 `review-code`。
36
36
  - 绝不执行与失败无关的「顺手优化」;不放宽 / 跳过失败的断言来「修绿」。
37
37
 
@@ -18,7 +18,7 @@
18
18
  {
19
19
  "type": "command",
20
20
  "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event pre-tool",
21
- "timeout": 15,
21
+ "timeout": 30,
22
22
  "statusMessage": "Recording Codex lifecycle spawn evidence"
23
23
  }
24
24
  ]
@@ -31,7 +31,7 @@
31
31
  {
32
32
  "type": "command",
33
33
  "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event post-tool",
34
- "timeout": 15,
34
+ "timeout": 30,
35
35
  "statusMessage": "Recording Codex lifecycle tool completion"
36
36
  }
37
37
  ]
@@ -44,7 +44,7 @@
44
44
  {
45
45
  "type": "command",
46
46
  "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-start",
47
- "timeout": 15,
47
+ "timeout": 30,
48
48
  "statusMessage": "Recording Codex child identity"
49
49
  }
50
50
  ]
@@ -57,7 +57,7 @@
57
57
  {
58
58
  "type": "command",
59
59
  "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-stop",
60
- "timeout": 15,
60
+ "timeout": 30,
61
61
  "statusMessage": "Recording Codex child stop evidence"
62
62
  }
63
63
  ]
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "Update the project AI collaboration configuration"
3
+ disable-model-invocation: true
4
+ ---
5
+
6
+ Read and execute the update-agent-infra skill from `.agents/skills/update-agent-infra/SKILL.md`.
7
+
8
+ Follow all steps defined in the skill exactly, including rendering from `templates/` before applying managed or merged updates.