Controlled Recursive Self-Improvement Runtime for Cross-Domain LLM Agents
Not only get stronger — improve how you get stronger.
English | 中文
RSIAgent is an independent Rust controlled recursive self-improvement runtime. It decouples online task execution from offline self-evolution governance: coding assistants, general-purpose agents, and trusted hosts (such as Claude Code, Cursor, Codex, Antigravity, OpenCode, and custom business agents) connect over MCP, HTTP, and CLI into a unified, local-first single-writer runtime (Prepare → Feedback → Proposal → Evaluation → Release → Application). Under strict role boundaries, root budgets, and independent acceptance gates, experience turns into lasting, inheritable improvements to both task skills (Skill) and the meta-improvement strategy itself (Improver). Focus on your business logic — without rebuilding self-improvement infrastructure for every scenario.
Engineering Baseline: Normative plan v4.3 (2026-10-12, SHA-256
73dd00bf5ef6e9757d0c391c9a8be4ca92b6e06a750aacb542817f82cbd208a7). That plan body stays off this remote.
Current Status: As of 2026-10-16, core engineering is roughly 80% complete (maintainer estimate) and approaching end-to-end verification; engineering progress does not imply acceptance pass or measured benefit. Public evidence is tracked in the implementation ledger and the derived support index. Do not claim measured recursive gains, a production host, or a complete E00–E18 route.
Today, “agent improvement” usually means ad-hoc reflection prompts or a skill library that only grows (Add only) — inflating latency while injecting noisy or conflicting instructions (library drift). Inspired by dual-process cognitive architectures (System 1 fast execution + System 2 slow evolution), RSIAgent splits runtime execution and recursive evolution into two loops with distinct latency and authority boundaries:
External Task Agents / Multi-Host Clients (Claude Code / Cursor / Codex / Antigravity / Custom Agents)
│ MCP (stdio/remote) · HTTP · CLI
▼
┌──────────────────────────────────────────────────────────────────────┐
│ RSIAgent Runtime (Rust) — One Runtime · Single-Writer Data Plane │
│ │
│ [System 1 · Online Fast Loop] Prepare Snapshot ──► Task Execution │
│ ──► Feedback & 4-Stage Application │
│ Receipts (zero evolution block) │
│ │ │
│ ▼ Untrusted evidence store │
│ [System 2 · Offline Slow Loop] Learnable Failure Attribution │
│ ──► Replay / Offline Simulation │
│ ──► Proposal & Counterexamples │
│ ──► Independent Evaluator Acceptance │
│ ──► Approval / Canary / Active │
└──────────────────────────────────────────────────────────────────────┘
| Dimension | System 1: Online Task Execution Loop (Fast Path) | System 2: Controlled Recursive Evolution Loop (Slow Path) |
|---|---|---|
| Responsibility | Assemble a bounded active skill snapshot for the task goal + host capabilities, and record verbatim execution traces | Identify learnable failures from accumulated traces; generate, replay, filter, and evaluate new candidates offline |
| Model Overhead | Zero extra LLM calls by default (ToolOnly snapshot assembly); never blocks the host's critical path |
Asynchronous job scheduling strictly bounded by root budgets (Budget) and recoverable leases |
| Target Objects | Frozen read-only active snapshot + append-only stage facts and receipts | Versioned Skill (task method) and Improver (evo.strategy.v1 meta-improvement strategy JSON) |
| Safety Boundary | External inputs and traces are treated strictly as untrusted data, never executable instructions or self-authorization | Independent Evaluator acceptance + human approval / canary / atomic release; candidates never self-approve |
Drawing on long-horizon productivity and software-engineering memory design, RSIAgent avoids storing vague summaries or unpruned skill dumps. Every task trace feeds a two-layer pipeline with bidirectional provenance and a version-evolution chain:
| Layer | What It Records | Admission Policy | Structure & Governance Contract |
|---|---|---|---|
Fact Layer (StageFact & Receipts) |
What the run actually did: goal, tool trace, success/failure class, and four-stage application receipts | Zero-threshold verbatim retention (append-only immutable records) | Tracks Returned → Attached → Observed → VerifiedBenefit; preserves both positive and negative outcomes |
Asset Layer (Skill & Improver) |
Reusable approaches for future tasks (Skill) and meta-strategies for future refinement (Improver) | High-threshold gated admission (must pass counterexample checks & independent evaluation) | Skill: narrow text skill (evidence + applicability boundary + counterexample) Improver: evolvable strategy JSON ( evo.strategy.v1) governing how experience is refined, filtered, and accepted |
- Bidirectional Provenance & Cascading Revocation: Every derived candidate (
SkillorImprover) is cryptographically and relationally bound to its upstream stage facts and evidence IDs. If upstream evidence is tainted or revoked, the runtime cascades revocation and cleanup across derived assets so active state remains auditable and recoverable. - Full-Lifecycle Skill Maintenance (Not “Add Only”): Skills are versioned candidates with a full lifecycle. RSIAgent tracks downstream contribution via
Applicationreceipts, caps active skills perPreparesnapshot, and prunes or retires low-utility assets based on measured usefulness rather than age.
In long-horizon coding and complex tool use, plain text summaries inevitably drop reverted attempts, negative trajectories, and intermediate revisions no longer present at HEAD. RSIAgent enforces exact evolutionary lineage:
- Bounded Atomic Edits & State Evolution Chain: Candidates progress through
Proposed → Validated → AcceptancePassed → Approved → Canary → Active(plusRetired / Rejected / Revoked), preserving the exact diff and rationale of each revision rather than overwriting history in place. - First-Class Counterexamples: Every skill proposal must state explicit applicability boundaries and counterexamples so future runs know both when to apply and when not to apply a method.
- Structural vs. Effective Recursion: Modifying the improvement mechanism (Structural Recursion) is tracked separately from proving that the new
Improverproduces higher-utility successor skills under equal budget, held-out generalization tasks, and non-regression checks on previously solved work (Effective Recursion).
These levels score who controls improvement decisions and evolutionary depth, not raw base-model IQ:
| Level | Name | In RSIAgent Terms |
|---|---|---|
| B0 | Intra-task correction | Fix the current output only — no lasting cross-session candidate |
| L1 | Execution autonomy | Apply human-prescribed lasting updates (skills or policy patches) within governed bounds |
| L2 | Strategy autonomy | Choose among allowed improvement methods (evo.strategy.v1 Improver) |
| L3 | Experience acquisition | Decide what to learn or practice next from Feedback failure classes and learner state |
| L4 | Environment adaptation | Continuously adjust from four-stage Application receipts (Attached → Observed → VerifiedBenefit) |
| L5 | Recursive meta-improvement | Evolve the Improver itself — how experience is refined, filtered, and accepted — and inherit that procedure in subsequent generations |
Grounded in the normative RSIAgent v4.3 Engineering Implementation Plan, this project advances an independent Rust implementation informed by the following research papers and open-source engineering systems:
-
Dream-RSI: Recursive Self-Improvement through Evolving Worlds (Paper)
arXiv:2609.14858 · v1: Informs generation–exploration decoupling, historical exploration replay, offline “dreaming” simulation, and strategy filtering.
Institutions: Google, Google DeepMind, University of Maryland (UMD), University of Virginia (UVA); authors include Tong Zheng, Zheng Zhang et al. -
The Last AI Built by Humans: Toward Genuine Recursive Self-Improvement (Paper)
arXiv:2609.11873 · v2: Informs the B0–L5 RSI autonomy taxonomy, learner-state-conditioned experience acquisition (L3), and cross-generation inheritance & meta-refinement of the improvement procedure (L5).
Institutions: Shanghai Jiao Tong University, Theseus Labs, Tsinghua University, ByteDance, ModelBest, Xiaohongshu, Shanghai AI Lab, Humanlaya, Agent-Native Research Lab, Frontis.AI; authors include Zhiyuan Liu, Bowen Zhou, Guoliang Li, Fan Wu et al. -
Memory Beyond Recall & Tencent-Hunyuan/Hy-Memory (Paper & Open-Source System)
arXiv:2606.09483 (EMNLP 2026) and Tencent Hunyuan's open-source Hy-Memory / MemHub: Informs the System 1 / System 2 cognitive division, the two-layerSession Fact ↔ Reusable Experiencepipeline with bidirectional provenance, the version-evolution diff-chain philosophy for coding trajectories, and the local-first single-writer cross-host runtime model. -
RSI-Harness (pinned commit
33c4f8df) & Microsoft SkillOpt (pinned commit79124b37)
Inform versioned asset management, historical experience distillation, trajectory attribution, and bounded skill refinement; upstream runtimes are not transplanted wholesale, nor are upstream benchmark numbers claimed as proof of effect for this repository.
A closed structural loop, independent benefit evidence, and a safely deployable product are three independent gates — none substitutes for the others.
- One Runtime, Single-Writer Data Plane, Multi-Host Isolation
A shared data-directory single writer serializes persistent mutations, paired with a safe read-only SQLite reader for inspection. Access is isolated bynamespace,actor, and five explicit roles (Agent/Host/Evaluator/Admin/Worker). - Experience Must Prove Real Downstream Utility
The runtime separatesReturned → Attached → Observed → VerifiedBenefitreceipts, combines positive and negative evidence with preserved counterexamples, and rejects model self-reports as proof of learning. - Predictions Must Face Held-Out Reality (Early Reject Allowed, Early Approve Forbidden)
Historical replay and offline simulation serve bounded candidate screening only. Formal benefit requires independent evaluation across fixed protection anchors and rotated held-out tasks under min-sample, gain-floor, regression-cap, and full cost-ratio constraints. - Evolution Never Bypasses Governance
Root budgets, lease recovery, human approval, and atomic release govern every state transition. Candidates are restricted to evolvable text andevo.strategy.v1JSON — never arbitrary executable code, unsupervised auto-publishing, or unbudgeted paid model calls.
git clone https://github.com/acosmi/RSIAgent.git && cd RSIAgent
cat docs/implementation-ledger.mdThe CLI entry (apps/rsia) strictly separates agent tool surfaces from authenticated management and review operations (default bootstrap disables external model transport and uses ToolOnly capabilities; without configured HTTP authentication, sensitive requests fail closed with 503):
rsia serve— serves the authenticated HTTP API and remote MCP transport (--binddefaults to127.0.0.1:7788,--datatorsia.sqlite3,--namespacetodefault).rsia mcp— runs the four agent MCP tools over stdio with a startup-fixed Agent identity (--datadefaults torsia.sqlite3,--namespacetodefault,--actortostdio-agent).rsia manage <operation>— submits or inspects authenticated management and evolution jobs (--urldefaults tohttp://127.0.0.1:7788; requires--auth-tokenorRSIA_MANAGEMENT_TOKEN; supports--request-fileand--job-id).rsia review --kind <typed_candidate|stage_fact|formal_report> --id <id> [--detail metadata|exact]— inspects stored candidates, stage facts, and formal reports over the authenticated read-only review path.
- Start Runtime — run RSIAgent over HTTP or stdio MCP.
- Prepare — submit task goal + host capabilities → receive a version-locked active skill snapshot.
- Execute Task — run the task inside your host agent without evolution-path blocking.
- Feedback — report outcome and failure class (reasoning, domain knowledge, tool-use, etc.).
- Proposal — learnable failures trigger asynchronous improvement jobs producing candidates with evidence, applicability bounds, and counterexamples.
- Evaluate & Release — independent
Evaluatoracceptance →Approved→Canary→Active. - Application Receipts — subsequent runs record
Returned → Attached → Observed → VerifiedBenefit.
apps/rsia CLI & daemon entry (serve / mcp / manage / review)
crates/evo-core Pure domain contracts, role permissions, state machines & acceptance rules
crates/evo-storage Single-writer persistence, read-only inspection, lineage & budget ledger
crates/evo-engine Controlled improvement jobs, replay evaluation & candidate evolution
crates/evo-mcp MCP adapter (agent tools isolated from management surfaces)
crates/evo-http Authenticated HTTP service & remote MCP transport
docs/ Implementation ledger, dependency register & operations notes
G0–G5 staged gates and V001–V120 verification scenario families advance scope by scope: starting from end-to-end configuration-priority localization tasks, then expanding to historical replay, curriculum learning, L5 meta-improvement controlled experiments, cross-host compatibility, fault recovery, and deployment safety.
This repository is a runtime and contract surface, not a model-weight training codebase or an official reproduction of the cited papers or reference repositories. We thank the respective researchers and open-source contributors.
Present in this tree (scoped, through PR #184):
- Workspace crates
evo-core,evo-storage,evo-engine,evo-mcp,evo-http, and thersiaCLI (serve/mcp/manage/review) - Domain contracts for roles, budgets, candidates, acceptance, and four-stage receipts
- Implementation ledger plus derived support index (
plan_versionv4.3, route not complete, legacy equivalence unverified) - Shared data-directory single writer, safe read-only SQLite reader, single-source management registry, real
control.reviewroute, fail-closed seed classification, bad-clock persistence guard, pinned toolchain and locked build inputs, project license metadata and guards, redacted bound-request identity, and locked dependency license provenance
Not claimed (as of 2026-10-16):
- A complete E00–E18 route, or whole scenario families V099–V120 (those families remain
planned) - Independent second acceptance
- A live external model provider, paid experiments, a live external host, or a production sandbox
- Production approval, canary, or
Activebacked by non-production evaluation - Measured effective recursion gains, or a formal production release (recorded increments are at
implemented_not_verifiedor earlier; default monetary budget is0; E17 and E18 remain optional and disabled)
RSIAgent is source-available under a research- and community-friendly non-commercial license (source_available_personal_noncommercial_free). The root LICENSE governs all grants: personal learning, academic and scientific research, educational use, benchmarking, and internal non-commercial technical evaluation (by individuals, universities, research institutions, non-profits, or engineering teams) are free of charge; open-source forking, academic reproduction artifacts, and non-commercial community sharing of modifications are permitted provided the original copyright notice and LICENSE are retained; deploying RSIAgent in commercial production operations, offering it as a paid or managed cloud/SaaS service, or embedding/distributing it in commercial products or revenue-generating services requires prior written authorization from Acosmi (fushihua@acosmi.com, https://acosmi.com). Third-party licenses and notices remain applicable to their corresponding material. Workspace crates remain unpublished.
