- Home
- Skills
- Testing & Debugging
- Turn Repeat Agent Failures into Automated Guard Rules
More screenshots
Works with the AI Agents you already use
Turn Repeat Agent Failures into Automated Guard Rules
Import structured run events idempotently.
$25
Turn Repeat Agent Failures into Automated Guard Rules
Example session with this skill installed
Count repeat failures in this event log over the last 7 days, using my taxonomy, as of 2030-01-15:
python3 scripts/failure_loop_tracker.py detect --events-file examples/sample_events.jsonl --taxonomy examples/sample_taxonomy.json --now 2030-01-15T12:00:00Z --window-days 7 --format text
- Read your context and instructions
- Compiled the turn repeat agent
Summary
The detector reads the synthetic log and reports two active tags in the seven-day window: one CRITICAL, one WARN. One malformed line is skipped.
FailureLoopDetect: events=sample_events.jsonl | window=7d | active_tags=2 | critical=1 | warn=1 | skipped_lines=1 | status=ACTION_REQUIRED
Alerts:
- [CRITICAL] tag=unchecked_exit_status | count=3 (threshold=3) | note=same tag does not prove identical root cause; inspect each event
- [WARN] tag=unbounded_retry_loop | count=2 (threshold=2) | note=same tag does not prove identical root cause; inspect each event
Summary: 8 raw lines (5 active, 1 voided, 1 is_fixed, 1 non-counting), 1 malformed skipped, 1 CRITICAL, 1 WARN
| Tag | Count | Threshold | Severity |
|---|---|---|---|
| unchecked_exit_status | 3 | 3 | CRITICAL |
| unbounded_retry_loop | 2 | 2 | WARN |
The figures come from a synthetic example log, not from a real project.
Next steps
- Inspect each event behind an alert; the same tag does not prove the same root cause
- Draft a proposal with the tracker's
proposemode and replace its placeholder regression test with project-specific positive and negative cases - Run
approve-checkbefore the guard is promoted
Connects securely to your tools. The creator never sees your data.
About this skill
For engineering teams tired of repeated AI coding mistakes and noisy regex alerts: capture recurring failures, require regression evidence before a guard is promoted, and keep scan noise out of the default gate.
The event taxonomy and severity tiers let you review repeat patterns without treating one match as proof: the same tag does not establish the same root cause, so every event is inspected individually.
What is inside
- Four chapters: sliding-window failure detection, deterministic proposals and test-gated promotion, low-noise violation scanning, and Claude Code hook and CI integration
scripts/failure_loop_tracker.py: log a known-tag event, import structured run events idempotently (from a file or stdin), detect repeat counts in a sliding window, render a draft guard proposal, and runapprove-checkscripts/signature_guard_scan.py: scan a file, a directory, or stdin; by default only files changed within the recent--since-hourswindow, or--all-filesto scan everythinghooks/posttooluse_scan.py: scans only the file named in an Edit, Write, or MultiEdit hook event; it reports without blocking unless you setGUARD_SCAN_STRICT=1- Templates for the taxonomy, guard proposal, and hook settings; synthetic fixtures; 47 standard-library self-tests
The five-step loop
- Record a failure under a controlled tag.
- Import structured run events idempotently.
- Detect repeat counts inside a sliding window.
- Draft a deterministic guard proposal and run its regression test.
- Scan recently changed files and review findings before enabling strict enforcement.
A new proposal contains an intentionally incomplete regression-test example; replace its placeholder with project-specific positive and negative cases before approve-check will pass.
Limits
Tag recurrence is a deterministic count, not root-cause analysis: two unrelated failures can share a tag, so cause separation and application stay with a human reviewer. Static signatures cannot reliably find calls assembled through dynamic execution or judge whether a match is semantically correct, so keep semantic checks at checklist strength instead of blocking code.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.
Tag recurrence is a deterministic count, not root-cause analysis: two unrelated failures can share a tag, so cause separation and application need human review. Static signatures cannot reliably find calls assembled through dynamic execution or judge whether a match is semantically correct, so semantic checks stay at checklist strength. A new proposal contains a placeholder regression test you must replace with your own positive and negative cases.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed today
- Software
Python 3.9+