Loop Engineering - The Guy Who Built Claude Code Says He Doesn't Prompt Anymore

Loop Engineering

Links & Resources

ResourceLink
Addy Osmani's Loop Engineering Postaddyosmani.com/blog/loop-engineering
How Boris Uses Claude Codehowborisusesclaudecode.com
Claude Code Hooks Guidecode.claude.com/docs/en/hooks-guide
Claude Code Agents Docscode.claude.com/docs/en/agents
Claude Code Skills Docscode.claude.com/docs/en/skills
Claude Code Worktrees Guideclaudedirectory.org/blog/claude-code-worktrees-guide
O'Reilly on Loop Engineeringoreilly.com/radar/loop-engineering
The New Stack Coveragethenewstack.io/loop-engineering
Cobus Greyling's Loop Tools (GitHub)github.com/cobusgreyling/loop-engineering
Boris Cherny's Original Statementx.com/rohanpaul_ai/status/2063289804708835412

Boris Cherny runs Claude Code at Anthropic. He recently said something that should change how you think about AI coding forever:

"I don't prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops."

Not a hot take. Not a prediction. That's the guy who built the tool telling you he doesn't use it the way you do. He designs systems that use it for him - on repeat, 24/7, while he sleeps.

Addy Osmani (14 years at Google, Director at Google Cloud AI) named this shift loop engineering in June 2026 and wrote the definitive breakdown. The industry followed within days. O'Reilly published on it. The New Stack covered it. Every major AI coding tool shipped native loop primitives within weeks.

This isn't a feature announcement. It's a paradigm shift.


What Is Loop Engineering

For two years, the way you used a coding agent was: type a prompt, read the answer, type the next prompt. You held the tool the entire time, one turn after another.

Loop engineering replaces you as the person doing the prompting. You design a system - a loop - that finds the work, hands it out, checks it, records what's done, and decides what's next. Then that system pokes the agents instead of you.

The loop runs on a timer. It spawns helpers. It feeds itself. You designed it once. You didn't prompt any of those steps.

As Addy Osmani put it: "You don't really need to be good at prompting anymore. The thing to get good at is the loop that does the prompting for you."


The 5 Building Blocks (+ Memory)

Every loop needs five components and one place to remember things. Both Claude Code and OpenAI's Codex ship all five natively - the names differ slightly, the capability is identical.

ComponentJob in the LoopClaude CodeCodex
AutomationsDiscovery + triage on a schedule/loop, /goal, hooks, cron, GitHub ActionsAutomations tab, /goal
WorktreesIsolate parallel featuresclaude --worktree, isolation: worktree on subagentsBuilt-in worktree per thread
SkillsCodify project knowledgeSKILL.md files, /pluginAgent Skills (SKILL.md), $name invocation
ConnectorsConnect your real toolsMCP servers + pluginsConnectors (MCP) + plugins
Sub-agentsSplit the maker from the checker.claude/agents/*.md, agent teams.codex/agents/*.toml, subagents
MemoryTrack what's doneCLAUDE.md, progress files, Linear via MCPMarkdown or Linear via connector

1. Automations - The Heartbeat of the Loop

Automations are what make a loop an actual loop and not just a one-time run. Without them, you're still the trigger. With them, the system wakes itself up.

/loop - Recurring Scheduled Prompts

Fire a prompt or skill on a repeating interval:

/loop 5m /babysit          # Auto-address code review, auto-rebase, shepherd PRs
/loop 30m /slack-feedback   # Auto put up PRs for Slack feedback every 30 mins
/loop /post-merge-sweeper   # Put up PRs for missed code review comments
/loop 1h /pr-pruner         # Close stale and unnecessary PRs

Without an interval, /loop self-paces based on output.

/goal - Run Until a Condition Is True

This is the real power move. You define a verifiable stopping condition, and Claude keeps working until it's met:

/goal all tests in test/auth pass and the lint step is clean

Walk away. Come back to a green build. The critical detail: a separate model checks whether the goal is met - the agent that wrote the code isn't the one grading it. Maker and checker are split at the stop condition level.

Hooks - Lifecycle Triggers

Hooks fire shell commands at specific lifecycle points. Claude Code supports 30 hook events across the entire agent lifecycle:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
          }
        ]
      }
    ]
  }
}

Key hook events and what they do:

EventFires WhenUse Case
SessionStartSession begins or resumesLoad env vars, inject context
PreToolUseBefore a tool call executesBlock edits to protected files
PostToolUseAfter a tool call succeedsAuto-format code after every edit
StopClaude finishes respondingRun tests before accepting "done"
SubagentStart/StopSubagent spawns or finishesLog agent activity
WorktreeCreate/RemoveWorktree lifecycleTrack parallel sessions
NotificationClaude sends a notificationDesktop alerts when waiting for input

Three hook types beyond basic commands:

  • Prompt hooks ("type": "prompt") - Send hook input to a Claude model for a yes/no decision. The model returns {"ok": true} or {"ok": false, "reason": "..."}. Use for judgment calls, not just rules.
  • Agent hooks ("type": "agent") - Spawn a full subagent that can read files, search code, and verify conditions before deciding.
  • MCP tool hooks ("type": "mcp_tool") - Call a tool on a connected MCP server directly from the hook.

Exit code 0 = proceed. Exit code 2 = block the action (stderr becomes feedback to Claude). The hook system enforces deterministic behavior - these things always happen, regardless of what the model decides.

Routines - Cloud-Based Automations

Schedule cron jobs, GitHub event triggers, or API webhook triggers that run on Anthropic's infrastructure. No laptop required. Kick off from your phone in the morning, pick up the results on your computer later.


2. Worktrees - Parallel Without Chaos

The second you run more than one agent, files collide. Two agents writing the same file is the exact same headache as two engineers committing to the same lines without talking first.

Git worktrees fix this: a separate working directory on its own branch, sharing the same repo history. One agent's edits literally cannot touch the other's checkout.

Setup

# Launch Claude in its own worktree
claude --worktree
# or shorthand
claude -w

For subagents, add isolation to the agent frontmatter:

---
isolation: worktree
---

Claude Code provisions a fresh worktree for each parallel agent and cleans it up automatically when the agent finishes.

Real-World Usage

Boris Cherny runs 5+ Claude Code instances in parallel using separate worktrees - numbered tabs 1 through 5. Plus 5-10 additional sessions on claude.ai/code.

Teams are reliably running 4-8 concurrent worktrees per developer as of mid-2026. Above that, the bottleneck is review bandwidth, not the tool.

Boris calls worktrees "the single biggest productivity unlock" in Claude Code.


3. Skills - Stop Explaining Your Project Every Time

Every time you start a new Claude session, the model knows nothing about your project. Without skills, the loop re-derives your entire project from zero every cycle. With skills, it compounds.

A skill is a folder with a SKILL.md file inside - instructions, metadata, optional scripts and assets:

my-skill/
├── SKILL.md        # The only required file
├── scripts/        # Optional automation scripts
└── assets/         # Optional reference files

SKILL.md Frontmatter

---
description: "Run full test suite and put up a PR"
fork: true          # Run in its own context window
---
# Steps
1. Run all tests with `npm test`
2. Run `/simplify` to clean up
3. Create a PR with the changes

Boris's Rule

"Every single time Claude makes a mistake, I don't tell it to do it differently. I tell it to write it to the CLAUDE.md, or make a skill, or something. If you can do this, then Claude can just run forever."

That's the real insight. Skills aren't documentation - they're the accumulated intelligence of every correction you've ever made. The agent forgets between runs. The skill doesn't.

His Daily Driver

/go    # test end-to-end, run /simplify, put up a PR

One command. Three steps. Runs the same way every time because it's a skill, not a prompt.

Boris's tip: "If you do something more than once a day, turn it into a skill or command."


4. Connectors (MCP) - The Loop Touches Your Real Tools

A loop that can only see the filesystem is a tiny loop. MCP (Model Context Protocol) connectors let the agent read your issue tracker, query a database, hit a staging API, drop a message in Slack.

The difference between an agent that says "here is the fix" and a loop that opens the PR, links the Linear ticket, and pings the channel once CI is green - by itself.

Boris's MCP Stack

ToolWhat It Does
Slack MCPRead and respond to team messages
BigQuery CLIQuery production data ("haven't written a line of SQL in 6+ months")
SentryPull error logs into agent context
Chrome ExtensionVerify frontend changes visually
Linear via MCPTrack and update issues

Install

/plugin install slack-mcp
/plugin install sentry-mcp

Connectors are built on the open MCP standard - a connector you write for one tool usually works in others.


5. Sub-Agents - Keep the Maker Away from the Checker

This is the most consequential design decision in a loop. The model that wrote the code is too generous grading its own homework. A second agent with different instructions catches what the first one reasoned itself into.

Custom Agents

Define agents in .claude/agents/*.md:

---
name: security-reviewer
model: opus
isolation: worktree
---
Review the PR for security vulnerabilities. Check for:
- SQL injection
- XSS vectors
- Auth bypass
- Secrets in code

The Standard Split

One agent explores. One implements. One verifies against the spec. Boris uses this pattern:

Dynamic Workflows: An orchestrator spawns an implementer, 2 verifiers, and a fixer per task. The implementer writes. The verifiers check independently. The fixer resolves disagreements.

Nesting

Subagents now support nesting up to depth=5. A subagent can spawn its own subagents. Teams of teams.

Boris's tip: "Append 'use subagents' to any request where you want Claude to throw more compute at the problem."


What a Complete Loop Looks Like

Stick it together and one thread becomes a control panel:

Morning: An automation runs on the repo. Its prompt calls a triage skill that reads yesterday's CI failures, open issues, and recent commits. Findings go to a markdown file or Linear board.

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

When the fix passes: Connectors open the PR and update the ticket. Anything the loop can't handle lands in a triage inbox for you.

Tomorrow morning: The state file remembers what got tried, what passed, what's still open. The next run picks up where today stopped.

You designed it once. You didn't prompt any of those steps.


Boris's Workflow in Numbers

MetricValue
Parallel Claude Code instances5+ (worktrees, numbered tabs)
Additional cloud sessions5-10 on claude.ai/code
Primary modelOpus (always, "faster than smaller models because less steering")
ModeAuto mode only (not plan mode - unnecessary since Opus 4.6)
Input method/voice for most coding
Effort levelxhigh default, max for hardest tasks
SQL written in 6 monthsZero (BigQuery CLI handles it)

His Power Tips

  • Use /rewind instead of correcting Claude in-chat - keeps context cleaner
  • Set CLAUDE_CODE_AUTO_COMPACT_WINDOW=400000 to avoid context rot
  • Use --bare flag with SDK for 10x faster startup
  • Use /fewer-permission-prompts to tune your allowlist instead of skipping permissions entirely
  • Use /usage to see what's burning tokens
  • Give Claude a way to verify its work - "Probably the most important thing. It will 2-3x the quality of the final result."

The Warnings

Loop engineering changes the work. It does not delete you from it. Three problems get sharper as the loop gets better:

Verification is still on you. A loop running unattended is also a loop making mistakes unattended. The verifier sub-agent helps, but "done" is a claim, not a proof. Your job is to ship code you confirmed works.

Understanding rots. The faster the loop ships code you didn't write, the bigger the gap between what exists and what you actually understand. Addy Osmani calls this comprehension debt - a smooth loop makes it grow faster unless you read what the loop made.

Cognitive surrender. When the loop runs itself, it's tempting to stop having an opinion and accept whatever comes back. Designing the loop is the cure when you do it with judgment, and the accelerant when you do it to avoid thinking.

Two people can build the exact same loop and get opposite results. One uses it to move faster on work they understand deeply. The other uses it to avoid understanding at all.


The Paradigm Table

EraYou DoThe Agent Does
Prompt Engineering (2023-2025)Write every prompt, review every output, trigger every actionOne task at a time, forgets between sessions
Loop Engineering (2026+)Design the system once, review what matters, maintain the loopFinds work, distributes it, checks it, records it, decides what's next