Recursive Self-Improvement for AI Agents: Why Experience Memory Matters When Models Change
This article explains why agent harnesses tuned on one model often underperform on the next, and how Continual Recursive Self-Improvement (CRSI) turns one-off optimization into a reusable asset. It covers the five components of a CRSI framework, a structured Self-Improvement Memory (SIM) design with hypothesis, evidence, verdict, and invalidation entries, and a step-by-step process for migrating rules across models. You will also find practical guidance on avoiding common pitfalls, rollback gates, and lightweight implementation using versioned configs, logging, object storage, and queues.
1. The Starting Point: Why Agent Frameworks Break After a Model Upgrade
Once agent engineering is in full swing, the place where teams invest the most effort is often not the model itself, but the “engineering shell” wrapped around it: system prompts, tool descriptions, parameter validation, retry policies on failure, context trimming rules, output format constraints, interceptors, and safety guardrails. The industry generally refers to this layer as the Harness—think of it as a suit of armor fitted around the model.
Since the vast majority of teams cannot modify the underlying weights of models with hundreds of billions of parameters, so-called “self-improvement” almost always happens at the Harness layer in practice: an optimizer repeatedly runs tasks, observes failures, edits prompts and rules, and then runs regression checks. After hundreds or thousands of iterations, this armor is polished to fit the behavioral habits of that particular model very closely.
The real pain appears the moment you switch models. A Harness that was repeatedly tuned on the previous generation of strong models, with great-looking metrics, may score even lower on a new model than the new model’s “out-of-the-box initial version” when migrated directly. The reason is not mysterious: what gets migrated is only the “result”—the code and configuration—while the “reason” behind every change is entirely lost: why this rule was added, why context is trimmed this way, which approaches have already been proven ineffective.
The model taking over the optimization task faces a screen full of complex rules and can only guess intent from surface semantics, so typical failures follow:
- Deleting special-case logic that was added to fix a critical defect, treating it as redundant code;
- Reimplementing an approach that was long ago proven ineffective, wasting a large amount of iteration budget;
- Repeatedly changing the same piece of logic back and forth, forming an oscillation loop where “the more you optimize, the worse it gets”;
- Hidden conflicts arising between rules, with the regression pass rate declining monotonically as iterations increase.
This explains a common phenomenon: the stronger the model’s capabilities, the faster old assets depreciate, and teams fall into a cycle of “starting from zero with every upgrade.”
2. From RSI to CRSI: Turning One-Off Optimization into a Sustainable Asset
The core of Recursive Self-Improvement (RSI) is to make the improvements a system produces feed back into the efficiency of the next improvement, forming a positive feedback loop. The idea mentioned in the source material—that experience can be inherited across model families—is not, in technical essence, mystical “memory inheritance.” It upgrades the optimization process from “keeping only the artifacts” to “artifacts plus traceable decision rationale.”
A practical framework for Continual RSI (CRSI) usually contains five components:
- Tasks and evaluation sets: fixed, reproducible benchmark tasks, hidden cases, and regression sets that serve as the sole judge of improvement.
- Optimizer: the agent responsible for proposing changes, running experiments, and comparing metrics.
- Candidate Harness: the set of prompts, tools, and rules being rewritten, existing as versioned files.
- Self-Improvement Memory (SIM): a structured record of the hypothesis, evidence, and conclusion for each change.
- Selector: makes keep/rollback decisions among multiple candidate versions, preventing degraded versions from entering the mainline.
The key is item 4. It is not a chat log, nor a simple cache of conversation history, but a highly structured “engineering journal” that lets the optimizer understand “why” when taking over unfamiliar code.
3. Designing the SIM Structure: Making Experience Readable, Searchable, and Verifiable
It is recommended to split SIM into four types of entries, each short, atomic, and linked to evidence:
- Hypothesis: what problem this change aims to solve and how metrics are expected to move.
- Evidence: evaluation data before and after the change, failed sample IDs, elapsed time, and invocation cost.
- Verdict: adopt, rollback, or conditional adopt, along with the preconditions under which it takes effect.
- Invalidation: the model behavior characteristics and task distributions under which this conclusion no longer holds.
Illustrative structure (field names are only a generic design example):
{"memory_id": "ctx-trim-017","hypothesis": "Context bloat in long tasks increases the tool selection error rate","change": "Truncate tool return results by relevance, keeping the first 20 lines of the error stack","evidence": {"pass_rate_before": 0.61, "pass_rate_after": 0.74, "samples": 120},"verdict": "adopt","scope": {"task_type": "multi_tool", "context_len": ">32k"},"invalidation": "When the model itself has stable long-context selection ability, the benefit of this rule decreases and it needs to be re-evaluated"}
There are three engineering practices. First, entries must be atomic: one memory carries only one conclusion, avoiding “mixed bag” entries that cannot be partially inherited. Second, they must carry invalidation boundaries—this is precisely the guardrail that keeps cross-model migration from crashing. Third, memory must be searchable: tag it by task type, failure mode, and model behavior characteristics, and when taking over a new model, recall only the relevant subset instead of pouring all history into the context.
4. The Right Way to Migrate Across Models
Cross-model inheritance is not wholesale transfer of old rules, but “explain first, then selectively inherit.” The recommended process is as follows:
- Attribution review: have the optimizer read the SIM and output a mapping table of “rule—reason—dependent assumption.”
- Dependency assessment: identify which rules depend on specific defects of the old model (such as unstable formatting or a tendency to hallucinate tool calls); these are likely to be burdens on the new model.
- Layered migration: inherit model-agnostic general engineering constraints (input validation, timeouts, idempotent retries, least privilege) first; isolate special cases strongly tied to model behavior behind toggleable configuration.
- Small-step validation: run a regression subset for each inherited rule, and roll back immediately if metrics do not improve.
- Reverse write-back: entries that fail validation on the new model must be written back to the SIM with the invalidation reason noted, to avoid repeating the same pitfall next time.
Three metrics can indicate whether “real evolution” is happening: the number of iterations needed to reach the same score, the first-day score retention rate after cross-version migration, and the average time to locate regression failures. Only when all three improve at the same time does it show that the memory mechanism is producing compound returns.
5. Common Pitfalls and Implementation Advice
The first pitfall is turning SIM into a pile of logs. A running account without conclusions and invalidation boundaries will only crowd out context and mislead the optimizer. The second is letting the optimizer change multiple places at once. Only by changing one variable at a time can you form a credible evidence chain. The third is lacking a hard rollback gate. It is recommended to set an automatic policy of “roll back if metrics do not improve,” leaving protection of the mainline version to the process rather than the model’s own discretion.
For teams that want to build this capability themselves, the implementation path can be lightweight: use versioned configuration to manage the Harness, use a general logging service and object storage to store memory entries and evaluation artifacts, use a message queue to drive the pipeline of “generate candidates—run evaluation—aggregate conclusions,” and use monitoring and alerting to track iteration curves and cost anomalies. If using relevant general capabilities from Baidu AI Cloud, it is likewise recommended to keep “reproducible evaluation + structured memory + automatic rollback” as the main line, rather than chasing single-shot prompt tricks.
The conclusion is clear: models will be replaced, and the asset that truly accumulates is optimization experience that is explainable, verifiable, and selectively inheritable. Write down the “why,” and recursive self-improvement turns from a slogan into sustainable engineering compound interest.
