---
schema: 1
type: video
title: 'Loop Engineering from First Principles — Kyle Mistele, HumanLayer'
description: >-
  A coding agent will happily hand you a 40,000 line pull request that nobody
  can review and that quietly does the wrong thing. Kyle Mistele's argument is
  that the fix is not a better prompt but a better loop, borrowed from control
  theory: a thermostat senses the error between where a system is and where you
  want it, emits a control signal, and measures again, over and over.
  Infrastructure as code already approximates this. The point is to design agent
  loops the same way, so each iteration makes a small, readable change you can
  actually verify, instead of one giant diff you have to trust. The working
  example is migrating a codebase one procedure at a time. A sensor, often just
  Grep or a structural search, finds the smallest unmigrated piece, a controller
  picks what to work on next, and an actuator agent makes the change against
  golden patterns defined by hand, gated by deterministic CI like a single loop
  iteration in CircleCI. The loop tracks its own PRs in version control, refuses
  to stack a new change while an earlier one is still open, and keeps improving
  the code incrementally, even while the team is away. Speaker info: -
  https://x.com/0xBlacklight - https://www.linkedin.com/in/kyle-mistele -
  https://blacklight.sh Timestamps: 0:00 - Introduction: the 40,000 line PR
  problem 1:55 - Why more code is not the goal 3:37 - Is the generated code any
  good? 4:43 - Control loops from control theory 5:49 - Infrastructure as code
  and Ralph loops 7:06 - Applying control loops to coding 8:35 - Migrating a
  codebase one procedure at a time 10:40 - Tracking the loop in version control
  12:35 - The actuator agent and golden patterns 13:51 - Wiring the loop into CI
  15:44 - Avoiding stacked PRs and scaling the controller --- Watch along with
  the corrected transcript, summary, timestamps and resources on this talk's
  official AIE page:
  https://ai.engineer/talks/xIt_mTQp6mY-loop-engineering-from-first-principles
  Join our upcoming AI Engineer conferences (see https://ai.engineer landing
  page): - AIEi Shanghai, November 5–6 — the first for meeting top Chinese labs
  and engineers - AIE CODE in SF, November 10–12 — the top AI Coding conference
  returns - AIEi Sydney, December 7–8 — the first AIEi run alongside NeurIPS
  2026 in Sydney ---
canonical: 'https://liquidgold.cc/watch/xIt_mTQp6mY'
markdown: 'https://liquidgold.cc/watch/xIt_mTQp6mY.md'
llms: 'https://liquidgold.cc/watch/xIt_mTQp6mY/llms.txt'
parent: 'https://liquidgold.cc/channel/aidotengineer.md'
channel: aidotengineer
updated: '2026-10-24T06:30:15.205Z'
language: null
children: []
videoId: xIt_mTQp6mY
durationSeconds: 1077
publishedAt: '2026-07-25T20:41:40.000Z'
searchChunks:
  - ordinal: 0
    text: null
    startSeconds: 39
    endSeconds: 117
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=39'
    heldReason: rights
  - ordinal: 1
    text: null
    startSeconds: 39
    endSeconds: 117
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=39'
    heldReason: rights
  - ordinal: 2
    text: null
    startSeconds: 128
    endSeconds: 228
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=128'
    heldReason: rights
  - ordinal: 3
    text: null
    startSeconds: 239
    endSeconds: 294
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=239'
    heldReason: rights
  - ordinal: 4
    text: null
    startSeconds: 294
    endSeconds: 305
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=294'
    heldReason: rights
  - ordinal: 5
    text: null
    startSeconds: 305
    endSeconds: 351
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=305'
    heldReason: rights
  - ordinal: 6
    text: null
    startSeconds: 351
    endSeconds: 361
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=351'
    heldReason: rights
  - ordinal: 7
    text: null
    startSeconds: 361
    endSeconds: 427
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=361'
    heldReason: rights
  - ordinal: 8
    text: null
    startSeconds: 438
    endSeconds: 515
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=438'
    heldReason: rights
  - ordinal: 9
    text: null
    startSeconds: 515
    endSeconds: 527
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=515'
    heldReason: rights
  - ordinal: 10
    text: null
    startSeconds: 527
    endSeconds: 645
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=527'
    heldReason: rights
  - ordinal: 11
    text: null
    startSeconds: 645
    endSeconds: 657
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=645'
    heldReason: rights
  - ordinal: 12
    text: null
    startSeconds: 657
    endSeconds: 764
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=657'
    heldReason: rights
  - ordinal: 13
    text: null
    startSeconds: 764
    endSeconds: 774
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=764'
    heldReason: rights
  - ordinal: 14
    text: null
    startSeconds: 774
    endSeconds: 838
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=774'
    heldReason: rights
  - ordinal: 15
    text: null
    startSeconds: 849
    endSeconds: 951
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=849'
    heldReason: rights
  - ordinal: 16
    text: null
    startSeconds: 849
    endSeconds: 951
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=849'
    heldReason: rights
  - ordinal: 17
    text: null
    startSeconds: 951
    endSeconds: 961
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=951'
    heldReason: rights
  - ordinal: 18
    text: null
    startSeconds: 961
    endSeconds: 1077
    watch: 'https://liquidgold.cc/watch/xIt_mTQp6mY?t=961'
    heldReason: rights
---


# Loop Engineering from First Principles — Kyle Mistele, HumanLayer

A coding agent will happily hand you a 40,000 line pull request that nobody can review and that quietly does the wrong thing. Kyle Mistele's argument is that the fix is not a better prompt but a better loop, borrowed from control theory: a thermostat senses the error between where a system is and where you want it, emits a control signal, and measures again, over and over. Infrastructure as code already approximates this. The point is to design agent loops the same way, so each iteration makes a small, readable change you can actually verify, instead of one giant diff you have to trust. The working example is migrating a codebase one procedure at a time. A sensor, often just Grep or a structural search, finds the smallest unmigrated piece, a controller picks what to work on next, and an actuator agent makes the change against golden patterns defined by hand, gated by deterministic CI like a single loop iteration in CircleCI. The loop tracks its own PRs in version control, refuses to stack a new change while an earlier one is still open, and keeps improving the code incrementally, even while the team is away. Speaker info: - https://x.com/0xBlacklight - https://www.linkedin.com/in/kyle-mistele - https://blacklight.sh Timestamps: 0:00 - Introduction: the 40,000 line PR problem 1:55 - Why more code is not the goal 3:37 - Is the generated code any good? 4:43 - Control loops from control theory 5:49 - Infrastructure as code and Ralph loops 7:06 - Applying control loops to coding 8:35 - Migrating a codebase one procedure at a time 10:40 - Tracking the loop in version control 12:35 - The actuator agent and golden patterns 13:51 - Wiring the loop into CI 15:44 - Avoiding stacked PRs and scaling the controller --- Watch along with the corrected transcript, summary, timestamps and resources on this talk's official AIE page: https://ai.engineer/talks/xIt_mTQp6mY-loop-engineering-from-first-principles Join our upcoming AI Engineer conferences (see https://ai.engineer landing page): - AIEi Shanghai, November 5–6 — the first for meeting top Chinese labs and engineers - AIE CODE in SF, November 10–12 — the top AI Coding conference returns - AIEi Sydney, December 7–8 — the first AIEi run alongside NeurIPS 2026 in Sydney ---

Canonical: https://liquidgold.cc/watch/xIt_mTQp6mY · Channel: [AI Engineer](https://liquidgold.cc/channel/aidotengineer.md)

> Search chunk text is held until public-source provenance is verified.

## Document chunks

> Missing: no stored document chunks are available.
