基于代码库知识图谱的 read_graph 工具(CONTAINS / EXPORTS / IMPORTS / IMPORTS_SYMBOL 关系)。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:Luke-Yong/dsh-plugin-knowledge-graph
GitHub 来源的插件在安装时会在你的机器上执行构建脚本。请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
A DeepSeek Harness (DSH) plugin that exposes a read_graph tool backed by a codebase knowledge graph. The graph tracks every file, directory, exported symbol, and their relationships so an agent can answer structural and dependency questions faster than grepping or reading files.
Status: infancy. This project is in its infancy stage. Execution behavior, the query surface, and compatibility may change while the project is iterated on and tested by the open source community.
Derived work. This project is derived from the knowledge graph tool in Luke-Yong/H, adapted to DeepSeek Harness's "everything is a plugin" model.
What it does
Given a workspace root, the plugin builds an in-memory graph and answers queries such as:
structure— print the full directory treeexports <file>— list every symbol exported by a fileimports_of <file>— list symbols a file imports (with their source files)exporters_of <symbol>— find which files export a symboldependents <file>— find which files import from a file
Graph model
The graph uses three node types and four edge types:
| Nodes | Meaning |
|---|---|
dir |
A directory |
file |
A source file |
symbol |
An exported symbol (function, class, const, type, interface, enum, default) |
| Edges | Meaning |
|---|---|
CONTAINS |
Structural parent → child (dir → dir/file, file → symbol) |
EXPORTS |
File → symbol it exports |
IMPORTS |
File-level dependency (file → file) |
IMPORTS_SYMBOL |
Precise symbol-level dependency (file → symbol) |
Installation
Install with the DSH CLI into a profile:
dsh plugin --profile web add github:Luke-Yong/dsh-plugin-knowledge-graph
Pin to a specific commit for reproducibility:
dsh plugin --profile web add github:Luke-Yong/dsh-plugin-knowledge-graph#<commit-sha>
Usage
The plugin registers a single tool, read_graph, on ctx.tools. Its parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | yes | Query string in <query_type> <target> form |
root |
string | no | Absolute workspace root to graph. Defaults to process.cwd() |
Example queries:
exports src/index.ts
exporters_of buildKnowledgeGraph
imports_of src/query.ts
dependents src/knowledgeGraph.ts
structure
Project structure
src/
index.ts Plugin entry — registers the read_graph tool
knowledgeGraph.ts Graph builder (filesystem walk, import/export parsing, serialization)
query.ts Query engine (runGraphQuery)
Building
npm run build # tsc -p tsconfig.json
Output is emitted to dist/ (dist/index.js is the package entry point).
License
MIT
链接
同类插件
liustack/modlens★ 1199
为纯文本模型架起视觉桥梁:粘贴图片,输出结构化 JSON 证据(OCR、版面、语义)。
Anionex/dsh-vision-toolkit★ 308
让纯文本模型更好地做视觉任务:带意图的图片问答、长截图 OCR、UI 还原等。
zhaoolee/notes★ 138
将 DSH 对话导出为锤子便签风格 PNG,或在配置的账号工作区中新建和更新 Markdown 便签。
liustack/modsearch★ 85
纯文本 agent 的联网搜索桥:搜索网页与 X,返回结构化 JSON 证据(search/fetch/引用)。
Lum1104/dsh-browser★ 80
Chrome 侧边栏扩展,让 DSH 直接操控你的浏览器,无需视觉能力。
taxueseek/argo★ 69
专为 agent 打造的搜索工具:多语言,覆盖中文/英文/学术/代码/购物/金融/新闻/百科。