<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ozgur Demir</title>
    <description>The latest articles on DEV Community by Ozgur Demir (@ozgurcd).</description>
    <link>https://dev.to/ozgurcd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F541916%2Fc60b4ee1-0aa3-4564-bd22-47ff9c7f1116.jpeg</url>
      <title>DEV Community: Ozgur Demir</title>
      <link>https://dev.to/ozgurcd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ozgurcd"/>
    <language>en</language>
    <item>
      <title>Gograph: Stop letting AI agents hallucinate your Go code (How to ditch grep for AST)</title>
      <dc:creator>Ozgur Demir</dc:creator>
      <pubDate>Tue, 12 May 2026 18:48:53 +0000</pubDate>
      <link>https://dev.to/ozgurcd/gograph-stop-letting-ai-agents-hallucinate-your-go-code-how-to-ditch-grep-for-ast-1gac</link>
      <guid>https://dev.to/ozgurcd/gograph-stop-letting-ai-agents-hallucinate-your-go-code-how-to-ditch-grep-for-ast-1gac</guid>
      <description>&lt;p&gt;If you’ve been using Claude Code, Cursor, or custom MCP servers to navigate large Go repositories, you’ve probably hit the "Context Wall."&lt;/p&gt;

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

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

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;So, I built &lt;strong&gt;&lt;a href="https://github.com/ozgurcd/gograph" rel="noopener noreferrer"&gt;Gograph&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Gograph?
&lt;/h2&gt;

&lt;p&gt;Gograph is a local, CLI-based AST and type-aware repository indexer built specifically for AI agents. &lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvhs.charm.sh%2Fvhs-33agETudadTu75KWqLv0ow.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvhs.charm.sh%2Fvhs-33agETudadTu75KWqLv0ow.gif" alt="Gograph Demo" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Token-Saving Commands
&lt;/h2&gt;

&lt;p&gt;With Gograph in your &lt;code&gt;$PATH&lt;/code&gt;, agents can now do surgical extractions:&lt;/p&gt;

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

&lt;h2&gt;
  
  
  How to integrate it with Claude Code or Cursor
&lt;/h2&gt;

&lt;p&gt;The easiest way to supercharge your agent is to add a strict rule to your repository's &lt;code&gt;CLAUDE.md&lt;/code&gt; or &lt;code&gt;.cursorrules&lt;/code&gt; file to override its default behavior.&lt;/p&gt;

&lt;p&gt;First, install the binary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew tap ozgurcd/tap
brew &lt;span class="nb"&gt;install &lt;/span&gt;gograph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, paste this block into your CLAUDE.md or .cursorrules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Repository Navigation (CRITICAL)&lt;/span&gt;
This project is indexed using &lt;span class="sb"&gt;`gograph`&lt;/span&gt;. &lt;span class="gs"&gt;**DO NOT use `grep` or `cat` for structural Go code analysis.**&lt;/span&gt;
&lt;span class="p"&gt;
1.&lt;/span&gt; Always run &lt;span class="sb"&gt;`gograph build .`&lt;/span&gt; at the start of your session to ensure the index is fresh. If the codebase is in a compilable state, use &lt;span class="sb"&gt;`gograph build . --precise`&lt;/span&gt; instead to enable strict type-checked interface analysis.
&lt;span class="p"&gt;2.&lt;/span&gt; To find interface implementers, run: &lt;span class="sb"&gt;`gograph implementers &amp;lt;InterfaceName&amp;gt;`&lt;/span&gt;
&lt;span class="p"&gt;3.&lt;/span&gt; To extract a function body or mock stub without reading the whole file, run: &lt;span class="sb"&gt;`gograph source &amp;lt;SymbolName&amp;gt;`&lt;/span&gt;
&lt;span class="p"&gt;4.&lt;/span&gt; To see where a function is called, run: &lt;span class="sb"&gt;`gograph callers &amp;lt;FunctionName&amp;gt;`&lt;/span&gt;
&lt;span class="p"&gt;5.&lt;/span&gt; Use &lt;span class="sb"&gt;`grep`&lt;/span&gt; ONLY for string literals, configuration files (.env), or markdown documentation.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Native MCP Support
&lt;/h2&gt;

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




&lt;p&gt;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. &lt;/p&gt;

&lt;p&gt;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 &lt;strong&gt;&lt;a href="https://github.com/ozgurcd/gograph" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Let me know what you think, and I'm happy to answer any questions about the AST heuristics!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
