graphify-go

A high-performance Go port of graphify — turn any codebase into a navigable knowledge graph with community detection and an honest audit trail.
graphify-go is a complete reimplementation of the original Python-based graphify in Go, delivering 20x faster performance with zero Python dependency. Single binary, no setup required.
| Metric |
Python (graphify) |
Go (graphify-go) |
Speedup |
| 721 files / AST extraction |
~15s |
0.78s |
~20x |
| Community detection (783 nodes) |
~1s |
<10ms |
~100x |
| Total pipeline |
~20s |
<1s |
~20x |
| Binary size |
~50MB (with venv) |
33MB (single binary) |
— |
| Dependencies |
Python 3.10+, pip |
None |
— |
Benchmarked on a real React Native project (721 files, 783 nodes, 8,403 edges) on Apple M-series.
Why Go?
The original graphify by @safishamsi is an excellent tool for building knowledge graphs from codebases. This Go port was created to:
- Eliminate Python dependency — no
pip install, no virtual environments, no version conflicts
- Leverage native tree-sitter — tree-sitter is written in C; Go's CGO bindings are significantly faster than Python's ctypes bridge
- Single binary distribution —
go install and you're done, on any platform
- Parallel extraction — Go's goroutines enable true concurrent file processing
Features
- 18 languages supported via tree-sitter AST parsing: Python, JavaScript, TypeScript, Go, Java, Rust, C, C++, C#, Ruby, Swift, Kotlin, Scala, PHP, Lua, and more
- Louvain community detection — pure Go implementation, no external libraries
- Three outputs: interactive HTML (vis.js), queryable JSON, audit report (Markdown)
- SHA256 file caching — incremental re-extraction on subsequent runs
- Cross-file import resolution — traces imports across module boundaries
- Confidence tagging — every edge is marked
EXTRACTED, INFERRED, or AMBIGUOUS
- AI agent integration — works as a skill in Claude Code, Codex, and Gemini CLI
Install
go install github.com/techinpark/graphify-go/cmd/graphify@latest
Or build from source:
git clone https://github.com/techinpark/graphify-go.git
cd graphify-go
go build -o graphify ./cmd/graphify/
Usage
# Analyze current directory
graphify .
# Analyze a specific path
graphify ./src
# Incremental update (only re-extract changed files)
graphify . --update
# Skip HTML visualization
graphify . --no-viz
# Deep extraction mode
graphify . --mode deep
Output
graphify-out/
├── graph.html # Interactive vis.js visualization — open in browser
├── graph.json # NetworkX-compatible JSON — queryable, persistent
├── GRAPH_REPORT.md # Audit report with God Nodes, Surprising Connections
└── cache/ # SHA256 cache for incremental re-runs
graph.html — Interactive Visualization
Dark-themed interactive graph powered by vis.js:
- Nodes sized by degree, colored by community
- Click to inspect node details and neighbors
- Search nodes by name
- Community legend with toggle visibility
- Dashed edges for
INFERRED/AMBIGUOUS relationships
GRAPH_REPORT.md — Audit Report
- God Nodes — most connected core abstractions
- Surprising Connections — unexpected cross-file/cross-community edges
- Communities — auto-detected module clusters with cohesion scores
- Knowledge Gaps — isolated nodes, thin communities, high ambiguity
- Suggested Questions — what this graph is uniquely positioned to answer
AI Agent Integration
graphify-go works as a skill/command in major AI coding assistants. Install once, then use natural language or slash commands to analyze any codebase.
Claude Code
# Install the skill
graphify install
# Then in Claude Code, type:
/graphify .
This registers SKILL.md at ~/.claude/skills/graphify-go/ and adds a trigger to ~/.claude/CLAUDE.md. When you type /graphify, Claude Code runs the binary and presents the results.
OpenAI Codex
# Install for Codex
graphify install --platform codex
# Then in Codex, type:
$graphify .
This registers the skill at ~/.codex/skills/graphify-go/ and creates an AGENTS.md entry.
Google Gemini CLI
Gemini CLI reads project instructions from GEMINI.md. Add graphify-go manually:
# 1. Build or install graphify
go install github.com/techinpark/graphify-go/cmd/graphify@latest
# 2. Add to GEMINI.md in your project root
cat >> GEMINI.md << 'EOF'
## graphify-go
To analyze this codebase's architecture, run:
```bash
graphify .
Then read graphify-out/GRAPH_REPORT.md for god nodes, communities, and surprising connections.
Open graphify-out/graph.html in a browser for interactive visualization.
EOF
Then in Gemini CLI, ask: *"Run graphify and summarize the architecture"*
### Uninstall
```bash
graphify uninstall # Claude Code
graphify uninstall --platform codex # Codex
How It Works with AI Agents
| Agent |
Install Command |
Trigger |
Config Location |
| Claude Code |
graphify install |
/graphify . |
~/.claude/skills/graphify-go/SKILL.md |
| Codex |
graphify install --platform codex |
$graphify . |
~/.codex/skills/graphify-go/SKILL.md |
| Gemini CLI |
Manual GEMINI.md |
Natural language |
./GEMINI.md |
All agents execute the same graphify binary and produce identical outputs. The SKILL.md instructs the agent to:
- Run
graphify <path> — the full pipeline completes in under 1 second
- Read
graphify-out/GRAPH_REPORT.md and present a summary
- Suggest opening
graph.html for interactive exploration
Architecture
cmd/graphify/ CLI entry point (cobra)
internal/
├── detect/ File discovery & classification
├── extract/ Tree-sitter AST extraction (18 languages)
├── graph/ Graph data structures & operations
├── cluster/ Louvain community detection (pure Go)
├── analyze/ God nodes, surprising connections, questions
├── export/ HTML (vis.js), JSON, Markdown report
├── cache/ SHA256-based file caching
└── skill/ AI agent skill installation
Supported Languages
| Language |
Extensions |
Entities Extracted |
| Python |
.py |
classes, functions, imports, calls, inheritance |
| JavaScript |
.js, .jsx |
classes, functions, arrow functions, imports, calls |
| TypeScript |
.ts, .tsx |
classes, interfaces, functions, imports, calls |
| Go |
.go |
types, functions, methods, imports, calls |
| Java |
.java |
classes, interfaces, enums, methods, imports |
| Rust |
.rs |
structs, enums, traits, impl blocks, functions |
| C/C++ |
.c, .h, .cpp, .hpp |
functions, classes, structs, includes |
| C# |
.cs |
classes, interfaces, structs, methods, using |
| Ruby |
.rb |
classes, modules, methods |
| Swift |
.swift |
classes, structs, protocols, enums, functions |
| Kotlin |
.kt |
classes, objects, interfaces, functions |
| Scala |
.scala |
classes, objects, traits, functions |
| PHP |
.php |
classes, interfaces, traits, functions |
| Lua |
.lua |
functions |
Credits
This project is a Go port of the original graphify by Safi Shamsi. The original project introduced the concept of turning any folder into a queryable knowledge graph with community detection and an honest audit trail. All credit for the core idea, graph schema, and output format goes to the original author.
License
MIT