惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
B
Blog
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
量子位
博客园 - 叶小钗
T
Tailwind CSS Blog
小众软件
小众软件
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
V
V2EX
博客园_首页
I
InfoQ
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Gograph: Stop letting AI agents hallucinate your Go code ...
Ozgur Demir · 2026-05-13 · via DEV Community

If you’ve been using Claude Code, Cursor, or custom MCP servers to navigate large Go repositories, you’ve probably hit the "Context Wall."

By default, AI coding agents navigate codebases using standard CLI tools like grep, cat, and find. In a compiled, strongly-typed language like Go, this creates two massive bottlenecks:

  1. Massive Token Waste: To find a single struct definition, the agent greps a keyword, gets hundreds of noisy results, and decides to cat a 1,500-line file just to read a 10-line struct.
  2. Duck-Typing Hallucinations: Because Go uses implicit interfaces, grep is practically useless for answering the question: "Which structs actually implement the AuthService interface?" The agent ends up hallucinating implementations based on naming conventions.

I got tired of watching Claude burn thousands of API tokens reading noisy tests and dependency injection wiring just to find a simple factory function.

So, I built Gograph.

What is Gograph?

Gograph is a local, CLI-based AST and type-aware repository indexer built specifically for AI agents.

Instead of letting the LLM wander blindly with string-matching tools, you instruct it to use gograph for semantic, structural extraction. It performs no network calls, runs instantly, and outputs strictly formatted, machine-parseable JSON or text.

Gograph Demo

The Token-Saving Commands

With Gograph in your $PATH, agents can now do surgical extractions:

  • Find interface implementers: gograph implementers "AuthService"
  • Extract a function body (without reading the file): gograph source "ValidateToken"
  • Calculate blast radius before a refactor: gograph impact "printResults"
  • Bundle all context in one call: gograph context "User" (Returns the AST node, exact source code, upstream callers, downstream callees, and related tests in a single token-optimized prompt).

How to integrate it with Claude Code or Cursor

The easiest way to supercharge your agent is to add a strict rule to your repository's CLAUDE.md or .cursorrules file to override its default behavior.

First, install the binary:

brew tap ozgurcd/tap
brew install gograph

Enter fullscreen mode Exit fullscreen mode

Then, paste this block into your CLAUDE.md or .cursorrules:

## Repository Navigation (CRITICAL)
This project is indexed using `gograph`. **DO NOT use `grep` or `cat` for structural Go code analysis.**

1. Always run `gograph build .` at the start of your session to ensure the index is fresh. If the codebase is in a compilable state, use `gograph build . --precise` instead to enable strict type-checked interface analysis.
2. To find interface implementers, run: `gograph implementers <InterfaceName>`
3. To extract a function body or mock stub without reading the whole file, run: `gograph source <SymbolName>`
4. To see where a function is called, run: `gograph callers <FunctionName>`
5. Use `grep` ONLY for string literals, configuration files (.env), or markdown documentation.

Enter fullscreen mode Exit fullscreen mode

Native MCP Support

If you prefer not to use CLI instructions, Gograph also ships with a native Model Context Protocol (MCP) server. Running gograph mcp . exposes all of these commands natively to Claude Desktop over stdio!


I built this to scratch my own itch during a heavy Go refactor, but it completely changed how I interact with LLMs in compiled codebases.

If you are building AI agents or just want Cursor to stop hallucinating your interface bindings, I'd love for you to give it a spin! You can check out the source code, installation instructions, and full feature list on GitHub.

Let me know what you think, and I'm happy to answer any questions about the AST heuristics!