graphify:把整个项目变成一张可查询的知识图graphify: turn a whole project into a graph you can query
graphify 把文件夹里的代码、文档、论文、图片和视频变成一张知识图。助手查图,不再 grep。它是技能(/graphify .),底层是 Python 库。
1. 读文件夹。 detect() 跳过忽略的文件、构建产物和密钥,再按类型分。
2. 抽事实。 代码用 tree-sitter 在本机解析,不用 LLM,不花钱。第二遍连起跨文件调用。
音视频在本机转写(video 包)。文档、论文、图片和转写稿分批并行交给 LLM,只有这遍花 token。SHA256 缓存跳过没变的文件。
每条边标明把握:EXTRACTED(原文写明)、INFERRED(带分推断)或 AMBIGUOUS(待人核对)。
3. 建图。 合成一张 NetworkX 图并去重。Leiden(leiden 包,否则 Louvain)按连接分社区,不用嵌入和向量库。报告列出核心节点、意外连接和可问的问题。
4. 用起来。 graphify claude install 加 CLAUDE.md 说明和钩子,助手搜索或读文件前先被提醒用 graphify query。命令行或 MCP 服务端(mcp 包)回一小块子图。
graphify hook install 让提交和切分支免费重建代码部分。git pull 后跑 graphify update .。
代码不出本机。文档、图片和转写稿交给你选的模型。
周边工具管多仓库、PR 和工作记忆。
52 个混合文件上,查询比读文件省 71.5 倍 token;6 个文件时没省。
graphify turns a folder of code, docs, papers, images and video into one knowledge graph. Your AI assistant then asks the graph instead of grepping files. It is a skill (/graphify .) on top of a Python library.
1. Read the folder. detect() skips ignored files, build output and secrets, then sorts the rest by type.
2. Pull out the facts. Code is parsed on your machine with tree-sitter: no LLM, no cost. A second pass links calls across files.
Video and audio are transcribed locally (video extra). Docs, papers, images and transcripts go to an LLM in parallel batches. Only this pass costs tokens. A SHA256 cache skips unchanged files.
Every edge says how sure it is: EXTRACTED (in the source), INFERRED (a scored guess) or AMBIGUOUS (for a person to check).
3. Build the map. Everything merges into one NetworkX graph, minus duplicates. Leiden (leiden extra, else Louvain) groups it into communities by its links. No embeddings, no vector store. The report lists god nodes, surprising links and questions to ask.
4. Use it. graphify claude install adds a CLAUDE.md section and a hook. Before the assistant searches or reads files, the hook points it to graphify query. The CLI or an MCP server (mcp extra) answers with a small subgraph, not whole files.
graphify hook install rebuilds the code part on every commit and branch switch, for free. After git pull, run graphify update ..
Code is never sent anywhere. Docs, images and transcripts go to your assistant's model or an API you choose.
Side tools cover several repos, pull requests and work memory.
On 52 mixed files, a query used 71.5x fewer tokens than reading the files. On 6 files there was no saving.
来源Source: github.com