Skip to content

cocodedk/loop-engineering

Loop Engineering — Boris Cherny's Claude Code Methodology

"The loop" is Boris Cherny's name for how he runs Claude Code today: instead of prompting the model turn by turn, he writes small programs (loops) that prompt Claude on his behalf, read what it produced, decide whether the task is done, and re-prompt with updated context if not. The loop runs the model in a sense-decide-act-check cycle where each decision is the model's, not a hardcoded branch, on a schedule or until a goal condition is met. Cherny stated the core idea verbatim: "I don't prompt Claude anymore. I have loops that are running. They're the ones that are prompting Claude and figuring out what to do. My job is to write loops" (source).

Website

Read online — the GitHub Pages rendering of this knowledge base.

TL;DR

  • Cherny's evolution runs in three stages: hand-writing code with autocomplete, then running 5-10 Claude sessions in parallel that he prompts manually, then writing loops that prompt Claude autonomously (source).
  • A loop discovers work, hands tasks to agents and sub-agents, verifies results, persists state, and decides the next action (source).
  • The single most important factor for quality is giving the agent a way to verify its own work; Cherny says a verification feedback loop "2-3x" the result (source).
  • Every caught mistake becomes a durable correction in CLAUDE.md or a skill, so the fix persists across future runs (source).
  • The methodology maps onto documented Claude Code primitives: /loop, /goal, the Agent SDK, sub-agents, skills, memory, hooks, worktrees, MCP, and channels (source).
  • "Loop engineering" as a named term was popularized by third parties (Peter Steinberger, Addy Osmani), not coined by Cherny himself (source).
  • Most receipts (parallel-session counts, PR figures, IDE deletion) trace to Cherny's own posts and talks; a few productivity numbers are confirmed only in secondary coverage. See docs/11-caveats.md.

What's in here

Run it — the agent-loop skill

Reading the method is one thing; running it is another. This repo ships agent-loop in skill/agent-loop/ — a Claude Code skill that turns this knowledge base into something you can run. It triggers on phrasings like "loop until the tests pass" or "keep going until the build is green" — even when you never say the word "loop."

One loop. Give it a goal and a verification gate — a test, a build, a runnable check. It runs an act → verify → re-prompt cycle until the gate passes or a budget ceiling stops it. Verification is the engine: the loop only advances when reality says it did.

skill/agent-loop/scripts/verify-loop.sh \
  --goal "fix the failing auth tests, root cause only" \
  --verify "pytest tests/auth -q" --max 10

A chain of loops. For a larger objective ("create user manuals"), it decomposes the work into a chain — a linear backbone of stages where any stage can fan out into one parallel sub-loop per item (per page, screen, or endpoint) and join before continuing. Each loop is a self-contained, reusable folder that verifies its own step and hands off to the next, so starting any loop runs forward to the end; a human signs off at the terminal stage.

skill/agent-loop/scripts/run-chain.sh .agent-loops/user-manuals

Gates are hybrid: an objective check where one exists, an LLM-judge against a rubric where it doesn't, and a human at the end. See skill/agent-loop/SKILL.md and skill/agent-loop/references/chains.md for the full skill, and docs/09-example-loops.md for the patterns it automates.

Author

Babak Bandpeycocode.dk | LinkedIn | GitHub


Compiled from public talks and articles, mostly secondary coverage of Boris Cherny's podcast and conference appearances (Sequoia AI Ascent, Acquired Unplugged presented by WorkOS, Lenny's Podcast, The Pragmatic Engineer, and developing.dev), together with his own posts on X and Threads and Anthropic's Claude Code documentation. Where a claim is dramatic or numeric, the relevant document notes whether it is confirmed against a primary source, only against secondary coverage, or left unverifiable.

License

Apache-2.0 | © 2026 Cocode | Created by Babak Bandpey

About

A fact-checked knowledge base on Boris Cherny's 'loop' methodology for running Claude Code.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors