[KongchangAI]
· 2 min read· 1,152 words

CAMP-II: Unlocking Long-Horizon Memory Potential in Coding Agents via File Operations

CAMP-II: Unlocking Long-Horizon Memory Potential in Coding Agents via File Operations

CAMP-II carries agent memory via file-operation priors, trained with asynchronous OPD, achieving 2.97× the baseline gain with transferability.

CAMP-II anchors the agent memory interface in Bash and file operations already familiar from pretraining, avoiding the cold-start dilemma faced by novel memory tools. It builds CAMG-II across five long-horizon environments and jointly trains a single policy with fully asynchronous OPD against a frozen file-prior teacher. Gains reach 2.97× the strongest OPD baseline and transfer to Terminal-Bench 2.1 and SWE-Bench Pro V2.

Long-horizon tasks are becoming the main battleground for language model agents, but a fundamental tension persists: interaction history quickly exceeds the model's active context window. Agents must learn to decide for themselves what to write, what to read, and when to perform these operations. A recent study proposes Coding Agent Memory Post-Training II (CAMP-II), which attempts to carry memory through file operations—a capability already present from pretraining—and trains the agent to master this behavior via On-Policy Distillation (OPD).

CAMP-II research overview

The bottleneck of existing memory approaches: tools and protocols lie outside the pretraining distribution

Recent work has begun using OPD to incorporate memory control into the policy itself, so that the model learns during training to invoke memory tools and execute compression protocols. The problem is that these tools and protocols are not within any model's pretraining distribution—the teacher model has never used such interfaces and naturally cannot provide effective guidance; meanwhile, the student model samples too few meaningful memory actions during training for that guidance to take real effect. Both sides are weakened simultaneously, and distillation effectiveness suffers greatly.

This constitutes a classic cold-start dilemma: memory behavior needs to be taught, but the interface on which teaching depends is itself unfamiliar.

On-Policy Distillation (OPD) is a variant of knowledge distillation whose key feature is that the student model samples trajectories with its own policy during training, and the teacher model then provides supervision signals on the states the student actually visits. Unlike offline distillation, which uses a fixed dataset, OPD's supervision distribution evolves dynamically with the student policy, making it highly sensitive to whether the teacher can provide effective guidance on the states sampled by the student. If the student, due to the unfamiliar interface, almost never samples meaningful memory actions, the teacher lacks states to annotate; conversely, if the teacher itself is unfamiliar with the interface, it will struggle to provide correct targets even when such states arise. This mechanism explains the root of the cold-start dilemma described in the paper: distillation effectiveness depends simultaneously on the student's sampling coverage and on the teacher's competence over that coverage.

CAMG-II: Five long-horizon environments and a pure-Bash memory interface

To study this problem systematically, the research team built Coding Agent Memory Gym II (CAMG-II), covering five categories of long-horizon agent reinforcement learning environments: Shop, Coding, AutoResearch, General, and Visual.

In addition to the native task interface, each environment provides ordinary Bash access and a persistent workspace that lasts throughout the entire episode. Agents can create, modify, search, and reuse files, treating the file system as a memory carrier that substitutes for the context window. The key to this design is that Bash and file operations are heavily encountered during model pretraining, so a natural prior exists and there is no need to learn unfamiliar tools from scratch.

CAMP-II: Freezing the teacher on the file prior, training the student with asynchronous OPD

The core idea of CAMP-II is to turn the pretrained file-operation prior into a teaching resource. It uses a frozen teacher model with a file-operation prior to jointly train a single policy across all five environments with fully asynchronous OPD, learning file-based memory behavior directly from the teacher.

Because the interface falls within the teacher's comfort zone, guidance signals are more effective; asynchronous training ensures sampling efficiency across environments and trajectories, allowing the student to accumulate enough meaningful memory actions.

Asynchronous OPD means that student sampling and teacher scoring/distillation updates do not run on the same synchronous pipeline, but are advanced in parallel by different processes or environment instances, exchanging data through buffers or parameter servers. When jointly training a single policy across five heterogeneous environments, episode lengths and task rhythms differ greatly across environments, and synchronous training would be dragged down by the slowest environment. Asynchrony lets each environment sample independently and continuously produce trajectories, decoupling student parameter updates from teacher forward passes, thereby improving sample throughput across environments and trajectories. The cost is a certain degree of stale-policy lag, which needs to be mitigated through buffer management and update-frequency control.

Experimental results: significant gains, transferable to external benchmarks

On CAMG-II, the gain achieved by CAMP-II is 2.97× that of the strongest OPD baseline. More noteworthy is transferability: the learned memory behavior generalizes to two external benchmarks, Terminal-Bench 2.1 and SWE-Bench Pro V2, with success rates improving on both.

This result shows that file-based memory is not a trick that merely overfits to a specific environment, but a general capability that can transfer across different task forms.

Terminal-Bench 2.1 and SWE-Bench Pro V2 are two external benchmarks for evaluating long-horizon agent capabilities. Terminal-Bench focuses on completing multi-step system operation tasks in real terminal environments, emphasizing command-line interaction and state management; SWE-Bench Pro V2 targets software engineering issue fixing in real code repositories, requiring agents to locate, modify, and verify within large codebases. Neither is a training environment for CAMG-II, and both differ in task interfaces and task forms, so success-rate improvements on them serve as a test of whether the memory behavior overfits the training environment. This is precisely why the paper emphasizes transferability: if the gains came only from adapting to CAMG-II's specific interfaces, stable improvements should not appear on external benchmarks.

Implications: anchoring memory capability in skills already present from pretraining

The value of CAMP-II is not just a set of numbers. It points to a more pragmatic path for long-horizon agent training: rather than designing entirely new memory tools and compression protocols, anchor the memory interface in capabilities the model has already mastered, so that the teacher and student in distillation stand on the same familiar ground. The file system happens to be exactly such an interface—general, persistent, and long since repeatedly present in pretraining corpora.

For teams building long-horizon agents, this means that when evaluating memory approaches, one should not only look at whether the interface design is elegant, but also at whether it falls within the model's capability distribution.

One-line Summary

CAMP-II carries agent memory via file-operation priors, trained with asynchronous OPD, achieving 2.97× the baseline gain with transferability.

Paragraph Summary

A long-horizon agent's interaction history exceeds the context window, so the agent must autonomously decide when to write and read memory. Existing methods that train memory behavior with OPD face a cold-start dilemma: memory tools and compression protocols lie outside the pretraining distribution, so the teacher cannot provide effective guidance and the student cannot sample enough meaningful memory actions. CAMP-II instead anchors the memory interface in Bash and file operations heavily encountered during pretraining, builds CAMG-II covering five long-horizon environments, and uses a frozen file-prior teacher to jointly train a single policy with fully asynchronous OPD. Results show a 2.97× gain over the strongest OPD baseline on CAMG-II, transferring to Terminal-Bench 2.1 and SWE-Bench Pro V2. The core insight: the memory interface should fall within the model's capability distribution rather than pursuing novel, elaborate tool designs.

#CAMP-II#long-horizon agents#agent memory#on-policy distillation#file operations#CAMG-II
Share:

Related articles