From compound-teams
The Ralph Loop pattern for Agent Team teammates. Use when spawning builder teammates that need to iterate until all tests, lint, and type checks pass. Provides the standard retry logic, max attempts, and escalation rules.
npx claudepluginhub tbdng/compound-teams-plugin --plugin compound-teamsThis skill uses the workspace's default tool permissions.
The Ralph Loop is a persistent retry pattern for AI coding agents. Instead of writing code and hoping it works, the agent implements → tests → fixes → retests in a loop until everything passes.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
The Ralph Loop is a persistent retry pattern for AI coding agents. Instead of writing code and hoping it works, the agent implements → tests → fixes → retests in a loop until everything passes.
implement → test → [FAIL?] → read error → fix → test again → [PASS?] → lint → [FAIL?] → fix → lint again → [PASS?] → typecheck → [FAIL?] → fix → typecheck again → [PASS?] → DONE
Max 5 retries per unique error. If the same test fails 5 times with the same root cause, stop and escalate.
Max 3 retries before escalating. If stuck on the same error after 3 attempts, message the team lead with:
Run checks in order: tests → lint → typecheck. Don't skip ahead.
Each retry should be different. Don't repeat the same fix. If approach A failed, try approach B. If both fail, try a fundamentally different strategy.
Read the error message carefully. Most failures contain the answer. Parse stack traces, find the actual line, understand the assertion.
Read these from CLAUDE.md "Build Commands" section. Common patterns:
| Stack | Tests | Lint | Typecheck |
|---|---|---|---|
| Next.js/React | npm test or npx vitest | npm run lint | npx tsc --noEmit |
| Python | pytest | ruff check . | mypy . |
| Node.js | npm test | npx eslint . | npx tsc --noEmit |
| Go | go test ./... | golangci-lint run | (built into compiler) |
Stop looping and escalate when: