Loop Circuit Breaker Pattern: Claude Code, Cursor Prompt

Agent LoopsAgent Loops

Loop Circuit Breaker Pattern: Claude Code, Cursor Prompt

Implement a circuit breaker that stops a runaway loop after repeated failures and requires manual reset

Write the circuit breaker for the agent loop system in [YOUR_PROJECT].

Implement a CircuitBreaker class backed by .agent/circuit-[LOOP_NAME].json:
**States**: closed (normal), open (blocked), half-open (testing recovery
TLDR

Circuit breaker pattern for Claude Code agent loops. Tracks consecutive failures per loop name, opens the circuit after a threshold, blocks further runs, and requires a manual reset command to resume.

How to use

  1. 1

    Start by replacing [YOUR_PROJECT] and [LOOP_NAME] with your specific project name and the loop name to tailor the CircuitBreaker class to your needs.

  2. 2

    After implementing the CircuitBreaker class, test each method to ensure that the state transitions and failure counts are functioning correctly in your agent loop system.

  3. 3

    Use the provided state definitions of closed, open, and half-open to clearly understand the behavior of your circuit breaker during different scenarios in your project.

Frequently asked questions

What is the Loop Circuit Breaker Pattern: Claude Code, Cursor Prompt prompt used for?

Circuit breaker pattern for Claude Code agent loops. Tracks consecutive failures per loop name, opens the circuit after a threshold, blocks further runs, and requires a manual reset command to resume.

How do I get the best results from this verification & goals prompt?

Paste the prompt into Claude Code, Cursor, Replit, fill in every bracketed placeholder with your specific information, then submit. The more detail you add to each placeholder, the more targeted the output. You can continue in the same conversation to refine tone, length, or focus without restarting from scratch.

Does this prompt work with Claude Code?

Yes. This prompt is optimized for Claude Code and also works well with Cursor and Replit. The structured format with a defined role and numbered steps produces consistent results across all major instruction-following models, so you can use whichever tool you prefer.

How do I access this agent loops prompt?

This verification & goals prompt is available through TopFreePrompts with a Lucy+ licence. You can get access with a one-time Lucy+ purchase for $109, or a $15/month plan you can cancel anytime. Both options give access to the full library of 1,000,000+ prompts across all categories.

More Agent Loops Prompts

View all

Related Prompts

View all