arXiv:2610.36153cs.SEOct 2026

Manuscript Offprint

arXiv:2610.36153

Stratum: Repository Memory for Coding Agents Beyond the Context Window

Yuvraj Sehgal, Mahsa Panahandeh, Naser Ezzati-Jivan

Yuvraj Sehgal ID^{ID}

Department of Computer Science

Brock University

St. Catharines, Ontario, Canada

ys19rk@brocku.ca

Mahsa Panahandeh ID^{ID}

School of Electrical Engineering

and Computer Science

University of Ottawa

Ottawa, Ontario, Canada

mpanahan@uottawa.ca

Naser Ezzati-Jivan ID^{ID}

Department of Computer Science

Brock University

St. Catharines, Ontario, Canada

nezzatijivan@brocku.ca

Abstract—Context windows have grown a thousand-fold, yet coding agents still start every session with no memory of their past work. They re-read files, retry failed approaches, and forget root causes they established hours earlier. This is not a context-length problem but a memory-architecture problem. Our hypothesis: coding agents need persistent, experience-aware repository memory, so that knowledge survives from one session to the next. Three measurements on real repositories motivate the design. First, mid-size projects already exceed the largest production context windows, and storing knowledge inside the model's key-value (KV) cache costs 10410^{4} to 10510^{5} times more bytes than storing it as indexed text. Second, across 752 real bug-fix commits, the median fix edits two files, and these files plus their direct imports amount to less than 10% of the repository; the bottleneck is selection, not capacity. Third, even with transitive import reachability and test links, 47% of co-edited file pairs remain structurally disconnected; the knowledge needed for selection must be mined from history and experience. We sketch STRATUM, a tiered memory that lives with the repository and serves it through page-safe tools: every response states what was returned, what remains, and what it cost. Retrieval over a store of one million nodes takes 1.7 ms at the median. In a multi-session experiment on eight real bugs, a fresh agent that inherited a prior session's memory, written by a different model, identified the root-cause file in 21 of 24 trials versus 6 of 24 for a retrieval-only baseline (Fisher p<10−4p<10^{-4}), at 4.5×4.5\times lower median token cost. With the notes of all eight investigations pooled in one store, success remained 8/8.

Index Terms—coding agents, LLM memory, context management, retrieval, software repositories

I. INTRODUCTION

Autonomous coding agents now routinely work for hours on repositories they can never see whole, and the industry's answer has been capacity. Context windows grew from 2K to 1M tokens in four years, and a large body of systems work optimizes the key-value (KV) cache, the per-token attention state that a long context creates inside the model (Section VI reviews it). All of this work makes the current turn cheaper. None of it gives an agent knowledge that survives the end of a session or a change of model.

This paper asks what should survive. Our central hypothesis: coding agents need persistent, experience-aware repository memory to avoid repeatedly rediscovering knowledge across independent sessions. We distinguish what the model can hold (attention state over tokens it has read) from what the agent should remember: the repository, its history, and its own experience with it. The latter, we propose, is a first-class software engineering artifact. Three measurements on real repositories ground this position.

F1: Model-resident knowledge does not scale. Django alone is 6.2M tokens, six times the largest production context window. No one proposes storing a repository as KV state; the measurement bounds the cost of any design that keeps knowledge inside the model. One billion tokens occupy about 4 GB as indexed text, but about 300 TB as fp16 KV state for a 70B-parameter model (Section II). The KV form is also model-specific: it must be rebuilt whenever the model changes.

F2: The directly connected code working set is small. Across 752 bug-fix commits in Django, Flask, and scikit-learn, the median fix edits two files. These files, plus every file they import or are imported by (their one-hop import closure), amount to 2.7–9.9% of the repository's code. This closure is only a proxy for the context a fix needs, generous in breadth but blind to configuration, runtime, and documentation dependencies. Even so, it suggests the code context of real maintenance fits in today's windows, if it can be found.

F3: Selection knowledge is not in the static structure. In these commits, plus those of a fourth repository (852 in total), 76.5% of the file pairs changed together by the same commit share no direct import edge. Extending to full transitive import reachability and test-naming links still leaves 47.3% of the pairs disconnected. Yet co-edited pairs are 26×26\times more likely than random pairs to be import-linked: co-change is real structure, but static analysis sees only half of it. The other half must be mined from version history [1] and from experience, and it must persist.

Together, these findings reframe agent memory as two problems joined: a systems problem, a memory hierarchy with paging and eviction; and a software engineering problem, mining and maintaining the relationships that make a repository navigable. Section III sketches STRATUM, which organizes memory into three kinds: structural (parsed from code), historical (mined from version history), and experiential (written back by agents). The store lives with the repository and is exposed through nine page-safe tools over the Model

Context Protocol [2]: every response carries explicit pagination and budget state, so the agent, not a lossy heuristic, decides what enters its context. Section V reports preliminary evidence for both the substrate and the mechanism, and Section VII lays out the research plan.

References (31)