Coding Agent Memory Post-Training II

Teach agents
to remember
through files.

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?
A task can outlive its context.
Current context

The page has styles,
but no HTML body.

$ write a diagnosis + next steps
Context replaced

The conversation is gone.
The workspace remains.

Fresh context

Read the saved plan.
Continue the rewrite.

$ cat CONTR.txt
CONTR.txtEpisode-persistent file

DiagnosisCSS only. No HTML body.

NextRewrite dist/index.html.
Add products, collections,
editor picks and comparisons.

The agent writes what the next context needs.

Illustration based on the paper’s Visual case. See the actual trace ↗

64.6CAMG-II average score

+12.8 ptsover the strongest memory OPD baseline

Compare the methods

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

Lirui Luo · Kelong Mao · Xinwei Yang · Rongqing Li · Luyu Chen · Kieran Wong · Yudong Guo · Xinrui Wang · Jiayin Zhu · Pu Yao · Gu Simiu · Sulong Xu · Cong Fang

Peking University · JD.com · Sichuan University · Beijing Institute of Technology · Renmin University of China · The Hong Kong University of Science and Technology

A strong teacher is only
half the story.

Adding a memory system does not ensure that it can be taught. On-policy distillation needs both sides to meet at the same interface.

Student side

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→continue
Teacher side

Can it judge
what was written?

A 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 write

Start with a language they share: files.

Ordinary 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.

The student acts.
The teacher scores.

One task-acting policy learns both task actions and memory operations. The frozen teacher supplies token-level feedback on the student’s own response.

01

Sample

The student acts in the environment—including writing its own files.

cat > notes.md << 'EOF'
Diagnosis: …
Next step: …
EOF
Illustrative Bash action
02

Score

The frozen teacher scores those same tokens under the same visible context.

Diagnosis:…Next
↑↑↑↑
Teacher scores, not teacher actions
03

Update

On-policy distillation updates the policy on sampled task and memory tokens.

log pteacher − log pstudent
Detached per-token signal · clipped update

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.

Open the full training framework ↗
The paper’s CAMP-II framework: five task environments, student rollout workers, frozen-teacher scoring and the asynchronous learner.
Original paper Figure 2. Click to inspect at full resolution.

A familiar interface.
A larger learning gain.

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.

CAMG-II average score Higher is better · 0–100
CAMP-II64.6
CAMP-I54.2
MemOPD (w/ SFT)51.8
HELM (single-model)49.8
Hy-Memory48.9
CompactOPD48.2
Frozen 4B45.3
ACM39.2
HELM36.6
MemOPD0.0
020406080
All methods, all five domains +
Paper Table 1 · CAMG-II scores (0–100). Frozen 4B/9B are Qwen3.5; frozen teacher is Qwen3.8-27B.
PolicyShopCodingAutoResearchGeneralVisualAverage
Frozen 4B77.327.346.139.836.045.3
Frozen 9B90.626.656.260.936.554.2
Frozen teacher100.063.383.693.040.376.0
MemOPD0.00.00.00.00.00.0
MemOPD (w/ SFT)93.027.339.162.537.351.8
CompactOPD93.824.237.561.723.648.2
ACM94.521.911.759.48.539.2
HELM87.50.09.453.133.136.6
HELM (single-model)87.529.746.946.938.049.8
Hy-Memory92.227.335.963.325.848.9
CAMP-I85.232.038.368.846.554.2
CAMP-II100.037.564.181.240.264.6
CAMP-II-9B100.036.773.482.040.266.5

Where does the gain land?

The largest gain over CAMP-I is in AutoResearch. Visual remains a trade-off.

Shop

85.2
100.0

+14.8 pts

Coding

32.0
37.5

+5.5 pts

AutoResearch

38.3
64.1

+25.8 pts

General

68.8
81.2

+12.4 pts

Visual

46.5
40.2

-6.3 pts

CAMP-I CAMP-II Visual is a judge score, not a binary success rate.

More actions to teach.
A clearer teaching signal.

The paper checks both sides of the interface, then tests whether the improvement depends on supervising memory content.

The student uses memory more often.Memory actions / all actions · %
Files / Bash21.6
Memory tools7.8
Compaction5.9

Before training, both models also assign lower surprisal to file actions than to the two other interfaces.

The teacher recognizes task-matched notes.Prefers same-task over foreign-task note · %
Files / Bash76.5
Memory tools63.8
Compaction70.0

This is a note-discrimination diagnostic—not a direct measurement of downstream success.

Mask the memory-content loss.
Most of the gain disappears.

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.

Controlled ablations CAMG-II average score
CAMP-II64.6
Compaction interface48.2
Dedicated memory tools48.2
Memory-content loss masked47.3
Same budget masked at random63.3

64.9 ± 0.5Mean ± sample standard deviation
over five training seeds

66.5Average with the same recipe
and a 9B student

Write the diagnosis.
Read it back.
Finish the page.

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.

Actual Visual trajectory: turn 32 writes CONTR.txt with a missing-HTML diagnosis and rewrite plan; context replacement at turn 33; turns 35–36 list and read the file; turns 37–54 develop the fitness-product showcase.
Original trace and final page. Open the figure for the full-resolution view.

Five task worlds.
One file-memory interface.

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.

Shop

WebShop

Complete a chain of six purchases.

Carry product evidence and earlier constraints into later sessions.

Coding

SWE-smith

Repair a real repository.

Retain the diagnosis, code locations and test outcomes across contexts.

AutoResearch

OpenMLE

Run and improve an ML experiment.

Keep experiment choices, measurements and the next hypothesis.

General

MiMo

Finish a multi-tool knowledge-work task.

Preserve requirements, intermediate outputs and unfinished steps.

Visual

MiMo / Web development

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.

The learned policy
transfers to new benchmarks.

Both the 4B and 9B students improve over their starting checkpoints on Terminal-Bench 2.1 and SWE-Bench Pro V2.

Terminal-Bench 2.1Success rate (%) · axis 0–50
4B
Initial model23.1
CAMP-II30.0
9B
Initial model23.1
CAMP-II38.0
SWE-Bench Pro V2Success rate (%) · axis 0–50
4B
Initial model11.2
CAMP-II18.1
9B
Initial model23.1
CAMP-II30.1
External results, including the larger-model reference +
Paper Table 2 · external transfer success rates (%)
PolicyTerminal-Bench 2.1SWE-Bench Pro V2Average
Qwen3.5-4B23.111.217.1
Qwen3.5-9B23.123.123.1
Qwen3.5-35B-A3B33.827.430.6
CAMP-II-4B30.018.124.1
CAMP-II-9B38.030.134.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.

Teach memory through
operations models know.

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

Cite this work
@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}
}