# Circuit Breaker Sentinel — Anti-Loop & Error Guard

> Halt costly AI self-healing loops with strict 3-strike failure limit and mandatory root-cause rubber-ducking.

Circuit Breaker Sentinel — Anti-Loop & Error Guard is a paid AI agent skill on Agensi by Patryk Mazur, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $26 (one-time purchase)
- Creator: [Patryk Mazur](https://www.agensi.io/creators/patryk-mazur)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Version: 1.1
- Last updated: 2026-10-20
- Security: scan passed (2026-10-20); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/circuit-breaker-sentinel-anti-loop-error-guard
- Tags: ai-agents, llm-ops, automation, python, finops, circuit-breaker, anti-loop, error-recovery

## About this skill

### Circuit Breaker Sentinel — Anti-Loop & Error Guard

Tired of autonomous AI agents burning $10 to $50 in token loops trying—and failing—the same broken fix over and over again?

When autonomous AI coding agents encounter runtime errors, test failures, or build crashes, their default behavior is a dangerous spiral: make a blind fix, rerun, fail, make another blind variation, repeat. This "infinite self-healing loop" burns your API budget and corrupts your codebase.

##### ⚡ The Solution: The Deterministic 3-Strike Circuit Breaker
The **Circuit Breaker Sentinel** enforces a strict, deterministic 3-strike policy with mandatory Rubber Duck root-cause deduction before allowing any further file modifications.

##### 🛡️ How the 3-Strike Protocol Works:
1. **Strike 1 (Surgical Diagnosis):** The agent must state a formal hypothesis before touching code.
2. **Strike 2 (Premise Invalidation):** If Strike 1 fails, the previous premise is invalidated. The agent must inspect surrounding context and dependencies.
3. **Strike 3 (Final Refactor):** One final attempt with proof of root cause.
4. 🛑 **TRIP — Hard Cutoff:** If unresolved after 3 attempts, the circuit breaker TRIPS. All tool execution is immediately halted to protect your token budget and codebase integrity. A 4th blind attempt is strictly prohibited without human signoff.

##### 📦 What's Included:
- `scripts/circuit_breaker_sentinel.py` (CLI loop detector & strike evaluator)
- `references/circuit_breaker_protocol.md` (Rubber-ducking templates and deduction rules)
- `agents/openai.yaml` (Agent configuration & execution rules)
- Ready-to-use hooks for Claude Code, Cursor, Windsurf, and Antigravity

##### 🔒 100% Local-First & Zero Telemetry
Runs entirely on your local machine using your existing CLI environment. Zero data telemetry, zero cloud egress.

## Known limitations

Requires Python 3 environment. Relies on the agent's ability to track session history or logs to count strikes accurately.

## 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 Circuit Breaker Sentinel — Anti-Loop & Error Guard skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How exactly does the 'circuit breaker' mechanism prevent token waste?

The Sentinel acts as a 'kill switch' by monitoring task failures. It stops autonomous agents from spiraling into infinite, costly loops by enforcing a hard three-strike limit and requiring structured reasoning before any file edits are allowed.

### Which AI agents or development environments are compatible with this skill?

This skill is designed for autonomous coding environments like Claude Code and Cursor. It works within any setup where the agent has permission to execute Python scripts and read/write local session logs.

### What does the installation process look like?

Setup is straightforward: you'll receive a Python monitoring script and a set of integration instructions to include in your agent's system prompt or configuration file. No complex API keys or external platform subscriptions are required.

### What specific files and assets are included in my purchase?

You will receive the `circuit_breaker_sentinel.py` core script, the structured Markdown reasoning protocol, and a comprehensive integration guide to help you deploy the logic across your specific agent workflows.

### Are there any specific technical requirements or dependencies I should be aware of?

Yes, the sentinel requires a local Python runtime to track strike counts and a persistent session (or local log file) so the agent can reference its previous failed attempts across different turns.

### Why should I use this skill instead of just adding 'don't loop' to my system prompt?

While standard prompts are easily ignored during high-velocity loops, this skill forces a logic gate at the execution layer. It requires the agent to pass a validation step before it can regain write-access to your codebase, effectively overriding the agent's tendency to repeat mistakes.

---

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.
