Introduction: Stuck in the Cage of 'Language'
Today's AI agents can orchestrate tools and strategies, but their ceiling is ultimately set by their underlying harness — the low-level code managing lifecycle, tool calls, and state transitions. Existing self-evolution approaches mostly tinker with *what the model thinks* (prompts) and *what it calls* (skill libraries). If the harness itself is broken, prompt-level fixes are like a general trying new tactics with broken bones and severed meridians: no strategy can compensate.
MOSS breaks through this barrier by enabling source-level rewriting: the agent performs surgery on its own underlying driver code.
From Text Adaptation to Source Refactoring
| Dimension | Traditional self-evolution (e.g., Voyager) | MOSS | | :--- | :--- | :--- | | Modification target | Prompts, tool descriptions, task flows | Harness source code, routing logic, hook ordering | | Theoretical ceiling | Bounded by preset framework | Turing-complete (any computable logic modifiable) | | Stability | Prone to context drift | Highly deterministic; code is truth | | Evolution depth | Skin-level tweaks | Marrow-level reconstruction |
> Note — Turing-completeness: the evolution method can theoretically realize any computable logical change; if it can be written in code, MOSS can rewrite it.
The Seven-Stage Evolution Pipeline
MOSS follows a rigorous deterministic state machine:
1. Failure Anchoring — Collect evidence of failures:
\(E_{fail} = \{(\text{Input}, \text{Trace}, \text{Error})\}\)
tracing the exact line of harness logic that caused the crash.
2. External Delegation — A dedicated Evo-Agent runs on the host machine with broad privileges: reading/writing files, compiling code.
3. Evolution Planning — The Evo-Agent reasons about the fix: reversed message routing? misconfigured async locks?
4. Diff Generation — Produces a real git diff patch.
5. Ephemeral Verification — The patch is tested in a temporary container by re-running the failed cases. It passes only if the fix rate is \(R_{fix} = 100\%\) with no regressions.
6. Human Audit — All changes are transparent and human-reviewable via the interface.
7. In-place Container Swap — A daemon smoothly replaces the old container:
\(C_{old} \xrightarrow{\text{health-check}} C_{new}\)
with automatic rollback if the new container fails health checks.
Results on OpenClaw
Evolution gain is measured with: \(G = \frac{S_{post} - S_{pre}}{T_{cycles}}\)
- Initial score: 0.25 (broken routing logic throughout)
- Post-evolution score: 0.61 — a single self-rewrite cycle transformed the agent.
- Title: MOSS: Self-Evolution through Source-Level Rewriting in Autonomous Agent Systems
- arXiv:
2605.22794 - Published: May 21, 2026
- Authors: Qianshu Cai, Yonggang Zhang, Xianzhang Jia, Wei Xue, Jun Song, Xinmei Tian, Yike Guo
- Institutions: University of Science and Technology of China (USTC), Hong Kong University of Science and Technology (HKUST), Hong Kong Baptist University (HKBU)
> Note — OpenClaw: a high-difficulty agent benchmark simulating complex production-grade tasks.
Discussion: When AI Gains the Right to Amend Its Contract
MOSS marks a shift from AI as a *contract-follower* to a *contract-reviser*: the agent can refactor its own code when it finds it flawed or slow — an embryonic self-organizing system. To guard against self-modification going astray, MOSS introduces a Syntax Barrier and human gating, ensuring evolution stays on rails.