LLM-powered tool to turn Go codebases into queryable knowledge graphs.
Reviewed against safishamsi/graphify:
- Branch:
v3 - Commit:
699e9960ce7b88076db33a4da3adbd53fb410c7c - Version: v0.3.28+5 (2026-04-10)
- Review Date: 2026-04-11
┌─────────────────────────────────────────────────────────────────────────┐
│ GRAPHIZE PIPELINE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Detect Step 2: Extract Step 3: Build │
│ ┌──────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ Scan │ │ Part A: AST │ │ Merge AST + │ │
│ │ sources │─────────▶│ (deterministic) │──┬───▶│ Semantic │ │
│ │ │ ├─────────────────┤ │ │ results │ │
│ └──────────┘ │ Part B: LLM │ │ └──────────────┘ │
│ │ (optional) │──┘ │ │
│ └─────────────────┘ ▼ │
│ ┌──────────────┐ │
│ Step 4: Analyze Step 5: Export │ GraphFS │ │
│ ┌──────────┐ ┌─────────────────┐ │ Store │ │
│ │ Cluster │◀─────────│ God nodes │◀─────└──────────────┘ │
│ │ Detect │ │ Surprises │ │
│ └──────────┘ │ Questions │ │
│ │ └─────────────────┘ │
│ ▼ │
│ Step 6: Output │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ HTML │ TOON │ JSON │ GRAPH_REPORT.md │ Neo4j │ Obsidian │ │
│ └─────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
| Feature | Graphify | Graphize | Status |
|---|---|---|---|
| Source Tracking | Single directory | Multi-repo with commit hashes | ✅ Better |
| Git Currency | None | Tracks commit/branch per repo | ✅ Better |
| Storage | Single graph.json | One file per entity (GraphFS) | ✅ Better |
| AST Extraction | tree-sitter (20 langs) | Go only (go/ast) | ✅ Done |
| Per-file Caching | ✅ SHA256 + MD5 | ✅ SHA256 | ✅ Done |
| Edge Confidence | ✅ | ✅ EXTRACTED/INFERRED/AMBIGUOUS | ✅ Done |
| LLM Semantic Extraction | ✅ Subagents | ✅ Skill + merge workflow | ✅ Done |
| Multi-agent-spec | ❌ | ✅ agents/specs/ | ✅ Better |
| Feature | Graphify | Graphize | Status |
|---|---|---|---|
| Community Detection | ✅ Leiden/Louvain | ✅ Louvain (gonum) | ✅ Done |
| God Nodes Analysis | ✅ Full | ✅ Full (report cmd) | ✅ Done |
| Surprising Connections | ✅ Betweenness centrality | ✅ Cross-file, cross-community | ✅ Done |
| Cohesion Scores | ✅ | ✅ | ✅ Done |
| Isolated Nodes | ✅ | ✅ | ✅ Done |
| Package Statistics | ❌ | ✅ | ✅ Better |
| Suggested Questions | ✅ | ✅ | ✅ Done |
| Hyperedges | ✅ 3+ node groups | ❌ | ⬜ Phase 7 |
| Betweenness Centrality | ✅ For bridges | ✅ Bridges in report | ✅ Done |
| Corpus Health Check | ✅ Word count, verdict | ✅ report --health |
✅ Done |
| Feature | Graphify | Graphize | Status |
|---|---|---|---|
| HTML Visualization | ✅ vis.js | ✅ cytoscape.js | ✅ Done |
| TOON Export | ❌ | ✅ (with confidence) | ✅ Better |
| JSON Export | ✅ NetworkX | ✅ Cytoscape format | ✅ Done |
| GRAPH_REPORT.md | ✅ | ✅ (report cmd) | ✅ Done |
| GraphML Export | ✅ | ✅ | ✅ Done |
| Obsidian Export | ✅ Wiki-style vault | ✅ | ✅ Done |
| Neo4j Cypher Export | ✅ cypher.txt | ✅ | ✅ Done |
| Neo4j Push | ✅ Direct bolt connection | ❌ | ⬜ Phase 5 |
| SVG Export | ✅ | ❌ | ⬜ Phase 5 |
| Feature | Graphify | Graphize | Status |
|---|---|---|---|
| MCP Server | ✅ | ✅ | ✅ Done |
| Watch Mode | ✅ fsnotify | ✅ | ✅ Done |
| Git Hooks | ✅ post-commit/checkout | ✅ | ✅ Done |
| Directed Graphs | ✅ --directed flag |
✅ | ✅ Done |
| Path Command | ✅ path "A" "B" |
✅ | ✅ Done |
| Explain Command | ✅ explain "Node" |
✅ | ✅ Done |
| Token Benchmark | ✅ benchmark |
✅ | ✅ Done |
| URL Ingestion | ✅ add <url> |
❌ | ⬜ Phase 7 |
| Feature | Graphify | Graphize | Status |
|---|---|---|---|
| Go Code | ✅ tree-sitter | ✅ go/ast | ✅ Done |
| Multi-language | ✅ 20 langs | ❌ Go only | ⬜ Phase 7 |
| Markdown/Text | ✅ Claude extraction | ✅ extractor | ✅ Done |
| PDF Papers | ✅ Citation mining | ❌ | ⬜ Phase 7 |
| Images | ✅ Claude vision | ❌ | ⬜ Phase 7 |
| Video/Audio | ✅ Whisper transcription | ❌ | ⬜ Phase 7 |
| Office Docs | ✅ DOCX/XLSX conversion | ❌ | ⬜ Phase 7 |
| Feature | Graphify | Graphize | Status |
|---|---|---|---|
| Claude Code | ✅ PreToolUse hook | ✅ MCP server | ✅ Done |
| Codex | ✅ hooks.json | ✅ install codex |
✅ Done |
| Cursor | ✅ .cursor/rules | ✅ install cursor |
✅ Done |
| Gemini CLI | ✅ BeforeTool hook | ✅ install gemini |
✅ Done |
| GitHub Copilot | ✅ skills/ folder | ✅ install copilot |
✅ Done |
| Aider/OpenClaw | ✅ AGENTS.md | ✅ install aider |
✅ Done |
- Multi-repo support: Track multiple repositories with independent git commit tracking
- GraphFS storage: Git-friendly one-file-per-entity storage
- TOON format: Token-efficient output for AI agents (98% smaller than JSON)
- multi-agent-spec: Portable subagent definitions for Claude, Kiro, Codex, Gemini
- Edge confidence metadata: Full support for EXTRACTED/INFERRED/AMBIGUOUS with scores
- 20 language support: tree-sitter parsers for many languages
- Multimodal extraction: Code, docs, papers, images, video, audio, office docs
- Platform hooks: 10 AI assistant integrations with always-on hooks
- URL ingestion: Fetch and extract papers, tweets, videos
- Project structure with pkg/ layout
- Source tracking types: Source, Manifest, SourceStatus
- Git commit/branch reading (NewSourceFromPath, CheckStatus)
- Output formatters: JSON, YAML working
- Manifest persistence (save/load to .graphize/manifest.json)
- TOON output: integrate toon-go library when released
-
graphize init- creates graph database directory structure -
graphize add <repo>- tracks repo with commit hash (persisted) -
graphize status- shows all sources with staleness detection -
graphize analyze- extract graph from sources -
graphize query- query the graph with filters
- Parse Go files with go/ast
- Extract packages, files, functions, methods, types, imports
- Extract function calls, type references as edges
- Mark all AST-derived edges as EXTRACTED confidence
-
graphize query- show graph summary -
graphize query <node-id>- show edges for a node - BFS/DFS traversal with --depth and --dfs flags
- Direction filter (--dir out/in/both)
- Edge type filter (--edge-type)
-
graphize export html- Cytoscape.js visualization -
graphize export json- Cytoscape JSON format -
graphize export toon- TOON format (agent-optimized) -
graphize summary- Markdown summary for AGENTS folder
- Create
pkg/cache/cache.go - SHA256-based file hashing
- Store extraction results per file hash
- Cache hit/miss detection
- Cache invalidation on file change
- Integrate with
pkg/extract/extract.go - Add
--no-cacheflag to analyze command - Report cache hit/miss statistics
- Create
skills/enhance.mdskill file - Create
agents/specs/semantic-extractor.yaml(multi-agent-spec) - Define subagent prompt for semantic extraction
- Define edge types (inferred_depends, rationale_for, similar_to, etc.)
- Parse and validate subagent JSON output (
pkg/extract/merge.go) - Merge with AST extraction results (
graphize mergecommand) - Create
agents/plugins/via assistantkit (when available) - Chunk files (20-25 per chunk) -
extract.ChunkFiles()+graphize enhance --json -
graphize enhance --prompt- Output prompts for each chunk -
graphize enhance --json- JSON output for automation -
skills/semantic-extract.md- Orchestration skill for parallel dispatch
- Add
Confidencefield to Edge type (EXTRACTED/INFERRED/AMBIGUOUS) - Already in graphfs - Add
ConfidenceScorefield (0.0-1.0) - Already in graphfs - AST extraction sets Confidence: EXTRACTED on all edges
- TOON export includes confidence for non-EXTRACTED edges
- HTML export includes confidence data for edge coloring
- HTML template edge color-coding (in cytoscape-go) - Future enhancement
-
graphize enhance- Prepare files for LLM semantic extraction -
graphize enhance --force- Ignore cache, list all files -
graphize enhance --chunk-size N- Control chunk size -
graphize enhance --prompt- Output subagent prompts for each chunk -
graphize enhance --json- JSON output for automation scripts - Show cache hit/miss statistics
-
graphize merge -i <json>- Merge semantic edges from LLM extraction -
graphize merge --validate- Validate semantic JSON without merging -
/semantic-extractskill - Orchestrated parallel subagent dispatch
-
pkg/extract/merge_test.go- 6 test functions, 31 test cases- ChunkFiles, ParseSemanticJSON, ValidateSemanticExtraction
- MergeExtractions, IsValidSemanticEdgeType, BuildSubagentPrompt
-
cmd/graphize/cmd/enhance_test.go- 7 test functions- EnhanceOutput JSON serialization, ChunkOutput structure
- Prompt generation, field validation
-
pkg/cache/cache_test.go- existing cache tests
- End-to-end test on yaml.v2 codebase
- Discovered 18 semantic edges (similar_to, shared_concern, inferred_depends, implements_pattern)
- Merged into graph, verified in report output
- Suggested questions reference INFERRED edges for human review
-
graphize rebuild- Analyze + merge semantic edges in one command -
graphize rebuild --html- Also generate HTML visualization -
graphize rebuild --report- Also generate analysis report -
graphize rebuild --semantics <path>- Custom semantic edges path - Automatic detection of
agents/graph/semantic-edges.json
- Implement simple community detection (pkg/analyze/cluster.go)
- Group by package (natural code communities)
- Connected components fallback
- Calculate cohesion scores
- Split oversized communities
- Community labels inference
- Louvain algorithm via gonum (pkg/analyze/louvain.go)
- God nodes detection (most connected) - pkg/analyze/gods.go
- Surprising connections (cross-community, cross-file) - pkg/analyze/surprise.go
- Isolated nodes detection
- Cross-file edges analysis
- Package statistics
- Edge confidence grouping
- Suggested questions generation (
pkg/analyze/questions.go)
-
graphize reportcommand - Generate report with:
- Corpus summary (nodes, edges, types)
- God nodes listing (most connected)
- Surprising connections (cross-file, cross-community)
- Community breakdown with cohesion scores
- Isolated nodes (potential gaps)
- Package statistics
- Edge confidence breakdown
- INFERRED/AMBIGUOUS edges flagged in Surprising Connections
- Suggested questions in report (5 question types)
-
graphize serve- Start MCP server (using official Go SDK) - Tool: query_graph (BFS/DFS traversal)
- Tool: get_node (lookup by ID or label)
- Tool: get_neighbors (in/out/both directions)
- Tool: get_community (list members)
- Tool: graph_summary (stats + god nodes + suggested questions)
-
graphize init-agents- Create agents/ folder structure - Generate agents/graph/GRAPH_SUMMARY.md (checkable)
- Generate agents/graph/GRAPH.toon.gz (checkable)
- Add .gitignore for local-only files
Implementation Order: Quick wins first, then multi-language (Phase 7). See PLAN.md for detailed schedule.
-
graphize path "A" "B"- Trace exact path between nodes ✅- Use graphfs query.FindPath
- Show intermediate nodes and edge types
-
graphize benchmark- Print token reduction stats ✅- Compare raw corpus size vs TOON output
- Show compression ratio
-
--directedflag forgraphize analyze✅- Preserve edge direction in graph (stored in manifest)
- Affects traversal and analysis
- GraphML export (for Gephi/yEd) -
graphize export graphml - Neo4j Cypher export -
graphize export cypher✅- Generate CREATE statements for nodes
- Generate CREATE statements for edges
- Include all node/edge attributes
- Neo4j Push -
graphize export cypher --push bolt://localhost:7687- Direct bolt connection to Neo4j instance
- Authentication support (user/password)
- SVG export -
graphize export svg- Use gonum/plot or similar for layout
- Static vector graph output
- Obsidian vault export -
graphize export obsidian✅- Generate
index.mdentry point - One article per community with wikilinks
- One article per god node
- Cohesion scores and navigation footers
- Generate
-
graphize watch- Monitor files, rebuild on change ✅- Use fsnotify for file system events
- Debounce rapid changes (500ms)
- Incremental rebuild (only changed files)
- Optional: auto-regenerate HTML/report
-
graphize hook install- Install git hooks ✅- post-commit hook: auto-analyze on commit
- post-checkout hook: check if graph is stale
-
graphize hook uninstall- Remove hooks ✅ -
graphize hook status- Check hook installation ✅
See docs/plans/v0.2.0-tasks.md for detailed task tracking.
- Betweenness centrality for bridge detection ✅
- Composite surprise scoring ✅
- Weight cross-file > cross-community (2.5x)
- Weight code-doc edges higher (+1.5 bonus)
- Corpus health check ✅
-
graphize report --healthflag - Verdict on whether graph adds value
-
-
graphize explain "NodeName"- Explain a node in context ✅- Show node attributes, neighbors, community, centrality
-
--depthand--jsonflags
-
graphize install <platform>- Platform installer command ✅
- Markdown/text extraction ✅
-
graphize enhance --include-docsflag -
graphize enhance --docs-onlyflag - Extract concepts and link to code nodes
-
-
graphize install claude- Claude Desktop MCP ✅ -
graphize install codex- Codex hooks.json ✅ -
graphize install cursor- .cursor/rules/graphize.mdc ✅ -
graphize install gemini- Gemini CLI context ✅ -
graphize install copilot- GitHub Copilot skills ✅ -
graphize install aider- AGENTS.md section ✅
- Tree-sitter integration via go-tree-sitter
- Python extraction
- TypeScript/JavaScript extraction
- Rust extraction
- Java extraction
- Language detection heuristics
- Unified node ID scheme across languages
- Support for 3+ node group relationships
- "All classes implementing interface X"
- "All functions in auth flow"
- Hyperedge visualization in HTML export
- Hyperedge queries
-
graphize add <url>- Fetch and extract external content- Papers (PDF): citation mining + concept extraction
- Web pages: content extraction
- Videos (YouTube): transcript extraction
-
--authorand--contributortags - URL caching by hash
- PDF extraction
- Text extraction via pdftotext or similar
- LLM concept extraction
- Citation relationship mining
- Image extraction
- Claude vision for diagrams, screenshots, charts
- Node creation for visual concepts
- Video/Audio transcription
- Whisper integration for local transcription
- God-node-aware prompts for domain vocabulary
- Transcript caching
- DOCX extraction
- Convert to markdown
- LLM concept extraction
- XLSX extraction
- Convert to markdown tables
- Extract data relationships
- 21,369 nodes extracted (AST)
- 72,351 edges extracted (AST)
- ~20 seconds extraction time
- 477 KB TOON export (gzipped)
- 23 MB HTML visualization
- 506 nodes, 1,738 edges total
- 1,720 EXTRACTED edges (AST)
- 18 INFERRED edges (LLM semantic)
- Edge types discovered: similar_to (5), shared_concern (5), inferred_depends (6), implements_pattern (2)
packages, files, functions, methods, structs, interfaces, constants, variables
- AST: calls, contains, imports, method_of, references, extends
- Semantic: inferred_depends, rationale_for, similar_to, implements_pattern, shared_concern
# 1. Initialize and extract
graphize init
graphize add .
graphize analyze
# 2. Run LLM semantic extraction (expensive, one-time)
/semantic-extract
# 3. Check in the portable artifacts
git add .graphize/manifest.json
git add agents/graph/semantic-edges.json
git commit -m "feat: add graphize knowledge graph"# Single command rebuilds everything
graphize rebuild --html --report
# View the results
open graph.html| Path | Purpose | Size |
|---|---|---|
.graphize/manifest.json |
Source tracking | <1 KB |
agents/graph/semantic-edges.json |
LLM-extracted edges | ~10 KB |
agents/specs/ |
Subagent definitions | ~5 KB |
| Path | Purpose | Regenerate With |
|---|---|---|
.graphize/nodes/ |
Graph database | graphize rebuild |
.graphize/edges/ |
Graph edges | graphize rebuild |
.graphize/cache/ |
Extraction cache | graphize rebuild |
graph.html |
Visualization | graphize export html |
GRAPH_REPORT.md |
Analysis | graphize report |
Move business logic from cmd/ to library packages for better unit testability.
- Extract
formatBytes()topkg/metrics/formatter.go- Duplicated in: benchmark.go, export_cypher.go, export_graphml.go
- Added:
FormatBytes(),FormatNumber()with tests
- Extract edge grouping helpers to
pkg/analyze/group.gogroupEdgesByType()duplicated in: export_obsidian.go, report.go- Added:
GroupEdgesByType(),CountEdgesByType(),GroupEdgesByConfidence(),CountEdgesByConfidence()with tests
- Extract directory walking to
pkg/metrics/walker.go- File collection duplicated in: benchmark.go, enhance.go
- Added:
WalkSourceFiles(),WalkSourceFilesWithContent(),WalkOptionswith tests
-
pkg/exporters/cypher/- Cypher generation from export_cypher.go- Generator type with Generate(), NodeToCreate(), EdgeToCreate()
- EscapeString(), EscapeKey(), ToNeoLabel(), ToNeoRelType()
- Comprehensive unit tests (8 test functions)
-
pkg/metrics/tokens.go- Token estimation from benchmark.go- EstimateTokens(), EstimateTokensInFile()
- Word counting + punctuation heuristics for LLM token estimation
-
pkg/exporters/obsidian/- Vault generation from export_obsidian.go- Generator type with Generate(), VaultContent result type
- GenerateIndex(), GenerateCommunity(), GenerateNode()
- SanitizeName() for safe filenames
- Comprehensive unit tests (6 test functions)
-
pkg/query/- Query formatting from query.go ✅-
summary.go- ComputeSummary, SummaryOptions, GodNode detection -
format.go- FormatTraversal, FormatPath for output formatting -
filter.go- EdgeFilter, FilterEdges, FindPartialMatches - Unit tests for all functions
-
-
pkg/analyze/report.go- Report orchestration from report.go ✅- Report struct with all analysis sections
- GenerateReport() function
- FormatMarkdown() method
- Unit tests for report generation
-
pkg/exporters/graphml/- GraphML generation from export_graphml.go ✅- Generator type with Generate(), WriteTo()
- Result type with NodeCount, EdgeCount, SkippedEdges
- Configurable: Directed, GraphID, Description
- Unit tests (9 test functions)
- Register system-spec provider in graphize
- Import
github.com/plexusone/system-spec/graphizepackage - Add to provider registry in
pkg/extract/systemspec/extractor.go - Auto-detect system-spec JSON files (has
name+servicesfields) - Extract infrastructure topology nodes alongside code graph
- Link service nodes to repo paths via
links_toedges
- Import
- Add
--serviceflag to query command- Map service name → repo URL via
links_toedges - Resolve repo URL → local path via manifest
- Filter query results to nodes from that repo
- Example:
graphize query --service paymentsreturns all code from payments repo
- Map service name → repo URL via
- Add
--serviceflag to export commands- Export subgraph for a specific service
- Useful for service-specific documentation
- Implemented
- Not started
- ✅ Complete / Better than graphify
- 🎯 HIGH priority
- 🔶 Medium priority (Phase 5-6)
- ⬜ Low priority / Future (Phase 7)