hunter-harness 0.1.3 → 0.2.1

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 (149) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +11 -0
  3. package/dist/bin.js +1540 -491
  4. package/package.json +9 -7
  5. package/resources/harness/general/.harness-build.json +0 -5
  6. package/resources/harness/general/CONTEXT.md +0 -65
  7. package/resources/harness/general/README.md +0 -478
  8. package/resources/harness/general/agents/harness-evaluator.md +0 -96
  9. package/resources/harness/general/agents/harness-explorer.md +0 -72
  10. package/resources/harness/general/agents/harness-reviewer.md +0 -69
  11. package/resources/harness/general/harness-archive/SKILL.md +0 -215
  12. package/resources/harness/general/harness-archive/checklist.md +0 -52
  13. package/resources/harness/general/harness-archive/reference.md +0 -103
  14. package/resources/harness/general/harness-archive/scripts/gen-manifest.ps1 +0 -31
  15. package/resources/harness/general/harness-archive/templates/render-summary.mjs +0 -171
  16. package/resources/harness/general/harness-archive/templates/summary-data-template.json +0 -128
  17. package/resources/harness/general/harness-codebase-map/SKILL.md +0 -112
  18. package/resources/harness/general/harness-codebase-map/checklist.md +0 -126
  19. package/resources/harness/general/harness-codebase-map/reference.md +0 -364
  20. package/resources/harness/general/harness-codebase-map/templates/ARCHITECTURE.md +0 -57
  21. package/resources/harness/general/harness-codebase-map/templates/CONCERNS.md +0 -49
  22. package/resources/harness/general/harness-codebase-map/templates/CONVENTIONS.md +0 -57
  23. package/resources/harness/general/harness-codebase-map/templates/INTEGRATIONS.md +0 -52
  24. package/resources/harness/general/harness-codebase-map/templates/STACK.md +0 -55
  25. package/resources/harness/general/harness-codebase-map/templates/STRUCTURE.md +0 -69
  26. package/resources/harness/general/harness-codebase-map/templates/TESTING.md +0 -64
  27. package/resources/harness/general/harness-codebase-map/templates/map-manifest.schema.json +0 -73
  28. package/resources/harness/general/harness-codebase-map/templates/map-summary.md +0 -64
  29. package/resources/harness/general/harness-knowledge-ingest/SKILL.md +0 -246
  30. package/resources/harness/general/harness-knowledge-ingest/design.md +0 -842
  31. package/resources/harness/general/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +0 -42
  32. package/resources/harness/general/harness-knowledge-ingest/mcp-config.example.json +0 -10
  33. package/resources/harness/general/harness-knowledge-ingest/reference.md +0 -309
  34. package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge.py +0 -4082
  35. package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +0 -273
  36. package/resources/harness/general/harness-knowledge-query/SKILL.md +0 -164
  37. package/resources/harness/general/harness-plan/SKILL.md +0 -127
  38. package/resources/harness/general/harness-plan/checklist.md +0 -243
  39. package/resources/harness/general/harness-plan/protocols.md +0 -124
  40. package/resources/harness/general/harness-plan/reference.md +0 -376
  41. package/resources/harness/general/harness-review/SKILL.md +0 -156
  42. package/resources/harness/general/harness-review/checklist.md +0 -124
  43. package/resources/harness/general/harness-review/protocols.md +0 -68
  44. package/resources/harness/general/harness-review/reference.md +0 -86
  45. package/resources/harness/general/harness-run/SKILL.md +0 -132
  46. package/resources/harness/general/harness-run/checklist.md +0 -259
  47. package/resources/harness/general/harness-run/protocols.md +0 -78
  48. package/resources/harness/general/harness-run/reference.md +0 -834
  49. package/resources/harness/general/harness-submit/SKILL.md +0 -159
  50. package/resources/harness/general/harness-submit/checklist.md +0 -407
  51. package/resources/harness/general/harness-submit/reference.md +0 -152
  52. package/resources/harness/general/harness-sync/SKILL.md +0 -82
  53. package/resources/harness/general/harness-sync/reference.md +0 -153
  54. package/resources/harness/general/harness-test/SKILL.md +0 -180
  55. package/resources/harness/general/harness-test/checklist.md +0 -319
  56. package/resources/harness/general/harness-test/pitfalls.md +0 -260
  57. package/resources/harness/general/harness-test/reference.md +0 -791
  58. package/resources/harness/general/protocols/archive-report-protocol.md +0 -175
  59. package/resources/harness/general/protocols/evidence-based-reporting-protocol.md +0 -134
  60. package/resources/harness/general/protocols/ledger-protocol.md +0 -270
  61. package/resources/harness/general/protocols/powershell-protocol.md +0 -181
  62. package/resources/harness/general/protocols/report-pipeline-protocol.md +0 -150
  63. package/resources/harness/general/protocols/sensitive-info-protocol.md +0 -92
  64. package/resources/harness/general/protocols/state-layout-protocol.md +0 -131
  65. package/resources/harness/general/protocols/submit-protocol.md +0 -78
  66. package/resources/harness/general/scripts/harness_archive.py +0 -2319
  67. package/resources/harness/general/scripts/harness_deploy.py +0 -613
  68. package/resources/harness/general/scripts/harness_events.py +0 -680
  69. package/resources/harness/general/scripts/harness_ledger.py +0 -671
  70. package/resources/harness/general/scripts/harness_preflight.py +0 -780
  71. package/resources/harness/general/scripts/harness_service.py +0 -1331
  72. package/resources/harness/java/.harness-build.json +0 -5
  73. package/resources/harness/java/CONTEXT.md +0 -65
  74. package/resources/harness/java/README.md +0 -478
  75. package/resources/harness/java/agents/harness-evaluator.md +0 -96
  76. package/resources/harness/java/agents/harness-explorer.md +0 -72
  77. package/resources/harness/java/agents/harness-reviewer.md +0 -69
  78. package/resources/harness/java/harness-apidoc/SKILL.md +0 -86
  79. package/resources/harness/java/harness-apidoc/checklist.md +0 -142
  80. package/resources/harness/java/harness-apidoc/reference.md +0 -233
  81. package/resources/harness/java/harness-archive/SKILL.md +0 -215
  82. package/resources/harness/java/harness-archive/checklist.md +0 -52
  83. package/resources/harness/java/harness-archive/reference.md +0 -103
  84. package/resources/harness/java/harness-archive/scripts/gen-manifest.ps1 +0 -31
  85. package/resources/harness/java/harness-archive/templates/render-summary.mjs +0 -171
  86. package/resources/harness/java/harness-archive/templates/summary-data-template.json +0 -128
  87. package/resources/harness/java/harness-codebase-map/SKILL.md +0 -112
  88. package/resources/harness/java/harness-codebase-map/checklist.md +0 -126
  89. package/resources/harness/java/harness-codebase-map/reference.md +0 -364
  90. package/resources/harness/java/harness-codebase-map/templates/ARCHITECTURE.md +0 -57
  91. package/resources/harness/java/harness-codebase-map/templates/CONCERNS.md +0 -49
  92. package/resources/harness/java/harness-codebase-map/templates/CONVENTIONS.md +0 -57
  93. package/resources/harness/java/harness-codebase-map/templates/INTEGRATIONS.md +0 -52
  94. package/resources/harness/java/harness-codebase-map/templates/STACK.md +0 -55
  95. package/resources/harness/java/harness-codebase-map/templates/STRUCTURE.md +0 -69
  96. package/resources/harness/java/harness-codebase-map/templates/TESTING.md +0 -64
  97. package/resources/harness/java/harness-codebase-map/templates/map-manifest.schema.json +0 -73
  98. package/resources/harness/java/harness-codebase-map/templates/map-summary.md +0 -64
  99. package/resources/harness/java/harness-knowledge-ingest/SKILL.md +0 -246
  100. package/resources/harness/java/harness-knowledge-ingest/design.md +0 -842
  101. package/resources/harness/java/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +0 -42
  102. package/resources/harness/java/harness-knowledge-ingest/mcp-config.example.json +0 -10
  103. package/resources/harness/java/harness-knowledge-ingest/reference.md +0 -309
  104. package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge.py +0 -4082
  105. package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +0 -273
  106. package/resources/harness/java/harness-knowledge-query/SKILL.md +0 -164
  107. package/resources/harness/java/harness-package/SKILL.md +0 -87
  108. package/resources/harness/java/harness-package/checklist.md +0 -322
  109. package/resources/harness/java/harness-package/reference.md +0 -210
  110. package/resources/harness/java/harness-plan/SKILL.md +0 -127
  111. package/resources/harness/java/harness-plan/checklist.md +0 -243
  112. package/resources/harness/java/harness-plan/protocols.md +0 -124
  113. package/resources/harness/java/harness-plan/reference.md +0 -376
  114. package/resources/harness/java/harness-review/SKILL.md +0 -156
  115. package/resources/harness/java/harness-review/checklist.md +0 -124
  116. package/resources/harness/java/harness-review/protocols.md +0 -68
  117. package/resources/harness/java/harness-review/reference.md +0 -86
  118. package/resources/harness/java/harness-run/SKILL.md +0 -148
  119. package/resources/harness/java/harness-run/checklist.md +0 -250
  120. package/resources/harness/java/harness-run/protocols.md +0 -78
  121. package/resources/harness/java/harness-run/reference.md +0 -814
  122. package/resources/harness/java/harness-submit/SKILL.md +0 -166
  123. package/resources/harness/java/harness-submit/checklist.md +0 -407
  124. package/resources/harness/java/harness-submit/reference.md +0 -152
  125. package/resources/harness/java/harness-sync/SKILL.md +0 -82
  126. package/resources/harness/java/harness-sync/reference.md +0 -153
  127. package/resources/harness/java/harness-test/SKILL.md +0 -192
  128. package/resources/harness/java/harness-test/checklist.md +0 -317
  129. package/resources/harness/java/harness-test/pitfalls-java.md +0 -16
  130. package/resources/harness/java/harness-test/pitfalls.md +0 -260
  131. package/resources/harness/java/harness-test/reference.md +0 -788
  132. package/resources/harness/java/protocols/archive-report-protocol.md +0 -175
  133. package/resources/harness/java/protocols/evidence-based-reporting-protocol.md +0 -134
  134. package/resources/harness/java/protocols/ledger-protocol.md +0 -270
  135. package/resources/harness/java/protocols/powershell-protocol.md +0 -181
  136. package/resources/harness/java/protocols/report-pipeline-protocol.md +0 -150
  137. package/resources/harness/java/protocols/sensitive-info-protocol.md +0 -92
  138. package/resources/harness/java/protocols/state-layout-protocol.md +0 -131
  139. package/resources/harness/java/protocols/submit-protocol.md +0 -78
  140. package/resources/harness/java/scripts/harness_archive.py +0 -2319
  141. package/resources/harness/java/scripts/harness_deploy.py +0 -613
  142. package/resources/harness/java/scripts/harness_events.py +0 -680
  143. package/resources/harness/java/scripts/harness_ledger.py +0 -671
  144. package/resources/harness/java/scripts/harness_preflight.py +0 -780
  145. package/resources/harness/java/scripts/harness_service.py +0 -1331
  146. package/resources/harness/manifests/general.json +0 -276
  147. package/resources/harness/manifests/java.json +0 -304
  148. package/resources/harness/migrations/0.1.1/general.json +0 -358
  149. package/resources/harness/migrations/0.1.1/java.json +0 -398
@@ -1,42 +0,0 @@
1
- <evaluation>
2
- <qa_pair>
3
- <question>Using the project tests/fixtures/mcp-eval-project, identify the component first documented as the single source of truth for billing reconciliation. Answer with the component name only.</question>
4
- <answer>LedgerReconciler</answer>
5
- </qa_pair>
6
- <qa_pair>
7
- <question>Using the project tests/fixtures/mcp-eval-project, find the later component that replaced the original billing reconciliation source-of-truth assumption for final published output. Answer with the component name only.</question>
8
- <answer>SettlementSnapshot</answer>
9
- </qa_pair>
10
- <qa_pair>
11
- <question>Using the project tests/fixtures/mcp-eval-project, what file introduced the final published reconciliation output object? Answer with the exact file path.</question>
12
- <answer>src/billing/settlement_snapshot.py</answer>
13
- </qa_pair>
14
- <qa_pair>
15
- <question>Using the project tests/fixtures/mcp-eval-project, which test file validates the original billing reconciliation component? Answer with the exact file path.</question>
16
- <answer>tests/test_ledger_reconciler.py</answer>
17
- </qa_pair>
18
- <qa_pair>
19
- <question>Using the project tests/fixtures/mcp-eval-project, what migration must run before the January ledger release? Answer with the migration id only.</question>
20
- <answer>2026-01-ledger-baseline</answer>
21
- </qa_pair>
22
- <qa_pair>
23
- <question>Using the project tests/fixtures/mcp-eval-project, what HTTP header carries the webhook signature? Answer with the header name only.</question>
24
- <answer>X-Harness-Signature</answer>
25
- </qa_pair>
26
- <qa_pair>
27
- <question>Using the project tests/fixtures/mcp-eval-project, what is the retry backoff cap for partner payout webhook notifications? Answer with the duration phrase only.</question>
28
- <answer>30 minutes</answer>
29
- </qa_pair>
30
- <qa_pair>
31
- <question>Using the project tests/fixtures/mcp-eval-project, how many files changed in the webhook contract archive? Answer with a number only.</question>
32
- <answer>2</answer>
33
- </qa_pair>
34
- <qa_pair>
35
- <question>Using the project tests/fixtures/mcp-eval-project, what risk can break signature timestamp validation? Answer with the exact risk sentence.</question>
36
- <answer>Partner sandbox clock skew may break signature timestamp validation.</answer>
37
- </qa_pair>
38
- <qa_pair>
39
- <question>Using the project tests/fixtures/mcp-eval-project, what project id is declared for the fixture project? Answer with the project id only.</question>
40
- <answer>harness-knowledge-mcp-eval</answer>
41
- </qa_pair>
42
- </evaluation>
@@ -1,10 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "harness-knowledge": {
4
- "command": "python",
5
- "args": [
6
- "scripts/harness_knowledge_mcp.py"
7
- ]
8
- }
9
- }
10
- }
@@ -1,309 +0,0 @@
1
- ---
2
- description: harness-knowledge-ingest 的命令详细示例、config.json 配置参考与变更日志。仅在执行命令或查阅配置时读取。
3
- ---
4
-
5
- # harness-knowledge-ingest 参考
6
-
7
- 本文件为 `harness-knowledge-ingest` 的渐进披露支持文件,承载 Commands 详细示例与变更日志。SKILL.md 只保留概要 + 渐进披露引用。`<skill-dir>` 指本 skill 目录,即 `.claude/skills/harness-knowledge-ingest/` 或知识库源目录中的 `harness-knowledge-ingest/`。所有 python 脚本命令通过 `powershell.exe -Command "..."` 执行,避开 Bash 在 Windows 中文路径下的编码/参数问题。
8
-
9
- ## Commands 详细
10
-
11
- ### Auto maintenance
12
-
13
- 如果只是想让 skill 自己完成常规知识库防腐,优先跑 `auto`:
14
-
15
- ```powershell
16
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto --project '<project-root>'"
17
- ```
18
-
19
- `auto` 会按默认维护顺序执行:首建 `config.json`(若缺失)、`sync --update`、只读 `suggest-validators`、`verify`、`audit`。首次发现 `.harness/knowledge/config.json` 不存在时,`auto` 会自动写入启用版 `autoPromote` 配置,并让本次运行立刻按 confidence 规则提升满足门槛的长期知识。默认不会把 validator 建议写回条目;确认要把建议写入后再执行:
20
-
21
- ```powershell
22
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto --project '<project-root>' --apply-suggestions --suggest-status candidate"
23
- ```
24
-
25
- 常用参数:
26
- - `--limit <n>`:限制本次 validator 建议的条目数。
27
- - `--audit-limit <n>`:限制各类审计清单条目数。
28
- - `--suggest-status active|candidate`:限定生成 validator 建议的 lifecycle,可重复。
29
- - `--no-incremental`:强制不复用 archive 抽取缓存。
30
-
31
- ### Rebuild index
32
-
33
- ```powershell
34
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' ingest --project '<project-root>'"
35
- ```
36
-
37
- 生成或刷新 `.harness/knowledge`。默认启用 archive 抽取缓存,未变化 archive 会复用 `.harness/knowledge/cache/archive-entries/*.json` 的原始抽取结果,但 lifecycle 会每次全局重算。自动生成条目默认为 `candidate`;如果来源 commit 不存在、来源 commit 之后相关文件发生变化、TTL 过期,或后续 verification 失败/降级,则标记为 `stale`。
38
-
39
- 如需强制全量重抽取:
40
-
41
- ```powershell
42
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' ingest --project '<project-root>' --no-incremental"
43
- ```
44
-
45
- ### Sync knowledge
46
-
47
- ```powershell
48
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>'"
49
- ```
50
-
51
- 检查 `.harness/knowledge` 是否与 `.harness/archive` 和当前 HEAD 一致。输出 JSON 包含:
52
-
53
- - `upToDate`
54
- - `reasons`
55
- - `archiveCount`
56
- - `paths`
57
-
58
- 如果希望发现过期后自动刷新:
59
-
60
- ```powershell
61
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>' --update"
62
- ```
63
-
64
- 如需刷新时禁用抽取缓存:
65
-
66
- ```powershell
67
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>' --update --no-incremental"
68
- ```
69
-
70
- ### Verify knowledge validators
71
-
72
- ```powershell
73
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' verify --project '<project-root>'"
74
- ```
75
-
76
- `verify` 不重抽 `.harness/archive`,只读取当前 `.harness/knowledge/entries/**/*.json` 中显式声明的 `validators[]`,执行确定性检查,写回 `lifecycle.validation`,刷新 `index.json` / `index.sqlite` / `views/`,并生成 `reports/verification-report-*.md`。
77
-
78
- 支持的 validator:
79
-
80
- ```json
81
- {
82
- "validators": [
83
- {
84
- "type": "file_exists",
85
- "path": "src/billing/ledger_reconciler.py",
86
- "description": "ledger reconciler file still exists"
87
- },
88
- {
89
- "type": "file_contains",
90
- "path": "src/billing/ledger_reconciler.py",
91
- "pattern": "LedgerReconciler",
92
- "description": "source still contains LedgerReconciler"
93
- },
94
- {
95
- "type": "symbol_exists",
96
- "symbol": "LedgerReconciler",
97
- "files": ["src/billing/ledger_reconciler.py"],
98
- "description": "LedgerReconciler symbol still exists"
99
- }
100
- ]
101
- }
102
- ```
103
-
104
- `command` validator 也支持,但默认禁用;只有项目显式开启 `knowledgeValidation.allowCommandValidators=true` 时才运行,且 `command` 必须是字符串数组。
105
-
106
- ### Suggest validators
107
-
108
- ```powershell
109
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' suggest-validators --project '<project-root>' --limit 20"
110
- ```
111
-
112
- 默认只生成建议和 `reports/validator-suggestions-*.md`,不会改写 entries。建议来源是当前 entry 的 `scope.sourceFiles`、正文/标题/关键词中的稳定 token,以及项目文件中的实际内容。当前只生成安全的 `file_exists` / `file_contains` 建议。
113
-
114
- 如需把建议写入 entry JSON:
115
-
116
- ```powershell
117
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' suggest-validators --project '<project-root>' --limit 20 --apply"
118
- ```
119
-
120
- 可用 `--status active` / `--status candidate` 限定生命周期状态。建议写入后应运行 `verify --project <project-root>`,确认 validator 能实际通过。
121
-
122
- ### Promote candidate to active
123
-
124
- ```powershell
125
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' promote --project '<project-root>' --id '<entry-id>' --note '<人工确认说明>'"
126
- ```
127
-
128
- 将一条 `candidate` 提升为 `active`,写入:
129
-
130
- ```text
131
- .harness/knowledge/entries/active/<entry-id>.json
132
- ```
133
-
134
- 提升后会自动重建索引,并保留 active 条目。后续重新 ingest 时,同 ID 的 active 条目会覆盖自动生成的 candidate 条目。
135
-
136
- 默认禁止提升 `stale`。如果人工已经重新验证,可显式使用:
137
-
138
- ```powershell
139
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' promote --project '<project-root>' --id '<entry-id>' --note '<验证说明>' --allow-stale"
140
- ```
141
-
142
- ### Demote active after manual review
143
-
144
- ```powershell
145
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' demote --project '<project-root>' --id '<entry-id>' --status stale --reason '<人工复核说明>'"
146
- ```
147
-
148
- `demote` 只处理人工确认后的 `active` 条目,可降级到 `stale` 或 `candidate`。降级到 `stale` 时会写入 `manual demotion` stale reason,并在后续 ingest 中保留该人工维护条目。
149
-
150
- ### Optional active auto-demotion
151
-
152
- 默认不会自动改写 `active`。如明确希望脚本根据 `Active Review` 自动降级 active,可在 `.harness/knowledge/config.json` 中启用:
153
-
154
- ```json
155
- {
156
- "activeLifecycle": {
157
- "autoDemote": true,
158
- "targetStatus": "stale"
159
- }
160
- }
161
- ```
162
-
163
- 启用后,ingest 会把需要复核的 active 自动移动到 `targetStatus`(`stale` 或 `candidate`),记录 `lifecycle.autoDemoted=true` 和 `activeLifecycle auto-demotion` 原因。该能力只应在项目团队确认接受自动降级策略后启用。
164
-
165
- ### Optional confidence scoring and autoPromote
166
-
167
- `ingest` 会为每个 entry 写入解释型 `confidence`,包含:
168
-
169
- ```json
170
- {
171
- "confidence": {
172
- "score": 0.82,
173
- "level": "high",
174
- "signals": ["type_bonus:decision", "source_files_present:+0.03"],
175
- "lastCalculatedAt": "2026-07-01T12:00:00Z"
176
- }
177
- }
178
- ```
179
-
180
- confidence 不是“绝对正确率”,只表示当前证据强弱。分数会受条目类型、来源文件、时间衰减、stale/superseded/conflicted、validator 通过/失败、来源文件变更等信号影响。
181
-
182
- `ingest` 单独执行时不会替项目首建策略文件;`auto` 首次发现项目没有 `.harness/knowledge/config.json` 时,会写入以下启用版配置并立即应用:
183
-
184
- ```json
185
- {
186
- "autoPromote": {
187
- "enabled": true,
188
- "minConfidence": 0.82,
189
- "allowedTypes": ["decision", "api-contract", "requirement", "pitfall"],
190
- "requireValidators": false,
191
- "allowStale": false,
192
- "maxPerRun": 50
193
- },
194
- "confidence": {
195
- "ttlHalfLifeDays": 45,
196
- "sourceChangePenalty": 0.25,
197
- "stalePenalty": 0.35,
198
- "validatorPassBonus": 0.15,
199
- "validatorFailPenalty": 0.5,
200
- "supersededPenalty": 0.8,
201
- "conflictPenalty": 0.8
202
- }
203
- }
204
- ```
205
-
206
- 自动提升只处理配置允许的类型,默认排除 stale/conflicted/superseded,且会写入 `lifecycle.autoPromoted=true`、`promotionNote` 和 `promotedAt`。一次性实现细节、测试证据、风险提醒仍不应自动提升为长期事实。
207
-
208
- ### Optional validator auto-demotion
209
-
210
- 默认不会因为 validator 失败自动改写 `active`。如明确希望确定性 validator 失败时自动降级 active,可在 `.harness/knowledge/config.json` 中启用:
211
-
212
- ```json
213
- {
214
- "knowledgeValidation": {
215
- "enabled": true,
216
- "autoDemoteActive": true,
217
- "defaultTargetStatus": "stale",
218
- "allowCommandValidators": false
219
- }
220
- }
221
- ```
222
-
223
- 启用后,`ingest` 和 `verify` 会把 validator 失败的 active 条目移动到 `defaultTargetStatus`,记录 `lifecycle.validation`,并写入 `validator failed:` stale reason。该机制适合代码事实、文件存在性、符号存在性、可重复命令等确定性事实;业务意图和团队取舍仍应保持为 candidate 或人工确认后的 active。
224
-
225
- ### MCP entry point
226
-
227
- ```powershell
228
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge_mcp.py' --describe-tools"
229
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge_mcp.py'"
230
- ```
231
-
232
- `harness_knowledge_mcp.py` 默认以 stdio 运行 `FastMCP`,暴露:
233
-
234
- - `harness_knowledge_ingest`
235
- - `harness_knowledge_sync`
236
- - `harness_knowledge_auto`
237
- - `harness_knowledge_audit`
238
- - `harness_knowledge_verify`
239
- - `harness_knowledge_suggest_validators`
240
- - `harness_knowledge_query`
241
- - `harness_knowledge_promote`
242
- - `harness_knowledge_demote`
243
-
244
- ## 变更日志
245
-
246
- ## v1.7 补充能力
247
-
248
- 当前脚本额外支持:
249
-
250
- - `audit --project <root> --limit <n>`:生成 `.harness/knowledge/reports/audit-report-*.md`,包含 `Candidate Review`、`Stale Review`、`Superseded Review`、`Conflict Review`。
251
- - `entries/superseded/*.json`:当后续 archive 与旧条目有重叠文件且类型相近时,非 active 自动生成条目会被标记为 `superseded`,并写入 `lifecycle.supersededBy`。
252
- - `entries/conflicted/*.json`:当同文件、同知识类型、共享主题词且出现“唯一来源/复用”与“不再/替代/改为”等相反信号时,非 active 自动生成条目会被标记为 `conflicted`,并写入 `lifecycle.conflictsWith`。
253
- - 后续 archive 的 verification 出现失败或 pass ratio 降级时,旧的重叠 `test-evidence` 会标记为 `stale`,并写入 `newer verification degraded` stale reason。
254
- - 默认增量 ingest:未变化 archive 复用 `.harness/knowledge/cache/archive-entries/*.json` 原始抽取缓存;`--no-incremental` 可强制全量重抽取。
255
- - `scripts/harness_knowledge_mcp.py` 提供 stdio MCP server 入口和 `--describe-tools` 工具元数据输出。
256
- - `audit` 新增 `Active Review`,当 `active` 条目被后续重叠 archive、潜在冲突或 verification 降级影响时,生成人工复核清单,但不会自动改写 active。
257
- - `demote --id <entry-id> --status stale|candidate --reason <说明>`:人工确认后显式降级 active 条目,降级记录跨后续 ingest 保留。
258
- - `.harness/knowledge/views/active-review.md`:列出需要人工复核的 active 条目。
259
- - `.harness/knowledge/views/knowledge.base`:Obsidian Bases 入口,按 lifecycle folder 浏览 `.harness/knowledge/entries/**/*.json`。
260
- - `mcp-config.example.json`:MCP client 配置示例。
261
- - `evaluations/harness_knowledge_evaluation.xml` 和 `tests/fixtures/mcp-eval-project/`:固定 MCP evaluation fixture,便于后续用 evaluation harness 跑稳定问答。
262
- - `verify` 命令与 `harness_knowledge_verify` MCP 工具:执行 entry-level `validators[]`,刷新 `lifecycle.validation`,生成 `verification-report-*`。
263
- - `suggest-validators` 命令与 `harness_knowledge_suggest_validators` MCP 工具:从 entry 的 sourceFiles 和代码内容生成 validator 建议;默认只写报告,`--apply` 才写回条目。
264
- - `views/superseded-items.md`:列出被后续归档取代的知识条目。
265
- - `views/conflicted-items.md`:列出需要人工确认的潜在冲突知识条目。
266
- - SQLite 新增 `entry_files(entry_id, source_file)` 表和 `idx_entry_files_source_file`,文件路径查询不再只依赖 JSON LIKE。
267
- - `.harness/knowledge/config.json` 支持 `staleTtlDays`:当归档日期超过 TTL 时,非 `active`/`superseded` 条目会标记为 `stale`,并写入 `ttl expired` stale reason。
268
-
269
- 限制:
270
-
271
- - `superseded` 目前是保守启发式,不自动改写人工确认的 `active`。
272
- - `conflicted` 目前也是保守启发式,优先减少误报;人工确认的 `active` 不会被自动移动。
273
- - 后续 verification 降级默认只自动处理非 active 的 `test-evidence`;active 通过 `Active Review` 提醒。只有显式启用 `activeLifecycle.autoDemote` 或 `knowledgeValidation.autoDemoteActive` 后才会自动降级 active。
274
- - MCP evaluation fixture 是本 skill 的固定测试项目,不代表真实项目质量;真实项目仍需单独 smoke。
275
- - `audit` 只生成审核清单,不自动 promote。
276
-
277
- ## v1.9 补充能力
278
-
279
- - Entry 可显式声明 `validators[]`,当前支持 `file_exists`、`file_contains`、`symbol_exists`、`command`。
280
- - `command` validator 默认禁用,避免知识库条目隐式执行任意命令。
281
- - `verify --project <root>` 不重抽 archive,只对当前知识条目执行 validator,并刷新 manifest、SQLite、views 和 verification report。
282
- - `ingest` 也会执行 validator;当 `knowledgeValidation.autoDemoteActive=true` 时,失败的 active 自动降级到 `defaultTargetStatus`。
283
- - `suggest-validators` 默认生成只读建议报告;`--apply` 后写入 validators,并可立刻由 `verify` 检查。
284
- - 单测扩展到 22 个,覆盖 validator 自动降级、verify 命令、suggest-validators、MCP verify/suggest 工具描述,以及 verify 刷新时保留 SQLite 基线条目。
285
-
286
- ## v1.11 补充能力
287
-
288
- - `auto --project <root>`:一条命令完成默认安全维护流程:`sync --update`、只读 `suggest-validators`、`verify`、`audit`。
289
- - MCP 新增 `harness_knowledge_auto`,给 agent 直接调用同一套维护流程。
290
- - 默认 `auto` 不会写回 validator 建议;只有显式传入 `--apply-suggestions` 才会修改 entry JSON,并随后由 `verify` 检查。
291
- - `--suggest-status active|candidate` 可限制写入或建议范围;建议真实项目首次使用仍优先只读跑报告。
292
- - 单测扩展到 24 个,覆盖 `auto` 的只读默认路径、显式 apply 路径,以及 MCP tool metadata。
293
-
294
- ## v1.12 补充能力
295
-
296
- - `ingest` 为所有 entry 写入 `confidence.score`、`confidence.level`、`confidence.signals` 和 `lastCalculatedAt`,让 agent 可以按证据强弱排序和解释判断。
297
- - `.harness/knowledge/config.json` 支持 `autoPromote`:默认关闭,显式启用后只会提升配置允许类型中满足 `minConfidence` 的 candidate。
298
- - autoPromote 默认排除 stale/conflicted/superseded,不处理一次性 implementation、test-evidence、risk;自动提升会记录 `lifecycle.autoPromoted=true`、`promotionNote` 和 `promotedAt`。
299
- - `confidence` 配置支持时间衰减、来源变更、stale、validator、superseded/conflict 等惩罚或奖励,目标是减少人工筛选量,不是假装机器可以判断所有知识真伪。
300
- - `index.json.ingestMode` 和 ingest report 新增 `confidenceScored`、`candidateAutoPromoted`,便于 agent 在运行后直接报告结果。
301
- - 单测扩展到 34 个,覆盖 confidence 元数据、autoPromote 配置门槛、stale/age 置信度惩罚,以及既有 lifecycle/validator/auto/MCP 路径。
302
-
303
- ## v1.13 补充能力
304
-
305
- - `auto --project <root>` 首次发现 `.harness/knowledge/config.json` 不存在时,会自动写入启用版 `autoPromote` + `confidence` 配置。
306
- - 如果写入 config 时现有 index 已经 `upToDate=true`,`auto` 会主动重建一次索引,让自动提升在本轮生效,而不是等下一次运行。
307
- - `auto` JSON 输出新增 `config` 摘要:`path`、`created`、`autoPromoteEnabled`、`appliedBy`、`candidateAutoPromoted`。
308
- - `ingest` 单独命令仍不首建 config;项目策略的自动首建只发生在 `auto` 维护入口。
309
- - 单测扩展到 35 个,覆盖“已有最新 index 但缺 config 时,auto 首建启用配置并立即提升”的路径。