Skip to content
Agentic Levels
  • New to AI?
  • Assessment
  • Levels
  • Lessons
  • Tracks
  • Resources
  • Reference
  • What's New
  • What's Next
  • More
    Tool SetupCompareAboutThanksFAQPricingPreferences
  • New to AI?
  • Assessment
  • Levels
  • Lessons
  • Tracks
  • Resources
  • Reference
  • Tool Setup
  • Compare
  • What's New
  • About
  • Thanks
  • FAQ
  • What's Next
  • Pricing

© 2026 Fuentes Studio·Privacy·Terms

yourCouncil
Ready to help
✦

What do you want to understand?

Ask anything about what you're learning.

L8Lesson 1

Build the Inner Loop

After this, you'll be able to wire a feedback loop where the agent runs tests, reads the result, and fixes failures without you intervening at every step.

Before you start

Before diving in, complete Track Cost Per Iteration so your inner loop is cost-aware from the start and won't burn budget on every test-fix cycle.

The idea

You ask Claude to add a small feature. It writes the code and says 'done.' You run the tests. Two failures. You paste the error back. It fixes one. You run again. Another failure. Forty-five minutes later you are still in the loop, manually ferrying outputs between Claude and your test runner. That back-and-forth is the supervision bottleneck the inner loop eliminates.

At L8, the agent does not just act. It verifies whether the action worked, reads the result, and acts again. You ask for the feature. The agent writes the code, runs the test suite itself, reads the two failures, fixes the root cause, and re-runs until green. Then it reports back. You were not in any of those intermediate steps.

Here is the before and after: a task that takes 6 hours of supervised back-and-forth becomes 90 minutes of unsupervised agent work plus 15 minutes of your review on the final diff. That is a 4x speedup from one change: letting the agent close the loop.

The prerequisite is a runnable check. The agent can only loop if it can verify it succeeded. Your project needs a test suite, a linter, or a build step it can invoke and read. If you have none, add one before building the inner loop. Without a checkable exit condition, the loop has no way to know when to stop.

Try it (20 min)

Watch out for

  • Running the inner loop on a project with no tests or linter. The loop requires a checkable exit condition. Add one first.
  • Asking the agent to confirm with you at each step. That re-introduces the supervision bottleneck you are trying to eliminate.
  • Treating a passing test suite as a complete verification. Tests verify what you specified, not whether the feature actually works end-to-end.
  • Letting the loop run indefinitely on a hard bug. Set a mental cap (3-4 cycles) and look at the trace if it is spinning.
  • Skipping the review step. The point of the loop is that your review is high-quality and focused, not that you skip it entirely.

Paste this into Claude:

I want to close the feedback loop on a task in my project. Here is a repeatable task I do regularly: [describe a task like 'add a function that does X and make sure tests pass' or 'fix the failing linter rule and verify no new errors']. Help me set this up so you can run it end-to-end: (1) Write or modify the code needed, (2) Run the test suite or linter using the shell tool, (3) Read the output, (4) Fix any failures, (5) Re-run until clean. Do not ask me to confirm each step. Show me the full loop running to completion.

What good looks like:

  • The agent ran the test suite or linter without you manually triggering it
  • The agent read the failure output and identified the root cause itself
  • The agent applied a fix and re-ran the check without waiting for your approval
  • The loop completed with a passing result before the agent reported back to you
  • You reviewed a diff and a pass result, not a series of intermediate questions

What a good response looks like:

Here is what a completed inner loop run looks like in Claude's summary:

'Task: add input validation to the createUser function.

Loop summary:
- Cycle 1: Wrote validation logic. Ran npm test. 2 failures: createUser.test.ts lines 34 and 67 expected ValidationError but got undefined.
- Cycle 2: Fixed root cause: validation was applied after the database write, not before. Moved the check. Ran npm test. 1 failure: line 67 still failing (edge case: empty string not caught by the null check).
- Cycle 3: Added empty-string guard. Ran npm test. All 47 tests passing.

Changes made:
- src/users/createUser.ts: added validateInput() call before db.insert() (line 12)
- src/users/validators.ts: added isNonEmptyString() guard (lines 8-11)

Final state: npm test exits 0. No linter errors. Ready to review.'

What you should see: the agent counted its own cycles (3), named the specific failing lines, explained the root cause it found, and reported a clean final state. You review one diff, not six exchanges.

Go deeper (30 min)

Paste this into Claude:

Now measure the loop. Pick a task that took you 30 minutes or more in the past when you were doing it manually with back-and-forth prompting. Run the same task using the inner loop. Record: (1) How many minutes did the agent run unsupervised? (2) How many test or lint cycles did it take? (3) How many minutes did your final review take? Compare those numbers to your manual estimate. Paste the numbers and ask Claude to help you identify which step consumed the most time and whether the loop could be tightened.

What good looks like:

  • You recorded the unsupervised run time and the review time separately
  • You counted how many fix-and-recheck cycles the agent needed
  • The total time (agent + review) was less than your manual estimate
  • You identified the slowest step in the loop and have one idea for making it faster

What a good response looks like:

Loop measurement report:

Task: refactor data fetching layer to use a shared HTTP client (previously took ~45 min with back-and-forth)

Inner loop run:
- Unsupervised agent time: 22 minutes
- Fix-and-recheck cycles: 4
- Your review time: 11 minutes
- Total: 33 minutes (vs 45 manual)

Slowest step: cycle 3 (9 minutes), agent rewrote the retry logic from scratch instead of patching it. Faster alternative: add a spec criterion 'do not rewrite retry logic, only update the client instantiation' to prevent it.

Net improvement: 27% faster, with less cognitive load (you reviewed a diff, not a conversation).

When this breaks

  • Breaks when the project has no runnable check because the agent has no exit condition and the loop never terminates on success.
  • Breaks when the success criteria depend on judgment because the agent cannot self-verify 'is this clean enough' the way it can verify 'do all tests pass'.
  • Breaks when the underlying bug is outside the file the agent is editing because the loop spins on local fixes that cannot resolve a cross-file root cause.

Claude can do it for you

Say to Claude: 'I want you to run this task end-to-end: [task description]. After each step, run [test command or linter] and read the output. Fix any failures and re-run. Do not stop until the check passes. Then show me a summary of what you changed and the final test result.'

You can now

Run a real task end-to-end where the agent edits code, runs tests, fixes failures, and reports a clean final result without your intermediate input.

Key takeaways

Wire the loop once, then get out of the way. Act, check, fix, repeat. You review the outcome, not the process.

  • The inner loop replaces supervision with a checkable exit condition the agent can verify itself
  • A runnable test, lint, or build step is the prerequisite. No exit condition, no loop.
  • Cap iterations at 3-4 cycles so the loop fails loudly on hard bugs instead of spinning silently
  • Your review moves from intermediate steps to the final diff, which is where most quality issues actually surface

Go deeper

  • The Ralph Loop (ghuntley.com, the article that named this pattern)
  • Claude Code Sub-Agents (headless mode for background execution)
  • Harness Engineering (OpenAI, broader harness context)