@pzy560117/codex-harness 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +7 -0
  2. package/lib/powershell/find-powershell.js +17 -0
  3. package/package-source/docs/codex-harness-engineering/templates/config/agents/failure-triage.toml +4 -1
  4. package/package-source/docs/codex-harness-engineering/templates/config/agents/test-planner.toml +3 -2
  5. package/package-source/docs/codex-harness-engineering/templates/config/codex-config.toml +2 -0
  6. package/package-source/docs/codex-harness-engineering/templates/config/codex-readme.md +2 -0
  7. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/README.md +5 -2
  8. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/best-practices.md +6 -0
  9. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/examples/goal-templates.md +380 -0
  10. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/global-rules-and-bootstrap.md +16 -0
  11. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/goal-harness-integration-guide.md +364 -0
  12. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/implementation-flow.md +13 -1
  13. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/implementation-guide.md +3 -1
  14. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/codex-harness-engineering/mode-matrix.md +34 -11
  15. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/ecc-zh-CN/README.md +7 -0
  16. package/package-source/docs/codex-harness-engineering/templates/package-assets/docs/ecc-zh-CN/commands/e2e.md +20 -5
  17. package/package-source/docs/codex-harness-engineering/templates/package-assets/skills/harness-surface-sync/references/stale-patterns.md +3 -0
  18. package/package-source/docs/codex-harness-engineering/templates/package-assets/skills/qa-e2e-planner/SKILL.md +2 -1
  19. package/package-source/docs/codex-harness-engineering/templates/package-assets/skills/qa-e2e-runner/SKILL.md +3 -2
  20. package/package-source/docs/codex-harness-engineering/templates/package-assets/skills/qa-mock-cleaner/SKILL.md +2 -1
  21. package/package-source/docs/codex-harness-engineering/templates/package-assets/skills/speckit-e2e-tasks/SKILL.md +3 -2
  22. package/package-source/docs/codex-harness-engineering/templates/package-assets/workflows/speckit.e2e-testing.md +6 -4
  23. package/package-source/docs/codex-harness-engineering/templates/prompts/failure-triage.md +9 -7
  24. package/package-source/docs/codex-harness-engineering/templates/runtime/codex-loop.ps1 +129 -6
  25. package/package-source/docs/codex-harness-engineering/templates/runtime/doctor.ps1 +13 -1
  26. package/package-source/docs/codex-harness-engineering/templates/runtime/project-task-template.json +6 -1
  27. package/package-source/docs/codex-harness-engineering/templates/testing/e2e-plan.md +115 -14
  28. package/package-source/docs/codex-harness-engineering/templates/testing/failure-triage.md +51 -13
  29. package/package-source/install-manifest.json +1 -1
  30. package/package-source/tools/install/install-agent.ps1 +1 -0
  31. package/package.json +1 -1
package/README.md CHANGED
@@ -11,6 +11,13 @@ harness verify
11
11
  harness run
12
12
  ```
13
13
 
14
+ 如果目标项目准备在 Codex app 中使用 `/goal` 长时间推进,安装完成后优先阅读:
15
+
16
+ - `docs/codex-harness-engineering/goal-harness-integration-guide.md`
17
+ - `docs/codex-harness-engineering/examples/goal-templates.md`
18
+
19
+ `/goal` 只作为外层长期目标控制面,不替代 `task.json + codex-loop.ps1 + stop hook` 主链。
20
+
14
21
  ## Release Assets
15
22
 
16
23
  GitHub Release assets are built from the repository package source with:
@@ -1,3 +1,20 @@
1
+ import { spawnSync } from "node:child_process";
2
+
3
+ function commandExists(command) {
4
+ const result = spawnSync(command, ["-NoProfile", "-Command", "$PSVersionTable.PSVersion.ToString()"], {
5
+ stdio: "ignore",
6
+ windowsHide: true
7
+ });
8
+
9
+ return result.status === 0;
10
+ }
11
+
1
12
  export function findPowerShell() {
13
+ for (const candidate of ["pwsh", "powershell"]) {
14
+ if (commandExists(candidate)) {
15
+ return candidate;
16
+ }
17
+ }
18
+
2
19
  return "powershell";
3
20
  }
@@ -10,6 +10,9 @@ Before concluding, read `AGENTS.md`, `docs/harness/task-session-strategy.md`, `.
10
10
  Read the matching package skill before classifying failures:
11
11
  - `skills/build-error-resolver/SKILL.md`
12
12
  Stay read-only.
13
- Return structured output only: finding id, owner, severity, evidence path, likely cause, and next verification step.
13
+ Classify every failure in two steps:
14
+ 1. one primary class: `TEST_CODE_ISSUE` / `PRODUCT_BUG` / `REQUIREMENT_CHANGE` / `ENV_OR_DATA_ISSUE` / `FLAKY`
15
+ 2. one secondary owner-oriented category from `docs/testing/failure-triage.md`
16
+ Return structured output only: finding id, primary class, secondary category, owner, severity, evidence path, likely cause, and next verification step.
14
17
  Do not repair code or edit files.
15
18
  """
@@ -6,11 +6,12 @@ sandbox_mode = "read-only"
6
6
 
7
7
  developer_instructions = """
8
8
  You are the test planning auxiliary subagent.
9
- Before concluding, read `AGENTS.md`, `docs/harness/task-session-strategy.md`, `.codex/rules/agents.md`, the relevant product/design/contract truth sources, and the matching package skills:
9
+ Before concluding, read `AGENTS.md`, `docs/harness/task-session-strategy.md`, `.codex/rules/agents.md`, the relevant product/design/contract truth sources, `docs/ai/repo-map.md` or `docs/context/repo-map.md` when present, and the matching package skills:
10
10
  - `skills/qa-e2e-planner/SKILL.md`
11
11
  - `skills/test-coverage/SKILL.md`
12
12
  - `skills/tdd/SKILL.md`
13
13
  Stay read-only.
14
- Return structured output only: test matrix, coverage gaps, evidence paths, seed data needs, and verification commands.
14
+ Prefer starting from repo map / codemap to identify entry points and affected areas before broad file reads.
15
+ Return structured output only: test matrix, coverage gaps, impacted modules, affected tests, evidence paths, seed data needs, whether an `e2e-plan.md` is required, and verification commands.
15
16
  Do not edit files.
16
17
  """
@@ -19,6 +19,8 @@ approval_policy = "on-request"
19
19
  # hooks 作为 stop-gate 增强层默认启用;driver 仍是主链路。
20
20
  # Windows 继续以 PowerShell driver 为主,hooks 只负责结束前补一轮 reflection / feedback。
21
21
  hooks = true
22
+ # goal mode 作为外层长期目标控制面启用;仓库执行仍回到 task.json + driver + stop hook。
23
+ goals = true
22
24
 
23
25
  [mcp_servers.anysearch]
24
26
  # AnySearch 提供可匿名访问的 Streamable HTTP MCP;需要更高额度时在本机设置 ANYSEARCH_API_KEY 后取消下一行注释。
@@ -48,6 +48,8 @@
48
48
 
49
49
  ## Profile 使用
50
50
 
51
+ 当前项目模板默认启用 `features.goals = true`,这样 Codex app 可以显示 `/goal`。这只是在产品层打开长期目标控制面,不改变 Harness 的主执行协议;仓库推进仍应回到 `task.json + tools/harness/codex-loop.ps1 + stop hook`。
52
+
51
53
  包内 `profiles.*` 是安装后的推荐配置模板,不保证 `codex -C <path> -p <profile>` 在所有调用场景都会自动读取项目 `.codex/config.toml`。
52
54
 
53
55
  更稳的方式是:
@@ -30,9 +30,10 @@ task.json
30
30
  | --- | --- |
31
31
  | `README.md` | 当前目录总览 |
32
32
  | `START-HERE.md` | 首次进入目录时的分流入口 |
33
- | `mode-matrix.md` | full 模式的职责、状态源、提交责任、trace 责任和验证入口 |
33
+ | `mode-matrix.md` | `user/project/vendor/full` 的职责边界、状态源、持续运行定位和验证入口 |
34
34
  | `best-practices.md` | 任务、上下文、权限、测试、阻塞、提交、回归沉淀的最佳实践 |
35
35
  | `implementation-flow.md` | 从 当前仓库包根结构出发说明安装、bootstrap、driver、验证、知识归档和同步的整体实现流程 |
36
+ | `goal-harness-integration-guide.md` | 说明如何把 Codex `/goal` 与 Harness driver/stop hook 结合使用,包含推荐用法和提示词模板 |
36
37
  | `harness-analysis-and-practice.md` | GitHub 调研后的 Harness 工程分析、当前安装包工程评估和改进路线图 |
37
38
  | `harness-quality-model.md` | 定义好的、好用的、完整的 Harness 工程质量模型、成熟度和评分标准 |
38
39
  | `harness-improvement-plan.md` | 基于质量模型和源码审计的 Harness 改进计划,说明每项改哪里、怎么改、如何验收 |
@@ -44,6 +45,7 @@ task.json
44
45
  | `templates/docs/frontend-quality-rules.md` | 前端审美、动效、响应式、可访问性、性能和证据要求 |
45
46
  | `templates/docs/service-dependency-matrix.md` | 多服务、多仓库、契约和外部系统影响面的可选 truth source 维护口径 |
46
47
  | `templates/design/frontend-architecture.md` | 前端页面、feature、组件、状态、API、响应式和测试边界模板 |
48
+ | `examples/goal-templates.md` | `/goal` 启动模板库,强调它是外层控制壳而不是替代 `task.json` / spec 的目标定义 |
47
49
  | `templates/` | 可复制模板集中目录 |
48
50
  | `templates/docs/project-agents-template.md` | 根据不同项目事实生成项目根 `AGENTS.md` / 子目录 `AGENTS.md` / `CLAUDE.md` 组合的通用模板 |
49
51
 
@@ -62,7 +64,8 @@ powershell -NoProfile -ExecutionPolicy Bypass -File .\docs\codex-harness-enginee
62
64
  6. 如果需要把根 `AGENTS.md` 调整为项目专属规则,按 `templates/docs/project-agents-template.md` 扫描项目事实后裁剪生成,不要原样套模板。
63
65
  7. 首次接入时,建议先用 `templates/runtime/smoke-task.json` 验证主链路;一旦 spec / plan 确认,就改用 `templates/runtime/project-task-template.json` 生成正式 `task.json` 并切回 driver。
64
66
  8. 正式任务队列落盘前,先补齐 `docs/testing/ACCEPTANCE_CRITERIA.md`、`docs/testing/ACCEPTANCE_EXAMPLES.md`、`docs/testing/TRACEABILITY_MATRIX.md`、`docs/testing/TEST_DATA_MATRIX.md`、`docs/testing/verify-matrix.md` 等测试左移真相源。
65
- 9. 运行:
67
+ 9. 如果任务涉及用户可见行为、路由、表单、权限、状态流转或关键业务闭环,补齐 `docs/testing/e2e-plan.md`,并先从 `docs/ai/repo-map.md` 进入代码结构后再做实现规划。
68
+ 10. 运行:
66
69
 
67
70
  ```powershell
68
71
  powershell -NoProfile -ExecutionPolicy Bypass -File .\tools/harness/codex-loop.ps1
@@ -96,6 +96,12 @@ Windows 不应依赖 Codex hooks 作为主链路。Codex hooks 可以作为结
96
96
  - 生成 trace。
97
97
  - 提交 Git commit。
98
98
 
99
+ 同理,Codex 官方 `/goal` 更适合作为**外层长期目标控制面**,而不是直接替代当前仓库的 `task.json + codex-loop.ps1 + stop hook` 执行协议。当前 Harness 的推荐分层仍然是:
100
+
101
+ - `/goal` 负责长期目标保持和人机 steering
102
+ - driver 负责任务、验证、trace 和提交
103
+ - stop hook 负责停止前治理门和 continuation 决策
104
+
99
105
  要明确区分两层职责:
100
106
 
101
107
  - 内层 `codex exec` 会话只负责当前任务直接要求的代码或文档改动。
@@ -0,0 +1,380 @@
1
+ # `/goal` 目标启动模板库
2
+
3
+ ## 1. 先说结论
4
+
5
+ 这里不是“自由目标文案库”,而是 **`/goal` 启动模板库**。
6
+
7
+ 原因很简单:
8
+
9
+ - 真正定义“做什么”的,不是 `/goal`。
10
+ - 真正定义“怎么拆任务”的,不是 `/goal`。
11
+ - 真正定义“能不能完成”的,也不是 `/goal`。
12
+
13
+ 在当前 Harness 体系里,这三件事分别由下面几层承担:
14
+
15
+ | 层 | 负责什么 |
16
+ | --- | --- |
17
+ | spec / PRD / design / testing truth source | 定义目标、范围、验收、风险、非目标 |
18
+ | `task.json` | 定义可执行任务队列、依赖、owned paths、验证命令 |
19
+ | `/goal` | 只负责外层长期目标保持、持续推进和人机 steering |
20
+
21
+ 所以这里的模板,更准确的名字应该理解成:
22
+
23
+ - **goal launch profiles**
24
+ - **goal wrappers**
25
+ - **goal control prompts**
26
+
27
+ 而不是“随便写一个长期目标让它自己跑”。
28
+
29
+ ## 2. `/goal` 和 spec / task.json 的区别
30
+
31
+ ### 2.1 spec / truth source 解决什么问题
32
+
33
+ spec、设计、测试真相源回答的是:
34
+
35
+ - 为什么要做
36
+ - 做到什么算完成
37
+ - 不做什么
38
+ - 哪些路径高风险
39
+ - 哪些证据必须存在
40
+
41
+ ### 2.2 `task.json` 解决什么问题
42
+
43
+ `task.json` 回答的是:
44
+
45
+ - 先做哪个任务
46
+ - 哪些任务有依赖
47
+ - 哪个任务接管哪些路径
48
+ - 每个任务要跑什么验证命令
49
+
50
+ ### 2.3 `/goal` 解决什么问题
51
+
52
+ `/goal` 回答的是:
53
+
54
+ - 在长时间运行里,系统持续朝哪个方向推进
55
+ - 用户暂停、恢复、修改目标时,外层控制面怎么表达
56
+ - 遇到 stop hook / failed trace / triage 结果时,是继续、保守、还是停下等人
57
+
58
+ 所以它本质上是:
59
+
60
+ ```text
61
+ 持续运行控制模板
62
+ ```
63
+
64
+ 不是:
65
+
66
+ ```text
67
+ 需求模板
68
+ ```
69
+
70
+ 也不是:
71
+
72
+ ```text
73
+ 任务模板
74
+ ```
75
+
76
+ ## 3. 使用前提
77
+
78
+ 任何 `/goal` 模板启用前,都要先确认下面这些已经存在:
79
+
80
+ ### 最小前提
81
+
82
+ 1. `task.json` 已经是真实任务队列,不是 smoke 占位。
83
+ 2. 已有 `docs/ai/repo-map.md` 或等价导航文件。
84
+ 3. 已有基本 testing truth source:
85
+ - `ACCEPTANCE_EXAMPLES.md`
86
+ - `TRACEABILITY_MATRIX.md`
87
+ - `TEST_DATA_MATRIX.md`
88
+ - `verify-matrix.md`
89
+
90
+ ### 高风险用户可见任务额外前提
91
+
92
+ 4. 已有 `docs/testing/e2e-plan.md`
93
+ 5. 已明确 `failure-triage.md`
94
+
95
+ ### 运行前检查
96
+
97
+ 6. `tools/harness/doctor.ps1` 通过
98
+ 7. `tools/harness/verify.ps1` 通过
99
+ 8. 工作区不是未解释的脏状态
100
+
101
+ 如果这些前提不成立,不要直接开 `/goal`。
102
+
103
+ ## 4. 模板字段说明
104
+
105
+ 下面每个模板都建议显式包含 6 类信息:
106
+
107
+ ### A. 目标对象
108
+
109
+ - 当前 feature / release / recovery scope
110
+
111
+ ### B. 依赖的真实真相源
112
+
113
+ - `AGENTS.md`
114
+ - `docs/ai/repo-map.md`
115
+ - `docs/testing/*`
116
+ - `task.json`
117
+
118
+ ### C. 执行动作
119
+
120
+ - 通过 `tools/harness/codex-loop.ps1 -RunUntilDone` 推进
121
+
122
+ ### D. 停止条件
123
+
124
+ - 没有 runnable task
125
+ - stop hook block
126
+ - failed trace
127
+ - 人工 blocker
128
+
129
+ ### E. 禁止事项
130
+
131
+ - 不绕过 `task.json`
132
+ - 不绕过 `test_command`
133
+ - 不绕过 review / trace / commit gate
134
+
135
+ ### F. 失败处理
136
+
137
+ - 优先读取 `failure-triage` 结果
138
+
139
+ ## 5. 模板 01:标准持续推进
140
+
141
+ ### 适用场景
142
+
143
+ - 已有明确 spec
144
+ - 已有真实任务队列
145
+ - 需要连续推进多个任务
146
+
147
+ ### 启动模板
148
+
149
+ ```text
150
+ 持续推进当前项目的 Harness 任务队列,直到 task.json 中没有 runnable task、出现真实人工阻塞,或 stop hook / review / test / trace 明确要求暂停。
151
+
152
+ 强制约束:
153
+ 1. 先遵守 AGENTS.md、docs/ai/repo-map.md、docs/harness/*、docs/testing/*。
154
+ 2. 通过 tools/harness/codex-loop.ps1 -RunUntilDone 推进任务,不绕过 task.json。
155
+ 3. 不跳过 test_command、Stage 1、Stage 2、trace 或 commit gate。
156
+ 4. 测试失败时先查看 failure-triage 结果,再决定下一步。
157
+ 5. 缺少 truth source、e2e-plan、权限或外部依赖时,明确报告 BLOCKED,不自行猜测。
158
+ ```
159
+
160
+ ### 适合的跟进消息
161
+
162
+ ```text
163
+ 继续按当前任务队列推进,不新增范围。优先完成已经 runnable 的任务。
164
+ ```
165
+
166
+ ## 6. 模板 02:夜间长跑
167
+
168
+ ### 适用场景
169
+
170
+ - 白天人工确认过状态
171
+ - 夜间希望继续推进
172
+ - 更关注稳态而不是速度
173
+
174
+ ### 启动模板
175
+
176
+ ```text
177
+ 在无人值守时持续推进当前 Harness 项目,但只允许在 driver 和 stop hook 都认为可以继续时前进。
178
+
179
+ 运行原则:
180
+ 1. 优先执行 task.json 中下一个 runnable task。
181
+ 2. 任何 dirty workspace、governance drift、failed trace、truth source 缺失都视为暂停信号。
182
+ 3. 不要为追求连续运行而弱化测试、跳过 review 或绕过 stop hook。
183
+ 4. 每次停下时总结:当前任务、最近证据、failure-triage 结果、是否需要人工。
184
+ ```
185
+
186
+ ### 适合的跟进消息
187
+
188
+ ```text
189
+ 进入保守夜间模式:如果同一 blocker 连续出现,不要反复重试,直接停下并报告。
190
+ ```
191
+
192
+ ## 7. 模板 03:高风险用户可见功能
193
+
194
+ ### 适用场景
195
+
196
+ - 路由
197
+ - 表单
198
+ - 权限
199
+ - 状态流转
200
+ - 关键 UI 主流程
201
+
202
+ ### 启动模板
203
+
204
+ ```text
205
+ 持续推进当前高风险用户可见功能,但必须先确认 docs/testing/e2e-plan.md、验收示例、追溯矩阵和 repo-map 已齐备。
206
+
207
+ 额外约束:
208
+ 1. 没有 e2e-plan 时不进入实现,先补测试计划。
209
+ 2. 先从 docs/ai/repo-map.md 进入代码结构,再做局部文件修改。
210
+ 3. 测试失败时先按 TEST_CODE_ISSUE / PRODUCT_BUG / REQUIREMENT_CHANGE / ENV_OR_DATA_ISSUE / FLAKY 分类。
211
+ 4. 不允许用 mock、fixture、local-only adapter 冒充真实交付路径。
212
+ ```
213
+
214
+ ### 适合的跟进消息
215
+
216
+ ```text
217
+ 先确认 e2e-plan 和影响面,不要为了前进速度绕过用户可见路径的测试计划。
218
+ ```
219
+
220
+ ## 8. 模板 04:恢复性目标
221
+
222
+ ### 适用场景
223
+
224
+ - 上一轮 stop hook 强制继续
225
+ - 早上接手夜间运行
226
+ - 测试刚失败,需要恢复执行链
227
+
228
+ ### 启动模板
229
+
230
+ ```text
231
+ 恢复并继续当前 Harness 执行链。先判断上次停止是正常 allow stop、stop hook continuation、review 失败、test_command 失败还是真实 BLOCKED。
232
+
233
+ 执行顺序:
234
+ 1. 读取最新 progress.txt、latest trace、failure-triage 报告。
235
+ 2. 确认当前 runnable task 和最近失败阶段。
236
+ 3. 如果 stop hook / driver 允许继续,则继续推进。
237
+ 4. 如果仍然 blocked,输出需要人工处理的最小动作,不要空转。
238
+ ```
239
+
240
+ ### 适合的跟进消息
241
+
242
+ ```text
243
+ 先恢复上下文,不要直接重跑实现;先解释最近一次失败和当前是否真的可继续。
244
+ ```
245
+
246
+ ## 9. 模板 05:Release 收口
247
+
248
+ ### 适用场景
249
+
250
+ - 多个故事已完成
251
+ - 进入 P0/P1 回归
252
+ - 需要收口而不是再发散实现
253
+
254
+ ### 启动模板
255
+
256
+ ```text
257
+ 持续推进当前 release 收口,但不新增新功能范围。目标是完成当前 task.json 中与 release 相关的 runnable task,并输出 fresh evidence。
258
+
259
+ 约束:
260
+ 1. 优先处理 P0/P1 回归、契约验证、e2e/视觉证据和 failure-triage。
261
+ 2. 不新增新的 feature 实现任务,除非任务队列本身已经声明。
262
+ 3. 如果发现问题,优先归因到现有 story 或 release blocker,不要模糊扩写需求。
263
+ 4. 没有 fresh evidence 就不要声称 release 完成。
264
+ ```
265
+
266
+ ### 适合的跟进消息
267
+
268
+ ```text
269
+ 收口优先,不再扩 scope。失败项先归因到现有 blocker,再决定是否需要 repair。
270
+ ```
271
+
272
+ ## 10. 模板 06:治理修复
273
+
274
+ ### 适用场景
275
+
276
+ - stop hook 被 governance drift 卡住
277
+ - rules / prompts / docs / mirrors 漂移
278
+ - 需要先修 Harness 面再继续业务开发
279
+
280
+ ### 启动模板
281
+
282
+ ```text
283
+ 当前目标不是继续业务功能,而是先修复 Harness 治理面,使 driver 和 stop hook 能重新进入稳定运行状态。
284
+
285
+ 约束:
286
+ 1. 优先读取 AGENTS.md、docs/harness/governance-auto-repair.md、docs/harness/rule-governance.md、.codex/rules/agents.md。
287
+ 2. 只修与当前治理失败直接相关的 runtime/docs/template/package-assets 面。
288
+ 3. 业务实现不是当前目标,除非治理修复明确要求一起同步。
289
+ 4. 修复完成后重新运行 verify / doctor,再决定是否恢复原目标。
290
+ ```
291
+
292
+ ### 适合的跟进消息
293
+
294
+ ```text
295
+ 优先恢复治理面,不继续业务功能。只处理当前 stop hook / verify 报出的直接问题。
296
+ ```
297
+
298
+ ## 11. 模板 07:人工旁路保守模式
299
+
300
+ ### 适用场景
301
+
302
+ - 人工希望介入更多
303
+ - 不希望系统自由选择太多 repair 动作
304
+ - 高风险上线前夕
305
+
306
+ ### 启动模板
307
+
308
+ ```text
309
+ 持续推进当前 Harness 项目,但进入人工旁路保守模式。
310
+
311
+ 规则:
312
+ 1. 只推进 task.json 中已经 runnable 的任务。
313
+ 2. 遇到同一 blocker 或 triage 分类不清时,立即停下请求人工确认。
314
+ 3. 不自行扩大范围,不自行改写目标,不自行新增 repair 分支。
315
+ 4. 每轮仅报告:当前任务、最近验证、failure-triage 分类、是否建议继续。
316
+ ```
317
+
318
+ ### 适合的跟进消息
319
+
320
+ ```text
321
+ 进入人工旁路模式:遇到需要策略判断的地方,不要自己选,直接停下问我。
322
+ ```
323
+
324
+ ## 12. 这些模板和 spec / task.json 的区别
325
+
326
+ 这是最容易混淆的一点:
327
+
328
+ ### spec / truth source 是“内容层”
329
+
330
+ 定义:
331
+
332
+ - 业务目标
333
+ - 验收
334
+ - 约束
335
+ - 风险
336
+
337
+ ### `task.json` 是“执行层”
338
+
339
+ 定义:
340
+
341
+ - 任务顺序
342
+ - 依赖
343
+ - owned paths
344
+ - test_command
345
+
346
+ ### `/goal` 模板是“控制层”
347
+
348
+ 定义:
349
+
350
+ - 如何持续推进
351
+ - 什么时候停
352
+ - 什么时候保守
353
+ - 遇到失败怎么先归因
354
+
355
+ 所以这里的模板库价值不在“重复写需求”,而在:
356
+
357
+ - 减少使用 `/goal` 时的外层控制失误
358
+ - 保证 `/goal` 不压过 Harness driver
359
+
360
+ ## 13. 推荐命名
361
+
362
+ 如果后续继续扩充,建议把这一类文案统一叫:
363
+
364
+ - `goal launch profiles`
365
+ - `goal control templates`
366
+
367
+ 不要叫:
368
+
369
+ - feature goal specs
370
+ - long-running task specs
371
+
372
+ 因为它们不是在定义业务目标本身。
373
+
374
+ ## 14. 推荐下一步
375
+
376
+ 如果后面还要继续完善,最值得补的不是“更多空泛模板”,而是:
377
+
378
+ 1. 基于真实 Harness 场景补更多 launch profiles。
379
+ 2. 补一个“如何从 stop hook / failed trace 自动挑选合适 goal 模板”的决策表。
380
+ 3. 如果未来 `user` 安装层正式支持 `/goal`,再把这套模板库明确挂到 user 模式文档里。
@@ -180,6 +180,11 @@ test-data-plan.md
180
180
  e2e-plan.md
181
181
  ```
182
182
 
183
+ 其中:
184
+
185
+ - `failure-triage.md` 应作为失败一级分类和 owner 二级归因入口,至少区分测试代码问题、产品 Bug、需求变更、环境/数据问题和 Flaky。
186
+ - `e2e-plan.md` 不应对所有任务一刀切;它主要用于涉及用户可见行为、路由、表单、权限、状态流转或关键业务闭环的高风险任务。
187
+
183
188
  建议同时初始化代码地图,作为大型项目的检索入口:
184
189
 
185
190
  ```text
@@ -188,6 +193,8 @@ docs/ai/repo-map.md
188
193
 
189
194
  如果使用本包模板,可从 `templates/context/repo-map.md` 复制后按项目事实裁剪。根 `AGENTS.md` 只需要索引它,不要把整张代码地图复制进入口文件。
190
195
 
196
+ 进入实现前,优先从 `docs/ai/repo-map.md` 或等价 codemap 进入代码结构,再补局部文件阅读;不要把大型仓库的首次理解建立在全仓盲扫上。
197
+
191
198
  通过 `tools/install/install-agent.ps1` 或 `tools/install/bootstrap-codex-harness.ps1` 安装时,模板会自动初始化:
192
199
 
193
200
  ```text
@@ -206,6 +213,8 @@ docs/ai/architecture-brief.md
206
213
 
207
214
  项目配置只放项目特有内容。能在全局复用的项放到 `~/.codex/config.toml`。
208
215
 
216
+ 如果目标项目准备在 Codex app 中使用 `/goal` 长时间推进,建议保留模板中的 `features.goals = true`。这只是打开 Goal mode 入口,不会替代 Harness 的 `task.json + codex-loop.ps1 + stop hook` 主链。
217
+
209
218
  ### Step 4: 初始化任务
210
219
 
211
220
  编辑 `task.json`:
@@ -258,6 +267,13 @@ powershell -NoProfile -ExecutionPolicy Bypass -File .\tools/harness/codex-loop.p
258
267
  powershell -NoProfile -ExecutionPolicy Bypass -File .\tools/harness/codex-loop.ps1 -RunUntilDone
259
268
  ```
260
269
 
270
+ 如果你想把 `/goal` 作为外层 7x24 控制面来用,先读:
271
+
272
+ - `docs/codex-harness-engineering/goal-harness-integration-guide.md`
273
+ - `docs/codex-harness-engineering/examples/goal-templates.md`
274
+
275
+ 然后再在 Codex app 中设置 `/goal`。不要跳过 `task.json`、driver 或 stop hook,直接让 `/goal` 自由实现。
276
+
261
277
  ## 5. 新环境初始化步骤
262
278
 
263
279
  这里指新电脑、新 runner、WSL、新 CI 环境。