Use Cases & Workflows
Practical scenarios and the CLI commands to handle them.
Core Use Cases
Onboarding to a New Codebase
Drop into a new project, run /graphify ., and immediately see which modules are the architectural pillars (god nodes), how the codebase clusters into logical areas (communities), and surprising connections you'd miss reading files linearly.
Research Paper + Code Integration
Working with academic papers alongside code (common in ML)? Graphify connects concepts across both. Paper concepts link to code implementations via semantically_similar_to edges. Query "what connects attention to the optimizer?" to traverse both paper and code nodes.
Architecture Documentation
The GRAPH_REPORT.md is an auto-generated architecture document that stays current with your code. With the always-on hook, your AI assistant reads this report before answering architecture questions.
Code Review Context
Before reviewing a PR, query the graph to understand the blast radius: which god nodes and communities are affected by the changed files.
Essential Commands
/graphify .
/graphify ./src
/graphify query "what connects auth to the database?"
/graphify path "UserService" "DatabasePool"
/graphify explain "CausalSelfAttention"
Workflows
First-Time Setup
pip install graphifyy && graphify install
/graphify . — reads all files, builds graph, exports to graphify-out/
graphify claude install — writes CLAUDE.md section + PreToolUse hook
graphify hook install — auto-rebuild on commit and branch switch
Daily Development
Git hooks rebuild the graph after each commit (AST only, no LLM cost)
The always-on hook means Claude reads GRAPH_REPORT.md before searching files
/graphify query "..." traverses the raw graph for edge-level detail
Adding New Content
/graphify add https://arxiv.org/abs/1706.03762
/graphify add https://x.com/karpathy/status/...
/graphify . --update
Advanced Commands
| Command | Purpose |
|---|---|
--mode deep | More aggressive INFERRED edge extraction |
--update | Only re-extract changed files, merge into existing graph |
--cluster-only | Rerun clustering without re-extraction |
--no-viz | Skip HTML, just produce report + JSON |
--watch | Auto-sync graph as files change |
--wiki | Build agent-crawlable wiki |
--obsidian | Generate Obsidian vault |
--svg | Export static SVG diagram |
--graphml | Export for Gephi/yEd |
--neo4j | Generate Cypher statements |
--neo4j-push bolt://... | Push directly to Neo4j |
--mcp | Start MCP stdio server |
Token Efficiency
| Corpus | Files | Naive Tokens | Graph Query | Reduction |
|---|---|---|---|---|
| Karpathy repos + papers + images | 52 | ~123K | ~1.7K | 71.5x |
| graphify source + Transformer paper | 4 | ~12K | ~2.2K | 5.4x |
| httpx (synthetic, 6 files) | 6 | ~6K | ~5K | ~1x |
Key insight: Token reduction scales with corpus size. Small projects (~6 files) fit in a context window anyway. At 52+ files, you get 71x+ savings. The first run costs tokens to build; every subsequent query saves them.
Known Limitations
- Graph drift on incremental updates: Stale relationships from earlier runs can persist. Recommendation: full re-index after major structural changes.
- Semantic extraction is probabilistic: Claude/GPT-4 extraction varies by model version. Confidence scores mitigate this but don't eliminate it.
- Louvain fallback on sparse graphs: Can be slow without tuned parameters (fixed in v0.3.10).
- PyPI name: Package is
graphifyy(namegraphifybeing reclaimed).