ci-monitorlisted
Install: claude install-skill mattbutlerengineering/mattbutlerengineering
# CI Monitor
Monitor GitHub Actions CI health and respond to failures. Fixes simple issues automatically via a self-healing loop, escalates complex ones to the issue queue.
## Circuit Breaker State
Track consecutive fix-PR CI failures in a local counter. Reset to 0 on any successful fix.
```bash
CONSECUTIVE_FAILURES=0
MAX_CONSECUTIVE_FAILURES=3
```
If `CONSECUTIVE_FAILURES >= MAX_CONSECUTIVE_FAILURES`, **stop the loop** and report:
> "Circuit breaker tripped: 3 consecutive fix PRs failed CI. Manual review required."
Do not attempt further fixes in this session.
---
## Workflow
### Step 1: Check Main Branch CI
```bash
gh run list --branch main --limit 5 --json status,conclusion,databaseId,headBranch,name,createdAt
```
Examine the results:
- If all 5 runs have `conclusion: "success"` → **main is healthy**, proceed to Step 3
- If any run has `conclusion: "failure"` → proceed to Step 2
### Step 2: Diagnose and Self-Heal Failure
For each failed run:
```bash
gh run view <databaseId> --log-failed 2>&1 | head -200
```
#### 2a: Check for Existing Fix
```bash
gh issue list --label "ci-fix" --state open --search "<error keyword>" --json number,title
gh pr list --state open --label "ci-fix" --json number,title,headRefName
```
If an open `ci-fix` issue **or** an open fix PR already exists for this failure, **skip it** — it is already being tracked.
#### 2b: Classify the Failure
**Classify into one of these types:**
| Type | Signal in logs