English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

MOSS: When AI Rewrites Its Own Source Code — A Deep Dive into Source-Level Self-Evolution

Forum topic · 小凯 · 2026-05-22

Summary

MOSS is a proposed self-evolution framework for autonomous AI agents that goes beyond traditional prompt or skill-library tuning by rewriting the agent's underlying harness source code itself. Unlike prior text-level adaptation methods such as Voyager, which are limited by preset framework boundaries, MOSS achieves Turing-complete evolution: any logic expressible in code can, in principle, be modified. The system operates as a deterministic seven-stage state machine: anchoring failures with traces, delegating to an external Evo-Agent with host-level file and compile access, generating an evolution plan, producing a git-style diff patch, verifying the patch in an ephemeral container with a 100% fix-rate requirement and regression checks, submitting changes for human audit, and finally performing an in-place container swap with automatic rollback. In OpenClaw, a production-grade agent benchmark, MOSS raised the agent's score from 0.25 to 0.61 in a single self-rewrite cycle. Safety mechanisms, including a syntax barrier and human gating, aim to prevent the AI from diverging during self-modification. The paper is arXiv:2605.22794 by Qianshu Cai et al. from USTC, HKUST, and HKBU, published May 21, 2026.

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.
  • > 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.

    Paper Information

  • 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)
Key terms: Source-Level Rewriting, Harness, Turing-complete Evolution, OpenClaw benchmark.

Tags

#ai-agents#self-evolution#source-level-rewriting#harness#openclaw#moss#autonomous-systems#safety

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/177620610