Code graphs for coding work
Let your AIs ask a graph of your project instead of reading whole files. The graph is built and kept on your computer.
When an AI works on code, it spends many steps reading files to find the few lines that matter. A code graph is a map of your project: every function, class and file, and which one calls which. The AI asks the map a question and gets the relevant code, and what depends on it, in one answer.
DeluHub works with two open-source tools that build this map on your own computer:
- CodeGraph (MIT licence). Best for questions about code: where something is defined, who calls it, what a change would affect.
- Graphify (Apache-2.0 licence). For documents (Markdown, PDF, images) and the overall shape of a project. Not for code.
Use CodeGraph for code and Graphify for documents; do not index the same code with both. DeluHub is not affiliated with either project and does not ship them. Graphify is a trademark of Graphify Labs.
What stays on your computer
Your code never goes to DeluHub. Both tools read the project, build the graph and answer questions on your computer. DeluHub does not run them and cannot see what they return.
The only thing DeluHub can hold is a short summary that you choose to save: how many files and symbols the graph has, the languages, and the names of the largest folders and most connected functions. It never holds a line of source code. You can leave the names out, or save nothing at all.
Set it up
Install each tool with its own installer, then let it connect to your AI apps and index the project. Run these in the project folder.
CodeGraph:
npm i -g @colbymchenry/codegraph@1.6.2
codegraph install
codegraph init
Graphify:
pipx install graphifyy==0.9.106
graphify install
graphify update docs
codegraph install asks which AI apps to connect. graphify update docs maps the headings of the Markdown files in your documents folder (here docs) without calling any AI model, and saves the graph in docs/graphify-out. It does not read PDFs or images: Graphify reads those only through an AI model (graphify extract docs), which uses tokens. Restart your AI apps afterwards so they see the new tools.
The version numbers are the releases DeluHub has been run with. Each tool's installer edits the settings of the AI apps it connects to, so it is worth a look at what changed there.
If you run the DeluHub command-line tool, one command does the CodeGraph steps and shows each one before it runs:
python3 aihub.py graphs setup --tools codegraph --dry-run
python3 aihub.py graphs setup --tools codegraph
It never installs anything unless you add --install, and it leaves each app's permission settings as they are.
Tell the hub about the graph
Every AI you connect to DeluHub is told to ask a code graph, when one is connected, who calls what and what a change affects, and to go straight to a file or name it already knows. A saved summary tells the AI the graph exists and what it covers.
To save it, ask the AI that works on the project:
Save a short summary of this project's code graph to DeluHub as a FACT with the key graph.my-project. Sizes only, no names and no source code.
Or with the command-line tool:
python3 aihub.py graphs summary
python3 aihub.py graphs summary --save
The first line prints the summary so you can read it. The second saves it. It holds sizes only. Add --names to include the names of the largest folders, groups and symbols; leave it out for a codebase whose names are confidential. Saving again updates the same note.
What to expect
- For a short question about code, an AI with a graph needs fewer tool calls and does not have to read whole files. That is not always a lower token cost; the exact figure depends on the project and the question.
- A graph adds to what the AI must load at the start of a conversation. For work that is not about code, it does not help.
- The graph follows your files. CodeGraph updates itself when code changes. Run
graphify update docsafter larger changes. - Each tool has its own settings. CodeGraph can send anonymous usage data to its makers: turn it off with
codegraph telemetry off. The DeluHub command-line tool keeps it off for every command it runs.
DeluHub itself also sends less to your AI than before. hub_status and thread_list answer in brief, and a resume pack shows a long list of memories one line each, with their numbers, so the AI opens only the ones it needs. See Memories, checkpoints and handoffs.