@hunter-harness/workflow-harness 0.2.23 → 0.2.24

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 (174) hide show
  1. package/harness/bundles/general/claude-code/.harness-build.json +1 -1
  2. package/harness/bundles/general/claude-code/README.md +2 -2
  3. package/harness/bundles/general/claude-code/agents/harness-evaluator.md +4 -4
  4. package/harness/bundles/general/claude-code/agents/harness-explorer.md +2 -2
  5. package/harness/bundles/general/claude-code/agents/harness-reviewer.md +2 -2
  6. package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
  7. package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
  8. package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  9. package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
  10. package/harness/bundles/general/claude-code/harness-plan/SKILL.md +7 -4
  11. package/harness/bundles/general/claude-code/harness-plan/checklist.md +12 -17
  12. package/harness/bundles/general/claude-code/harness-plan/reference.md +7 -19
  13. package/harness/bundles/general/claude-code/harness-review/SKILL.md +3 -3
  14. package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
  15. package/harness/bundles/general/claude-code/harness-run/protocols.md +3 -3
  16. package/harness/bundles/general/claude-code/harness-submit/SKILL.md +1 -1
  17. package/harness/bundles/general/claude-code/harness-submit/checklist.md +8 -2
  18. package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
  19. package/harness/bundles/general/claude-code/harness-test/SKILL.md +1 -1
  20. package/harness/bundles/general/claude-code/scripts/harness_deploy.py +22 -3
  21. package/harness/bundles/general/claude-code/scripts/harness_preflight.py +50 -29
  22. package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
  23. package/harness/bundles/general/codebuddy/README.md +2 -2
  24. package/harness/bundles/general/codebuddy/agents/harness-evaluator.md +5 -6
  25. package/harness/bundles/general/codebuddy/agents/harness-explorer.md +3 -3
  26. package/harness/bundles/general/codebuddy/agents/harness-reviewer.md +3 -5
  27. package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
  28. package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
  29. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  30. package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  31. package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +7 -4
  32. package/harness/bundles/general/codebuddy/harness-plan/checklist.md +12 -17
  33. package/harness/bundles/general/codebuddy/harness-plan/reference.md +7 -19
  34. package/harness/bundles/general/codebuddy/harness-review/SKILL.md +3 -3
  35. package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
  36. package/harness/bundles/general/codebuddy/harness-run/protocols.md +3 -3
  37. package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +1 -1
  38. package/harness/bundles/general/codebuddy/harness-submit/checklist.md +8 -2
  39. package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
  40. package/harness/bundles/general/codebuddy/harness-test/SKILL.md +1 -1
  41. package/harness/bundles/general/codebuddy/scripts/harness_deploy.py +22 -3
  42. package/harness/bundles/general/codebuddy/scripts/harness_preflight.py +50 -29
  43. package/harness/bundles/general/codex/.harness-build.json +1 -1
  44. package/harness/bundles/general/codex/README.md +2 -2
  45. package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
  46. package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
  47. package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
  48. package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
  49. package/harness/bundles/general/codex/harness-plan/SKILL.md +7 -5
  50. package/harness/bundles/general/codex/harness-plan/checklist.md +12 -17
  51. package/harness/bundles/general/codex/harness-plan/reference.md +7 -19
  52. package/harness/bundles/general/codex/harness-review/SKILL.md +2 -2
  53. package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
  54. package/harness/bundles/general/codex/harness-run/protocols.md +3 -3
  55. package/harness/bundles/general/codex/harness-submit/SKILL.md +1 -1
  56. package/harness/bundles/general/codex/harness-submit/checklist.md +8 -2
  57. package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
  58. package/harness/bundles/general/codex/harness-test/SKILL.md +1 -1
  59. package/harness/bundles/general/codex/scripts/harness_deploy.py +22 -3
  60. package/harness/bundles/general/codex/scripts/harness_preflight.py +50 -29
  61. package/harness/bundles/general/cursor/.harness-build.json +1 -1
  62. package/harness/bundles/general/cursor/README.md +2 -2
  63. package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
  64. package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
  65. package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  66. package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
  67. package/harness/bundles/general/cursor/harness-plan/SKILL.md +7 -5
  68. package/harness/bundles/general/cursor/harness-plan/checklist.md +12 -17
  69. package/harness/bundles/general/cursor/harness-plan/reference.md +7 -19
  70. package/harness/bundles/general/cursor/harness-review/SKILL.md +2 -2
  71. package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
  72. package/harness/bundles/general/cursor/harness-run/protocols.md +3 -3
  73. package/harness/bundles/general/cursor/harness-submit/SKILL.md +1 -1
  74. package/harness/bundles/general/cursor/harness-submit/checklist.md +8 -2
  75. package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
  76. package/harness/bundles/general/cursor/harness-test/SKILL.md +1 -1
  77. package/harness/bundles/general/cursor/scripts/harness_deploy.py +22 -3
  78. package/harness/bundles/general/cursor/scripts/harness_preflight.py +50 -29
  79. package/harness/bundles/java/claude-code/.harness-build.json +1 -1
  80. package/harness/bundles/java/claude-code/README.md +2 -2
  81. package/harness/bundles/java/claude-code/agents/harness-evaluator.md +4 -4
  82. package/harness/bundles/java/claude-code/agents/harness-explorer.md +2 -2
  83. package/harness/bundles/java/claude-code/agents/harness-reviewer.md +2 -2
  84. package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
  85. package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
  86. package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
  87. package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  88. package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
  89. package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
  90. package/harness/bundles/java/claude-code/harness-plan/SKILL.md +7 -4
  91. package/harness/bundles/java/claude-code/harness-plan/checklist.md +12 -17
  92. package/harness/bundles/java/claude-code/harness-plan/reference.md +7 -19
  93. package/harness/bundles/java/claude-code/harness-review/SKILL.md +3 -3
  94. package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
  95. package/harness/bundles/java/claude-code/harness-run/protocols.md +3 -3
  96. package/harness/bundles/java/claude-code/harness-submit/SKILL.md +1 -1
  97. package/harness/bundles/java/claude-code/harness-submit/checklist.md +8 -2
  98. package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
  99. package/harness/bundles/java/claude-code/harness-test/SKILL.md +1 -1
  100. package/harness/bundles/java/claude-code/scripts/harness_deploy.py +22 -3
  101. package/harness/bundles/java/claude-code/scripts/harness_preflight.py +50 -29
  102. package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
  103. package/harness/bundles/java/codebuddy/README.md +2 -2
  104. package/harness/bundles/java/codebuddy/agents/harness-evaluator.md +5 -6
  105. package/harness/bundles/java/codebuddy/agents/harness-explorer.md +3 -3
  106. package/harness/bundles/java/codebuddy/agents/harness-reviewer.md +3 -5
  107. package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
  108. package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
  109. package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
  110. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  111. package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  112. package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
  113. package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +7 -4
  114. package/harness/bundles/java/codebuddy/harness-plan/checklist.md +12 -17
  115. package/harness/bundles/java/codebuddy/harness-plan/reference.md +7 -19
  116. package/harness/bundles/java/codebuddy/harness-review/SKILL.md +3 -3
  117. package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
  118. package/harness/bundles/java/codebuddy/harness-run/protocols.md +3 -3
  119. package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +1 -1
  120. package/harness/bundles/java/codebuddy/harness-submit/checklist.md +8 -2
  121. package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
  122. package/harness/bundles/java/codebuddy/harness-test/SKILL.md +1 -1
  123. package/harness/bundles/java/codebuddy/scripts/harness_deploy.py +22 -3
  124. package/harness/bundles/java/codebuddy/scripts/harness_preflight.py +50 -29
  125. package/harness/bundles/java/codex/.harness-build.json +1 -1
  126. package/harness/bundles/java/codex/README.md +2 -2
  127. package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
  128. package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
  129. package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
  130. package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
  131. package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
  132. package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
  133. package/harness/bundles/java/codex/harness-plan/SKILL.md +7 -5
  134. package/harness/bundles/java/codex/harness-plan/checklist.md +12 -17
  135. package/harness/bundles/java/codex/harness-plan/reference.md +7 -19
  136. package/harness/bundles/java/codex/harness-review/SKILL.md +2 -2
  137. package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
  138. package/harness/bundles/java/codex/harness-run/protocols.md +3 -3
  139. package/harness/bundles/java/codex/harness-submit/SKILL.md +1 -1
  140. package/harness/bundles/java/codex/harness-submit/checklist.md +8 -2
  141. package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
  142. package/harness/bundles/java/codex/harness-test/SKILL.md +1 -1
  143. package/harness/bundles/java/codex/scripts/harness_deploy.py +22 -3
  144. package/harness/bundles/java/codex/scripts/harness_preflight.py +50 -29
  145. package/harness/bundles/java/cursor/.harness-build.json +1 -1
  146. package/harness/bundles/java/cursor/README.md +2 -2
  147. package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
  148. package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
  149. package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
  150. package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  151. package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
  152. package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
  153. package/harness/bundles/java/cursor/harness-plan/SKILL.md +7 -5
  154. package/harness/bundles/java/cursor/harness-plan/checklist.md +12 -17
  155. package/harness/bundles/java/cursor/harness-plan/reference.md +7 -19
  156. package/harness/bundles/java/cursor/harness-review/SKILL.md +2 -2
  157. package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
  158. package/harness/bundles/java/cursor/harness-run/protocols.md +3 -3
  159. package/harness/bundles/java/cursor/harness-submit/SKILL.md +1 -1
  160. package/harness/bundles/java/cursor/harness-submit/checklist.md +8 -2
  161. package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
  162. package/harness/bundles/java/cursor/harness-test/SKILL.md +1 -1
  163. package/harness/bundles/java/cursor/scripts/harness_deploy.py +22 -3
  164. package/harness/bundles/java/cursor/scripts/harness_preflight.py +50 -29
  165. package/harness/manifests/general/claude-code.json +22 -22
  166. package/harness/manifests/general/codebuddy.json +22 -22
  167. package/harness/manifests/general/codex.json +19 -19
  168. package/harness/manifests/general/cursor.json +19 -19
  169. package/harness/manifests/java/claude-code.json +24 -24
  170. package/harness/manifests/java/codebuddy.json +24 -24
  171. package/harness/manifests/java/codex.json +21 -21
  172. package/harness/manifests/java/cursor.json +21 -21
  173. package/hunter-workflow-family.json +2 -2
  174. package/package.json +1 -1
@@ -2,5 +2,5 @@
2
2
  "schemaVersion": 1,
3
3
  "overlay": "none",
4
4
  "agent": "claude-code",
5
- "coreHash": "15e7aa9003de59d7"
5
+ "coreHash": "8fdeda6094f4f0a5"
6
6
  }
@@ -260,7 +260,7 @@ harness-skills/
260
260
  | 阶段 | 强制检查 |
261
261
  |------|---------|
262
262
  | **plan 阶段 0** | 检查工作区是否有未提交业务代码变更,已有则询问用户处理方式(继续/暂存/回滚/取消),不得假装"编码前规划" |
263
- | **plan 阶段 3** | 委派前 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-explorer --json`;`usable=false` 或无效返回 → 主会话只读探索,不 retry |
263
+ | **plan 阶段 3** | 默认主会话 CodeGraph/Read inline 探索;仅高复杂度且准备委派固定 agent 时单次预检,失败或无效返回立即 inline,不 retry |
264
264
  | **plan 阶段 4/6** | 原生规划协议必须记录风险/复用/替代方案/推荐方案/关键决策,以及任务拆分摘要 |
265
265
  | **plan 阶段 5** | 设计文档自审结果必须展示给用户;测试场景表未覆盖维度必须标记为 ⚠️ 缺口,不得全部 ✅ |
266
266
  | **run 步骤 0** | 任何代码修改前必须先向 `events.ndjson` 追加 `phase.start`;执行日志由阶段结束事件自动渲染 |
@@ -401,7 +401,7 @@ powershell.exe -Command "Copy-Item -Path 'harness-skills/harness-*' -Destination
401
401
  powershell.exe -Command "Copy-Item -Path 'harness-skills/harness-test' -Destination '<目标项目>/.claude/skills/' -Recurse -Force"
402
402
  ```
403
403
 
404
- 同时复制 agents 到目标项目的 `.claude/agents/`(共 3 个:`harness-explorer` harness-plan 预检后委派;`harness-evaluator` 仅 `--adversarial` 时 opt-in;`harness-reviewer` harness-review 预检后委派):
404
+ Claude Code/CodeBuddy 可选复制 3 个隔离角色:`harness-explorer` 仅高复杂度探索、`harness-evaluator` 仅 `--adversarial`/高风险规划、`harness-reviewer` 仅发布候选/高风险审查。Codex/Cursor 默认使用主会话或宿主临时隔离任务,不安装固定角色,也不执行固定 agent 预检:
405
405
 
406
406
  ```powershell
407
407
  powershell.exe -Command "Copy-Item -Path 'harness-skills/agents/*.md' -Destination '<目标项目>/.claude/agents/' -Recurse -Force"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: harness-evaluator
3
- description: "计划对抗评审执行者:对设计文档+实施计划+测试场景表做只读对抗评审,挑刺方案可行性/依赖顺序/遗漏风险/范围蔓延/测试覆盖缺口,default 模式 + tools 白名单只读,返回 VERDICT(APPROVED/REVISE)+结构化问题清单。由 harness-plan 阶段7.5通过 context:fork 委派。"
3
+ description: "高风险/显式 adversarial 计划对抗评审执行者:对设计文档+实施计划+测试场景表做只读隔离评审,返回 VERDICT(APPROVED/REVISE)+结构化问题清单。"
4
4
  model: haiku
5
5
  effort: medium
6
6
  permissionMode: default
@@ -43,11 +43,11 @@ tools: [Read, Glob, Grep]
43
43
  - **不阻塞**:评审为参考性,报告不得写"阻塞 submit / 必须修复",应写"建议优先处理 / 仅供参考,由用户决定是否修订"
44
44
  - **敏感信息脱敏**:发现计划中明文 token/密码/密钥列入 RED,以 `<TOKEN_REDACTED>` 等占位符引用
45
45
 
46
- ## ⚠️ 同 provider 局限(诚实标注)
46
+ ## ⚠️ 同宿主局限(诚实标注)
47
47
 
48
- 你是 Claude 子代理,与主会话**同 provider**。本评审基于"上下文隔离 + 档位差异(haiku vs 主会话模型)",**非真正跨 provider 对抗**——回音壁风险仍在,对结构性盲点保持谦逊:
48
+ 你通常与主会话处于同一宿主或模型家族。本评审的价值来自上下文隔离,**不等同于跨 provider 对抗**——回音壁风险仍在,对结构性盲点保持谦逊:
49
49
  - 不确定的问题标 `TODO(不确定)` 而非强行下结论
50
- - 如发现"可能需要跨 provider 二次确认"的高风险点,在报告中提示主会话"建议升级为 Codex 跨 provider 评审"(见 harness-plan/reference.md "C2 升级口"),但你自身不调 Codex CLI
50
+ - 如发现可能需要跨 provider 二次确认的高风险点,只提示主会话走显式 C2 升级口;你自身不启动外部 CLI
51
51
 
52
52
  ## 输出格式
53
53
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: harness-explorer
3
- description: "代码只读研究:harness-codebase-map 情报 + CodeGraph MCP 调用链 + 现有代码阅读。由 harness-plan skill 在阶段3(代码探索)委派,default 模式 + tools 白名单确保只读,返回结构化设计概要。"
3
+ description: "高复杂度代码只读研究:harness-codebase-map 情报 + CodeGraph MCP 调用链 + 现有代码阅读。仅在 harness-plan 判定隔离探索有明确收益时委派,default 模式 + tools 白名单确保只读,返回结构化设计概要。"
4
4
  model: haiku
5
5
  effort: low
6
6
  permissionMode: default
@@ -28,7 +28,7 @@ disallowedTools:
28
28
 
29
29
  # harness-explorer — 代码探索 Subagent
30
30
 
31
- 你是一个专门执行代码只读研究的子代理。由 harness-plan skill 在阶段 3(代码探索)委派,使用 default 模式 + tools 白名单确保只读。
31
+ 你是一个专门执行高复杂度代码只读研究的子代理。仅在 harness-plan 判断多个独立模块、陌生大型代码库或并行调查确有隔离收益时委派,使用 default 模式 + tools 白名单确保只读。
32
32
 
33
33
  ## 你的职责
34
34
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: harness-reviewer
3
- description: "6维度代码审查执行者:对 git diff 进行架构/安全/规范/兼容/测试/性能审查,对照项目规则(见 .harness/context-index.json)和测试场景表,default 模式 + tools 白名单只读,返回分级审查报告(RED/YELLOW/OK)。由 harness-review skill 通过 Agent 工具 spawn(subagent_type: harness-reviewer)委派。"
3
+ description: "高风险6维度代码审查执行者:对发布候选或高风险 git diff 进行架构/安全/规范/兼容/测试/性能隔离审查,对照项目规则和测试场景表,返回分级报告(RED/YELLOW/OK)。"
4
4
  model: sonnet
5
5
  effort: high
6
6
  permissionMode: default
@@ -28,7 +28,7 @@ disallowedTools:
28
28
 
29
29
  # harness-reviewer — 6维度代码审查 Subagent
30
30
 
31
- 你是一个专门执行代码审查的子代理。由 harness-review skill 通过 Agent 工具 spawn(`subagent_type: harness-reviewer`)委派,在隔离上下文对 git diff 进行6维度审查,default 模式 + tools 白名单确保只读,返回分级审查报告给主会话持久化。
31
+ 你是一个专门执行发布候选或高风险代码审查的子代理。由 harness-review 在风险门槛命中且宿主支持固定 agent 时委派,在隔离上下文对 git diff 进行6维度审查,default 模式 + tools 白名单确保只读,返回分级审查报告给主会话持久化。
32
32
 
33
33
  ## 你的职责
34
34
 
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-archive — 变更归档
25
25
 
26
26
  ## Purpose
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-codebase-map — 代码库地图
25
25
 
26
26
  ## Purpose
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-knowledge-ingest
25
25
 
26
26
  从 `.harness/archive/**/reports/final/summary-data.json` 抽取项目知识,生成并维护本地 `.harness/knowledge/` 索引。
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-knowledge-query
25
25
 
26
26
  并行 change 中查询必须传 `--change <change-id>`;成功后以该 change 的 `meta/knowledge-context.json` 为稳定指针。全局 `context-packs/latest.json` 仅向后兼容,不得用于判断多个 active change 的上下文归属。
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-plan — 需求规划
25
25
 
26
26
  ## Purpose
@@ -69,10 +69,13 @@ disallowed-tools:
69
69
 
70
70
  内化为 `protocols.md`:`clarification-protocol`、`decision-grilling-protocol`、`implementation-planning-protocol`。不运行时调用 Superpowers/grill-me。
71
71
 
72
- ## Subagent 委派
72
+ <!-- @section-id plan.delegate -->
73
+ ## 执行路由(inline 优先)
73
74
 
74
- - **阶段 3 探索**:先运行 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-explorer --json`;可用则委派,否则主会话探索且不 retry。`reasonCode=CUSTOM_AGENTS_UNSUPPORTED` 表示当前工具本身没有自定义 agent 能力,是正常的 inline 路径,控制台不得显示“harness-explorer subagent 不可用”类告警。
75
- - **阶段 7.5**:仅 `--adversarial`;先运行 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-evaluator --json`;可用才委派到 `reports/plan-review/`
75
+ - **阶段 3 探索默认 inline**:主会话直接使用 CodeGraph/Read,简单修复和常规跨文件变更不得为“隔离上下文”额外启动 agent
76
+ - **仅高复杂度探索考虑委派**:涉及多个独立模块、陌生大型代码库或可并行的独立调查时,才执行一次 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-explorer --json`。只有 `executionMode=delegated` 才委派;`executionMode=inline` 是正常路径,静默继续;`unavailable` 只记录安装问题后 inline。
77
+ - **阶段 7.5 evaluator**:仅 `--adversarial` 或 auth/支付/迁移/并发等高风险规划启用;需要固定 agent 时才预检。无论预检 inline、spawn 失败、空返回或只有元数据,都立即由主会话完成同一对抗检查,`fallbackPolicy=inline-no-retry`。
78
+ - 日志记录 `executionMode=inline|delegated`;只有真实定义损坏或 spawn 失败才记 issue。正常 inline 不得显示“subagent 不可用”告警。
76
79
 
77
80
  ## Workflow 概要
78
81
 
@@ -37,21 +37,16 @@ description: harness-plan 的阶段检查清单和覆盖检查列表。仅在执
37
37
  阶段 3 执行完成后,确认以下事项:
38
38
 
39
39
  ```
40
- 是通过 Agent 工具委派 subagent 执行的(不是主会话直接调用 codegraph)
41
- subagent 返回了结构化设计概要(涉及模块、接口变更、关键决策)
42
- 委派前已运行 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-explorer --json`
43
- □ `usable=false` 或未返回有效输出 → 主会话探索,**不 retry 委派**
44
- 主会话未被代码探索的中间结果污染
45
- 在执行日志中记录了 Agent 调用状态:
46
- - 是否成功调用
47
- - 使用的 agent 名称
48
- - 是否只读
49
- - 子代理实际 tool uses 计数
50
- - 返回的核心结论
40
+ 已按复杂度选择 `executionMode=inline|delegated`;默认 inline
41
+ inline 时主会话直接使用 CodeGraph/Read,并返回结构化设计概要
42
+ 仅高复杂度且准备委派固定 agent 时,才运行一次 `check-agents --agent harness-explorer`
43
+ 只有预检 `executionMode=delegated` 才委派;`inline` 静默继续,不显示不可用告警
44
+ spawn 失败、空返回、0 tool uses、仅 "Done"/元数据 → 主会话探索,**不 retry 委派**
45
+ 执行日志记录 executionMode、委派原因(如有)、只读约束和核心结论
51
46
  ```
52
47
 
53
- > 如果 Agent 工具不可用,或子代理被委派但未返回有效输出(0 tool uses / 空返回 / 仅 "Done"),必须显式降级并记录:
54
- > - 追加 `issue` 事件并在 note 写明降级原因:Agent 不可用 / 子代理未返回有效输出,改为主会话只读探索
48
+ > 正常 inline 只记 `decision`,不是降级或故障。如果已尝试委派但未返回有效输出(0 tool uses / 空返回 / 仅 "Done"),必须:
49
+ > - 追加一次 `issue` 事件并在 note 写明:子代理未返回有效输出,改为主会话只读探索
55
50
  > - 主会话直接使用 codegraph MCP 工具(`mcp__codegraph__codegraph_explore`)和 Read 探索代码(只读,不执行写操作)
56
51
  > - 不得在主会话中执行任何写操作
57
52
  > - CodeGraph 如通过 MCP 调用,必须优先用 MCP 工具,不允许通过普通 Bash 调 codegraph 命令
@@ -156,10 +151,10 @@ source: harness-plan
156
151
  ```
157
152
  □ 已用 **设计审批包** 一次 blocking user confirmation(设计 + 场景表摘要 + worktree + change-name)
158
153
  □ **未**单独询问 worktree 或对抗评审(对抗评审仅 `--adversarial`)
159
- 用户同意后,已用 Agent 工具委派 harness-evaluator(haiku, context:fork, plan 模式只读, maxTurns:8)
160
- 已用 context:fork 隔离上下文(evaluator 未参与规划,破除确认偏误)
161
- 已校验子代理 tool uses > 0(0/空/Done 视为未返回有效输出,已降级为主会话自审并记录)
162
- evaluator 返回了 VERDICT(APPROVED/REVISE) + 结构化问题清单(RED/YELLOW)
154
+ 已按宿主能力选择隔离 evaluator 或主会话对抗自审;正常 inline 不记故障
155
+ 若委派,已使用隔离上下文且校验 tool uses > 0
156
+ 若委派返回 0/空/Done/元数据,已立即 inline 自审且未 retry
157
+ 已产出 VERDICT(APPROVED/REVISE) + 结构化问题清单(RED/YELLOW)
163
158
  □ 评审报告已写入 .harness/changes/<change-name>/reports/plan-review/plan-review-YYYYMMDD-HHmm.md
164
159
  □ VERDICT 和问题清单已展示给用户(不得仅记"已评审")
165
160
  □ REVISE 时已询问用户是否修订;修订后可选再审
@@ -345,25 +345,13 @@ status: approved
345
345
  - 最终输出只提示产出物路径和下一步 `/harness-run`
346
346
  - `docs/superpowers/` 不得作为最终产物路径出现在输出中
347
347
 
348
- ## C2 升级口:Codex provider 评审(可选,未实现)
348
+ ## C2 升级口:跨 provider 评审(显式、非默认)
349
349
 
350
- 阶段 7.5 harness-evaluator 是同 provider(Claude)评审,基于"上下文隔离 + 档位差异"。如需真正跨 provider 对抗(高风险构建:auth/支付/数据迁移/并发),可在 evaluator 返回 REVISE 后,可选调 Codex CLI 做二次确认。
350
+ 阶段 7.5 默认只做主会话对抗自审或宿主原生隔离任务,不自动启动第二个 CLI/provider。高风险构建确需跨 provider 二次确认时,由用户显式要求并提供可用宿主能力;该升级不属于正常 harness-plan 路径,也不得因外部工具不可用而 retry。
351
351
 
352
- ### 前置
353
- - Codex CLI ≥ 0.130:`npm install -g @openai/codex@latest`(现 0.142.3)
354
- - Codex 已登录:`codex login`(ChatGPT 账号即可)
355
- - Windows + bridge 环境未实测,TODO(review)
352
+ ### 安全线
356
353
 
357
- ### 执行(示例)
358
- ```powershell
359
- powershell.exe -NoProfile -Command "codex exec -s read-only '$(Get-Content .harness/changes/<cn>/spec/<cn>-design.md -Raw)'"
360
- ```
361
-
362
- ### 安全线 ⚠️
363
- - 首次 `codex exec -s read-only` 强制只读沙箱
364
- - resume 必须加 `-c sandbox_mode="read-only"`(`resume` 不接受 `-s`,漏写会继承 config 默认,可能 `danger-full-access`)——这是最关键安全线
365
- - Codex 全程只读,从不写文件
366
- - 不 pin `-m` 模型(ChatGPT 账号鉴权会拒 `gpt-5.x-codex` 变体并 400 报错)
367
-
368
- ### 状态
369
- 本节为**升级口**,当前 harness-plan 阶段 7.5 默认走 harness-evaluator(C1),不自动触发 Codex。需手动启用,且建议先验证 Codex CLI 在当前环境可用。详见 grill-me 文档的 grill-me-codex Act 2(技术知识库/02-Skills与扩展/Skills合集/grill-me.md)。
354
+ - 外部评审必须只读,输入只包含已脱敏的设计/计划/场景表
355
+ - 不继承未确认的生产凭证、写权限或危险沙箱设置
356
+ - 一次失败即返回主会话,不自动安装 CLI、不自动登录、不循环 resume
357
+ - 报告必须标注 provider、执行模式和证据边界
@@ -21,7 +21,7 @@ disallowed-tools:
21
21
  - Bash(curl *)
22
22
  - Bash(codegraph *)
23
23
  ---
24
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
24
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
25
25
  # harness-review — 代码审查
26
26
 
27
27
  ## Purpose
@@ -69,9 +69,9 @@ disallowed-tools:
69
69
  0. **启动准备** — 确定变更名(Glob `.harness/changes/*/plans/*-plan.md`,排除 `.harness/archive/*/`,读 frontmatter 提取 change-name);**append `phase.start` 事件**(不得等审查完成才补)
70
70
  1. **读取 worktree 状态(门禁检查)** — 读 `.harness/changes/<change-name>/meta/worktree.json`:`requested=true` 但 worktree 不存在 → 停止并提示先修复 `harness-run`,不得静默回主目录(否则 git diff 为空);`requested=true` 且 worktree 已创建 → spawned agent 用该 worktree 路径执行 `git diff`(确保审查 worktree 变更而非主目录);`requested=false` → 审查主目录变更
71
71
  <!-- @section-id review.delegate -->
72
- ### 2. 委派 harness-reviewer
72
+ ### 2. 审查执行(风险分级、inline 优先)
73
73
 
74
- 先运行 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-reviewer --json`。`usable=false` → **直接主会话审查**,记 `decision` 事件,**不委派**。`reasonCode=CUSTOM_AGENTS_UNSUPPORTED` 是当前工具没有自定义 agent 能力的正常 inline 路径,不显示缺失告警。`usable=true` 时用 Agent spawn `harness-reviewer`(只读, 6 维度)。返回空 / 无报告正文 → **不 retry**,降级主会话审查。
74
+ 默认由主会话按同一 6 维度检查清单审查。仅发布候选,或变更命中权限/安全、支付、数据迁移、并发幂等、公共契约、跨模块核心路径时,才考虑隔离 reviewer;需要固定 `harness-reviewer` 时执行一次 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-reviewer --json`。只有 `executionMode=delegated` 才委派;`executionMode=inline` 静默由主会话审查,不显示缺失告警。定义损坏、spawn 失败、空返回或只有元数据 记录一次 issue 后直接主会话审查,`fallbackPolicy=inline-no-retry`。
75
75
 
76
76
  3. **持久化报告与事实 sidecar(强制,主会话)** — Agent 返回后主会话 Write 到 `reports/review/review-report-*.md`,并把同一批发现写成临时 JSON 后调用 `python <skills-root>/scripts/harness_review.py write-findings --change-dir <change-dir> --input <findings.json>`。权威计数来自 `reports/review/review-findings.json`,不是 Markdown。任一写入缺失 → 🟡WARN,不得宣称 review 完成。
77
77
  4. **生成修复反馈(原生协议)** — 若报告存在 RED/YELLOW 问题,执行 `protocols.md` 的 `review-fixback-protocol`,将问题转化为结构化 fixback 清单并落盘到 `.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md`;随后把 disposition 临时 JSON 交给 `python <skills-root>/scripts/harness_review.py write-dispositions --change-dir <change-dir> --input <dispositions.json>`,权威状态写入 `reports/review/fixback-dispositions.json`。若无 RED/YELLOW,也必须写空 findings sidecar,并记录 `review-fixback-protocol: skipped(no findings)`。不调用 Superpowers `receiving-code-review`,也不记录外部 skill 降级。
@@ -21,7 +21,7 @@ disallowed-tools:
21
21
  - Bash(curl *)
22
22
  - Bash(codegraph *)
23
23
  ---
24
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
24
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
25
25
  # harness-run — 需求编码
26
26
 
27
27
  ## Purpose
@@ -49,13 +49,13 @@ REFACTOR 只允许不改变行为的整理。若重构改变行为,必须回
49
49
  满足**全部**条件时启用:
50
50
 
51
51
  - 变更簇命中高风险(数据迁移、权限、安全、并发、幂等、核心契约变更、缺真实测试证据等,见原触发列表任一)
52
- - `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-reviewer --json` 返回 `usable=true`
52
+ - 当前宿主已显式提供隔离 reviewer 能力;需要固定 reviewer 时,单次 `check-agents` 返回 `executionMode=delegated`
53
53
 
54
- 未满足时记录“跳过变更簇审查:低风险 / reviewer 不可用 / 后续 harness-review 覆盖”,不得视为降级。
54
+ 未满足时记录“跳过变更簇隔离审查:低风险 / 正常 inline / 后续 harness-review 覆盖”,不得视为降级或显示不可用告警。
55
55
 
56
56
  ### 审查方式
57
57
 
58
- `usable=true` 时委派只读 `harness-reviewer` 审查当前变更簇 diff。**不 retry**;无效返回 → 主会话 checklist 自审,记 `decision` 事件。
58
+ `executionMode=delegated` 时委派只读 `harness-reviewer` 审查当前变更簇 diff。**不 retry**;spawn 失败或无效返回 → 主会话 checklist 自审,记一次 `issue` 事件。
59
59
 
60
60
  审查范围只限当前变更簇:
61
61
 
@@ -20,7 +20,7 @@ disallowed-tools:
20
20
  - Bash(awk *)
21
21
  - Bash(curl *)
22
22
  ---
23
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
23
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
24
24
  # harness-submit — 最终提交(含 worktree 合并)
25
25
 
26
26
  ## Purpose
@@ -367,7 +367,13 @@ python harness/scripts/harness_integration.py verify --change <change-name> --ru
367
367
 
368
368
  任一命令非零退出 → step FAILED,不进入 push。
369
369
 
370
- **写 check-ok marker**(npm run check exit 0 后强制):
370
+ **产品候选证据门槛**:
371
+
372
+ - 项目存在远端 CI:本地 push 只运行有界静态门槛,push 后必须取得当前候选 commit 的 CI 绿灯,才能归档或发布。
373
+ - 项目没有远端 CI:在候选 commit 对应的同一棵 tree 上完整执行 resolved check;成功后写本地候选收据。收据必须同时匹配时间、命令和 tree hash,不接受口头声明或旧提交结果。
374
+ - 不得在 pre-push 中无条件重复全量测试;失败后不自动重跑,先报告失败阶段与残留进程。
375
+
376
+ **写 check-ok marker**(`npm run check` exit 0 后强制;无 CI 项目以此作为产品候选绿灯证据):
371
377
 
372
378
  ```powershell
373
379
  node scripts/check-gate.mjs --write
@@ -375,7 +381,7 @@ node scripts/check-gate.mjs --write
375
381
 
376
382
  ### 步骤 M5:push
377
383
 
378
- **硬门槛(eslint × feature worktree)**:integration / 主仓 `pre-push` `npm run check` 时,eslint 不得把 sibling `.worktrees/<change>/` 当成第二工程根(双 `tsconfigRootDir`)。本仓以 `eslint.config.mjs` 的 `.worktrees/**` ignore 为准;若自定义 eslint 未 ignore,须先 `move_agent_to_root(<projectRoot>)` 再清 feature worktree,再 push。
384
+ **硬门槛(eslint × feature worktree)**:integration / 主仓 `pre-push` 跑有界 `check:push` 时,eslint 不得把 sibling `.worktrees/<change>/` 当成第二工程根(双 `tsconfigRootDir`)。本仓以 `eslint.config.mjs` 的 `.worktrees/**` ignore 为准;若自定义 eslint 未 ignore,须先 `move_agent_to_root(<projectRoot>)` 再清 feature worktree,再 push。
379
385
 
380
386
  ```powershell
381
387
  python harness/scripts/harness_integration.py push --change <change-name> --run-id <run-id> --feature-branch harness/<change-name> --target-branch <主分支> --temp-root <task-temp>
@@ -19,7 +19,7 @@ disallowed-tools:
19
19
  - Bash(awk *)
20
20
  - Bash(curl *)
21
21
  ---
22
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
22
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
23
23
  # harness-sync — 元数据同步
24
24
 
25
25
  ## Purpose
@@ -22,7 +22,7 @@ disallowed-tools:
22
22
  - Bash(node *)
23
23
  - Bash(codegraph *)
24
24
  ---
25
- <!-- generated by harness_deploy.py; core=15e7aa9003de59d7; overlay=none; agent=claude-code; do not edit -->
25
+ <!-- generated by harness_deploy.py; core=8fdeda6094f4f0a5; overlay=none; agent=claude-code; do not edit -->
26
26
  # harness-test — 测试执行
27
27
 
28
28
  ## Purpose
@@ -16,6 +16,7 @@ import re
16
16
  import shutil
17
17
  import subprocess
18
18
  import sys
19
+ import time
19
20
  import uuid
20
21
  from pathlib import Path
21
22
  from typing import Any, Iterable
@@ -38,6 +39,7 @@ HEADING_RE = re.compile(r"^(#{2,6})\s+(.+?)\s*$")
38
39
  FRAGMENT_HINT_RE = re.compile(r"^>\s*片段:\[\[shared/[^\]]+\]\]\s*.*$")
39
40
 
40
41
  BUILD_MARKER = ".harness-build.json"
42
+ _REPLACE_RETRY_DELAYS_SECONDS = (0.05, 0.1, 0.2, 0.4, 0.8)
41
43
  # Install-side managed manifests record which files a prior install owned, so a
42
44
  # later conservative install can delete removed managed files while preserving
43
45
  # user-owned files (design §3.8 要点4). Skills manifest lives in the skills
@@ -76,6 +78,23 @@ def now_iso() -> str:
76
78
  return dt.datetime.now().astimezone().isoformat(timespec="seconds")
77
79
 
78
80
 
81
+ def replace_with_retry(source: Path, target: Path) -> None:
82
+ """Bounded retry for transient directory locks during atomic swaps.
83
+
84
+ Windows indexers and antivirus scanners may briefly hold a newly generated
85
+ bundle directory. Retrying only ``PermissionError`` keeps real path and
86
+ contract failures fail-fast while avoiding an expensive full bundle rerun.
87
+ """
88
+ for attempt in range(len(_REPLACE_RETRY_DELAYS_SECONDS) + 1):
89
+ try:
90
+ os.replace(source, target)
91
+ return
92
+ except PermissionError:
93
+ if attempt >= len(_REPLACE_RETRY_DELAYS_SECONDS):
94
+ raise
95
+ time.sleep(_REPLACE_RETRY_DELAYS_SECONDS[attempt])
96
+
97
+
79
98
  def emit_json(payload: dict[str, Any], *, ok: bool = True) -> int:
80
99
  print(json.dumps(payload, ensure_ascii=False, indent=2))
81
100
  return 0 if ok else 1
@@ -596,15 +615,15 @@ def cmd_build(
596
615
  if out_dir.exists():
597
616
  if (out_dir / BUILD_MARKER).is_file():
598
617
  old_backup = out_dir.parent / f".{out_dir.name}.old-{uuid.uuid4().hex[:8]}"
599
- os.replace(out_dir, old_backup)
618
+ replace_with_retry(out_dir, old_backup)
600
619
  else:
601
620
  shutil.rmtree(staging, ignore_errors=True)
602
621
  raise ValueError(f"refusing to overwrite unmarked out_dir: {out_dir}")
603
622
  try:
604
- os.replace(staging, out_dir)
623
+ replace_with_retry(staging, out_dir)
605
624
  except OSError:
606
625
  if old_backup is not None and old_backup.exists():
607
- os.replace(old_backup, out_dir)
626
+ replace_with_retry(old_backup, out_dir)
608
627
  raise
609
628
  if old_backup is not None:
610
629
  shutil.rmtree(old_backup, ignore_errors=True)
@@ -374,12 +374,14 @@ def _resolve_agents_root(skills_root: Path, agents_root: Path | None) -> tuple[P
374
374
  return (skills_root / "agents").resolve(), None
375
375
 
376
376
 
377
- def _read_host_capabilities(skills_root: Path) -> set[str]:
377
+ def _read_host_capabilities(skills_root: Path) -> tuple[set[str], bool]:
378
378
  """Read agent capabilities declared by the host adapter (retro §5.3).
379
379
 
380
380
  Adapter installs may declare available agent roles in
381
381
  `meta/runtime.json` under `agentCapabilities` (list of role names).
382
- Returns an empty set if the file or field is absent.
382
+ Returns ``(capabilities, manifest_present)``. ``manifest_present`` is true
383
+ only when a readable capability list exists; an unrelated runtime.json
384
+ must not turn an unknown host into a hard "agent missing" failure.
383
385
  """
384
386
  # runtime.json lives in the change's meta/ dir, but agent capabilities are
385
387
  # project-level. Check the adapter's runtime.json at the project root.
@@ -398,8 +400,8 @@ def _read_host_capabilities(skills_root: Path) -> set[str]:
398
400
  continue
399
401
  caps = data.get("agentCapabilities")
400
402
  if isinstance(caps, list):
401
- return {str(c) for c in caps if isinstance(c, str)}
402
- return set()
403
+ return {str(c) for c in caps if isinstance(c, str)}, True
404
+ return set(), False
403
405
 
404
406
 
405
407
  def cmd_check_agents(
@@ -420,7 +422,7 @@ def cmd_check_agents(
420
422
  }
421
423
 
422
424
  resolved_agents_root, _ = _resolve_agents_root(skills_root, agents_root)
423
- host_capabilities = _read_host_capabilities(skills_root)
425
+ host_capabilities, capability_manifest_present = _read_host_capabilities(skills_root)
424
426
  host_callable = agent_name in host_capabilities
425
427
 
426
428
  # Three independent fields (retro §5.3):
@@ -437,32 +439,37 @@ def cmd_check_agents(
437
439
  agent_path = resolved_agents_root / filename
438
440
  definition_present = agent_path.is_file()
439
441
 
440
- # If no local definition and host doesn't declare the role, we can't
441
- # determine usability. Distinguish "host says no" from "unknown".
442
+ # Codex/Cursor bundles intentionally do not install fixed harness-* agent
443
+ # definitions. Missing host capabilities therefore select the normal
444
+ # inline path instead of reporting UNKNOWN/"subagent unavailable".
442
445
  if not definition_present and not host_callable:
443
- # Check if this adapter is known to not support custom agents
444
446
  adapter_name = skills_root.parent.name
445
447
  if adapter_name in (".agents", ".cursor"):
446
- # Codex/Cursor: may support via host manifest. If runtime.json
447
- # has agentCapabilities but this role isn't listed, it's a
448
- # genuine "not available". If no agentCapabilities field at all,
449
- # we can't know — return UNKNOWN.
450
- runtime_path = skills_root.parent / "runtime.json"
451
- if not runtime_path.is_file():
452
- return {
453
- "ok": True,
454
- "action": "check-agents",
455
- "agent": agent_name,
456
- "usable": False,
457
- "definitionPresent": False,
458
- "hostCallable": False,
459
- "toolContractValid": False,
460
- "reasonCode": "UNKNOWN",
461
- "reason": (
462
- "no local agent definition and no host capability manifest; "
463
- "cannot determine agent availability"
464
- ),
465
- }
448
+ reason_code = (
449
+ "HOST_CAPABILITY_NOT_DECLARED"
450
+ if capability_manifest_present
451
+ else "INLINE_BY_ADAPTER"
452
+ )
453
+ return {
454
+ "ok": True,
455
+ "action": "check-agents",
456
+ "agent": agent_name,
457
+ "usable": False,
458
+ "executionMode": "inline",
459
+ "fallbackPolicy": "inline-no-retry",
460
+ "definitionPresent": False,
461
+ "hostCallable": False,
462
+ "toolContractValid": False,
463
+ "capabilityManifestPresent": capability_manifest_present,
464
+ "reasonCode": reason_code,
465
+ "reason": (
466
+ "host capability manifest does not declare this fixed agent; "
467
+ "use the normal inline path"
468
+ if capability_manifest_present
469
+ else "adapter uses inline execution unless the host explicitly "
470
+ "declares a callable agent capability"
471
+ ),
472
+ }
466
473
  return {
467
474
  "ok": False,
468
475
  "action": "check-agents",
@@ -470,9 +477,12 @@ def cmd_check_agents(
470
477
  "path": str(agent_path) if agent_path else None,
471
478
  "agentsRoot": str(resolved_agents_root) if resolved_agents_root else None,
472
479
  "usable": False,
480
+ "executionMode": "unavailable",
481
+ "fallbackPolicy": "inline-no-retry",
473
482
  "definitionPresent": False,
474
483
  "hostCallable": False,
475
484
  "toolContractValid": False,
485
+ "capabilityManifestPresent": capability_manifest_present,
476
486
  "reasonCode": "AGENT_DEFINITION_NOT_FOUND",
477
487
  "reason": f"agent file not found and host does not declare role: {agent_name}",
478
488
  }
@@ -488,9 +498,13 @@ def cmd_check_agents(
488
498
  "agent": agent_name,
489
499
  "path": str(agent_path),
490
500
  "usable": False,
501
+ "executionMode": "unavailable",
502
+ "fallbackPolicy": "inline-no-retry",
491
503
  "definitionPresent": True,
492
504
  "hostCallable": host_callable,
493
505
  "toolContractValid": False,
506
+ "capabilityManifestPresent": capability_manifest_present,
507
+ "reasonCode": "AGENT_DEFINITION_UNREADABLE",
494
508
  "reason": f"cannot read agent file: {exc}",
495
509
  }
496
510
 
@@ -502,9 +516,13 @@ def cmd_check_agents(
502
516
  "agent": agent_name,
503
517
  "path": str(agent_path),
504
518
  "usable": False,
519
+ "executionMode": "unavailable",
520
+ "fallbackPolicy": "inline-no-retry",
505
521
  "definitionPresent": True,
506
522
  "hostCallable": host_callable,
507
523
  "toolContractValid": False,
524
+ "capabilityManifestPresent": capability_manifest_present,
525
+ "reasonCode": "AGENT_DEFINITION_INVALID",
508
526
  "reason": f"frontmatter parse failed: {err or 'unknown'}",
509
527
  }
510
528
 
@@ -525,7 +543,7 @@ def cmd_check_agents(
525
543
  name_field = meta.get("name") if meta else None
526
544
  tools_field = meta.get("tools") if meta else None
527
545
 
528
- reason_code = "READY" if usable else "AGENT_DEFINITION_NOT_FOUND"
546
+ reason_code = "READY" if usable else "TOOL_CONTRACT_INVALID"
529
547
  if not definition_present and host_callable:
530
548
  reason_code = "DEFINITION_NOT_FOUND_HOST_CAPABLE"
531
549
 
@@ -536,9 +554,12 @@ def cmd_check_agents(
536
554
  "path": str(agent_path) if agent_path else None,
537
555
  "agentsRoot": str(resolved_agents_root) if resolved_agents_root else None,
538
556
  "usable": usable,
557
+ "executionMode": "delegated" if usable else "unavailable",
558
+ "fallbackPolicy": "inline-no-retry",
539
559
  "definitionPresent": definition_present,
540
560
  "hostCallable": host_callable,
541
561
  "toolContractValid": tool_contract_valid,
562
+ "capabilityManifestPresent": capability_manifest_present,
542
563
  "reasonCode": reason_code,
543
564
  "reason": (
544
565
  "agent available; "
@@ -2,5 +2,5 @@
2
2
  "schemaVersion": 1,
3
3
  "overlay": "none",
4
4
  "agent": "codebuddy",
5
- "coreHash": "15e7aa9003de59d7"
5
+ "coreHash": "8fdeda6094f4f0a5"
6
6
  }
@@ -260,7 +260,7 @@ harness-skills/
260
260
  | 阶段 | 强制检查 |
261
261
  |------|---------|
262
262
  | **plan 阶段 0** | 检查工作区是否有未提交业务代码变更,已有则询问用户处理方式(继续/暂存/回滚/取消),不得假装"编码前规划" |
263
- | **plan 阶段 3** | 委派前 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-explorer --json`;`usable=false` 或无效返回 → 主会话只读探索,不 retry |
263
+ | **plan 阶段 3** | 默认主会话 CodeGraph/Read inline 探索;仅高复杂度且准备委派固定 agent 时单次预检,失败或无效返回立即 inline,不 retry |
264
264
  | **plan 阶段 4/6** | 原生规划协议必须记录风险/复用/替代方案/推荐方案/关键决策,以及任务拆分摘要 |
265
265
  | **plan 阶段 5** | 设计文档自审结果必须展示给用户;测试场景表未覆盖维度必须标记为 ⚠️ 缺口,不得全部 ✅ |
266
266
  | **run 步骤 0** | 任何代码修改前必须先向 `events.ndjson` 追加 `phase.start`;执行日志由阶段结束事件自动渲染 |
@@ -401,7 +401,7 @@ powershell.exe -Command "Copy-Item -Path 'harness-skills/harness-*' -Destination
401
401
  powershell.exe -Command "Copy-Item -Path 'harness-skills/harness-test' -Destination '<目标项目>/.claude/skills/' -Recurse -Force"
402
402
  ```
403
403
 
404
- 同时复制 agents 到目标项目的 `.claude/agents/`(共 3 个:`harness-explorer` harness-plan 预检后委派;`harness-evaluator` 仅 `--adversarial` 时 opt-in;`harness-reviewer` harness-review 预检后委派):
404
+ Claude Code/CodeBuddy 可选复制 3 个隔离角色:`harness-explorer` 仅高复杂度探索、`harness-evaluator` 仅 `--adversarial`/高风险规划、`harness-reviewer` 仅发布候选/高风险审查。Codex/Cursor 默认使用主会话或宿主临时隔离任务,不安装固定角色,也不执行固定 agent 预检:
405
405
 
406
406
  ```powershell
407
407
  powershell.exe -Command "Copy-Item -Path 'harness-skills/agents/*.md' -Destination '<目标项目>/.claude/agents/' -Recurse -Force"