@hunter-harness/workflow-harness 0.2.41 → 0.2.42

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 (130) hide show
  1. package/harness/bundles/general/claude-code/.harness-build.json +1 -1
  2. package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
  3. package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
  4. package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +42 -16
  5. package/harness/bundles/general/claude-code/harness-knowledge-ingest/reference.md +57 -6
  6. package/harness/bundles/general/claude-code/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  7. package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
  8. package/harness/bundles/general/claude-code/harness-plan/SKILL.md +1 -1
  9. package/harness/bundles/general/claude-code/harness-review/SKILL.md +1 -1
  10. package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
  11. package/harness/bundles/general/claude-code/harness-submit/SKILL.md +1 -1
  12. package/harness/bundles/general/claude-code/harness-sync/SKILL.md +16 -10
  13. package/harness/bundles/general/claude-code/harness-sync/reference.md +34 -14
  14. package/harness/bundles/general/claude-code/harness-test/SKILL.md +1 -1
  15. package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
  16. package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
  17. package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
  18. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +41 -15
  19. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/reference.md +57 -6
  20. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  21. package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  22. package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +1 -1
  23. package/harness/bundles/general/codebuddy/harness-review/SKILL.md +1 -1
  24. package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
  25. package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +1 -1
  26. package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +16 -10
  27. package/harness/bundles/general/codebuddy/harness-sync/reference.md +34 -14
  28. package/harness/bundles/general/codebuddy/harness-test/SKILL.md +1 -1
  29. package/harness/bundles/general/codex/.harness-build.json +1 -1
  30. package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
  31. package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
  32. package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +41 -15
  33. package/harness/bundles/general/codex/harness-knowledge-ingest/reference.md +57 -6
  34. package/harness/bundles/general/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  35. package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
  36. package/harness/bundles/general/codex/harness-plan/SKILL.md +1 -1
  37. package/harness/bundles/general/codex/harness-review/SKILL.md +1 -1
  38. package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
  39. package/harness/bundles/general/codex/harness-submit/SKILL.md +1 -1
  40. package/harness/bundles/general/codex/harness-sync/SKILL.md +16 -10
  41. package/harness/bundles/general/codex/harness-sync/reference.md +34 -14
  42. package/harness/bundles/general/codex/harness-test/SKILL.md +1 -1
  43. package/harness/bundles/general/cursor/.harness-build.json +1 -1
  44. package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
  45. package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
  46. package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +41 -15
  47. package/harness/bundles/general/cursor/harness-knowledge-ingest/reference.md +57 -6
  48. package/harness/bundles/general/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  49. package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
  50. package/harness/bundles/general/cursor/harness-plan/SKILL.md +1 -1
  51. package/harness/bundles/general/cursor/harness-review/SKILL.md +1 -1
  52. package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
  53. package/harness/bundles/general/cursor/harness-submit/SKILL.md +1 -1
  54. package/harness/bundles/general/cursor/harness-sync/SKILL.md +16 -10
  55. package/harness/bundles/general/cursor/harness-sync/reference.md +34 -14
  56. package/harness/bundles/general/cursor/harness-test/SKILL.md +1 -1
  57. package/harness/bundles/java/claude-code/.harness-build.json +1 -1
  58. package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
  59. package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
  60. package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
  61. package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +42 -16
  62. package/harness/bundles/java/claude-code/harness-knowledge-ingest/reference.md +57 -6
  63. package/harness/bundles/java/claude-code/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  64. package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
  65. package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
  66. package/harness/bundles/java/claude-code/harness-plan/SKILL.md +1 -1
  67. package/harness/bundles/java/claude-code/harness-review/SKILL.md +1 -1
  68. package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
  69. package/harness/bundles/java/claude-code/harness-submit/SKILL.md +1 -1
  70. package/harness/bundles/java/claude-code/harness-sync/SKILL.md +16 -10
  71. package/harness/bundles/java/claude-code/harness-sync/reference.md +34 -14
  72. package/harness/bundles/java/claude-code/harness-test/SKILL.md +1 -1
  73. package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
  74. package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
  75. package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
  76. package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
  77. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +41 -15
  78. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/reference.md +57 -6
  79. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  80. package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  81. package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
  82. package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +1 -1
  83. package/harness/bundles/java/codebuddy/harness-review/SKILL.md +1 -1
  84. package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
  85. package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +1 -1
  86. package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +16 -10
  87. package/harness/bundles/java/codebuddy/harness-sync/reference.md +34 -14
  88. package/harness/bundles/java/codebuddy/harness-test/SKILL.md +1 -1
  89. package/harness/bundles/java/codex/.harness-build.json +1 -1
  90. package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
  91. package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
  92. package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
  93. package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +41 -15
  94. package/harness/bundles/java/codex/harness-knowledge-ingest/reference.md +57 -6
  95. package/harness/bundles/java/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  96. package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
  97. package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
  98. package/harness/bundles/java/codex/harness-plan/SKILL.md +1 -1
  99. package/harness/bundles/java/codex/harness-review/SKILL.md +1 -1
  100. package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
  101. package/harness/bundles/java/codex/harness-submit/SKILL.md +1 -1
  102. package/harness/bundles/java/codex/harness-sync/SKILL.md +16 -10
  103. package/harness/bundles/java/codex/harness-sync/reference.md +34 -14
  104. package/harness/bundles/java/codex/harness-test/SKILL.md +1 -1
  105. package/harness/bundles/java/cursor/.harness-build.json +1 -1
  106. package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
  107. package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
  108. package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
  109. package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +41 -15
  110. package/harness/bundles/java/cursor/harness-knowledge-ingest/reference.md +57 -6
  111. package/harness/bundles/java/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +1097 -174
  112. package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
  113. package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
  114. package/harness/bundles/java/cursor/harness-plan/SKILL.md +1 -1
  115. package/harness/bundles/java/cursor/harness-review/SKILL.md +1 -1
  116. package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
  117. package/harness/bundles/java/cursor/harness-submit/SKILL.md +1 -1
  118. package/harness/bundles/java/cursor/harness-sync/SKILL.md +16 -10
  119. package/harness/bundles/java/cursor/harness-sync/reference.md +34 -14
  120. package/harness/bundles/java/cursor/harness-test/SKILL.md +1 -1
  121. package/harness/manifests/general/claude-code.json +19 -19
  122. package/harness/manifests/general/codebuddy.json +19 -19
  123. package/harness/manifests/general/codex.json +19 -19
  124. package/harness/manifests/general/cursor.json +19 -19
  125. package/harness/manifests/java/claude-code.json +21 -21
  126. package/harness/manifests/java/codebuddy.json +21 -21
  127. package/harness/manifests/java/codex.json +21 -21
  128. package/harness/manifests/java/cursor.json +21 -21
  129. package/hunter-workflow-family.json +10 -10
  130. package/package.json +1 -1
@@ -3,7 +3,7 @@ name: harness-knowledge-query
3
3
  description: 根据新需求、设计任务、代码修改请求或问题排查,在规划和编码前查询 .harness/knowledge
4
4
  历史上下文。适用场景:query knowledge、查找历史需求、根据归档理解需求、继续之前类似开发、生成需求上下文包。
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=79326ada58817556; overlay=none; agent=codex; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=33013358599f6743; overlay=none; agent=codex; do not edit -->
7
7
  # harness-knowledge-query
8
8
 
9
9
  并行 change 中查询必须传 `--change <change-id>`;成功后以该 change 的 `meta/knowledge-context.json` 为稳定指针。全局 `context-packs/latest.json` 仅向后兼容,不得用于判断多个 active change 的上下文归属。
@@ -2,7 +2,7 @@
2
2
  name: harness-plan
3
3
  description: 将需求转化为设计文档+实施计划+完整测试场景表,必须在编码前完成。使用场景:需求分析、feature plan、技术方案设计、实现方案规划
4
4
  ---
5
- <!-- generated by harness_deploy.py; core=79326ada58817556; overlay=none; agent=codex; do not edit -->
5
+ <!-- generated by harness_deploy.py; core=33013358599f6743; overlay=none; agent=codex; do not edit -->
6
6
  # harness-plan — 需求规划
7
7
 
8
8
  ## Purpose
@@ -3,7 +3,7 @@ name: harness-review
3
3
  description: 6维度代码审查(架构/安全/规范/兼容/测试/性能),对照项目规则(见
4
4
  .harness/context-index.json)和测试场景表,在隔离上下文运行。使用场景:代码审查、提交前检查、合并评审
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=79326ada58817556; overlay=none; agent=codex; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=33013358599f6743; overlay=none; agent=codex; do not edit -->
7
7
  # harness-review — 代码审查
8
8
 
9
9
  ## Purpose
@@ -2,7 +2,7 @@
2
2
  name: harness-run
3
3
  description: 按变更簇执行 TDD 编码循环(RED→GREEN→REFACTOR→编译验证),逐变更簇实现计划中的任务。使用场景:开始编码、实现功能、写代码、TDD 编码
4
4
  ---
5
- <!-- generated by harness_deploy.py; core=79326ada58817556; overlay=none; agent=codex; do not edit -->
5
+ <!-- generated by harness_deploy.py; core=33013358599f6743; overlay=none; agent=codex; do not edit -->
6
6
  # harness-run — 需求编码
7
7
 
8
8
  ## Purpose
@@ -3,7 +3,7 @@ name: harness-submit
3
3
  description: 最终提交封装:验证→中文 commit→提交/推送;worktree 模式含 --no-ff
4
4
  合并回主分支。使用场景:提交代码、commit、push、合并分支、merge to main、完成开发
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=79326ada58817556; overlay=none; agent=codex; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=33013358599f6743; overlay=none; agent=codex; do not edit -->
7
7
  # harness-submit — 最终提交(含 worktree 合并)
8
8
 
9
9
  ## Purpose
@@ -4,7 +4,7 @@ description: Use when the user asks to synchronize, refresh, or validate Harness
4
4
  metadata, adapters, knowledge, rules, instruction entrypoints, config origins,
5
5
  or CodeGraph status.
6
6
  ---
7
- <!-- generated by harness_deploy.py; core=79326ada58817556; overlay=none; agent=codex; do not edit -->
7
+ <!-- generated by harness_deploy.py; core=33013358599f6743; overlay=none; agent=codex; do not edit -->
8
8
  # harness-sync
9
9
 
10
10
  ## Purpose
@@ -13,13 +13,10 @@ description: Use when the user asks to synchronize, refresh, or validate Harness
13
13
 
14
14
  ## Before running
15
15
 
16
- 读取 `reference.md`。先执行只读能力握手;若最低 CLI 版本或任一必需能力不满足,立即停止,不得先运行 knowledge、refresh 或其他重操作:
17
-
18
- ```powershell
19
- npx hunter-harness capabilities --json
20
- ```
21
-
22
- 工作流要求 `sync@1`、`rules-sync@1`、`rules-review@1`、`knowledge-sync@2`。`BLOCKED_CAPABILITY_MISMATCH` 属环境阻塞,不得降级为手工拼接旧流程。
16
+ 读取 `reference.md`。`sync` 自身会在任何重操作之前完成能力握手;不要另起一个
17
+ `capabilities` 进程。工作流要求 `sync@2`、`rules-sync@1`、`rules-review@1`、
18
+ `knowledge-sync@3`、`codegraph-status@2`。`BLOCKED_CAPABILITY_MISMATCH` 属环境阻塞,
19
+ 不得降级为手工拼接旧流程。
23
20
 
24
21
  ## Run
25
22
 
@@ -29,17 +26,26 @@ npx hunter-harness sync --project <项目路径> --profile interactive --progres
29
26
 
30
27
  CLI 负责 Python runtime 解析、投影事务、knowledge、rules、map、指令图、配置来源、change 状态及 CodeGraph 证据汇总。禁止直接调用内部 Python 脚本,禁止使用固定 `HEAD~5`,禁止自动全量重建 CodeGraph。
31
28
 
32
- 长阶段的 heartbeat 写 stderr;stdout 只保留紧凑摘要。完整报告写入摘要中的 `reportPath`,并带 `reportSha256`。不得把完整 JSON 报告直接回显到对话。
29
+ 只读诊断使用 `--check`(`--dry-run` 为兼容别名);它不得写报告、receipt 或投影。
30
+ 长阶段的 heartbeat 写 stderr;stdout 只保留紧凑摘要。完整报告写入摘要中的
31
+ `reportPath`,并带 `reportSha256`。需要组件级证据时显式加 `--verbose`,不得默认把完整
32
+ JSON 报告回显到对话。
33
+
34
+ 摘要中的 `remediations[]` 是稳定修复契约。先用对应 `previewCommand` 预览;低风险修复用
35
+ `--apply safe`,指定修复用 `--fix <id>`。需覆盖受管投影的修复必须同时提供 `--yes`,
36
+ 并依赖 refresh 事务留下的 before snapshot;不允许绕过确认或无备份覆盖。指定修复时,
37
+ 无关组件只做只读评估,不得顺带写入。
33
38
 
34
39
  ## Interpret
35
40
 
36
41
  - `OK`:所有可验证组件通过。
42
+ - `ADVISORY`:索引最新,但有待评审候选等非阻塞健康提示;退出码仍为 0。
37
43
  - `WARN`:存在过期、冲突、待评审或 `UNKNOWN` 证据;按 `reportPath` 中的 `nextAction` 处理。
38
44
  - `FAIL`:组件执行失败;不得宣称同步完成。
39
45
  - `BLOCKED`:runtime、项目状态或能力契约阻塞;先修复阻塞条件。
40
46
  - `UNKNOWN`:证据不足,不等于成功,也不触发无界重建。
41
47
 
42
- 非交互或 CI 使用 `--profile general --progress jsonl --json`,不得等待规则候选确认。交互式运行若报告规则待评审,再按 `reference.md` 的显式入口处理。
48
+ 非交互或 CI 使用 `--check --profile general --progress jsonl --json`,不得等待规则候选确认。交互式运行若报告规则待评审,再按 `reference.md` 的显式入口处理。
43
49
 
44
50
  ## Safety
45
51
 
@@ -6,13 +6,8 @@ description: harness-sync 的能力契约、统一状态模型、报告收据和
6
6
 
7
7
  ## 1. 能力握手
8
8
 
9
- 统一入口执行前读取:
10
-
11
- ```powershell
12
- npx hunter-harness capabilities --json
13
- ```
14
-
15
- 工作流 family manifest 声明 `minimumCliVersion` 和 `capabilities`。CLI 在任何高成本阶段之前核对版本与能力;缺失时返回:
9
+ 工作流 family manifest 声明 `minimumCliVersion` 和 `capabilities`。`sync` 在任何高成本
10
+ 阶段之前自行核对版本与能力;Skill 不要再运行独立的 `capabilities` 子进程。缺失时返回:
16
11
 
17
12
  ```json
18
13
  {
@@ -47,22 +42,41 @@ npx hunter-harness sync --project <项目路径> --profile interactive --progres
47
42
  CI/非交互式:
48
43
 
49
44
  ```powershell
50
- npx hunter-harness sync --project <项目路径> --profile general --progress jsonl --json
45
+ npx hunter-harness sync --check --project <项目路径> --profile general --progress jsonl --json
51
46
  ```
52
47
 
53
- `--dry-run` 只做只读检查或事务预览,不应生成持久报告、receipt 或投影。每个长阶段通过 stderr 输出受限 heartbeat;stdout 只输出:
48
+ `--check` 是严格只读检查;`--dry-run` 是兼容别名。两者都不生成持久报告、receipt
49
+ 投影。每个长阶段通过 stderr 输出受限 heartbeat;stdout 默认只输出:
54
50
 
55
51
  ```json
56
52
  {
57
53
  "status": "WARN",
58
54
  "runId": "<run-id>",
59
- "components": {"ok": 7, "warn": 1, "fail": 0, "blocked": 0, "unknown": 1},
55
+ "components": {"ok": 7, "advisory": 1, "warn": 0, "fail": 0, "blocked": 0, "unknown": 0},
56
+ "versions": {
57
+ "cliVersion": "0.0.0",
58
+ "workflowBundleVersion": "0.0.0",
59
+ "adapterBundleVersions": {}
60
+ },
61
+ "remediations": [],
60
62
  "reportPath": ".harness/runtime/sync/<run-id>/reports/sync-report.json",
61
63
  "reportSha256": "<sha256>"
62
64
  }
63
65
  ```
64
66
 
65
- 详细报告必须受大小限制,并包含每个组件的 `status`、`reasonCode`、`observedAt`、`durationMs`、输入/输出 hash、证据、是否自动修复及 `nextAction`。
67
+ 只读检查的 `reportPath/reportSha256` `null`。详细报告必须受大小限制,并包含每个组件
68
+ 的 `status`、`reasonCode`、`observedAt`、`durationMs`、输入/输出 hash、证据、是否自动
69
+ 修复及 `nextAction`;只有显式 `--verbose` 才把组件级详情写到 stdout。
70
+
71
+ ### 结构化修复
72
+
73
+ - `remediations[]` 含稳定 `id`、风险、写入范围、备份/回滚说明、预计耗时、是否需确认、
74
+ `previewCommand` 与 `applyCommand`。
75
+ - `--apply safe` 只执行低风险、无需确认的修复。
76
+ - `--fix <id>` 只执行该项;需要覆盖受管 Adapter 时必须加 `--yes`。
77
+ - 指定修复时,其他组件仍参与诊断但保持只读。
78
+ - Adapter 覆盖由 refresh 事务执行,before snapshot 位于最新 committed refresh
79
+ transaction;事务失败会自动回滚。预览永远不得产生写入。
66
80
 
67
81
  ## 4. 组件状态
68
82
 
@@ -77,15 +91,21 @@ npx hunter-harness sync --project <项目路径> --profile general --progress js
77
91
  | instruction graph | 入口、include 边、环、主题可达性 | 缺失引用或循环为 `FAIL` |
78
92
  | config origins | canonical/projection 路径与 hash | 漂移 `WARN`,不静默覆盖 |
79
93
  | changes | 五态分类及归档收据 | `INVALID`/`ORPHAN` 不自动删除 |
80
- | CodeGraph | 索引文件、守护进程管道、watcher 日志、pendingwatcher lag | 输出 `CURRENT/PENDING/STALE/INDEX_PRESENT_UNVERIFIED/MISSING/UNKNOWN`;不自动全量 reindex |
94
+ | CodeGraph | `codegraph status --json` 的 pending、数据库观察时间、watcher 可达性 | 输出 `CURRENT/PENDING/STALE/INDEX_PRESENT_UNVERIFIED/MISSING/UNKNOWN`;日志 mtime 只证明 watcher 活动,不证明索引完成;不自动全量 reindex |
81
95
 
82
- 全局状态优先级:`BLOCKED` → `FAIL` → `WARN` → `OK`。任一 `UNKNOWN` 至少使全局结果为 `WARN`。
96
+ 全局状态优先级:`BLOCKED` → `FAIL` → `WARN` → `ADVISORY` → `OK`。任一 `UNKNOWN`
97
+ 至少使全局结果为 `WARN`。knowledge freshness 与 health 分开:索引一致但仍有待裁决候选时
98
+ 为 `ADVISORY`,不得误报为过期。
83
99
 
84
100
  ## 5. Git 与 CodeGraph
85
101
 
86
102
  增量基线来自上次成功 sync receipt 的 `headCommit`。首次运行或 receipt 不可用时,仅收集当前 HEAD 和有界文件统计;禁止固定 `HEAD~5`。
87
103
 
88
- CodeGraph 状态探测读取 `.codegraph/codegraph.db`、daemon receipt/log,尝试有界管道连接,并比较项目文件与最近索引观察时间。只有服务可达、watcher 已启用且 `pendingFileCount=0` 时为 `CURRENT`;此时才可将当前 HEAD 记录为推断的 `indexedCommit`。不可用、待同步或证据不足时分别报告 `STALE/PENDING/INDEX_PRESENT_UNVERIFIED/UNKNOWN` 与明确后续动作。不要在 sync 内执行全量索引,不使用依赖 shell 连接符的跨平台命令。
104
+ CodeGraph 状态探测优先读取 `codegraph status --json` 的权威 pending 列表;只有该 API
105
+ 不可用时才退回受限文件扫描,并把来源标成 `database-scan` 或 `unverified`。`.agents/`、
106
+ `.cursor/`、`.claude/` 等 Adapter 投影和 Markdown 文档不计入源码 pending。daemon log
107
+ mtime 只写入 `watcherObservedAt`,不能冒充 `indexObservedAt`。只有服务可达、watcher 已
108
+ 启用且权威 `pendingFileCount=0` 时为 `CURRENT`。不要在 sync 内执行全量索引。
89
109
 
90
110
  ## 6. Instruction graph
91
111
 
@@ -2,7 +2,7 @@
2
2
  name: harness-test
3
3
  description: 测试执行:读取场景表,执行单元测试+API接口测试+数据兼容验证,输出测试报告。当用户说'跑测试/验证/跑用例/接口测试/单元测试'时使用
4
4
  ---
5
- <!-- generated by harness_deploy.py; core=79326ada58817556; overlay=none; agent=codex; do not edit -->
5
+ <!-- generated by harness_deploy.py; core=33013358599f6743; overlay=none; agent=codex; do not edit -->
6
6
  # harness-test — 测试执行
7
7
 
8
8
  ## Purpose
@@ -2,5 +2,5 @@
2
2
  "schemaVersion": 1,
3
3
  "overlay": "none",
4
4
  "agent": "cursor",
5
- "coreHash": "9864fa7f9364d250"
5
+ "coreHash": "4caa698ed8bc50c8"
6
6
  }
@@ -3,7 +3,7 @@ name: harness-archive
3
3
  description: 归档所有变更产出(计划/测试报告/审查/SQL/API文档)到
4
4
  .harness/archive/,含归档元数据和可视化最终总结。使用场景:归档、完成归档、收尾、打包产出物
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=9864fa7f9364d250; overlay=none; agent=cursor; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=4caa698ed8bc50c8; overlay=none; agent=cursor; do not edit -->
7
7
  # harness-archive — 变更归档
8
8
 
9
9
  ## Purpose
@@ -3,7 +3,7 @@ name: harness-codebase-map
3
3
  description: 分析现有代码库并生成 .harness/codebase/map/
4
4
  下的结构化代码库地图。用于陌生项目理解、重大改造前梳理、harness-sync 提示 map 过期后的人工刷新。
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=9864fa7f9364d250; overlay=none; agent=cursor; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=4caa698ed8bc50c8; overlay=none; agent=cursor; do not edit -->
7
7
  # harness-codebase-map — 代码库地图
8
8
 
9
9
  ## Purpose
@@ -3,7 +3,7 @@ name: harness-knowledge-ingest
3
3
  description: 从 .harness/archive 归档整理、同步和维护项目知识索引。适用场景:ingest knowledge、sync
4
4
  knowledge、rebuild knowledge index、promote knowledge、确认知识条目、检查知识库是否过期。
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=9864fa7f9364d250; overlay=none; agent=cursor; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=4caa698ed8bc50c8; overlay=none; agent=cursor; do not edit -->
7
7
  # harness-knowledge-ingest
8
8
 
9
9
  从 `.harness/archive/**/reports/final/summary-data.json` 抽取项目知识,生成并维护本地 `.harness/knowledge/` 索引。
@@ -47,10 +47,12 @@ description: 从 .harness/archive 归档整理、同步和维护项目知识索
47
47
  .harness/knowledge/entries/superseded/*.json
48
48
  .harness/knowledge/entries/conflicted/*.json
49
49
  .harness/knowledge/cache/archive-entries/*.json
50
- .harness/knowledge/reports/ingest-report-YYYYMMDD-HHmmss.md
51
- .harness/knowledge/reports/verification-report-YYYYMMDD-HHmmss.md
52
- .harness/knowledge/reports/validator-suggestions-YYYYMMDD-HHmmss.md
53
- .harness/knowledge/reports/audit-report-YYYYMMDD-HHmmss.md
50
+ .harness/knowledge/reports/ingest-report-*.md
51
+ .harness/knowledge/reports/verification-report-*.md
52
+ .harness/knowledge/reports/audit-report-*.md
53
+ .harness/knowledge/reports/judge-export-<content-sha256>.json
54
+ .harness/knowledge/reports/judgements-<content-sha256>.json
55
+ .harness/knowledge/reports/latest.json
54
56
  .harness/knowledge/views/knowledge-dashboard.md
55
57
  .harness/knowledge/views/by-file.md
56
58
  .harness/knowledge/views/stale-items.md
@@ -67,14 +69,17 @@ description: 从 .harness/archive 归档整理、同步和维护项目知识索
67
69
 
68
70
  | 命令 | 用途 |
69
71
  |---|---|
70
- | `auto` | 一键防腐:首建 config、sync --update、**默认**写回 validator 建议、verify、audit;随后由 **Agent** 执行 judge 闭环 |
72
+ | 无参数 / `auto` | 一键防腐:首建 config、sync --update、**默认**写回 validator 建议、verify、audit;随后由 **Agent** 执行 judge 闭环 |
73
+ | `status` | 严格只读地返回 freshness 与 health |
74
+ | `repair all` | 修复可证明的 legacy gate、归一化重复、冲突与报告保留;不确定项返回 `needsConfirmation` |
71
75
  | `ingest` | 重建/刷新知识索引,抽取 candidate;`--no-incremental` 强制全量重抽取 |
72
- | `sync` | 检查 index 与 archive/HEAD 一致性;`--update` 自动刷新 |
76
+ | `sync --check` | 只读检查 index 与 archive/HEAD 一致性;`--update` 自动刷新 |
73
77
  | `promote` | candidate→active(显式 promote 或 autoPromote / judge 触发) |
74
78
  | `demote` | active→stale/candidate(显式 demote 或自动降级策略触发) |
75
79
  | `audit` | 生成 Candidate/Stale/Superseded/Conflict/Active Review 报告 |
76
80
  | `verify` | 执行 entry validators,刷新 lifecycle.validation,生成 verification-report |
77
81
  | `suggest-validators` | 生成 file_exists/file_contains validator 建议;`--apply` 写回 entry |
82
+ | `admin <旧命令>` | 旧管理命令兼容入口 |
78
83
  | `mcp` | FastMCP stdio 入口,暴露 9 个工具(见 reference.md) |
79
84
 
80
85
  config.json 配置项(autoPromote / confidence / activeLifecycle / knowledgeValidation)详见 `reference.md`「Commands 详细」。
@@ -109,11 +114,17 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' inges
109
114
  powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto --project '<project-root>'"
110
115
  ```
111
116
 
117
+ 不传子命令时等价于 `auto`。`auto` 输出必须分别报告:
118
+
119
+ - `freshness`:archive、HEAD、manifest、entry、SQLite 是否一致。
120
+ - `health`:各 lifecycle、publication、validation 与待裁决工作量。
121
+
112
122
  `auto` 默认会写回确定性 validator 建议(`--no-apply-suggestions` 可关闭)。JSON 返回含 `lifecycle` 摘要(validatorsApplied、autoPromote、pendingAgentJudge 等)。
113
123
 
114
124
  ### Phase 3:Agent judge 闭环(auto 之后必须执行)
115
125
 
116
- 当 `lifecycle.pendingAgentJudge > 0`、存在 `pending-judge` outbox,或 `judge export` 的 `counts.pending > 0` 时:
126
+ 当 `lifecycle.pendingAgentJudge > 0`、存在 `pending-judge` outbox,或 `judge export` 的
127
+ `counts.requiredDecisionCount > 0` 时:
117
128
 
118
129
  1. `judge export`(或读 maintain 产出的 pending judgements)
119
130
  2. Agent 读取 export JSON,按 `reference.md`「Agent judge 启发式」批量写 `reports/judge-decisions-<ts>.json`
@@ -122,12 +133,15 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto
122
133
 
123
134
  **禁止**默认输出「请人工确认 N 条 candidate」类五步待办清单。拿不准的 candidate 保持 `candidate` 状态留待下轮,记入 `skippedCandidates` 即可。
124
135
 
125
- 裁决体量:`config.judge.maxCandidatesPerRun`(默认 100);conflicted 优先全量裁决。
136
+ `pendingAgentJudge`/`requiredDecisionCount` 是完整待裁决总量;`previewCount` 才受
137
+ `config.judge.maxCandidatesPerRun`(默认 100)限制。已被 publication gate 阻断的条目
138
+ 只进入 `quarantinedCount`,不得混入 judge export。`defer` 必须保存证据指纹;来源、
139
+ validator、冲突关系或 publication 证据变化后即使未到 `reviewAfter` 也重新进入裁决。
126
140
 
127
141
  ### Phase 4:同步检查(可选)
128
142
 
129
143
  ```powershell
130
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>'"
144
+ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' status --project '<project-root>'"
131
145
  ```
132
146
 
133
147
  当 `upToDate=false` 时,运行 `sync --update` 或重新 `auto`,再交给 `harness-knowledge-query` 查询。
@@ -136,7 +150,11 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync
136
150
 
137
151
  仅在用户点名单条、或 `manualReview=true` 需人工确认时使用 `promote` / `demote`。日常归档后不要逐条人工复核。
138
152
 
139
- **发布门禁**:promote / judge apply / autoPromote 会校验来源归档——`reportPipeline.sourceConsistency` 缺失或失败、authoritative pointer /hash 不通过的归档,其条目带 `lifecycle.publishBlocked`,只能停留在 quarantined candidate。先 `harness_archive.py repair` 修复并重新 ingest,再 promote(详见 `reference.md`「发布门禁」)。
153
+ **发布门禁**:knowledge publication archive release status 独立。promote / judge apply /
154
+ autoPromote 校验 authoritative pointer/hash 与 `reportPipeline.sourceConsistency`;即使归档
155
+ 最终状态为 WARN,只要知识来源一致也可发布,但保留 release advisory。旧归档只有在
156
+ summary/hash/source commit 可独立证明时才自动生成 attestation;否则保持 quarantined 并
157
+ 返回 `needsConfirmation`(详见 `reference.md`「发布门禁」)。
140
158
 
141
159
  ### Phase 6:解释同步结果
142
160
 
@@ -146,10 +164,15 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync
146
164
  - 如需刷新,具体原因是 archive 增删、checksum 变化、sqlite 缺失,还是 HEAD 改变。
147
165
  - 本次是否自动刷新。
148
166
  - 当前 `active` / `candidate` / `stale` 的数量。
167
+ - 分别报告 `freshness` 与 `health`,不要用一个 `status` 覆盖
168
+ lifecycle/review/publication/validation 四个正交维度。
149
169
 
150
170
  ## Knowledge extraction rules
151
171
 
152
- - Detect duplicate IDs, duplicate content, and conflicting active facts.
172
+ - 优先读取归档显式 `knowledgeCandidates[]`;维护流水线、测试计数等
173
+ `category=process-observation` 不进入长期知识。
174
+ - Duplicate content 使用 Unicode、空白、标点与大小写归一化指纹,并在全量重建时迁移。
175
+ - 冲突必须同时有相同实体、共享来源范围和双方证据;仅关键词相反不得判为冲突。
153
176
  - Keep project-local entries excluded from any global index unless explicitly selected.
154
177
  - Validate lifecycle relationships.
155
178
  - Default generated entries are `candidate`; only config-gated `autoPromote` may promote high-confidence long-lived entries to `active`.
@@ -191,7 +214,7 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync
191
214
  本 skill 自带最小测试:
192
215
 
193
216
  ```powershell
194
- powershell.exe -Command "python -m unittest '<skill-dir>\tests\test_harness_knowledge.py'"
217
+ powershell.exe -Command "python 'harness\scripts\harness_test_runner.py' unittest --profile safe --tests-dir '<skill-dir>\tests' --timeout-seconds 300 --verbosity 1"
195
218
  ```
196
219
 
197
220
  完成脚本修改后必须至少运行该测试。若在真实项目中验证,还应运行:
@@ -221,13 +244,16 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync
221
244
  - `upToDate` 及 `reasons`(sync)或新增/覆盖条目数(ingest/promote)。
222
245
  - 当前 `active` / `candidate` / `stale` 数量统计。
223
246
  - 产物路径(`index.json`、`index.sqlite`、`views/`、`reports/`)。
224
- - `lifecycle` 摘要:`validatorsApplied`、`candidateAutoPromoted`、`pendingAgentJudge` 等。
247
+ - `lifecycle` 摘要:`validatorsApplied`、`candidateAutoPromoted`、兼容整数
248
+ `pendingAgentJudge`,以及
249
+ `pendingAgentJudgeSummary.requiredDecisionCount/previewCount/quarantinedCount` 等。
250
+ - validator 摘要:`eligible/selected/applied/remaining/unavailable`,不得只报告本轮抽样数。
225
251
  - **已处理报告**(auto + judge 后):promoted/dropped/superseded/kept/deferred/skipped 计数与 `reports/judge-decisions-*.json`、`judgements-*.json` 路径;人工判断还会追加到 `judgements/decisions.json`,后续 ingest 不得抹除。`defer` 必须带 `reviewAfter`,到期前不重复进入待判断清单。
226
252
  - 仅当 `upToDate=false` 时建议 `sync --update`;查询历史 → `/harness-knowledge-query`。**禁止**默认列出「请人工确认 N 条 candidate」待办。
227
253
 
228
254
  ## 渐进披露
229
255
 
230
- - **Read `reference.md`** 仅在执行命令或查阅 config.json 配置时 — 含 Commands 详细示例(9 命令的 powershell 示例 + config.json 配置)与变更日志(v1.7–v1.13 补充能力)。
256
+ - **Read `reference.md`** 仅在执行命令或查阅 config.json 配置时 — 含 Commands 详细示例、config.json 配置与兼容说明。
231
257
 
232
258
  ## 交互白名单
233
259
 
@@ -16,6 +16,9 @@ description: harness-knowledge-ingest 的命令详细示例、config.json 配置
16
16
  powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto --project '<project-root>'"
17
17
  ```
18
18
 
19
+ 省略子命令时也进入 `auto`;旧命令可放在 `admin` 后继续调用,例如
20
+ `admin audit --project <root>`。
21
+
19
22
  `auto` 会按默认维护顺序执行:首建 `config.json`(若缺失)、`sync --update`、**默认写回** validator 建议、`verify`、`audit`。首次发现 `.harness/knowledge/config.json` 不存在时,会写入启用版 `autoPromote` + `activeLifecycle.autoDemote` + `knowledgeValidation.autoDemoteActive` + `judge.maxCandidatesPerRun` 配置。
20
23
 
21
24
  关闭 validator 写回:
@@ -35,7 +38,11 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto
35
38
 
36
39
  - **conflicted**:优先 `supersede` 较旧/较弱证据方;对称难判 → `keep-conflict` + reason
37
40
  - **candidate**:`decision|api-contract|requirement|pitfall` 且 confidence 高 → `promote`;`implementation|test-evidence` 倾向 `drop` 或保持 candidate
38
- - 超过 `judge.maxCandidatesPerRun`(默认 100)的低分 candidate:跳过,记入 `skippedCandidates`
41
+ - `requiredDecisionCount` 是完整总量,`previewCount` 才受
42
+ `judge.maxCandidatesPerRun`(默认 100)限制。
43
+ - publication gate 阻断项计入 `quarantinedCount`,不进入待裁决单位。
44
+ - 超出预览窗口的 candidate 计入 `deferredByLimitCount`,不能让
45
+ `pendingAgentJudge` 误报为窗口大小。
39
46
 
40
47
  ```powershell
41
48
  powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' judge --project '<project-root>' --export '<export.json>'"
@@ -65,15 +72,18 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' inges
65
72
  ### Sync knowledge
66
73
 
67
74
  ```powershell
68
- powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>'"
75
+ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' status --project '<project-root>'"
69
76
  ```
70
77
 
71
- 检查 `.harness/knowledge` 是否与 `.harness/archive` 和当前 HEAD 一致。输出 JSON 包含:
78
+ 严格只读地检查 `.harness/knowledge` 是否与 `.harness/archive` 和当前 HEAD 一致。也可用
79
+ 兼容命令 `sync --check`。输出 JSON 包含:
72
80
 
73
81
  - `upToDate`
74
82
  - `reasons`
75
83
  - `archiveCount`
76
84
  - `paths`
85
+ - `freshness`
86
+ - `health`(lifecycle/review/publication/validation 四个独立维度)
77
87
 
78
88
  如果希望发现过期后自动刷新:
79
89
 
@@ -87,6 +97,24 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync
87
97
  powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>' --update --no-incremental"
88
98
  ```
89
99
 
100
+ ### Repair
101
+
102
+ 先诊断、不写入:
103
+
104
+ ```powershell
105
+ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' repair all --project '<project-root>' --no-apply"
106
+ ```
107
+
108
+ 执行可证明的修复:
109
+
110
+ ```powershell
111
+ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' repair all --project '<project-root>'"
112
+ ```
113
+
114
+ repair 处理归一化重复、冲突重算、旧 publication gate attestation 与报告保留。旧归档只有在
115
+ authoritative summary/hash 和 source commit 均可独立验证时自动修复;其余项进入
116
+ `needsConfirmation`,不得猜测或静默放行。
117
+
90
118
  ### Verify knowledge validators
91
119
 
92
120
  ```powershell
@@ -129,7 +157,10 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' verif
129
157
  powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' suggest-validators --project '<project-root>' --limit 20"
130
158
  ```
131
159
 
132
- 默认只生成建议和 `reports/validator-suggestions-*.md`,不会改写 entries。建议来源是当前 entry 的 `scope.sourceFiles`、正文/标题/关键词中的稳定 token,以及项目文件中的实际内容。当前只生成安全的 `file_exists` / `file_contains` 建议。
160
+ 默认只生成建议和 content-addressed report,不会改写 entries。结果分别报告
161
+ `eligible/selected/suggested/applied/remaining/unavailable`。建议来源是当前 entry 的
162
+ `scope.sourceFiles`、正文/标题/关键词中的稳定 token,以及项目文件中的实际内容。
163
+ 当前只生成安全的 `file_exists` / `file_contains` 建议。
133
164
 
134
165
  如需把建议写入 entry JSON:
135
166
 
@@ -145,12 +176,18 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sugge
145
176
  powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' promote --project '<project-root>' --id '<entry-id>' --note '<人工确认说明>'"
146
177
  ```
147
178
 
148
- **发布门禁(archive publication gate)**:promote / judge apply / autoPromote 只处理来自**已验证归档**的条目。以下来源归档会被阻断并在条目上标记 `lifecycle.publishBlocked`(ingest 仍可生成 quarantined candidate,但不得 active/promote):
179
+ **发布门禁(archive publication gate)**:promote / judge apply / autoPromote 只处理
180
+ knowledge publication 证据通过的条目。它与归档 release status 独立:归档为 WARN 但
181
+ source consistency 与 authoritative pointer/hash 均通过时,知识可以发布,同时保留
182
+ `archiveReleaseEligibility` advisory。以下来源归档会被阻断并在条目上标记
183
+ `lifecycle.publishBlocked`:
149
184
 
150
185
  - 归档 summary 缺少 `reportPipeline.sourceConsistency`(source consistency 未运行)或 `ok=false`;
151
186
  - `derived/authoritative.json` pointer 缺失、版本目录不可读,或 repair record / pointer 的 summary hash 不匹配(DEGRADED)。
152
187
 
153
- 修复路径:先运行 `harness_archive.py repair` 生成通过两层 validator 的新 derived version,再重新 ingest(旧错误条目标记 superseded),之后 promote 才放行。
188
+ 修复路径:优先运行本 skill 的 `repair legacy-publication-gates`。只有 summary/hash/source
189
+ commit 都可证明时才生成 attestation;否则输出 `needsConfirmation`。也可由 archive repair
190
+ 生成通过 validator 的新 derived version,再重新 ingest。
154
191
 
155
192
  将一条 `candidate` 提升为 `active`,写入:
156
193
 
@@ -289,6 +326,20 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge_mcp.py'"
289
326
 
290
327
  ## 变更日志
291
328
 
329
+ ## v1.15 补充能力(sync/knowledge retrospective hardening)
330
+
331
+ - 默认无参数进入 `auto`;新增严格只读 `status`、`sync --check`、`repair all` 与
332
+ `admin <legacy-command>` 兼容入口。
333
+ - 显式 `knowledgeCandidates[]` 为首选来源,process observation 不再进入长期知识。
334
+ - 内容去重改为归一化指纹;冲突要求共同实体、来源范围与双方 evidence。
335
+ - freshness 与 health 分离,health 按 lifecycle/review/publication/validation 正交报告。
336
+ - judge 输出完整 `requiredDecisionCount`、有界 `previewCount` 和 `quarantinedCount`;
337
+ blocked 条目不进入 judge;defer 绑定证据指纹。
338
+ - knowledge publication gate 与 archive release status 解耦,legacy gate 仅在可证明时修复。
339
+ - judge/rollback 等 JSON 报告采用 content-addressed 文件、`latest-*` 指针与有界保留;
340
+ rollback snapshot 使用 gzip。
341
+ - validator 建议输出 `eligible/selected/applied/remaining/unavailable`。
342
+
292
343
  ## v1.7 补充能力
293
344
 
294
345
  当前脚本额外支持: