LightCode: Distilling Execution Context for Coding Agents
Abstract
Large language model (LLM) agents tackle complex software tasks through extended sequences of reasoning, action, and observation. However, redundancy in incoming observations and accumulated histories inflates cumulative token costs and can impair reasoning, while indiscriminate compression risks discarding information needed later. To address this challenge, we propose LightCode, a framework for context-efficient coding agents that controls how incoming observations are represented and how accumulated histories are retained over successive interaction steps. For incoming observations, self-evolving observation compression uses execution experience to identify recurring redundancy and refine reusable compression programs, extending their coverage across formats while constraining updates to preserve required information. By integrating long-horizon history consolidation, LightCode maintains a compact task state while retaining historical details separately for selective retrieval. Evaluations across three benchmarks and four LLM backbones demonstrate consistent gains in token efficiency, with LightCode reducing token usage by 14-50% while maintaining or improving task performance. Source code is available at: https://anonymous.4open.science/r/lightcode-research-4664
est. 32% chance this paper gets accepted at ICLR 2027.
What do you think this paper will get?
All positions stay anonymous.