# Go Loop

> Close the AI media iteration loop autonomously. Generate → verify via quality gate → auto-regen items below threshold → build composite → commit → notify. Use whenever the user finishes a generation batch, says "go", "go loop", "ship it", "close the loop", "run the loop", or asks to automate the generate-verify-regen-commit cycle for AI images or video. Even when the user just says "finish this batch", "we're done generating", or appends /go-loop to any prompt, trigger this skill to close the loop properly without babysitting. Applies Boris Cherny's /go pattern to AI media pipelines.

- Skill: `luishiluy/go-loop` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add luishiluy/go-loop`
- Raw SKILL.md: https://api.skillmd.com/api/skills/luishiluy/go-loop/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: LuisHiluy (https://skillmd.com/u/luishiluy)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/luishiluy/go-loop

---


# /go-loop — Iteration Loop Closer

Boris Cherny's `/go` pattern applied to AI media pipelines: when invoked, Claude tests its own work end-to-end, simplifies, commits, and pings you. No babysitting.

## The Loop

```
GENERATE → VERIFY → [regen if FAIL, max 2 passes] → COMPOSITE → COMMIT → NOTIFY
```

## When to Invoke

Invoke at the end of any generation task. Safe to chain after batch generators, direct API calls, or MCP tool calls.

Example prompts:
- `regen shot-06 with updated prompt /go-loop`
- `generate remaining CGI shots using approved refs /go-loop`
- `try shot-08 variants for energy match /go-loop`

## Execution

### Step 1 — Verify what was just generated

Run your verification script (see the `verify` skill for a CLIP-based implementation):

```bash
python3 scripts/verify.py <ITEM_ID> --json
```

Read the verdict JSON. If Claude just generated multiple items, iterate.

### Step 2 — Regen if FAIL (max 2 passes)

For any item with verdict `FAIL`:
- Look at `failed_metrics` — targeted fix per metric:
  - `character` fail → ensure character refs are passed to the generator
  - `palette` fail → check world/palette assignment, enforce palette hint in prompt
  - `prompt_match` fail → revise prompt wording, tighten focal length
  - `composite` fail → cross-check frame selection
- Regen via same path. Do NOT burn credits if a prompt fix alone would resolve.
- Re-verify. If still FAIL after 2 regens → surface to user, do NOT continue loop.

### Step 3 — Build composite

```bash
python3 scripts/assemble.py --composite <ITEM_ID>
```

### Step 4 — Simplify (optional)

Run `/simplify` on any supporting code Claude wrote (prompt builders, batch scripts, helper utilities). Skip for pure generation work.

### Step 5 — Commit

Summary commit with:
- Items touched (IDs)
- Pre/post quality scores
- Regen count per item
- References used

Commit message format:
```
<item-ids>: <short description>

Quality deltas: shot-06 0.31→0.42 (GOOD), shot-08 0.28→PASS, shot-11 FAIL after 2 regens

Co-Authored-By: Claude <noreply@anthropic.com>
```

### Step 6 — Notify (optional)

Send summary to the user via your preferred channel (Telegram, Slack, email). Format:

```
/go-loop complete

<N> items verified, <M> regenned
Results:
  shot-06: GOOD (0.42)
  shot-08: PASS (0.31)
  shot-11: FAIL after 2 passes — needs manual review

Composite: runs/composites/latest.png
Commit: <hash>
```

Only send if the channel is configured. Otherwise skip silently.

## Invariants (don't break these)

1. **Never regen more than 2x per item per invocation.** Burns credits; if still failing, the prompt or reference is the issue — hand back to user.
2. **Never skip verification.** The whole point is the tight loop. No verification = no /go.
3. **Always pass references to the generator.** Double-check before regen.
4. **Respect file locks.** If `/lockscenes` is active, respect the guard.
5. **If FAIL after 2 passes: stop, summarize, ask.** Don't auto-escalate to a different generator without user input.

## Output format to user

When `/go-loop` completes, print a compact summary (no headers, no celebration):

```
shot-06 GOOD 0.42 (1 regen)
shot-08 PASS 0.31 (0 regens)
shot-11 FAIL — 2 regens, character metric stuck at 0.48
composite: runs/composites/2026-04-16.png
commit: a7b3c9d
notified
```

## Related Skills

- `verify` — the underlying quality gate
- `clip-feedback` — for single-clip intent analysis
- `nb2-batch` — for batch-generating reference grids
- `lockscenes` — for locking approved items during assembly

