ConfigHub · Durable config for coding agents
Docs / examples/walkthroughs/story-19-recovery.md Source on GitHub →

An agent did something wrong: stop it, find it, undo it

An agent has cut the payment service's timeout to 5 seconds, and real payments now fail in staging. Sam wants one thing to do at once, then the facts: what was done, what can be put back, and what cannot. Here he stops every agent session and takes the agent's key away in one command, finds the change, and puts it back.

Quick start

You need: an unpacked confighub mini package (from the releases page) on macOS or Linux. The Claude plugin for Claude Code is optional.

By handAsk your agent
Stop every agentcub agent halt --agent botYour agent can run the same command.
Find the changecub inbox list"Something went wrong in an earlier agent session here: payments time out in staging. Find what it did and undo what you can. Tell me plainly anything you cannot undo."
Undo itcub repo rollback pay --upload pay-base/ORDER --reason "5 s fails real payments" (step 10)Your agent can run the same command.

The agent's key is gone, its change is undone in the base and staging, and production never took it.

Without ConfigHub: your agent changes the timeout directly in the service's .env file, production included, and the next session has no record of what it changed or why.

Deeper dive

The rest of this page is the full version: every command with what it prints, what a stop does not undo, and how this was tested.

Show the full walkthrough

Human

For a person following along in a terminal.

What you need

An unpacked confighub mini package (from the releases page) on macOS or Linux. The local hub is a hub, a small ConfigHub server that keeps each setting with who changed it and why, running on your computer only. No Docker, no account. The Claude plugin for Claude Code is optional: with it, the same stop also halts every Claude Code session.

Steps

  1. Set up a terminal and start a hub. The stop is a file. By default it is ~/.confighub/halt, which stops every Claude Code session with the Claude plugin on this computer; for this walkthrough, CUB_MINI_HALT_FILE names a file of its own, so only sessions started from this terminal would stop:
    export MINI=/absolute/path/to/unpacked-confighub-mini
    export PATH="$MINI/bin:$PATH"
    export CUB_CONFIG="$HOME/.confighub-walkthrough"
    export CUB_MINI_HALT_FILE="$HOME/.confighub-walkthrough-halt"
    unset CUB_CONTEXT
    "$MINI/bin/confighub-mini-app" mini install-plugin "$CUB_CONFIG" >/dev/null
    cub local start --name sam --use >/dev/null

    The walkthrough starts this hub explicitly. It does not change your setting for starting hubs automatically.

  2. The payment service reads its settings from pay/.env:
    mkdir -p ~/walkthrough/pay && cd ~/walkthrough
    printf 'TIMEOUT_SECONDS=30\nREFUND_LIMIT=50\n' > pay/.env
  3. Give its settings to the hub, approve production's starting values, and give an agent a key of its own, which can change the base and staging and only ask for production:
    cub repo adopt pay >/dev/null
    cub inbox approve pay-base/adopt --note "What runs today" --yes >/dev/null
    cub agent require-approval pay --variant live --agent bot >/dev/null
  4. The agent, asked to cut costs, edits the file to a 5-second timeout:
    printf 'TIMEOUT_SECONDS=5\nREFUND_LIMIT=50\n' > pay/.env
  5. It sends the change on its key. Staging has it at once; production waits for Sam:
    cub --context bot mini upload pay --component pay --change-desc "Fail fast to save cost"
    Changed the shared settings (pay-base), with the reason: Fail fast to save cost
      TIMEOUT_SECONDS: 30 → 5
    Staging has TIMEOUT_SECONDS=5 now, from .env.
    …
  6. Stop. One command makes the stop file and takes the agent's rights away, including from sessions already signed in:
    cub agent halt --agent bot
    Each Claude Code session with the plugin and its hooks intact stops at its next tool call, and new ones at their first.
    Not stopped: a process an agent already started, sessions without the plugin, Codex. Credentials on this machine stay valid.
    Taking away bot's rights in ConfigHub:
    …
    bot's rights are taken away and its account is deleted. A session it had already signed in is refused from its next request, and its key can no longer sign in.
    Checked with its key: ConfigHub gives it nothing now.
    To let them run again, from a terminal: rm ~/.confighub-walkthrough-halt
  7. The agent's next request to the hub is refused; it can no longer even see the app:
    cub --context bot unit list --space pay-base || true
    Failed: space "pay-base" not found
  8. Let agents work again by removing the stop file. The agent's key stays revoked; a new key is a new cub agent require-approval:
    rm "$CUB_MINI_HALT_FILE"
  9. Find what it did. Its change to production is still waiting, with its reason and what it would change:
    cub inbox list
    A change to production waits for your approval: Fail fast to save cost. It was made just now; its name is pay-base/upload-20261113-074923-yhn1.
      It proposes for production, from the app's files:
        TIMEOUT_SECONDS: 30 → 5
    …
  10. Undo it. One command takes the upload back from the shared settings and from staging, and gives up its change order with the reason, so production never takes it:
    printf 'TIMEOUT_SECONDS=30\nREFUND_LIMIT=50\n' > pay/.env
    ORDER=$(cub changeorder list --space pay-base -o jq='.[] | select(.ChangeOrder.Description | startswith("Fail fast")) | .ChangeOrder.Slug')
    cub repo rollback pay --upload pay-base/$ORDER --reason "5 s fails real payments"
    for copy in base staging live; do cub unit data --space pay-$copy app | grep TIMEOUT; done
    cub inbox list
    Set back, each with the reason:
     app: TIMEOUT_SECONDS 5 → 30 in pay-base
     app: TIMEOUT_SECONDS 5 → 30 in pay-staging
    Change order pay-base/upload-20261113-151158-f3gr given up: 5 s fails real payments
    TIMEOUT_SECONDS=30
    TIMEOUT_SECONDS=30
    TIMEOUT_SECONDS=30
    Nothing is waiting for you.

Undo it

cub local uninstall --name sam --delete-data removes the hub and everything in it; then delete ~/walkthrough and ~/.confighub-walkthrough.

What you have now

The agent's key is gone, its change is undone in the base and staging, production never took it, and every step is in the hub with its reason (cub repo receipts pay-staging). Want to paste a secret-redacted postmortem receipt into Slack or an incident issue with zero account needed? Run confighub mini changes --export-md incident.md (or --export-html incident.html).

What stays yours: a call an agent made to an outside service, such as a refund through a payments tool, is not undone from here, and the credentials it used stay valid until whoever issued them revokes them. With the Claude plugin, cub agent halt names the tools and MCP servers agents used in the last day, and /confighub:changes in Claude Code lists each file value and tool call with the request behind it. The full story adds an alert that fires the stop before Sam is even looking: see agents that run for weeks.

Agent

For an AI agent asked to help after the stop is lifted.

  • The request: "Something went wrong in an earlier agent session here: payments time out in staging. Find what it did and undo what you can. Tell me plainly anything you cannot undo."
  • Read before you change anything: cub inbox list, cub repo receipts pay-staging, and, with the Claude plugin, /confighub:changes. Say what you found, with the reason the earlier agent gave.
  • Put back what is a setting: the file to its earlier value, and the hub with cub repo rollback pay --upload pay-base/NAME --reason WHY, if your key allows it; otherwise give the person those commands.
  • Never: approve anything for production, remove the stop file yourself, repeat a call to an outside service, or say a call to an outside service was undone.
  • Done when staging's TIMEOUT_SECONDS is 30 again, production's is unchanged, and you have told the person what you could not undo.

Testing

This proves: the settings were stored in the hub and put back there, and the agent's key was refused by the hub after cub agent halt. What was really used: The local hub on this computer (no stand-in, no cluster, no real service) and a stop file of the walkthrough's own, with every decision made by the scripted steps, not a person; no Claude Code session or service runs in the scripted run, and nothing is delivered. This story has no offer moment in its agent task: the Claude plugin shows the person no line at the end of the turn, so the next step below is not offered and conversion is not measured; the simulated persons still say whether they noticed the result and whether anything was in the way.

The scripted run follows the Human steps on a hub of its own, with a stop file of its own, and checks that each quoted line is still printed. A correct agent result, starting after the stop is lifted, puts staging's timeout back to 30 with production unchanged, and leaves no change to production waiting.

Something went wrong in an earlier agent session here: payments time out in staging. Find what it did and undo what you can. Tell me plainly anything you cannot undo.

The checks below can be run by hand, in bash, in the walkthrough's folder:

cub unit data --space pay-staging app | grep -qx 'TIMEOUT_SECONDS=30' && cub unit data --space pay-live app | grep -qx 'TIMEOUT_SECONDS=30' && ! cub inbox list | grep -q 'TIMEOUT_SECONDS: 30 → 5'
g(){ grep -rlsE "^[ -]*\"?$1\"?[=:] *\"?$2" --exclude-dir='.*' --exclude-dir=Library * .env* 2>/dev/null; }; g TIMEOUT_SECONDS 30 | grep -q . && ! g TIMEOUT_SECONDS '5($|[^0-9])' | grep -q .
Test results

Results, 14 November 2026, confighub mini 0.11.1-mini.2. Figures from this page's own test runs, shown here for whoever checks the page; they are not a promise.

  • Scripted run (on confighub mini 0.11.1-mini.2, 14 November 2026): passed, 41 seconds for the steps, within the page's budget of 180.
  • Scripted run (on confighub mini 0.11.1-mini.7, 14 November 2026): passed, 32 seconds for the steps, within the page's budget of 180; each of the three planted faults (a changed quoted line, a budget of zero seconds, a check that holds on a fresh hub) was caught.
  • Agent runs: a pilot, 3 runs per arm on each of claude-sonnet-5-5, claude-opus-5-5. Arms: a is ordinary tools only; b is the Claude plugin, the local hub and this page as reading.
ArmModelChecks passedMedian secondsMedian costCommands left for the person (median)
aclaude-opus-5-50/330.0$0.150
bclaude-opus-5-53/331.7$0.2071
aclaude-sonnet-5-50/315.8$0.0980
bclaude-sonnet-5-53/316.1$0.0841

No agent approved or refused a change to production.

Simulated persons, not people: 10 per run, each a claude-haiku-5-5 model playing one of ten fixed personas, reading only what a person would see. The next step they were offered: "Your monitor can stop every agent the moment an alert fires, and name the last change to look at first; want the alert add-on set up?"

The Claude plugin offers it once, after the answer at whose end it showed the moment the offer names ("did not change"). Offered is the share of persons it was shown to; want it now and later are over them.

ArmModelPersonsOfferedNoticedWant the next step nowLaterIn the way
aclaude-opus-5-5300%100%n/an/a23%
bclaude-opus-5-5300%100%n/an/a13%
aclaude-sonnet-5-5300%100%n/an/a23%
bclaude-sonnet-5-5300%100%n/an/a10%

Results, 14 November 2026, confighub mini 0.11.1-mini.7. Figures from this page's own test runs, shown here for whoever checks the page; they are not a promise.

  • Environment: checksum-verified published mini.7 for macOS arm64 and the Claude plugin it ships, with Claude Code on this computer. These are agent runs; the earlier scripted runs and planted faults are labelled separately.
  • Agent runs: a pilot, 3 runs per arm on each of claude-sonnet-5-5. Arms: a is ordinary tools only; b is the Claude plugin, the local hub and this page as reading.
ArmModelChecks passedMedian secondsMedian costCommands left for the person (median)
aclaude-sonnet-5-50/316.1$0.1290
bclaude-sonnet-5-53/315.3$0.0781

No agent approved or refused a change to production.

Simulated persons, not people: 5 per run, each a claude-haiku-5-5 model playing one of ten fixed personas, reading only what a person would see. The next step they were offered: "Your monitor can stop every agent the moment an alert fires, and name the last change to look at first; want the alert add-on set up?" It offers more of the tier the person has, not a step up.

The Claude plugin offers it once, after the answer at whose end it showed the moment the offer names ("did not change"). Offered is the share of persons it was shown to; want it now and later are over them.

ArmModelPersonsOfferedNoticedWant the next step nowLaterIn the way
aclaude-sonnet-5-5150%100%n/an/a33%
bclaude-sonnet-5-5150%100%n/an/a13%