nuwa-skill
alchaincyf
你想蒸馏的下一个员工,何必是同事。蒸馏任何人的思维方式——心智模型、决策启发式、表达DNA。Distill how anyone thinks.
PROJECT TOPICS
PROJECT README
给 DSH 装上「预索引的代码知识图谱」:Agent 读代码不再盲 grep,而是查调用链、影响面、数据流——切分支自动跟随,索引图永远对应当前检出分支。
# GitHub
dsh plugin add github:hoyyang/dsh-code-graph
# 或 npm
dsh plugin add dsh-code-graph-plugin
~/.local/bin/codebase-memory-mcp,可用 config.bin 改路径)。引擎缺失时 fail-loud 点名报错,不影响 DSH 启动。dsh plugin --profile web remove dsh-code-graph——卸载即净:工具/命令/提示 section/skill 文件/状态文件全部自动清理,不碰图数据库与用户仓库。callers /callees /impact(调用方逐层 BFS)/ trace(调用与数据流路径)/ architecture(架构概览),LSP 级跨文件解析,覆盖 158+ 语言。branch 参数直查已建索引的非检出分支(冻结态,不做保鲜)。/codegraph 查看已索引项目与分支状态。/codegraph <仓库绝对路径> fast(也支持 moderate/full)。⚠️ fast/moderate 只索引 filtered files 子集,可能静默漏文件(大仓实测 fast 仅覆盖 1/3 Java 文件);要完整图显式用 full。codegraph { "op": "callers", "repo_path": "<repo>", "name": "handleRequest" }git checkout release/x 后继续提问,索引自动跟随。路径__分支(一分支一库)。maxBranchProjects(默认 6);切回已访问分支零重索引。branchIndexMaxDbBytes 即 500MB):每仓只留当前分支一份索引;每次使用核对当前检出分支,不一致删旧建新(fast 全量重建,可能分钟级)——稳态磁盘恒 1 份。branch 参数:codegraph { "op": "callers", "repo_path": "<repo>", "branch": "release/x", "name": "..." }——仅限已建索引分支;非检出分支为冻结态(不做保鲜)。__detached-<sha7> 命名;非 git 目录与 branchIndex=false 时回退单索引跟随行为。op=status 返回当前分支、模式(multi/single)与可用分支清单。| 键 | 默认 | 说明 |
|---|---|---|
| bin | ~/.local/bin/codebase-memory-mcp | 引擎二进制路径 |
| defaultMode | fast | index 默认模式(fast=filtered files 可能静默漏文件;完整图显式 mode=full;对已有 full 图做增量不降级) |
| fresh | true | 查询前保鲜门控 |
| freshThrottleSec | 120 | 重索引防抖窗口(秒) |
| maxRows | 50 | 查询返回行数上限 |
| hint | true | 条件系统提示开关 |
| skill | true | skill 文件落盘开关 |
| gate | true | grep 门禁开关(未先调 codegraph 的代码 grep 被 deny) |
| branchIndex | true | 分支索引层总开关(false 回退单索引跟随行为) |
| maxBranchProjects | 6 | multi 模式每仓库分支项目上限(LRU) |
| branchIndexMaxDbBytes | 524288000 | 超过该 DB 字节数转 single(大仓滚动单索引)模式 |
| op | 用途 |
|---|---|
| projects | 列已索引项目 |
| status | 索引状态 + 分支清单 |
| index | 建/增量索引(仅主 agent) |
| query | BM25 符号/全文检索 |
| callers / callees | 直接调用关系 |
| impact | 向上影响面 BFS(深度 1-8) |
| trace | 调用/数据流路径 |
| architecture | 架构概览 |
| snippet | 按 qualified_name 取代码 |
| changes | 变更检测(git ref 级) |
插件是 DSH 原生 toolkit:唯一工具 codegraph 按需 spawn 本机 codebase-memory 引擎 CLI(JSON 走 stdin,空闲即走,无常驻连接、零 MCP 会话)。索引按分支持久化为独立图库;查询前做保鲜门控(HEAD+脏树签名比对);tools/pre-execute 事件上挂读代码门禁;分支层在查询时惰性解析当前检出分支并维护分支注册表(LRU 淘汰 / 大仓单槽清理),全程不修改用户仓库文件、不装 git hooks。
node scripts/selftest-ops.mjs,ALL PASS。branchIndexMaxDbBytes 转 multi 模式。git clone https://github.com/hoyyang/dsh-code-graph && cd dsh-code-graph
bash scripts/build.sh # pnpm/npm 装依赖 + tsc 编译(自包含)
node scripts/selftest-ops.mjs # 29 项端到端回归(需引擎二进制)
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: session、sessions。