← All papers  /  Nov 10, 2026
Training · Memory · Agents

Coding Agent Memory Post-Training II: Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via On-Policy Distillation

First page
Coding Agent Memory Post-Training II: Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via On-Policy Distillation
The curator’s take

Lirui Luo and Cong Fang (Peking University) with Kelong Mao, Sulong Xu and colleagues at JD.com train agents to use ordinary files in a persistent workspace as memory, arguing that bespoke memory tools are outside both teacher and student pre-training and weaken on-policy distillation.

Ask this paper

Key points
01

Diagnosis. With custom memory tools, the teacher cannot guide an interface it never saw, and the student samples too few meaningful memory actions for guidance to take effect.

02

CAMG-II. Long-horizon agentic-RL environments across Shop, Coding, AutoResearch, General and Visual, each adding Bash access and an episode-persistent workspace that survives context replacement.

03

CAMP-II. One policy trained jointly on all five environments with fully asynchronous on-policy distillation from a frozen teacher that already knows file operations.

04

Result. CAMP-II obtains 2.97x the gain of the strongest on-policy distillation baseline on CAMG-II (640 test tasks).

05

Transfer. The trained 4B and 9B policies improve on Terminal-Bench 2.1 and SWE-Bench Pro V2; the 4B policy gains 6.9 points on each.

Abstract

Language-model agents increasingly tackle long-horizon tasks whose interaction histories exceed the model's active context. They must therefore decide what to write down and what to read back, and when to do either. Recent work has begun to use on-policy distillation (OPD) to make memory control part of the policy, relying on memory tools and compaction protocols that lie outside either model's pre-training. However, this weakens the distillation on both sides: the teacher cannot give useful guidance on an interface it has never used, and the student samples too few meaningful memory actions for that guidance to take effect. To study this problem, we introduce Coding Agent Memory Gym II (CAMG-II), a suite of long-horizon agentic-RL environments spanning Shop, Coding, AutoResearch, General, and Visual. Alongside each environment's native task interface, CAMG-II provides ordinary Bash access and an episode-persistent workspace, enabling the policy to create, revise, search, and reuse files as memory across context replacements. We also introduce Coding Agent Memory Post-Training II (CAMP-II), which trains a single policy jointly across all five environments with fully asynchronous OPD to learn this file-based memory behavior directly from a frozen teacher with a prior for file operations. On CAMG-II, CAMP-II obtains 2.97 times the gain of the strongest OPD baseline. The memory behavior CAMP-II learns generalizes to two external benchmarks, Terminal-Bench 2.1 and SWE-Bench Pro V2, with improved success rates.

Every Monday
Get next week’s papers.
Subscribe on Substack