Most of what you pay an AI coding agent for is not writing code. It is reading: whole files pulled into context to find one function, the same repo explored again every session, and subagents that keep spawning until your usage window is gone.
These three free, open source tools attack that waste from three sides. One gives your agent a search engine, one gives it a map of your codebase, and one gives you a brake. Here are the links first, then the install order we use.
1. XERJ: a search engine for your agent
XERJ is one Rust binary that indexes your code, docs, logs and PDFs and serves them to Claude Code, Cursor or any MCP client. Instead of grepping and pulling whole files into context, the agent pulls the exact code it needs.
In the XERJ team's own test (8 tasks, 16 runs each, real Claude token counts), the XERJ agent used 9,982 output tokens and $1.58 to solve 16 of 16. A grep agent used 26,477 tokens and $3.27 for the same result. That is 2.7x fewer output tokens.
curl -fsSL https://xerj.org/get | sh
xerj --insecure --data-dir ./data &
xerj autoindex ~/my-projectThen connect it to your agent with the MCP setup in the XERJ README. Keep --insecure for a single user on your own dev machine only: it turns off TLS and authentication. The binary is free under Apache 2.0. Its optional reranker is a paid external service that sends result text to another company's servers, so leave it off unless you want it.
2. Graphify: a map of your codebase
Graphify turns your repo, docs, schemas and PDFs into a knowledge graph your agent can query, so it asks the graph how things connect instead of reading file after file. Code is parsed locally with tree sitter and building the graph costs zero LLM credits.

uv tool install graphifyy
graphify installThen run /graphify . inside Claude Code, Cursor, Codex or Gemini CLI. Note the package name has a double y. The open source tool is free and local. Graphify Cloud is a separate paid product with a 14 day trial: you do not need it for this setup.
3. agent-usage-guard: a brake on runaway spend
Its author once watched Claude Code spawn 394 subagent calls and push 84M context tokens in ten minutes, then lock him out until the window reset. This Claude Code mod reads your plan's live usage and holds subagent fan out, heavy context prompts and retry loops before they spend your window. It asks you first, makes no network requests and fails open.
/plugin marketplace add rbartoli/agent-usage-guard
/plugin install agent-usage-guard@agent-usage-guard
/reload-pluginsThen run /agent-guard to see what it sees. It needs Claude Code v2.1.287 or later. By default it asks at 80% of a plan window and refuses at 95%.
The order we use
First the brake. Install agent-usage-guard so nothing else can burn your window while you test.
Then the map. Run Graphify on your main project once.
Then the search. Add XERJ when your agent keeps grepping big folders, logs or docs.
Get sharper with AI every week with The AI Leverage, by bestapps.ai on instagram.
