Your Claude Code Go token bill is a Lookup problem
Claude has memorized the library during training. But it uses functions that never existed and ones removed three releases ago. It writes Go from memory instead of looking up the real thing.
Watch a coding agent meet an unfamiliar Go dependency. It fails in one of two directions. It guesses from training data and invents an API: a function that never existed, or one removed three releases back, written against a version it last saw two years ago. Or it over-fetches: it pours the whole package documentation into context, or clones the repo and greps the source, to answer something as small as the signature of sentry.Init.
Both are failures of lookup. The first looks up nothing. The second looks up everything. Neither asks pkg.go.dev a precise question.
The reflex across the tooling space is to give the agent more access. More docs, bigger fetches, a full mirror of the source tree. That is backwards. The expensive part is not access, it is everything the agent has to drag into context to find the one fact it actually needed. The win is a narrower call.
The agent guesses instead of looking it up
↳ Wrong signature in the generated code
↳ Claude Code retries, burning extra turns
↳ Context fills
↳ Gets slower and costlierOne binary, two surfaces
pkg.go.dev just shipped a real API. godig is what you do with it: a CLI and an MCP server for searching Go packages, reading docs, and listing symbols, versions, importers and vulnerabilities.
Same binary, two surfaces, built from one hand-written catalog of operations. Every CLI command is also an MCP tool, generated from the same definition. The godig symbol examples command you run in your shell and the symbol-examples tool your agent calls are the same code path. So the thing you reach for at the terminal is exactly what Claude Code reaches for as a tool. Nothing is bolted on; the agent surface falls out of the CLI for free.
Two operations carry the argument
overview is one call that returns a module’s metadata, its latest and recent versions, licenses and known vulnerabilities. No documentation blob. An agent orients on an unknown dependency in a single round-trip, then decides what it actually needs next.
symbol doc returns the documentation for one identifier. Ask for sentry.Init and you get its kind, signature, first-sentence synopsis and, on request, a runnable example. Not the rest of the package. The agent reads the function it is about to call, and nothing else. And when it asks for a symbol that is not there, it gets a not-found error, not a plausible invention: it can confirm a function exists before it writes the call.
That is the whole token story. Instead of “clone the package in /tmp and let the model sift,” you get “ask pkg.go.dev a precise question and get a precise answer.” The context window stays for code, not for documentation the agent will read once and discard.
Because it is also a CLI, the same surface is yours at the terminal:
godig overview github.com/samber/ro # before you add the dependency
godig package licenses github.com/samber/ro # before you add the dependency
godig package imports github.com/samber/ro # review dependencies
godig vulns github.com/samber/ro # in a CI script
godig symbols github.com/samber/ro -o md # a quick Markdown tableThe agent’s tools and your tools are the same tools.
godig imported-by is also a reputation check. Nobody got fired for buying IBM, but plenty got burned importing a flashy 5-star lib nobody else depends on. A library your trusted packages already lean on is the safer bet. Stars are vanity; importers are votes with a go.mod.
Precision compounds
The token win is not only per call. In an agent loop, every tool result and every wrong turn stays in the context window for the rest of the session. A vague or partial answer triggers another call: fetch more, compile, fail, clone, retry. Each round adds tokens that every later step has to re-read, and each round is one more network round-trip of latency.
One accurate answer cuts the loop short. overview orients the agent in a single call; a symbol lookup confirms the exact signature before it writes code that would not compile. Fewer turns means a smaller transcript, which means every later model call is cheaper and faster, not just the one you saved. The effect does not add up. It multiplies.
“I already run Context7”
Then godig is not a replacement, it is a different axis. Context7 keeps documentation fresh across every language by crawling and ranking it. godig returns structured Go facts straight from pkg.go.dev: the version list, the importers, the vulnerabilities, the signature of a single symbol. No crawl, no index, no catalogue to be added to, no API key. If a module is on pkg.go.dev, godig sees it the moment it is published. Use Context7 for current prose. Use godig for precise facts.
Setup
Install the binary:
go install github.com/samber/godig/cmd/godig@latestRegister it with your agent over stdio, where the client launches it on demand:
claude mcp add pkg-go-dev -- godig mcpOr skip the install entirely and point at the remote MCP:
claude mcp add --transport http pkg-go-dev https://godig.samber.dev/mcpOr use the CLI and its companion skill, which is the part that makes the agent use the tools well:
npx skills add https://github.com/samber/cc-skills-golangPrefer the skill for local Claude Code. Use MCP server in https://claude.ai/code.
Net effect
Your agent stops guessing and stops dumping whole packages into context. It asks pkg.go.dev precise questions instead. No invented APIs, fewer tokens, fewer turns, no repo clone. Cheaper and faster, because it gets the answer right the first time.
godig: github.com/samber/godig
Skill
golang-pkg-go-dev: github.com/samber/cc-skills-golang
Point your agent at it, and star the repo if it saves you a context window.
If you enjoy my work, consider sponsoring me on GitHub. Your support helps me keep writing and creating open-source projects 👉 github.com/sponsors/samber

