Recursive Self-Improvement: Letting AI Agents Inherit Their Evolution Memory Across Models
As AI agents move to new model families, the engineering layer around them—prompts, tool policies, guardrails—often fails to transfer, sometimes performing worse than an unoptimized baseline. This article examines why that happens: optimization history gets compressed into static rules that lose the reasoning, evidence, and boundaries behind them. It introduces Continual Recursive Self-Improvement (CRSI) and Self-Improvement Memory (SIM), a structured, auditable memory layer that lets optimizers record not just what changed, but why, with what evidence, and under what conditions—enabling safer, more reliable knowledge transfer across model generations.
1. The Real Object of Optimization in the Agent Era: Not Weights, but the “Harness”
As large language models iterate rapidly, engineering teams increasingly focus their effort not on the hundreds of billions of parameters inside the model, but on the execution layer wrapped around it—commonly called the “harness.” This layer consists of system prompts, tool definitions and calling protocols, context-trimming strategies, failure retry and interception rules, output validators, and similar engineering assets.
The value of this harness lies in constraining a general-purpose model into a stable, reliable executor for a specific task. In most engineering practice, recursive self-improvement means having an optimizer—usually itself a model—repeatedly read execution traces and evaluation feedback, then automatically rewrite this harness, rather than touching the underlying weights. Editing prompts, adding or removing tools, and adjusting interception thresholds cost far less than retraining or fine-tuning, and can compress iteration cycles from weeks to hours.
The problem is that this harness is tightly coupled to the behavioral characteristics of a specific model. A widely observed phenomenon in the industry: a harness that has been extensively tuned and scores well on one model family can, when moved directly to a more capable model family, perform worse than that new model’s unoptimized baseline harness. Many teams treat a model upgrade as a “free improvement,” only to find their old optimization assets turn into a liability.
2. Root Cause: Experience Gets Compressed into “Results,” and the “Reasons” Get Discarded
This degradation isn’t a model capability problem—it’s a knowledge representation problem. During cross-model migration, typically only the final artifacts survive: a pile of rules, a handful of interceptors, a few carefully tuned prompts. The critical information that originally justified these artifacts is lost:
- Missing change intent: There’s no record of which specific failure case each rule was originally added to fix.
- Missing validation evidence: There’s no record of how many samples a rule was validated on, how much it improved results, or what confidence level it achieved.
- Missing applicability boundaries: The preconditions a rule depends on—a particular input distribution, a specific tool response format—were never explicitly stated.
- Missing counter-examples: Approaches that were already proven ineffective, and why, were never preserved.
When a new optimizer inherits a screen full of rules that all look important, it can only make localized, guesswork-based edits. Two typical failure patterns emerge: it removes defensive code meant to guard against a critical flaw, treating it as redundant, which causes previously fixed issues to resurface; or it re-proposes and re-runs an approach already proven ineffective, wasting significant iteration budget. Together these compound into a degradation loop where optimization makes things worse.
The conclusion is clear: cross-model migration doesn’t fail because experience is inherently non-transferable—it fails because that experience was stored as an uninterpretable static artifact.
3. CRSI and SIM: Turning Optimization History into an Inheritable, Structured Asset
The core idea behind Continual Recursive Self-Improvement (CRSI) is to add a persistent memory layer—Self-Improvement Memory (SIM)—on top of the existing “optimizer–execution framework–evaluation” loop.
It’s worth emphasizing that SIM is not a conversation history, nor a simple append-only log. It’s a structured development log designed to be readable, searchable, and auditable by the optimizer. Each memory entry should independently answer four questions: what changed, why it changed, what the evidence is, and when it should not be applied.
A sample memory entry structure:
{"mem_id": "M-2026-0417-013","model_family": "family_A","model_generation": "gen-3","target": "harness/tool_policy.yaml#retry_on_timeout","change_type": "add_guard","intent": "Tool calls that timed out without retry caused long-running tasks to fail entirely","evidence": {"eval_set": "regression-500","before": 0.61,"after": 0.74,"sample_size": 500,"confidence": "high"},"preconditions": ["Tool response is structured JSON", "Timeout threshold < 30s"],"counter_examples": ["M-2026-0402-007: Increasing concurrency had no effect and amplified timeouts instead"],"transfer_hint": {"model_agnostic": true,"risk": "low","notes": "A general reliability fix, unrelated to any specific model"}}
The transfer_hint field is key to cross-model inheritance: it explicitly marks whether a piece of experience is a “model-agnostic fix for a general defect” or a “behavioral correction tailored to a specific model’s output habits.” The former can be prioritized for transfer; the latter needs re-validation.
4. Execution Flow for Cross-Model Migration
In practice, this can be implemented as a five-step closed loop:
- Memory retrieval: When a new model is brought online, retrieve high-confidence memories by task type and
model_agnosticflag, rather than injecting the full memory store, to avoid context bloat. - Diff comparison: Compare the preconditions of candidate memories against the new model’s observed behavior, flagging entries that may no longer hold.
- Controlled injection: Compile only the memories that pass filtering into the initial harness, attaching each rule’s source
mem_idto keep it traceable. - Regression validation: Run the baseline on a fixed evaluation set first, then the inherited version, confirming it performs no worse than the new model’s native, unoptimized harness.
- Write-back and status update: Newly generated experience continues to be written into SIM; disproven entries are marked invalid rather than deleted, preserving their value as counter-examples.
Sample code:
def build_initial_harness(mem_store, task_type, new_model):mems = mem_store.search(task_type=task_type, min_confidence=0.8)kept = [m for m in memsif m.transfer_hint.model_agnosticand check_preconditions(m.preconditions, new_model)]harness = compile_rules(kept) # each rule carries its mem_idassert regression(harness) >= baseline(new_model) # anti-regression gatereturn harness
5. Anti-Regression Gates and Observability
The biggest risk in cross-generation inheritance is inheriting bad experience. Evaluation must therefore be a hard gate, not just a reference metric: use a fixed regression set, fixed random seeds, and log the score delta and confidence interval for every change. If scores drop or variance widens, automatically roll back to the previous harness version. Logging and monitoring should also connect each mem_id to the production call chain, so that if a rule causes an elevated error rate, it can be pinpointed and disabled on the fly. Memory assets themselves should be version-controlled in object storage, with changes broadcast to execution nodes via a message queue to keep multiple instances consistent.
6. Capability Boundaries and Realistic Expectations
It’s worth stating plainly: this mechanism improves the efficiency of reusing experience—it does not give the model new capabilities on its own. It cannot exceed the capability ceiling of the base model, and transfer effectiveness is constrained by task similarity, evaluation set quality, and how precisely preconditions are specified. Memory growth also introduces retrieval noise, requiring periodic deduplication, merging, and archiving of invalid entries. Its real value is partially replacing a brute-force, compute-scaling approach with accumulable, auditable engineering asset reuse—so that bringing a new model online no longer means starting from zero, but building on a structured historical record.
In platform environments such as Baidu AI Cloud, the general-purpose infrastructure this approach requires—container platforms to host optimizers and executors, object storage for versioned memory, and logging and monitoring systems to support traceability—are all standard offerings. Teams can focus their effort on designing the memory structure and building the evaluation gates. For developers, there’s one concrete thing to start doing now: make sure every rule the optimizer writes comes with a “why.”
