chore: 接入 CodeGraph 代码知识图谱(忽略本地索引 + AGENTS.md 用法说明)

给 agent 补一个"调用关系"能力:rg 只能搜文本,回答不了"谁调用 X / 改了会影响谁"。
CodeGraph 是本地预索引的代码知识图谱(MIT,单 MCP 工具 codegraph_explore,
C++ 有完整支持),已在 pi 里挂成 exposure=direct 的 MCP server。

本仓库实测(codegraph init):
- 6,297 个文件、170,985 个节点、628,208 条边,索引 687 MB,`.codegraph/`;
- `codegraph callers AecDbEwPipeBase::SetSection` 返回 210 个调用点;
- `codegraph impact …` 给出 214 个受影响符号并分文件列出;
- 增量 `codegraph sync` 秒级(Already up to date 2 s)。

改动:
- .gitignore 加 `.codegraph/`(本地索引,别提交);
- AGENTS.md 加一节"CodeGraph",写清可用命令、sync/unlock、以及
  "解析是启发式的,结论要用源码核实"这个限制(实测 extends 边偶有误判)。
This commit is contained in:
company-desktop committed 2026-10-30 09:44:50 +08:00
1 parent 1e453b78f3
commit ac5915ce5d
2 files changed
+16

No files matched your search

+3
View File
@@ -17,3 +17,6 @@ lib/
*.diagsession
!tools/perf_diagsession.py
__pycache__/
# CodeGraph 本地索引(codegraph init 生成,勿提交)
.codegraph/
+13
View File
@@ -72,3 +72,16 @@ powershell -NoProfile -ExecutionPolicy Bypass -File tools\run_acad_perf.ps1
| `notify-decision` | 需要用户拍板时主动推送通知(桌面 toast / IM 机器人),不让他干等终端 |
使用说明(常用命令、会话管理、Windows 终端问题、多机同步、插件取舍)见 `pi-agent-setup.md`。
## CodeGraph(代码知识图谱)
本仓库已 `codegraph init`(索引在 `.codegraph/`,已 gitignore,约 700 MB)。
适合回答 rg 做不到的问题:**谁调用 / 改了会影响谁 / 某个流程怎么串起来的**。
- MCP 工具 `codegraph_explore`(已挂进 pi,`~/.pi/agent/mcp.json`,exposure=direct);
- 命令行等价:`codegraph explore "<问题>"`、`codegraph callers <符号>`、
`codegraph impact <符号>`、`codegraph node <符号|文件>`、`codegraph query <词>`;
- 代码改动后 `codegraph sync`(增量,几秒);索引损坏/卡住用 `codegraph unlock`;
- 解析是启发式的:C++ 的宏/MFC 大量展开时关系可能不全(实测 `AecDbX3dPart → AcDbX3dSolid`
这类 `extends` 边偶有误判),**结论仍要用源码核实**;
- 提交前不要 `git add .codegraph/`。