Agents rewrite their own code and it works

Philipp Schmid published a technical review that breaks the notion of recursive self-improvement into concrete steps: agents examine failed runs, edit their own tools, capabilities and harness code, and retain only the changes that succeeded. The critical point is not the ability to modify code but the ability to preserve the correct modification.
According to Schmid, “the hard part is to keep what works.” In tool-call experiments with LLaMA 3.2, the model refused to perform a task in all three runs, generating 122 tokens of apology in free text that were unparseable. When a grammar constraint that prevents the model from refusing in prose was imposed, all three calls succeeded. The lesson is that the agent must learn that a refusal leads to a grammar constraint, not to a larger model.
The loop Schmid describes consists of three already-existing components: a monitoring mechanism that analyzes failed runs, a code editor that can modify the definitions of the tools themselves, and a filter that decides which change is incorporated into the next version. None of these require a new architecture; they run today on open models and open-source infrastructure. The novelty lies in wiring them into a closed loop that operates without human intervention.
This differs from classic prompt engineering in the target of modification. Here the model does not merely rewrite instructions; it rewrites the tool code, the skill definitions, and the harness code that connects them. When the agent encounters a recurring failure—such as a broken response format—it can add validation, alter a schema, or replace a library, then rerun to verify that the fix succeeded. The change is to the execution environment, not to the input prompt.
Schmid notes that the current mechanism still depends on a human-defined notion of “what works,” expressed through reward functions or pre-written acceptance tests. The agent does not set its own objective but searches for a path that satisfies the given goal. Moreover, no demonstration yet shows a long chain of improvements without intervention; most examples are single fixes that close a specific failure. The next step is to show that the loop can accumulate improvements over dozens of iterations without degradation.
If the loop stabilizes, it will shift the engineer’s role from writing harness code and fixing format bugs to defining success metrics while the agent closes the gap. This is not a replacement of developers but a transfer of “plumbing” work to the model, allowing humans to focus on architecture and policy. Schmid gives no target date, but the infrastructure is already in place, and the next step is scaling integration and testing.