ColGrep-Agent on a real production codebase: what we measured, a model-loading fix, and why it pairs with a field guide
By Rick Young, founder of SiliconExchange, a US marketplace for buying and selling PC hardware. Written with Claude Code, which ran the tests.
LightOn's ColGrep-Agent post makes a simple promise: put a small code-search model on your own GPU, let it do the grepping and file-skimming, and your frontier coding agent spends fewer tokens finding code. We run Claude Code (Opus) on a private ~178,000-line TypeScript/Next.js codebase every day, and there's an RTX 5090 under the desk, so we tried it the same afternoon.
This post covers what we installed, how we tested it, what we found (including a model-loading problem and its fix), and why it works alongside a tool we already use, Field Guide.
TL;DR
- Tokens: with ColGrep-Agent added, Claude used 14% fewer tokens and 25% fewer tool calls on 10 real "where is this code?" questions. Accuracy was unchanged: 10 out of 10 in both arms.
- Where it helps: questions whose answer spans several files saved 33–37%. Single-file questions saved nothing.
- The 2B model alone is a pointer, not an answer: on its own it fully answered 4 of 10 questions and partly answered 5. The frontier model still has to open the files.
- Model loading: out of the box, every
colgrep --agentcall cold-starts its own llama.cpp server and loads the model. Running one persistent llama-server with 4 parallel slots cut a question to 2.5–4.4 s. Ten simultaneous questions finished in 16.5 s, on one shared copy of the model. - One required flag: the persistent server must be started with
--special, or every call fails. - Field Guide + ColGrep: a field guide tells the agent which system owns something and what rules guard it. ColGrep finds the exact lines. They answer different questions, and the savings stacked in our test.
Setup
- Windows 11, RTX 5090 (32 GB), Claude Code in the Claude desktop app, Opus 5.5.
- ColGrep v1.8.5 from the official GitHub release. We downloaded the Windows zip directly and checked its SHA-256 instead of piping the installer.
colgrep --install-agentpulledcolgrep-agent-2B-Q8_0.gguf(~2.5 GB) and a Vulkan build of llama.cpp. It detected the 5090 on the first try.colgrep initindexed 1,017 files in 91 seconds.
Secrets check first. Like most apps, the repo has a git-ignored env file with credentials in it. Before letting any tool return code into an agent's transcript, we read the index's metadata database and diffed it against git ls-files. Every indexed file was git-tracked; nothing ignored, no .env*. Do the same check for your own repo instead of trusting a README line.
We did not install the Claude Code hooks (colgrep --install-claude-code). They install machine-wide, across every project, and we wanted to measure before changing anyone's defaults.
How we tested
We wrote 10 questions about our own codebase, each with an answer key (files and line ranges) checked against the code before any run. They cover the parts of a marketplace where a wrong answer is expensive: payment completion, order sweeps, session revocation, sales-tax display, offer handling, dispute deadlines, URL token scrubbing, listing publish rules, an abuse rate limit and shipping deadlines. They are worded the way a developer would ask, for example "When the last unit of a listing sells, what happens to other buyers' pending offers, and where is that triggered?"
Each question was answered by a fresh Opus subagent, twice:
- A (our current practice): Grep, Glob, Read, and our field-guide lookup.
- B: the same tools, plus an instruction to run
colgrep --agent "<question>"first and verify from there.
We recorded each subagent's processed tokens, tool calls and wall time, and graded the answers against the keys.
Results
| A: field guide + grep | B: + ColGrep-Agent | |
|---|---|---|
| Tokens processed (10 questions) | 1,084,750 | 934,527 (−13.8%) |
| Tool calls | 56 | 42 (−25%) |
| Correct | 10/10 | 10/10 |
| Avg wall time per question | 16 s | 30 s (built-in runtime, see below) |
- The savings concentrated where you'd expect. The two widest questions, one an order sweep spanning a cron route, a sweep library and a refund helper, the other a payment handler that voids offers, dropped from ~130k to ~87k tokens each. Questions that live in one well-named file came out flat, because grep finds those in one step anyway.
- This is smaller than LightOn's 34%, and we think the difference is real, not noise. Their baseline was plain grep. Ours already had a field guide that sends the agent to the right system in one call, so some of the savings ColGrep offers were already taken.
- Caveats: 10 questions, one run each, one repo, one model. Token counts are what the subagent processed, including cached context re-read on every turn. That's why fewer turns means fewer tokens even when no file is skipped. Treat 14% as an indication, not a guarantee.
The 2B agent on its own. We also ran colgrep --agent alone on all 10 questions. It took ~5 s each. It fully answered 4 and partly answered 5. Typically it found the constant but not the function that enforces it, or the library but not the caller. One answer included a 2,400-line range covering most of an email module. That's fine, because it isn't the job: in arm B, Opus took the pointer, opened the files, and closed every gap. Use ColGrep-Agent to locate code; don't use it to answer.
The model-loading finding, and the fix
Arm B's wall time was nearly double arm A's. Two causes:
- Every
colgrep --agentcall starts its own llama-server and loads the model, then shuts it down. You pay that cold start on every question: about 10 s on the first call, about 5 s after that. - Parallel calls each load their own copy. We ran 5 subagents at once, which meant 5 servers and 5 copies of the model competing for the GPU. Ten at once would need ~30 GB of VRAM for model copies alone.
The Claude Code hooks don't change this. We read the v1.8.5 source: colgrep --install-claude-code adds a SessionStart hook and two PreToolUse hooks that only inject text, telling Claude (and any subagents it spawns) which search command to prefer. None of them starts or keeps a server. --hook-mode only picks that advice. hybrid, the default, steers most searches to plain colgrep, which uses only the small 17M embedding model, and saves colgrep --agent for questions about behaviour. So hybrid mode makes you pay the 2B model's load cost less often, but it never keeps the model loaded.
The fix is built into ColGrep. It can send its questions to any OpenAI-compatible server through --agent-endpoint. So we run llama.cpp's server once, with the model loaded and 4 parallel slots:
llama-server.exe ^
-m "%USERPROFILE%\.cache\huggingface\hub\models--lightonai--colgrep-agent-2B-GGUF\snapshots\<hash>\colgrep-agent-2B-Q8_0.gguf" ^
--host 127.0.0.1 --port 8765 -ngl 999 -c 65536 --parallel 4 --jinja --special
colgrep settings --agent-endpoint http://127.0.0.1:8765/v1
--special is mandatory. Without it llama-server strips special tokens from completions, and those tokens are the agent's tool-call markup. Every call fails with:
removed special tokens from the completion, which deletes the tool-call markup: start llama-server with --special
Credit to LightOn: that error message told us the exact fix. -c 65536 with --parallel 4 gives each slot 16k of context, matching ColGrep's own default agent-context. --host 127.0.0.1 keeps the server local to the machine.
Results with the persistent server:
| Built-in runtime | Persistent server | |
|---|---|---|
| One question | 2.5–4.4 s | |
| 10 questions at once | one model copy per call | 16.5 s total, one copy |
| GPU memory | ~3 GB per concurrent call | ~5.5 GB total, held permanently |
We didn't re-run the full Opus A/B on the persistent server; these timings are ColGrep's own calls. The answers matched the built-in runtime's, apart from the model's normal sampling variance (it runs at temperature 0.6).
To undo it: colgrep settings --agent-reset.
Field Guide + ColGrep: why they work together
Field Guide is an open-source Claude Code plugin that builds a plain-English guide to every system in your repo. It's one JSON file that assigns every file to a named system and describes each system: what it does, how it works step by step, its key files, its jobs and switches, the traps to avoid, and the rules and tests that guard it. Claude reads it through a one-entry lookup (node docs/field-guide/guide.mjs <system | file path | word>, about 1.5k tokens). A CI check fails whenever a file has no owner or the guide names something that no longer exists, so the guide can't quietly go stale. It's the open-source, generalized version of the internal "System Atlas" we built for SiliconExchange. In a blind A/B on this codebase, it cut ~30% of tokens on code-change tasks at equal accuracy. On quick find-and-explain questions it made no measurable difference.
That last result is the point. The two tools answer different questions:
| Field Guide | ColGrep-Agent | |
|---|---|---|
| Answers | Which system is this? What must I not break? | Which exact lines? |
| Strongest on | Changing code | Finding code across several files |
| Knows | Intent, ownership, rules, checks, traps (written down and checked against the code) | What the code says (semantic search + a small model reading files) |
| Can't know | The exact line you need right now | Why the code is the way it is |
| Cost | ~1.5k tokens per lookup, no GPU | ~3–4 s on a local GPU, no API tokens |
They fit together in the order a careful developer works. The guide sends the agent to the right system and tells it what the system guards. ColGrep turns "where in here?" into path:start-end without the agent reading half the folder. In our test they stacked: the field guide was present in both arms, and ColGrep still saved 14% on top.
The rule that makes it safe: locate, then Read
The combination has one sharp edge. Claude Code's path-scoped rules (.claude/rules/*.md with paths: globs) load only when the agent reads a matching file with the Read tool. Those rules carry our hardest-won invariants, such as which payment paths must take a lock first. If an agent acts on a snippet ColGrep returned and never opens the file, the rule never loads.
So the line we added to our CLAUDE.md, right under the field-guide pointer, says it outright:
ColGrep (this PC only):
colgrep --agent "<question>"LOCATES code (path:start-end, ~4 s, a local model); then Read every file you act on: rules load only through Read, and alone it missed a key file 5 times in 10. Connection error → run%USERPROFILE%\colgrep\start-colgrep-server.cmd.
What we'd tell LightOn
- The tool works, and the small model is impressively fast on a consumer GPU. Most of a question's time was cold start, not inference.
- Consider keeping the model loaded by default, or at least have parallel calls share one server instead of loading a copy each. Agents run subagents in parallel, and every copy costs ~3 GB of VRAM.
- Document
--specialnext to--agent-endpoint. The error message is excellent; it would be better if nobody had to see it. - State in the docs which files the indexer skips (it honored
.gitignorefor us). People will index repos with secrets in them.
Reproduce it
- Install ColGrep and the agent model, then run
colgrep initin your repo. Check the index againstgit ls-files. - Start a persistent
llama-serverwith--jinja --special --parallel N, and setcolgrep settings --agent-endpoint. - If you use Claude Code, install Field Guide (
/plugin marketplace add AlphaGator1/field-guide, then/plugin install field-guide@field-guide) and run/field-guide:build. - Add one instruction for your agent: locate with ColGrep, then Read the files you act on.
- Measure on your own questions. Our 14% is one repo's number; yours depends on how much your agent already knows before it starts searching.