Manuscript Offprint

arXiv:2610.02404

Trained Agentic Context Management

Bryce Sandlund

ABSTRACT

We study long context language models. Instead of training long context natively, or designing a long context harness, we train a model over the simplest possible harness: a tool to call itself with any specified prompt and a tool to read tokens in a range from the input context. We finetune Qwen3.6-35B-A3B on a diverse synthetic dataset using this harness. With only 8,000 tokens of context, our small model is as strong as GPT-5.4 with 1M tokens of context on the OOLONG-synth benchmark when document length exceeds 40K tokens 1^{1}.

RULER

Figure

OOLONG-synth

Document length (tokens)

Document length (tokens)

Figure 1: Results on RULER and OOLONG-synth. Our finetune runs in our harness with an 8K token per-agent context limit. GPT-5.4 (medium reasoning) and base Qwen3.6-35B-A3B (thinking disabled) receive the full document with the prompt (see Section 4 and Appendix A for more details). Base Qwen and GPT-5.4 are served with 64K and 1M token context limits, respectively. The OOLONG random baseline follows Bertsch et al. (2025, §2.3).

1 INTRODUCTION

As language models boast impressive breakthroughs (Luong & Lockhart, 2025; Wei, 2025; OpenAI, 2025b; Lin & Cheng, 2025; OpenAI, 2026h; g;f), increasing focus is placed on their limitations. The most salient resource constraint of a language model is its context length. Models can process and produce tokens within this limit, but the limit is hard. Model producers have identified this constraint and placed great emphasis on extending it as large as possible, with some model builders touting 10M (Dangel, 2026; Meta AI, 2025; Zhu et al., 2026) and even 100M (Magic, 2024) token context lengths (for reference, the length of the first Harry Potter book is about 100,000 tokens, the full U.S. tax code roughly 3M, and the Linux kernel source code about 300M).

While native context scaling is appealing as a concrete engineering problem, it is not the only approach to producing a model capable of processing long documents. In 2021, OpenAI fine-tuned GPT-3 to summarize sections of books, and then summarize those summaries, achieving competitive performance with human summaries on a model with a context length of just 2,048 tokens (Wu et al., 2021). As the field has matured, agentic harnesses have become viable. MemGPT treats context similarly to an operating system, relying on LLM-invoked function calls to push relevant

1^{1}Our code is available at: https://github.com/brycesandlund/infinite-context.

information in and out of the context window to external memory, achieving effectively expanded virtual context (Packer et al., 2023). More recently, Recursive Language Models introduced a harness that leverages LLMs' coding prior: the model is repeatedly invoked in a REPL environment over O(1)O(1)-sized result snippets, achieving stronger performance than base models on retrieval and aggregation tasks both within context limits, but also beyond them (Zhang et al., 2025).

While handcrafted prompts and programmatic environments can be effective in solving long context problems without native long context training, it begs an obvious question: if models can, for example, solve all the problems at the International Collegiate Programming Contest 2^{2} World Finals (OpenAI, 2025b), or more generally, implement requested features in codebases far larger than context limits (Marten et al., 2026; OpenAI, 2026d; Anthropic, 2026b), can they not be trained to manage context effectively, without human-authored harness crutches? Such model training internalizes decisions external harnesses hardcode, offering the potential to scale much more generally.

We answer this question in this paper, affirmatively. We consider the simplest possible agentic context harness, defined below. The purpose of the harness is to enable capability, without fixing choices or instilling a prior.

References (64)