← ClaudeAtlas

revert-rca-looplisted

Detect when an AI-authored PR is reverted and trigger a Reflection session for RCA. Monitors revert commits, matches to AI PRs, and initiates analysis. Scheduled to run hourly. Invoke with /revert-rca-loop.
mattbutlerengineering/mattbutlerengineering · ★ 0 · API & Backend · score 69
Install: claude install-skill mattbutlerengineering/mattbutlerengineering
# Revert RCA Loop Detects and analyzes reversions of AI-authored PRs to identify patterns and prevent recurrence. **Goal:** Close the learning loop when the autonomous system makes a mistake: capture the revert, trigger RCA, file follow-up tasks. ## Architecture ``` Periodic Check (hourly) → Query GitHub for recent reverts → Filter for AI-authored PRs (marked "Generated by @mbe/agent-core") → Match revert commit to original PR → Check if RCA issue already exists → If new revert: Create RCA issue + Trigger Reflection session → Track trend (reverts/day, patterns, root causes) ``` ## Workflow ### Step 1: Detect Recent Reverts Query the last 24 hours of commits on main for revert patterns: ```bash # Find revert commits (last 24h) git log --oneline --since="24 hours ago" --grep="^Revert" | head -20 ``` Parse each revert commit: - Extract original commit SHA or PR number from message: `Revert "feat: #1234 description"` - Or: `Revert "title (#1234)"` - Extract: `1234` (PR number) For each potential revert: ```bash # Get the reverted commit details REVERT_COMMIT=$(git log -1 --format=%H --grep="^Revert" --since="24 hours ago") ORIGINAL_COMMIT=$(git show $REVERT_COMMIT | grep -oP 'This reverts commit \K[0-9a-f]+' || echo "") # Try to find the original PR from the commit message PR_NUM=$(git log -1 --format=%B $REVERT_COMMIT | grep -oP '#\K[0-9]+' | head -1) ``` ### Step 2: Verify PR is AI-Authored For each potential revert: ```bash # Check if the PR body co