arXiv:2610.11007cs.AIOct 2026

Manuscript Offprint

arXiv:2610.11007

Curating Always-Loaded Context for LLM Agents: A Capacitated Assortment Model with Censored Feedback

Zexuan Liu, Yuning Yang, Tiancheng Zhao

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

At the start of every session, LLM agents load a fixed context file, such as AGENTS.md. Each loaded token in the file is charged again in every later round of the session, and these files can degrade performance as they grow in size. However, in practice, human or automated curators usually grow these files by appending. We formulate context curation as a capacitated assortment problem. Instructions consume tokens under a finite attention capacity; adding an instruction never raises the compliance of the others, while retained instructions incur a per-session setup cost. We prove an upper bound on the optimal file size, regardless of the number of available candidate instructions, and that appending every instruction with positive standalone value can be arbitrarily worse in net value than selecting an optimal subset. A token budget also limits the loss when the token price is underestimated. We then examine what can be learned from past sessions and how this information can guide decisions to add or remove instructions. Feedback is inherently censored: the benefits and harms of loaded instructions are observable, whereas missing instructions generate feedback only when their absence causes harm. In this setting, we show that deleting instructions ignored by agents can inevitably remove helpful ones. We characterize how much evidence should be collected before adding an instruction. Besides, we bound regret when human reviewers can inspect only a limited number of edits per period. Empirical experiments further show that irrelevant rules drawn from real context files reduce language-model compliance.

1 INTRODUCTION

A coding agent that works on a Python package reads the package's AGENTS.md at the start of every session. The file holds instructions such as “run pytest after every edit”, “add a CHANGELOG.md line”, “use NumPy docstrings”, “never commit to main”, and “always use conda”. The last one breaks the environment in a repository that uses uv. This example illustrates why instructions must be selected carefully: an unsuitable rule can lead the agent to make mistakes.

Even instructions that cause no harm incur a setup cost in each session, regardless of their relevance to the current task. Context files can raise inference cost by a fifth or more without a matching gain in task success (Gloaguen et al., 2026), since the file remains part of the prompt throughout the session, occupying context space in every model call. As the file grows, the agent may follow its instructions less reliably. At high instruction density the more instructions the file holds, the less reliably the agent follows any one of them (Jaroslawicz et al., 2025; Harada et al., 2025). However, McMillan (2026) and Zhang et al. (2026a), studying real configuration files, observe no drop in adherence as file size grows within the small ranges they test.

In practice the file grows by appending. Across 1,867 repositories such files more than double over their life, and deletions become rarer as the file ages (Chakrabarti, 2026). Tools that write the file from past sessions add to the pressure. Every session is summarized into new candidate instructions, so the pool of candidates grows without bound while the agent's attention does not.

These lead to two questions. What should the file contain? And how can a human or automated curator learn that from the transcripts of past sessions? The second is harder than it looks, because transcripts are censored. For instructions already in the file, transcripts reveal whether the agent complied with them and whether compliance helped or hurt. For instructions not in the file, their value is usually invisible; it becomes observable only when a failure reveals the missing instruction.

We answer the first question with an assortment model. Each candidate instruction is an item with a setup cost, a probability of being relevant, and a gain when followed. The gain can be negative as a followed instruction can harm. The agent's limited attention is shared among all instructions. Adding an instruction may lower the compliance of every instruction already in the file, so the file is an assortment whose items compete for one resource. Every loaded instruction carries a per-session setup cost. This is the fixed-cost assortment problem of operations management (Kunnumkal and Martínez-de Albéniz, 2019; Feldman and Paul, 2019) with a capacity constraint (Rusmevichientong et al., 2010; Désir et al., 2022). Two things are new: the items compete for a shared attention that dilutes as the file grows, and the pool of items grows with time.

We answer the second question with an observation model that models the censored feedback. We ask four questions: what censored transcripts identify, when a deletion policy is safe, how much corroboration to require before adding an instruction, and what a cap on human review costs.

To our knowledge, no prior work models instruction compliance as choice under a finite attention capacity, and no existing learning result handles censored feedback under an edit cap. Classical assortment models optimize revenue under a fixed choice model (Talluri and van Ryzin, 2004; Berbeglia and Joret, 2020); we instead bound the size of the optimal file under a attention-capacity bound. Learning with one-sided feedback (Helmbold et al., 2000) and learning under a bounded number of switches (Altschuler and Talwar, 2021) have each been studied separately. The unique combination with a growing candidate pool and a curator who can review only a limited number of edits has not been studied.

Contributions. (i) A model of context curation as capacitated assortment problem with a per-session setup cost, in which compliance is diluted by a shared attention load (Section 2). (ii) A structural characterization under finite attention capacity, including a file-size bound independent of the number of candidate instructions and an unbounded accretion loss, which would be optimal without attention dilution (Section 3). (iii) What censored feedback identifies: compliance and harm identify different parameters, so deleting on non-compliance is value-blind and can remove the better instruction (Section 4). (iv) An evidence threshold for adding an instruction, and regret when a reviewer accepts at most m edits per period, with the edit-cap term matched above and below (Section 4). (v) Experiments in which the optimal file size stays flat as the candidate pool grows from 200 to 3,200 items for two models, and a simulation matching the edit-cap regret bounds (Section 5).

Section 2 defines the model, Section 3 gives the structural results, Section 4 develops the learning results, and Section 5 reports the experiments. Proofs are in the appendix; Appendix A also gives the results on token budgets. The numbered results, except those relying on the smoothness-to-bound step in Assumption C.4, have complete formal proofs in Lean 4 (supplementary material).

References (68)