Guide
Hermes Agent + Graphify: Codebase Knowledge Graphs
Graphify is an open-source skill that turns a repository into a queryable knowledge graph. Point a Hermes Agent at it and a question like “where does billing deduct credits?” comes back grounded in the right files for around 1.7k tokens, instead of the ~123k a read-everything approach would burn. The OpenClaw side of this is covered in OpenClaw + Graphify — this page is the Hermes wiring.
What Graphify Is
Graphify is MIT-licensed and builds a graph from a repository — code, docs, papers and diagrams. It uses Tree-sitter for static analysis, Leiden clustering to find community structure, and an LLM pass to attach semantic labels. Nodes are functions, files and concepts; edges are calls, imports and semantic relationships.
It launched in April 2026 and crossed 22,000 GitHub stars in under ten days, with native integrations across a range of AI coding platforms. Its headline number is the token saving: roughly 1.7k tokens per query against about 123k for a naive read-the-repo approach, a 71x reduction.
Why Hermes Specifically Benefits
Hermes Agent is strong at long-running autonomous work — it holds a persistent workspace, runs background reviews, and can grind through multi-step tasks without being re-prompted. That amplifies both sides of the retrieval problem.
An agent that works for an hour on a repository will re-read the same files many times if the only retrieval it has is grep-and-read. Every one of those reads is paid for, and each one crowds out context that mattered. A persistent graph inverts it: the agent asks a question, gets back the few relevant chunks, and spends its context on reasoning instead of on file contents it already saw twice.
Three concrete effects:
- Cheaper long sessions — the saving compounds across a multi-hour autonomous run rather than applying once
- Less context thrash — the agent stops evicting useful state to make room for source files
- Code stays local — graph construction runs on your machine, and only the query result travels to the model
Step 1: Build the Graph
From your repository root:
pip install graphify
graphify build .Graphify walks the tree, runs Tree-sitter over code files, clusters the result, and writes an artefact under .graphify/. The build happens locally — no source is uploaded anywhere.
Step 2: Serve It Over MCP
graphify mcp serve --port 7812This exposes the graph query tool over the Model Context Protocol, which is the same protocol Hermes uses for external tools.
Step 3: Register the Server With Hermes
Add the endpoint to your Hermes MCP configuration so the agent discovers the tool at startup:
{
"mcpServers": {
"graphify": {
"url": "http://127.0.0.1:7812",
"transport": "http"
}
}
}Restart the agent, and the graph query tool shows up in its tool list. General MCP mechanics for Hermes — where config lives, how to debug a server that will not start — are in the Hermes MCP guide.
Reachability for a Hosted Hermes
A graph served on 127.0.0.1 of your laptop is not visible to a hosted container. If you run Hermes on OpenClaw Launch, you have the usual three options:
- Tailscale — put the agent and the machine serving the graph on one tailnet
- Run Graphify beside the agent — build the graph on the same host, which also keeps the repository there
- Publish it over authenticated HTTPS — workable, but you are now exposing a service that has read your entire codebase, so authenticate it properly
For a private repository, the second option is usually the honest one: if the code cannot leave your infrastructure, neither should the graph built from it.
Keeping the Graph Fresh
The graph is a snapshot. On an active repository it drifts, and a stale graph produces confidently wrong file references — the worst failure mode, because it looks like a correct answer. Rebuild on a schedule:
# nightly rebuild at 04:00
0 4 * * * cd /srv/repo && git pull --quiet && graphify build . >/dev/null 2>&1Or have the agent do it itself with a scheduled job, which has the advantage that a failed rebuild can message you rather than failing silently.
Hermes or OpenClaw for This?
Both frameworks speak MCP, so Graphify works with either. Choose based on the workload rather than the integration: Hermes for long autonomous runs over a codebase, OpenClaw for chat-first help across many channels. If you want the OpenClaw version of this setup, see OpenClaw + Graphify; for the broader difference, see OpenClaw Launch vs Hermes Agent.
Troubleshooting
The agent never calls the graph tool
Usually tool discovery, not reasoning. Confirm the MCP server is listed in the agent's available tools after restart; if it is absent, the server did not start and the error is in the agent log rather than in chat.
Answers cite files that no longer exist
A stale graph. Rebuild it, then add the scheduled rebuild above so it does not recur.
The build is slow on a large monorepo
Expected on the first pass — Tree-sitter parsing and clustering are proportional to repository size. Subsequent builds are cheaper, and it is worth scoping the build to the directories the agent actually works in.
What's Next?
- OpenClaw + Graphify — the same integration on the OpenClaw side
- Hermes MCP guide
- AI agent cron jobs
- Managed Hermes hosting
- OpenClaw Launch vs Hermes Agent