Back to Patterns

Refinement Loop

Pattern

Problem

AI's first attempt at any goal is rarely optimal. One pass isn't enough, and it's often hard to see deeper when surface problems obscure the core.

Pattern

Give AI a specific improvement goal and loop it:

  1. Define your goal (distill, improve quality, simplify, understand deeper - can be many things!)
  2. AI makes one pass toward that goal. Aiming for the simplest one currently visible works really well
  3. Next pass builds on previous, goes deeper
  4. Repeat until there's nothing noticeable to improve

Each iteration removes a layer of noise, making the next layer visible.

Use external artifacts (files/commits) to make iteration real rather than pretend.

Why This Works

One small goal per iteration keeps AI focused. Each pass removes one layer of problems. Looping this (like Feedback Flip, but generalized to any goal) compounds the improvement until there's nothing visible to improve.

Examples

Llewellyn Falco's refactoring process consistently produces better code quickly.

What makes it work really well:

  • Focus on the simplest visible refactoring each time.
  • Commit after each change with passing tests.
  • The process file acts like a todo list, keeping AI on track.
  • Each simple fix removes noise, revealing the next improvement hidden before.
Documented by