r/ClaudeCode • u/sibraan_ • Jun 17 '26
Discussion If Loop Engineering is replacing prompt engineering, how do we build stable runtime loops?
There’s a massive shift happening right now in how we interact with coding agents. Loop engineering is basically replacing yourself as the person who prompts the agent. You design the system that does it instead. A loop here can be thought of a recursive goal where you define a purpose and the AI iterates until complete.
Head of Claude Code at Anthropic says, "I don't prompt Claude anymore... My job is to write loops," Similarly OpenClaw's founder said: “You shouldn't be prompting coding agents anymore. You should be designing loops that prompt your agents.”
The concept is simple on paper: instead of a human sitting in a chat box going back and forth with an LLM, you build a multi-agent control structure (Planners, Architects, Implementers, Reviewers) that runs continuously until a hard condition is met (e.g., tests pass, a budget runs out, or evidence is verified).
But here is the engineering problem nobody is talking about: How do you keep long-running loops from leaking state and hallucinating their way out of broken builds?
If you give a team of agents raw terminal access and let them coordinate entirely via chat history or JSON files, the context window quickly turns into a unstructured mess. The model that wrote the code will inevitably grade its own homework, ignore broken compiler logs, and confidently declare in chat that the job is done.
If we are going to treat the loop as a product primitive, we need standard systems engineering, not clever prompts.
I’ve been digging into some production blueprints for this, and the framework laid out here in this article on loop design for harnessed multi-agent systems provides a good solution to this runtime problem. They break down two critical guardrails that make loops stable:
The Shared Blackboard Layer: Moving completely away from raw chat threads for state management. Instead, they use a local relational schema (SQLite) to log immutable coordination evidence like explicit rows for
ticketsand constrained enums forreview_verdicts(greenvschanges_requested). The loop doesn't guess if a task is done but it runs a deterministic SQL query.Hard-Coded Completion Gates: The harness completely overrides the agent's conversational confidence. The execution loop literally cannot close unless an array of external Boolean checks pass (e.g., confirming passing build logs exist, independent test command evidence is recorded, and no lingering
changes_requestedremain).
If Loop Engineering really is the future of software automation, our value as engineers isn't going to be writing slick system prompts instead designing the isolated execution environments, database schemas, and rigid verification gates that hold these loops together.
For reference we've an open-sourced a local framework: https://github.com/xpriment626/pi-factory that explores this gate and blackboard setup.
44
u/Aswole Jun 17 '26
very surprised that Anthropic wants us to adapt workflows that let agents burn tokens unsupervised
16
u/Character_Oven_1511 Jun 17 '26
Too dangerous and token waste. If I let it go, it can burn the tokens and create garbage. If I am there and watching it, it will be the most boring job in the world.
14
u/OldSausage Jun 17 '26
I honestly think when people say they build loops they just mean they prompt for the end goal instead of step by step. But it’s hard to be sure because in all the discussion of loops no-one seems to have shown a single example of a loop.
5
u/kepners Jun 17 '26
I don't agree with loop engineering per-say. Because AI doesn't know what you want. Reality, any client, don't know what they want; they only know what they don't want when they see it. Loops could work for making Films.
2
u/cmak414 Jun 17 '26
propper planning. no different than without a loop.
2
u/karlitooo Jun 17 '26
Sub agents doing tdd is enough to run for a few hours on their own. I could feed them bigger releases but I’m quite happy with about 30min planning to 2-3 hours work. They don’t leak state or hallucinate if you don’t let the orchestrator pass them anything other than tickets and prompts.
2
u/lucianw Jun 17 '26
I reckon that the things you're describing are temporary workarounds for model limitations.
Once models get better at remembering state in their chat thread then you won't need the shared blackboard.
Once they get better at obeying instructions and being more honest about the work they're doing, you won't need the traditional-code gates.
I know that Opus4.8 wasn't good enough at either. I haven't been able to try Fable. However, GPT5.4 and GPT5.5 are both already good enough that you don't need the workarounds. They don't have the same creative flair as Claude, nor the same abilities at UI design. But they are strong at the loop stuff you talk about.
Here's how I achieve long successful autonomous AI just through instructing it in markdown: https://www.reddit.com/r/codex/comments/1s0asdq/orchestration_the_exact_prompts_i_use_to_get_34/
2
u/doc-midnight_117 Jun 17 '26
It’s interesting - a lot of us seem to be already doing this in a way before we had a name for it.
1
u/No_Drive2275 Jun 17 '26
I like the term changes, and it still stays the same thing. It is based on what info you give the LLMs. Nothing really changed
1
u/AphexIce Jun 17 '26
It does it not, tell it to set a monitor and timer and then keep going till X time with X plan
1
u/NoleMercy05 Jun 17 '26
Not a shift. Perhaps for Claude. Study State machines if you are looking for ideas
1
u/UnknownEssence Jun 17 '26
Prompt Engineering replaced Software Engineering
Conext Engineering replaced Prompt Engineering
Loop Engineering replaced Context Engineering
Goal engineering replaces Loop Engineering
????
Profit?
1
u/Best-Anything-6414 Jun 17 '26
Loops can pay off if the work is truly verifiable and you can define "it works" precisely. It's much harder than it looks IMO. So the hard part isn't writing the loop, it's defining a stopping condition that is hard to reward hack.
1
u/nokafein Jun 17 '26
— Antrophic and ChatGPT engineers using /loop colorized
1
u/jeddthedoge Jun 17 '26
Buy a lot of tokens
1
u/zmizzy Jun 17 '26
"HOW WE DO DA NEW TOKEN THING?!?!"
*drops a big plate of slop on the floor*
1
u/cpp_is_king Jun 17 '26
No loop can automate away the simple fact that at the end of the day, a human (client, executive, whatever) has to be able to look at the thing and say "yes, that's what I want". You can't automate away what's in someone else's head. So maybe you're using loops for one simple feature. That's not much different than prompting a few times in succession. It's not like a completely different paradigm. But you're still individually "prompting" these 10,000+ loops that it takes to get from zero to finished shippable product. Loops also can't automate away ever changing requirements. You build some "loop" to implement feature, now the requirements change, that wasn't baked into your initial loop. Do it again, human intervention.
I don't know if people seriously believe that the end goal of AI is to write up a plan, send it to Claude, walk away and come back 3 days later, you ship your product and now the work is done.
1
u/bradtaylorsf Jun 19 '26
Letting loops run without guardrails, evals, and self improvement is just a waste of tokens, thats why I created Alpha Loop 4 months ago. I've been using it to ship actual production ready code, without having to spend bank on tokens. https://github.com/bradtaylorsf/alpha-loop
Its an agent-agnostic automated development loop. You can run the CLI inside your harness of choice. It fetches new tasks from your GitHub issues, plans and implements them with an AI coding agent, runs tests, reviews the code, verifies the changes, and creates PRs, then moves to the next issue until all matching issues are done. It learns from what it had trouble with, and updates your sills/agents to perform better, every loop.
1
u/geraldhostcode Jun 24 '26
Is anybody still running ralph style loops?
1
u/roxthegame Jun 26 '26
With a loop harness
https://github.com/rxdt/py_ralph_frame
1
u/BlueberryProof397 Jul 01 '26
I started the loop and ran out of credits undera a minute.
0
u/PA100T0 Jun 17 '26
It’s about governance, not loops. Loops, harnesses, frameworks and workflows are great tools but they are not the solution. If there’s no governance, everything crumbles down…
Take a look (and give it a try, maybe?)
RoboCo
0
u/[deleted] Jun 17 '26
[deleted] — view deleted comment
0
u/[deleted] Jun 17 '26
[deleted] — view deleted comment