You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a concise guardrail heuristic: "If the same approach fails twice, stop and switch strategies."
Source
Extracted from the Codex compiler project's CLAUDE.md session rules (rule #8). Permission was granted by the author for semantic extraction.
Concept
"If the same approach fails twice, stop and switch strategies."
This is a decision-making heuristic that prevents a common AI agent antipattern: retrying the same failing approach with minor variations, consuming tool capacity and context window in a futile loop.
Why This Matters for Agents
AI agents have a strong tendency to:
Try an approach
See it fail
Try the same approach with a small tweak
See it fail again
Try again with another small tweak
Repeat until context window is exhausted
The two-failures rule provides a clear, memorable trigger to break this cycle. After two failures of the same approach, the agent must:
Reassess assumptions
Try a fundamentally different strategy
Ask the user for guidance
Or explicitly document why the approach cannot work
Integration Options
This could be:
A standalone micro-guardrail
A numbered rule in guardrails/operational-constraints
A phase in reasoning/root-cause-analysis (escalation trigger)
Value for PromptKit
Small but high-impact. Prevents the most common waste pattern in agent-assisted development. The rule is concise enough to remember and specific enough to enforce.
Proposed Component Type
Type: guardrails protocol (or addition to operational-constraints)
Activity
feat: Tier 1 backlog batch — 4 issues
feat: Tier 1 backlog batch — #212, #215, #155 (F-003), #113 (#219)