Mistele argues that prompting coding agents in open-ended loops can produce enormous pull requests that teams cannot review. He says the approach works for some solo projects, but is a poor fit for teams building critical systems with users, service-level agreements, and regulatory obligations. He proposes incremental loops that keep code readable and manageable.
Loop Engineering from First Principles
Speaker
Kyle Mistele, co-founder of HumanLayer, explains how to build agent loops for complex, production codebases at AI Engineer.
Mistele uses control theory to describe a loop: measure the current state, compare it with a desired state, choose a change, apply it, and measure again. Thermostats, Kubernetes autoscaling, infrastructure as code, Postgres autovacuum, and React's virtual DOM are examples of control loops. Incremental changes help reduce risk and avoid destabilizing the system.
A loop needs a set point, a sensor, a controller, and an actuator. HumanLayer uses ast-grep to find RPC procedures that have not been migrated to Effect, then tracks a deterministic baseline so new procedures can be caught in pull requests. The controller can select the smallest procedure first, or use telemetry such as error rates and instrumentation gaps to prioritize work.
HumanLayer pairs a coding agent with a skill and hand-written examples called golden patterns, then runs one loop iteration in CI to create a small pull request. A version-controlled feedback file and an “/iterate” comment let reviewers steer revisions without editing the skill by hand. The workflow pauses if a prior pull request from that loop is still open, preventing duplicate work from piling up.
Mistele describes scaling the loop after it proves reliable: select several procedures per run, give each procedure its own implementation phase and context window, or run multiple workflows and assign their pull requests to different teammates. He notes that migrating 150 procedures one at a time could take six months. The goal is more throughput while keeping changes reviewable.
Takeaways
- Use a measurable target and repeat small changes instead of asking an agent to rewrite a large part of the codebase.
- Prefer deterministic sensors such as ast-grep when they can identify violations reliably.
- Give agents hand-written examples of the patterns your team wants them to reproduce.
- Track reviewer feedback in version control so the loop can learn from corrections.
- Limit each loop to one open pull request until a human has reviewed its previous result.
Mentioned in this talk
Search inside this talk
What was claimed 6
- foundedKyle Mistele founded
HumanLayerco-founder“I'm co-founder of a company called HumanLayer”
YouTube Verified2 sources· Talk, Web· archived
- uses
HumanLayer uses Effect“we're incrementally migrating our RPC API to Effect”
YouTube Unverified1 source· Talk
- uses
HumanLayer uses ast-grep“we're going to use ast-grep”
YouTube Unverified1 source· Talk
- feature
GitHub Actions: Workflow automation with code and secrets access, dispatch and scheduling primitives
“it has access to your code and secrets, and it has great dispatch and scheduling primitives”
YouTube Unverified1 source· Talk
- metric
HumanLayer: 150 RPC procedures to migrate“I have 150 RPC procedures to migrate”
YouTube Unverified1 source· Talk
- feature
HumanLayer: Scaffold for building coding loops“we built a scaffold”
YouTube Unverified1 source· Talk














