[FEATURE] Native circuit breaker — auto-stop after repeated identical failures
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When a command, fix, or approach fails repeatedly, Claude Code will often retry the same or very similar approach multiple times before giving up — sometimes exhausting the context window. Users currently rely on CLAUDE.md rules like "stop after 3 failures" to prevent this, but the model does not always self-enforce.
Proposed Solution
Implement native loop detection in the agent's execution loop. Track sequential tool calls that produce the same or similar errors. After N failures (configurable, default 3), automatically pause execution and force a user intervention prompt: "This approach has failed 3 times with similar errors. How should I proceed?"
Alternative Solutions
Users add rules to CLAUDE.md telling the model to stop after 3 failures. This is unreliable because it depends on model self-discipline.
Priority
High - Significant impact on productivity
Feature Category
Performance and speed
Use Case Example
Claude tries to fix a TypeScript error. Its fix doesn't work. It tries a similar fix. Same error. It tries again. Same error. By attempt 5-6, the context window is polluted with failed attempts and the model is less likely to find the right fix. A circuit breaker at attempt 3 would save tokens and let the user redirect.
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗