Graph Intelligence

How the CodeGraph and Graphify exports were built, and the two tools documented for your own setup.

Graph Intelligence — How the Graphs Were Built

To understand the harness we ran two local, no-API-key code-intelligence tools over a clone of the repository and used their output to drive the diagrams and the component map. Their raw exports live under tool-outputs/.

These tools read all the code and build a map of how everything connects — which function calls which, which file imports which. That map is what let us draw an accurate "component dependency" picture instead of guessing, and it is exactly the kind of index an AI coding assistant can query to answer "how does X work?" without re-reading the whole codebase every time.

What we ran (locally, in the sandbox)

CodeGraph (@colbymchenry/codegraph v1.5.0)

A tree-sitter + node:sqlite knowledge-graph builder. We indexed the repo and exported the results.

Metric Value
Files indexed 180 (177 Python + 2 YAML + 1 Go fixture)
Nodes 4,538 (function 1,701 · method 1,030 · import 967 · variable 347 · class 314 · file 178)
Edges 10,362 (contains 4,360 · calls 3,653 · imports 941 · references 751 · instantiates 652 · extends 5)

Outputs: tool-outputs/codegraph/ — the SQLite DB (db/), files.json, god_nodes.json, status.txt, and module_dependencies.json (the aggregated component-to-component edges that power diagrams/04_module_dependencies.svg and diagrams/module-graph.html).

Highest-connected ("god") symbols confirm the design: the runtime agent's config _resolve, RepoProperties, stream set_verbosity, redact, and the token/URL helpers dominate — consistent with a config-and-transport-heavy automation layer wrapping prompt-only skills.

Graphify (graphifyy v0.9.x)

A NetworkX + Leiden + tree-sitter knowledge-graph builder that also emits an interactive HTML view and a report. We ran the code (AST) pass with clustering — no LLM/API key.

Metric Value
Nodes 4,970
Edges 11,539
Communities 263

Outputs: tool-outputs/graphify/ — GRAPH_REPORT.md, graph.json, graph.labeled.json, analysis.json, and the raw graph.html.

On Graphify's "Community N" clusters. Graphify groups the ~4,970 symbols into 263 "communities" (code that calls each other a lot). We named every cluster deterministically — from each cluster's dominant module plus its representative classes/functions — and produced a readable view: tool-outputs/graphify/labeled-clusters.html. Because VulnHunter is heavily tested, several of the largest communities are test suites; the production communities cluster cleanly by component (agent internals, fixer scripts, harness).

Readable interactive views we built

Because the raw graph exports are dense, we built human-navigable views (all use native HTML <details>, so they expand with or without JavaScript):

File What it gives you
tool-outputs/codeviz/vulnhunter-skill-explorer.html The closed loop Hunt→Fix→Verify + runtimes; each box → phases → files. Best entry point.
tool-outputs/codeviz/vulnhunter-codeviz.html Full drill-down: module → file → function, with plain-English notes.
diagrams/module-graph.html Clickable 10-component flow; expand a box for role/inputs/outputs/deps.
tool-outputs/graphify/labeled-clusters.html Graphify's 263 clusters, each with a human name.

The reusable generator is tools/codeviz/ (codeviz.py works on any Python repo; see its README).

The two tools we did not run here (need your local setup)

Both are designed to run inside your own AI client with local providers. Run them against a local clone of the repo.

Serena (oraios/serena) — LSP-backed semantic code tools

Serena needs language servers (e.g. a Python LSP) and is driven by an LLM over MCP.

uv tool install -p 3.13 serena-agent
serena init
# Point your MCP client (Claude Code / Cursor) at Serena, then over the vulnhunter-agent/agent
# and vulnhunter-fix/ packages use find_symbol / get_symbols_overview / find_referencing_symbols
# for symbol-level navigation and safe refactors.

Value here: precise symbol overviews and cross-file reference lookups on top of the Python language server — ideal for a developer changing a shared contract (e.g. the manifest schema or AgentConfig).

grepai needs an embedding provider (Ollama by default, or OpenAI).

brew install yoanbernabeu/tap/grepai      # or the install.sh one-liner
ollama pull nomic-embed-text
cd VulnHunter && grepai init && grepai watch &
grepai search "where is the auth token chosen for Claude"     # → agent/build_settings.py, auth.py
grepai search "the falsification pass that disproves findings" # → vulnhunt/phases/phase2b_verify.md
grepai trace callers "run_vulnhunt"

Value here: ask questions by meaning ("authorization bypass", "delivery gates") and get the relevant code even when names differ — and far fewer tokens for an AI agent.

How to refresh these graphs after code changes

codegraph index /path/to/VulnHunter --force        # CodeGraph
python tools/codeviz/codeviz.py --root /path/to/VulnHunter --name "Capital One VulnHunter" --exclude tests
# Graphify: re-run the extract → build → cluster → export pipeline (AST pass, no LLM).

These tools all target the same goal from different angles: turn a large codebase into a queryable graph so humans and AI agents can navigate it cheaply. CodeGraph and Graphify gave us the concrete numbers and the component map; Serena and grepai shine when wired into your own agent for day-to-day navigation and refactoring.