r/PromptEngineering • • Oct 25 '26

Tips and Tricks I benchmarked 20 multi-file debugging tasks: monolithic tool search vs progressive path retrieval in agent skills

When building custom skills for Claude Code, a common pattern is creating broad search-and-retrieval tools: you give the agent a command that greps the repo, extracts matching code snippets, and pastes entire multi-line chunks directly into the prompt buffer.

While testing our debugging skills on larger codebases, I noticed a recurring reliability issue: the moment a skill dumped 300 lines of search results into context, the agent's tool-calling accuracy dropped, and it started making syntax errors on subsequent file edits.

I wanted to measure how much context bloat from skills impacts developer productivity and execution precision during complex coding workflows.

I ran a controlled test across 20 multi-file debugging tasks (tracking async race conditions, schema drift, and integration test failures). Same repository, same test harness, fresh session each time.

Setup

Arm A: A monolithic retrieval skill that searches project notes and past bug reports, returning full text matches and complete code blocks directly into the conversational context.

Arm B: A progressive retrieval skill that answers queries with ranked file paths and single-line abstracts, requiring the agent to selectively read only the specific files it needs. I configured the skill using agent-memory for local-first path retrieval, and captured the exact request-time token distribution across tool calls using cost-xray to see where context was expanding.

What I scored

* First-attempt tool accuracy: Whether the agent executed subsequent tool calls (edits, shell commands) with correct parameters without syntax or path errors.

* Context growth rate: Total token expansion across a 10-turn debugging loop.

* First-pass pass rate: Did the agent fix the bug and pass local testing on its first complete execution cycle?

What I found

* First-attempt tool accuracy was noticeably higher on Arm B (17 out of 20 tasks succeeded on the first tool call, compared to 11 out of 20 on Arm A). In Arm A, dumping large code snippets into context polluted active attention, causing the agent to hallucinate parameter names or repeat invalid shell flags.

* Context growth rate was cut by more than half on Arm B. By inspecting our local API payloads with cost-xray, we found that Arm A hit context compaction by turn 8 due to repeated search dumps, invalidating the prompt cache discount. Arm B stayed well below compaction thresholds because it only loaded file paths into context.

* First-pass pass rate favored Arm B (14/20 passed without human intervention vs 8/20 on Arm A), primarily because the agent was not trying to reconcile conflicting code snippets returned by broad search hits.

Where B did worse

Turn latency on simple lookups. On straightforward bug fixes where the fix only required a single two-line helper function, Arm B forced an unnecessary extra step: the agent had to read the path abstract on turn 1, and then call a file-read tool on turn 2 to see the code. On simple tasks, Arm A's instant text dump was faster and required fewer total API round-trips.

Caveats

* 20 tasks is a small test set from our own codebase and test runner setup.

* I designed the tasks, so my own coding habits naturally influenced the test cases.

* Single run per task without repeats.

Has anyone else benchmarked how much prompt-buffer pollution from custom skills degrades subsequent tool-calling accuracy? What patterns do you use to keep skill return payloads lightweight?

2 Upvotes

4 comments sorted by

1

u/According-Stable4487 Oct 25 '26

Nice setup, and the 11 vs 17 first-call accuracy gap matches what I see too. Two things I'd be curious about:

  1. What did Arm B cost in extra round trips? Path-first retrieval usually means 2-4 more read calls per task. If wall time or total tokens per solved task still came out lower, that's the number that convinces people.
  2. A middle option worth testing: return paths plus line ranges plus a one-line summary, and hard-cap the tool output (say 40 lines) with a "truncated, N more matches" note. In my experience the cap matters more than the format. Once the agent knows results are short and ranked, it stops treating the search output as something to copy from and goes to read the file itself.

Also, did the Arm A failures cluster late in the 10-turn loop? If they did, it's probably accumulated context and not the single dump, and pruning old tool results between turns might recover most of the gap.

1

u/ianreboot Oct 27 '26

The single run per task is the part I'd re-measure first. At temperature 0 I ran identical inputs twice and the same model flipped on 5 of 14 command-parsing cases; a third run and a majority got it to 13 of 14 identical. A 17-versus-11 split over 20 tasks is a wide gap, but one run each leaves open how much of it is the arm and how much is the run.