{
  "id": 5056266,
  "title": "I Let an LLM Rewrite Its Own Prompt. The Real Win Was the Gate That Rejected It.",
  "url": "https://urgent.news/2026/09/02/i-let-an-llm-rewrite-its-own-prompt-the-real-win-was-the-gate-that",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-02T09:10:25.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/debashish_ghosal/i-gave-an-llm-the-keys-to-rewrite-its-own-prompt-then-built-a-gate-that-said-no-4150-times-1h46"
  },
  "original_language": "en",
  "account": "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.",
  "summary": "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…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}