advancedpractical-guidesloop-engineeringexampleintegrationtriage

Chapter 7 of 8

One Full Loop

Wire all six building blocks into a single loop that runs overnight — triage, worktree, draft, review, ship — with you nowhere in the middle.

One Full Loop

Stick the six blocks together and a single thread turns into a little control panel. Here is one shape worth using — adapted from Osmani's "What one loop looks like".

The loop, in plain English

Every morning, an automation runs on the repo. Its prompt calls a triage skill that reads yesterday's CI failures, the open issues, and the recent commits, then writes the findings to a state file (markdown or a Linear board).

For each finding worth doing, the loop opens an isolated worktree and sends a sub-agent to draft the fix. A second sub-agent reviews that draft against the project skills and the existing tests.

Connectors let the loop open the PR and update the ticket. Anything the loop can't handle lands in the triage inbox for you. The state file is the spine — it remembers what got tried, what passed, what's still open — so tomorrow morning's run picks up where today stopped.

The six blocks, mapped

BlockJob in this loop
AutomationFires every morning, runs the triage prompt on a cadence
Skill$triage-issues — the triage procedure, written once, invoked by the automation
WorktreeOne isolated branch per finding, so fixes don't collide
Sub-agentOne drafts the fix, a different one reviews it (maker-checker)
ConnectorsRead the issue tracker; open the PR; update the ticket
Stateloop-state.md records what was tried, what passed, what's open

What you actually did

You designed it one time. You did not prompt any of those steps.

That's Steinberger's whole point made real. And it's the same loop in Codex or in Claude Code, because the pieces are the same pieces.

A minimal version to start with

Don't build the whole thing on day one. Start with the smallest version that closes one loop:

# 1. A skill that defines what "triage" means for your project
#    .claude/skills/triage/SKILL.md

# 2. An automation that runs it every morning
/loop 24h $triage-issues

# 3. A state file it writes to
#    loop-state.md

# 4. (Later) a sub-agent that drafts fixes, a second that reviews
# 5. (Later) connectors that open PRs and update tickets

Ship the smallest loop that survives overnight

The goal of your first loop is not to be impressive — it's to survive a night unattended and produce something you can review in the morning. A loop that triages issues into a markdown file and stops there is a complete loop. The worktree, the sub-agents, the connectors — those are upgrades you add once the spine works.

The shape, not the tools

The reason this chapter doesn't show you a 200-line Codex script or a 200-line Claude Code config is that the shape is the point. Map the six blocks onto whatever tool you're sitting in. The automation is /loop or the Automations tab. The worktree is git worktree or isolation: worktree. The skill is SKILL.md in either. The sub-agent is .claude/agents/ or .codex/agents/. The connector is an MCP server in both. The state is a markdown file.

Once you can name the six blocks in your tool, you can build this loop. That's the whole skill.


Next: The Loop Doesn't Replace You — three problems that get sharper, not easier, as the loop gets better.