Project Brain 功能设计文档(FSD)
1. 功能架构
┌─────────────────────────────────────────────────────────────────┐
│ Agent 侧(Skill) │
│ 职责:意图解析、场景编排、多步调用、结果整合 │
│ 复用 Agent 已有的 LLM 能力 │
├─────────────────────────────────────────────────────────────────┤
│ Project Brain(MCP Server) │
├─────────────────────────────────────────────────────────────────┤
│ MCP Tools(20 个工具) │
│ 搜索类: keyword_search | locate_symbol | get_symbol_info | │
│ list_documents │
│ 上下文类: get_context | get_content | get_module_contents | │
│ get_file_symbols │
│ 关系类: get_call_graph | get_dependencies │
│ 测试类: get_related_tests | test_recommendation │
│ 历史类: get_history | get_owner | get_change_diff │
│ 约定/文档类: get_conventions | get_doc_links │
│ 推理类: impact_analysis │
│ 能力声明类: get_graph_capabilities │
│ 文档导入类: pull_wiki │
├─────────────────────────────────────────────────────────────────┤
│ Query Engine │
│ 可配置检索策略: keyword | keyword+graph │
├─────────────────────────────────────────────────────────────────┤
│ Reasoning Engine │
│ impact_analysis | test_recommendation │
├─────────────────────────────────────────────────────────────────┤
│ Build Engine │
│ code_parse | document_parse | history_parse | link_build | │
│ convention_extract | test_parse │
├─────────────────────────────────────────────────────────────────┤
│ Storage Engine │
│ 混合存储: JSON (< 10万行) | SQLite (≥ 10万行) │
│ 索引: 关键词(必需) | 代码块(必需) | 签名 | Diff | 别名 | 图(可选) │
├─────────────────────────────────────────────────────────────────┤
│ Watch Engine │
│ file_watch | incremental_update | cross_graph_links_rebuild | │
│ git_history_update | persist │
└─────────────────────────────────────────────────────────────────┘
2. MCP Tools(底层查询原语)
通用输出字段:所有 Tool 输出均包含
freshness字段,表示数据新鲜度。{ "freshness": { "status": "fresh | stale | building", "last_updated": "2024-01-15T10:30:00Z", "warning": null | "图谱正在更新,结果基于旧版本数据" } }
2.1 搜索类
keyword_search
功能描述:关键词搜索(BM25,开启语义检索时为 BM25+向量混合)。支持按 test/normal 过滤。
输入:
query: 搜索关键词scope: 可选,限定搜索范围(模块/目录)test_filter: 可选,过滤测试函数(normal=仅非测试,test=仅测试,all=全部,默认 normal)top_k: 可选,返回结果数量(默认 20)
输出:
{
"results": [
{
"file": "src/order/timeout.rs",
"line": 42,
"content": "fn handle_order_timeout(order_id: &str) {",
"symbol_id": "fn_handle_order_timeout",
"kind": "function",
"score": 0.85
}
],
"total": 5
}
locate_symbol
功能描述:符号定位(类/函数/模块/变量)。
输入:
symbol_name: 符号名称kind: 可选,限定符号类型(class/function/module/struct/enum)
输出:
{
"symbols": [
{
"id": "fn_handle_order_timeout",
"name": "handle_order_timeout",
"kind": "function",
"file": "src/order/timeout.rs",
"line_start": 42,
"line_end": 58,
"signature": "fn handle_order_timeout(order_id: &str) -> Result<(), Error>",
"module": "order",
"class": null,
"docstring": "处理订单超时..."
}
]
}
get_symbol_info
功能描述:获取符号详细信息。支持按需返回关联信息。
输入:
symbol_id: 符号 IDinclude: 可选,指定返回哪些关联信息(callers/callees/tests/docs/source/any,默认 any)
输出:
{
"id": "fn_handle_order_timeout",
"name": "handle_order_timeout",
"kind": "function",
"signature": "...",
"file": "src/order/timeout.rs",
"line_start": 42,
"line_end": 58,
"module": "order",
"class": null,
"visibility": "public",
"params": [{"name": "order_id", "type": "&str"}],
"return_type": "Result<(), Error>",
"docstring": "...",
"callers": ["fn_process_order", "fn_check_timeout"],
"callees": ["fn_cancel_order", "fn_refund_payment"],
"tests": ["test_timeout_handling"],
"docs": ["doc_order_design"],
"source": "fn handle_order_timeout(order_id: &str) -> Result<(), Error> {\n ...\n}"
}
list_documents
功能描述:列出项目文档目录,供 Agent LLM 判断需要读取哪些文档。
输入:
scope: 可选,限定搜索范围(目录/模块路径)pattern: 可选,glob 模式过滤(如*.md、docs/**)
输出:
{
"documents": [
{
"id": "doc_architecture",
"title": "系统架构设计",
"path": "docs/architecture_design.md",
"summary": "描述 Project Brain 的整体架构,包括 MCP Server、Query Engine...",
"section_titles": [
"1. 系统上下文",
"2. 调用流程",
"8. Build Engine",
"9. Knowledge Graph",
"10. File Watcher"
],
"line_count": 1245
},
{
"id": "doc_api",
"title": "API 参考",
"path": "docs/api.md",
"summary": "MCP Tool 的完整 API 参考文档",
"section_titles": [
"1. 搜索类",
"2. 关系类",
"3. 测试类"
],
"line_count": 450
}
],
"total": 2
}
2.2 上下文类
get_context
功能描述:围绕目标符号获取多维上下文,用于 RAG 上下文组装。
输入:
target: 符号 ID 或符号名scope: 可选,指定返回哪些上下文(callers/callees/tests/docs/params/all,默认 all)depth: 可选,递归深度(默认 1)
输出:
{
"target": "fn_handle_order_timeout",
"context": {
"callers": [
{"id": "fn_process_order", "name": "process_order", "relation": "caller"}
],
"callees": [
{"id": "fn_cancel_order", "name": "cancel_order", "relation": "callee"}
],
"tests": [
{"id": "test_timeout_handling", "name": "test_timeout_handling"}
],
"docs": [
{"id": "doc_order_design", "title": "订单模块设计文档", "section": "超时处理"}
],
"params": [
{"name": "order_id", "type": "&str", "description": "订单 ID"}
]
}
}
get_content
功能描述:获取符号或文档的源代码/文本内容。
输入:
target: 符号 ID / 文档 ID / 文件路径kind: 可选,指定获取类型(function/class/section/file/any,默认 any)section: 可选,指定文档的章节名include_source: 可选,是否包含源代码(默认 true)
输出:
{
"target": "fn_handle_order_timeout",
"kind": "function",
"file": "src/order/timeout.rs",
"line_start": 42,
"line_end": 58,
"source": "fn handle_order_timeout(order_id: &str) -> Result<(), Error> {\n let order = get_order(order_id)?;\n if order.is_expired() {\n cancel_order(order_id)?;\n return Err(Error::Timeout);\n }\n Ok(())\n}",
"token_count": 45
}
2.3 调用关系类
get_call_graph
功能描述:查询函数的调用图(BFS 遍历),支持查询调用方(callers)、被调用方(callees)或两者(both)。
输入:
function_id: 函数 ID 或函数名direction: 可选,方向(callers=谁调用我,callees=我调用谁,both=两者,默认 both)depth: 可选,递归深度(默认 1)
输出:
{
"target": "fn_handle_order_timeout",
"callers": [
{
"id": "fn_process_order",
"name": "process_order",
"file": "src/order/service.rs",
"line": 128,
"depth": 1
}
],
"callees": [
{
"id": "fn_cancel_order",
"name": "cancel_order",
"file": "src/order/service.rs",
"line": 48,
"depth": 1
}
]
}
2.4 依赖关系类
get_dependencies
功能描述:获取模块依赖关系。
输入:
module_id: 模块 ID 或模块名direction: "up"(谁依赖我)| "down"(我依赖谁)| "both"
输出:
{
"target": "order",
"upstream": [
{"id": "api", "name": "api", "type": "import"},
{"id": "scheduler", "name": "scheduler", "type": "import"}
],
"downstream": [
{"id": "payment", "name": "payment", "type": "import"},
{"id": "inventory", "name": "inventory", "type": "import"}
]
}
2.5 模块/文件类
get_module_contents
功能描述:获取模块下的所有内容(类、函数、子模块)。
输入:
module_id: 模块 ID 或模块路径
输出:
{
"module": {
"id": "order",
"name": "order",
"path": "src/order"
},
"submodules": ["timeout", "service", "model"],
"classes": [
{"id": "OrderService", "name": "OrderService", "kind": "struct"},
{"id": "Order", "name": "Order", "kind": "struct"}
],
"functions": [
{"id": "fn_create_order", "name": "create_order", "visibility": "public"},
{"id": "fn_cancel_order", "name": "cancel_order", "visibility": "public"}
]
}
get_file_symbols
功能描述:获取文件中定义的所有符号。
输入:
file_path: 文件路径
输出:
{
"file": "src/order/timeout.rs",
"symbols": [
{"id": "fn_handle_order_timeout", "name": "handle_order_timeout", "kind": "function", "line": 42},
{"id": "struct_TimeoutConfig", "name": "TimeoutConfig", "kind": "struct", "line": 10}
]
}
2.6 测试类
get_related_tests
功能描述:获取与符号关联的测试。
输入:
symbol_id: 符号 ID 或符号名
输出:
{
"target": "fn_handle_order_timeout",
"tests": [
{
"id": "test_timeout_handling",
"name": "test_timeout_handling",
"file": "tests/order/timeout_test.rs",
"line": 28,
"framework": "rust_test"
}
]
}
get_test_coverage
注:此工具为早期设计,当前未实现。测试相关能力由
get_related_tests(符号关联测试)和test_recommendation(基于修改文件的测试推荐)覆盖。
2.7 历史/归属类
get_history
功能描述:获取符号/文件的修改历史。
输入:
target: 符号 ID 或文件路径limit: 可选,返回数量(默认 10)
输出:
{
"target": "fn_handle_order_timeout",
"commits": [
{
"sha": "abc123",
"author": "Alice",
"timestamp": "2024-01-15T10:30:00Z",
"message": "fix: 修复超时处理中的竞态条件",
"files_changed": 3
}
]
}
get_owner
功能描述:获取符号/文件的归属信息。
输入:
target: 符号 ID 或文件路径
输出:
{
"target": "src/order/timeout.rs",
"owners": [
{"author": "Alice", "commit_count": 15, "line_changes": 230},
{"author": "Bob", "commit_count": 8, "line_changes": 120}
],
"last_modified": "2024-01-15T10:30:00Z"
}
get_change_diff
功能描述:获取 commit/文件/符号的变更 diff,支持多种格式输出(用于样本对提取)。
输入:
target: commit SHA / 文件路径 / 符号 IDformat: 可选,输出格式(unified/side_by_side/pair,默认 unified)
输出:
{
"target": "abc123",
"format": "pair",
"changes": [
{
"file": "src/order/timeout.rs",
"change_type": "modified",
"before": "fn handle_timeout(order_id: &str) {\n // old logic\n}",
"after": "fn handle_timeout(order_id: &str) {\n // new logic with retry\n}",
"changed_functions": ["fn_handle_timeout"]
}
]
}
2.8 约定/文档类
get_conventions
功能描述:获取项目约定。
输入:
scope: 可选,模块名(空则返回全局约定)
输出:
{
"conventions": [
{
"category": "architecture",
"name": "DDD分层",
"description": "项目采用 DDD 架构,分为 controller/service/domain/infrastructure 四层"
},
{
"category": "naming",
"name": "函数命名",
"description": "函数使用 snake_case 命名"
}
]
}
get_doc_links
功能描述:获取与符号关联的文档。
输入:
symbol_id: 符号 ID
输出:
{
"target": "fn_handle_order_timeout",
"documents": [
{
"id": "doc_order_design",
"title": "订单模块设计文档",
"path": "docs/design/order.md",
"section": "超时处理",
"relevance": "explicit"
}
]
}
2.8 推理分析类
impact_analysis
功能描述:分析修改的影响范围。
输入:
target: 符号 ID 或符号名
输出:
{
"target": "fn_handle_order_timeout",
"affected_modules": ["order", "api", "scheduler"],
"affected_functions": [
{"id": "fn_process_order", "name": "process_order", "relation": "caller"},
{"id": "fn_check_timeout", "name": "check_timeout", "relation": "caller"}
],
"affected_tests": [
{"id": "test_timeout_handling", "name": "test_timeout_handling"}
],
"risk_level": "medium",
"risk_reasons": [
"2 个直接调用方",
"1 个关联测试"
]
}
test_recommendation
功能描述:根据修改文件推荐测试。
输入:
file_paths: 修改的文件路径列表
输出:
{
"modified_files": ["src/order/timeout.rs"],
"recommended_tests": [
{
"id": "test_timeout_handling",
"name": "test_timeout_handling",
"file": "tests/order/timeout_test.rs",
"reason": "直接测试修改的函数 handle_order_timeout"
},
{
"id": "test_order_processing",
"name": "test_order_processing",
"file": "tests/order/service_test.rs",
"reason": "测试调用了修改的函数"
}
]
}
3. Skill 场景编排(Agent 侧)
3.1 增量功能开发
场景:定位实现位置
用户: "加一个订单超时自动取消的功能"
│
▼
Skill 编排:
1. keyword_search("订单超时 order timeout cancel")
2. locate_symbol("OrderService")
3. get_module_contents("order")
4. get_conventions("order")
│
▼
整合结果,用 LLM 生成回复
场景:发现可复用组件
用户: "项目里有没有现成的 HTTP Client?"
│
▼
Skill 编排:
1. keyword_search("http client HttpClient request")
2. locate_symbol("HttpClient", kind="class")
3. locate_symbol("http_client", kind="function")
│
▼
整合结果,列出可复用组件
3.2 代码重构
场景:评估影响范围
用户: "我要把 calculatePrice 的签名改了"
│
▼
Skill 编排:
1. locate_symbol("calculatePrice")
2. get_call_graph("calculatePrice", direction="callers", depth=3)
3. get_related_tests("calculatePrice")
4. impact_analysis("calculatePrice")
│
▼
整合结果,生成影响报告
场景:理解模块结构
用户: "order 模块是做什么的?"
│
▼
Skill 编排:
1. get_module_contents("order")
2. get_conventions("order")
3. get_dependencies("order", direction="both")
4. get_doc_links("order")
│
▼
整合结果,生成模块说明
3.3 代码修正(Bug Fix)
场景:从现象定位根因
用户: "下单后库存没有扣减"
│
▼
Skill 编排:
1. keyword_search("库存扣减 inventory deduct reserve")
2. locate_symbol("InventoryService")
3. get_call_graph("deductInventory", direction="callers")
4. get_history("deductInventory")
│
▼
整合结果,定位可疑代码和最近修改
场景:理解代码上下文
用户: "这段代码为什么这样写?"
│
▼
Skill 编排:
1. get_symbol_info("当前函数")
2. get_history("当前函数", limit=20)
3. get_doc_links("当前函数")
│
▼
整合结果,解释代码背景
3.4 测试保障
场景:测试覆盖分析
用户: "order 模块测试覆盖怎么样?"
│
▼
Skill 编排:
1. get_module_contents("order")
2. get_related_tests("order") // 各符号关联测试
3. test_recommendation(["src/order/"]) // 推荐需运行的测试
│
▼
整合结果,生成覆盖报告和改进建议
4. Query Engine
4.1 可配置检索策略
配置方式(.botbrain/config.yaml):
search:
strategy: keyword # keyword | keyword+graph
4.2 Keyword Search(保底,始终可用)
功能描述:基于关键词的全文搜索,类似 grep。
索引范围:
- 代码符号(类名、函数名、变量名)
- 文档标题和关键词
- 文件名
- 代码内容
支持正则表达式匹配。
4.3 Graph Search(可选)
功能描述:基于图谱的关系遍历查询。
支持的遍历:
- CALL 边:调用链追踪
- DEPEND 边:依赖分析
- TEST 边:测试关联
- DESCRIBE 边:文档关联
- MODIFY 边:历史变更
4.4 降级策略
- 图谱未构建时,自动降级到 keyword
- keyword 始终可用
5. Reasoning Engine
5.1 Impact Analysis
功能描述:基于图谱的修改影响分析。
处理流程:
- 定位目标节点
- 依赖展开(沿 DEPEND 边)
- 调用展开(沿 CALL 边)
- 测试展开(沿 TEST 边反向)
- 风险评分
依赖:Knowledge Graph 已构建
5.2 Test Recommendation
功能描述:基于修改文件推荐测试。
处理流程:
- 文件 → 函数映射
- 函数 → 关联测试查找
- 按关联强度排序
依赖:Knowledge Graph 已构建
5.3 Change Risk Analysis
功能描述:评估变更方案的风险。
处理流程:
- 每个变更节点分析:
- 依赖影响范围
- 历史变更频率(热点分析)
- 测试覆盖度
- 综合风险评分
依赖:Knowledge Graph 已构建
6. Build Engine
6.1 Code Parse
功能描述:解析源代码,提取结构化信息。
输入:Git Repository
处理流程:
- 扫描项目文件(按语言过滤)
- Tree-sitter 解析生成 CST
- 提取 AST 信息
- 构建 Code Graph
输出:Repository、Module、Class、Function、File 节点 + CONTAIN、CALL、DEPEND、IMPLEMENT、IMPORT 边
支持语言:C、C++、Python、Rust、TypeScript
6.2 Document Parse
功能描述:解析项目文档,提取结构化信息。
输入:项目内 Markdown 文件
处理流程:
- 标题层级解析 → Section 节点
- 代码引用识别 → DESCRIBE 边
- 概念提取 → Concept 节点
输出:Document、Section、Concept 节点 + CONTAIN、REFERENCE 边
支持格式:Markdown(P0)
6.3 History Parse
功能描述:解析 Git 历史,提取变更信息。
输入:Git Repository
输出:Commit、PR 节点 + MODIFY、AUTHOR、BELONG 边
6.4 Link Build
功能描述:建立跨图谱的关联关系。
处理流程:
- Explicit Link:文档中直接引用的代码符号 → DESCRIBE 边
- Historical Link:Commit/PR 关联 → MODIFY/BELONG 边
输出:Link Graph(跨图关联边)
注:Semantic Link(基于 Embedding 匹配)为可选扩展,需用户配置 Embedding API。MCP Server 通过 HTTP 调用外部 API 获取向量,自身零 LLM 依赖。
6.5 Convention Extract [P1]
P0 阶段说明:自动提取能力为 P1。P0 仅支持读取
.botbrain/conventions.yaml手动声明的约定。
功能描述:提取项目约定。
P0 处理流程:
- 读取
.botbrain/conventions.yaml手动声明 - 返回约定列表
P1 处理流程(自动提取):
- 代码结构分析(目录结构、分层模式)
- 命名模式分析(snake_case/PascalCase 等)
- 文档提取(README、CONTRIBUTING)
- 配置合并(手动配置优先级最高)
输出:Convention 节点 + GOVERN 边
6.6 Test Parse
功能描述:识别测试代码,建立测试与生产代码关联。
输入:项目源代码 + 测试代码
处理流程:
- 识别测试文件(目录约定 + 文件命名)
- 识别测试函数(框架标记 + 命名约定)
- 建立测试关联(显式引用 + 命名匹配 + 目录映射)
输出:Test 节点 + TEST 边(携带关联强度标记:explicit/naming/directory)
各语言测试识别:
| 语言 | 测试框架 | 测试标记 | 测试目录 |
|---|---|---|---|
| Python | pytest/unittest | @pytest.mark, TestCase | tests/ |
| Rust | lib test | #[test] | 同文件 #[cfg(test)] |
| TypeScript | Jest/Vitest | describe/it/test | tests/, *.test.ts |
| C++ | GoogleTest | TEST_F, TEST | test/ |
| C | 无标准 | 无标准 | test/ |
| Go | go test | Test/Benchmark/Example/Fuzz 前缀 | 同包 *_test.go |
| Java | JUnit | *Test.java/*Tests.java 命名 | test/ |
7. Storage Engine
7.1 混合存储
存储策略:
- 项目规模 < 10万行:JSON 文件
- 项目规模 ≥ 10万行:SQLite
- 用户可通过
config.yaml手动锁定存储方案
存储位置:.botbrain/
目录结构:
.botbrain/
├── config.json # 项目配置
├── graph/
│ ├── nodes.json/.db # 节点数据
│ ├── edges.json/.db # 边数据
│ └── metadata.json # 图谱元信息
├── index/
│ ├── keyword.idx # 关键词索引(必需)
│ └── symbol.idx # 符号索引(必需)
└── cache/
7.2 分级索引
| 索引 | 类型 | 必需性 | 用途 |
|---|---|---|---|
| 关键词索引 | 倒排索引 | 必需 | Keyword Search(保底) |
| 符号索引 | 哈希表 | 必需 | 符号定位、增量更新 |
| 图索引 | 内存邻接表 | 可选 | Graph Search |
8. Watch Engine
8.1 File Watch
功能描述:监听文件系统变更,支持双模式自动切换。
监听模式:
| 模式 | 实现 | 适用场景 | 说明 |
|---|---|---|---|
| inotify | watchdog Observer | 本地文件系统 | 实时事件驱动,零延迟 |
| polling | _PollingWatcher | NFS/CIFS/SMB 等网络文件系统 | 自动降级,两阶段检测 |
自动检测:读取 /proc/mounts 判断项目所在文件系统类型,不支持 inotify 时自动切换 polling。
Polling 两阶段检测:
- 快速阶段(每 1 秒):stat 已知文件,检测修改(mtime/size 变化)
- 慢速阶段(每 3 个周期):全量扫描,检测新增/删除文件
去抖策略(Debounce):
文件变更 → 记录到 pending 队列 → 启动 Timer (2-5秒)
↓
新变更到达 → 取消旧 Timer → 重新启动 Timer
↓
Timer 到期 → 批量处理所有 pending 变更
忽略规则:
- 忽略隐藏目录(以
.开头) - 忽略目录:
.git,__pycache__,.venv,node_modules,.botbrain,.pytest_cache,target
8.2 Incremental Update
触发条件:文件变更后 2-5 秒(去抖)
处理流程:
1. 文件删除? → handle_delete()
- 移除该文件相关的所有节点
- 移除相关边
- 更新索引
2. 新文件? → _parse_new_file()
- 按扩展名识别语言
- Tree-sitter 解析
- 创建节点和边
- 更新索引
3. 内容变更? → MD5 比对
- new_md5 == old_md5 → 跳过(内容未变)
- new_md5 != old_md5 → 删除旧节点 + 重新解析
4. 更新范围:
- 只重新解析变更的文件
- 更新 KeywordIndex, SymbolIndex, FileIndex
性能要求:< 10秒
8.3 Freshness 追踪(Python 版)
功能描述:追踪图谱构建状态,查询结果携带数据新鲜度信息。
实现方式:_FreshnessTrackingUpdater 继承 IncrementalUpdater
更新流程:
build_status = "building"super().update()→ 文件增量更新_update_cross_graph_links()→ 重建跨图谱链接(Document → Code 的 DESCRIBE 边)_update_git_history()→ 检测新 commit,建立 Commit → File 的 MODIFY 边store.save()→ 持久化到.botbrain/graph/build_status = "idle",last_updated = now()
查询结果携带 freshness:
{
"freshness": {
"status": "fresh | stale | building",
"last_updated": "2024-01-15T10:30:00Z",
"warning": null | "图谱正在更新,结果基于旧版本数据"
}
}
8.4 并发模型
读写分离:
- 查询请求:读取当前已提交的图谱快照(只读)
- 增量构建:在写副本上操作,完成后原子切换
- 构建期间查询不阻塞,返回上一版本数据
实现方式:
- Python: 使用线程锁 (
_query_engine._lock) - Rust: 使用
Arc<Mutex<Box<dyn GraphStore>>>共享 store
8.5 Scheduled Full Rebuild
触发条件:每 1 小时
执行方式:后台执行,不阻塞查询
8.6 监听暂停/恢复(pull_wiki 使用)
pull_wiki 工具在下载 wiki 文档期间暂停文件监听,避免每个写入文件触发增量重建:
_pause_file_watcher():仅停止 OS observer(WatcherManager.stop),保留self._updater与 reconciler 存活。区别于_stop_watcher(会销毁 updater 并强制 reconcile)。_resume_file_watcher():仅重建 observer(_create_watcher_manager),不重新 reconcile。- 调用顺序:
pause → download → _updater.update(files) → resume(update 在 resume 前, 避免与 watcher 驱动的更新竞争;resume 在 finally 块保证即使失败也恢复)。
9. P0 交付清单
基准版本:以 Python 版(
src/project_brain/)完整实现为准。
9.1 Project Brain(MCP Server)
必需功能:
MCP Tools(20 个):
搜索类(4):
上下文类(4):
关系类(2):
测试类(2):
历史类(3):
约定/文档类(2):
推理类(1):
能力声明类(1):
文档导入类(1):
Build Engine:
Storage:
Watch:
9.2 Skill(Agent 侧)
必需功能:
9.3 可选功能(需 graph 策略启用)
9.4 交付目标
P0 完成标准:
支持 Agent 完成以下核心任务:
- 增量功能开发:定位实现位置、理解项目约定、发现可复用组件
- 代码重构:理解现有结构、评估影响范围
- 代码修正:从现象定位根因、理解上下文后修复
- 测试保障:测试覆盖分析
- RAG 上下文组装:获取代码/文档片段 + 多维上下文
- 样本对提取:从 commit diff 获取 before/after 代码对