Claude Code Integration
FreshOverview
Graphify's Claude Code integration makes the knowledge graph always-on — Claude consults the graph automatically before answering architecture questions, without you having to mention it.
What Gets Installed
graphify claude installInstalls two components:
| Component | Location | Purpose |
|---|---|---|
| CLAUDE.md directive | Project or global CLAUDE.md | Tells Claude to check graph before architecture questions |
| PreToolUse hook | Claude Code hooks config | Fires before every file-search tool call |
How the Hook Works
sequenceDiagram
participant You
participant Claude Code
participant PreToolUse Hook
participant graph.json
participant Files
You->>Claude Code: "How does the payment flow work?"
Claude Code->>PreToolUse Hook: About to search files
PreToolUse Hook->>graph.json: Query payment-related subgraph
graph.json-->>PreToolUse Hook: Payment community nodes + edges
PreToolUse Hook-->>Claude Code: Inject: relevant nodes are PaymentService, StripeClient, OrderController
Claude Code->>Files: Read PaymentService.py, StripeClient.ts, OrderController.py
Files-->>Claude Code: File contents
Claude Code-->>You: Accurate answer with full contextThe key insight: the hook fires before Claude searches files, so the graph guides Claude to the right files — rather than Claude searching broadly and hoping to find the right ones.
Manual Installation
If graphify claude install is unavailable, add to your CLAUDE.md:
## Graphify Knowledge Graph
This project has an active Graphify knowledge graph at `graphify-out/graph.json`.
Before answering architecture questions, check:
1. `graphify-out/GRAPH_REPORT.md` for an overview of key nodes and communities
2. Use `/graphify query "..."` to find relevant nodes before reading files
3. Use `/graphify explain "NodeName"` for detailed node information
4. Use `/graphify path "NodeA" "NodeB"` to trace connections between componentsRebuilding the Graph
When your codebase changes:
/graphify . --update # Only reprocess changed files (fast)
/graphify . # Full rebuild (slower, more thorough)Uninstalling
graphify claude uninstallThis removes the CLAUDE.md directive and the PreToolUse hook. Your graphify-out/ directory is untouched.
Verification Checklist
- [ ]
graphify claude installcompleted without error - [ ] CLAUDE.md contains a Graphify section
- [ ]
/graphify query "..."returns relevant results from your codebase - [ ] Claude Code references graph data when answering architecture questions
Token Efficiency
With the Claude Code integration active, complex architecture questions that previously required reading 20-30 files can often be answered by reading 3-5 targeted files guided by the graph. This translates to real cost savings on API calls.