Coding with AI

Coding Agents Resolve More Problems by Choosing Whole Files Instead of Compressors

CQ2-CARE selects whole files for coding agents, avoiding compressed context that breaks patches. It beats compressors and retrievers on SWE-rebench.

Coding Agents Resolve More Problems by Choosing Whole Files Instead of Compressors

Key Takeaways

  • CQ2-CARE improves coding-agent issue fixes by spending a fixed token budget on whole, verbatim source files instead of compressed or retrieved snippets.
  • Token pruning and retrieval can break patches because exact code text may be altered or the needed file may not appear, so CQ2-CARE separates file selection from text reduction.
  • It selects candidate files by asking the model twice independently and keeping only files named in both answers, then adds short grep spans only when extra context is needed.
  • On 300 SWE-rebench issues, it resolved 43.7% of cases with GPT-5.6 and 46.7% with Claude Opus 5, beating tested prompt compressors, retrievers, and trained issue-resolution methods.
  • The practical lesson is to prioritize correct file selection and preserve full file text; if cuts are necessary, remove whole lines rather than modifying token content.

Meta description: CQ2-CARE lifts coding-agent issue fixes to 43.7% with GPT-5.6 and 46.7% with Claude Opus 5 by using whole files within a fixed token budget.

Coding Agents Resolve More Problems by Choosing Whole Files Instead of Compressors

Tags: CQ2-CARE, coding agents, SWE-rebench, token budgets, Claude Opus 5

Featured image: Abstract illustration of a coding agent selecting whole source files for a patch, friendly style, no real people, no logos, no text.

CQ2-CARE is a file-selection method for coding agents, and it is useful for builders who need better issue fixes without adding a compression model. At a fixed token budget—the maximum amount of model input measured in tokens—it resolves more issues by spending the budget on a few whole source files shown exactly as they are, rather than on token pruning or retrieved chunks. In an evaluation on 300 recent SWE-rebench issues, the method resolved 43.7% of cases with GPT-5.6 and 46.7% with Claude Opus 5.

Why token pruning and retrieval can break patches

A code patch has to quote the lines it changes exactly. That requirement makes the editing task brittle: if the context given to the model has been compressed, pruned, or rephrased, the patch may no longer match the source text. Token pruners can keep the right file while altering its content, so the generated edit fails to apply. Prompt compressors face a similar problem because they shorten context by changing or removing text.

Coding Agents Resolve More Problems by Choosing Whole Files Instead of Compressors

Retrieval creates a different risk. Retriever systems rank code by similarity to the issue, which can surface relevant snippets, but the file that actually needs editing may not rise high enough. If the agent never sees the correct file in full, the fix cannot be written. CQ2-CARE addresses both problems by separating file selection from text reduction: it first chooses a small set of candidate files, then shows those files whole and verbatim.

How CQ2-CARE selects files

The selector uses a simple two-pass question. It asks the model under test twice, independently, which files must change. It keeps only the files named by both answers. That intersection acts as a confidence filter: a file has to be selected by the model in both independent calls before it enters the final context.

After selection, the method shows those files in full. It does not use a separate compression model to shrink them. If the model needs additional details, such as definitions, callers, or strings, CQ2-CARE adds short grep spans. In this setting, grep spans are small search snippets that provide targeted context without rewriting or trimming the whole selected files. The final context therefore contains whole files plus narrowly targeted snippets, all fitted to the same per-issue token budget.

Coding Agents Resolve More Problems by Choosing Whole Files Instead of Compressors

Benchmark results across 300 SWE-rebench issues

The reported results come from 300 recent SWE-rebench issues. Every context was fitted to the same per-issue token budget and graded by the benchmark's tests. With GPT-5.6, CQ2-CARE resolved 43.7% of issues. With Claude Opus 5, it resolved 46.7%.

The comparison set covers three main alternatives. Against the best of three prompt compressors—LLMLingua-2, LongLLMLingua, and LongCodeZip—CQ2-CARE gained 6.3 points with either model. Against the best of three retrievers, including SWE-bench's file-level BM25, the gains were 9.3 points and 12.7 points. Against two methods trained for issue resolution, CQ2-CARE stayed ahead of SWE-Pruner by 2.0 points and 7.3 points, and ahead of SweRank by 0.7 points and 1.7 points, with the SweRank difference described as within noise.

How close the method gets to an oracle

The oracle comparison gives the strongest signal about what matters. Showing the true gold files resolved only 5.7 points more with GPT-5.6, and no more with Claude. In other words, once the right files were chosen and shown in full, the extra benefit from a perfect file oracle was small. A controlled test showed why preserving the text matters: deleting 20% of the tokens on every line of CQ2-CARE's own contexts cost 9.7 points.

For agent builders, the takeaway is direct. Choose the candidate files well, keep them verbatim, and if something must be cut, cut whole lines. That rule is simple enough to test in a coding-agent workflow, and the reported gains suggest it may matter more than adding a compression model or choosing a different retrieval setup.

Comments (0)

  1. No comments yet. Be the first to share what worked for you.

Leave a comment

Comments are reviewed before they appear. Your email address is not published.