Summary / 20. Episodic coding memory / Document
Paper 2026-09-06
Shared copy: the operator's name and machine names are replaced by roles. Nothing else is changed.
Rendering…
# Coding-Harness Component 20/27 — Episodic Coding Memory # Remember What the Attempt Proved, Not What Was Said: Evidence-Grounded, Typed, Subtask-Indexed Episodic Coding Memory for a Weak-Model Coding Harness *Component 20 of 27 — Coding-Harness Program. This document specifies the episodic-memory stage, and it is precise about what it is not: it is not the reflection stage, which already extracted a lesson from a single failure (component 19's write half), and it is not the context-construction stage, which already solved how to fill a bounded window. This is the library — the storage, indexing, retrieval, and lifecycle that turn one task's scar tissue into the next task's head start, and that give the hypothesis ledger and reflection store cross-task reach. Iterative repair loops *within* a task; this row compounds *across* tasks and sessions. The spine distinction is between "it ran" and "it is retrievable": component 17 established whether a patch advances on evidence; component 19 established how to distill one failure into a lesson; this component establishes whether that lesson — and every other attempt — is stored under the cue a future task will actually supply, retrieved only when it is the smallest high-confidence experience relevant to the current decision, and retired when it stops earning its context. The naive harness asks "what did I say last time?" and pastes a similar conversation back into the prompt; this component argues that the only question worth asking is what the old attempt *proved*, and whether that proof transfers to the decision in front of the model right now. This paper translates the program's thesis into the episodic-memory build contract: a typed three-tier store (episodic attempt records, semantic insight rules, procedural skills) written on every attempt, indexed at write time by the cues future tasks will hold (error class, failure signature, repository area, task shape, harness phase) rather than by stored content, retrieved by a deterministic scored function (relevance × recency × importance, with hard scope filters first), injected as a budgeted top-k of compact memory cards, governed by a lifecycle of promotion, decay, deduplication, and falsification, and audited by a MemoryStats instrument that retires noisy, obsolete, or harmful lessons — and the weak model's only role is distillation (extracting the lesson from an episode), because every other stage is deterministic software and the L column holds at most one entry.* --- ## Abstract Episodic coding memory is where a coding harness either keeps what it learned or loses it at the next context reset — and where the program's most quietly expensive error is committed, not by storing too little, but by storing the wrong object in the wrong shape under the wrong index. This paper argues that a coding agent's memory should preserve evidence-grounded experience rather than conversation history, and that a weak-model harness must therefore treat memory as a deterministic discipline of typing, cue-indexing, scored retrieval, budgeted injection, and measured lifecycle rather than as an append-only transcript searched by embedding similarity. The review establishes the case across twenty-nine sources: Reflexion founded the bounded episodic buffer that alters later behavior without retraining, and demonstrated by its own design that forgetting is a policy, not a defect [1], while MemGPT supplied the memory-as-operating-system interface [2] and Generative Agents supplied the scored retrieval function — recency × importance × relevance — whose ablations show each term earns its place [3]; ReasoningBank distilled strategies from both successes and failures and, crucially, showed that one relevant experience raises success from 39.0 to 49.7 while two, three, and four experiences drop it to 46.0, 45.5, and 44.4 — more memory is not automatically better [4]; Experiential Co-Learning mined reusable experience from historical trajectories [5] and Agent Workflow Memory showed that induced, abstracted workflows transfer where raw replay does not [6]; Structurally Aligned Subtask-Level Memory aligned memory with the coding agent's functional decomposition [7], PMCoder coupled episodic memory with planning to detect repeated failures [8], and SWE-Exp carried experience-driven reuse into issue resolution [9]; ExpeRepair and TwinMem-Agent built dual episodic-plus-semantic repair stores [10][11], E-mem reconstructed episodic context instead of destructively compressing it [12], and RepoMem turned a repository's own git history into episodic memory [13]; ContextSniper made memory token-efficient [14], ProjectMem made memory a governance layer whose failure history gates actions rather than merely hinting [15], and Mem0 set the production-ready baseline [16]; MemRL made the memory itself the object of runtime reinforcement learning [17], Agent KB pooled cross-domain experience [18], and ExpeL paired insight rules with case retrieval [19]; and the two papers that keep the whole row honest — CTIM-Rover, showing that episodic memory ported to real repositories can act as pure noise [20], and SWE Context Bench, showing that correctly selected summarized experience helps while unfiltered or wrongly selected history hurts [21]. Beneath all of it, Tulving's episodic/semantic distinction and the encoding-specificity principle state the row's oldest constraint — index for the query you will face, not the content you have [22][23] — with Schank's dynamic memory [24], Aamodt and Plaza's case-based R4 cycle [25], CoALA's cognitive taxonomy [26], Voyager's verification-gated skill library [27], LeMa's distillation exit [28], and the survey of second-half agent memory [29] completing the lineage. From this review the paper derives eight design principles, then specifies a deterministic architecture (D) in which the single learned entry (L) is distillation — never storage, indexing, retrieval, or lifecycle — and closes with a recursive self-improvement protocol and a measurement plan whose instruments exist to keep the harness from mistaking a noisy, stale, or harmful memory for an asset. ## 1. Introduction The coding-harness program has, through components 01 through 19, assembled machinery that reads a repository, localizes a fault, maps its dependencies, generates a candidate patch, edits it into place, runs it, and distills failures into durable memory. Component 20 is the moment where all of that learned experience either compounds or evaporates: it is where the harness decides what to keep, how to find it again, and whether it actually helps. Everything upstream produces an experience — "this strategy fixed this failure, this approach wasted three rounds, this invariant held under refactor" — and everything downstream depends on that experience resurfacing, in compact form, exactly when the next decision needs it. Episodic memory therefore fails in exactly one way that matters: it stores the conversation instead of the conclusion, indexes it by what it contains instead of by what a future task will ask, retrieves a top-k that is always full instead of a smallest relevant set, and never measures whether the memory it injects made the next attempt better or worse. And in every case the failure is invisible, because the harness asked only whether the transcript was saved. The thesis that governs this component is stated plainly. **Episodic coding memory should preserve evidence-grounded experience rather than conversation history: retain immutable records of coding episodes, distill successful strategies, failed approaches, causal mistakes, and reusable invariants into compact typed memories, index them by both semantic applicability and coding-harness subtask, retrieve only the smallest high-confidence experience relevant to the current decision, learn from both positive and negative trajectories, and continually measure whether each memory improves future outcomes so noisy, obsolete, or harmful lessons can be revised or retired.** And it carries a strong rule for Piper that compresses the whole thesis into one sentence, stated verbatim: **Do not remember the old conversation. Remember what the old coding attempt proved.** The first clause of the thesis is the discipline of typing — an episode is an immutable record of what happened, while a rule and a skill are distilled claims about what transfers, and the two must never be confused, because a claim can be revised or falsified while a record cannot. The second clause is the discipline of the cue — memory is indexed by the error class, failure signature, repository area, task shape, and harness phase that a *future* task will present, never by the narrative of the task that produced it. The third clause is the discipline of economy — retrieval returns the smallest high-confidence experience relevant to the current decision, because ReasoningBank's ablation [4] and SWE Context Bench's negative result [21] together prove that a top-k that is always full is a distractor field wearing a "helpful" badge. The final clause is the discipline of the measured lifecycle — every memory accumulates a usage record, and a memory that does not improve future outcomes is revised or retired, not preserved out of sentiment. The weak-model problem makes episodic memory the make-or-break stage for a specific reason that has nothing to do with the model's raw capability: there are no gradients at inference time, so memory text is the *entire* learning channel a deployed weak model has. Everything the harness "learns" from a task lives or dies in the memory store at the context reset, which means a weak model needs its memory to be small, well-selected, and grounded — the opposite of the naive transcript dump — because a weak model is precisely the model that cannot tell which of twenty pasted conversations is relevant and which is interference. The trap the library guards against is the one the whole program's economics fear: injected episodes can rescue a task or drown it, and memories arrive pre-formatted as *advice*, which models weight heavily and rarely question — so a wrongly remembered lesson is not neutral noise, it is a poisoned prior with seniority. The escape is the evidence grounding the rest of the harness already produces: the deterministic verdicts of component 17, the typed failure signatures of component 11, and the distilled reflections of component 19 are the raw material, and the memory layer's job is to keep them as *proof*, not as prose. The design implication is decisive and it is the thesis: a weak-model harness must store typed, evidence-grounded episodes indexed by future cues, retrieve only the smallest high-confidence relevant experience under a hard budget, learn from failures and successes alike, and measure whether each memory helps so that noisy, obsolete, or harmful lessons can be retired — because the question is never whether the old conversation was saved, but whether the old attempt's proof transfers to the decision in front of the model. The paper proceeds as follows. Section 2 reviews the episodic-memory literature in eight parts — the bounded buffer and its two limits, from transcripts to transferable strategy, subtask alignment and plan-coupled memory, dual-memory repair systems, token efficiency and governance, the learned memory policy, the negative result and the measurement paper, and the cognitive substrate with the procedural pipeline. Section 3 derives eight design principles. Section 4 specifies the architecture, labeling every node deterministic (D) or learned (L) and stating the invariant that the L column holds at most one entry, with the deterministic library as the default. Section 5 states the recursive self-improvement protocol. Section 6 gives the measurement plan. Section 7 concludes. ## 2. Related Work The literature divides into eight parts that together answer one question: what is a stored coding experience FOR, and how must storage, indexing, retrieval, and lifecycle be built so that a weak model's small context budget buys the most transfer per injected token? Each part supplies one design lever the library must pull. ### 2.1 The bounded buffer and its two limits **Reflexion: Language Agents with Verbal Reinforcement Learning** (Noah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao, NeurIPS 2023, arXiv:2303.11366) is the foundational episodic-memory paper, and for this row the relevant facet is not the reflection step but the memory design [1]. After an attempt receives environmental feedback, the agent generates a verbal reflection and stores it in an episodic buffer, and that buffer conditions the next trial without any weight update — the proof that failure can alter subsequent behavior through memory text alone, reporting 91% pass@1 on HumanEval. Two design facts matter more than the headline number. First, the buffer is *bounded*: Reflexion keeps a sliding window of the most recent reflections — capped at one to three to keep the prompt tractable — and old lessons are forgotten by policy, not by overflow. Second, the buffer is *within-task and unindexed*: it is appended wholesale to the next retry of the *same* task, with no retrieval, no indexing, and no persistence across tasks. Those two limits — everything is recalled every time, and nothing crosses a task boundary — are exactly the two axes every later paper extends: selective retrieval, and cross-task, cross-session persistence. The design transfer is the axiom with its inverse stated together: forgetting is a feature that prevents a memory from degrading into a distractor field, and a memory that is always fully recalled has no retrieval problem only because it has no retrieval. **MemGPT: Towards LLMs as Operating Systems** (Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E. Gonzalez, arXiv 2023, arXiv:2310.08560) applies an operating-system memory hierarchy to the agent: a limited main context (the "RAM" the model sees) over an unbounded external store (the "disk"), with the model itself performing self-editing memory operations through function calls — revising its own core memory and paging content in and out of archival storage through search [2]. Demonstrated across sessions, it persists persona and prior interactions by deliberately re-paging them in rather than carrying them in the window. The design transfer is the interface discipline: memory needs explicit read, write, edit, and search operations that the agent can invoke, with the harness enforcing capacity and persistence underneath — a coding harness's plan file, hypothesis ledger, and episode store are all MemGPT-shaped objects. **Generative Agents: Interactive Simulacra of Human Behavior** (Joon Sung Park, Joseph C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, and Michael S. Bernstein, UIST 2023, arXiv:2304.03442) is the retrieval-function paper: a memory stream of everything observed, made usable by a scoring function that is recency (exponential decay) × importance (scored at write time) × relevance (embedding similarity to the current situation) [3]. Its ablations show each term earns its place — retrieval without all three measurably degrades believability. Its second contribution is reflection-as-compaction: when accumulated high-importance observations pass a threshold, the agent generates abstract conclusions that themselves enter the stream as retrievable memories, so the hierarchy bootstraps from raw episodes to generalizations. The design transfer is the exact shape of retrieval this component adopts: a scored, tunable, three-factor function rather than a vector-search default, with a scheduled compaction process rather than a manual chore. ### 2.2 From transcripts to transferable strategy **ReasoningBank: Scaling Agent Self-Evolving with Reasoning Memory** (Siru Ouyang, Jun Yan, I-Hung Hsu, Yanfei Chen, Ke Jiang, Zifeng Wang, Rujun Han, Long T. Le, Samira Daruki, Xiangru Tang, Vishy Tirumalashetty, George Lee, Mahsan Rofouei, Hangfei Lin, Jiawei Han, Chen-Yu Lee, and Tomas Pfister, ICLR 2026 Poster, arXiv:2509.25140) is the most important modern paper for this component, because it addresses the exact failure mode of persistent agents that repeatedly encounter tasks yet discard what they learned [4]. It distills generalizable reasoning strategies from successful and failed experiences, retrieves relevant memories for new tasks, integrates new learning back into the bank, and evaluates on software-engineering tasks using SWE-bench Verified — not a web or toy environment. Its key shift is the same one this component makes mechanical: from raw episode memory ("I opened foo.py, ran grep, edited bar.py") to reasoning memory ("when a public API change appears local but its test failure occurs in a wrapper, inspect the wrapper's transformations before modifying the API"). The single most important number for this row is the retrieval-ablation: with Gemini-2.5-flash on WebArena-Shopping, the success rate rises from 39.0 without memory to 49.7 with one relevant experience, then *falls* to 46.0 with two, 45.5 with three, and 44.4 with four experiences — more retrieved memories are not automatically better, and irrelevant memory is interference [4]. That finding is the quantitative anchor for this component's smallest-high-confidence retrieval discipline and for its budgeted injection. **Experiential Co-Learning of Software-Developing Agents** (Chen Qian, Yufan Dang, Jiahao Li, Wei Liu, Zihao Xie, Yifei Wang, Weize Chen, Cheng Yang, Xin Cong, Xiaoyin Che, Zhiyuan Liu, and Maosong Sun, ACL 2024, pp. 5628–5640, arXiv:2312.17025) is the direct software-development demonstration of the move from Reflexion's single-attempt loop to multi-trajectory mining: agents extract shortcut-oriented experience from historical trajectories and reuse it on unseen development tasks, instead of repeatedly rediscovering solutions and repeating mistakes [5]. Its transfer is the granularity lesson in concrete form: the useful unit is not the old patch itself but the transferable pattern — three tasks where an API signature changed and each failed in a different place (subclass override, mock implementation, protocol implementation) collapse into one lesson: enumerate callers, overrides, protocol implementations, mocks, and tests before editing a callable contract. That is what this component's distillation step must produce. **Agent Workflow Memory** (Zora Zhiruo Wang, Jiayuan Mao, Daniel Fried, and Graham Neubig, ICML 2025, arXiv:2409.07429) closes the loop from episodes to reusable procedure: from past agent trajectories it induces abstracted workflows — step patterns that recur across tasks — stores them, and injects them into future task prompts, evaluated on web agents and SWE-bench Lite [6]. Its interesting finding is the same as ReasoningBank's from the other direction: raw episodic replay helps less than induced, abstracted workflows — the compaction step is where cross-task transfer actually comes from, and it is the pipeline this component adopts in its promotion ladder (episode → rule → skill). ### 2.3 Subtask alignment and plan-coupled memory **Structurally Aligned Subtask-Level Memory for Software Engineering Agents** (Kangning Shen, Jingyuan Zhang, Chenxi Sun, Wencong Zeng, and Yang Yue, arXiv 2026, arXiv:2602.21611) may have the most direct architectural implication for this component, because it identifies the granularity mismatch that whole-task episodic memory creates: two issues may look similar overall while requiring completely different reasoning during a particular phase [7]. Its solution aligns memory with the functional decomposition of the agent — LOCALIZE, PLAN, EDIT, DEBUG, VALIDATE memories rather than whole-issue trajectories — and performs retrieval and update at the same subtask granularity used for reasoning, reporting +4.7 percentage points average Pass@1 over the vanilla agent (including +6.8 points on Gemini 2.5 Pro), with gains increasing at longer interaction horizons. The design transfer is decisive for this component: memory is indexed not only by semantic similarity but by which coding-harness subtask is currently active, which turns the harness's own component decomposition into a hard first-stage retrieval filter that eliminates enormous memory noise before any embedding is consulted. **Coupling Planning with Episodic Memory in LLM Agents for Software Issue Resolution** (Jiahao Zhang, Yifan Zhang, and Yu Huang, arXiv 2026, arXiv:2608.06811) couples episodic memory with hierarchical planning, under the method name PMCoder [8]. Its bidirectional coupling is the design point: the current plan phase conditions memory retrieval, while trajectory statistics derived from memory inform replanning — including stuck detection that uses memory-derived statistics to detect repeated failed edits and trigger replanning — reporting +5.0pp on SWE-bench Verified over a harness-matched baseline, with gains that persist even without reproduction signals. The design transfer is the harness-phase index made dynamic: the *plan* says which phase is active, and the phase says which memory bucket to query — exactly the "index by coding-harness subtask" clause of the thesis, with the model's plan as the pointer rather than a free-text guess. **SWE-Exp: Experience-Driven Software Issue Resolution** (Silin Chen, Shaoxin Lin, Yuling Shi, Heng Lian, Xiaodong Gu, Longfei Yun, Dong Chen, Lin Cao, Jiyang Liu, Nu Xia, and Qianxiang Wang, arXiv 2025, arXiv:2507.23361) is the experience-driven reuse paper for issue resolution, carrying the cross-task memory promise into the SWE setting [9]. It is cited here as the positive result that experience reuse is worth engineering for coding specifically — the bridge from the reasoning-domain successes of Reflexion and ReasoningBank to the repository setting this harness inhabits. ### 2.4 Dual-memory repair systems **ExpeRepair: Dual-Memory Enhanced LLM-Based Repository-Level Program Repair** (Fangwen Mu, Junjie Wang, Lin Shi, Song Wang, Shoubin Li, and Qing Wang, FSE 2026, DOI 10.1145/3808181, arXiv:2506.10484) builds the full dual-memory architecture for repository-level repair: an episodic store of concrete repair demonstrations (test–patch trajectories) paired with a semantic store of abstract reflective insights distilled from past repairs, retrieved dynamically at inference to guide new attempts [10]. Its reported results require care, and this paper flags them rather than repeating them flatly: the 60.3% SWE-bench Lite figure is corroborated by the authors' own repository (ExpeRepair-v1.0 at 60.33% on Lite with Claude 4 Sonnet), while the 74.6% SWE-bench Verified figure was not independently corroborated by the sources surfaced during verification — the arXiv abstract's headline is 49.3% pass@1 on Lite with Claude 3.7 Sonnet, an older configuration, and the figure varies by model and version. The transfer that survives the caveat is architectural, not numeric: episodic demonstrations and semantic insights are different stores with different write rules and different lifetimes, and they must not be collapsed into one log. **TwinMem-Agent: Episodic and Semantic Memory for Repository-Level Program Repair** (Benzhao Wu, Zhiwen Luo, Fangwen Mu, and Lijun Xiang, SIGSOFT FSE Companion 2026, pp. 1447–1451, DOI 10.1145/3803437.3807664) follows the same dual-memory design, cited here through its ACM/DBLP record with no arXiv identifier assigned [11]. Its distinguishing disciplines are role-specific semantic entries — maintained separately for test versus patch roles to avoid mixing modalities — and a validation loop that includes boundary testing and a lightweight review before memory storage. The design transfer is the write-gate: a memory earns storage through validation, not through having been generated. **E-mem: Multi-Agent Based Episodic Context Reconstruction for LLM Agent Memory** (Kaixiang Wang, Yidan Lin, Zihan Wang, Bunyod Suvonov, Zhaojiacheng Zhou, Yuxiang Zheng, Jiaxi Cao, Zhiheng Dong, Chentao Wu, Jiong Lou, and Jie Li, ICML 2026, arXiv:2601.21714) replaces destructive compression with episodic context reconstruction, reconstructing prior context from archived episodic material rather than summarizing it away [12]. Its transfer is the immutability clause of the thesis given teeth: the raw episode is never compressed in place — compression, when it happens, produces a *derived* memory that points back at the immutable record, so nothing historical is lost to a lossy rewrite. **Improving Code Localization with Repository Memory** (Boshi Wang, Weijian Xu, Yunsheng Li, Mei Gao, Yujia Xie, Huan Sun, and Dongdong Chen, ICLR 2026, arXiv:2510.01003) is the RepoMem framework, and it supplies this component's most elegant observation about where episodic material already lives: a repository's own git and commit history is an episodic memory of the codebase's evolution, which the framework turns into a module-summary semantic memory plus a git-history episodic memory for code localization [13]. The design transfer is the cheapest store in the library: the repository's own history is evidence-grounded experience that costs nothing to harvest and is already scoped to exactly one repo. ### 2.5 Token efficiency and governance **ContextSniper: AntTrail's Token-Efficient Code Memory for Repository-Level Program Repair** (Chiwang Luk, Matin Mohammad Najafi, Zhifeng Jia, Wei Yang, Xiuchang Li, Jinwei Zhu, Yang Ren, Lei Chen, and Gao Cong, arXiv 2026, arXiv:2607.01916) is the token-efficiency paper: a memory-centric design that retains and reuses previously explored contexts to cut token and cost overhead for repository-level repair agents, substantially reducing cost without measurable loss in repair quality [14]. It is cited as an arXiv preprint, not an ACM venue. The design transfer is the budget clause made concrete: memory's value must be measured against its token cost, and the compaction that survives is the compaction that pays for itself. **PROJECTMEM: A Local-First, Event-Sourced Memory and Judgment Layer for AI Coding Agents** (Ripon Chandra Malo and Tong Qiu, arXiv 2026, arXiv:2606.12329) is the most harness-shaped paper in the set, and it introduces the taxonomy this component adopts: memory-as-tool (passive query-in/passages-out), memory-as-cognition (access interleaved with reasoning), and memory-as-governance — memory that *acts on* the agent, with a deterministic pre-action judgment gate derived from the project's own failure history [15]. Practically it is an MCP-native, event-sourced plain-text log across projects; the agent loads roughly 800–1,500 tokens of summary at session start versus an estimated 5,000–20,000 tokens spent reconstructing context with no memory layer, in a self-study of 207 logged events across ten projects (numbers the authors themselves present as anecdotal). The design transfer is the sharpest escalation past Reflexion: a memory's failure history is a *gate*, not a hint — the store does not merely suggest; it can veto an action the project's own history has already falsified. **Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory** (Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav, ECAI 2025, arXiv:2504.19413) is the production-ready baseline of scalable long-term memory, the general-purpose comparison point against which a harness-specific store is judged [16]. Its transfer is the engineering floor: extraction, search, update, and duplicate management are table stakes any serious memory layer must provide, and a coding harness builds on that floor rather than below it. ### 2.6 The learned memory policy **MemRL: Self-Evolving Agents via Runtime Reinforcement Learning on Episodic Memory** (Shengtao Zhang, Jiaqian Wang, Ruiwen Zhou, Junwei Liao, Yuchen Feng, Zhuo Li, Yujie Zheng, Weinan Zhang, Ying Wen, Zhiyu Li, Feiyu Xiong, Yutao Qi, Bo Tang, and Muning Wen, arXiv 2026, arXiv:2601.03192) is the trained-version paper: rather than retrieving raw episodes or LLM-written reflections, it treats the episodic store as the object of learning, running reinforcement learning at runtime over stored episodes so the agent's policy for what to write, what to recall, and how much to trust a recalled episode improves as experience accumulates — without retraining the base model [17]. Its transfer is the answer to "who decides what is worth remembering": in this component, that decision is a fixed deterministic rulebook (the lifecycle), because a weak-model harness cannot afford a learned write policy on top of everything else — but MemRL marks the ceiling the deterministic lifecycle is approximating, and the audit loop of Section 5 is the harness's honest substitute for a learned recall policy. **Agent KB: Leveraging Cross-Domain Experience for Agentic Problem Solving** (Xiangru Tang, Tianrui Qin, Tianhao Peng, Ziyang Zhou, Daniel Shao, Tingting Du, Xinming Wei, Peng Xia, Fang Wu, He Zhu, Ge Zhang, Jiaheng Liu, Xingyao Wang, Sirui Hong, Chenglin Wu, Hao Cheng, Chi Wang, and Wangchunshu Zhou, arXiv 2025, arXiv:2507.06229) is the shared-memory version: high-level strategies and execution lessons distilled from heterogeneous agent trajectories are aggregated into a knowledge base any agent can query, using a two-tier reason-retrieve-refine loop (workflow-level experience up front, step-level fixes after a failure), evaluated on GAIA and SWE-bench [18]. Its transfer is the fleet argument: episodic memory need not be one agent's diary — it can be a pooled record of what worked and what did not across agents hitting the same codebases, which is the natural architecture for a fleet of coding agents, and which this component's per-repo namespace makes safe rather than leaky. **ExpeL: LLM Agents Are Experiential Learners** (Andrew Zhao, Daniel Huang, Quentin Xu, Matthieu Lin, Yong-Jin Liu, and Gao Huang, AAAI-24, arXiv:2308.10144) pairs insight rules with case retrieval of similar past trajectories — the dual-memory design whose extraction half was the reflection row's home treatment, and whose retrieval half belongs here [19]. Its transfer is the promotion discipline: recurring episodes promote to insight rules, and the R4 cycle of Section 2.8 names the loop ExpeL operationalizes. ### 2.7 The negative result and the measurement paper **From Knowledge to Noise: CTIM-Rover and the Pitfalls of Episodic Memory in Software Engineering Agents** (Tobias Lindenbauer, Georg Groh, and Hinrich Schütze, arXiv 2025, arXiv:2505.23422) is the negative result this row must survive, and it is the outlier because it says the anchor's premise may not survive contact with real codebases [20]. Porting ExpeL's cross-task-instance memory to AutoCodeRover on SWE-bench — distilling insights from successful trajectories and from success/failure pairs on the same instance, with the same add/edit/upvote/downvote operations, adapted to repository-level knowledge with mixture-of-experts-style routing — the authors find it *hurts*: the retrieved "knowledge" acts as noise, and in-context exemplar trajectories from similar tasks do not help either. Their diagnosis is that real repositories have a state space so large that a lesson from one instance rarely transfers cleanly to the next, unlike the small environments where ExpeL and Reflexion were validated. The design transfer is a warning this component encodes mechanically: scope is not an afterthought — a lesson is only trustworthy within the repository (and the harness phase, and the task shape) where it was earned, and retrieval across that boundary is the failure CTIM-Rover measured. Every design lever in Section 3 exists to explain how this component escapes the negative result: typing and evidence-grounding (so a "lesson" that cannot cite its proof is not promoted), scope filters before similarity (so cross-repo noise never enters), and a measured lifecycle (so a lesson that hurts is retired rather than upvoted). **SWE Context Bench: A Benchmark for Context Learning in Coding** (Jiayuan Zhu, Junde Wu, Minhao Hu, Shengda Zhu, Jiazhen Pan, Weixiang Shen, Yijun Yang, Fenglin Liu, Jianye Hao, Yueming Jin, Qirong Ho, and Min Xu, arXiv 2026, arXiv:2602.08316) is the measurement paper that answers whether previous coding experience actually helps future coding tasks [21]. Built from SWE-bench Lite, it adds related tasks through real dependency/reference relationships between GitHub issues and pull requests, creating sequences where prior experience could be useful. Its numbers require the same care as ExpeRepair's, and the correction is baked in here: the "99 related tasks added to 300" construction describes the *Lite* subset (300 base + 99 related = 399 tasks); the full benchmark is 1,100 base tasks plus 376 related tasks across 51 repositories and 9 languages. The strongest result for this component is not "memory helps" but the conditional: correctly selected summarized experience helps — improving accuracy, runtime, and token efficiency — while unfiltered or incorrectly selected experience provides little benefit or actively hurts [21]. That is the experiment this component's retrieval discipline exists to pass, and its budgeted injection is the direct consequence. ### 2.8 The cognitive substrate and the procedural pipeline **Episodic and Semantic Memory** (Endel Tulving, in E. Tulving and W. Donaldson, eds., *Organization of Memory*, Academic Press, 1972, pp. 381–403) is the row's namesake and its oldest design constraint: episodic memory — temporally dated, context-bound records of specific events ("that attempt where I broke the parser") — is distinct from semantic memory — context-free general knowledge ("APIs here change additively") [22]. The distinction structures this component's typed stores, and it is cited as a book chapter with no arXiv identifier. **Encoding Specificity and Retrieval Processes in Episodic Memory** (Endel Tulving and Donald M. Thomson, *Psychological Review*, 80(5), 1973, pp. 352–373) is the companion result and the row's hardest lesson in a sentence: retrieval succeeds in proportion to the match between the retrieval cue and the encoding context, so memory encoded without its context is effectively unretrievable [23]. It is cited with its correct journal — *Psychological Review*, 80(5):352–373 — and not the common "Journal of Experimental Psychology" mis-citation. The operational consequence is the whole of Section 3's second principle: an episode stored as "the fix was X" without the cue context — error class, repository area, conditions — is a book shelved by cover color, and human memory research established fifty years ago that you index for the query you will face, not the content you have. **Dynamic Memory: A Theory of Reminding and Learning in Computers and People** (Roger C. Schank, Cambridge University Press, 1982) is the episode-to-generalization lineage: experience is reminded and generalized into schema structures rather than replayed verbatim [24]. It is the cognitive ancestor of workflow induction, cited as a book with no arXiv identifier. **Case-Based Reasoning: Foundational Issues, Methodological Variations, and System Approaches** (Agnar Aamodt and Enric Plaza, *AI Communications*, 7(1), 1994, pp. 39–59) supplies the retrieve–reuse–revise–retain R4 cycle, which is this component's lifecycle thirty years pre-LLM: a case is retrieved, its solution reused, the result revised against outcome, and the revised case retained [25]. **Cognitive Architectures for Language Agents** (Theodore R. Sumers, Shunyu Yao, Karthik Narasimhan, and Thomas L. Griffiths, arXiv 2023, arXiv:2309.02427) supplies the working/episodic/semantic/procedural taxonomy that names this component's three typed stores as agent design vocabulary rather than ad-hoc buckets [26]. **Voyager: An Open-Ended Embodied Agent with Large Language Models** (Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar, TMLR, arXiv:2305.16291) supplies the procedural store's gate: its skill library admits programs only after verified successful execution, and a refinement loop re-prompts when retrieval misses — the verification gate that keeps a skill library trustworthy and the reason procedural skills in this component are gated on executed, verified success [27]. **Learning From Mistakes Makes LLM Better Reasoner** (Shengnan An, Zexiong Ma, Zeqi Lin, Nanning Zheng, Jian-Guang Lou, and Weizhu Chen, ICLR 2024, arXiv:2310.20689) supplies the distillation exit: the memory-to-fine-tuning-corpus path by which a mature store eventually becomes weights, cited here with its exact title so it is not confused with the same group's related EMNLP 2024 Findings paper on reasoning tasks [28]. **A Survey of Agent Memory in the Second Half: Towards Self-Evolving and Long-Horizon Agents** (Wei-Chieh Huang, Weizhi Zhang, Yueqing Liang, Yuanchen Bei, Yankai Chen, Tao Feng, Xinyu Pan, Zhen Tan, Yu Wang, Tianxin Wei, Shanglin Wu, Ruiyao Xu, Liangwei Yang, Rui Yang, Wooseong Yang, Chin-Yuan Yeh, Hanrong Zhang, Haozhen Zhang, Siqi Zhu, Henry Peng Zou, Wanjia Zhao, Song Wang, Wujiang Xu, Zixuan Ke, Zheng Hui, Dawei Li, Yaozu Wu, Langzhou He, Chen Wang, Xiongxiao Xu, Baixiang Huang, Juntao Tan, Shelby Heinecke, Huan Wang, Caiming Xiong, Ahmed A. Metwally, Jun Yan, Chen-Yu Lee, Hanqing Zeng, Yinglong Xia, Xiaokai Wei, Ali Payani, Yu Wang, Haitong Ma, Wenya Wang, Chenguang Wang, Yu Zhang, Xin Eric Wang, Yongfeng Zhang, Jiaxuan You, Hanghang Tong, Xiao Luo, Xue Liu, Yizhou Sun, Wei Wang, Julian McAuley, James Zou, Jiawei Han, Philip S. Yu, and Kai Shu, TMLR Survey Certification, arXiv:2602.06052) is the survey whose episodic-memory section maps the recording-versus-retrieval split this row sits on, cited here with its current title (the paper was earlier circulated as "Rethinking Memory Mechanisms of Foundation Agents in the Second Half") [29]. ## 3. Design Principles Eight principles follow from the review, each tied to the evidence above and each a clause of the strong Piper rule made mechanical. **P1 — Memory is a typed library, not a transcript.** Three stores, three write rules, three lifetimes, three retrieval treatments: episodic attempt records (every attempt, cheap, automatic, immutable — what happened), semantic insight rules (distilled claims about what transfers, gated on evidence citations — the reflection row's schema, generalized), and procedural skills (verified, recomposable strategies, gated on executed success — Voyager's discipline [27]). "Everything is saved" is a transcript; "the right object in the right shape under the right gate" is a library. This is Tulving's episodic/semantic distinction [22] extended with the procedural tier CoALA names [26], and the refusal to collapse a record ("what happened") into a claim ("what transfers") is the immutability lesson of E-mem [12]. **P2 — Index by the query you will face, not the content you have.** Memory is indexed at write time by the cues a *future* task will actually supply — error class, failure signature, repository area, task shape, language/framework, harness phase — never by the narrative of the task that produced it. This is encoding specificity operationalized [23]: an episode stored as "the fix was X" without its cue context is unretrievable, and retention without retrieval is zero. The harness-phase cue is the Structurally Aligned Subtask-Level Memory transfer [7], made dynamic by the plan pointer of PMCoder [8]: the active component of the harness *is* the first index key. **P3 — Retrieval is a scored function with hard filters first.** Relevance (embedding similarity) × recency (exponential decay) × importance (write-time scoring) — Park et al.'s function [3] — is computed only *after* hard filters on repository/project scope, harness phase, and task shape have narrowed the candidate set. Scope filters precede similarity, never follow it, because a cross-repo "similar" memory is exactly the noise CTIM-Rover measured [20], and the repo namespace is a security boundary before it is a relevance optimization. No memory crosses a scope filter on similarity alone. **P4 — Gate every tier by evidence.** Every attempt becomes an episode, automatically and cheaply. Only a diagnosis that cites its evidence — the failing test, the trace, the deterministic verdict of component 17 — promotes to a rule. Only a strategy that executed and verified — the suite green under component 17's typed evidence — becomes a skill. Workflows earn storage by surviving induction across multiple episodes, Agent Workflow Memory's multi-trajectory mining [6]. The write gates are deterministic software; the only learned step is the distillation itself (Section 4). **P5 — Both polarities are memory.** Successes and failures are stored symmetrically: a DO THIS strategy and a DO NOT REPEAT THIS failed approach, each with its situation, its evidence, and its causal attribution. ReasoningBank learns from both [4], and the negative polarity is the cheaper half of the store — a falsified approach that is never stored is re-paid in full on the next task. The causal-attribution requirement is the guard against poisoned memory: a success misattributed to the wrong factor promotes a bogus rule, and a "do not repeat" that cannot say *why* the approach failed is a superstition, not a lesson. **P6 — Inject the smallest high-confidence advice under an explicit budget.** Retrieval returns top-k compact memory cards under an explicit token slice, positioned at window edges; memories are formatted as *advice*, not ground truth, so the model can disagree. ReasoningBank's 39.0 → 49.7 → 46.0/45.5/44.4 ablation [4] and SWE Context Bench's "correctly selected summarized experience helps; unfiltered hurts" [21] are the same sentence read twice: a top-k that is always full is a distractor field wearing a helpful badge, and the k that helps is often one. **P7 — Scope and redact as a security boundary.** Per-repository (per-project) namespaces; secrets and credentials stripped at write time; cross-repo or cross-client contamination treated as a security incident, not an indexing bug. Agent KB showed pooled experience is valuable [18]; the namespace is what makes pooling safe rather than leaky. A memory that carries client A's pattern into client B's task is a breach, and the redaction rule is mechanical, not discretionary. **P8 — A memory must prove it helps or be retired.** Every entry accumulates a MemoryStats record — retrieved, used, successful-after-use, harmful — and the lifecycle of promotion, decay, deduplication, and falsification runs on it. A rule that fires and helps is promoted; a rule that fires and hurts is falsified loudly and retired; a rule that never fires decays; duplicates merge. Stale memory is a poisoned prior with seniority, and a library nobody measures is a warehouse nobody visits. ## 4. The Architecture The episodic-memory stage is a typed library with a write pipeline, a retrieval pipeline, and a lifecycle; every node is labeled D (deterministic software) or L (a learned model). The invariant that governs the whole is: **the L column contains at most one entry, and the deterministic library is the default.** A pure write of an episode — record the attempt, index its cues, attach its evidence — has zero L entries: the episode record, the cue index, the scope namespace, and the secret redaction are deterministic software on CPU. A pure retrieval — score candidates, filter by scope, budget the injection — has zero L entries: the scored retrieval function, the hard filters, and the top-k budget are deterministic. The single L entry appears only in the distillation step, and it is the one place where judgment is genuinely required: the model reads a raw episode and extracts the transferable lesson — the mistake pattern, the successful strategy, the reusable invariant, or the causal attribution — that becomes a semantic rule or a procedural skill. The model never decides what to store (every attempt is stored), never decides what to index (the cue indexer does), never decides what to retrieve (the scorer does), and never decides whether a memory is retired (the lifecycle does). The concrete input is a completed coding episode — task, repository, trajectory, patches, failures, evidence, final patch, outcome — plus the current decision point (the active harness phase and the pending choice); the output is either a stored, indexed, scoped memory record, or a budgeted, ranked set of memory cards injected into the current decision context, or a lifecycle mutation (promotion, decay, deduplication, falsification). The pipeline, in the deterministic services plus the one learned entry (L): 1. **Record the episode [D].** `record_episode` writes the immutable attempt record — task, repository, trajectory, patches, failures with their typed evidence (component 17's verdicts, component 11's failure signatures), final patch, outcome — as an episodic entry. Every attempt, success or failure, cheap and automatic. The record is append-only and never rewritten in place: distillation produces derived memories that point back at it (E-mem's reconstruction discipline [12]), so nothing historical is lost to a lossy rewrite. 2. **Index the cues [D].** `index_cues` attaches, at write time, the keys a future task will supply: error class, failure signature, repository area, task shape, language/framework, and harness phase. This is the encoding-specificity operation [23]: the cue is derived from the *future query's* vocabulary — the symptom a later task presents — not from the episode's own narrative. The harness-phase key comes from the component decomposition itself (Structurally Aligned [7]), so a dependency-impact decision queries the impact bucket and never the editing bucket. 3. **(L) Distill the lesson — the at-most-one learned entry.** `distill` is the single learned call: the model reads one episode (or a small aligned cluster of episodes) and extracts the transferable lesson into a typed shape — situation, strategy-or-mistake, evidence citations, causal attribution, applicability, confidence. It produces either a semantic rule (a claim about what transfers, gated on cited evidence) or a candidate procedural skill (a recomposable strategy, gated on executed verification). This is the only stage that can misattribute, and its output is therefore never trusted at write time: a rule enters the store only after its cited evidence resolves against the episode's record, and a skill enters only after the verification gate of step 4 closes. The distillation is advice-shaped and evidence-bound, never a free-floating claim. 4. **Gate and type the store [D].** `apply_write_gate` enforces P4 deterministically: an episode is always admitted; a rule is admitted only if its evidence citations resolve (the failing test, the trace, the verdict); a skill is admitted only if its execution record verified (component 17's typed green, not the model's self-report — Voyager's gate [27]); a workflow is admitted only after surviving induction across multiple episodes [6]. The gate reads the harness's own evidence records; it does not consult the model about whether the model's lesson is true. 5. **Scope and redact [D].** `scope_redact` assigns the per-repository namespace, strips secrets and credentials from the stored text, and raises a security incident on any cross-repo or cross-client contamination. This runs at write and again at retrieval, so a memory can never carry client A's material into client B's decision even if a later edit to the record slips a reference in. The namespace is a hard partition, not a tag. 6. **Retrieve by scored function with hard filters first [D].** `score_retrieval` computes relevance (embeddings) × recency (exponential decay) × importance (write-time scoring) — Park et al.'s three factors [3] — strictly *after* `filter_scope` has narrowed candidates to the active repository, harness phase, and task shape. No cross-scope candidate reaches the scorer. The phase filter is fed by the plan pointer (PMCoder's coupling [8]), so the bucket is chosen by the harness's own state, not by free-text similarity. 7. **Budget the injection [D].** `inject_budget` selects the top-k memory cards under an explicit token slice, formats them as compact cards at the window edges, and marks them as advice rather than ground truth. The k defaults to the smallest high-confidence set — often one — and expands only when the scorer's confidence justifies the extra tokens, because ReasoningBank's ablation [4] is the standing evidence that more retrieved memories are not automatically better. 8. **Run the lifecycle [D].** `apply_lifecycle` executes promotion (episode → rule → skill on the evidence gates), decay (unretrieved entries lose retrieval weight), deduplication (equivalent lessons merge), and falsification (a lesson contradicted by new evidence is retired loudly). Every mutation is driven by the MemoryStats record, not by the model's opinion, and a retirement writes a visible falsification notice rather than silently deleting. The cross-cutting deterministic services that make the library an instrument rather than a log: `record_episode` (the immutable attempt record), `index_cues` (the write-time future-cue index), `apply_write_gate` (evidence-gated admission per store), `scope_redact` (per-repo namespace and secret stripping), `score_retrieval` (relevance × recency × importance with hard scope filters first), `inject_budget` (top-k memory cards under a token slice), `apply_lifecycle` (promotion, decay, deduplication, falsification), and `audit_memory` (the MemoryStats instrument of Section 6). Every one is deterministic software on CPU. The target is explicit and checkable: the write pipeline, the cue index, the retrieval scorer, the budget, the namespace, the redaction, and the lifecycle are software on CPU, and the L column holds at most one entry — the distillation call that contributes the model's only legitimate value (extracting a transferable, evidence-bound lesson from a raw episode), never the storage, indexing, retrieval, or retirement decisions. Any proposed addition that would put a language model elsewhere in the pipeline — having the model decide what is worth remembering, rank retrievals by feel, decide whether an injected memory helped, or veto a retirement — is a regression against the Piper rule and must clear the same bar as in earlier components: beat the deterministic stage on the honest metrics of Section 6, on held-out tasks, at a defensible cost, or be rejected. The invariant is stated again so it can be enforced mechanically: **"the L column contains at most one entry."** ## 5. Recursive Self-Improvement Protocol Component 20 of 27 follows the program's uniform protocol: the executable specification is written to 100%, round 1 lands at approximately 80% of the specified behavior, and later rounds close the gap. Each round is A/B-gated against the honest metrics of Section 6 — above all retrieval precision and the successful-after-use rate — never the end-to-end resolve rate alone. The three-way split disciplines every change: distillation goes to the LLM's single entry (extracting the lesson from an episode), mechanics go to deterministic software (the record, the cue index, the scorer, the budget, the namespace, the lifecycle), and every change to either is A/B-gated on honest metrics, never on vibes. Because memory decides what past experience even reaches the current decision, its improvement protocol measures the PRECISION and COST of the library rather than trusting the model's sense that "memory helped," improving itself in four loops. First, *retrieval calibration*: the harness measures whether the scored function actually surfaces the memory that would have helped — whether an injected card was used in the solution and whether the card that would have prevented a known failure ever surfaced — and reweights the three factors accordingly, guided by Park et al.'s ablation that each factor earns its place [3] and by ReasoningBank's demonstration that more retrieval is not better [4]; a scorer whose top-k is always full but rarely used is a similarity engine, not a memory. Second, *distillation quality*: the harness measures the survival rate of distilled rules — what fraction of promoted rules and skills fire again and help — and tightens the evidence gates where survival is low, guided by ExpeL's promotion discipline [19] and Voyager's verification gate [27]; a distillation step that produces rules nobody reuses is generating prose, not lessons. Third, *lifecycle honesty*: the harness measures whether harmful memories are actually retired and whether stale memories decay on schedule, guided by CTIM-Rover's demonstration that a wrong lesson acts as noise [20] and by the MemoryStats falsification rule; a store that never retires anything is accumulating, not learning. Fourth, *budget efficiency*: the harness measures the token cost per actually-used memory and whether advice-flooding is occurring — top-k always filled regardless of relevance — guided by ContextSniper's token-efficiency claim [14] and SWE Context Bench's "unfiltered hurts" result [21]; a memory layer whose injection budget is always exhausted is spending context on interference. Because every injected card carries its MemoryStats record and every episode carries its evidence, a regression in the memory layer is visible in the precision and cost metrics before it surfaces as a wrong decision, and each A/B change must justify itself on held-out tasks at a defensible cost before it ships. ## 6. Measurement & Evaluation Episodic memory is measured *separately* and *honestly*, because a stage whose whole purpose is to improve future decisions can be defeated in either of two opposite ways: by injecting memories that help (and claiming credit for the underlying model), or by injecting memories that hurt (and claiming neutrality because "more context can't hurt" — it can, and ReasoningBank [4] and SWE Context Bench [21] both measured it). The instruments keep the library accountable to what each memory actually contributed and what it cost, not to the count of stored episodes. **Retrieval precision.** The primary instrument reports, for every injected memory card, whether it was actually used in the solution — whether the final patch, diagnosis, or decision cites or is consistent with the card's lesson — versus whether it sat in the context unused. A library whose top-k is always full but never used is scoring similarity, not transfer, and this instrument drives the retrieval-calibration loop of Section 5. **Successful-after-use rate.** The companion instrument reports, of all used memories, what fraction preceded a successful outcome and what fraction preceded a failure. This is the MemoryStats core — retrieved, used, successful-after-use, harmful — and it is the Piper rule's last clause made quantitative: a memory that does not improve future outcomes is revised or retired, and this number names exactly which ones. **Promotion survival rate.** The instrument reports what fraction of promoted rules and skills fire again and help, versus how many were promoted once and never retrieved again. A low survival rate means the distillation gate is too loose — the model is generating rules that read well and transfer nothing — and it drives the distillation-quality loop. **Lifecycle honesty (falsification and decay).** The instrument reports how many harmful memories were retired, how many stale memories decayed on schedule, and how many duplicates merged, versus how many should have been (the audit computes the counterfactual from the MemoryStats record). A store that never retires anything is a warehouse accumulating noise, and the instrument verifies the lifecycle is actually running, not merely defined. **Budget efficiency.** The instrument reports the token cost per actually-used memory and the distribution of injection budgets — how often the top-k was filled versus how often the smallest high-confidence set (often one) was returned. This measures the thesis's clause that retrieval returns the smallest high-confidence experience: a memory layer that always exhausts its budget is spending context on interference, the failure SWE Context Bench measured [21]. **Scope-violation rate.** The instrument reports how often the hard scope filters fired — cross-repo or cross-phase candidates blocked before similarity — and how often a contamination incident was raised by `scope_redact`. A zero rate is not proof of safety; it is a signal to check that the namespace partition is actually installed, because a cross-repo leak is a security incident, not an indexing bug (P7). **Evidence-gate rate.** The instrument reports, of all distilled rules, what fraction carried resolvable evidence citations and what fraction were admitted as bare claims. A distillation step whose rules cannot cite their evidence is producing unfalsifiable prose, and the gate rate is the number that keeps the store grounded in what the attempts *proved* rather than what the model *said*. **Memory on/off ablation.** The instrument runs the memory layer on and off per task class and reports the difference — the cleanest causal reading of whether the library helps, borrowed from the discipline of SWE Context Bench [21] and CTIM-Rover [20]. A library whose ablation shows no improvement, or harm, is a cost with a plausible story, and the ablation is the number that prevents the story from being mistaken for the effect. A failure-mode audit closes the positive instruments by naming how an episodic library lies. *Transcript hoarding* is everything stored, nothing indexed — retrieval returns noise and the agent learns to ignore memory entirely. *Cue mismatch* is episodes stored by content and queried by symptom — the one relevant past fix never surfaces, encoding specificity violated [23]. *Poisoned memory* is a success misattributed to the wrong factor, promoting a bogus rule that ships in every future task — error propagation at library scale. *Fighting the last war* is a surface-similar episode hijacking retrieval, the agent rerunning a strategy from a different context — memory lock-in. *Stale memory* is the repo evolved but the library did not, old invariants firing wrongly and their accumulating false alarms discrediting the store wholesale. *Advice-flood* is top-k always filled regardless of relevance — the distractor economics of the context row, wearing a helpful badge. *Cross-task contamination* is client A's pattern leaking into client B's task — scoped namespaces skipped once, remembered forever. Two honest caveats close the section. First, the strong-pipeline numbers of Section 2 — ReasoningBank's 39.0 → 49.7 ablation [4], Structurally Aligned's +4.7pp [7], ExpeRepair's 60.3% Lite [10], PMCoder's +5.0pp [8] — were measured on repositories and models far larger than a weak-model harness controls, and a weak model should expect materially smaller absolute effects while leaning all the harder on the typed stores, the scope filters, and the smallest-high-confidence discipline to make its small budget count. Second, all memory metrics must be reported on held-out and out-of-benchmark tasks, as in the earlier components, so a library that has memorized a task set's answers cannot score well on retrieval precision without its usefulness having been measured on problems it never saw. ## 7. Conclusion Episodic coding memory is where a coding harness's most expensive loss is committed in its most invisible form: the experience that was never retrievable, because it was stored as a conversation indexed by its own content, and injected as advice the model neither needed nor questioned. This paper has argued that a coding agent's memory should preserve evidence-grounded experience rather than conversation history, and that a weak-model harness must therefore run a typed, cue-indexed, scope-filtered, budgeted, and measured library deterministically — storing every attempt, distilling transferable lessons only under an evidence gate, retrieving only the smallest high-confidence relevant experience, learning from failures and successes alike, and retiring whatever stops earning its context. The thesis that has governed every design choice is the one with which this paper began and closes: **Episodic coding memory should preserve evidence-grounded experience rather than conversation history: retain immutable records of coding episodes, distill successful strategies, failed approaches, causal mistakes, and reusable invariants into compact typed memories, index them by both semantic applicability and coding-harness subtask, retrieve only the smallest high-confidence experience relevant to the current decision, learn from both positive and negative trajectories, and continually measure whether each memory improves future outcomes so noisy, obsolete, or harmful lessons can be revised or retired.** And the rule that compresses that thesis into one sentence of discipline for Piper is: **Do not remember the old conversation. Remember what the old coding attempt proved.** The model distills — its single learned contribution is to extract the transferable lesson from a raw episode, never to decide what is stored, indexed, retrieved, or retired. The harness remembers — the episode record, the cue index, the scored retrieval, the scope namespace, the budget, and the lifecycle are deterministic software, because a memory that a weak model could flatter into staying is not a memory, it is a prior. The architecture holds the invariant mechanically: the L column contains at most one entry, and the deterministic library is the default. The measured message of the literature is unambiguous — Reflexion showed failure can alter later behavior through a bounded memory buffer without retraining, and that forgetting is a policy rather than a defect [1]; Generative Agents showed retrieval is a scored, tunable function whose factors each earn their place [3]; ReasoningBank showed one relevant experience lifts success from 39.0 to 49.7 while more retrieved memories pull it back down to 46.0, 45.5, and 44.4 [4]; Structurally Aligned Subtask-Level Memory showed whole-task episodes are too coarse and memory must be aligned to the active subtask [7]; CTIM-Rover showed episodic memory ported to real repositories can act as pure noise [20]; SWE Context Bench showed correctly selected summarized experience helps while unfiltered history hurts [21]; and Tulving and Thomson showed, before any of this, that retrieval succeeds in proportion to the match between the cue and the encoding context — you index for the query you will face, not the content you have [23]. For a weak model, a pasted conversation is a distractor field with a reassuring shape; what a weak-model harness needs is a deterministic, typed, cue-indexed, scope-filtered, budgeted library that knows exactly which lesson each attempt proved — because the question is never whether the old conversation was saved, but whether the old attempt's proof was preserved, indexed by the cue the next decision would actually supply, retrieved only when it was the smallest high-confidence experience that mattered, and retired the moment it stopped helping. --- ## References 1. Noah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. *Reflexion: Language Agents with Verbal Reinforcement Learning.* NeurIPS 2023. arXiv:2303.11366. *(The bounded episodic buffer: reflections alter later behavior without weight updates, 91% pass@1 HumanEval; sliding window of 1–3 reflections; within-task, unindexed.)* 2. Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E. Gonzalez. *MemGPT: Towards LLMs as Operating Systems.* arXiv 2023. arXiv:2310.08560. *(Memory hierarchy with self-editing memory operations; the read/write/edit/search interface.)* 3. Joon Sung Park, Joseph C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, and Michael S. Bernstein. *Generative Agents: Interactive Simulacra of Human Behavior.* UIST 2023. arXiv:2304.03442. *(Recency × importance × relevance retrieval function; reflection as memory compaction.)* 4. Siru Ouyang, Jun Yan, I-Hung Hsu, Yanfei Chen, Ke Jiang, Zifeng Wang, Rujun Han, Long T. Le, Samira Daruki, Xiangru Tang, Vishy Tirumalashetty, George Lee, Mahsan Rofouei, Hangfei Lin, Jiawei Han, Chen-Yu Lee, and Tomas Pfister. *ReasoningBank: Scaling Agent Self-Evolving with Reasoning Memory.* ICLR 2026 Poster. arXiv:2509.25140. *(Distills strategies from successes and failures; retrieval ablation 39.0 → 49.7 with one experience, then 46.0 / 45.5 / 44.4 with 2/3/4.)* 5. Chen Qian, Yufan Dang, Jiahao Li, Wei Liu, Zihao Xie, Yifei Wang, Weize Chen, Cheng Yang, Xin Cong, Xiaoyin Che, Zhiyuan Liu, and Maosong Sun. *Experiential Co-Learning of Software-Developing Agents.* ACL 2024, pp. 5628–5640. arXiv:2312.17025. *(Shortcut-oriented experience mined from historical trajectories and reused on unseen tasks.)* 6. Zora Zhiruo Wang, Jiayuan Mao, Daniel Fried, and Graham Neubig. *Agent Workflow Memory.* ICML 2025. arXiv:2409.07429. *(Induces abstracted workflows from trajectories; abstracted workflows transfer where raw replay does not.)* 7. Kangning Shen, Jingyuan Zhang, Chenxi Sun, Wencong Zeng, and Yang Yue. *Structurally Aligned Subtask-Level Memory for Software Engineering Agents.* arXiv 2026. arXiv:2602.21611. *(Subtask-aligned memory; +4.7 pp mean Pass@1, +6.8 pp Gemini 2.5 Pro.)* 8. Jiahao Zhang, Yifan Zhang, and Yu Huang. *Coupling Planning with Episodic Memory in LLM Agents for Software Issue Resolution.* arXiv 2026. arXiv:2608.06811. *(PMCoder; plan-memory coupling and stuck detection; +5.0pp SWE-bench Verified.)* 9. Silin Chen, Shaoxin Lin, Yuling Shi, Heng Lian, Xiaodong Gu, Longfei Yun, Dong Chen, Lin Cao, Jiyang Liu, Nu Xia, and Qianxiang Wang. *SWE-Exp: Experience-Driven Software Issue Resolution.* arXiv 2025. arXiv:2507.23361. *(Experience-driven reuse for issue resolution.)* 10. Fangwen Mu, Junjie Wang, Lin Shi, Song Wang, Shoubin Li, and Qing Wang. *ExpeRepair: Dual-Memory Enhanced LLM-Based Repository-Level Program Repair.* FSE 2026. DOI 10.1145/3808181. arXiv:2506.10484. *(Dual episodic+semantic store; 60.3% SWE-bench Lite corroborated; 74.6% Verified flagged uncorroborated.)* 11. Benzhao Wu, Zhiwen Luo, Fangwen Mu, and Lijun Xiang. *TwinMem-Agent: Episodic and Semantic Memory for Repository-Level Program Repair.* SIGSOFT FSE Companion 2026, pp. 1447–1451. DOI 10.1145/3803437.3807664. *(No arXiv ID; role-specific semantic entries and validation-before-storage.)* 12. Kaixiang Wang, Yidan Lin, Zihan Wang, Bunyod Suvonov, Zhaojiacheng Zhou, Yuxiang Zheng, Jiaxi Cao, Zhiheng Dong, Chentao Wu, Jiong Lou, and Jie Li. *E-mem: Multi-Agent Based Episodic Context Reconstruction for LLM Agent Memory.* ICML 2026. arXiv:2601.21714. *(Episodic context reconstruction in place of destructive compression.)* 13. Boshi Wang, Weijian Xu, Yunsheng Li, Mei Gao, Yujia Xie, Huan Sun, and Dongdong Chen. *Improving Code Localization with Repository Memory.* ICLR 2026. arXiv:2510.01003. *(RepoMem; git/commit history as the repository's own episodic memory.)* 14. Chiwang Luk, Matin Mohammad Najafi, Zhifeng Jia, Wei Yang, Xiuchang Li, Jinwei Zhu, Yang Ren, Lei Chen, and Gao Cong. *ContextSniper: AntTrail's Token-Efficient Code Memory for Repository-Level Program Repair.* arXiv 2026. arXiv:2607.01916. *(arXiv preprint, not an ACM venue; token-efficient code memory.)* 15. Ripon Chandra Malo and Tong Qiu. *PROJECTMEM: A Local-First, Event-Sourced Memory and Judgment Layer for AI Coding Agents.* arXiv 2026. arXiv:2606.12329. *(Memory-as-governance; ~800–1,500 vs 5,000–20,000 tokens; 207 events / 10 projects.)* 16. Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav. *Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory.* ECAI 2025. arXiv:2504.19413. *(Production-ready long-term memory baseline.)* 17. Shengtao Zhang, Jiaqian Wang, Ruiwen Zhou, Junwei Liao, Yuchen Feng, Zhuo Li, Yujie Zheng, Weinan Zhang, Ying Wen, Zhiyu Li, Feiyu Xiong, Yutao Qi, Bo Tang, and Muning Wen. *MemRL: Self-Evolving Agents via Runtime Reinforcement Learning on Episodic Memory.* arXiv 2026. arXiv:2601.03192. *(Runtime RL over the episodic store; the memory itself is the object of learning.)* 18. Xiangru Tang, Tianrui Qin, Tianhao Peng, Ziyang Zhou, Daniel Shao, Tingting Du, Xinming Wei, Peng Xia, Fang Wu, He Zhu, Ge Zhang, Jiaheng Liu, Xingyao Wang, Sirui Hong, Chenglin Wu, Hao Cheng, Chi Wang, and Wangchunshu Zhou. *Agent KB: Leveraging Cross-Domain Experience for Agentic Problem Solving.* arXiv 2025. arXiv:2507.06229. *(Pooled cross-domain experience; reason-retrieve-refine loop.)* 19. Andrew Zhao, Daniel Huang, Quentin Xu, Matthieu Lin, Yong-Jin Liu, and Gao Huang. *ExpeL: LLM Agents Are Experiential Learners.* AAAI-24. arXiv:2308.10144. *(Insight rules + case retrieval; the dual-memory design CTIM-Rover tested.)* 20. Tobias Lindenbauer, Georg Groh, and Hinrich Schütze. *From Knowledge to Noise: CTIM-Rover and the Pitfalls of Episodic Memory in Software Engineering Agents.* arXiv 2025. arXiv:2505.23422. *(The negative result: episodic memory as noise on real repositories.)* 21. Jiayuan Zhu, Junde Wu, Minhao Hu, Shengda Zhu, Jiazhen Pan, Weixiang Shen, Yijun Yang, Fenglin Liu, Jianye Hao, Yueming Jin, Qirong Ho, and Min Xu. *SWE Context Bench: A Benchmark for Context Learning in Coding.* arXiv 2026. arXiv:2602.08316. *(Selected summarized experience helps; unfiltered hurts. Lite = 300 + 99 related; full = 1,100 + 376.)* 22. Endel Tulving. *Episodic and Semantic Memory.* In E. Tulving and W. Donaldson, eds., *Organization of Memory*, Academic Press, 1972, pp. 381–403. *(Non-arXiv book chapter.)* 23. Endel Tulving and Donald M. Thomson. *Encoding Specificity and Retrieval Processes in Episodic Memory.* Psychological Review, 80(5), 1973, pp. 352–373. *(Correct journal; not Journal of Experimental Psychology. Non-arXiv.)* 24. Roger C. Schank. *Dynamic Memory: A Theory of Reminding and Learning in Computers and People.* Cambridge University Press, 1982. *(Non-arXiv book.)* 25. Agnar Aamodt and Enric Plaza. *Case-Based Reasoning: Foundational Issues, Methodological Variations, and System Approaches.* AI Communications, 7(1), 1994, pp. 39–59. DOI 10.3233/AIC-1994-7104. *(Non-arXiv; the retrieve–reuse–revise–retain cycle.)* 26. Theodore R. Sumers, Shunyu Yao, Karthik Narasimhan, and Thomas L. Griffiths. *Cognitive Architectures for Language Agents.* arXiv 2023. arXiv:2309.02427. *(Working/episodic/semantic/procedural taxonomy.)* 27. Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar. *Voyager: An Open-Ended Embodied Agent with Large Language Models.* TMLR. arXiv:2305.16291. *(Verification-gated skill library; zero weight updates.)* 28. Shengnan An, Zexiong Ma, Zeqi Lin, Nanning Zheng, Jian-Guang Lou, and Weizhu Chen. *Learning From Mistakes Makes LLM Better Reasoner.* ICLR 2024. arXiv:2310.20689. *(The distillation exit: memory → fine-tuning corpus → weights.)* 29. Wei-Chieh Huang, Weizhi Zhang, Yueqing Liang, Yuanchen Bei, Yankai Chen, Tao Feng, Xinyu Pan, Zhen Tan, Yu Wang, Tianxin Wei, Shanglin Wu, Ruiyao Xu, Liangwei Yang, Rui Yang, Wooseong Yang, Chin-Yuan Yeh, Hanrong Zhang, Haozhen Zhang, Siqi Zhu, Henry Peng Zou, Wanjia Zhao, Song Wang, Wujiang Xu, Zixuan Ke, Zheng Hui, Dawei Li, Yaozu Wu, Langzhou He, Chen Wang, Xiongxiao Xu, Baixiang Huang, Juntao Tan, Shelby Heinecke, Huan Wang, Caiming Xiong, Ahmed A. Metwally, Jun Yan, Chen-Yu Lee, Hanqing Zeng, Yinglong Xia, Xiaokai Wei, Ali Payani, Yu Wang, Haitong Ma, Wenya Wang, Chenguang Wang, Yu Zhang, Xin Eric Wang, Yongfeng Zhang, Jiaxuan You, Hanghang Tong, Xiao Luo, Xue Liu, Yizhou Sun, Wei Wang, Julian McAuley, James Zou, Jiawei Han, Philip S. Yu, and Kai Shu. *A Survey of Agent Memory in the Second Half: Towards Self-Evolving and Long-Horizon Agents.* TMLR Survey Certification. arXiv:2602.06052. *(Current title; earlier circulated as "Rethinking Memory Mechanisms of Foundation Agents in the Second Half.")*