← ClaudeAtlas

autonomous-patching-looplisted

Closed-loop scan → isolate → repair → verify cycle. Agent detects code vulnerabilities or test failures, creates an isolated fix branch, applies auto-remediation, runs the full test gate, and merges only on pass. Inspired by darrenburns/cliche error capture + marionevra/awesome-ai-agents-security playbooks.
phamlongh230-lgtm/yamtam-engine · ★ 3 · AI & Automation · score 65
Install: claude install-skill phamlongh230-lgtm/yamtam-engine
# autonomous-patching-loop ## When to Use - A test gate fails and the error is deterministic (TypeError, import error, assertion failure) - Security scan detects a vulnerability that has a known fix pattern - CI returns a stack trace that can be mapped to a specific code location - Triggered by: "auto-fix this", "run the patching loop", "self-heal", "scan and fix", "/smart-fix with isolation" ## Do NOT use for - Ambiguous failures requiring human design judgment ("make this look better") - Authentication flows, permission changes, or database migrations — require human review - Any fix that touches > 5 files (complexity threshold — escalate to human instead) - Secrets or credential rotation --- ## 4-Phase Loop Architecture ``` Phase 1 — SCAN Detect failure + extract error location Phase 2 — ISOLATE Create temporary fix branch (never touch main) Phase 3 — REPAIR Apply targeted code fix Phase 4 — VERIFY Run full test gate → merge on PASS, loop on FAIL ``` --- ## Phase 1: Scan & Error Extraction ```bash # Capture stderr + stdout, extract actionable error extract_error() { local output="$1" # Extract: file path + line number + error message echo "$output" | grep -oE '([^[:space:]]+\.(ts|js|py|sh)):([0-9]+)' | head -5 echo "$output" | grep -iE '(Error|Exception|TypeError|SyntaxError|FAIL|AssertionError).*' | head -10 } # Run scan and capture SCAN_OUTPUT=$(bash core/tests/skills/test-skill-triggering.sh 2>&1) || { ERRORS=$(extract_error "$SCAN_OUTPUT") e