ai-dev-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.
- package/COLLEAGUE_TRIAL_GUIDE.md +175 -0
- package/ONLINE_INSTALL_GUIDE.md +458 -0
- package/README.md +253 -54
- package/dist/agent.js +74 -49
- package/dist/approval.js +64 -0
- package/dist/audit.js +1 -0
- package/dist/checkpoint.js +83 -0
- package/dist/cli.js +326 -99
- package/dist/config.js +118 -9
- package/dist/context.js +62 -21
- package/dist/contextScore.js +44 -0
- package/dist/diagnostics.js +58 -0
- package/dist/doctor.js +100 -0
- package/dist/feedback.js +5 -0
- package/dist/init.js +8 -20
- package/dist/integration.js +84 -93
- package/dist/loop.js +116 -0
- package/dist/mcp.js +29 -112
- package/dist/metrics.js +91 -0
- package/dist/replay.js +27 -0
- package/dist/runPaths.js +31 -0
- package/dist/summarize.js +170 -39
- package/dist/templates.js +39 -215
- package/package.json +5 -2
- package/scripts/read-evidence.ps1 +45 -3
- package/scripts/run-harness.ps1 +9 -6
- package/templates/default-project/AGENTS.md +9 -0
- package/templates/default-project/SKILLS.md +13 -0
- package/templates/default-project/TOOLS.md +11 -0
- package/templates/default-project/skills/add_feature/SKILL.md +34 -0
- package/templates/default-project/skills/add_feature/context.yaml +33 -0
- package/templates/default-project/skills/add_feature/verify.yaml +2 -0
- package/templates/default-project/skills/fix_bug/SKILL.md +45 -0
- package/templates/default-project/skills/fix_bug/context.yaml +33 -0
- package/templates/default-project/skills/fix_bug/verify.yaml +2 -0
- package/templates/default-project/skills/update_docs/SKILL.md +28 -0
- package/templates/default-project/skills/update_docs/context.yaml +30 -0
- package/templates/default-project/skills/update_docs/verify.yaml +2 -0
- package/templates/default-project/skills/write_tests/SKILL.md +30 -0
- package/templates/default-project/skills/write_tests/context.yaml +32 -0
- package/templates/default-project/skills/write_tests/verify.yaml +2 -0
- package/templates/integrations/claude/SKILL.md +115 -0
- package/templates/integrations/codex/AGENTS_BLOCK.md +82 -0
- package/templates/integrations/cursor/ai-dev-harness.mdc +55 -0
- package/templates/integrations/gemini/GEMINI_BLOCK.md +46 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Skill Index
|
|
2
|
+
|
|
3
|
+
- fix_bug: diagnose and fix a defect with tests when possible.
|
|
4
|
+
- add_feature: implement a scoped feature with verification.
|
|
5
|
+
- write_tests: add or improve tests for existing behavior.
|
|
6
|
+
- update_docs: update project documentation and knowledge suggestions.
|
|
7
|
+
|
|
8
|
+
Every skill follows the same execution contract:
|
|
9
|
+
|
|
10
|
+
1. Analysis Contract: identify assumptions, affected files/modules, likely risks, and the smallest viable plan.
|
|
11
|
+
2. Execution Contract: make only task-relevant changes and avoid opportunistic refactors.
|
|
12
|
+
3. Verification Contract: run or defer verification with explicit reasons.
|
|
13
|
+
4. Report Contract: explain root cause or intent, changed files, verification, residual risk, and knowledge suggestions.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Tool Rules
|
|
2
|
+
|
|
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
|
+
- Verification commands are defined in harness.yaml and skill verify.yaml files.
|
|
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.
|
|
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.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# add_feature
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
基于现有项目模式实现范围明确的功能。
|
|
5
|
+
|
|
6
|
+
## Analysis Contract
|
|
7
|
+
- 复述功能意图和非目标。
|
|
8
|
+
- 识别受影响模块、公共接口、数据流和兼容性风险。
|
|
9
|
+
- 使用 CodeGraph 检查调用方、依赖和集成点。
|
|
10
|
+
- 使用 Knowledge Graph 检查 ADR、接口契约和历史决策。
|
|
11
|
+
|
|
12
|
+
## Execution Contract
|
|
13
|
+
- 实现满足任务的最小完整切片。
|
|
14
|
+
- 优先遵循现有模式,再考虑新增抽象。
|
|
15
|
+
- 不改变无关行为,不扩大范围。
|
|
16
|
+
- 除非任务明确允许破坏性变更,否则保持向后兼容。
|
|
17
|
+
|
|
18
|
+
## Verification Contract
|
|
19
|
+
- 行为变化时添加或更新测试。
|
|
20
|
+
- 通过 Harness 运行配置的验证命令。
|
|
21
|
+
- 记录未验证场景和原因。
|
|
22
|
+
|
|
23
|
+
## Report Contract
|
|
24
|
+
- 已实现的功能行为。
|
|
25
|
+
- 修改文件。
|
|
26
|
+
- 兼容性说明。
|
|
27
|
+
- 验证结果。
|
|
28
|
+
- 残余风险。
|
|
29
|
+
- 文档或知识沉淀建议。
|
|
30
|
+
|
|
31
|
+
## Outputs
|
|
32
|
+
- 代码变更。
|
|
33
|
+
- 测试或验证。
|
|
34
|
+
- 行为变化时的文档和知识沉淀建议。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
queries:
|
|
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
|
|
6
|
+
mcp_preflight:
|
|
7
|
+
codegraph:
|
|
8
|
+
required: true
|
|
9
|
+
primary_tool: codegraph_explore
|
|
10
|
+
ask_for:
|
|
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
|
+
knowledgeGraph:
|
|
17
|
+
required: true
|
|
18
|
+
ask_for:
|
|
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
|
|
25
|
+
stop_conditions:
|
|
26
|
+
- requirement is ambiguous
|
|
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
|
|
30
|
+
- impact scope cannot be determined
|
|
31
|
+
fallbackInclude:
|
|
32
|
+
- README.md
|
|
33
|
+
- src
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# fix_bug
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
用最小安全变更定位并修复缺陷。
|
|
5
|
+
|
|
6
|
+
## Inputs
|
|
7
|
+
- 任务描述或 Issue。
|
|
8
|
+
- CodeGraph 影响范围上下文。
|
|
9
|
+
- Knowledge Graph 中的决策、模块说明、接口说明和运行手册。
|
|
10
|
+
|
|
11
|
+
## Outputs
|
|
12
|
+
- 代码变更。
|
|
13
|
+
- 测试或验证结果。
|
|
14
|
+
- 包含根因、影响、风险和后续建议的总结。
|
|
15
|
+
|
|
16
|
+
## Analysis Contract
|
|
17
|
+
- 复述观察到的缺陷和期望行为。
|
|
18
|
+
- 识别可能根因和涉及的代码路径。
|
|
19
|
+
- 修改前列出假设和信心等级。
|
|
20
|
+
- 使用 CodeGraph 影响范围,避免遗漏调用方或依赖模块。
|
|
21
|
+
- 使用 Knowledge Graph 决策和 runbook,避免违背历史约束。
|
|
22
|
+
|
|
23
|
+
## Execution Contract
|
|
24
|
+
- 做和任务相关的最小变更。
|
|
25
|
+
- 可行时添加或更新回归测试。
|
|
26
|
+
- 不重写无关代码,不重命名公共 API,不做大范围格式化,不升级依赖。
|
|
27
|
+
- 如果根因不清楚,停止并报告缺失证据,不要猜。
|
|
28
|
+
|
|
29
|
+
## Verification Contract
|
|
30
|
+
- 通过 Harness 运行配置的验证命令。
|
|
31
|
+
- 如需手动或定向验证,说明确切命令或场景。
|
|
32
|
+
- 记录无法执行的验证及原因。
|
|
33
|
+
|
|
34
|
+
## Report Contract
|
|
35
|
+
- 根因。
|
|
36
|
+
- 修改文件。
|
|
37
|
+
- 为什么这个修复是安全的。
|
|
38
|
+
- 验证结果。
|
|
39
|
+
- 残余风险。
|
|
40
|
+
- 知识库或 runbook 更新建议。
|
|
41
|
+
|
|
42
|
+
## Acceptance
|
|
43
|
+
- 缺陷被解释清楚。
|
|
44
|
+
- 变更限定在受影响区域。
|
|
45
|
+
- 相关验证命令通过,或失败原因被记录。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
queries:
|
|
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
|
|
6
|
+
mcp_preflight:
|
|
7
|
+
codegraph:
|
|
8
|
+
required: true
|
|
9
|
+
primary_tool: codegraph_explore
|
|
10
|
+
ask_for:
|
|
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
|
+
knowledgeGraph:
|
|
17
|
+
required: true
|
|
18
|
+
ask_for:
|
|
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
|
|
25
|
+
stop_conditions:
|
|
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
|
|
29
|
+
- impact scope cannot be determined
|
|
30
|
+
- verification path is missing
|
|
31
|
+
fallbackInclude:
|
|
32
|
+
- README.md
|
|
33
|
+
- src
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# update_docs
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
更新项目文档,并提出 Knowledge Graph 沉淀建议。
|
|
5
|
+
|
|
6
|
+
## Analysis Contract
|
|
7
|
+
- 识别文档更新的读者和目的。
|
|
8
|
+
- 对照代码、CodeGraph 上下文和 Knowledge Graph 记录校验文档。
|
|
9
|
+
- 区分已确认事实和推断建议。
|
|
10
|
+
|
|
11
|
+
## Execution Contract
|
|
12
|
+
- 除非明确要求改代码,否则只更新文档或知识建议产物。
|
|
13
|
+
- 文档应简洁、可操作,并和真实项目行为一致。
|
|
14
|
+
- v1 不直接写入 Knowledge Graph。
|
|
15
|
+
|
|
16
|
+
## Verification Contract
|
|
17
|
+
- 检查文档中的链接、命令、路径和文件名。
|
|
18
|
+
- 如果文档影响生成产物或示例,运行配置的验证命令。
|
|
19
|
+
|
|
20
|
+
## Report Contract
|
|
21
|
+
- 修改的文档。
|
|
22
|
+
- 使用的事实来源。
|
|
23
|
+
- 验证结果。
|
|
24
|
+
- Knowledge Graph 沉淀建议。
|
|
25
|
+
|
|
26
|
+
## Outputs
|
|
27
|
+
- 文档变更。
|
|
28
|
+
- ADR、模块说明、runbook 或决策记录的沉淀建议。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
queries:
|
|
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
|
|
5
|
+
mcp_preflight:
|
|
6
|
+
codegraph:
|
|
7
|
+
required: false
|
|
8
|
+
primary_tool: codegraph_explore
|
|
9
|
+
ask_for:
|
|
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
|
|
14
|
+
knowledgeGraph:
|
|
15
|
+
required: true
|
|
16
|
+
ask_for:
|
|
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
|
|
23
|
+
stop_conditions:
|
|
24
|
+
- documentation target is unclear
|
|
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
|
|
28
|
+
fallbackInclude:
|
|
29
|
+
- README.md
|
|
30
|
+
- docs
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# write_tests
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
为已有行为添加或改进测试,除非必要,不改变生产行为。
|
|
5
|
+
|
|
6
|
+
## Analysis Contract
|
|
7
|
+
- 识别被测行为以及它覆盖的风险。
|
|
8
|
+
- 找到现有测试模式、fixture 和 helper API。
|
|
9
|
+
- 使用 CodeGraph 检查受影响代码路径。
|
|
10
|
+
- 不发明源码或知识上下文不支持的行为。
|
|
11
|
+
|
|
12
|
+
## Execution Contract
|
|
13
|
+
- 优先编写聚焦测试,避免脆弱的大快照或过宽集成测试。
|
|
14
|
+
- 除非现有代码不可测试且改动很小,否则不修改生产代码。
|
|
15
|
+
- fixture 应尽量确定性,并尽量局部化。
|
|
16
|
+
|
|
17
|
+
## Verification Contract
|
|
18
|
+
- 运行相关测试命令或 Harness 配置的验证命令。
|
|
19
|
+
- 如果全量测试成本过高,记录定向命令和原因。
|
|
20
|
+
|
|
21
|
+
## Report Contract
|
|
22
|
+
- 覆盖的场景。
|
|
23
|
+
- 修改文件。
|
|
24
|
+
- 验证结果。
|
|
25
|
+
- 剩余未覆盖风险。
|
|
26
|
+
|
|
27
|
+
## Outputs
|
|
28
|
+
- 测试文件或 fixture 更新。
|
|
29
|
+
- 验证结果。
|
|
30
|
+
- 覆盖场景总结。
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
queries:
|
|
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
|
|
6
|
+
mcp_preflight:
|
|
7
|
+
codegraph:
|
|
8
|
+
required: true
|
|
9
|
+
primary_tool: codegraph_explore
|
|
10
|
+
ask_for:
|
|
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
|
+
knowledgeGraph:
|
|
17
|
+
required: false
|
|
18
|
+
ask_for:
|
|
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
|
|
24
|
+
stop_conditions:
|
|
25
|
+
- expected behavior is unclear
|
|
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
|
|
29
|
+
- test data or fixture requirements are unknown
|
|
30
|
+
fallbackInclude:
|
|
31
|
+
- README.md
|
|
32
|
+
- src
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-dev-harness
|
|
3
|
+
description: 从 Claude Code 对话中触发可审计的 AI Dev Harness CLI,并在当前对话中展示 Harness 执行过程。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AI Dev Harness
|
|
7
|
+
|
|
8
|
+
当用户要求使用 Harness、AI Dev Harness、可审计执行、CodeGraph/Knowledge Graph 上下文,或要求执行 `fix_bug`、`add_feature`、`write_tests`、`update_docs` 时,使用本 Skill。
|
|
9
|
+
|
|
10
|
+
## Agent MCP Preflight
|
|
11
|
+
|
|
12
|
+
运行 Harness 命令前,优先使用 Claude Code 已配置的 MCP 工具。
|
|
13
|
+
|
|
14
|
+
CodeGraph 使用规则:
|
|
15
|
+
|
|
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
|
+
请在当前对话中使用以下预检总结格式:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
## MCP Preflight Findings
|
|
46
|
+
- CodeGraph tools used:
|
|
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:
|
|
53
|
+
- Knowledge Graph tools used:
|
|
54
|
+
- Candidate concept_ids:
|
|
55
|
+
- Read tools used:
|
|
56
|
+
- Evidence sections/chunks:
|
|
57
|
+
- ADRs / decisions:
|
|
58
|
+
- Module notes:
|
|
59
|
+
- API notes / runbooks:
|
|
60
|
+
- Audit/backlink findings:
|
|
61
|
+
- Missing context:
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
把关键 MCP 发现带入 Harness 的任务文本,让审计记录保留决策上下文。
|
|
65
|
+
|
|
66
|
+
不要在 Harness 内部实现单独的 MCP transport。SSE MCP 访问属于 Claude Code 的 MCP 客户端能力。
|
|
67
|
+
|
|
68
|
+
## Harness Command
|
|
69
|
+
|
|
70
|
+
MCP preflight 完成后,在仓库根目录运行:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
powershell -ExecutionPolicy Bypass -File ".harness/ai-dev-harness/scripts/run-harness.ps1" -Task "<task>" -Skill <skill> -Agent claude -Live
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
兜底直接命令:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
{{HARNESS_COMMAND}} run --task "<task>" --skill <skill> --agent claude --live
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Skill Mapping
|
|
83
|
+
|
|
84
|
+
- 缺陷或回归问题:`fix_bug`
|
|
85
|
+
- 范围明确的功能:`add_feature`
|
|
86
|
+
- 添加或改进测试:`write_tests`
|
|
87
|
+
- 只读分析或文档:`update_docs`
|
|
88
|
+
|
|
89
|
+
只读分析时,在任务里明确写入:“Do not modify repository files”。
|
|
90
|
+
|
|
91
|
+
## 过程汇报
|
|
92
|
+
|
|
93
|
+
命令执行期间和结束后,在当前对话中报告:
|
|
94
|
+
|
|
95
|
+
- 使用了哪些 MCP 工具,以及关键上下文发现。
|
|
96
|
+
- Harness live output 中当前可见的生命周期阶段。
|
|
97
|
+
- Harness 打印的证据目录。
|
|
98
|
+
- `summary.md`
|
|
99
|
+
- `verify.json`
|
|
100
|
+
- `verify_diagnostics.json`
|
|
101
|
+
- `agent_contract.json`
|
|
102
|
+
- `context_score.json`
|
|
103
|
+
- `approval_required.json`
|
|
104
|
+
- `loop_review.json`
|
|
105
|
+
- `loop_report.md`
|
|
106
|
+
- `audit.jsonl`
|
|
107
|
+
- MCP 工具不可用或上下文缺失情况。
|
|
108
|
+
|
|
109
|
+
必要时可读取证据:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
powershell -ExecutionPolicy Bypass -File ".harness/ai-dev-harness/scripts/read-evidence.ps1" -Run <run_id_or_path>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
除非用户明确要求直接手工处理,否则实现类任务不要绕过 Harness。
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
## AI Dev Harness
|
|
2
|
+
|
|
3
|
+
当用户要求使用 Harness、可审计执行、CodeGraph/Knowledge Graph 辅助研发,或要求执行以下技能时,使用 AI Dev Harness CLI:
|
|
4
|
+
|
|
5
|
+
- `fix_bug`
|
|
6
|
+
- `add_feature`
|
|
7
|
+
- `write_tests`
|
|
8
|
+
- `update_docs`
|
|
9
|
+
|
|
10
|
+
运行 Harness 前,优先使用 Codex 已配置的 MCP 工具。
|
|
11
|
+
|
|
12
|
+
CodeGraph 使用规则:
|
|
13
|
+
|
|
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
|
+
请在当前对话中使用以下预检总结格式:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
## MCP Preflight Findings
|
|
44
|
+
- CodeGraph tools used:
|
|
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:
|
|
51
|
+
- Knowledge Graph tools used:
|
|
52
|
+
- Candidate concept_ids:
|
|
53
|
+
- Read tools used:
|
|
54
|
+
- Evidence sections/chunks:
|
|
55
|
+
- ADRs / decisions:
|
|
56
|
+
- Module notes:
|
|
57
|
+
- API notes / runbooks:
|
|
58
|
+
- Audit/backlink findings:
|
|
59
|
+
- Missing context:
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
把关键发现带入 Harness 的任务文本,让审计记录保留上下文。
|
|
63
|
+
|
|
64
|
+
不要在 Harness 内部实现或期待 SSE MCP transport。SSE MCP 访问属于 Codex MCP 客户端能力。
|
|
65
|
+
|
|
66
|
+
MCP preflight 完成后,在仓库根目录运行:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
powershell -ExecutionPolicy Bypass -File ".harness/ai-dev-harness/scripts/run-harness.ps1" -Task "<task>" -Skill <skill> -Agent codex -Live
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
兜底直接命令:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
{{HARNESS_COMMAND}} run --task "<task>" --skill <skill> --agent codex --live
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
只读分析时,在任务里明确写入 “Do not modify repository files”,通常使用 `update_docs`。
|
|
79
|
+
|
|
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 工具不可用或上下文缺失情况。
|
|
81
|
+
需要时使用 `.harness/ai-dev-harness/scripts/read-evidence.ps1` 打印证据摘要。
|
|
82
|
+
v1 不直接写入 Knowledge Graph;使用 `persist_suggestions.md`。
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 使用 AI Dev Harness 执行可审计研发任务
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AI Dev Harness
|
|
7
|
+
|
|
8
|
+
当用户要求使用 Harness、可审计执行、CodeGraph/Knowledge Graph 辅助研发,或要求执行 `fix_bug`、`add_feature`、`write_tests`、`update_docs` 时,优先使用 AI Dev Harness。
|
|
9
|
+
|
|
10
|
+
## MCP Preflight
|
|
11
|
+
|
|
12
|
+
运行 Harness 前,先使用 Cursor 当前可用的 MCP 工具收集上下文:
|
|
13
|
+
|
|
14
|
+
- CodeGraph:优先围绕任务、文件、符号、调用链和影响范围查询,记录使用过的工具与关键发现。
|
|
15
|
+
- Knowledge Graph:优先查找 ADR、模块说明、接口说明、runbook、历史决策和踩坑记录。
|
|
16
|
+
- 不要在 Harness 内实现 MCP transport;MCP 调用属于当前 Agent/编辑器的能力。
|
|
17
|
+
- 不要直接写入 Knowledge Graph,只在 Harness 产物 `persist_suggestions.md` 中提出沉淀建议。
|
|
18
|
+
|
|
19
|
+
请在当前对话中先输出:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
## MCP Preflight Findings
|
|
23
|
+
- CodeGraph tools used:
|
|
24
|
+
- CodeGraph primary query:
|
|
25
|
+
- Source grouped by file:
|
|
26
|
+
- Current line-numbered source:
|
|
27
|
+
- Call paths:
|
|
28
|
+
- Dynamic dispatch hops:
|
|
29
|
+
- Blast-radius summary:
|
|
30
|
+
- Knowledge Graph tools used:
|
|
31
|
+
- Candidate concept_ids:
|
|
32
|
+
- Read tools used:
|
|
33
|
+
- Evidence sections/chunks:
|
|
34
|
+
- ADRs / decisions:
|
|
35
|
+
- Module notes:
|
|
36
|
+
- API notes / runbooks:
|
|
37
|
+
- Audit/backlink findings:
|
|
38
|
+
- Missing context:
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Harness Command
|
|
42
|
+
|
|
43
|
+
MCP preflight 完成后,在仓库根目录运行:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
powershell -ExecutionPolicy Bypass -File ".harness/ai-dev-harness/scripts/run-harness.ps1" -Task "<task>" -Skill <skill> -Agent cursor -Live
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
兜底命令:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
{{HARNESS_COMMAND}} run --task "<task>" --skill <skill> --agent cursor --live
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
执行结束后,向用户报告 Harness 证据目录、生命周期状态、验证结果、审批门禁、Context Score、Loop Review 和知识沉淀建议。
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
## AI Dev Harness
|
|
2
|
+
|
|
3
|
+
当用户要求使用 Harness、可审计执行、CodeGraph/Knowledge Graph 辅助研发,或要求执行 `fix_bug`、`add_feature`、`write_tests`、`update_docs` 时,优先使用 AI Dev Harness CLI。
|
|
4
|
+
|
|
5
|
+
运行 Harness 前,先使用 Gemini 当前可用的 MCP 工具收集上下文:
|
|
6
|
+
|
|
7
|
+
- CodeGraph:围绕任务、文件、符号、调用链和影响范围查询,记录使用过的工具与关键发现。
|
|
8
|
+
- Knowledge Graph:查询 ADR、模块说明、接口说明、runbook、历史决策和踩坑记录。
|
|
9
|
+
- Harness 不负责连接 MCP;MCP 调用由当前 Agent 完成。
|
|
10
|
+
- 不要直接写入 Knowledge Graph,只在 Harness 产物 `persist_suggestions.md` 中提出沉淀建议。
|
|
11
|
+
|
|
12
|
+
请在当前对话中先输出:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
## MCP Preflight Findings
|
|
16
|
+
- CodeGraph tools used:
|
|
17
|
+
- CodeGraph primary query:
|
|
18
|
+
- Source grouped by file:
|
|
19
|
+
- Current line-numbered source:
|
|
20
|
+
- Call paths:
|
|
21
|
+
- Dynamic dispatch hops:
|
|
22
|
+
- Blast-radius summary:
|
|
23
|
+
- Knowledge Graph tools used:
|
|
24
|
+
- Candidate concept_ids:
|
|
25
|
+
- Read tools used:
|
|
26
|
+
- Evidence sections/chunks:
|
|
27
|
+
- ADRs / decisions:
|
|
28
|
+
- Module notes:
|
|
29
|
+
- API notes / runbooks:
|
|
30
|
+
- Audit/backlink findings:
|
|
31
|
+
- Missing context:
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
MCP preflight 完成后,在仓库根目录运行:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
powershell -ExecutionPolicy Bypass -File ".harness/ai-dev-harness/scripts/run-harness.ps1" -Task "<task>" -Skill <skill> -Agent gemini -Live
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
兜底命令:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
{{HARNESS_COMMAND}} run --task "<task>" --skill <skill> --agent gemini --live
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
执行结束后,向用户报告 Harness 证据目录、生命周期状态、验证结果、审批门禁、Context Score、Loop Review 和知识沉淀建议。
|