Gograph
3.5 points
6.0K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.

๐Ÿ•ธ๏ธ gograph

Go Report Card License: MIT Go Version Homebrew Docs

Stop burning tokens on grep. Give your AI agent a graph.

gograph builds a local, AST-aware call graph of your Go repository and exposes 50+ query tools via CLI and MCP, so coding agents can navigate packages, symbols, call chains, routes, SQL, env vars, and tests โ€” without reading raw files.

๐Ÿ”’ Zero network. Zero execution. Zero secrets read. gograph is purely static analysis โ€” it never runs your code, makes API calls, or opens non-.go files.


๐Ÿš€ Quick Start

# Install
brew install ozgurcd/tap/gograph

# Build the graph
gograph build . --precise

# Try it โ€” who calls ValidateToken?
gograph callers "ValidateToken"

# Full context in ONE call (node + source + callers + callees + tests)
gograph context "ValidateToken"

# Change plan before editing (callers, tests, routes, SQL, env risk)
gograph plan "ValidateToken"

๐Ÿ’ก Why gograph?

Benchmarked on gograph's own codebase (70 files, 518 symbols, 16 packages):

Task grep -rn gograph Savings
Find callers of loadGraph 158 noisy lines (comments, docs, vars) 56 exact structural call sites ~65% noise eliminated
Locate symbol definitions 842 lines matching "Symbol" 83 true type/method declarations ~90% noise eliminated
Read one function body cat dumps 180+ lines of the whole file source extracts the exact 12-line function ~93% fewer tokens
Understand a symbol fully 4โ€“5 separate tool calls 1 call: context bundles everything 80% fewer tool calls

โœจ Key Features

  • ๐Ÿ” 50+ Query Tools โ€” callers, callees, impact, context, plan, review, errorflow, orphans, hotspot, coupling, and more. Full command reference โ†’

  • ๐Ÿ”Œ Native MCP Server โ€” all tools available as MCP endpoints for Claude, Cursor, Copilot, and any MCP-compatible agent. One command setup: gograph add-claude-plugin

  • ๐Ÿช™ Token-Saving Composites โ€” context replaces 5 calls. plan replaces 8. explain synthesizes architectural narratives. Built to minimize agent round-trips.

  • ๐Ÿ›ก๏ธ Safe by Design โ€” no network, no code execution, no secrets, no .env files read. AI worktree directories (.claude/, .cursor/, .agents/) auto-excluded.

  • ๐Ÿ›๏ธ Architecture Enforcement โ€” boundary rules, API drift detection, complexity gates, dead code sweeps, god-object detection, coupling analysis. Run in CI with gograph gate.

  • ๐Ÿ“‹ Agent Compliance Auditing โ€” session telemetry tracks whether agents run plan before edits and review after. Grades agent behavior Aโ€“F with actionable recommendations.


๐Ÿ“– Command Reference

All commands support --json for machine-readable output and --files-only for flat file lists.

Category Commands What it does
Indexing build . [--precise], stale, stats Parse AST, write graph. Check freshness. Index health.
Navigation query, callers [--depth N], callees [--depth N], path, source, node Find symbols, trace call chains, extract source.
Context context, explain, focus, endpoint Bundled structural data in one call. Token savers.
Change Analysis plan, review, risk, impact [--uncommitted|--since], changes [--git], api --since Pre-edit planning, post-edit review, risk analysis, blast radius, drift.
Architecture boundaries, coupling, complexity, godobj, orphans, arity Quality gates, dead code, coupling, god objects.
Types & Structs fields, implementers [--test-only], interfaces, embeds, constructors, literals, usages, mutate, schema Struct fields, interface satisfaction, type usage.
Infrastructure routes, sql, envs, errors, concurrency, globals, httpcalls, deps [--transitive], dependents, imports HTTP routes, SQL, env vars, concurrency, outbound HTTP calls, imports.
Testing tests, fixtures, mocks Test coverage map, helpers, mock implementations.
Error Tracing errorflow [--no-tests], trace Reverse-BFS from error strings to HTTP entry points.
Diagnostics hotspot, returnusage, skeleton, diagram, changes, public Hotspots, return usage, API signatures, Mermaid diagrams.
CI/CD check [--since|--uncommitted], gate, snapshot save|diff|list|drop Policy checks, threshold enforcement, metric snapshots.
Telemetry session create|end|audit|cleanup Agent compliance tracking and grading (Aโ€“F).
LLM-Wiki wiki [--output dir] Generate llm-wiki/ โ€” machine-first markdown pages for zero-cost agent orientation (overview, architecture, hotspots, routes, env, errors, concurrency, per-package, API surface).
Summary summary [--json] Single-call codebase briefing: top 3 hotspots, worst instability package, highest complexity function, orphan count, god-object count. Replaces 5 separate calls.
Untested untested [--pkg name] [--top N] [--json] Functions with callers but zero test edges โ€” coverage gaps invisible to orphans or per-symbol test queries. One sweep replaces N tests <sym> calls.
Doc doc <pkg[.Symbol]> [--json] go doc wrapper โ€” signature + doc comment for any stdlib or third-party symbol. No graph required. Closes the gap when call chains leave the project.

๐Ÿ“š Full command reference with examples: gograph.identuum.ai/docs/command-reference

๐Ÿ›๏ธ Architecture Boundary Enforcement

Define boundaries in .gograph/boundaries.json:

{
  "layers": [
    { "name": "domain", "packages": ["internal/domain/**"], "may_import": [] },
    { "name": "handler", "packages": ["internal/handler/**"], "may_import": ["internal/service/**", "internal/domain/**"] }
  ]
}

Run gograph boundaries โ€” exits with code 1 on violation. Works in CI/CD.


๐Ÿค– AI Agent Integration

One-command setup (Claude Desktop + Claude Code)

gograph add-claude-plugin

This registers the MCP server, injects CLAUDE.md steering rules, and installs a PreToolUse hook that redirects grep on Go symbols to gograph tools.

Alternative โ€” install via Claude Code plugin marketplace

/plugin marketplace add ozgurcd/gograph
/plugin install gograph@gograph

Discovers gograph through Claude Code's plugin marketplace and ships a SKILL.md that auto-activates on Go work, teaching the agent the mandatory workflow (capabilities โ†’ build โ†’ plan โ†’ context โ†’ review) and that grep/rg/find must not be used for Go symbol search.

๐Ÿ’ก Note: You still need the gograph binary installed (brew install ozgurcd/tap/gograph or go install github.com/ozgurcd/gograph@latest). Use gograph add-claude-plugin above for the full one-command bootstrap (MCP wiring + CLAUDE.md rules + PreToolUse hook). Use the plugin marketplace when you'd rather discover and install gograph from inside Claude Code's plugin UI.

Other agents (Cursor, Copilot, Antigravity, etc.)

gograph mcp .   # Run as MCP server over stdio

Add to your .cursorrules or AI system prompt:

Before answering architecture or repository questions, inspect the available gograph_* MCP tools and use them instead of grep/find. Run gograph capabilities first.

Machine-readable output

All commands support --json for machine-readable output:

gograph callers "ValidateToken" --json
# โ†’ {"schema_version": "1", "command": "callers", "status": "ok", "count": 2, "results": [...]}

For full integration guides, see docs/coding-agent-usage.md.

Zero-cost orientation with llm-wiki/

Run gograph wiki once per session to generate a directory of machine-first markdown pages โ€” overview, architecture diagram, hotspots, routes, env vars, error sites, concurrency, per-package docs, and the full API surface. Agents read these pages instead of issuing dozens of individual tool calls:

gograph build . --precise
gograph wiki                 # writes to ./llm-wiki/
# then read: llm-wiki/README.md โ†’ project.md โ†’ rules.md โ†’ agent-contract.md โ†’ overview.md

โš ๏ธ Add llm-wiki/ to .gitignore โ€” these files are regenerated each session.


๐Ÿ“Š Example Output

When you run gograph build ., the generated GRAPH_REPORT.md gives your AI a condensed context map.

External Dependencies (Tech Stack)

Module Version
github.com/gin-gonic/gin v1.9.1
github.com/jackc/pgx/v5 v5.5.5

Important Symbols (Top by outgoing calls)

Symbol Kind File Line Calls out
(Server).Start method server.go 42 18
ValidateAuth function auth.go 12 14

๐Ÿ†š Why not use a Language Server (gopls)?

gopls is optimized for human IDEs. gograph is optimized for terminal-based LLMs:

  1. Protocol Mismatch โ€” gopls returns file:line:col coordinates. Agents must then burn tokens running cat/sed to read the actual code. gograph extracts the exact structural slice and formats it as Markdown.

  2. Graph-Level Diagnostics โ€” gopls does hover and go-to-definition. gograph does reverse-BFS error tracing, full blast radius analysis, and PR-level change plans across the entire call graph.

  3. Composable Intelligence โ€” gopls answers one question at a time. gograph context bundles node + source + callers + callees + tests in a single call. gograph plan aggregates impact, routes, SQL, env, and test risk into one checklist.

โœ… Correctness Model
  • Default mode uses Go AST parsing and best-effort heuristics. Tolerates incomplete or non-compiling repositories.
  • Precise mode uses type-checked enrichment and requires compilable packages.
  • Heuristic extractors (routes, SQL, tests, error mapping) are navigation aids, not authoritative program analysis.
๐Ÿšซ Non-goals
  • No multi-language parsing
  • No AI/model API calls
  • No embeddings or SaaS backend
  • No telemetry
  • No replacement for compiler/type-checker correctness

๐Ÿค Contributing

Pull requests welcome! See CONTRIBUTING.md for build, test, and contribution guidelines.

๐ŸŒ Language Support: gograph currently parses Go only. The architecture is extensible โ€” if you want to add Python, TypeScript, Rust, etc., please open an issue first.


๐Ÿ“„ License

MIT โ€” see LICENSE.

gograph MCP server

Alternatives

M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
50.5K
5 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
33.9K
4.5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
39.0K
4.3 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
107.0K
4.3 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
91.5K
4.5 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
49.4K
5 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
32.7K
4.5 points
C
Context7
Context7 MCP is a service that provides real-time, version-specific documentation and code examples for AI programming assistants. It is directly integrated into prompts through the Model Context Protocol to solve the problem of LLMs using outdated information.
TypeScript
133.5K
4.7 points