What Is gograph?
gograph is a local AST/type-aware Go repository context indexer built by ozgurcd for AI coding agents, and it ships with 20+ graph queries that turn a Go codebase into navigable Markdown instead of raw file paths. gograph is one of the best AI Coding Agents tools for Go developers building terminal-based AI assistants. It parses packages, symbols, calls, routes, config reads, tests, and code-quality signals so an agent can answer architecture questions without scanning the entire tree.
The point of gograph is not generic code search. It is a repo graph that is optimized for terminal workflows, with local stdout-based access and output that an LLM can ingest directly. That makes it a fit for agents that need structural context, not just grep results.
Quick Overview
| Attribute | Details |
|---|---|
| Type | AI Coding Agents |
| Best For | Go developers building terminal-based AI coding agents |
| Language/Stack | Go, AST parsing, go/types, stdio MCP |
| License | MIT |
| GitHub Stars | N/A in the scraped page text as of Feb 2026 |
| Pricing | Open-Source |
| Last Release | N/A |
Who Should Use gograph?
- Platform teams maintaining medium or large Go monorepos that need call graphs, dependency trees, and dead-code detection without loading half the repository into an LLM.
- Agent builders wiring terminal tools into an MCP or stdio workflow who want
focus,impact, andcontextstyle commands instead of raw file coordinates. - Backend engineers shipping HTTP APIs in Go who need route extraction, config-read mapping, and caller/callee chains before editing auth, validation, or request handlers.
- Refactor owners who need
complexity,coupling, andgodobjstyle signals to decide where to split packages or shrink an oversized service.
Not ideal for:
- Polyglot repositories where Python, TypeScript, or Rust are first-class citizens, because gograph currently only parses Go.
- Teams that need compiler-grade correctness only and do not want heuristic route, test, or SQL mapping.
- Workflows that depend on embeddings or SaaS search, because gograph is local, structural, and intentionally non-LLM.
Key Features of gograph
- Local-only graph builds — gograph performs no network calls and does not send source to external APIs. That matters when the agent is running in a private repo or on a locked-down workstation.
- AST and type-aware indexing — it reads Go packages through the standard AST and can enrich results with type-checked analysis in
--precisemode. That gives you better interface satisfaction evidence and cleaner symbol mapping when the code compiles. - Token-efficient context bundles —
context <symbol>collapses node data, source, callers, callees, and tests into one response. That cuts the number of tool calls an agent needs before editing code. - Graph traversal diagnostics —
path,impact, andtrace-style queries let you move through call chains and blast radius instead of searching file by file. This is the right model for debugging a request path from entrypoint to failure. - Code health signals —
complexity,godobj,coupling, andorphansgive you a lightweight architecture review without running a separate static-analysis stack. The output is useful for prioritizing refactors, not just collecting metrics. - Config and runtime mapping — gograph can surface
os.Getenvandviper.Get*reads, plus goroutines, channels, mutexes, andsync.Once.Dousage. That makes concurrency and environment coupling visible in one graph. - Build artifact isolation — the tool generates
.gograph/graph.jsonand.gograph/GRAPH_REPORT.md, then reuses them for fast queries. You build once after a meaningful change and query many times after that.
gograph vs Alternatives
| Tool | Best For | Key Differentiator | Pricing |
|---|---|---|---|
| gograph | Go repository context for AI agents | Structural graph output with traversal, impact, and exact slices | Open-Source |
| gopls | IDE language intelligence | Best for editor hover, completion, and Go-to-definition inside Go-aware IDEs | Free |
| Claude Context Mode | LLM-first context extraction | Better fit when the workflow is centered on Claude-style repo context, not Go-only graph analysis | N/A |
| OpenTrace | Runtime tracing and observability | Better when you need live request-path evidence rather than static source analysis | N/A |
Pick gopls when the developer is in an editor and wants language-server features. Pick gograph when an agent needs a compact repository map, exact source slices, and graph traversal without the JSON-RPC friction of a language server.
Pick Claude Context Mode when your entire workflow is built around LLM context assembly across many files and languages. Pick OpenTrace when the real problem is runtime behavior, because static graph analysis will not replace tracing for live production faults.
How gograph Works
gograph builds a graph from Go source using package discovery, AST parsing, and best-effort heuristics, then stores the results in a local cache under .gograph/. The graph includes nodes for packages, symbols, methods, calls, routes, tests, config reads, and quality signals, with edges for containment, invocation, imports, and reachability.
The design choice is simple: optimize for terminal agents that need summarized structure, not editor features that need incremental cursor-aware state. In default mode, gograph tolerates incomplete repositories and still produces useful navigation data; in --precise mode, it uses type-checked enrichment to sharpen interface satisfaction and symbol resolution when packages compile.
A typical flow looks like this:
gograph build . --precise
gograph impact ValidateToken
gograph focus internal/auth
The first command builds the repository graph and writes the local artifacts. The second walks downstream callers to show blast radius, while the third extracts a narrow context bundle for one package so the agent can make a change with less file churn.
Pros and Cons of gograph
Pros:
- Local execution only keeps source code inside the workstation or container.
- Graph-first navigation saves tokens by replacing repeated
cat,sed, and ad hoc grep calls. - Useful architecture signals like coupling, complexity, and orphan detection help identify refactor targets fast.
- Precise mode adds type-aware enrichment for interface and dispatch analysis when the repo compiles.
- Generated-file filtering removes many mocks and protobufs, which keeps the graph cleaner for real code paths.
- Fast repeat queries work off the cached graph instead of reparsing the tree every time.
Cons:
- Go-only parsing is a hard limit today, so it is not the right default for mixed-language monorepos.
- Heuristic extraction for routes, SQL, and test mapping is helpful but not authoritative.
- No embeddings or semantic search means it will not replace a codebase vector index.
- Precise mode depends on compilable packages, so broken builds reduce how much type information gograph can prove.
- Needs a rebuild after major changes, because stale graph data can mislead follow-up queries.
Getting Started with gograph
# macOS or Linux via Homebrew
brew install ozgurcd/tap/gograph
# or install from source with Go
go install github.com/ozgurcd/gograph/cmd/gograph@latest
# build the repo graph from the current directory
gograph build .
# optionally generate a narrower package context
gograph focus internal/auth
After the build finishes, gograph creates .gograph/graph.json and .gograph/GRAPH_REPORT.md in the repository root. The first query should usually be a focus, impact, or callees lookup so the agent can verify the graph before making edits.
If you need stricter analysis, rerun the build with --precise. That is slower, but it improves type-aware results for interface satisfaction and dispatch-heavy code.
Verdict
gograph is the strongest option for terminal-based Go codebase analysis when an AI agent needs structural context instead of raw file reads. Its biggest strength is the local graph model with exact slices and traversal queries, while the main caveat is Go-only parsing with heuristic edges. Use gograph when you want repository intelligence for an agent, not a language-server replacement.



