# I was giving my coding agent context the wrong way... <!-- ref: @content/youtube/ai-jason/i-was-giving-my-coding-agent-context-the-wrong-way tags: [coding agents, codebase graphs, MCP tools, token efficiency, code search, change impact analysis, hooks] version: 2 updated_at: 2026-11-24T05:15:01.719Z --> **[Watch on YouTube](https://www.youtube.com/watch?v=iWRmtPdFbGw)** # I was giving my coding agent context the wrong way... *Synthesized from AI Jason, 2026-06-30; speakers are not named in the source.* A single presenter demonstrates the Codebase Memory MCP tool on a large codebase and on his team's design-platform repository. The transcript is machine-generated and has some misspelled tool and product names. ## Core Thesis The presenter argues that coding agents waste tokens and miss breakage when they find code with text search and read files one at a time. A deterministic graph of functions, classes and call edges, built without an LLM, lets the agent ask for the blast radius of a change. He reports that this cuts token use by almost half. ## Key Insights - **The failure mode.** A grep returns a wall of matches, the agent opens about 20 files one after another, and it still misses places that could break. - **The tool.** Codebase Memory MCP is mostly C and C++. It indexes a large codebase in about three minutes and a smaller one in seconds, and it extracts functions, classes and methods into a relationship graph. - **Graph tools.** The agent can fetch an architecture overview, search the graph for a node, trace call paths, list callers that lack test coverage, and show the impact of changes in a pull request. - **Interceptor pattern.** A Claude Code or Codex hook runs a graph lookup before the agent's plain search and appends graph context to the grep output. The benefit does not depend on the agent remembering to call the MCP tool, and he recommends this pattern for MCP builders. - **Hidden invariant.** In his design platform, a backend function that adds a design node called a lock that was not visible from the function itself, because the caller did not invoke it directly. The graph surfaced it, and he used it to show how a "simplification" would cause race conditions across concurrent agents. - **Token comparison.** On the first question, the graph answer used about 11,000 tokens against about 38,000 without it. On a second question about what would change, the figures were about 33,000 and 64,000. - **Setup.** One install command adds the MCP to the coding agent, with an optional web UI for the graph. The agent asks which folders to ignore during indexing. He has added the tool to his codebase customization skill. ## Actionable Takeaways 1. Index the codebase into a graph of functions, classes and call edges before asking an agent to change shared code. 2. Before editing a function, ask the graph for its callers and which of them have no test coverage. 3. Use a hook to intercept plain search so graph context is added whether or not the agent calls the tool. 4. Measure token use with and without the tool on the same query. 5. Look for hidden guards, such as locks, in helper code that the function you are editing does not call directly. ## Notable Quotes > "your codebase is already a map. Every import, every function call is an edge." — the presenter > "there was no real reliance on the agent always calling this specific MCP tool" — the presenter --- *Related: `@content/web/github/2026-11-25-claude-code-v2-1-332` · `@content/youtube/yifan-bth/claude-code-beat-cursor-4-2-heres-why-im-still-using-both` · `@content/youtube/david-ondrej/build-anything-with-tmux-here-s-how` · `@content/youtube/wes-mcdowell/how-to-use-chatgpt-for-content-creation-itll-sound-like-you` · `@content/youtube/cole-medin/ai-makes-us-way-faster-but-fries-our-focus-heres-what-i-do-about-it`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*