
Runaway guard
Halts a Claude Code or Codex session on loops, failure streaks or a spend cap
Runaway guard is an open-source agent skill for developer tools. It is available on Claude Code and Codex.
- Scripts
- Python
- Platforms
- Claude Code, Codex
- GitHub stars
- 1.7K
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Runaway guard
Runaway guard installs a hook that Claude Code or Codex runs before every tool call. It watches for three problems: the same call repeated a third time with nothing changed in between, five failed calls in a row, and session spending that passes a dollar cap. The cap is an estimate at API list prices, so on a subscription plan it measures usage rather than the bill. The guard warns at 80% of the cap and blocks further calls once it is reached, which covers interactive sessions where the built-in print-mode budget flag does not apply.
The install flow is designed to be previewed first. A dry run shows the headline limits and the exact settings change without writing anything, and the change is applied only when the user confirms. Status and reset commands report the counts for each session, and an uninstall removes only the guard's own entries and restores the settings file it changed. Everything runs locally on macOS or Linux with Python 3.9 or newer, reading the session transcripts and keeping small per-session counters.
The skill is written for developers who leave agents running unattended and want a ceiling on cost or a stop on repeated work. Prices for models missing from the built-in table are estimated from the most expensive known model in the same family, so the cap still applies.
When your agent uses it
Runaway guard: a hook that stops a live Claude Code or Codex session when the agent loops on the same tool call, keeps failing, or exceeds a dollar cap. Use when the user wants a spending cap, budget limit, or cost ceiling for interactive agent sessions (the built-in --max-budget-usd works only in print mode); wants to halt an agent that repeats the same command, is stuck in a loop, or runs up a bill unattended overnight; wants a circuit breaker for several failed tool calls in a row; or asks how much the current session has spent against its cap, why a call was blocked, or how to raise or reset the cap. Runs locally: reads the session transcripts before each tool call and sends nothing.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
- Runs Python scripts(see the files on GitHub)
- Network calls found in its scripts(see the files on GitHub)
- License: MIT(see the files on GitHub)
From a static check of its 11 files (192 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the harness-skills plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add RyanAlberts/best-of-Agent-Harnesses
/plugin install harness-skills@agent-harnessesOr copy only this skill to ~/.claude/skills/runaway-guard:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/runaway-guard &&
cp -R "$tmp/skills/runaway-guard" ~/.claude/skills/runaway-guard &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/runaway-guard inside it instead.
Copy the skill folder to ~/.agents/skills/runaway-guard to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/runaway-guard &&
cp -R "$tmp/skills/runaway-guard" ~/.agents/skills/runaway-guard &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/runaway-guard inside it instead.
Copy the skill folder to ~/.cursor/skills/runaway-guard to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/runaway-guard &&
cp -R "$tmp/skills/runaway-guard" ~/.cursor/skills/runaway-guard &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/runaway-guard inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/RyanAlberts/best-of-Agent-Harnesses.git --path skills/runaway-guardOr copy the folder to ~/.gemini/skills/runaway-guard yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/runaway-guard:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/runaway-guard &&
cp -R "$tmp/skills/runaway-guard" ~/.copilot/skills/runaway-guard &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/runaway-guard inside it instead.
Get the folder:
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.gitThen copy best-of-Agent-Harnesses/skills/runaway-guard into your agent's skills folder as runaway-guard. Agents that support SKILL.md read one folder per skill.
What it does
- Repeated call detection
- Blocks an identical tool call a third time when nothing has changed between attempts.
- Failure streak circuit breaker
- Asks before the next call after five failed tool calls in a row, or blocks it where prompts are not possible.
- Session dollar cap
- Tracks spend at API list prices and warns at 80% before blocking calls at the cap.
- Guided install and uninstall
- Shows a dry-run headline and settings diff, then writes only when asked, and removes only its own entries.
- Status and reset reporting
- Shows per-session spend, trip counts and recent events, and can restart a session's count.
- Local-only operation
- Reads transcripts on the local machine and keeps counters and hashes without network calls.
Good for
- Set a $20 spending ceiling on interactive Claude Code sessions
- Stop an agent that keeps re-running the same failing command
- Add a circuit breaker so an agent halts after several failed tool calls
- Check how much the current session has spent against its cap
- Find out why a tool call was blocked and how to raise the cap
Runaway guard FAQ
Which agents does Runaway guard work with?
It installs hooks for Claude Code and Codex. Codex hooks cannot ask the user, so after five failures the call is blocked and the agent is told to ask instead.
Does Runaway guard send my data anywhere?
No. It reads local session transcripts and makes no network calls; it keeps small counters and hashes of recent calls per session.
Does the dollar cap match my bill?
Not on a subscription plan. The figure is an estimate at API list prices and runs slightly low, so it measures usage rather than what you pay.
Does the install change my settings right away?
No. It shows the planned change first and writes only when run with the write option after the user agrees.
How do I install Runaway guard in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/runaway-guard to use it in all your projects, or to .claude/skills/runaway-guard in one project. Or install the harness-skills plugin, which includes it: /plugin marketplace add RyanAlberts/best-of-Agent-Harnesses, then /plugin install harness-skills@agent-harnesses.
Does Runaway guard run scripts?
Yes. It runs Python scripts. Its scripts contain network calls. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Runaway guard?
Claude Code and Codex. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Runaway guard?
The closest alternatives to Runaway guard are Rules to guards, Guardrail tester, Regression finder, Session hardening and Delivery gate.
Where this comes from
- Description: from the skill's own SKILL.md.
More from RyanAlberts/best-of-Agent-Harnesses

Shows which instruction files each coding agent loads and whether documented commands
- Open source
- 1.7K GitHub stars
- Developer tools

Audits an agent's claims that tests or builds passed against its session transcripts
- Open source
- 1.7K GitHub stars
- Developer tools

Checks if your agent's deny rules and hooks really block dangerous commands
- Open source
- 1.7K GitHub stars
- Security

Benchmarks Claude Code, Codex and Gemini CLI on tasks from your own git history
- Open source
- 1.7K GitHub stars
- Developer tools

Finds the Claude Code or Codex update where your agent's behavior started to change
- Open source
- 1.7K GitHub stars
- Developer tools

Finds the rules your coding agent keeps breaking and turns them into blocking hooks
- Open source
- 1.7K GitHub stars
- Developer tools


