# Iterate Until Green

> Pin a goal + verifiable check; loop attempt → test → diagnose → fix until the check exits 0.

- **Kind**: Shell tool
- **Category**: engineering
- **Owner**: Sentinel (/sentinel)
- **Default model**: sonnet
- **Cost class**: standard (Sonnet-class model. Default for most skills.)
- **Turn budget**: 20
- **Execution**: synchronous (result lands in the same turn)
- **Canonical URL**: https://app.51ultron.com/docs/skills/iterate-until-green

## What it does

Implements goal-driven-loop/SKILL.md. The user supplies a goal and a verifiable shell check (a one-liner that exits 0 on success, non-zero with diagnostic output on failure). The model runs an outer loop: attempt → run check → if fail, read failure output, propose surgical patch, apply, retry. Capped at 10 iterations to avoid runaway. Best for build/test/typecheck driven work.

## When to use this

- user wants something to 'just work' and has a clear pass/fail criterion
- user says 'make tests pass' / 'get this building' / 'fix until typecheck is green'
- open-ended task where the only spec is a runnable verification

## When NOT to use this

- no verifiable check exists → ask the user for one first
- task is a single bug fix → use minimal-patch directly

## Example prompts

- `make the tests pass`
- `iterate until pnpm typecheck is green`
- `get the build working — npm run build should exit 0`

## Inputs

- **goal**: what success looks like in one sentence
- **check_command**: shell one-liner that exits 0 on success

## Output

Iterations taken, final check output, list of files touched.

## Tools used

`shell_exec`, `shell_read`, `shell_write`

## Execution template

Shell tools dispatch through `shell_exec` with the following command template:

```bash
follow goal-driven-loop/SKILL.md; loop attempt -> {{check_command}} -> diagnose -> fix (max 10 iters)
```

## Tags

`engineering`, `iterate`, `verify`

## Keywords

iterate, loop, until passing, tdd, make tests pass, goal driven, verify

