# Claude Code Guardrails: stop false "done" reports

> Three bash hooks that surface failed commands, force checked-vs-unchecked replies, and break retry loops.

Claude Code Guardrails: stop false "done" reports is a free AI agent skill on Agensi by laika, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [laika](https://www.agensi.io/creators/laika)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-02
- Security: scan passed (2026-10-02); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/claude-code-guardrails-stop-false-done-reports
- Tags: llm-ops, claude-code, bash, automation, testing

## About this skill

Claude Code sometimes summarizes a turn as finished when a command in it failed. A rule in CLAUDE.md does not reliably prevent that: in one workspace the verification rule was in context for all 22 verification-shaped replies and was followed in 13 of them (59%). Hooks fire at the moment the rule matters, so these three move the rules out of the instructions file.

What is included (3 bash hooks, 58-69 lines each, bash + jq only):
- verify-before-done: after each Bash call, scans the output for failure signals (non-zero exit, failing test counts, tracebacks, connection refused, permission denied) and adds a note naming what it found. Skips cat/grep/head/--help so reading a file about failures does not fire it.
- quantify-claims: on verification-shaped prompts, asks the reply to open with "verified n% (numerator/denominator)" and to name what was not checked.
- loop-breaker: counts consecutive calls to the same tool and, past a threshold, tells the agent to stop and choose a different move. Ordinary tools (Bash, Read, Grep, Edit, Write) are skipped by default.

install.sh merges into your existing settings.json, writes a timestamped backup first, and adds nothing on a second run. Nothing is sent anywhere; the hooks only read the hook payload on stdin. Read the hooks before installing.

What it does not do: it does not make an agent honest or prevent every false completion. It makes failed output hard to skip past.

## Known limitations

Requires bash and jq. Written for Claude Code hook settings (settings.json). It does not make an agent honest or prevent every false completion; it makes failed output hard to skip past. The failure scan matches common patterns (exit codes, test counts, tracebacks) and can miss tool-specific wording.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Claude Code Guardrails: stop false "done" reports skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How is this different from a rule in CLAUDE.md?

A rule in CLAUDE.md is read once and can be skipped. A hook runs at the moment it matters: right after a Bash call, or when a verification-shaped prompt arrives. In one measured workspace the written rule was followed in 13 of 22 cases (59%).

### What are the technical requirements for running these hooks?

bash, jq, and Claude Code with hooks support. Tested on macOS.

### Can I choose to install these hooks for a specific project only, or are they applied globally?

Yes. install.sh writes to <project>/.claude/ by default, or to ~/.claude/ with --global.

### What exactly is included in the purchase?

install.sh, the three hook scripts (verify-before-done.sh, quantify-claims.sh, loop-breaker.sh), SKILL.md with install/check/remove steps, and the MIT license. install.sh writes a timestamped backup of settings.json before it changes anything.

### Will I need to reinstall the guardrails every time I update the Claude Code CLI?

Not normally. The hooks live in settings.json, which Claude Code updates do not overwrite. If the hook format changes, re-run install.sh; running it again adds no duplicate entries.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
