Reducing Token Usage of State-in-Context Agents using Minification Conference: ; ; CCS: Software and its engineering Software maintenance tools CCS: Software and its engineering Automatic programming CCS: Software and its engineering Maintaining software CCS: Computing methodologies Natural language processing

Nicolas Hrubec, Jürgen Cito · 2026

Read Reducing Token Usage of State-in-Context Agents using Minification Conference: ; ; CCS: Software and its engineering Software maintenance tools CCS: Software and its engineering Automatic programming CCS: Software and its engineering Maintaining software CCS: Computing methodologies Natural language processing by Nicolas Hrubec, Jürgen Cito (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2606-01326.txt.

Introduction

Hrubec and Cito test if minified code cuts agent token use. State-in-context agents carry their state in the prompt. The pair rebuild the DirectSolve variant on their own. They test it end to end on SWE-bench Verified. GPT-5-mini runs the full benchmark, with GPT-4 point 1 ablations. Source code dominates token use in their prompt analysis. So they minify code before it enters the prompt.

Minification strips or shortens non-essential lexical elements. Program semantics stay intact through the changes. Input token use falls by 42 percent on average. The resolution rate drops by 12 percentage points. Light transforms thus give large efficiency gains. They keep a substantial share of baseline performance too.

Catalog record

CREATORNicolas Hrubec, Jürgen Cito
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE40 KB
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2606.01326

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Reducing Token Usage of State-in-Context Agents using Minification Conference: ; ; CCS: Software and its engineering Software maintenance tools CCS: Software and its engineering Automatic programming CCS: Software and its engineering Maintaining software CCS: Computing methodologies Natural language processing Nicolas Hrubec, Jürgen Cito Abstract . This paper presents a replication and extension of the recently introduced state-in-context agent framework. We independently re-implement the DirectSolve variant and evaluate it on the SWE-bench Verified benchmark. We report end-to-end full-benchmark results using GPT-5-mini and run selected ablations with GPT-4.1. In addition, we investigate a complementary research question: What is the impact of token-reducing input transformation strategies on the performance of software engineering agents? Based on a preliminary prompt analysis, we identify source code as the dominant contributor to token consumption. We therefore apply a series of code minification techniques that remove or shorten non-essential lexical elements while preserving program semantics. The proposed transformations are integrated into the agent and systematically evaluated. Experiments show that minification reduces average input token usage by 42% with a 12 percentage-point drop in resolution rate. These findings demonstrate that lightweight source code transformations can yield substantial efficiency gains while retaining a substantial fraction of the baseline performance, indicating a promising path toward more cost-effective agents. The full implementation is publicly available on GitHub 1 1 1 https://github.com/ipa-lab/minified-state-in-context-agent . 1. Introduction Large language models (LLMs) are increasingly deployed as the central reasoning component in agentic systems for software engineering (SE). On repository-level tasks such as SWE-bench ( 5 ) , agents repeatedly retrieve, read, and reason over large codebases. In such workflows, context size grows rapidly, resulting in high token usage. Since token usage typically determines LLM cost, long contexts also incur high operational cost. Additionally, studies have shown that LLMs can struggle to fully utilize long contexts, leading to performance degradation ( 3 ; 8 ; 6 ; 16 ; 15 ) . Thus, effectively reducing context size (while retaining relevant information) is essential for both performance and cost efficiency in LLM-based SE agents. Jiang et al. ( 4 ) recently proposed state-in-context agents as a way to simplify the architecture of such systems. Rather than reconstructing task-relevant state incrementally through tool calls, a state-in-context agent receives (a compressed version of) the entire environment state in a single prompt and is asked to produce a fix directly. In their DirectSolve variant, the LLM first ranks repository files by estimated relevance to the issue description, then aggregates top-ranked files into a large repair context, and finally generates a patch in a SEARCH/REPLACE format. This design removes much of the handcrafted scaffolding and explicit tool interaction present in previous agents such as SWE-Agent ( 20 ) or Agentless ( 18 ) , while maintaining similar performance on SWE-bench Verified ( 1 ) . This paper addresses reducing end-to-end token consumption in SE agents while aiming to limit performance impact. To make progress toward this goal, we study state-in-context agents in greater detail. To understand where tokens are spent in this setting, we first perform a prompt analysis through our re-implementation and replication of DirectSolve . We find that the overwhelming majority of tokens are source code tokens consumed during the repair step. Even after capping the repair context at 100,000 tokens, more than 90% of all tokens are spent on source code in the repair prompt. In contrast, ranking and natural language instructions together account for less than 10% (see Figure 1 ). Figure 1. Distribution of Ranking and Repair Tokens. In other aspects of software engineering, code size is routinely reduced through minification . Minification removes characters that are not required for program execution but aid human readability ( 9 ) . Typical operations include removing whitespace, comments, and line breaks, merging adjacent statements, and renaming identifiers. In the JavaScript ecosystem, for instance, minification tools are standard components of build pipelines to reduce bundle size and improve load times. Motivated by this, our solution focuses on reducing the code size of the state-in-context repair prompt using minification-style code transformations. These transformations are applied to the retrieved source files before they are passed to the LLM for repair. The overall objective is to reduce token consumption in the repair step while maintaining the model’s ability to reason about the underlying program logic. Replication This paper constitutes an independent replication and extension of the DirectSolve state-in-context agent introduced by Jiang et al. ( 4 ) . Since DirectSolve is not accompanied by a publicly available code artifact, our replication is based on a clean-room re-implementation derived from the specifications and experimental details provided in Jiang et al.’s paper ( 4 ) . Minor implementation deviations aimed primarily at reducing overall cost are outlined in Section 3.1 . Following the original paper, we evaluate on SWE-bench Verified ( 5 ) , with the main difference in our base setup being the choice of underlying LLMs. Our evaluation on SWE-bench Verified is conducted using GPT-5-mini ( 12 ) for end-to-end results on the full benchmark. We additionally use GPT-4.1 ( 10 ) for selected ablation analyses. With this setup, we replicate the main qualitative finding of the original work that a single-call, tool-free state-in-context agent can achieve competitive performance on SWE-bench Verified when paired with a sufficiently capable model. Using GPT-5-mini, we obtain a 50% pass@1 rate consistent with the originally reported 50.8% pass@1 result for DirectSolve with Gemini-2.5-Pro ( 2 ) . However, we do not attempt to replicate any of the original paper’s ablations on individual agent design choices and file localization errors. Extension Beyond replication, we extend the original study by systematically investigating source code minification as an explicit context-reduction mechanism for state-in-context agents. While Jiang et al. ( 4 ) employ compression primarily as a preprocessing step to fit long contexts, we treat code transformation itself as a first-class experimental variable. We design and evaluate a set of lightweight, semantics-preserving minification techniques tailored to Python source code, integrate them into the repair pipeline and analyze their individual and combined effects on token usage and repair performance. This extension enables a more fine-grained understanding of how different classes of code-level transformations trade off efficiency and effectiveness in large-context software engineering agents. Contributions In summary, we make the following contributions: • We re-implement the DirectSolve state-in-context agent of Jiang et al. ( 4 ) and evaluate it on SWE-bench Verified, demonstrating that our implementation reproduces the reported performance trends. • We conduct an analysis of token allocation in this pipeline, revealing that source code in the repair prompt dominates token usage and that natural-language instructions and ranking prompts are comparatively negligible. • We propose a set of lightweight, semantics-preserving code minification transformations tailored to Python and integrate them into the state-in-context repair workflow. • We empirically evaluate these transformations on SWE-bench Verified and find that minification can reduce average input token usage during repair by approximately 42% with a 12% absolute drop in resolution rate, leading to significant cost savings while retaining a substantial fraction of the baseline performance. Further analysis indicates that these trends remain largely stable across issue difficulty levels and repositories. • We perform ablation studies isolating individual transformations and stacked combinations, quantifying their respective token savings and

Read the complete text