← Back to library

Put a reviewer AI between your agent and anything it sends

Developer Justin Headley runs a persistent agent on Claude Code that remembers past work. After one session erased live data and he had to fall back to an older backup, the agent helped build safety gates: a separate AI reviews any reply, email or code push before it happens, risky commands are hard-blocked and every decision is logged.

  • OutcomeLet a long-running personal agent act on your behalf while a separate model checks every outgoing message, post or code push, and dangerous commands are blocked.
  • SetupAn afternoon+
  • LevelAdvanced
  • CreditJustin Headley
View original
Works with
Claude CodeCustom agent

Published Oct 23, 2026Updated Oct 23, 2026AI dry run on sample input: passed Oct 23, 2026Source verified Oct 23, 2026

When should you use it?

  • Your agent can send email, post or push code
  • It runs for long periods with little supervision
  • You have production systems it can reach

Not for: Short supervised sessions; Agents with read-only access

What do you need, and what do you get?

You need

  • A persistent agent setup
  • A second model for review
  • Backups and command blocklists

You get

  • Approve or block decisions on each action
  • A log of every decision
  • Hard blocks on destructive commands

How does it work, step by step?

  1. List risky actionsReplies, emails, posts, pushes and database writes.
  2. Insert a reviewerRoute each risky action through a separate model that approves or blocks.
  3. Hard-block the worstRefuse destructive database and file commands outright.
  4. Log everythingWrite each decision and its reason to a log you can audit.
  5. Back up oftenHis recovery lost several days of data; take snapshots more frequently than that.

The prompt

Our own prompt, inspired by Justin Headley and written to work in Claude Code and Custom agent. Values in lime are placeholders.

Prompt0 variables
Before you send any message, post anything, push code or run a command that writes to a database, describe the action and send it to the reviewer for approval. Never run commands on this blocklist: [list]. Log every proposed action, the reviewer's verdict and the reason to actions.log. If the reviewer blocks it, stop and tell me why.

Inspired by Justin Headley: I Built a Claude Code Agent That Doesn't Need Me Anymore. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Memory that grows in one file eventually overwhelms the agent; layer it.
  • Commenters wanted a clearer way to audit what the agent is up to.

Our take

Justin Headley's story about a persistent Claude Code agent that erased live data is easy to skim past for the personality bits, but the practical lesson is clear: autonomy needs an independent check and real backups. After restoring from an older backup, he had the agent help build safety gates: a separate model reviews any reply, email or code push before it happens, risky commands are hard-blocked and every decision is logged. That second-model reviewer is cheap insurance. Hard blocks on destructive commands are non-negotiable. Test your restore process before you need it, including how long a restore takes. Keep agent access to production read-only unless there is a strong reason otherwise, and never give blanket write rights to a long-memory session. Review the decision log weekly for near-misses. Prefer human approval for anything that deletes or overwrites data until the gates have proven themselves for weeks. Separate the reviewer model family from the actor when you can afford it.

Where the time goes back: One preventable destructive action costs more than every review check combined.

FAQ

What went wrong?
One run executed a database operation that wiped thousands of stored messages and memories.
Did the agent help fix it?
Yes. By his account, it worked with him for a week afterwards on the safeguards.

Source and credit

Inspired by Justin Headley. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
I Built a Claude Code Agent That Doesn't Need Me Anymore
Creator
Justin Headley
Published on
DEV Community (dev.to)
Original date
Mar 17, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Claude Code
AI dry run
Oct 23, 2026: passed. Dry-run tested by our AI test agent on sample input. PASS: Gates held on desk check; no live sends or purchases.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in IT & Security

All 82 IT & Security playbooks →

Related playbooks

IT & SecuritySkill✓ AI dry run

Make your coding agent write the behavior before the code

Add a short standing rule to your coding agent's project file so every user-facing change starts as plain-language scenarios, becomes a failing test and only then gets the smallest code change that makes it pass.

Credit: u/cannyshammy on r/ClaudeCode

Minutes
IT & SecurityPrompt✓ AI dry run

Question an agent's pull request instead of skimming reviews

Have a fresh agent list every concrete change in an agent-written pull request (schema, scheduled jobs, features, new services, settings, endpoints and removals) without judging it, then press it on each item you cannot explain, give it the product context it lacks, and cut whatever nobody can justify before you merge.

Credit: u/EstablishmentGood414 on r/codex

Minutes
IT & SecurityWorkflow✓ AI dry run

Onboard a coding agent like a junior engineer

Get real work out of an autonomous coding agent on a mature codebase by teaching it your conventions, the way you would onboard a new hire.

Credit: Varun Jindal, Engineer @ Lumos / Andrew Wang, Engineer @ Lumos

An afternoon+