hunter-harness 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/bin.js +1033 -219
  2. package/package.json +2 -2
  3. package/resources/harness/general/.harness-build.json +1 -1
  4. package/resources/harness/general/harness-archive/SKILL.md +215 -215
  5. package/resources/harness/general/harness-codebase-map/SKILL.md +112 -112
  6. package/resources/harness/general/harness-codebase-map/templates/map-summary.md +3 -3
  7. package/resources/harness/general/harness-knowledge-ingest/SKILL.md +246 -246
  8. package/resources/harness/general/harness-knowledge-query/SKILL.md +164 -164
  9. package/resources/harness/general/harness-plan/SKILL.md +127 -127
  10. package/resources/harness/general/harness-review/SKILL.md +156 -156
  11. package/resources/harness/general/harness-run/SKILL.md +132 -132
  12. package/resources/harness/general/harness-submit/SKILL.md +159 -159
  13. package/resources/harness/general/harness-sync/SKILL.md +82 -82
  14. package/resources/harness/general/harness-test/SKILL.md +180 -180
  15. package/resources/harness/general/scripts/harness_deploy.py +580 -580
  16. package/resources/harness/java/.harness-build.json +1 -1
  17. package/resources/harness/java/harness-apidoc/SKILL.md +86 -86
  18. package/resources/harness/java/harness-archive/SKILL.md +215 -215
  19. package/resources/harness/java/harness-codebase-map/SKILL.md +112 -112
  20. package/resources/harness/java/harness-codebase-map/templates/map-summary.md +3 -3
  21. package/resources/harness/java/harness-knowledge-ingest/SKILL.md +246 -246
  22. package/resources/harness/java/harness-knowledge-query/SKILL.md +164 -164
  23. package/resources/harness/java/harness-package/SKILL.md +87 -87
  24. package/resources/harness/java/harness-plan/SKILL.md +127 -127
  25. package/resources/harness/java/harness-review/SKILL.md +156 -156
  26. package/resources/harness/java/harness-run/SKILL.md +148 -148
  27. package/resources/harness/java/harness-submit/SKILL.md +166 -166
  28. package/resources/harness/java/harness-sync/SKILL.md +82 -82
  29. package/resources/harness/java/harness-test/SKILL.md +192 -192
  30. package/resources/harness/java/scripts/harness_deploy.py +580 -580
  31. package/resources/harness/manifests/general.json +13 -33
  32. package/resources/harness/manifests/java.json +15 -35
  33. package/resources/harness/migrations/0.1.1/general.json +358 -0
  34. package/resources/harness/migrations/0.1.1/java.json +398 -0
  35. package/resources/bootstrap-ir/manifest.json +0 -19
  36. package/resources/bootstrap-ir/skills/harness-apidoc.yaml +0 -24
  37. package/resources/bootstrap-ir/skills/harness-archive.yaml +0 -24
  38. package/resources/bootstrap-ir/skills/harness-codebase-map.yaml +0 -24
  39. package/resources/bootstrap-ir/skills/harness-knowledge-ingest.yaml +0 -24
  40. package/resources/bootstrap-ir/skills/harness-package.yaml +0 -24
  41. package/resources/bootstrap-ir/skills/harness-plan.yaml +0 -24
  42. package/resources/bootstrap-ir/skills/harness-review.yaml +0 -24
  43. package/resources/bootstrap-ir/skills/harness-run.yaml +0 -24
  44. package/resources/bootstrap-ir/skills/harness-skill-optimizer.yaml +0 -28
  45. package/resources/bootstrap-ir/skills/harness-submit.yaml +0 -24
  46. package/resources/bootstrap-ir/skills/harness-sync.yaml +0 -24
  47. package/resources/bootstrap-ir/skills/harness-test.yaml +0 -24
  48. package/resources/bootstrap-ir/templates/claude-code-skill.md +0 -12
  49. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
  50. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
  51. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
  52. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
  53. package/resources/harness/general/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
  54. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
  55. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
  56. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
  57. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
  58. package/resources/harness/java/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
  59. package/resources/manifest.json +0 -19
  60. package/resources/skills/harness-apidoc/SKILL.md +0 -50
  61. package/resources/skills/harness-archive/SKILL.md +0 -48
  62. package/resources/skills/harness-codebase-map/SKILL.md +0 -53
  63. package/resources/skills/harness-knowledge-ingest/SKILL.md +0 -48
  64. package/resources/skills/harness-package/SKILL.md +0 -48
  65. package/resources/skills/harness-plan/SKILL.md +0 -51
  66. package/resources/skills/harness-review/SKILL.md +0 -50
  67. package/resources/skills/harness-run/SKILL.md +0 -48
  68. package/resources/skills/harness-skill-optimizer/SKILL.md +0 -54
  69. package/resources/skills/harness-submit/SKILL.md +0 -47
  70. package/resources/skills/harness-sync/SKILL.md +0 -48
  71. package/resources/skills/harness-test/SKILL.md +0 -50
@@ -1,164 +1,164 @@
1
- ---
2
- name: harness-knowledge-query
3
- description: "根据新需求、设计任务、代码修改请求或问题排查,在规划和编码前查询 .harness/knowledge 历史上下文。适用场景:query knowledge、查找历史需求、根据归档理解需求、继续之前类似开发、生成需求上下文包。"
4
- argument-hint: "<需求文本> [--file <path>] [--status active|candidate|stale]"
5
- effort: medium
6
- allowed-tools: [Bash(powershell.exe:*), Read, Write, Edit, Glob, Grep]
7
- disallowed-tools:
8
- - Bash(git *)
9
- - Bash(mvn *)
10
- - Bash(ls *)
11
- - Bash(find *)
12
- - Bash(grep *)
13
- - Bash(cat *)
14
- - Bash(cp *)
15
- - Bash(mv *)
16
- - Bash(rm *)
17
- - Bash(mkdir *)
18
- - Bash(touch *)
19
- - Bash(sed *)
20
- - Bash(awk *)
21
- - Bash(curl *)
22
- ---
23
- <!-- generated by harness_deploy.py; core=63af4c482d21b6be; overlay=none; do not edit -->
24
- # harness-knowledge-query
25
-
26
- 根据用户的新需求或排查问题,从项目本地 `.harness/knowledge` 中检索历史需求、决策、实现、风险和测试证据,并生成 AI 可读的 context pack。
27
-
28
- 此 skill 只负责查询和使用知识。整理、同步和 promote 条目由 `harness-knowledge-ingest` 负责。
29
-
30
- ## Triggers
31
-
32
- - query knowledge
33
- - knowledge query
34
- - 查找相关历史需求
35
- - 根据历史归档理解这个需求
36
- - 结合之前做过的内容
37
- - 继续之前类似开发
38
- - 生成需求上下文包
39
- - 在规划前查历史
40
-
41
- ## Automatic Use
42
-
43
- 当用户提出新功能、改造、排查、设计方案、继续历史任务,且项目存在 `.harness/archive` 或 `.harness/knowledge` 时,AI 应主动运行本 skill,不需要等用户提醒。
44
-
45
- 如果 `.harness/knowledge/index.json` 不存在或已过期,先运行:
46
-
47
- ```powershell
48
- powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>' --update"
49
- ```
50
-
51
- 然后再查询。
52
-
53
- ## Commands
54
-
55
- `<ingest-skill-dir>` 指同级 `harness-knowledge-ingest/` 目录;查询逻辑复用其脚本。所有 python 脚本命令通过 `powershell.exe -Command "..."` 执行,避开 Bash 在 Windows 中文路径下的编码/参数问题。
56
-
57
- ### Query by requirement
58
-
59
- ```powershell
60
- powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<用户需求原文>'"
61
- ```
62
-
63
- ### Query with metadata filters
64
-
65
- ```powershell
66
- powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<需求或关键词>' --file '<source-file>' --status active"
67
- ```
68
-
69
- 可重复使用:
70
-
71
- - `--file <path>`:只返回关联到指定文件的知识。
72
- - `--status active|candidate|stale|superseded|conflicted`:按生命周期过滤。
73
- - `--type requirement|decision|implementation|risk|test-evidence|pitfall|api-contract`:按知识类型过滤。
74
- - `--limit <n>`:限制返回数量。
75
-
76
- ## Workflow
77
-
78
- 1. 确认项目根目录。
79
- 2. 运行 `sync --project <root>`。
80
- 3. 如果 `upToDate=false`,运行 `sync --update`。
81
- 4. 用用户原始需求作为 `--query` 查询。
82
- 5. 如已知道相关文件,追加 `--file` 过滤。
83
- 6. 读取 JSON 输出中的 `contextPack`。
84
- 7. 在 `harness-plan`、设计、代码探索或实现前,把 context pack 当作必读输入。
85
-
86
- ## Output Contract
87
-
88
- 查询输出 JSON 包含:
89
-
90
- - `matchCount`
91
- - `contextPack`
92
- - `filters`
93
- - `planInput`
94
- - `matches`
95
-
96
- `planInput.kind` 必须为 `harness-knowledge-context-pack`。后续 `harness-plan` 应读取 `planInput.path`。
97
-
98
- 每次查询还会更新稳定指针:
99
-
100
- ```text
101
- .harness/knowledge/context-packs/latest.json
102
- ```
103
-
104
- 该文件包含最新 query、context pack 路径和 `matchIds`,供后续流程快速读取最近一次知识上下文。
105
-
106
- ## Interpretation Rules
107
-
108
- - `active`:可优先采用,但仍要结合当前代码验证。
109
- - `candidate`:有参考价值,不是当前事实。
110
- - `stale`:只能作为历史线索,必须重新检查代码和归档。
111
- - `superseded` / `conflicted`:必须显式提示风险,不得静默采用。
112
-
113
- ## Forbidden Actions
114
-
115
- - rebuild_index_without_need
116
- - treat_candidate_as_current_fact
117
- - treat_stale_as_current_fact
118
- - skip_context_pack_before_planning
119
- - copy_large_archive_content_into_prompt
120
-
121
- ## Verification
122
-
123
- ```powershell
124
- powershell.exe -Command "python -m unittest '<ingest-skill-dir>\tests\test_harness_knowledge.py'"
125
- powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<real-project-root>' --query '<真实需求>'"
126
- ```
127
-
128
- 确认输出中存在 `contextPack`、`planInput.kind=harness-knowledge-context-pack`,且 context pack 文件包含 `Before planning`。
129
-
130
- ## P0 执行可信度规则
131
-
132
- - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
133
- - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
134
- - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
135
-
136
- ## Output Format
137
-
138
- 执行完成后展示:
139
-
140
- - 用户需求原文与生效的过滤条件(`--file`/`--status`/`--type`/`--limit`)。
141
- - `matchCount` 与按状态分组的命中数(active/candidate/stale/superseded/conflicted)。
142
- - `contextPack` 路径与 `latest.json` 指针。
143
- - 命中 stale/superseded/conflicted 时显式提示风险。
144
- - 下一步建议(context pack 已就绪 → 进入 `/harness-plan`;索引过期 → 先 `sync --update`)。
145
-
146
- ## 渐进披露
147
-
148
- - 本 skill 暂无 `checklist.md` / `reference.md` 支持文件,规则全部在 SKILL.md。若 Output Contract / Interpretation Rules 后续扩展变重,应拆到 `reference.md`。
149
-
150
- ## 交互白名单
151
-
152
- **无** AskUserQuestion;`stale`/`conflicted` 命中记 `issue`,不阻断 query。
153
-
154
- ## 执行日志
155
-
156
- `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
157
-
158
- ```powershell
159
- python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
160
- ```
161
-
162
- > **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
163
-
164
- > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
1
+ ---
2
+ name: harness-knowledge-query
3
+ description: "根据新需求、设计任务、代码修改请求或问题排查,在规划和编码前查询 .harness/knowledge 历史上下文。适用场景:query knowledge、查找历史需求、根据归档理解需求、继续之前类似开发、生成需求上下文包。"
4
+ argument-hint: "<需求文本> [--file <path>] [--status active|candidate|stale]"
5
+ effort: medium
6
+ allowed-tools: [Bash(powershell.exe:*), Read, Write, Edit, Glob, Grep]
7
+ disallowed-tools:
8
+ - Bash(git *)
9
+ - Bash(mvn *)
10
+ - Bash(ls *)
11
+ - Bash(find *)
12
+ - Bash(grep *)
13
+ - Bash(cat *)
14
+ - Bash(cp *)
15
+ - Bash(mv *)
16
+ - Bash(rm *)
17
+ - Bash(mkdir *)
18
+ - Bash(touch *)
19
+ - Bash(sed *)
20
+ - Bash(awk *)
21
+ - Bash(curl *)
22
+ ---
23
+ <!-- generated by harness_deploy.py; core=76dd32302df53f0b; overlay=none; do not edit -->
24
+ # harness-knowledge-query
25
+
26
+ 根据用户的新需求或排查问题,从项目本地 `.harness/knowledge` 中检索历史需求、决策、实现、风险和测试证据,并生成 AI 可读的 context pack。
27
+
28
+ 此 skill 只负责查询和使用知识。整理、同步和 promote 条目由 `harness-knowledge-ingest` 负责。
29
+
30
+ ## Triggers
31
+
32
+ - query knowledge
33
+ - knowledge query
34
+ - 查找相关历史需求
35
+ - 根据历史归档理解这个需求
36
+ - 结合之前做过的内容
37
+ - 继续之前类似开发
38
+ - 生成需求上下文包
39
+ - 在规划前查历史
40
+
41
+ ## Automatic Use
42
+
43
+ 当用户提出新功能、改造、排查、设计方案、继续历史任务,且项目存在 `.harness/archive` 或 `.harness/knowledge` 时,AI 应主动运行本 skill,不需要等用户提醒。
44
+
45
+ 如果 `.harness/knowledge/index.json` 不存在或已过期,先运行:
46
+
47
+ ```powershell
48
+ powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>' --update"
49
+ ```
50
+
51
+ 然后再查询。
52
+
53
+ ## Commands
54
+
55
+ `<ingest-skill-dir>` 指同级 `harness-knowledge-ingest/` 目录;查询逻辑复用其脚本。所有 python 脚本命令通过 `powershell.exe -Command "..."` 执行,避开 Bash 在 Windows 中文路径下的编码/参数问题。
56
+
57
+ ### Query by requirement
58
+
59
+ ```powershell
60
+ powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<用户需求原文>'"
61
+ ```
62
+
63
+ ### Query with metadata filters
64
+
65
+ ```powershell
66
+ powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<需求或关键词>' --file '<source-file>' --status active"
67
+ ```
68
+
69
+ 可重复使用:
70
+
71
+ - `--file <path>`:只返回关联到指定文件的知识。
72
+ - `--status active|candidate|stale|superseded|conflicted`:按生命周期过滤。
73
+ - `--type requirement|decision|implementation|risk|test-evidence|pitfall|api-contract`:按知识类型过滤。
74
+ - `--limit <n>`:限制返回数量。
75
+
76
+ ## Workflow
77
+
78
+ 1. 确认项目根目录。
79
+ 2. 运行 `sync --project <root>`。
80
+ 3. 如果 `upToDate=false`,运行 `sync --update`。
81
+ 4. 用用户原始需求作为 `--query` 查询。
82
+ 5. 如已知道相关文件,追加 `--file` 过滤。
83
+ 6. 读取 JSON 输出中的 `contextPack`。
84
+ 7. 在 `harness-plan`、设计、代码探索或实现前,把 context pack 当作必读输入。
85
+
86
+ ## Output Contract
87
+
88
+ 查询输出 JSON 包含:
89
+
90
+ - `matchCount`
91
+ - `contextPack`
92
+ - `filters`
93
+ - `planInput`
94
+ - `matches`
95
+
96
+ `planInput.kind` 必须为 `harness-knowledge-context-pack`。后续 `harness-plan` 应读取 `planInput.path`。
97
+
98
+ 每次查询还会更新稳定指针:
99
+
100
+ ```text
101
+ .harness/knowledge/context-packs/latest.json
102
+ ```
103
+
104
+ 该文件包含最新 query、context pack 路径和 `matchIds`,供后续流程快速读取最近一次知识上下文。
105
+
106
+ ## Interpretation Rules
107
+
108
+ - `active`:可优先采用,但仍要结合当前代码验证。
109
+ - `candidate`:有参考价值,不是当前事实。
110
+ - `stale`:只能作为历史线索,必须重新检查代码和归档。
111
+ - `superseded` / `conflicted`:必须显式提示风险,不得静默采用。
112
+
113
+ ## Forbidden Actions
114
+
115
+ - rebuild_index_without_need
116
+ - treat_candidate_as_current_fact
117
+ - treat_stale_as_current_fact
118
+ - skip_context_pack_before_planning
119
+ - copy_large_archive_content_into_prompt
120
+
121
+ ## Verification
122
+
123
+ ```powershell
124
+ powershell.exe -Command "python -m unittest '<ingest-skill-dir>\tests\test_harness_knowledge.py'"
125
+ powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<real-project-root>' --query '<真实需求>'"
126
+ ```
127
+
128
+ 确认输出中存在 `contextPack`、`planInput.kind=harness-knowledge-context-pack`,且 context pack 文件包含 `Before planning`。
129
+
130
+ ## P0 执行可信度规则
131
+
132
+ - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
133
+ - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
134
+ - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
135
+
136
+ ## Output Format
137
+
138
+ 执行完成后展示:
139
+
140
+ - 用户需求原文与生效的过滤条件(`--file`/`--status`/`--type`/`--limit`)。
141
+ - `matchCount` 与按状态分组的命中数(active/candidate/stale/superseded/conflicted)。
142
+ - `contextPack` 路径与 `latest.json` 指针。
143
+ - 命中 stale/superseded/conflicted 时显式提示风险。
144
+ - 下一步建议(context pack 已就绪 → 进入 `/harness-plan`;索引过期 → 先 `sync --update`)。
145
+
146
+ ## 渐进披露
147
+
148
+ - 本 skill 暂无 `checklist.md` / `reference.md` 支持文件,规则全部在 SKILL.md。若 Output Contract / Interpretation Rules 后续扩展变重,应拆到 `reference.md`。
149
+
150
+ ## 交互白名单
151
+
152
+ **无** AskUserQuestion;`stale`/`conflicted` 命中记 `issue`,不阻断 query。
153
+
154
+ ## 执行日志
155
+
156
+ `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
157
+
158
+ ```powershell
159
+ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
160
+ ```
161
+
162
+ > **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
163
+
164
+ > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
@@ -1,127 +1,127 @@
1
- ---
2
- name: harness-plan
3
- description: "将需求转化为设计文档+实施计划+完整测试场景表,必须在编码前完成。使用场景:需求分析、feature plan、技术方案设计、实现方案规划"
4
- argument-hint: "需求描述 | --adversarial"
5
- effort: high
6
- allowed-tools: [Read, Glob, Grep, Edit, Write, Agent, Bash(powershell.exe:*)]
7
- disallowed-tools:
8
- - Bash(git *)
9
- - Bash(mvn *)
10
- - Bash(ls *)
11
- - Bash(find *)
12
- - Bash(grep *)
13
- - Bash(cat *)
14
- - Bash(cp *)
15
- - Bash(mv *)
16
- - Bash(rm *)
17
- - Bash(mkdir *)
18
- - Bash(touch *)
19
- - Bash(sed *)
20
- - Bash(awk *)
21
- - Bash(curl *)
22
- ---
23
- <!-- generated by harness_deploy.py; core=63af4c482d21b6be; overlay=none; do not edit -->
24
- # harness-plan — 需求规划
25
-
26
- ## Purpose
27
-
28
- 需求 → 设计文档 → 任务拆分 → 测试场景表(编码/测试唯一真相源)。存在 `.harness/archive/` 或 `.harness/knowledge/` 时须先 `harness-knowledge-query`。
29
-
30
- ## When to Use
31
-
32
- `/harness-plan`、新功能设计、技术方案、测试场景表规划。
33
-
34
- ## 统一读取协议
35
-
36
- 1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
37
- 2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
38
- 3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
39
- 4. **spec** — 设计真相源:`spec/<change>-design.md`
40
- 5. **plan** — 任务真相源:`plans/<change>-plan.md`
41
- 6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
42
- 7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
43
- 8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
44
-
45
- 状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
46
-
47
- ## Worktree 门禁
48
-
49
- 读取 `meta/worktree.json`(兼容旧路径 `worktree.json`):
50
-
51
- | 条件 | 行为 |
52
- |------|------|
53
- | `requested=false` | 主目录执行 |
54
- | `requested=true` + path 存在 | 切换 worktree 执行 |
55
- | `requested=true` + path 不存在 | **必须创建**(run)或 **停止**(test/review/submit) |
56
-
57
- **严禁** `requested=true` 时静默回主目录。创建失败 → 停止或 AskUserQuestion 降级(须 🟡WARN + 用户确认)。
58
-
59
- **状态与代码分离**:代码/编译/测试在 `worktreeRoot`;`stateDir`(logs/events/ledger/reports)写回 `.harness/changes/<change-name>/`。
60
-
61
- 创建命令与 JSON 模板 → 各 skill `reference.md`(plan 写决策,run 创建/更新)。
62
-
63
- ## 原生规划协议
64
-
65
- 内化为 `protocols.md`:`clarification-protocol`、`decision-grilling-protocol`、`implementation-planning-protocol`。不运行时调用 Superpowers/grill-me。
66
-
67
- ## Subagent 委派
68
-
69
- - **阶段 3 探索**:`check-agents --agent harness-explorer` → 可用则委派,否则主会话探索;无效返回不 retry
70
- - **阶段 7.5**:仅 `--adversarial`;`check-agents --agent harness-evaluator` → `reports/plan-review/`
71
-
72
- ## Workflow 概要
73
-
74
- | 阶段 | 动作 |
75
- |------|------|
76
- | 0 | git status;脏工作区 → baseline 隔离 + `decision`,不询问 |
77
- | 0.5 | `harness-knowledge-query`(失败记 `issue`) |
78
- | 1 | 自动生成 change-name + 初始化 logs/events |
79
- | 2–3 | 代码探索 + 需求澄清(高风险 → 交互白名单 ②) |
80
- | 4 | **设计审批包** AskUserQuestion → 写 `spec/*-design.md` + `meta/worktree.json` |
81
- | 5–6 | plan + implementation-detail + test-scenarios → `plans/` |
82
- | 7.5 | 仅 `--adversarial` 对抗评审 |
83
- | 8 | 产物完整性必检 → `checklist.md` |
84
-
85
- change-name 范围变更 → 提示重命名或记 🟡WARN(→ `reference.md`)
86
-
87
- ## P0 执行可信度规则
88
-
89
- - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
90
- - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
91
- - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
92
-
93
- ## 关键规则
94
-
95
- | 规则 | 要点 |
96
- |------|------|
97
- | 产物路径 | 只写 `.harness/changes/<cn>/`;禁止 superpowers 输入 |
98
- | 设计审批包 | 一次 AskUserQuestion 含 worktree(读 `harness.json` `defaultWorktree`) |
99
- | 阶段 8 | spec/plan/detail/scenarios/worktree.json/logs/events 缺一不可 → ❌FAIL |
100
- | Plan 结束 | **禁止**询问执行模式;只提示 `/harness-run` |
101
- | 知识查询 | 0.5 失败不得假装已读历史 |
102
- | 协议 | sensitive-info / evidence-based-reporting / state-layout |
103
-
104
- 产出物表、frontmatter、legacy 兼容、结束输出模板 → `reference.md`
105
-
106
- ## 渐进披露
107
-
108
- - **Read `checklist.md`** — 阶段检查与覆盖表
109
- - **Read `protocols.md`** — 阶段 4/6 原生协议
110
- - **Read `reference.md`** — 模板与 worktree JSON
111
-
112
- ## 交互白名单
113
-
114
- 1. **设计审批包**(阶段 4):设计 + 场景表 + worktree + change-name
115
- 2. **decision-grilling**(阶段 3 澄清):高风险业务裁决(一次一问)
116
-
117
- ## 执行日志
118
-
119
- `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
120
-
121
- ```powershell
122
- python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
123
- ```
124
-
125
- > **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
126
-
127
- > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
1
+ ---
2
+ name: harness-plan
3
+ description: "将需求转化为设计文档+实施计划+完整测试场景表,必须在编码前完成。使用场景:需求分析、feature plan、技术方案设计、实现方案规划"
4
+ argument-hint: "需求描述 | --adversarial"
5
+ effort: high
6
+ allowed-tools: [Read, Glob, Grep, Edit, Write, Agent, Bash(powershell.exe:*)]
7
+ disallowed-tools:
8
+ - Bash(git *)
9
+ - Bash(mvn *)
10
+ - Bash(ls *)
11
+ - Bash(find *)
12
+ - Bash(grep *)
13
+ - Bash(cat *)
14
+ - Bash(cp *)
15
+ - Bash(mv *)
16
+ - Bash(rm *)
17
+ - Bash(mkdir *)
18
+ - Bash(touch *)
19
+ - Bash(sed *)
20
+ - Bash(awk *)
21
+ - Bash(curl *)
22
+ ---
23
+ <!-- generated by harness_deploy.py; core=76dd32302df53f0b; overlay=none; do not edit -->
24
+ # harness-plan — 需求规划
25
+
26
+ ## Purpose
27
+
28
+ 需求 → 设计文档 → 任务拆分 → 测试场景表(编码/测试唯一真相源)。存在 `.harness/archive/` 或 `.harness/knowledge/` 时须先 `harness-knowledge-query`。
29
+
30
+ ## When to Use
31
+
32
+ `/harness-plan`、新功能设计、技术方案、测试场景表规划。
33
+
34
+ ## 统一读取协议
35
+
36
+ 1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
37
+ 2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
38
+ 3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
39
+ 4. **spec** — 设计真相源:`spec/<change>-design.md`
40
+ 5. **plan** — 任务真相源:`plans/<change>-plan.md`
41
+ 6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
42
+ 7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
43
+ 8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
44
+
45
+ 状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
46
+
47
+ ## Worktree 门禁
48
+
49
+ 读取 `meta/worktree.json`(兼容旧路径 `worktree.json`):
50
+
51
+ | 条件 | 行为 |
52
+ |------|------|
53
+ | `requested=false` | 主目录执行 |
54
+ | `requested=true` + path 存在 | 切换 worktree 执行 |
55
+ | `requested=true` + path 不存在 | **必须创建**(run)或 **停止**(test/review/submit) |
56
+
57
+ **严禁** `requested=true` 时静默回主目录。创建失败 → 停止或 AskUserQuestion 降级(须 🟡WARN + 用户确认)。
58
+
59
+ **状态与代码分离**:代码/编译/测试在 `worktreeRoot`;`stateDir`(logs/events/ledger/reports)写回 `.harness/changes/<change-name>/`。
60
+
61
+ 创建命令与 JSON 模板 → 各 skill `reference.md`(plan 写决策,run 创建/更新)。
62
+
63
+ ## 原生规划协议
64
+
65
+ 内化为 `protocols.md`:`clarification-protocol`、`decision-grilling-protocol`、`implementation-planning-protocol`。不运行时调用 Superpowers/grill-me。
66
+
67
+ ## Subagent 委派
68
+
69
+ - **阶段 3 探索**:`check-agents --agent harness-explorer` → 可用则委派,否则主会话探索;无效返回不 retry
70
+ - **阶段 7.5**:仅 `--adversarial`;`check-agents --agent harness-evaluator` → `reports/plan-review/`
71
+
72
+ ## Workflow 概要
73
+
74
+ | 阶段 | 动作 |
75
+ |------|------|
76
+ | 0 | git status;脏工作区 → baseline 隔离 + `decision`,不询问 |
77
+ | 0.5 | `harness-knowledge-query`(失败记 `issue`) |
78
+ | 1 | 自动生成 change-name + 初始化 logs/events |
79
+ | 2–3 | 代码探索 + 需求澄清(高风险 → 交互白名单 ②) |
80
+ | 4 | **设计审批包** AskUserQuestion → 写 `spec/*-design.md` + `meta/worktree.json` |
81
+ | 5–6 | plan + implementation-detail + test-scenarios → `plans/` |
82
+ | 7.5 | 仅 `--adversarial` 对抗评审 |
83
+ | 8 | 产物完整性必检 → `checklist.md` |
84
+
85
+ change-name 范围变更 → 提示重命名或记 🟡WARN(→ `reference.md`)
86
+
87
+ ## P0 执行可信度规则
88
+
89
+ - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
90
+ - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
91
+ - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
92
+
93
+ ## 关键规则
94
+
95
+ | 规则 | 要点 |
96
+ |------|------|
97
+ | 产物路径 | 只写 `.harness/changes/<cn>/`;禁止 superpowers 输入 |
98
+ | 设计审批包 | 一次 AskUserQuestion 含 worktree(读 `harness.json` `defaultWorktree`) |
99
+ | 阶段 8 | spec/plan/detail/scenarios/worktree.json/logs/events 缺一不可 → ❌FAIL |
100
+ | Plan 结束 | **禁止**询问执行模式;只提示 `/harness-run` |
101
+ | 知识查询 | 0.5 失败不得假装已读历史 |
102
+ | 协议 | sensitive-info / evidence-based-reporting / state-layout |
103
+
104
+ 产出物表、frontmatter、legacy 兼容、结束输出模板 → `reference.md`
105
+
106
+ ## 渐进披露
107
+
108
+ - **Read `checklist.md`** — 阶段检查与覆盖表
109
+ - **Read `protocols.md`** — 阶段 4/6 原生协议
110
+ - **Read `reference.md`** — 模板与 worktree JSON
111
+
112
+ ## 交互白名单
113
+
114
+ 1. **设计审批包**(阶段 4):设计 + 场景表 + worktree + change-name
115
+ 2. **decision-grilling**(阶段 3 澄清):高风险业务裁决(一次一问)
116
+
117
+ ## 执行日志
118
+
119
+ `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
120
+
121
+ ```powershell
122
+ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
123
+ ```
124
+
125
+ > **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
126
+
127
+ > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。