ai-dev-harness 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/summarize.js CHANGED
@@ -30,7 +30,7 @@ ${options.agentName}
30
30
  - 确认变更限定在任务范围内。
31
31
  - 确认公共接口和向后兼容性没有被意外破坏。
32
32
  - 确认失败或跳过的验证项已被理解。
33
- - 确认知识沉淀建议经过人工评审后再写入 Knowledge Graph。
33
+ - 确认知识沉淀建议符合 OKF v0.1 + 团队扩展规范,并经过人工评审后再写入 Knowledge Graph。
34
34
 
35
35
  ## PR 描述草稿
36
36
  ### 变更内容
@@ -46,7 +46,7 @@ ${options.verifyResult?.commands.map((cmd) => `- ${cmd.name}: ${cmd.exitCode ===
46
46
  - 合并前需要评审正确性、安全性、兼容性和知识沉淀建议。
47
47
 
48
48
  ### 知识沉淀跟进
49
- - 写入 Knowledge Graph 前先评审 persist_suggestions.md
49
+ - 写入 Knowledge Graph 前先评审 persist_suggestions.md,确认目标项目目录、frontmatter、相关链接、index.md 和 log.md 更新项。
50
50
 
51
51
  ## Diff 快照
52
52
  \`\`\`diff
@@ -55,20 +55,148 @@ ${truncate(diff, 12000)}
55
55
  `;
56
56
  const persist = `# 知识沉淀建议
57
57
 
58
- 写入 Knowledge Graph 前,请先人工评审这些建议。
58
+ 写入 Knowledge Graph 前,请先人工评审这些建议。本文只生成 OKF 候选内容,不自动写入知识库。
59
59
 
60
60
  - 任务: ${options.task}
61
61
  - Skill: ${options.skillName}
62
62
  - 修改文件: ${options.agentResult?.changedFiles.join(", ") || "无"}
63
63
  - 沉淀策略: 写入 Knowledge Graph 前必须人工评审。
64
- - 建议沉淀类型:
65
- - ADR Candidate: 如果实现涉及有意义的技术取舍,补充决策记录。
66
- - Module Note Candidate: 如果变更澄清了模块职责或行为,补充模块说明。
67
- - API Note Candidate: 如果接口语义、入参、返回值或兼容性有变化,补充接口说明。
68
- - Runbook Candidate: 如果验证或排障暴露了可复用步骤,补充运行手册。
69
- - Test Knowledge Candidate: 如果新增了典型测试场景,补充测试知识。
70
- - Skill Improvement Candidate: 如果本次任务暴露 Skill 缺口,补充 Skill 改进建议。
71
- - Missing Context Candidate: 如果缺少 Agent 侧 MCP 上下文影响了信心,记录缺失项。
64
+ - 知识库规范: OKF v0.1 + PC 浏览器团队扩展。
65
+
66
+ ## OKF 写作规则
67
+
68
+ - 每个知识文档是一个 concept,concept_id 等于文件路径去掉 \`.md\` 后缀。
69
+ - 新文档放入具体项目目录,例如 \`/zero/\`、\`/se/\`、\`/yuntun/\`。
70
+ - 子域优先选择 \`overview\`、\`features\`、\`metrics\`、\`api\`、\`playbooks\`、\`references\`。
71
+ - 普通知识文档必须包含 YAML frontmatter: \`type\`、\`title\`、\`description\`、\`tags\`、\`timestamp\`;API/数据类建议补充 \`resource\`。
72
+ - \`## 相关\` 必须使用有效 Markdown 链接,推荐 bundle 根相对路径,例如 \`/zero/features/fast-launch.md\`。
73
+ - API Reference 必须补充 \`## 关键实现锚点\` 和 \`### Agent 使用建议\`。
74
+ - 不写入密钥、Token、明文密码、未脱敏用户数据、未公开内网 IP;内网链接使用占位符域名。
75
+ - 合入知识库时同步更新对应目录的 \`index.md\` 和 \`log.md\`。
76
+
77
+ ## 建议候选文档
78
+
79
+ ### Candidate 1: Feature / Module Note
80
+
81
+ - 适用条件: 本次变更澄清了功能行为、模块职责、边界条件或实现约束。
82
+ - 建议路径: \`/<project>/features/<feature-or-module>.md\`
83
+ - 建议 type: \`Feature\`
84
+
85
+ \`\`\`\`markdown
86
+ ---
87
+ type: Feature
88
+ title: <功能或模块名称>
89
+ description: <一句话说明这个功能/模块解决什么问题,以及本次变更沉淀了什么>
90
+ tags: [<project>, <feature-or-module>]
91
+ timestamp: ${new Date().toISOString()}
92
+ ---
93
+
94
+ ## 背景 / 设计目标
95
+
96
+ - <为什么需要这个功能或这次变更>
97
+
98
+ ## 方案 / 实现
99
+
100
+ - <关键实现路径、主要流程、重要约束>
101
+ - 相关代码: \`${options.agentResult?.changedFiles[0] ?? "<path/to/code>"}\`
102
+
103
+ ## 注意事项 / 已知限制
104
+
105
+ - <边界条件、兼容性、风险点>
106
+
107
+ ## 相关
108
+
109
+ - [相关文档](/<project>/<domain>/<doc>.md)
110
+ \`\`\`\`
111
+
112
+ ### Candidate 2: API Reference
113
+
114
+ - 适用条件: 本次变更涉及接口语义、入参、返回值、兼容性或调用链。
115
+ - 建议路径: \`/<project>/api/<api-name>.md\`
116
+ - 建议 type: \`API Reference\`
117
+
118
+ \`\`\`\`markdown
119
+ ---
120
+ type: API Reference
121
+ title: <接口名称>
122
+ description: <一句话说明接口职责和主要调用场景>
123
+ resource: <endpoint-or-openapi-placeholder>
124
+ tags: [<project>, api]
125
+ timestamp: ${new Date().toISOString()}
126
+ ---
127
+
128
+ ## 关键实现锚点
129
+ - 模块: \`<代码仓库中的模块路径>\`
130
+ - 类/组件: \`<核心类、Handler 或入口函数>\`
131
+ - 补充入口: \`<配置、部署脚本或 Playbook 路径>\`
132
+
133
+ ### Agent 使用建议
134
+
135
+ 需要实现细节时,继续用 CodeGraph 查询真实调用链和影响面。
136
+
137
+ # Schema
138
+
139
+ | 字段 | 类型 | 必填 | 说明 |
140
+ |------|------|------|------|
141
+ | <field> | <type> | <yes/no> | <description> |
142
+
143
+ # Examples
144
+
145
+ \`\`\`json
146
+ {
147
+ "example": true
148
+ }
149
+ \`\`\`
150
+
151
+ ## 相关
152
+
153
+ - [相关功能](/<project>/features/<feature>.md)
154
+ \`\`\`\`
155
+
156
+ ### Candidate 3: Playbook / Test Knowledge
157
+
158
+ - 适用条件: 本次修复、验证、回滚或排障步骤可复用。
159
+ - 建议路径: \`/<project>/playbooks/<scenario>.md\`
160
+ - 建议 type: \`Playbook\`
161
+
162
+ \`\`\`\`markdown
163
+ ---
164
+ type: Playbook
165
+ title: <场景处理手册>
166
+ description: <一句话说明该手册解决什么操作/排障场景>
167
+ tags: [<project>, playbook]
168
+ timestamp: ${new Date().toISOString()}
169
+ ---
170
+
171
+ ## 适用场景
172
+
173
+ - <什么情况下使用>
174
+
175
+ ## 操作步骤
176
+
177
+ 1. <步骤一>
178
+ 2. <步骤二>
179
+ 3. <验证结果>
180
+
181
+ ## 风险与回滚
182
+
183
+ - <风险>
184
+ - <回滚方式>
185
+
186
+ ## 相关
187
+
188
+ - [相关功能](/<project>/features/<feature>.md)
189
+ \`\`\`\`
190
+
191
+ ## index.md / log.md 更新建议
192
+
193
+ - \`index.md\`: 添加新文档链接和一句话 description。
194
+ - \`log.md\`: 最新日期在前,使用 \`**Creation**\`、\`**Update**\`、\`**Deprecation**\` 或 \`**Deletion**\`。
195
+
196
+ ## 缺失上下文记录
197
+
198
+ - Missing Context Candidate: 如果缺少 CodeGraph 或 Knowledge Graph 证据影响判断,请记录缺失的工具、query、concept_id 或代码路径。
199
+ - Skill Improvement Candidate: 如果本次任务暴露 Skill 输入、验证命令或 MCP 使用规则缺口,请记录到 Skill 改进建议。
72
200
  `;
73
201
  await writeFile(options.summaryPath, summary, "utf8");
74
202
  await writeFile(options.persistPath, persist, "utf8");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ai-dev-harness",
3
- "version": "0.1.1",
4
- "description": "Auditable AI development harness for Codex and Claude Code.",
3
+ "version": "0.1.3",
4
+ "description": "Auditable AI development harness for Codex, Claude Code, Cursor Agent, and Gemini CLI.",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "ai",
@@ -23,6 +23,7 @@
23
23
  "scripts/",
24
24
  "templates/",
25
25
  "README.md",
26
+ "ONLINE_INSTALL_GUIDE.md",
26
27
  "COLLEAGUE_TRIAL_GUIDE.md",
27
28
  "package.json"
28
29
  ],
@@ -18,7 +18,13 @@ Write-Host "[harness-skill] 证据目录: $runPath"
18
18
 
19
19
  $summary = Join-Path $runPath "summary.md"
20
20
  $verify = Join-Path $runPath "verify.json"
21
+ $verifyDiagnostics = Join-Path $runPath "verify_diagnostics.json"
21
22
  $contract = Join-Path $runPath "agent_contract.json"
23
+ $contextScore = Join-Path $runPath "context_score.json"
24
+ $approval = Join-Path $runPath "approval_required.json"
25
+ $checkpoint = Join-Path $runPath "checkpoint.json"
26
+ $loopReview = Join-Path $runPath "loop_review.json"
27
+ $loopReport = Join-Path $runPath "loop_report.md"
22
28
  $audit = Join-Path $runPath "audit.jsonl"
23
29
 
24
30
  if (Test-Path -LiteralPath $summary) {
@@ -31,12 +37,42 @@ if (Test-Path -LiteralPath $verify) {
31
37
  Get-Content -LiteralPath $verify
32
38
  }
33
39
 
40
+ if (Test-Path -LiteralPath $verifyDiagnostics) {
41
+ Write-Host "`n--- verify_diagnostics.json ---"
42
+ Get-Content -LiteralPath $verifyDiagnostics
43
+ }
44
+
34
45
  if (Test-Path -LiteralPath $contract) {
35
46
  Write-Host "`n--- agent_contract.json ---"
36
47
  Get-Content -LiteralPath $contract
37
48
  }
38
49
 
50
+ if (Test-Path -LiteralPath $contextScore) {
51
+ Write-Host "`n--- context_score.json ---"
52
+ Get-Content -LiteralPath $contextScore
53
+ }
54
+
55
+ if (Test-Path -LiteralPath $approval) {
56
+ Write-Host "`n--- approval_required.json ---"
57
+ Get-Content -LiteralPath $approval
58
+ }
59
+
60
+ if (Test-Path -LiteralPath $checkpoint) {
61
+ Write-Host "`n--- checkpoint.json ---"
62
+ Get-Content -LiteralPath $checkpoint
63
+ }
64
+
65
+ if (Test-Path -LiteralPath $loopReview) {
66
+ Write-Host "`n--- loop_review.json ---"
67
+ Get-Content -LiteralPath $loopReview
68
+ }
69
+
70
+ if (Test-Path -LiteralPath $loopReport) {
71
+ Write-Host "`n--- loop_report.md ---"
72
+ Get-Content -LiteralPath $loopReport
73
+ }
74
+
39
75
  if (Test-Path -LiteralPath $audit) {
40
76
  Write-Host "`n--- 审计失败/错误 ---"
41
- Select-String -LiteralPath $audit -Pattern "failed|error|run_finished" | ForEach-Object { $_.Line }
77
+ Select-String -LiteralPath $audit -Pattern "failed|error|evaluate|rework|approval|restore|run_finished" | ForEach-Object { $_.Line }
42
78
  }
@@ -7,7 +7,7 @@ param(
7
7
  [string]$Skill,
8
8
 
9
9
  [Parameter(Mandatory = $true)]
10
- [ValidateSet("claude", "codex")]
10
+ [ValidateSet("claude", "codex", "cursor", "gemini")]
11
11
  [string]$Agent,
12
12
 
13
13
  [string]$Repo = (Get-Location).Path,
@@ -1,8 +1,11 @@
1
1
  # Tool Rules
2
2
 
3
- - Codex and Claude Code are execution agents.
4
- - CodeGraph MCP is used by Claude/Codex for code impact context.
5
- - Knowledge Graph MCP is used by Claude/Codex for ADR, module, API, runbook, and decision context.
3
+ - Codex, Claude Code, Cursor Agent, and Gemini CLI are supported execution agents.
4
+ - CodeGraph MCP is used by the current execution agent for code impact context.
5
+ - Knowledge Graph MCP is used by the current execution agent for ADR, module, API, runbook, and decision context.
6
6
  - Verification commands are defined in harness.yaml and skill verify.yaml files.
7
7
  - Harness run evidence is stored in runs/<run_id>/ and must be treated as the audit record.
8
+ - Correction loop evaluation is stored in loop_review.json and loop_report.md.
9
+ - Verification diagnostics, context score, approval gate, feedback events, and checkpoints are Harness evidence only; agents still own code understanding and implementation.
8
10
  - Knowledge Graph is read-only in v1. Write suggestions to persist_suggestions.md only.
11
+ - Knowledge persistence suggestions must follow OKF v0.1 + PC browser team rules: choose the right project/domain path, include frontmatter, use valid Markdown links, add API implementation anchors when needed, and remind humans to update index.md and log.md.
@@ -1,29 +1,32 @@
1
1
  queries:
2
- - related files
3
- - symbols
4
- - call graph
5
- - dependencies
6
- - impact analysis
2
+ - use codegraph_explore for the target feature area or user-facing flow
3
+ - ask how the existing flow works before adding behavior
4
+ - ask for integration points and public interfaces
5
+ - ask for blast-radius summary before editing
7
6
  mcp_preflight:
8
7
  codegraph:
9
8
  required: true
9
+ primary_tool: codegraph_explore
10
10
  ask_for:
11
- - related_files
12
- - extension_points
13
- - dependent_modules
14
- - public_interfaces
15
- - impact_scope
11
+ - existing_flow_source_grouped_by_file
12
+ - integration_points
13
+ - current_line_numbered_source_for_known_file_or_symbol
14
+ - call_paths_between_entry_point_and_target_behavior
15
+ - blast_radius_summary
16
16
  knowledgeGraph:
17
17
  required: true
18
18
  ask_for:
19
- - product_decisions
20
- - adr
21
- - api_notes
22
- - module_notes
23
- - rollout_notes
19
+ - search_docs_or_hybrid_search_for_feature_terms
20
+ - answer_context_for_product_and_architecture_context
21
+ - read_doc_outline_for_relevant_concepts
22
+ - read_section_or_read_doc_range_for_contracts
23
+ - get_backlinks_for_related_decisions
24
+ - get_audit_log_when_recent_knowledge_changes_matter
24
25
  stop_conditions:
25
26
  - requirement is ambiguous
26
27
  - public interface change is needed but not requested
28
+ - codegraph_explore cannot identify the existing extension point
29
+ - knowledge MCP cannot confirm product or API constraints
27
30
  - impact scope cannot be determined
28
31
  fallbackInclude:
29
32
  - README.md
@@ -1,28 +1,31 @@
1
1
  queries:
2
- - related files
3
- - symbols
4
- - call graph
5
- - dependencies
6
- - impact analysis
2
+ - use codegraph_explore for the defect, suspected file, symbol, or user-facing flow
3
+ - ask for current line-numbered source when a file or symbol is known
4
+ - ask for call paths between the entry point and suspected behavior
5
+ - ask for blast-radius summary before editing
7
6
  mcp_preflight:
8
7
  codegraph:
9
8
  required: true
9
+ primary_tool: codegraph_explore
10
10
  ask_for:
11
- - related_files
12
- - related_symbols
13
- - callers
14
- - dependencies
15
- - impact_scope
11
+ - relevant_source_grouped_by_file
12
+ - current_line_numbered_source_for_known_file_or_symbol
13
+ - call_paths_between_related_symbols
14
+ - dynamic_dispatch_hops
15
+ - blast_radius_summary
16
16
  knowledgeGraph:
17
17
  required: true
18
18
  ask_for:
19
- - adr
20
- - module_notes
21
- - api_notes
22
- - runbooks
23
- - historical_decisions
19
+ - search_docs_or_search_chunks_for_defect_terms
20
+ - answer_context_for_direct_rag_context
21
+ - read_doc_outline_for_relevant_concepts
22
+ - read_section_or_read_doc_range_for_evidence
23
+ - get_backlinks_for_related_decisions
24
+ - get_audit_log_when_recent_knowledge_changes_matter
24
25
  stop_conditions:
25
26
  - root cause is unclear
27
+ - codegraph_explore cannot identify a plausible affected area
28
+ - knowledge MCP cannot provide enough decision or runbook evidence for a risky change
26
29
  - impact scope cannot be determined
27
30
  - verification path is missing
28
31
  fallbackInclude:
@@ -1,26 +1,30 @@
1
1
  queries:
2
- - related docs
3
- - ADR
4
- - module notes
5
- - API docs
2
+ - use codegraph_explore for the documented module, API, or flow
3
+ - ask how the flow works and which files define it
4
+ - ask for current line-numbered source when documenting a known file or symbol
6
5
  mcp_preflight:
7
6
  codegraph:
8
7
  required: false
8
+ primary_tool: codegraph_explore
9
9
  ask_for:
10
- - related_files
11
- - public_interfaces
12
- - ownership
10
+ - relevant_source_grouped_by_file
11
+ - current_line_numbered_source_for_known_file_or_symbol
12
+ - call_paths_for_documented_flow
13
+ - blast_radius_summary_when_docs_affect_shared_behavior
13
14
  knowledgeGraph:
14
15
  required: true
15
16
  ask_for:
16
- - adr
17
- - module_notes
18
- - api_notes
19
- - runbooks
20
- - stale_docs
17
+ - list_path_for_doc_area
18
+ - search_docs_or_search_sections_for_existing_docs
19
+ - search_chunks_or_hybrid_search_for_relevant_evidence
20
+ - read_doc_outline_before_deep_reading
21
+ - read_section_or_read_doc_range_for_source_of_truth
22
+ - get_backlinks_for_related_docs
21
23
  stop_conditions:
22
24
  - documentation target is unclear
23
25
  - source of truth cannot be identified
26
+ - codegraph_explore cannot identify the documented behavior
27
+ - knowledge MCP cannot identify the source-of-truth document
24
28
  fallbackInclude:
25
29
  - README.md
26
30
  - docs
@@ -1,28 +1,31 @@
1
1
  queries:
2
- - related files
3
- - symbols
4
- - call graph
5
- - dependencies
6
- - impact analysis
2
+ - use codegraph_explore for the behavior under test
3
+ - ask for source grouped by file around the behavior
4
+ - ask for call paths and likely test targets
5
+ - ask for blast-radius summary when tests touch shared behavior
7
6
  mcp_preflight:
8
7
  codegraph:
9
8
  required: true
9
+ primary_tool: codegraph_explore
10
10
  ask_for:
11
- - related_files
12
- - test_targets
13
- - dependencies
14
- - callers
15
- - impacted_paths
11
+ - relevant_source_grouped_by_file
12
+ - test_target_files_or_symbols
13
+ - current_line_numbered_source_for_known_file_or_symbol
14
+ - call_paths_to_behavior_under_test
15
+ - blast_radius_summary
16
16
  knowledgeGraph:
17
17
  required: false
18
18
  ask_for:
19
- - test_strategy
20
- - known_edge_cases
21
- - runbooks
22
- - historical_bugs
19
+ - search_docs_or_search_chunks_for_test_strategy
20
+ - answer_context_for_known_edge_cases
21
+ - read_section_or_read_chunk_for_test_evidence
22
+ - get_related_chunks_for_neighboring_context
23
+ - get_audit_log_when_recent_test_docs_matter
23
24
  stop_conditions:
24
25
  - expected behavior is unclear
25
26
  - no test runner can be identified
27
+ - codegraph_explore cannot identify the behavior under test
28
+ - knowledge MCP cannot clarify expected behavior for ambiguous tests
26
29
  - test data or fixture requirements are unknown
27
30
  fallbackInclude:
28
31
  - README.md
@@ -5,33 +5,64 @@ description: 从 Claude Code 对话中触发可审计的 AI Dev Harness CLI,
5
5
 
6
6
  # AI Dev Harness
7
7
 
8
- 当用户要求使用 Harness、AI Dev Harness、可审计执行、CodeGraph/Knowledge Graph 上下文,或要求执行 `fix_bug`、`add_feature`、`write_tests`、`update_docs` 这些技能时,使用本 Skill。
8
+ 当用户要求使用 Harness、AI Dev Harness、可审计执行、CodeGraph/Knowledge Graph 上下文,或要求执行 `fix_bug`、`add_feature`、`write_tests`、`update_docs` 时,使用本 Skill。
9
9
 
10
10
  ## Agent MCP Preflight
11
11
 
12
- 运行 Harness 命令前,优先使用 Claude Code 已配置的 MCP 工具:
12
+ 运行 Harness 命令前,优先使用 Claude Code 已配置的 MCP 工具。
13
13
 
14
- - 使用 CodeGraph MCP 检查相关文件、符号、依赖、调用方和影响范围。
15
- - 使用 Knowledge Graph MCP 检查 ADR、模块说明、接口说明、历史决策和 runbook。
16
- - 在当前对话中先总结 MCP 发现,再调用 Harness。
17
- - 把关键 MCP 发现带入 Harness 的任务文本,让审计记录保留决策上下文。
14
+ CodeGraph 使用规则:
18
15
 
19
- 请使用以下预检总结格式:
16
+ - 如果使用的是 `colbymchenry/codegraph`,优先调用默认工具 `codegraph_explore`。
17
+ - 用任务里的业务流程、文件路径、函数/类/符号名、错误现象作为 query。
18
+ - 重点读取 `codegraph_explore` 返回的 grouped source、line-numbered source、call paths、dynamic dispatch hops、blast-radius summary。
19
+ - 只有当服务显式暴露了额外工具时,才使用其它 CodeGraph 工具。
20
+
21
+ Knowledge Graph 使用规则:
22
+
23
+ - 如果使用的是 browser_knowledge_service,按渐进式读取:
24
+ 1. 用 `list_path`、`search_docs`、`search_sections`、`search_chunks` 缩小范围。
25
+ 2. RAG 场景优先用 `answer_context`;需要自己控制排序时用 `hybrid_search`。
26
+ 3. 定位 concept_id 后,先用 `read_doc_outline` 看结构。
27
+ 4. 再用 `read_section`、`read_doc_range`、`read_chunk`、`get_related_chunks` 精读证据。
28
+ 5. 需要关联关系时用 `get_backlinks`,需要确认近期知识变动时用 `get_audit_log`。
29
+ - v1 不直接调用 `propose_doc` 写入知识库;只把建议写入 Harness 的 `persist_suggestions.md`。
30
+ - 区分已确认事实和推断结论。
31
+
32
+ 知识沉淀建议规则:
33
+
34
+ - 按 OKF v0.1 扩展输出候选内容。
35
+ - 建议目标路径时,优先选择 `/<project>/overview/`、`/<project>/features/`、`/<project>/metrics/`、`/<project>/api/`、`/<project>/playbooks/`、`/<project>/references/`。
36
+ - 每个候选文档必须说明 `type`、`title`、`description`、`tags`、`timestamp`;API/数据类建议补充 `resource`。
37
+ - `## 相关` 必须使用有效 Markdown 链接,不要只写纯文本 concept 名。
38
+ - API Reference 候选必须包含 `## 关键实现锚点` 和 `### Agent 使用建议`。
39
+ - 只提出写入建议,不直接调用写入类工具;同时提醒更新对应目录的 `index.md` 和 `log.md`。
40
+ - 不要输出密钥、Token、明文密码、未脱敏用户数据、未公开内网 IP。
41
+
42
+ 请在当前对话中使用以下预检总结格式:
20
43
 
21
44
  ```text
22
45
  ## MCP Preflight Findings
23
46
  - CodeGraph tools used:
24
- - Related files:
25
- - Related symbols:
26
- - Callers / dependencies:
27
- - Impact scope:
47
+ - CodeGraph primary query:
48
+ - Source grouped by file:
49
+ - Current line-numbered source:
50
+ - Call paths:
51
+ - Dynamic dispatch hops:
52
+ - Blast-radius summary:
28
53
  - Knowledge Graph tools used:
54
+ - Candidate concept_ids:
55
+ - Read tools used:
56
+ - Evidence sections/chunks:
29
57
  - ADRs / decisions:
30
58
  - Module notes:
31
59
  - API notes / runbooks:
60
+ - Audit/backlink findings:
32
61
  - Missing context:
33
62
  ```
34
63
 
64
+ 把关键 MCP 发现带入 Harness 的任务文本,让审计记录保留决策上下文。
65
+
35
66
  不要在 Harness 内部实现单独的 MCP transport。SSE MCP 访问属于 Claude Code 的 MCP 客户端能力。
36
67
 
37
68
  ## Harness Command
@@ -66,7 +97,12 @@ powershell -ExecutionPolicy Bypass -File ".harness/ai-dev-harness/scripts/run-ha
66
97
  - Harness 打印的证据目录。
67
98
  - `summary.md`
68
99
  - `verify.json`
100
+ - `verify_diagnostics.json`
69
101
  - `agent_contract.json`
102
+ - `context_score.json`
103
+ - `approval_required.json`
104
+ - `loop_review.json`
105
+ - `loop_report.md`
70
106
  - `audit.jsonl`
71
107
  - MCP 工具不可用或上下文缺失情况。
72
108
 
@@ -7,29 +7,60 @@
7
7
  - `write_tests`
8
8
  - `update_docs`
9
9
 
10
- 运行 Harness 前,优先使用 Codex 已配置的 MCP 工具:
10
+ 运行 Harness 前,优先使用 Codex 已配置的 MCP 工具。
11
11
 
12
- - 查询 CodeGraph MCP,获取相关文件、符号、依赖、调用方和影响范围。
13
- - 查询 Knowledge Graph MCP,获取 ADR、模块说明、接口说明、历史决策和 runbook。
14
- - 在当前对话中简要报告 MCP 发现。
15
- - 把关键发现带入 Harness 的任务文本,让审计记录保留上下文。
12
+ CodeGraph 使用规则:
16
13
 
17
- 请使用以下预检总结格式:
14
+ - 如果使用的是 `colbymchenry/codegraph`,优先调用默认工具 `codegraph_explore`。
15
+ - 用任务里的业务流程、文件路径、函数/类/符号名、错误现象作为 query。
16
+ - 重点读取 `codegraph_explore` 返回的 grouped source、line-numbered source、call paths、dynamic dispatch hops、blast-radius summary。
17
+ - 只有当服务显式暴露了额外工具时,才使用其它 CodeGraph 工具。
18
+
19
+ Knowledge Graph 使用规则:
20
+
21
+ - 如果使用的是 browser_knowledge_service,按渐进式读取:
22
+ 1. 用 `list_path`、`search_docs`、`search_sections`、`search_chunks` 缩小范围。
23
+ 2. RAG 场景优先用 `answer_context`;需要自己控制排序时用 `hybrid_search`。
24
+ 3. 定位 concept_id 后,先用 `read_doc_outline` 看结构。
25
+ 4. 再用 `read_section`、`read_doc_range`、`read_chunk`、`get_related_chunks` 精读证据。
26
+ 5. 需要关联关系时用 `get_backlinks`,需要确认近期知识变动时用 `get_audit_log`。
27
+ - v1 不直接调用 `propose_doc` 写入知识库;只把建议写入 Harness 的 `persist_suggestions.md`。
28
+ - 区分已确认事实和推断结论。
29
+
30
+ 知识沉淀建议规则:
31
+
32
+ - 按 OKF v0.1 扩展输出候选内容。
33
+ - 建议目标路径时,优先选择 `/<project>/overview/`、`/<project>/features/`、`/<project>/metrics/`、`/<project>/api/`、`/<project>/playbooks/`、`/<project>/references/`。
34
+ - 每个候选文档必须说明 `type`、`title`、`description`、`tags`、`timestamp`;API/数据类建议补充 `resource`。
35
+ - `## 相关` 必须使用有效 Markdown 链接,不要只写纯文本 concept 名。
36
+ - API Reference 候选必须包含 `## 关键实现锚点` 和 `### Agent 使用建议`。
37
+ - 只提出写入建议,不直接调用写入类工具;同时提醒更新对应目录的 `index.md` 和 `log.md`。
38
+ - 不要输出密钥、Token、明文密码、未脱敏用户数据、未公开内网 IP。
39
+
40
+ 请在当前对话中使用以下预检总结格式:
18
41
 
19
42
  ```text
20
43
  ## MCP Preflight Findings
21
44
  - CodeGraph tools used:
22
- - Related files:
23
- - Related symbols:
24
- - Callers / dependencies:
25
- - Impact scope:
45
+ - CodeGraph primary query:
46
+ - Source grouped by file:
47
+ - Current line-numbered source:
48
+ - Call paths:
49
+ - Dynamic dispatch hops:
50
+ - Blast-radius summary:
26
51
  - Knowledge Graph tools used:
52
+ - Candidate concept_ids:
53
+ - Read tools used:
54
+ - Evidence sections/chunks:
27
55
  - ADRs / decisions:
28
56
  - Module notes:
29
57
  - API notes / runbooks:
58
+ - Audit/backlink findings:
30
59
  - Missing context:
31
60
  ```
32
61
 
62
+ 把关键发现带入 Harness 的任务文本,让审计记录保留上下文。
63
+
33
64
  不要在 Harness 内部实现或期待 SSE MCP transport。SSE MCP 访问属于 Codex MCP 客户端能力。
34
65
 
35
66
  MCP preflight 完成后,在仓库根目录运行:
@@ -46,6 +77,6 @@ powershell -ExecutionPolicy Bypass -File ".harness/ai-dev-harness/scripts/run-ha
46
77
 
47
78
  只读分析时,在任务里明确写入 “Do not modify repository files”,通常使用 `update_docs`。
48
79
 
49
- 每次 Harness 运行期间和结束后,报告可见生命周期进度、证据目录、`summary.md`、`verify.json`、`agent_contract.json`、`audit.jsonl`,以及 MCP 工具不可用或上下文缺失情况。
80
+ 每次 Harness 运行期间和结束后,报告可见生命周期进度、证据目录、`summary.md`、`verify.json`、`verify_diagnostics.json`、`agent_contract.json`、`context_score.json`、`approval_required.json`、`loop_review.json`、`loop_report.md`、`audit.jsonl`,以及 MCP 工具不可用或上下文缺失情况。
50
81
  需要时使用 `.harness/ai-dev-harness/scripts/read-evidence.ps1` 打印证据摘要。
51
82
  v1 不直接写入 Knowledge Graph;使用 `persist_suggestions.md`。