Small Loop vs Big Loop
🔁 Small Loop (Inner Loop)
Every agent has a tiny cycle running inside it:
send context → model asks for tools → run tools → add results → repeat
This stops when the model itself decides it's done. Problem: nothing checks whether the model is actually right — it's just judging its own work. That's why agents confidently say "Done! All fixed" without ever running the tests.
Fix = Outside stops — conditions that don't depend on the model's own opinion:
- A checked condition (prove the work with a real test)
- A limit (max number of tries)
- A no-progress check (stop if nothing's improving)
- A separate checker (a second process grades the work)
🧭 Big Loop (Outer Loop)
The small loop is one worker doing one task. The big loop is the manager — it decides:
- Which task to give
- When to start
- How to grade the result
- What to remember for tomorrow
One full run of the small loop = one "beat" of the big loop.
🏗️ The 4 Layers (each nested inside the next)
| # | Layer | What it covers |
|---|-------|-----------------|
| 1 | Prompt engineering | The words you send |
| 2 | Context engineering | Everything the model sees in one turn |
| 3 | Harness engineering | The code around the model (running tools, handling errors) — where the small loop lives |
| 4 | Loop engineering | The outer cycle: what the system works on, when it starts, how it knows it's done |
Each layer stops a different kind of failure:
- No context → the model guesses
- No harness → you are the only checker
- No loop → the schedule is still on you
🎯 Key Takeaway
The useful question isn't "is my prompt good enough?"
It's: "Which of these layers am I still doing by hand?"