Shop
Preferences and product evidence.
Coding Agent Memory Post-training
Language models already know how to work with files. CAMG-RL teaches them what is worth remembering—and how to use it when the context is gone.
One policy. Four kinds of long-horizon work.
See what it can do ↓
objective: fix response logging evidence: added _mqpush in scrapy/core/scheduler.py tested: no _mqpush error next: run tests, confirm logging, then submitSave the diagnosis and next steps
The work survives in a file the agent can read.
A real Scrapy training episode.
Follow the fix through to the tests ↓
01 / Start with a familiar skill
An agent can use ordinary files to keep a plan, save evidence, or leave itself a next step. CAMG-RL builds on these familiar operations to learn useful memory.
The base model is already more familiar with ordinary file operations than with dedicated memory tools.
Reinforcement learning turns that familiarity into a practical skill: deciding what to keep and how to use it later.
Preferences and product evidence.
Diagnoses, patches and test results.
Sources, findings and open questions.
Hypotheses, experiments and discoveries.
Work on the task. Write and read files.
Carry useful information into the next context.
Success trains both acting and remembering.
02 / Remember better. Finish more.
Average success across
Shop, Coding, DeepResearch
and AutoResearch.
over CompactionRL
The biggest gains are in Coding and AutoResearch, where keeping track of intermediate work is especially valuable.
All methods use Qwen3.5-4B. Evaluated on 512 held-out tasks.
Swipe or scroll horizontally to see all columns →
| Method | Shop | Coding | DeepResearch | AutoResearch | Average |
|---|---|---|---|---|---|
| Qwen3.5-4B | 11.6 | 10.9 | 36.7 | 10.2 | 17.4 |
| Mem0 | 15.6 | 14.8 | 37.5 | 10.9 | 19.7 |
| Letta Code | 12.6 | 14.8 | 32.0 | 11.7 | 17.8 |
| CompactionRL | 97.5 | 19.5 | 50.8 | 24.2 | 48.0 |
| AgeMem | 16.7 | 26.6 | 28.1 | 29.7 | 25.3 |
| CAMG-RL | 97.1 | 26.6 | 55.5 | 38.3 | 54.4 |
03 / The saved content matters
Resume the same tasks from the same state, but empty or shuffle the saved files. Success falls across all four environments.
Average success lost in this memory test
when the saved memory is emptied.
The files carry information the agent actually uses to continue its work.
← Lower success · right edge = no change
04 / A skill that travels
The learned policy improves memory through both Claude Code file tools and AgeMem’s dedicated tools—without further training.
The task-execution policy is held fixed; only the policy managing memory changes.
CAMG-RL’s learned file memory, with a 30,720-token active context, outperforms a 262K-context agent using automatic compaction.
Same base model and PPO training budget; different context-management strategies.
Both the 4B and 9B models carry their gains to software-engineering and machine-learning benchmarks.
Task success (%) · each trained model is compared with its own base
05 / Back to the task
In the Scrapy episode, the agent has already made a fix. Before starting a fresh context, it leaves itself the diagnosis and the checks still to run.
SAVE THE STATE
objective: fix response logging evidence: added _mqpush in scrapy/core/scheduler.py tested: no _mqpush error next: run tests, confirm logging, then submit
The file keeps the diagnosis, the code change, and the next step together.
PICK UP THE THREAD
cat .agent_memory/CONTINUATION.md python test_spider.py python -m pytest tests/test_crawl.py -v
In the fresh context, the agent reads its note and resumes testing.
FINISH THE WORK
The saved state has become useful action, carrying the task through to completion.
From a real training episode; excerpts shortened for readability.
Paper & resources
Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via Reinforcement Learning
JD.com
@article{luo2026coding,
title={Coding Agent Memory Post-training: Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via Reinforcement Learning},
author={Luo, Lirui and Mao, Kelong and Xia, Heming and Li, Rongqing and Yang, Xinwei and Chen, Luyu and Wong, Kieran and Guo, Yudong and Wang, Xinrui and Zhu, Jiayin and Gu, Simiu and Xu, Sulong and Fang, Cong},
journal={arXiv preprint arXiv:2609.34422},
year={2026}
}