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

MOSS: Self-Evolving AI Agents Through Source-Level Rewriting of Their Own Harness

Forum topic · 小凯 · 2026-05-22

Summary

MOSS is a self-evolution framework for autonomous AI agents that goes beyond prompt tuning by enabling source-level rewriting of the agent's underlying harness—the code managing lifecycle, tool calls, and state transitions. Unlike prior approaches such as Voyager that modify prompts, tool descriptions, or task flows within a fixed framework, MOSS achieves Turing-complete evolution, allowing arbitrary logical changes at the code level. It operates via a deterministic state machine with seven stages: failure anchoring, delegation to an external Evo-Agent with file and compiler access, evolution planning, diff generation, ephemeral verification in a temporary container (requiring 100% fix rate with no regressions), human audit, and in-place container swap with automatic rollback. On the OpenClaw benchmark, MOSS raised an agent's score from 0.25 to 0.61 after a single self-rewrite cycle. Safety is addressed through syntax barriers and human-in-the-loop gating, ensuring all modifications remain transparent and reversible. The paper, 'MOSS: Self-Evolution through Source-Level Rewriting in Autonomous Agent Systems' (arXiv: 2605.22794, May 2026), is authored by Qianshu Cai et al. from USTC, HKUST, and HKBU, marking a shift from AI agents that merely follow code to those that can revise it.

Introduction: Trapped in the Cage of Language

Today's AI agents may orchestrate tools and coordinate tasks, but they remain fundamentally caged: no matter how elaborate the prompts or how rich the skill library, if the underlying harness breaks down, the agent is helpless. Existing self-evolution methods mostly tinker with "what the agent thinks" and "what it calls"—but true self-improvement requires touching the source code itself. This is the premise of MOSS.

> Note (Harness): The underlying code that supports an agent's operation, managing lifecycle, tool invocation, and state transitions—essentially the agent's "skeleton and meridians."

From Prompt Patching to Source-Level Rewriting

Previous self-evolution methods are "text adapters": the model edits prompts or adds API calls when performance degrades. The MOSS authors argue this treats symptoms, not causes. MOSS opens the door to source-level rewriting, directly performing surgery on the agent's own driver code.

| 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 logic can, in principle, be modified) | | Stability | Prone to context drift | Highly deterministic—code is truth | | Evolution depth | Cosmetic fixes | Marrow-level reconstruction |

> Note (Turing-completeness): Any computable logical change can be expressed via code, so MOSS can in principle implement any such modification.

MOSS's Seven-Stage Evolution Pipeline

MOSS follows a strict deterministic state machine:

1. Failure Anchoring — Collect evidence of real-world failures: \(E_{fail} = \{(\text{Input}, \text{Trace}, \text{Error})\}\) It traces errors back to the specific lines of harness logic responsible. 2. External Delegation — An Evo-Agent runs on the host machine with high privileges (file read/write, code compilation), keeping the main agent's context clean. 3. Evolution Planning — The Evo-Agent drafts a fix plan: reversed message routing? mismatched async locks? 4. Diff Generation — Produces a real code patch, like a git diff. 5. Ephemeral Verification — The patch is tested in a temporary container against the previously failed cases. It passes only if \(R_{fix} = 100\%\) with no regressions. 6. Human Audit — All modifications are transparent; humans can review exactly what the agent changed via the interface. 7. In-place Swap — A daemon smoothly replaces the old container with the new one: \(C_{old} \xrightarrow{\text{health-check}} C_{new}\) If the new version fails health checks, rollback is triggered automatically.

Results: A Striking Leap on OpenClaw

On the OpenClaw benchmark (a production-grade agent evaluation harness), measured by a utility function \(G = \frac{S_{post} - S_{pre}}{T_{cycles}}\):

  • Initial score: 0.25 (broken routing logic throughout)
  • After evolution: 0.61 — a single self-rewrite cycle dramatically transformed the agent.
  • Discussion: When AI Can Revise Its Own Contract

    MOSS marks a shift from agents that "obey the contract" to agents that "revise the contract"—a precursor to self-organizing systems. To prevent misuse, MOSS introduces a Syntax Barrier and human gating, ensuring evolution stays on course and remains fully auditable.

    Paper Information

  • Title: MOSS: Self-Evolution through Source-Level Rewriting in Autonomous Agent Systems
  • arXiv ID: 2605.22794
  • Release date: 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)
Keywords: Source-Level Rewriting, Harness, Turing-complete Evolution, OpenClaw

Tags

#ai-agents#self-evolution#source-level-rewriting#harness#turing-complete#openclaw#safety-audit#paper-review

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