jaideepnarang.com
Tooling · 4 min read

Graphify — turn any codebase into a knowledge graph

Drop a folder in, get back a graph of what you didn't know was connected. Why I keep a knowledge graph of every codebase I work in.

Every codebase I’ve worked in has the same problem: dozens of files, scattered docs, and implicit relationships between components that nobody has mapped. The knowledge exists — it’s just distributed across people’s heads and a wiki nobody updates. Graphify is the tool I’ve been using to attack this: point it at a folder and it hands back a navigable knowledge graph.

What it is

Graphify is a Python CLI tool and Claude Code skill that transforms any folder — code, docs, papers, images, even videos — into a structured knowledge graph with community detection, an interactive HTML visualisation, and an honest audit trail.

It’s built around a simple idea: drop anything into a folder and get back a graph that shows you what you didn’t know was connected.

Three things it does that your AI assistant alone can’t:

  1. Persistent graph — relationships live in graphify-out/graph.json and survive across sessions. You can ask questions weeks later without re-reading everything.
  2. Honest audit trail — every edge is tagged EXTRACTED, INFERRED, or AMBIGUOUS. You always know what was found in the source versus what was reasoned about. This matters more than it sounds: most AI-generated “architecture summaries” give you no way to tell.
  3. Cross-document surprise — community detection finds connections between concepts in different files that you’d never think to ask about directly.

Why I rate it

The bottleneck it attacks is real: understanding how a backend service, a frontend component, an infrastructure config, and a six-month-old planning doc relate to each other — especially when you’re new to a project or reviewing someone else’s work.

  • Onboarding — run it on a codebase you’ve never seen and get an architecture map before touching anything
  • Hidden coupling — discover that a start script is conceptually tied to a container config, or that a theme in the backend mirrors one in the frontend
  • Persistent understanding — the graph survives across sessions, so context isn’t lost between conversations
  • Token economics — for large corpora, querying the graph is far cheaper than stuffing raw files into context

What a run looks like

I ran it on a full-stack codebase I work in — Python/FastAPI backend, React frontend, planning docs, infrastructure configs. One run produced:

  • 775 nodes, 925 edges, 62 communities across 78 files (~62,000 words)
  • God nodes — the most connected abstractions — immediately showed which functions and services are load-bearing
  • Connections nobody had documented: a theme constant in the backend was semantically similar to a UI theme in the frontend (same problem solved twice in different layers, never linked); a startup script conceptually coupled to the container orchestration config; planning docs referencing API functions that had since moved

None of that required anyone to manually trace relationships. It also identified hyperedges — group relationships like a multi-service pipeline spanning routers, AI services, and frontend components.

Installation

Python 3.10+ required; installs from PyPI:

pip install graphifyy

# or, for tool isolation (my preference):
uv tool install graphifyy

No configuration needed — it works immediately with Claude Code.

How to use it

Inside Claude Code (the way I use it):

/graphify                           # run on current directory
/graphify ./src                     # run on a specific path
/graphify ./src --mode deep         # thorough extraction, richer inferred edges
/graphify ./src --update            # incremental — only re-extract changed files

Claude handles the pipeline: file detection, AST extraction for code, semantic extraction for docs, graph building, clustering, visualisation.

Querying an existing graph without rebuilding:

/graphify query "How does authentication work?"             # BFS — broad context
/graphify query "How does auth reach the database?" --dfs   # DFS — trace a path
/graphify path "AuthModule" "Database"                      # shortest path
/graphify explain "PresentationService"                     # everything connected to a node

Exports for wherever your workflow lives:

/graphify ./src --obsidian          # Obsidian vault (one note per node)
/graphify ./src --svg               # SVG for embedding in docs
/graphify ./src --graphml           # GraphML for Gephi/yEd
/graphify ./src --neo4j             # Cypher file for Neo4j import

Keeping it current

The git hook integration is the feature that makes it stick for teams — nobody has to remember to update the graph:

graphify hook install       # post-commit + post-checkout hooks
graphify hook status        # check they're active

The graph rebuilds automatically after every commit and branch switch, asynchronously — git commit returns instantly. Code-only changes rebuild via AST extraction with no LLM cost; if docs changed, it nudges you to run /graphify --update for semantic re-extraction.

The team workflow that works: one person runs /graphify . and commits graphify-out/; everyone else pulls and their sessions immediately read the graph report; everyone installs the hook so it stays current.

Honest limitations

  • Semantic extraction costs tokens on the first run over a large corpus. Subsequent --update runs only process changed files, and code-only changes are free.
  • Garbage in, garbage out — well-structured code with clear naming produces better graphs than obfuscated code.
  • The HTML visualisation caps at 5,000 nodes — beyond that, use the Obsidian or Neo4j export.
  • Python 3.10+ only.

Getting started

  1. pip install graphifyy
  2. Open your project in Claude Code and run /graphify
  3. Open graphify-out/graph.html and explore
  4. Read graphify-out/GRAPH_REPORT.md for god nodes, surprising connections, and suggested questions
  5. Use /graphify query "your question" to traverse conversationally

GitHub: github.com/safishamsi/graphify