{"id":"17-long-running","number":17,"slug":"long-running-agents-ralph-loop","title":"Long-running agents and loops","short":"Long-running agents and loops","module":"Scaling up","summary":"Agents went from running thirty seconds before derailing to working for hours. The trick isn't one giant session; it's loops: fresh contexts, one task at a time, state kept in files and git, and a check the loop can't argue with. From the Ralph loop to nightly slow loops, here's how to let agents work while you're away.","voice":"Eric","scenes":[{"template":"title","chapter":"Intro","narration":"Karpathy says that to get the most out of these tools, you have to remove yourself as the bottleneck. You can't be there to prompt the next thing. So how do you let an agent work for hours without you?","params":{"kicker":"Lesson 17","module":"Module 4 · Scaling up","title":"Long-running agents and *loops*","subtitle":"How agents work while you sleep.","bubble":"Good night. I'll keep going.","mood":"work"},"start":0.5,"dur":13.242,"words":[{"text":"Karpathy","s":0.8,"e":1.36},{"text":"says","s":1.44,"e":1.76},{"text":"that","s":1.84,"e":1.92},{"text":"to","s":1.96,"e":2},{"text":"get","s":2.08,"e":2.16},{"text":"the","s":2.24,"e":2.32},{"text":"most","s":2.4,"e":2.72},{"text":"out","s":2.8,"e":2.88},{"text":"of","s":2.92,"e":2.96},{"text":"these","s":3.04,"e":3.12},{"text":"tools,","s":3.2,"e":3.84},{"text":"you","s":3.92,"e":4},{"text":"have","s":4.08,"e":4.24},{"text":"to","s":4.28,"e":4.32},{"text":"remove","s":4.4,"e":4.8},{"text":"yourself","s":4.88,"e":5.28},{"text":"as","s":5.36,"e":5.44},{"text":"the","s":5.52,"e":5.56},{"text":"bottleneck.","s":5.6,"e":6.24},{"text":"You","s":6.72,"e":6.88},{"text":"can't","s":6.96,"e":7.2},{"text":"be","s":7.28,"e":7.36},{"text":"there","s":7.44,"e":7.6},{"text":"to","s":7.68,"e":7.76},{"text":"prompt","s":7.92,"e":8.08},{"text":"the","s":8.12,"e":8.16},{"text":"next","s":8.24,"e":8.48},{"text":"thing.","s":8.64,"e":9.12},{"text":"So","s":9.44,"e":9.68},{"text":"how","s":10,"e":10.08},{"text":"do","s":10.16,"e":10.2},{"text":"you","s":10.24,"e":10.32},{"text":"let","s":10.4,"e":10.48},{"text":"an","s":10.56,"e":10.64},{"text":"agent","s":10.72,"e":11.04},{"text":"work","s":11.16,"e":11.28},{"text":"for","s":11.4,"e":11.52},{"text":"hours","s":11.6,"e":12},{"text":"without","s":12.2,"e":12.4},{"text":"you?","s":12.48,"e":12.88}]},{"template":"timeline","chapter":"Longer runs","narration":"Run lengths have exploded. Boris Cherny recalls that early models could run fifteen or thirty seconds before going off the rails. By 2026, typical unattended runs lasted tens of minutes, some for hours or days. Anthropic's trends report describes a single seven-hour autonomous run that implemented a feature in a twelve-million-line codebase.","params":{"events":[{"when":"2024","label":"15–30 seconds","sub":"before going off the rails","at":"fifteen"},{"when":"2026","label":"10–30 minutes","sub":"typical unattended runs","at":"tens of minutes"},{"when":"2026","label":"7 hours","sub":"one run, 12.5M-line codebase","at":"seven-hour"},{"when":"next","label":"days","sub":"with oversight at key points","now":true,"at":"days"}]},"start":13.742,"dur":24.669,"words":[{"text":"Run","s":14.042,"e":14.362},{"text":"lengths","s":14.442,"e":14.722},{"text":"have","s":14.762,"e":14.842},{"text":"exploded.","s":14.922,"e":16.082},{"text":"Boris","s":16.362,"e":16.682},{"text":"Cherny","s":16.762,"e":17.082},{"text":"recalls","s":17.162,"e":17.562},{"text":"that","s":17.682,"e":17.802},{"text":"early","s":17.962,"e":18.122},{"text":"models","s":18.322,"e":18.522},{"text":"could","s":18.602,"e":18.682},{"text":"run","s":18.842,"e":19.002},{"text":"fifteen","s":19.042,"e":19.482},{"text":"or","s":19.562,"e":19.802},{"text":"thirty","s":19.842,"e":20.042},{"text":"seconds","s":20.282,"e":20.682},{"text":"before","s":20.762,"e":21.002},{"text":"going","s":21.082,"e":21.322},{"text":"off","s":21.402,"e":21.482},{"text":"the","s":21.522,"e":21.562},{"text":"rails.","s":21.642,"e":22.522},{"text":"By","s":22.602,"e":22.682},{"text":"2026,","s":22.802,"e":23.962},{"text":"typical","s":24.042,"e":24.442},{"text":"unattended","s":24.522,"e":25.002},{"text":"runs","s":25.162,"e":25.322},{"text":"lasted","s":25.402,"e":25.882},{"text":"tens","s":25.922,"e":26.202},{"text":"of","s":26.282,"e":26.362},{"text":"minutes,","s":26.442,"e":27.162},{"text":"some","s":27.242,"e":27.482},{"text":"for","s":27.562,"e":27.802},{"text":"hours","s":28.042,"e":28.282},{"text":"or","s":28.362,"e":28.442},{"text":"days.","s":28.602,"e":29.362},{"text":"Anthropic's","s":29.642,"e":30.282},{"text":"trends","s":30.322,"e":30.602},{"text":"report","s":30.802,"e":31.002},{"text":"describes","s":31.122,"e":31.482},{"text":"a","s":31.562,"e":31.722},{"text":"single","s":31.922,"e":32.122},{"text":"seven-hour","s":32.282,"e":32.842},{"text":"autonomous","s":32.922,"e":33.482},{"text":"run","s":33.562,"e":33.802},{"text":"that","s":34.042,"e":34.202},{"text":"implemented","s":34.482,"e":34.762},{"text":"a","s":34.802,"e":34.842},{"text":"feature","s":34.922,"e":35.322},{"text":"in","s":35.362,"e":35.402},{"text":"a","s":35.482,"e":35.562},{"text":"twelve-million-line","s":35.682,"e":36.842},{"text":"codebase.","s":36.922,"e":37.802}]},{"template":"statement","chapter":"Loops, not marathons","narration":"But long runs don't come from one giant session. A single session fills up, rots and compacts. Long runs come from loops: many fresh sessions in a row, each doing one piece of work, with the state of the project kept outside the context window.","params":{"text":"Long runs are *loops* of fresh sessions, not one marathon session.","sub":"Each iteration starts clean. The project's state lives in files and git.","art":"loop","tone":"agent","sync":false},"start":38.411,"dur":16.676,"words":[{"text":"But","s":38.711,"e":38.871},{"text":"long","s":38.951,"e":39.191},{"text":"runs","s":39.271,"e":39.511},{"text":"don't","s":39.591,"e":39.831},{"text":"come","s":39.831,"e":40.071},{"text":"from","s":40.151,"e":40.311},{"text":"one","s":40.471,"e":40.631},{"text":"giant","s":40.791,"e":41.111},{"text":"session.","s":41.191,"e":41.671},{"text":"A","s":42.071,"e":42.151},{"text":"single","s":42.231,"e":42.471},{"text":"session","s":42.551,"e":42.871},{"text":"fills","s":43.031,"e":43.271},{"text":"up,","s":43.351,"e":43.751},{"text":"rots","s":43.831,"e":44.231},{"text":"and","s":44.311,"e":44.471},{"text":"compacts.","s":44.591,"e":45.191},{"text":"Long","s":45.671,"e":45.911},{"text":"runs","s":45.991,"e":46.231},{"text":"come","s":46.311,"e":46.391},{"text":"from","s":46.471,"e":46.631},{"text":"loops:","s":46.791,"e":47.671},{"text":"many","s":47.791,"e":47.911},{"text":"fresh","s":47.991,"e":48.231},{"text":"sessions","s":48.311,"e":48.631},{"text":"in","s":48.711,"e":48.751},{"text":"a","s":48.791,"e":48.831},{"text":"row,","s":48.871,"e":49.351},{"text":"each","s":49.431,"e":49.591},{"text":"doing","s":49.671,"e":49.911},{"text":"one","s":50.071,"e":50.231},{"text":"piece","s":50.311,"e":50.471},{"text":"of","s":50.551,"e":50.631},{"text":"work,","s":50.711,"e":51.191},{"text":"with","s":51.271,"e":51.351},{"text":"the","s":51.391,"e":51.431},{"text":"state","s":51.511,"e":51.751},{"text":"of","s":51.791,"e":51.831},{"text":"the","s":51.871,"e":51.911},{"text":"project","s":51.991,"e":52.391},{"text":"kept","s":52.471,"e":52.711},{"text":"outside","s":52.791,"e":53.271},{"text":"the","s":53.311,"e":53.351},{"text":"context","s":53.431,"e":53.831},{"text":"window.","s":53.911,"e":54.471}]},{"template":"code","chapter":"The Ralph loop","narration":"The most famous version is the Ralph loop, by Geoffrey Huntley. In its purest form, Ralph is a bash loop. It pipes the same prompt into a coding agent, again and again. Each run starts with a fresh context, studies the plan, picks the single most important task, does it, and exits. Huntley calls it low control, high oversight.","params":{"file":"ralph.sh","lang":"sh","lines":["while true; do","  cat PROMPT.md | claude -p","done","","# PROMPT.md (core idea)","# Study specs/ and fix_plan.md.","# Pick the ONE most important item. Do only that.","# Run the tests. Commit if green. Update fix_plan.md."],"hl":[{"from":1,"to":3,"at":"bash loop","label":"the whole loop","tone":"agent"},{"from":7,"to":7,"at":"single most important","label":"one task","tone":"good"}]},"start":55.087,"dur":23.467,"words":[{"text":"The","s":55.387,"e":55.467},{"text":"most","s":55.547,"e":55.787},{"text":"famous","s":55.867,"e":56.187},{"text":"version","s":56.267,"e":56.667},{"text":"is","s":56.747,"e":56.907},{"text":"the","s":56.947,"e":56.987},{"text":"Ralph","s":57.067,"e":57.387},{"text":"loop,","s":57.467,"e":57.867},{"text":"by","s":57.947,"e":58.027},{"text":"Geoffrey","s":58.107,"e":58.427},{"text":"Huntley.","s":58.467,"e":58.907},{"text":"In","s":59.467,"e":59.507},{"text":"its","s":59.547,"e":59.707},{"text":"purest","s":59.787,"e":60.187},{"text":"form,","s":60.267,"e":60.827},{"text":"Ralph","s":60.907,"e":61.227},{"text":"is","s":61.307,"e":61.387},{"text":"a","s":61.467,"e":61.507},{"text":"bash","s":61.547,"e":61.867},{"text":"loop.","s":61.947,"e":62.427},{"text":"It","s":62.667,"e":62.827},{"text":"pipes","s":62.987,"e":63.147},{"text":"the","s":63.227,"e":63.307},{"text":"same","s":63.387,"e":63.547},{"text":"prompt","s":63.627,"e":64.027},{"text":"into","s":64.147,"e":64.267},{"text":"a","s":64.347,"e":64.387},{"text":"coding","s":64.427,"e":64.747},{"text":"agent,","s":64.907,"e":65.307},{"text":"again","s":65.547,"e":65.787},{"text":"and","s":65.947,"e":66.027},{"text":"again.","s":66.227,"e":66.507},{"text":"Each","s":67.067,"e":67.227},{"text":"run","s":67.307,"e":67.547},{"text":"starts","s":67.627,"e":67.947},{"text":"with","s":67.987,"e":68.027},{"text":"a","s":68.107,"e":68.187},{"text":"fresh","s":68.307,"e":68.427},{"text":"context,","s":68.507,"e":69.387},{"text":"studies","s":69.467,"e":69.787},{"text":"the","s":69.867,"e":69.907},{"text":"plan,","s":69.947,"e":70.667},{"text":"picks","s":70.707,"e":70.907},{"text":"the","s":70.987,"e":71.067},{"text":"single","s":71.227,"e":71.467},{"text":"most","s":71.547,"e":71.707},{"text":"important","s":71.787,"e":72.187},{"text":"task,","s":72.267,"e":72.987},{"text":"does","s":73.107,"e":73.227},{"text":"it,","s":73.307,"e":73.627},{"text":"and","s":73.707,"e":73.787},{"text":"exits.","s":73.867,"e":74.627},{"text":"Huntley","s":74.907,"e":75.227},{"text":"calls","s":75.307,"e":75.467},{"text":"it","s":75.547,"e":75.707},{"text":"low","s":75.867,"e":76.027},{"text":"control,","s":76.107,"e":76.827},{"text":"high","s":76.947,"e":77.067},{"text":"oversight.","s":77.147,"e":77.947}]},{"template":"quote","chapter":"Engineers in shifts","narration":"Anthropic's engineers describe the core problem vividly. Imagine a software project staffed by engineers working in shifts, where each new engineer arrives with no memory of what happened on the previous shift. That's what a loop of fresh sessions is.","params":{"text":"Imagine a software project staffed by engineers working in shifts, where each new engineer arrives with *no memory* of what happened on the previous shift.","who":"Justin Young","role":"Anthropic","src":"Effective harnesses for long-running agents"},"start":78.554,"dur":16.023,"words":[{"text":"Anthropic's","s":78.854,"e":79.494},{"text":"engineers","s":79.654,"e":80.054},{"text":"describe","s":80.294,"e":80.534},{"text":"the","s":80.614,"e":80.694},{"text":"core","s":80.854,"e":81.014},{"text":"problem","s":81.254,"e":81.494},{"text":"vividly.","s":81.574,"e":82.694},{"text":"Imagine","s":82.774,"e":83.174},{"text":"a","s":83.254,"e":83.334},{"text":"software","s":83.534,"e":83.734},{"text":"project","s":83.814,"e":84.374},{"text":"staffed","s":84.534,"e":84.774},{"text":"by","s":84.854,"e":84.934},{"text":"engineers","s":85.014,"e":85.494},{"text":"working","s":85.574,"e":85.894},{"text":"in","s":86.014,"e":86.134},{"text":"shifts,","s":86.294,"e":86.934},{"text":"where","s":87.014,"e":87.094},{"text":"each","s":87.174,"e":87.334},{"text":"new","s":87.414,"e":87.494},{"text":"engineer","s":87.574,"e":87.974},{"text":"arrives","s":88.054,"e":88.454},{"text":"with","s":88.534,"e":88.774},{"text":"no","s":88.894,"e":89.014},{"text":"memory","s":89.174,"e":89.334},{"text":"of","s":89.414,"e":89.494},{"text":"what","s":89.574,"e":89.654},{"text":"happened","s":89.734,"e":89.974},{"text":"on","s":90.054,"e":90.134},{"text":"the","s":90.214,"e":90.294},{"text":"previous","s":90.534,"e":90.774},{"text":"shift.","s":90.934,"e":91.654},{"text":"That's","s":91.774,"e":91.974},{"text":"what","s":92.054,"e":92.134},{"text":"a","s":92.174,"e":92.214},{"text":"loop","s":92.294,"e":92.454},{"text":"of","s":92.534,"e":92.614},{"text":"fresh","s":92.774,"e":92.934},{"text":"sessions","s":93.174,"e":93.414},{"text":"is.","s":93.494,"e":93.974}]},{"template":"loop","chapter":"The shift handoff","narration":"Their answer is a disciplined handoff. Every session gets its bearings first, from a progress file and the git log. It runs a quick smoke test. It implements exactly one failing feature, verifies it end to end, commits, and flips that feature's pass flag to true. Then the next shift begins.","params":{"title":"Every shift, the same routine","steps":[{"label":"Bearings","sub":"progress file + git log","icon":"search","at":"bearings"},{"label":"Smoke test","sub":"is it still working?","icon":"test","at":"smoke test"},{"label":"One feature","sub":"the next failing one","icon":"code","at":"exactly one"},{"label":"Verify + commit","sub":"flip passes → true","icon":"check","at":"commits"}],"center":{"label":"next shift","agent":true,"at":"next shift"}},"start":94.577,"dur":20.516,"words":[{"text":"Their","s":94.877,"e":95.117},{"text":"answer","s":95.197,"e":95.597},{"text":"is","s":95.677,"e":95.757},{"text":"a","s":95.837,"e":95.917},{"text":"disciplined","s":95.997,"e":96.477},{"text":"handoff.","s":96.557,"e":97.197},{"text":"Every","s":97.757,"e":97.997},{"text":"session","s":98.077,"e":98.397},{"text":"gets","s":98.477,"e":98.637},{"text":"its","s":98.757,"e":98.877},{"text":"bearings","s":98.997,"e":99.277},{"text":"first,","s":99.357,"e":99.997},{"text":"from","s":100.077,"e":100.157},{"text":"a","s":100.197,"e":100.237},{"text":"progress","s":100.317,"e":100.637},{"text":"file","s":100.717,"e":101.117},{"text":"and","s":101.197,"e":101.277},{"text":"the","s":101.357,"e":101.397},{"text":"git","s":101.437,"e":101.597},{"text":"log.","s":101.677,"e":101.997},{"text":"It","s":102.477,"e":102.557},{"text":"runs","s":102.677,"e":102.797},{"text":"a","s":102.837,"e":102.877},{"text":"quick","s":102.957,"e":103.117},{"text":"smoke","s":103.197,"e":103.437},{"text":"test.","s":103.517,"e":103.917},{"text":"It","s":104.317,"e":104.477},{"text":"implements","s":104.717,"e":104.957},{"text":"exactly","s":105.037,"e":105.757},{"text":"one","s":105.917,"e":106.077},{"text":"failing","s":106.237,"e":106.557},{"text":"feature,","s":106.637,"e":107.357},{"text":"verifies","s":107.437,"e":107.917},{"text":"it","s":107.997,"e":108.077},{"text":"end","s":108.157,"e":108.237},{"text":"to","s":108.317,"e":108.397},{"text":"end,","s":108.477,"e":109.037},{"text":"commits,","s":109.117,"e":109.757},{"text":"and","s":109.837,"e":109.917},{"text":"flips","s":110.077,"e":110.317},{"text":"that","s":110.397,"e":110.477},{"text":"feature's","s":110.557,"e":110.957},{"text":"pass","s":111.117,"e":111.277},{"text":"flag","s":111.357,"e":111.597},{"text":"to","s":111.677,"e":111.757},{"text":"true.","s":111.837,"e":112.237},{"text":"Then","s":112.717,"e":112.957},{"text":"the","s":113.117,"e":113.197},{"text":"next","s":113.277,"e":113.437},{"text":"shift","s":113.557,"e":113.677},{"text":"begins.","s":113.757,"e":114.477}]},{"template":"statement","chapter":"Back pressure","narration":"Loops only work with back pressure: checks the loop has to satisfy, like tests, types and linters. Dex Horthy's lesson from Ralph: if you can make a problem very verifiable, you can treat it like a black box and loop on it. Karpathy's AutoResearch is the same idea. Give an agent an objective, a metric and boundaries. Overnight, it found tunings in his code that he'd missed.","params":{"text":"Make it *verifiable*, and you can loop on it.","sub":"AutoResearch: “an objective, a metric, your boundaries. And go.” — Andrej Karpathy","sub_at":"objective","art":"gauge","tone":"good","sync":false},"start":115.093,"dur":25.557,"words":[{"text":"Loops","s":115.393,"e":115.793},{"text":"only","s":115.953,"e":116.193},{"text":"work","s":116.273,"e":116.513},{"text":"with","s":116.593,"e":116.673},{"text":"back","s":116.753,"e":116.913},{"text":"pressure:","s":116.993,"e":117.873},{"text":"checks","s":117.953,"e":118.193},{"text":"the","s":118.273,"e":118.313},{"text":"loop","s":118.353,"e":118.593},{"text":"has","s":118.673,"e":118.753},{"text":"to","s":118.793,"e":118.833},{"text":"satisfy,","s":118.993,"e":119.793},{"text":"like","s":119.913,"e":120.033},{"text":"tests,","s":120.113,"e":120.753},{"text":"types","s":120.953,"e":121.153},{"text":"and","s":121.233,"e":121.313},{"text":"linters.","s":121.393,"e":122.313},{"text":"Dex","s":122.753,"e":122.993},{"text":"Horthy's","s":123.033,"e":123.393},{"text":"lesson","s":123.473,"e":123.793},{"text":"from","s":123.873,"e":123.953},{"text":"Ralph:","s":124.033,"e":124.713},{"text":"if","s":124.993,"e":125.073},{"text":"you","s":125.113,"e":125.153},{"text":"can","s":125.233,"e":125.313},{"text":"make","s":125.393,"e":125.473},{"text":"a","s":125.513,"e":125.553},{"text":"problem","s":125.633,"e":126.033},{"text":"very","s":126.193,"e":126.433},{"text":"verifiable,","s":126.513,"e":127.553},{"text":"you","s":127.593,"e":127.633},{"text":"can","s":127.713,"e":127.793},{"text":"treat","s":127.873,"e":128.033},{"text":"it","s":128.073,"e":128.113},{"text":"like","s":128.193,"e":128.273},{"text":"a","s":128.353,"e":128.433},{"text":"black","s":128.593,"e":128.753},{"text":"box","s":128.833,"e":129.153},{"text":"and","s":129.233,"e":129.313},{"text":"loop","s":129.393,"e":129.553},{"text":"on","s":129.633,"e":129.713},{"text":"it.","s":129.793,"e":129.953},{"text":"Karpathy's","s":130.433,"e":130.993},{"text":"AutoResearch","s":131.153,"e":131.793},{"text":"is","s":131.873,"e":131.953},{"text":"the","s":132.033,"e":132.113},{"text":"same","s":132.193,"e":132.273},{"text":"idea.","s":132.353,"e":133.033},{"text":"Give","s":133.313,"e":133.393},{"text":"an","s":133.473,"e":133.553},{"text":"agent","s":133.633,"e":133.953},{"text":"an","s":133.993,"e":134.033},{"text":"objective,","s":134.113,"e":134.913},{"text":"a","s":134.953,"e":134.993},{"text":"metric","s":135.073,"e":135.473},{"text":"and","s":135.633,"e":135.713},{"text":"boundaries.","s":135.793,"e":136.633},{"text":"Overnight,","s":136.913,"e":137.633},{"text":"it","s":137.713,"e":137.793},{"text":"found","s":137.913,"e":138.033},{"text":"tunings","s":138.113,"e":138.433},{"text":"in","s":138.513,"e":138.553},{"text":"his","s":138.593,"e":138.673},{"text":"code","s":138.753,"e":138.993},{"text":"that","s":139.033,"e":139.073},{"text":"he'd","s":139.153,"e":139.313},{"text":"missed.","s":139.473,"e":140.033}]},{"template":"list","chapter":"Slow loops","narration":"You don't need an overnight swarm to start. Dex recommends slow loops: a nightly job that runs the linter, fixes one thing, and opens one small pull request, so you wake up to a slightly better codebase. Boris runs dozens of loops: one babysits his pull requests and fixes CI, another hunts flaky tests, another clusters user feedback.","params":{"title":"Loops worth running","items":[{"text":"Nightly: fix one lint issue → one small PR","sub":"Dex Horthy's slow loop","at":"nightly"},{"text":"Babysit PRs: fix CI, rebase","sub":"Boris Cherny","at":"babysits"},{"text":"Keep CI healthy: hunt flaky tests","at":"flaky"},{"text":"Triage feedback into themes","at":"feedback"}]},"start":140.65,"dur":24.121,"words":[{"text":"You","s":140.95,"e":141.11},{"text":"don't","s":141.19,"e":141.35},{"text":"need","s":141.43,"e":141.51},{"text":"an","s":141.59,"e":141.75},{"text":"overnight","s":141.83,"e":142.23},{"text":"swarm","s":142.31,"e":142.63},{"text":"to","s":142.71,"e":142.79},{"text":"start.","s":142.87,"e":143.55},{"text":"Dex","s":143.83,"e":144.07},{"text":"recommends","s":144.15,"e":144.63},{"text":"slow","s":144.71,"e":145.03},{"text":"loops:","s":145.11,"e":145.91},{"text":"a","s":145.99,"e":146.07},{"text":"nightly","s":146.15,"e":146.39},{"text":"job","s":146.47,"e":146.79},{"text":"that","s":146.87,"e":146.95},{"text":"runs","s":147.07,"e":147.19},{"text":"the","s":147.27,"e":147.31},{"text":"linter,","s":147.35,"e":147.99},{"text":"fixes","s":148.11,"e":148.47},{"text":"one","s":148.55,"e":148.63},{"text":"thing,","s":148.79,"e":149.35},{"text":"and","s":149.39,"e":149.43},{"text":"opens","s":149.51,"e":149.91},{"text":"one","s":149.99,"e":150.15},{"text":"small","s":150.31,"e":150.63},{"text":"pull","s":150.71,"e":150.87},{"text":"request,","s":150.95,"e":151.67},{"text":"so","s":151.75,"e":151.83},{"text":"you","s":151.87,"e":151.91},{"text":"wake","s":151.99,"e":152.15},{"text":"up","s":152.23,"e":152.31},{"text":"to","s":152.35,"e":152.39},{"text":"a","s":152.47,"e":152.63},{"text":"slightly","s":152.71,"e":153.11},{"text":"better","s":153.19,"e":153.35},{"text":"codebase.","s":153.43,"e":154.55},{"text":"Boris","s":154.63,"e":155.03},{"text":"runs","s":155.11,"e":155.51},{"text":"dozens","s":155.55,"e":155.91},{"text":"of","s":155.95,"e":155.99},{"text":"loops:","s":156.07,"e":156.87},{"text":"one","s":156.95,"e":157.19},{"text":"babysits","s":157.27,"e":157.75},{"text":"his","s":157.83,"e":157.91},{"text":"pull","s":157.99,"e":158.07},{"text":"requests","s":158.15,"e":158.63},{"text":"and","s":158.71,"e":158.79},{"text":"fixes","s":158.91,"e":159.19},{"text":"CI,","s":159.27,"e":160.07},{"text":"another","s":160.15,"e":160.55},{"text":"hunts","s":160.63,"e":160.87},{"text":"flaky","s":160.91,"e":161.19},{"text":"tests,","s":161.27,"e":162.07},{"text":"another","s":162.27,"e":162.47},{"text":"clusters","s":162.63,"e":163.03},{"text":"user","s":163.11,"e":163.35},{"text":"feedback.","s":163.43,"e":164.15}]},{"template":"terminal","chapter":"Headless","narration":"Loops run headless. Boris describes Claude's print mode as a Unix utility: give it a prompt, get JSON back, and pipe it into anything. And a stop hook can check the tests when the agent tries to finish, and simply tell it: keep going.","params":{"title":"ci · nightly-slow-loop","lines":[{"k":"cmd","text":"npx eslint . --format json | head -c 4000 > lint.json","at":"print mode"},{"k":"cmd","text":"claude -p \"Fix ONE issue from lint.json. Run tests. Commit.\" --output-format json","at":"Unix utility"},{"k":"dim","text":"  stop hook: tests failing → \"keep going\"","at":"stop hook"},{"k":"ok","text":"tests pass · committed 1 fix","at":"keep going"},{"k":"cmd","text":"gh pr create --title \"nightly: fix one lint issue\" --fill"}]},"start":164.771,"dur":15.944,"words":[{"text":"Loops","s":165.071,"e":165.471},{"text":"run","s":165.551,"e":165.791},{"text":"headless.","s":165.871,"e":166.751},{"text":"Boris","s":167.071,"e":167.391},{"text":"describes","s":167.471,"e":167.871},{"text":"Claude's","s":167.951,"e":168.351},{"text":"print","s":168.471,"e":168.591},{"text":"mode","s":168.671,"e":168.991},{"text":"as","s":169.071,"e":169.151},{"text":"a","s":169.191,"e":169.231},{"text":"Unix","s":169.391,"e":169.631},{"text":"utility:","s":169.711,"e":170.591},{"text":"give","s":170.671,"e":170.751},{"text":"it","s":170.791,"e":170.831},{"text":"a","s":170.871,"e":170.911},{"text":"prompt,","s":171.111,"e":171.551},{"text":"get","s":171.631,"e":171.791},{"text":"JSON","s":171.871,"e":172.271},{"text":"back,","s":172.351,"e":172.751},{"text":"and","s":172.871,"e":172.991},{"text":"pipe","s":173.071,"e":173.311},{"text":"it","s":173.351,"e":173.391},{"text":"into","s":173.471,"e":173.551},{"text":"anything.","s":173.631,"e":174.311},{"text":"And","s":174.591,"e":174.671},{"text":"a","s":174.751,"e":174.791},{"text":"stop","s":174.831,"e":175.151},{"text":"hook","s":175.231,"e":175.471},{"text":"can","s":175.551,"e":175.711},{"text":"check","s":175.831,"e":175.951},{"text":"the","s":176.031,"e":176.111},{"text":"tests","s":176.311,"e":176.511},{"text":"when","s":176.591,"e":176.671},{"text":"the","s":176.711,"e":176.751},{"text":"agent","s":176.911,"e":177.071},{"text":"tries","s":177.231,"e":177.391},{"text":"to","s":177.471,"e":177.551},{"text":"finish,","s":177.751,"e":178.111},{"text":"and","s":178.191,"e":178.271},{"text":"simply","s":178.351,"e":178.591},{"text":"tell","s":178.671,"e":178.751},{"text":"it:","s":178.791,"e":179.231},{"text":"keep","s":179.351,"e":179.471},{"text":"going.","s":179.631,"e":180.111}]},{"template":"statement","chapter":"Use the boundaries","narration":"Mitchell Hashimoto has a simple habit. He spends the boundaries of his day, when he wakes up and before he stops, deciding what slow task an agent can do while he's away: library research, edge case analysis, triage. Those agents write reports. They aren't allowed to respond to anyone.","params":{"text":"Before you stop for the day, ask: what can my agent be doing *while I'm away*?","sub":"Mitchell Hashimoto: research, edge cases, triage reports, nothing that acts on its own.","art":"moon","tone":"human","sync":false},"start":180.715,"dur":19.471,"words":[{"text":"Mitchell","s":181.015,"e":181.335},{"text":"Hashimoto","s":181.415,"e":182.055},{"text":"has","s":182.135,"e":182.215},{"text":"a","s":182.295,"e":182.375},{"text":"simple","s":182.455,"e":182.695},{"text":"habit.","s":182.775,"e":183.255},{"text":"He","s":183.815,"e":183.895},{"text":"spends","s":183.975,"e":184.215},{"text":"the","s":184.295,"e":184.375},{"text":"boundaries","s":184.535,"e":184.855},{"text":"of","s":184.935,"e":184.975},{"text":"his","s":185.015,"e":185.095},{"text":"day,","s":185.175,"e":185.735},{"text":"when","s":185.775,"e":185.815},{"text":"he","s":185.895,"e":185.975},{"text":"wakes","s":186.055,"e":186.215},{"text":"up","s":186.295,"e":186.535},{"text":"and","s":186.615,"e":186.775},{"text":"before","s":186.935,"e":187.095},{"text":"he","s":187.175,"e":187.255},{"text":"stops,","s":187.335,"e":188.135},{"text":"deciding","s":188.255,"e":188.695},{"text":"what","s":188.815,"e":188.935},{"text":"slow","s":189.015,"e":189.255},{"text":"task","s":189.335,"e":189.735},{"text":"an","s":189.775,"e":189.815},{"text":"agent","s":189.975,"e":190.215},{"text":"can","s":190.295,"e":190.375},{"text":"do","s":190.455,"e":190.615},{"text":"while","s":190.695,"e":190.775},{"text":"he's","s":190.815,"e":190.935},{"text":"away:","s":191.015,"e":191.815},{"text":"library","s":191.895,"e":192.295},{"text":"research,","s":192.375,"e":193.175},{"text":"edge","s":193.295,"e":193.415},{"text":"case","s":193.495,"e":193.655},{"text":"analysis,","s":193.735,"e":194.615},{"text":"triage.","s":194.735,"e":195.495},{"text":"Those","s":195.815,"e":195.975},{"text":"agents","s":196.055,"e":196.375},{"text":"write","s":196.455,"e":196.615},{"text":"reports.","s":196.935,"e":197.415},{"text":"They","s":197.575,"e":197.655},{"text":"aren't","s":197.735,"e":197.855},{"text":"allowed","s":197.895,"e":198.135},{"text":"to","s":198.175,"e":198.215},{"text":"respond","s":198.455,"e":198.695},{"text":"to","s":198.775,"e":198.855},{"text":"anyone.","s":198.935,"e":199.575}]},{"template":"compare","chapter":"Caveats","narration":"Some caveats. Geoffrey Huntley warns you'll sometimes wake up to a broken codebase, so commits and tags are your restore points. Peter Steinberger thinks heavy upfront plans for loops are waterfall in disguise. And OpenAI's harness team says their end-to-end autonomy depends heavily on their repo's structure and tooling, so don't assume it transfers for free.","params":{"left":{"title":"Risks","tone":"bad","items":["You'll wake up to a broken build","Big upfront plans can be waterfall","Autonomy depends on your tooling"],"at":"caveats"},"right":{"title":"Mitigations","tone":"good","items":["Commits and tags as restore points","Small tasks, re-planned often","Invest in checks before autonomy"],"at":"restore points"}},"start":200.186,"dur":23.546,"words":[{"text":"Some","s":200.486,"e":200.726},{"text":"caveats.","s":200.766,"e":201.686},{"text":"Geoffrey","s":201.926,"e":202.326},{"text":"Huntley","s":202.406,"e":202.806},{"text":"warns","s":202.926,"e":203.126},{"text":"you'll","s":203.206,"e":203.446},{"text":"sometimes","s":203.686,"e":203.926},{"text":"wake","s":204.006,"e":204.166},{"text":"up","s":204.246,"e":204.406},{"text":"to","s":204.446,"e":204.486},{"text":"a","s":204.566,"e":204.646},{"text":"broken","s":204.846,"e":205.046},{"text":"codebase,","s":205.126,"e":206.006},{"text":"so","s":206.166,"e":206.326},{"text":"commits","s":206.406,"e":206.726},{"text":"and","s":206.806,"e":206.886},{"text":"tags","s":207.126,"e":207.366},{"text":"are","s":207.446,"e":207.526},{"text":"your","s":207.566,"e":207.606},{"text":"restore","s":207.846,"e":208.086},{"text":"points.","s":208.286,"e":208.966},{"text":"Peter","s":209.086,"e":209.206},{"text":"Steinberger","s":209.286,"e":209.926},{"text":"thinks","s":210.006,"e":210.246},{"text":"heavy","s":210.326,"e":210.646},{"text":"upfront","s":210.766,"e":211.126},{"text":"plans","s":211.286,"e":211.446},{"text":"for","s":211.526,"e":211.606},{"text":"loops","s":211.686,"e":212.086},{"text":"are","s":212.206,"e":212.326},{"text":"waterfall","s":212.486,"e":212.886},{"text":"in","s":212.926,"e":212.966},{"text":"disguise.","s":213.086,"e":214.086},{"text":"And","s":214.246,"e":214.406},{"text":"OpenAI's","s":214.486,"e":215.126},{"text":"harness","s":215.259,"e":215.526},{"text":"team","s":215.686,"e":215.846},{"text":"says","s":215.926,"e":216.166},{"text":"their","s":216.246,"e":216.486},{"text":"end-to-end","s":216.566,"e":216.966},{"text":"autonomy","s":217.086,"e":217.606},{"text":"depends","s":217.686,"e":218.086},{"text":"heavily","s":218.166,"e":218.566},{"text":"on","s":218.646,"e":218.726},{"text":"their","s":218.806,"e":218.886},{"text":"repo's","s":219.046,"e":219.286},{"text":"structure","s":219.526,"e":219.766},{"text":"and","s":219.846,"e":219.926},{"text":"tooling,","s":220.006,"e":220.806},{"text":"so","s":220.886,"e":221.126},{"text":"don't","s":221.206,"e":221.366},{"text":"assume","s":221.526,"e":221.686},{"text":"it","s":221.766,"e":221.846},{"text":"transfers","s":221.966,"e":222.326},{"text":"for","s":222.446,"e":222.566},{"text":"free.","s":222.726,"e":223.126}]},{"template":"quiz","chapter":"Quick check","narration":"Quick check. Which task is the best fit for an overnight loop? Tap your answer.","params":{"q":"Which task is the best fit for an overnight loop?","options":["Redesign the onboarding flow based on vibes","Make the test suite run under 2 minutes without reducing coverage","Decide next quarter's roadmap","Rewrite the auth system, which has no tests"],"answer":1,"explain":"It has a clear metric and a hard boundary the loop can check after every iteration."},"start":223.732,"dur":10.829,"words":[{"text":"Quick","s":224.032,"e":224.272},{"text":"check.","s":224.352,"e":224.672},{"text":"Which","s":225.152,"e":225.392},{"text":"task","s":225.472,"e":225.792},{"text":"is","s":225.872,"e":225.952},{"text":"the","s":226.032,"e":226.112},{"text":"best","s":226.192,"e":226.432},{"text":"fit","s":226.512,"e":226.752},{"text":"for","s":226.832,"e":226.912},{"text":"an","s":226.952,"e":226.992},{"text":"overnight","s":227.152,"e":227.552},{"text":"loop?","s":227.672,"e":228.272},{"text":"Tap","s":228.352,"e":228.512},{"text":"your","s":228.592,"e":228.672},{"text":"answer.","s":228.872,"e":229.312}]},{"template":"exercise","chapter":"Try it","narration":"Design your first slow loop. This prompt has the agent propose a small, nightly improvement with a strict check, without scheduling anything yet.","params":{"title":"Try it with your agent","intro":"Design (don't schedule yet) a slow loop:","prompt":"Propose one nightly \"slow loop\" for this repo: a job that fixes\nexactly ONE small thing (a lint warning, a flaky test, a TODO) and\nopens one small PR. Write the prompt file, the verification it must\npass, and how it records progress. Don't schedule or run it yet."},"start":234.561,"dur":10.432,"words":[{"text":"Design","s":234.861,"e":235.341},{"text":"your","s":235.421,"e":235.581},{"text":"first","s":235.661,"e":236.061},{"text":"slow","s":236.141,"e":236.381},{"text":"loop.","s":236.461,"e":237.101},{"text":"This","s":237.421,"e":237.581},{"text":"prompt","s":237.661,"e":237.981},{"text":"has","s":238.061,"e":238.141},{"text":"the","s":238.221,"e":238.301},{"text":"agent","s":238.461,"e":238.621},{"text":"propose","s":238.741,"e":239.021},{"text":"a","s":239.101,"e":239.261},{"text":"small,","s":239.501,"e":239.901},{"text":"nightly","s":239.981,"e":240.301},{"text":"improvement","s":240.381,"e":240.941},{"text":"with","s":241.021,"e":241.101},{"text":"a","s":241.181,"e":241.261},{"text":"strict","s":241.461,"e":241.661},{"text":"check,","s":241.741,"e":242.461},{"text":"without","s":242.621,"e":242.781},{"text":"scheduling","s":242.861,"e":243.341},{"text":"anything","s":243.421,"e":243.821},{"text":"yet.","s":243.941,"e":244.381}]},{"template":"recap","chapter":"Recap","narration":"Recap. Long runs are loops of fresh sessions. One task per iteration, with state kept in files and git. Loops need back pressure, so make the problem verifiable. Start with slow loops and restore points. Next: harness engineering, building the whole factory.","params":{"items":["Loops of *fresh sessions*, not marathons","One task per iteration; state in files + git","Back pressure: verifiable checks","Start with slow loops"],"next":"Harness engineering: build the factory","next_at":"Next"},"start":244.993,"dur":21.231,"words":[{"text":"Recap.","s":245.293,"e":246.133},{"text":"Long","s":246.413,"e":246.653},{"text":"runs","s":246.733,"e":247.053},{"text":"are","s":247.133,"e":247.213},{"text":"loops","s":247.373,"e":247.613},{"text":"of","s":247.693,"e":247.853},{"text":"fresh","s":248.013,"e":248.173},{"text":"sessions.","s":248.253,"e":249.093},{"text":"One","s":249.373,"e":249.533},{"text":"task","s":249.613,"e":249.933},{"text":"per","s":250.013,"e":250.093},{"text":"iteration,","s":250.173,"e":250.893},{"text":"with","s":250.973,"e":251.053},{"text":"state","s":251.133,"e":251.453},{"text":"kept","s":251.533,"e":251.693},{"text":"in","s":251.773,"e":251.853},{"text":"files","s":251.933,"e":252.333},{"text":"and","s":252.413,"e":252.493},{"text":"git.","s":252.573,"e":252.973},{"text":"Loops","s":253.533,"e":253.853},{"text":"need","s":253.933,"e":254.093},{"text":"back","s":254.173,"e":254.333},{"text":"pressure,","s":254.413,"e":255.053},{"text":"so","s":255.133,"e":255.293},{"text":"make","s":255.453,"e":255.613},{"text":"the","s":255.653,"e":255.693},{"text":"problem","s":255.773,"e":256.093},{"text":"verifiable.","s":256.253,"e":257.293},{"text":"Start","s":257.613,"e":257.853},{"text":"with","s":257.933,"e":258.093},{"text":"slow","s":258.173,"e":258.413},{"text":"loops","s":258.493,"e":258.813},{"text":"and","s":258.893,"e":258.973},{"text":"restore","s":259.173,"e":259.373},{"text":"points.","s":259.453,"e":259.933},{"text":"Next:","s":261.053,"e":261.533},{"text":"harness","s":261.613,"e":262.013},{"text":"engineering,","s":262.573,"e":263.133},{"text":"building","s":263.293,"e":263.373},{"text":"the","s":263.453,"e":263.533},{"text":"whole","s":263.773,"e":263.853},{"text":"factory.","s":264.333,"e":264.653}]}],"total":266.624,"audio":"/audio/17-long-running.mp3"}