Manuscript Offprint

arXiv:2610.20116

Maximising Transparency in Context Compaction Improves Retention of Facts and Commitments for Lightweight Coding Agents

Felix Woolford

Abstract

Long coding agent sessions outgrow the model’s context window, so agents compact: older history is replaced by something shorter, usually a model-written summary. A summary selects and rewords, and the agent cannot see what was lost. Existing work has explored a range of compaction techniques, but comparatively little attention has been paid to their effectiveness with lightweight models, including those deployed locally or used for high-volume workloads. Here, we present transparent-compact, a simple deterministic method for the open-source Pi coding agent, designed specifically for use with such models and with the purpose of maximising the transparency of the agent’s view of its own compacted context. It guarantees that user and assistant prose in its context is unchanged by a model or algorithm, and explicitly flags where compaction has stripped information. We compare it with Pi’s default model-written summary and with pi-vcc, a popular deterministic compaction method with similar methods but without verbatim retention of prose. Our benchmarks run on four models of varying performance levels, with emphasis on Qwen3.8-27B: a lightweight model at the top end of what consumer hardware can serve locally. On sets probing commitments (rules the user set which exist only in the conversation) and recall of facts, transparent-compact matched or outperformed both alternatives. In particular, it showed an advantage in avoiding confident blunders, i.e. assertion of false information as opposed to recognizing that something was not recalled. Even with a frontier model, transparent-compact’s advantage was still present but smaller, suggesting that method is broadly effective, although the strongest models are able to compensate for ambiguous summaries more effectively. We argue that transparent-compact spares lightweight models from reasoning or searching their way around what compaction lost, and results in improved recall and application of critical information as a result, without the need for task or context-specific structuring of the session history.

1 Introduction

A coding agent works in long sessions. It reads files, runs commands and tests, and talks with the user about what to do. Most of what fills its context is tool output: about 84% of an average SWE-agent turn [11], and input tokens, not output tokens, drive the cost of agentic work [2]. When the context approaches the model’s window, the agent compacts. The usual approach is to ask the model to summarise the older history and continue from the summary [17]. A summary is selective by design. It keeps what the summariser judged important, in the summariser’s words, and nothing in the agent’s new context marks what was dropped or changed.

Some losses can be repaired, for example the agent can re-read a file or re-run a test. But other losses are silently damaging: A user’s commitments (“don’t touch the migration folder”, “no need for backwards compatibility”, “we agreed to keep it in one file”) may exist only in the conversation. If nothing in the repository reveals them, then an agent that has lost one can act against it without noticing. Recent work has shown that compaction silently erases such constraints: violations rose from 0% with the policy in context to 30% after compaction, and stayed at 0% when the constraint survived the summary [4].

Compaction methods are typically developed against the most capable frontier models, whose capabilities allow them to compensate for some of the limitations of lossy summaries. This paper focuses instead on lighter weight models that are effective enough to have real-world utility, but whose weaker reasoning exposes them to failures deriving from compaction. A 27-billion-parameter model such as Qwen3.8-27B now runs on a single consumer GPU and can drive a coding agent. Such lightweight models are attractive for privacy, cost and offline use, but summary-based compaction serves them poorly in two ways. First, a model-written summary is slow and fragile on local hardware. Second, and more fundamentally, a lighter model is less able to compensate for a lossy summary: to notice what is missing, guess what an abbreviated line meant, and search its history persistently until it finds the original.

We propose that compaction for lightweight models should guarantee transparency in three senses:

(i) What is kept in context is kept verbatim: the user’s and the agent’s own words are retained absolutely, not as a reinterpretation.

(ii) What is removed is explicitly declared, so the model knows what it no longer has.

(iii) All of what is removed is recoverable in one step, and recovery protocols and conditions are parsimonious and well defined.

transparent-compact [6], which we built as an extension for the open-source Pi coding agent [22], implements these properties (Section 3.1). It removes tool outputs and reasoning, which make up most of the context and can be re-read or recovered, and keeps everything that was said by both the user and agent. The guiding principle is to aid the model in avoiding confabulation and false certainty: Summary and information compression invites misplaced certainty on partial information. Conversely, declaring what information is removed tells the agent which of its beliefs rest on material it no longer has, keeping the original words leaves no paraphrase to misread, and one-step recovery lets the agent check instead of guessing.

In this study we compared transparent-compact with Pi’s default model-written summary (pi-default) and with pi-vcc [14], a widely used deterministic extractor for Pi that is functionally closer to transparent-compact, on two kinds of probe: commitments in real sessions, and facts planted in synthetic sessions and probed after repeated compaction. Transparency matters most for the kind of error that a lossy context invites. When information is missing and the agent knows it, the agent can look it up, check, or say that it does not know, and the user can step in: the failure is visible and cheap to repair. When the context instead holds something that only looks like the answer, such as a reworded rule, a stale value or a fragment of code, the agent acts on it with confidence, and the user has no reason to check. In a coding agent such confident errors turn directly into actions, such as a broken commitment or a wrong value written into a file. We therefore distinguish confident blunders separately from uncertain errors and reports of missing knowledge. The main model is Qwen3.8-27B running locally. Two other lightweight models (GPT-6 Luna and Gemma4 31B) and a frontier model (GPT-6.1 Sol) test how the results depend on the model. Scoring was blind to the method, and a replication package is available publicly.

References (15)