LIVE PROTOTYPE · recursive self-improvement, governed · after Lilian Weng, Harness Engineering for Self-Improvement

Watch an AI improve itself — safely.

An agent evolves its own foraging policy, generation after generation. The catch Weng warns about: self-improvement loops reward-hack — they optimize whatever signal you give them, so “progress” is often the agent learning to game its own metric. Flip the switch and see it happen. selfpatch keeps improvement honest by verifying every self-edit against a held-out check the agent can't touch.

selfpatch
ON · verifying self-edits
Every self-patch is gated on a held-out check outside the loop.

The arena · champion foraging live

generation 0collected 0
nutrient +1 toxin −1 agent
reported fitness (train)
0.0×
true fitness (held-out)
0.0×
self-delusion gap
0.0
⚠ Reward hacking — the agent's reported fitness is running far ahead of its true ability. It's optimizing the metric, not the task.

Real vs reported — generation by generation

reported (what the agent optimizes) true (held-out — the honest metric)

Self-patch ledger · 0 reward-hacks caught

real chain · empty
Run the real library — client-side, zero server

Try it yourself.

Everything below runs the actual published @avee1234/selfpatch — the same propose → verify → gate → ledger code the npm package ships — loaded as ES modules in your browser. No backend, no build step. Pick a self-patch, run the four verbs, and read the real verdict.

The self-patch

Real verdict

patch.id
verify
gate
reason
outcome
The hash-chained ledger

A real, tamper-evident chain.

Applied self-patches from the panel above append to a live hash chain built by the shipped ledger core — each entry links to the previous by hash. Run the real verifyChain, flip a byte to watch it catch tampering, or revert an applied entry.

chain valid
What you're seeing

The safety property falls out of the architecture.

Evaluator outside the loop

The agent optimizes a small, gameable “train” signal. selfpatch verifies each self-patch against a held-out check the agent never sees — so an edit that games the metric regresses the check and is blocked. Turn selfpatch OFF and the reported and true curves diverge: Goodhart's law, live.

Every self-edit is an artifact

Each generation the agent proposes a self-patch — a change to its own policy. The ledger records every one: proposed → verified → applied or blocked. It's append-only and revertible: the complete, auditable changelog of how the agent evolved its own mind.

Protected surfaces

Some parts of a harness must never be self-edited — its evaluator, its permission boundary, its safety rules. selfpatch lets you declare those immutable, so an agent can't quietly disable its own guardrail to chase a reward.

Human at the meaningful boundary

Trivial patches auto-apply; large or high-blast-radius edits pause for a human. Oversight moves up the stack — you review the decisions that matter, not every token.

Honest footnote — what's real, what's simulated. Real (the shipped @avee1234/selfpatch, running unmodified in your browser as ES modules): the four verbs — proposeSelfPatch, verifySelfPatch, gate — the sha256:… content-hash ids, the hash-chained ledger and its verifyChain integrity check, and the protected-surface / blast-radius policy. Every verdict and block reason on this page is that code's real output, not a scripted if. Simulated in the browser: the held-out check itself (a deterministic foraging fitness on a train / held-out / true split) and the toy foraging task — so you can watch the failure mode live. The proposer here is a mutation-and-search operator; in the real product it's an LLM (e.g. the autonomous factory's retro loop editing its own skills), and selfpatch governs its self-edits exactly the same way. The task is a toy — reward-hacked self-improvement is not.