CoReMem: Cost-Internalizing Memory for Successive Coding Tasks with Prospective Valuation: what it means for business leaders

CoReMem gives coding agents a short note of file locations and test commands to carry between tasks on one repository, then trains the model to use it, raising fix rates while cutting steps and tokens.

1. What the method is

CoReMem is a memory framework for coding agents that work through a sequence of tasks on the same repository, where each task inherits the code left by the one before. It has two parts. The first is a memory format: a short note written at the end of each task and built around what the authors call anchors, meaning specific file locations and runnable checks such as test commands. The second is a fine-tuning procedure that teaches the agent's model to act on that note only where doing so saves work. Both parts are driven by one measurement: how much effort, in steps and tokens, the next task saves when it runs with the memory compared with running without it, with the cost of writing and reading the memory counted against it.

2. Why the method was developed

Agent memory is usually sold as a way to stop agents rediscovering what they already learned. The authors tested that claim on successive coding tasks with four existing forms: the full history of earlier tasks, Mem0, MemOp and ReasoningBank. None lowered both steps and total tokens once the memory module's own token use was counted. On the 27B model, Mem0 and ReasoningBank more than doubled total tokens per session, at plus 113 and plus 110 percent. The paper gives two reasons. These systems are tuned on the task that produced the memory, or carry general lessons across unrelated repositories, so they are not tuned for an unknown next task on changed code. They also leave the reading model untouched, so it may ignore a useful note or follow one that does not apply.

3. Who should care

Engineering leaders who run coding agents against our own repositories should care most, because the result bears on how much each agent-resolved ticket costs. Whoever owns the inference budget should note the accounting method: memory is charged for the tokens it consumes, which most vendor comparisons leave out. Platform and ML teams matter because the larger gains require fine-tuning the model, which is only possible where we host open-weight models; with API-served models we can adopt the memory format but not the training. Security and compliance have a stake too. The memory stores file paths, commands and test output from private code, so it needs the repository's access controls, a retention policy and secret redaction before storage. Procurement can use the paper's total-token test when evaluating memory vendors.

4. How the method works

The memory design comes from an ablation. A finished task's record is split into seven segments by role, including reasoning text, commands, repository content read, test output and the diff. Each is removed in turn and the next task is re-run to see how steps and tokens change. Commands and repository content read save steps. Reasoning text and the diff body only add tokens, so they are dropped. Test output and the diff are kept in reduced form, as test commands with exit codes and a file list. Training then runs groups of sessions with the right memory, with no memory, and with a memory from another repository. The reward ranks any solved task above any unsolved one and charges steps only among solved ones. The measured gap between memory and no-memory sessions is credited only to steps that use an anchor traceable to the memory.

5. How it was evaluated

The evaluation uses ChainSWE, a benchmark of task chains on evolving repositories, run in the mini-swe-agent harness, with training and test chains drawn from disjoint repositories. Baselines are no memory, full history, Mem0, MemOp and ReasoningBank. Metrics are resolve rate, steps per task, cache-aware tokens per session including the memory module, and resolves per thousand tokens. Six models were tested with the memory format alone: three open-weight models (Qwen3.5-9B, Qwen3.8-27B and Gemma-4-31B) and three API-served ones. Only the open-weight three were fine-tuned. Ablations separate the memory format, the step-charging reward and the anchor-level credit. The text available to us was cut off before the appendices, so we have not reviewed the replay counts, the statistical tests, or the reported checks on SWE-bench Verified, external task chains and OpenHands.

6. How it performed

On the 27B model the full method raised the resolve rate from 21.0 to 25.7 percent, with 17 percent fewer steps and 11 percent fewer total tokens than no memory. Across the three trained models, resolves per total token rose 38 to 46 percent. Without training, the memory cut steps on all six models, but on the 9B model it raised total tokens 14 percent and lowered resolves per token 16 percent. Training also made a wrong-repository memory less costly. The limits are real: Python repositories only, one main harness, no training on larger models, no wall-clock or energy figures, and no answer on managing memory over long histories. Absolute resolve rates remain low, at 14 to 26 percent. Our call is to pilot the anchor-based memory format on our own agent workflows now and watch the fine-tuning step until it is shown on larger models. (Source: arXiv 2611.17316, 2026)

← Back to dossier index