Lesson 01 · Loop Engineering
Six parts. Learn the parts and every later lesson has a place to attach.
You prompt an agent turn by turn. You type, you read, you type again. Addy Osmani describes the alternative in one sentence:
Loop engineering is replacing yourself as the person who prompts the agent. You design the system that does it instead. Addy Osmani, Loop Engineering
A loop is a recursive goal: you define a purpose, and the AI iterates until the purpose is complete. The skill you are building across this course is not prompting. It is design.
Osmani lists five primitives, then adds one more that he calls the memory. Read the table once. You do not need to remember it yet.
| Primitive | Job in the loop | In Claude Code |
|---|---|---|
| Automations | Discovery and triage, on a schedule | Scheduled tasks, cron, /loop, /goal, hooks, GitHub Actions |
| Worktrees | Keep parallel agents off each other's files | git worktree, --worktree, isolation: worktree |
| Skills | Write down project knowledge the agent would guess | Agent Skills (SKILL.md) |
| Connectors | Plug the agent into your real tools | MCP servers, plus plugins to ship them |
| Sub-agents | One has the idea, a different one checks it | Task subagents in .claude/agents/ |
| State | Remember what is done and what is next | Markdown files, or Linear over MCP |
The same six exist in the Codex app under different names. That is Osmani's point: the shape is the same, so stop arguing about which tool and design a loop that survives either one. See the primitive map for the full two-column comparison.
The five primitives do work. The sixth remembers it. Osmani is blunt about why it sounds too small to matter and is not:
The model forgets everything between runs so the memory has to be on disk and not in the context. The agent forgets, the repo doesnt. Addy Osmani, Loop Engineering
What makes a loop a loop, rather than one very good agent run?
Where must a loop's memory of finished work live?
From memory: name as many of the six parts as you can. Do not scroll up.
Primary source: Loop Engineering by Addy Osmani. Read the opening and the section titled The five pieces, and then notes. About eight minutes. Everything in this course is grounded there.