Will it use memory
in the first place?
The student has to sample meaningful writes and reads. An action that never appears gets no on-policy supervision.
write→read→continueCoding Agent Memory Post-Training II
Long tasks outlive a single context. CAMP-II distills memory through ordinary Bash and files—operations the student and a frozen teacher already know.
Why does the interface matter?The page has styles,
but no HTML body.
The conversation is gone.
The workspace remains.
Read the saved plan.
Continue the rewrite.
DiagnosisCSS only. No HTML body.
NextRewrite dist/index.html.
Add products, collections,
editor picks and comparisons.
Illustration based on the paper’s Visual case. See the actual trace ↗
Coding Agent Memory Post-Training II: Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via On-Policy Distillation
Peking University · JD.com · Sichuan University · Beijing Institute of Technology · Renmin University of China · The Hong Kong University of Science and Technology
The research question
Adding a memory system does not ensure that it can be taught. On-policy distillation needs both sides to meet at the same interface.
The student has to sample meaningful writes and reads. An action that never appears gets no on-policy supervision.
write→read→continueA strong task model can still be unfamiliar with a memory protocol. Its targets need to guide the content the student actually produces.
same context+student’s writeOrdinary Bash lets the agent create, revise, search and read its own memory. The familiar operations make the channel usable; training teaches what to keep and when to use it.
CAMP-II · the method
One task-acting policy learns both task actions and memory operations. The frozen teacher supplies token-level feedback on the student’s own response.
The student acts in the environment—including writing its own files.
cat > notes.md << 'EOF'
Diagnosis: …
Next step: …
EOFIllustrative Bash actionThe frozen teacher scores those same tokens under the same visible context.
On-policy distillation updates the policy on sampled task and memory tokens.
At a context boundary the files remain. The agent receives a path and reads what it needs; file contents are not automatically injected.
At inference time the trained student acts without the distillation teacher.

The result
CAMP-II reaches the highest average among the 4B systems in the paper. The strongest memory OPD baseline is MemOPD with its SFT cold start.
| Policy | Shop | Coding | AutoResearch | General | Visual | Average |
|---|---|---|---|---|---|---|
| Frozen 4B | 77.3 | 27.3 | 46.1 | 39.8 | 36.0 | 45.3 |
| Frozen 9B | 90.6 | 26.6 | 56.2 | 60.9 | 36.5 | 54.2 |
| Frozen teacher | 100.0 | 63.3 | 83.6 | 93.0 | 40.3 | 76.0 |
| MemOPD | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| MemOPD (w/ SFT) | 93.0 | 27.3 | 39.1 | 62.5 | 37.3 | 51.8 |
| CompactOPD | 93.8 | 24.2 | 37.5 | 61.7 | 23.6 | 48.2 |
| ACM | 94.5 | 21.9 | 11.7 | 59.4 | 8.5 | 39.2 |
| HELM | 87.5 | 0.0 | 9.4 | 53.1 | 33.1 | 36.6 |
| HELM (single-model) | 87.5 | 29.7 | 46.9 | 46.9 | 38.0 | 49.8 |
| Hy-Memory | 92.2 | 27.3 | 35.9 | 63.3 | 25.8 | 48.9 |
| CAMP-I | 85.2 | 32.0 | 38.3 | 68.8 | 46.5 | 54.2 |
| CAMP-II | 100.0 | 37.5 | 64.1 | 81.2 | 40.2 | 64.6 |
| CAMP-II-9B | 100.0 | 36.7 | 73.4 | 82.0 | 40.2 | 66.5 |
The largest gain over CAMP-I is in AutoResearch. Visual remains a trade-off.
CAMP-I CAMP-II Visual is a judge score, not a binary success rate.
Understanding the result
The paper checks both sides of the interface, then tests whether the improvement depends on supervising memory content.
Before training, both models also assign lower surprisal to file actions than to the two other interfaces.
This is a note-discrimination diagnostic—not a direct measurement of downstream success.
Mask the same number of tokens at random and the score stays near CAMP-II. The result depends on which tokens receive supervision, not just how many.
64.9 ± 0.5Mean ± sample standard deviation
over five training seeds
66.5Average with the same recipe
and a 9B student
A real memory trace
A Visual-task agent finds that its page has CSS but no HTML body. Before context replacement, it saves the diagnosis and a four-part rewrite plan.
In the next context it lists the workspace, reads CONTR.txt, and continues building the page.
One training episode from paper Figure 5. This is a behavior example, not the controlled ablation above.

CAMG-II · the environment suite
Each environment keeps its native task. All give the policy ordinary Bash access and an episode-persistent workspace. One policy is trained jointly across the five.
Complete a chain of six purchases.
Carry product evidence and earlier constraints into later sessions.
Repair a real repository.
Retain the diagnosis, code locations and test outcomes across contexts.
Run and improve an ML experiment.
Keep experiment choices, measurements and the next hypothesis.
Finish a multi-tool knowledge-work task.
Preserve requirements, intermediate outputs and unfinished steps.
Build and refine a website.
Save visual findings and an implementation plan, then resume.
“Coding agent” describes how memory is operated. The tasks themselves extend beyond coding.
Beyond the training suite
Both the 4B and 9B students improve over their starting checkpoints on Terminal-Bench 2.1 and SWE-Bench Pro V2.
| Policy | Terminal-Bench 2.1 | SWE-Bench Pro V2 | Average |
|---|---|---|---|
| Qwen3.5-4B | 23.1 | 11.2 | 17.1 |
| Qwen3.5-9B | 23.1 | 23.1 | 23.1 |
| Qwen3.5-35B-A3B | 33.8 | 27.4 | 30.6 |
| CAMP-II-4B | 30.0 | 18.1 | 24.1 |
| CAMP-II-9B | 38.0 | 30.1 | 34.1 |
Table 2 values are reproduced as reported. Qwen3.5-35B-A3B is a mixture-of-experts reference; parameter counts do not imply matched inference cost.
Paper & presentation
CAMP-II connects a familiar file interface with on-policy teacher feedback. CAMG-II provides five long-horizon environments to study that learning.
arXiv:2611.14009
@article{luo2026campii,
title = {Coding Agent Memory Post-Training II: Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via On-Policy Distillation},
author = {Lirui Luo and Kelong Mao and Xinwei Yang and Rongqing Li and Luyu Chen and Kieran Wong and Yudong Guo and Xinrui Wang and Jiayin Zhu and Pu Yao and Gu Simiu and Sulong Xu and Cong Fang},
year = {2026},
eprint = {2611.14009},
archivePrefix = {arXiv}
}