# MOSS: Source-Level Self-Rewriting for Agents _MOSS enables AI agents to self-rewrite their source code, achieving significant performance gains and overcoming limitations of text-based evolution._ **Published:** 2026-05-22 **Source:** https://www.startuphub.ai/ai-news/ai-research/2026/moss-source-level-self-rewriting-for-agents --- Current autonomous agentic systems suffer from a critical inflexibility: once deployed, they remain static, unable to learn from user interactions or fix recurring failures without manual intervention. Existing self-evolving agents, while a step forward, are limited to text-mutable artifacts like prompts and skill files, leaving the core agent harness untouched. This pr[event](/ai-news/technology/2026/openclaw-event-at-github-hq)s the system from addressing structural failures embedded in code, such as routing or hook ordering. The researchers propose that true self-evolution requires source-level adaptation, a fundamentally more general and robust approach. Static Agent InflexibilityDriver From the article 2 mentionsCurrent autonomous agentic systems suffer from a critical inflexibility: once deployed, they remain static, unable to learn from user interactions or fix recurring failures without manual intervention.leads toText-Based Evolution LimitsDriveronly text artifacts like prompts and skills can be evolvedaddressed byMOSS SystemCoreenables source-level self-rewriting for AI agentsFrom the article 9+ mentionsThis paper introduces MOSS, a system designed for self-rewriting at the source code level within production agentic substrates.Source-Level AdaptationContextoperates on the actual agent code, not just text configurationsFrom the article 2 mentionsThe researchers propose that true self-evolution requires source-level adaptation, a fundamentally more general and robust approach.Overcoming LimitationsEffectaddresses structural failures in core agent harness codeTuring-Complete PowerContextfundamentally more general and robust approach to agent evolutionFrom the articleThis approach is inherently more powerful because source-level adaptation is Turing-complete, a strict superset of any text-mutable scope.Performance LeapOutcomesignificant gains demonstrated in real-world scenariosFrom the articleThis significant improvement showcases the practical impact of enabling agents to evolve at the source code level, moving beyond static deployments and text-based adjustments to achieve more dynamic and effective performance. ## Beyond Textual Artifacts: The Power of Source-Level Adaptation This paper introduces [MOSS](https://arxiv.org/abs/2605.22794v1), a system designed for self-rewriting at the source code level within production agentic substrates. Unlike previous methods confined to text-based configurations, MOSS operates on the actual code. This approach is inherently more powerful because source-level adaptation is Turing-complete, a strict superset of any text-mutable scope. It ensures deterministic evolution, unaffected by the long-context drift that can plague base-model compliance, and addresses a class of failures previously inaccessible through text modifications alone. ## MOSS: A Deterministic Pipeline for Agentic Evolution MOSS implements a structured, multi-stage pipeline for its self-rewriting process. Each evolution cycle is triggered by an automatically curated batch of production failure evidence. While a pluggable external coding-agent CLI handles the actual code modification, MOSS maintains control over stage ordering and final verdicts. Candidate code is rigorously verified by replaying the failure batch in ephemeral trial workers. Successful candidates are then deployed through a user-consent-gated, in-place container swap, with a health-probe-gated rollback mechanism ensuring system stability. This meticulous process underpins the reliability of [MOSS self-rewriting agents](https://arxiv.org/abs/2605.22794v1). ## Demonstrated Performance Leap in Real-World Scenarios The efficacy of MOSS is clearly demonstrated on the OpenClaw platform. In a single, unsupervised evolution cycle, the system successfully lifted the mean grader score across four tasks from a baseline of 0.25 to 0.61. This significant improvement showcases the practical impact of enabling [agents](/ai-news/ai-video/2025/composios-self-evolving-agents-tackle-ais-tooling-bottleneck) to evolve at the source code level, moving beyond static deployments and text-based adjustments to achieve more dynamic and effective performance. --- Original analysis from [startuphub.ai](https://www.startuphub.ai), the #1 AI startup directory.