self-fix-loop
Skill15 starsChanged 5 months agoMITView on GitHub
Self-learning fix loop - commit, push, monitor CI, auto-fix failures using swarm agents with skills on demand, loop until all checks pass. Supports GitHub Actions and GitLab CI. Use when CI fails and you need to iteratively fix until green. Triggers: "fix CI", "loop until green", "auto-fix failures", "self-fix".
- Deletes or force-pushes
- Commits and pushes
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- anti-ai-slopSkill
- architecture-diagramSkill
- atomic-commitSkill
- build-rustSkill
- codacySkill
- crates-io-name-checkSkill
- dora-reportSkill
- goap-agentSkill
- harnessSkill
- issue-triageSkill
- lint-rustSkill
- metrics-reporterSkill
- privacy-firstSkill
- release-rustSkill
- reviewing-pull-requestsSkill
- secret-lintSkill
- skill-creatorSkill
- skill-evaluatorSkill
- stacked-prsSkill
- task-decompositionSkill
- test-rustSkill
- tokio-performanceSkill
- triz-analysisSkill
- triz-solverSkill
- verify-actionsSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 24
Self-Fix Threshold: If 2+ similar errors occur during the loop, pause and diagnose the root cause before attempting another fix.
- Very specific: line 119
If the current branch is part of a gh stack (check: gh stack view --json 2>/dev/null succeeds):
- Distinctive: line 121
Commit fixes as NEW commits — never amend stacked commits
- Very specific: line 122
Run gh stack rebase --upstack to propagate changes to dependent branches
- Very specific: line 123
Run gh stack push to update all dependent PRs
- Very specific: line 125
Do NOT use git push --force on stacked branches — use gh stack push instead.
- Distinctive: line 126
Do NOT use git commit --amend — it breaks upstack branch ancestry.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Self-Fix Loop Skill
When to Use
Automated self-learning cycle: commit → push → monitor → analyze failures → fix → retry until all CI checks pass.
Self-Fix Threshold: If 2+ similar errors occur during the loop, pause and diagnose the root cause before attempting another fix.
Overview
Continuous improvement loop that:
- Commits all changes atomically
- Pushes to feature branch
- Creates/updates PR/MR
- Monitors CI (GitHub Actions or GitLab CI)
- On failure: diagnoses and fixes
- Repeats until ALL checks pass
Platform Detection
Auto-detect from git remote:
REMOTE=$(git remote get-url origin)
if echo "$REMOTE" | grep -qi "github"; then
PLATFORM="github"; CLI="gh"
elif echo "$REMOTE" | grep -qi "gitlab"; then
PLATFORM="gitlab"; CLI="glab"
fiCLI Command Mapping
| Action | GitHub (gh) | GitLab (glab) |
| Check CI | gh pr checks | glab ci status |
| Create PR/MR | gh pr create | glab mr create |
| View logs | gh run view --log-failed | glab ci view |
Arguments
| Argument | Description | Default |
--max-retries N | Maximum fix iterations | 5 |
--platform github|gitlab | Force platform | auto-detect |
--auto-research | Use web research on failures | true |
--fix-issues | Attempt automatic fixes | true |
--strict-validation | ALL checks must pass | true |
--timeout SECONDS | Per-iteration timeout | 1800 |
--dry-run | Simulate without pushing | false |
Loop Phases
[Start]
↓
Phase 1: COMMIT & PUSH
- Stage all changes
- Run quality gate
- Atomic commit
- Push to feature branch
↓
Phase 2: CREATE/UPDATE PR/MR
- Create new PR/MR or update existing
↓
Phase 3: MONITOR CI
- Poll GitHub Actions / GitLab CI
- Wait for all checks complete
↓
Phase 4: ANALYZE FAILURES
- Identify failed checks
- Extract error messages
- Categorize failure type
↓
Phase 5: FIX (if failures)
- Diagnose root cause
- Apply fixes
- Commit fix
↓
Phase 6: RETRY LOOP
- If retries remaining → Phase 1
- If max retries → FAIL
- If all pass → SUCCESSRust Failure Types
| Failure Type | Action |
cargo fmt | Run cargo fmt --all |
cargo clippy | Fix warnings, respect -D warnings |
cargo test | Debug test failures, fix or skip flaky |
cargo audit | Update vulnerable dependency (refer to .agents/ci/regression-matrix.json) |
cargo deny | Fix license or advisory violations (refer to .agents/ci/regression-matrix.json) |
markdownlint | Fix heading increments/links (refer to .agents/ci/regression-matrix.json) |
gitleaks | Remove secret or add exception (refer to .agents/ci/regression-matrix.json) |
cargo machete | Remove unused dependencies |
| Linker errors | Check build-essential, pkg-config |
Stacked PR Interaction
If the current branch is part of a gh stack (check: gh stack view --json 2>/dev/null succeeds):
- Commit fixes as NEW commits — never amend stacked commits
- Run
gh stack rebase --upstackto propagate changes to dependent branches - Run
gh stack pushto update all dependent PRs
Do NOT use git push --force on stacked branches — use gh stack push instead.
Do NOT use git commit --amend — it breaks upstack branch ancestry.
Rationalizations
| Rationalization | Reality |
| "The loop is stuck, I'll just force merge" | Force merging defeats the purpose of CI and introduces regressions. |
| "One more retry should fix it" | Repeated identical failures indicate a root cause, not a flaky test. |
| "I'll disable strict validation to pass faster" | Strict validation catches issues early; disabling it pushes bugs to production. |
Red Flags
- Exceeding max retries without diagnosing root cause
- Disabling strict validation to bypass failing checks
- Force merging when the self-fix loop reports failure
- Using
git commit --amendorgit push --forceon stacked branches (usegh stack pushinstead)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

