Source-linked AI summary
Your Code Agent Can Grow Alongside You with Structured Memory
Yi-Xuan Deng, Xiaoqin Liu, Yi Zhang, Guo-Wei Yang, Shuojin Yang
TL;DR
Static code agents miss reasoning trajectories and tacit project knowledge embedded in development history, limiting their adaptability on repository-level tasks. MemCoder structures historical experience, refines execution using verification feedback, and internalizes validated solutions; it achieves SOTA performance and raises DeepSeek-V3.2's resolved rate from 68.4% to 77.8% on SWE-bench Verified.
Problem
Existing repository-level code agents remain tied to static code snapshots and fail to capture project evolution and reasoning trajectories from past successful practices.
Source: §1 · p. 1Method
MemCoder structures historical commits into memory, retrieves experience to concretize intent, refines execution with verification feedback, and internalizes human-validated solutions.
Source: §1 · p. 2, §3 · p. 3, §3.1 · p. 4Results
77.8% resolved rate, up from 68.4%, is reported for DeepSeek-V3.2 with MemCoder on SWE-bench Verified, alongside SOTA performance.
Source: §1 · p. 2Takeaways & Limitations
MemCoder supports continuous human-AI co-evolution by enabling agents to internalize human-derived evolutionary context and grow alongside developers.
Source: §5 · p. 8
Abstract
from arXiv · showhide
While "Intent-oriented programming" (or "Vibe Coding") redefines software engineering, existing code agents remain tethered to static code snapshots. Consequently, they struggle to model the critical information embedded in the temporal evolution of projects, failing to leverage the "reasoning trajectories" implicit in past successful practices. This limitation results in rigid behavioral logic and a lack of autonomous adaptability, ultimately hindering their ability to tackle complex, repository-level problems. To bridge this static-dynamic mismatch, we propose MemCoder, a framework designed to enable continual human-AI co-evolution. MemCoder first structures historical human experience to distill latent intent-to-code mappings from past commits. It then employs a self-refinement mechanism driven by verification feedback to correct agent behavior in real-time. Crucially, an experience self-internalization mechanism is introduced to crystallize human-validated solutions into long-term knowledge, thereby supporting sustained evolution. Experimental results on SWE-bench Verified demonstrate that MemCoder not only achieves State-of-the-Art (SOTA) performance but also delivers a 9.4% improvement in resolved rate over the general foundation model DeepSeek-V3.2. These findings indicate that equipping agents with the capability to co-evolve with humans via project history and real-time feedback effectively unlocks the potential of general models in complex software engineering tasks.
1. Introduction
MemCoder addresses the mismatch between evolving human project knowledge and static repository-level agents by structuring historical experience, refining execution with feedback, and internalizing validated solutions. It achieves SOTA performance on SWE-bench Verified while improving DeepSeek-V3.2's resolved rate from 68.4% to 77.8%.
Problem
- Existing repository-level agents operate statically, overlooking historical defect-repair patterns, implicit project conventions, and human-verified solutions.This leaves agents unable to retrieve precedents, align abstract instructions with concrete execution, or retain corrections across tasks.Source: §1 · pp. 1–2
Motivation
- Repository-level collaboration requires reconstructing developer cognition from historical trajectories and crystallizing interactions into enduring capabilities.The proposed cycle progressively attunes agents to a developer's coding philosophy and constraints.Source: §1 · p. 2
Method
- MemCoder structures historical commits into memory so agents can recall how humans previously resolved similar repository complexities.This Knowledge Dimension captures both explicit solutions and implicit intent from historical contributions.Source: §1 · p. 2
- MemCoder retrieves historical context to concretize sparse instructions, then stores human-verified solutions as persistent intent-to-code mappings.Its Execution Dimension combines intent concretization, dynamic self-refinement, and experience internalization.Source: §1 · p. 2
Evaluation
- 77.8% resolved rate, up from 68.4%, is reported for DeepSeek-V3.2 with MemCoder on SWE-bench Verified.The framework also achieves SOTA performance, with GPT-5.2 used as the backbone in the evaluation.Source: §1 · p. 2
Contribution
- MemCoder couples general models with human-derived evolutionary context to support continuous human-AI co-evolution on complex software engineering tasks.The framework is designed to let agents grow alongside projects rather than remain static executors.Source: §1 · p. 2
2. Related Work
Related work spans code-generation workflows, long-term memory organization, and dynamic evolution through feedback. MemCoder combines these strands by incorporating historical development wisdom into decision-making and continuous human-AI co-evolution.
2.1. LLM-Based Code Generation Agents
- LLM-based code agents use iterative feedback, multi-agent collaboration, and reasoning-action coupling to improve autonomous software problem solving.MemCoder extends these approaches by incorporating historical development wisdom into agent decisions.Source: §2.1 · p. 2
2.2. Long-Term Memory Mechanisms for LLMs
- Long-term memory methods organize agent experience through external databases, hierarchical structures, or forgetting-based pruning, whereas MemCoder uses flat autonomous memory management.Its memory dynamically integrates new insights instead of relying on rigid organization or decay-based removal.Source: §2.2 · pp. 2–3
2.3. Dynamic Evolution
- Dynamic evolution methods improve agents through memory consolidation or prompt optimization driven by environmental and execution feedback.MemCoder distinguishes itself by integrating these evolutionary mechanisms with historical human experience for continuous human-AI co-evolution.Source: §2.3 · p. 3
3. Method
MemCoder models repository-level coding as continuous human–AI co-evolution: it structures historical experience, retrieves relevant intent-to-code mappings, refines execution with feedback, and internalizes validated solutions. Its method therefore combines memory construction and utilization with execution-time adaptation and closed-loop knowledge updating.
3. Method
- MemCoder iteratively refines the agent system using long-term memory, execution trajectories, and multi-source feedback.The framework represents code generation as continuous learning rather than static inference.Source: §3 · p. 3
3.1. Experience Representation and Utilization
- Historical commits are transformed into structured memory capturing keywords, problem descriptions, root causes, and actionable solutions.The process ingests commit messages and code changes, then reconstructs developer cognition and intent-to-code mappings.Source: §3.1 · p. 3
- MemCoder retrieves relevant experiences through a two-stage pipeline combining approximate nearest-neighbor search with cross-encoder reranking.Embedding-based retrieval forms a broad candidate pool, while reranking performs fine-grained semantic matching and filters false positives.Source: §3.1 · pp. 4–5
- The retrieval system autonomously synthesizes queries from the agent’s reasoning state and task context to adapt historical-memory search to each issue.Final relevance is determined by reranking rather than the initial retrieval score.Source: §3.1 · p. 5
3.2. Self-Refinement and Internalization
- During execution, a Refining Sub-agent uses retrieved precedents, execution traces, environmental feedback, generated tests, and verification checklists to guide repository-aligned decisions.Iterative feedback updates verification logic without modifying long-term memory during execution.Source: §3.2 · p. 5
- Human-verified model solutions are internalized into long-term memory, closing the evolution loop and shifting knowledge from human-only priors toward human–agent co-evolved experience.This mechanism preserves alignment between high-level intent and concrete implementations.Source: §3.2 · p. 5
4. Experiment
MemCoder is evaluated on SWE-bench Verified against leading methods and through module, retrieval, and representation ablations. It achieves SOTA-level performance, while the ablations show that structured memory and precise, moderate retrieval are important for performance and efficiency.
4.1. Experimental Settings
- The benchmark measures functional patch correctness by executing generated patches against tests for repository-level GitHub issues across 12 Python repositories.SWE-bench Verified is a manually curated 500-instance subset of the full 2,294-instance SWE-bench benchmark.Source: §4.1 · p. 6
- MemCoder is evaluated on 500 manually curated SWE-bench Verified tasks using resolution rate and resolved-issue count, with retrieval restricted to pre-test experiences.Experiments primarily use DeepSeek-V3.2, with GPT-5.2 used to assess absolute performance.Source: §4.1 · p. 6
4.2. Performance on Repository-Level Code Generation
- 83.8% solved rate is achieved with GPT-5.2 under pass@2, despite official OpenHands results using pass@3.MemCoder is compared with OpenHands-based LLM configurations on SWE-bench Verified.Source: §4.2 · p. 7, Table 1 · p. 7
4.3. Ablation Study
- All three modules improve performance, with commit retrieval producing the largest gain in the ablation study.The tested modules are commit retrieval, experience representation, and dynamic self-refinement.Source: §4.3 · p. 7, Table 2 · p. 7
- 76.4% resolved rate with structured memory exceeds the 73% raw-commit and 68.4% no-experience settings.Structured memory reduces noise and semantic ambiguity while presenting historical information in a unified style.Source: §4.3 · p. 7
- Moderate initial top-k balances broader information access against declining retrieval frequency, plateauing resolution gains, and excessive context noise.With smaller top-k, agents retrieve more frequently; larger top-k eventually reduces signal-to-noise ratio and yields diminishing returns.Source: §4.3 · pp. 7–8
- With one retrieval opportunity, increasing top-k improves performance at first, but gains diminish beyond 8 and excessive values degrade performance through context overload.Figure 5 evaluates resolve rate on a randomly sampled 200-instance subset using DeepSeek-V3.2.Source: §4.3 · p. 8, Figure 5 · p. 8
5. Conclusion
MemCoder addresses static code agents’ failure to capture project evolution by reconstructing developer cognition from historical commits and enabling continuous Human-AI Co-Evolution.
- MemCoder targets static agents’ inability to capture critical information embedded in projects’ temporal evolution.Source: §5 · p. 8
- The framework reconstructs developer cognition by structuring historical commits and using retrospective wisdom to guide execution verification and refinement.Source: §5 · p. 8
- Continuous internalization of reasoning trajectories lets the agent move beyond a mere executor toward an adaptive partner that grows with the developer.Source: §5 · p. 8
A. Case Study
The case study shows that retrieved historical experience can identify the relevant function and guide a correct database-conflict repair, unlike a patch generated without retrieval.
- Historical retrieval guides the agent to the relevant on_conflict_suffix_sql invocation and enables successful bug repair, whereas no retrieval leads to an incorrect fix location.Source: A. Case Study · p. 13
- Mixed-case db_column values cause PostgreSQL ON CONFLICT clauses to use field names instead of column names, producing a missing-column error.Source: A. Case Study · p. 13
- The case study contrasts patches generated without retrieval and with retrieval as separate conditions.Source: A. Case Study · p. 13
- The patch also updates conflict SQL generation to use converted unique columns and update columns across affected database operations.Source: A. Case Study · p. 13
- The retrieved patch converts update and unique fields into database column names before constructing conflict SQL.Source: A. Case Study · p. 13
B. Algorithmic Pipeline
Algorithm 1 organizes MemCoder into memory synchronization, a retrieval-and-refinement execution loop, and human-reviewed submission that feeds new commits back into memory.
- The pipeline takes a target repository, issue, and existing memory, and returns a resolved solution.Source: B. Algorithmic Pipeline · p. 14
Stage 1: Memory Synchronization
- Memory synchronization summarizes new commits with an LLM, embeds the summaries, and adds them to memory.Source: B. Algorithmic Pipeline · p. 14
Stage 2: Execution Loop
- During execution, the primary agent can retrieve memory, invoke a refining agent on a candidate patch, or execute a standard tool.Source: B. Algorithmic Pipeline · p. 14
- The refining agent tests the candidate and marks it solved when tests pass; otherwise, test results and checklists are added to context for further iteration.Source: B. Algorithmic Pipeline · p. 14
Stage 3: Submission (Closed-Loop)
- A solved solution undergoes human review before Git commit, and the new commit is learned during the next memory-synchronization run.Source: B. Algorithmic Pipeline · p. 14
C. Prompt of Refining Agent
The Refining Agent prompt makes reproduction, retrieval, structural analysis, invariant checking, strategy comparison, and validation mandatory parts of patch review.
- The Refining Agent synthesizes tests, environment feedback, and retrieved experience into an actionable checklist for the primary agent.Source: C. Prompt of Refining Agent · p. 15
0. TEST REPRODUCTION, PATCH VERIFICATION & HYPOTHESIS GENERATION
- The workflow begins by analyzing the patch mechanism, retrieving related tests and commits, and using historical patterns to inform debugging.Source: C. Prompt of Refining Agent · p. 15
- Retrieval uses problem statements with keywords and descriptions, progressive top_k values beginning at 8, and synthesis after each query.Source: C. Prompt of Refining Agent · p. 15
- The agent must create a minimal runnable reproduction, compare base and patched behavior, record commands and outcomes, and generate competing hypotheses when errors are unclear.Source: C. Prompt of Refining Agent · p. 16
1–6. Structured Analysis
- The subsequent review covers code structure, reproduction and path tracing, logic and invariants, history, fix strategies, and testing validation.Source: C. Prompt of Refining Agent · pp. 16–18
Output Format
- The final report must summarize the change, structure, reproduction, invariants, historical context, recommendations, and focused regression tests.Source: C. Prompt of Refining Agent · p. 18
Related papers
This paper cites
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues?2023
- Self-Refine: Iterative Refinement with Self-Feedback2023
- OpenHands: An Open Platform for AI Software Developers as Generalist Agents2024
- Large Language Models as Optimizers2023
- Large Language Model based Multi-Agents: A Survey of Progress and Challenges2024