Skip to main content
v2026.11,986 entries · CC-BY 4.0

Editorial · CASRAI · AI and ML research outputs

CoReMem Preprint Introduces Cost-Internalizing Memory for Coding Agents

Yale researchers introduced CoReMem, an architecture that cuts coding agent steps and token costs by prospectively valuing repository memory.

Published 15 Nov 2026· 5 minute read

Ask CASRAI · free to try

Ask about this story

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

CASRAI is the reference for research administration — bookmark it for the next question.

On November 12, 2026, researchers from Yale University, Tsinghua University, and Goodvision AI published a preprint introducing CoReMem (Coding-Repository Memory), a cost-internalizing framework that prospectively values and compacts repository memory across sequential software engineering tasks. Submitted to arXiv under identifier 2611.17316, the study addresses a critical operational friction in autonomous software development: balancing the future utility of accumulated codebase context against the latency and inference token costs of writing and reading persistent memory.

The Challenge of Sequential Memory in Evolving Codebases

Most autonomous coding agent benchmarks evaluate models on isolated, single-turn tasks where the underlying repository state resets after each bug fix or feature implementation. In professional development environments and computational research laboratories, software engineering tasks occur sequentially on evolving codebases. An agent might implement an algorithmic feature, refactor dependent modules, resolve integration regressions, and update test suites across consecutive sessions.

Carrying forward context across successive tasks poses significant trade-offs. Earlier approaches, including full interaction history concatenation or memory frameworks such as Mem0, MemOp, and ReasoningBank, often accumulate extensive trajectory logs. While rich history can provide contextual clues, unmanaged context quickly inflates prompt lengths, increases per-step inference latency, and exhausts token budgets. Furthermore, carrying natural language reasoning traces and raw diff histories risks injecting obsolete architectural assumptions or hallucinations when files have been modified in intermediate steps. The CoReMem authors argue that an agent memory system must internalize its costs, retaining only memory structures whose prospective utility on unknown subsequent tasks exceeds the compute expense of generating and processing them.

Prospective Valuation and Anchor-Based Memory Design

To establish which components of task history actually benefit future tasks, the authors designed a three-part framework consisting of prospective segment valuation (M1), cost-internalizing on-policy valuation (M2), and step-level provenance-gated value credit (M3).

In the prospective segment valuation phase, the research team dissected agent execution trajectories into seven functional segments: natural language reasoning text, executed shell commands, repository file content read, raw diff bodies, diff file lists, test commands, and command exit codes. By systematically removing individual segments and evaluating agent performance on subsequent tasks from the inherited repository state, the authors measured the marginal value of each component. The analysis revealed a clear operational pattern: unstructured reasoning narratives and detailed diff bodies added token overhead without reducing downstream task steps. Instead, transferable utility concentrated in two concise classes of anchors:

  • Repository locations (WHERE): Explicit file paths, line ranges, and structural code symbols relevant to the target component.
  • Executable checks (VERIFY): Concrete reproduction scripts, unit test commands, and expected exit codes that validate implementation correctness.

Building on these anchors, the authors trained coding agents using paired rollout groups. Each training group combined sessions operating with their own repository memory, memory-free baseline sessions, and sessions deliberately initialized with misplaced memory originating from an unrelated repository. The training reward function heavily prioritized task resolution while explicitly penalizing step count on successful rollouts, forcing the model to minimize exploratory steps.

To teach the actor model when to rely on memory and when to verify independently, CoReMem incorporates a provenance gate. When an agent executes an action that directly utilizes a memory-supplied anchor, that specific step receives an additional prospective value credit, while all steps retain overall trajectory outcome credit. This targeted attribution prevents the agent from blindly trusting erroneous context, reducing the step penalty of misplaced memory from +2.1 steps to +0.3 steps on a 27-billion parameter actor model.

Empirical Benchmark Results Across Actor Architectures

The research team evaluated CoReMem on the ChainSWE benchmark using the mini-swe-agent execution harness. ChainSWE organizes 100 multi-task chains across disparate repositories, split evenly into training and evaluation sets. The benchmark evaluated six distinct language models: three open-weight architectures (Qwen3.5-9B, Qwen3.8-27B-FP8, and Gemma-4-31B) and three commercial API-served models (Claude Opus 5.5, GPT-5.6 Luna, and DeepSeek-V4-Flash).

Across the evaluated models, the empirical metrics reported by the authors demonstrated substantial efficiency gains:

  • Resolution and step efficiency: On the Qwen3.8-27B actor model, CoReMem increased the task resolve rate from 21.0% to 25.7%, while decreasing average execution steps by 17% and reducing total cache-aware token consumption by 11% relative to the untrained baseline without memory.
  • Token productivity: Across all three open-weight models, post-training raised resolve rate per total token by 38% to 46% (averaging a 41% gain).
  • Zero-training inference benefits: When deployed with frozen weights on API-served models, CoReMem lowered execution steps across all six architectures, including statistically significant reductions between 9% and 13% on three models, without lowering resolution rates.
  • Comparison with existing memory layers: In side-by-side evaluations, alternative memory layers (Mem0, MemOp, and ReasoningBank) incurred higher total token usage than CoReMem on five of the six actor models.

Implications for Research Software Engineering and Computing Infrastructure

The findings presented in the CoReMem preprint carry immediate implications for academic research computing, institutional research software engineering (RSE) teams, and university laboratory workflows. Computational researchers increasingly rely on automated agents to assist in codebase maintenance, pipeline refactoring, and reproducibility verification.

Within research computing environments, deterministic execution and auditability are foundational. Integrating coding agents with reproducible software stacks—such as containerized environments examined in Docker vs virtual machine architectures and structured version control workflows highlighted in Git vs GitHub vs GitLab—ensures that automated repository edits remain strictly traceable across collaborative projects.

Furthermore, academic software stewardship requires rigorous packaging and citation standards. As research software engineers prepare scientific software for formal archiving using metadata vocabularies like CodeMeta and publication in venues like the Journal of Open Source Software (JOSS), agents must interact with codebases without generating uncurated discursive debris. CoReMem indicates that compacting repository memory into structured file anchors and verifiable test routines aligns agent behavior with formal software testing principles.

Finally, for university departments and sponsored project administrators managing cloud computing budgets, cost-internalizing architectures provide a path toward sustainable automation. As explored across the broader research tools ecosystem, incorporating step penalties and prospective valuation into agent workflows prevents runaway inference costs, allowing research institutions to scale agentic software maintenance within predictable grant expenditure limits.

Sources

  • Li, P., Verma, H., Zhou, S., Wang, H., Bui, N., Chang, H., Fei, F., van Dijk, D., and Ying, R. (2026). ‘CoReMem: Cost-Internalizing Memory for Successive Coding Tasks with Prospective Valuation.’ arXiv:2611.17316v1 [cs.SE]. https://arxiv.org/abs/2611.17316 (accessed 2026-11-14).
  • Jin, Y., et al. (2026). ‘ChainSWE: Evaluating Coding Agents on Sequential Repository Tasks.’ arXiv preprint. https://arxiv.org (accessed 2026-11-14).
  • Jimenez, C. E., et al. (2024). ‘SWE-bench: Can Language Models Resolve Real-World GitHub Issues?’ International Conference on Learning Representations (ICLR 2024). https://arxiv.org/abs/2310.06770 (accessed 2026-11-14).

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →