StateTape improves coding agent memory with symbol-level tracking

StateTape: Action-Conditioned Evidence Lifecycle Modeling for Long-Horizon Coding Agents

Artificial Intelligence

Summary

Coding agents that write and edit code face a problem: as they work, their memory of past changes grows too large and can get outdated or confusing. The authors propose StateTape, which tracks exactly which parts of the code are changed every time the agent makes an edit, using a detailed map of code symbols and their connections. This helps the agent know what parts of its memory are still correct and what needs updating, so it can work better on longer, complicated coding tasks without slowing down. They tested it with several coding agents and found it helped them keep accurate records and solve problems more reliably.

What this means in practice

  • For software development teams: Support coding AI in managing complex codebases by tracking precise code changes to keep memory relevant through long editing sessions.
  • For automated code review teams: Help automated review tools maintain accurate understanding of evolving code by clearing outdated records based on symbol-level change tracking.

Authors

Ziyang Yu, Liang Zhao, Bowen Zhu, Hasibul Haque

Abstract

Despite the recent success of coding agents built on large language models, it remains challenging to run them over long horizons, since every observation is appended to the context and the context grows with each one. History-based maintenance is a common remedy, which masks or summarizes old observations, or prunes what a model reads as useless, and bounds the context at little cost. However, it decides from the text of the history alone and sees nothing of how the code is connected. Since a coding agent edits code many times over a single task, and each write can change what code elsewhere means, such maintenance may keep records a write has falsified, drop ones that still hold, and miss code the agent needs next. To overcome these challenges, this paper proposes StateTape, a novel and scalable framework that rewrites a coding agent's context as the repository changes rather than as the context grows. The key idea of StateTape is to model the repository as a symbol-level code graph, whose dependencies and language rules expose which symbols a write can affect. Upon this graph, a tape marks the symbols each write changed, which turns staleness from an inference about text into an observation of the agent's writes. We propose a per-write procedure in which the tape nominates the records a write could have falsified while a small manager model settles what the write log cannot, and further provide a theoretical analysis and TraceBench, a benchmark that labels what an agent is holding against what is actually needed. Empirically, we demonstrate that StateTape can effectively clear falsified records and retrieve what is needed, and thus achieve a higher resolve rate in all experiments spanned by six coding agents and three edit-heavy benchmarks with little computational overhead.