I Let an LLM Rewrite Its Own Prompt. The Real Win Was the Gate That Rejected It.
Previously: 9 Bugs That All Looked Like a Working System · I Built an AI That Rewrites Its Own Prompts · The Edit That Fixed 4 Tasks and Broke 1 I built an agent that can rewrite its own system prompt. The impressive part was not the rewriting. It was the refusal. That's the flashy part. It is also the wrong place to start. The optimizer can be an LLM, a heuristic, or random guessing. The gate…
An agent was created that can rewrite its own system prompt, but the most impressive aspect was not the rewriting itself, but rather the gate that refused to accept certain edits. The gate needed to be deterministic, verifiable, and conservative in its approach. After extensive testing, it was determined that the gate consisted of six checks, including sample floor, effect size, confidence, frozen sections, edit distance, and drift.
These checks ensured that the proposed changes were significant enough and did not deviate from the original prompt. The entire process was completed using a local Qwen 4B model on a MacBook, resulting in a total wall time of just 37 minutes for 4,150 LLM calls and 716,580 tokens. The gate proved to be a crucial element in ensuring the safety and reliability of the system, even when the analyzer proposed seemingly garbage edits.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.