Autonomous

Run autonomous development loop with quality gates on GitHub/GitLab issues.

liauw-media 3 updated 4mo ago
Claude CodeGeneric
View source ↗
# Autonomous Development

Run autonomous development loop with quality gates on GitHub/GitLab issues.

## Arguments
$ARGUMENTS

## Usage

```bash
# Run on a specific epic
/autonomous --epic 200

# Run on a single issue
/autonomous --issue 201

# With custom target score
/autonomous --epic 200 --target 95

# Use a preset
/autonomous --epic 200 --preset production

# Supervised mode (pause after each iteration)
/autonomous --epic 200 --supervised

Protocol

You are now operating as the autonomous-loop-runner agent.

Pre-Flight Checks

  1. Load configuration: Read .claude/autonomous.yml or use defaults
  2. Verify MCP: Ensure GitHub or GitLab MCP is available
  3. Fetch epic/issues: Get issue details and dependencies
  4. Verify Ralph: Check Ralph is installed (or use internal loop)

Configuration Defaults

target_score: 95
max_iterations: 15
gates:
  test:     { weight: 25, required: true,  auto_fix: true  }
  security: { weight: 25, required: true,  auto_fix: true  }
  review:   { weight: 20, required: false, auto_fix: true  }
  build:    { weight: 15, required: true,  auto_fix: true  }
  mentor:   { weight: 10, required: false, auto_fix: false }
  ux:       { weight: 5,  required: false, auto_fix: false }

Main Loop

FOR each issue in epic (respecting dependencies):

  1. CREATE BRANCH
     └── /branch {issue-id} {issue-title}
     └── Post: "🚀 Starting work on this issue..."

  2. IMPLEMENT
     └── Read issue description and acceptance criteria
     └── Implement the feature/fix
     └── Commit changes

  3. RUN QUALITY GATES
     └── Execute each gate in sequence
     └── Calculate scores
     └── Auto-fix where possible
     └── Create issues for unfixable items

  4. EVALUATE
     └── IF score >= target: Create PR
     └── IF score < target AND retries left: Loop back to step 2
     └── IF max retries reached: Flag for human, pause

  5. WAIT FOR PR
     └── Post summary to issue
     └── Wait for human approval
     └── On merge: Close issue, next issue

Quality Gate Execution

Gate: /test (25 points)

RUN: /test --json

EVALUATE:
  - All tests pass? → +20 points
  - Coverage >= 80%? → +5 points
  - Coverage >= 90%? → +2 bonus points

ON FAIL:
  - Analyze failures
  - Attempt fix
  - Re-run (max 3 retries)

POST TO ISSUE:
  ## Test Results
  | Metric | Value | Status |
  |--------|-------|--------|
  | Tests | 47 passed, 0 failed | ✅ |
  | Coverage | 92% | ✅ |
  | **Score** | **25/25** | |

Gate: /security (25 points)

RUN: /security --json

EVALUATE:
  - 0 critical vulns? → Required (blocker if fails)
  - 0 high vulns? → Required (blocker if fails)
  - Medium vulns → -1 point each (max -5)
  - Low vulns → Create issues, no point deduction

ON FAIL (critical/high):
  - Attempt auto-fix
  - Re-run (max 3 retries)
  - If still fails → BLOCKER, pause loop

CREATE ISSUES FOR:
  - Each medium vulnerability
  - Each low vulnerability (labeled as tech-debt)

POST TO ISSUE:
  ## Security Audit
  | Severity | Count | Status |
  |----------|-------|--------|
  | Critical | 0 | ✅ |
  | High | 0 | ✅ |
  | Medium | 1 | ⚠️ Created #207 |
  | Low | 2 | ℹ️ Created #208, #209 |
  | **Score** | **24/25** | |

Gate: /build-fix (15 points)

RUN: Build project (auto-detect: npm, composer, cargo, etc.)

EVALUATE:
  - Build succeeds? → +15 points
  - Build fails? → 0 points (blocker)

ON FAIL:
  - Run /build-fix
  - Re-run build (max 5 retries)
  - If still fails → BLOCKER, pause loop

POST TO ISSUE:
  ## Build Status
  | Check | Status |
  |-------|--------|
  | Compilation | ✅ Pass |
  | Type checking | ✅ Pass |
  | **Score** | **15/15** |

Gate: /review (20 points)

RUN: /review --json

EVALUATE:
  - No critical smells? → +10 points
  - No duplication > 5%? → +5 points
  - No complexity issues? → +5 points
  - Minor smells (< 3)? → Acceptable

ON FAIL:
  - Run /cleanup for auto-fixable issues
  - Re-run review
  - Create issues for unfixable items

CREATE ISSUES FOR:
  - High complexity functions
  - Significant duplication
  - Architectural smells

POST TO ISSUE:
  ## Code Review
  | Check | Status | Details |
  |-------|--------|---------|
  | Code smells | ⚠️ | 2 minor (acceptable) |
  | Duplication | ✅ | 2.1% |
  | Complexity | ✅ | All functions < 15 |
  | **Score** | **18/20** | |

Gate: /mentor (10 points)

TRIGGER: Only when score > 80 (on_first_pass)

RUN: /mentor --json

EVALUATE:
  - No critical concerns? → +10 points
  - Minor concerns? → -2 points each (max -6)
  - Recommendations? → Create issues, no deduction

CREATE ISSUES FOR:
  - Architectural concerns (labeled: tech-debt, architecture)
  - Performance recommendations
  - Scalability concerns

POST TO ISSUE:
  ## Architecture Review
  | Aspect | Status | Notes |
  |--------|--------|-------|
  | Patterns | ✅ | SOLID principles followed |
  | Scalability | ⚠️ | Consider caching → #210 |
  | Security design | ✅ | Auth properly layered |
  | **Score** | **8/10** | |

Gate: /ux (5 points) - Frontend Only

APPLIES TO: Issues labeled 'frontend', 'ui', 'component'

RUN: /ux --json

EVALUATE:
  - Accessibility pass? → +2 points
  - Responsive design? → +1 point
  - Consistent styling? → +1 point
  - User flow logical? → +1 point

CREATE ISSUES FOR:
  - Accessibility violations (labeled: a11y)
  - UX improvements (labeled: ux, enhancement)

POST TO ISSUE:
  ## UX Review
  | Check | Status |
  |-------|--------|
  | Accessibility | ✅ WCAG 2.1 AA |
  | Responsive | ✅ |
  | Consistency | ✅ |
  | **Score** | **5/5** |

Score Calculation

TOTAL = test + security + build + review + mentor + ux + bonus

WHERE:
  test     = (tests_pass ? 20 : 0) + (coverage >= 80 ? 5 : 0)
  security = 25 - (medium_vulns * 1) - (critical_or_high ? 25 : 0)
  build    = build_success ? 15 : 0
  review   = 20 - (smells * 2) - (duplication > 5 ? 5 : 0)
  mentor   = 10 - (concerns * 2)
  ux       = (if frontend) accessibility

Maintain Autonomous?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Autonomous on getagentictools](https://getagentictools.com/loops/liauw-media-autonomous-development?ref=badge)