Why the loop?
The baseline of software development is shifting. This shift represents a basic law of human nature: we seek the highest leverage possible, moving from manual labor to delegation, and finally to orchestration. Because attention is the new bottleneck, anything that lets the work continue with less interruption could make a move in the right direction. By early 2026, empirical research of open-source projects estimated that coding agent adoption had reached between 22% and 29% of more than 128,000 active repositories on GitHub. Those who become proficient in agentic workflows now operate with a level of leverage that elevates their entire team’s productivity. However, it also increases the cognitive load on everyone who is taking responsibility at the systemic level.
To understand this shift, let’s trace the technical lineage of loops and set some high level expectations.
Academic foundations
The academic seed was Yao et al.’s ReAct paper in October 2022, which interleaved reasoning traces with tool calls. ReAct beat reinforcement learning baselines by 34% on ALFWorld and 10% on WebShop by reasoning before acting, mirroring human nature: we perform better when verbalizing plans. Then came AutoGPT in early 2023, raising millions in venture funding. While early iterations of ReAct frequently spun in infinite loops, it proved developers wanted hands-off automation, highlighting the need for structural guardrails.
Stateless experimentation
In mid-2025, developers ran stateless bash loops that piped prompts into command-line agents and reset context files on every tick. Resetting context prevents cognitive bloat and acknowledges that human memory limits also apply to models. Stateless bash loops worked only because the durable state lived outside the model: in Git history, in progress files, and in the test suite. It successfully built self-hosting compilers over months of automated runs. By spring 2026, major tool environments absorbed this pattern, shipping native commands like /goal to let agents run unattended loops.
The mathematics of autonomy
Consider a theoretical example:
If you put your agent in a flat sequential chain to complete multiple tasks in a row, the agent’s success rate degrades exponentially. When each of its individual steps operates as an independent probability event, a sequence of N steps has a cumulative success rate of pN. For instance, if you run a task requiring 20 consecutive file modifications with a model that has p = 0.95 accuracy, then you face a success rate of only 36%. Without your structural interventions, they will fail almost certainly.
Is 0.95 a real number? Treat it as an illustrative per-step reliability, not as a benchmark result. Even a frontier model reaches reliable multi-step outcomes only when it runs inside a verified harness. If your own per-step reliability sits closer to 75%, then the raw chain is already under 6% by step 10. The verification around the model sets the ceiling, which is why the loop matters.
This is why you need evaluation loops. A verification gate should not force your agent to retry indefinitely (which causes infinite spinning runaways). Instead, it should pinpoint where the error occurred and allow the model exactly one targeted retry to fix it. If your agent has a 95% base accuracy, and your evaluation loop has a 95% chance of spotting and fixing the error on that single retry, the effective step success probability rises to 0.95 + (0.05 x 0.95) = 99.75%.
That arithmetic assumes the check is independent of the worker, so the gate has to be an outside check. Compilers, test suites, and linters give you that for free, and behavioral evaluations let you assert on discrete tool calls and intermediate actions in seconds instead of waiting on a full end-to-end benchmark. For semantic judgments that a deterministic test cannot make, I pair models from different families so the reviewer does not share the worker’s blind spot.
Even if fixing fails, just spotting the error with a 95% accuracy, lets you jump in and manually realign the system while keeping the same 99.75% subagent accuracy and only paying the cost of human-in-the-loop intervention.
The table below shows the probability of completion across different chain lengths, comparing raw models to this single-retry course-correction topology:
|
Chain Length |
95% Accuracy |
95% x 95% Loop |
|
3 Steps |
86% |
99% |
|
5 Steps |
77% |
99% |
|
10 Steps |
60% |
98% |
|
15 Steps |
46% |
96% |
|
20 Steps |
36% |
95% |
|
30 Steps |
21% |
93% |
|
50 Steps |
8% |
88% |
What about context bloat?
If each step in a chain adds approximately 1% of context in tokens, you end up with a chain that is not much longer than 50 steps before we require compression. A 95% base accuracy that can be evaluated (and course corrected with 95% accuracy for each dimension that we care about) should keep you at good success rates for such individual running agents. If you establish a scalable way to divide and conquer problems, you can apply similar principles to drive your subagents. As we can see, at 20 steps, a 95% accuracy paired with a single-retry corrective loop yields a 95% end-to-end success rate (assuming the correction itself stays under our 20 steps soft limit) while keeping context size reasonable. Note that there is no explicit requirement for the correction to be AI or human driven, but rather it needs to produce accurate and verifiable results.
This is where you divide problems into tasks that require a small number of steps each. If a problem is more complex, it remains approachable, but it must be divided into smaller subproblems, and so on. For our example, this means allocating up to 20 steps for each level agent, task, and trajectory and another 20 steps for the next level supervisory agent to consolidate contributions. To prevent drift, establish separate evaluations at all subagent and supervisory levels with a final acceptance criteria.
Lastly, you must evaluate these metrics at least once for each level to verify that they measure the right target before running automation at a higher level. These are general estimations, but help you quickly decide whether you should split a problem, repeat a step, or commit results and move on.
In practice, your numbers will look different, but the scaling laws will be similar.
How to build a durable system
What started as a source of friction has now become one of my primary driving curiosities: how do we build automation when we still have a lot to learn about the craft itself? I have a few ideas.
To build a loop that does not run off a cliff, you must establish core guardrails that will keep accuracy high and will allow us to debug and intervene whenever necessary. Specifically, these are the pillars I identified:
-
Durable state: Git-backed checkpoints ensure that your agent can resume work after a crash.
-
Verification gates: Automated test suites and compilers deterministically check that the changes are correct. Write the acceptance criteria and the tests upstream, before implementation starts, and make one rule explicit in your project instructions: an agent cannot pass a gate by deleting or weakening a test. When done properly, gates can have >95% accuracy. However, you should be on the lookout for edge cases you might have forgotten about. Especially if verification, evaluation, or manual validation success rates diverge for any of your features.
-
Evals: Anything that cannot be deterministically verified but is important should have an evaluation or benchmark which you can later inspect for accuracy. Try to write them in a way that will keep answers to a simple yes or no and accuracy high, ideally over 95%. If you’re getting results that point to confusion or unexpected failures, you probably need to split the criteria into simpler ones.
-
Halt conditions: Turn limits (as we saw above, 20 seems to be the sweet spot) and token or dollar cost ceilings stop runs before API budgets get out of control.
-
Standardized skills and instructions: Reusable utilities, documented in the SKILL.md format, preferably bundled with code and source of truth references. Pair them with an AGENTS.md that holds the project invariants every run load. Skills stay on disk until their description matches the task, so they do not eat into the 20-step context window.
These pillars don’t name a model version, but rather a model family. Individual model leads last only weeks. The asset that survives each release is the harness and its processes: the AGENTS.md instructions every run loads, the SKILL.md modules loaded only when relevant, the isolated Cloud Run sandbox where the loop runs around the clock, the deterministic checks, and the cross-model review. When a run fails or you have to intervene, patch your harness along with the code: a new test, a line in AGENTS.md, a note in the skill. The next run inherits the lesson even though its context starts from zero.
Platform built-in systems
Platforms like Google Antigravity have codified these patterns (/grill-me and /goal) into built-in primitives, shifting the work from custom scripts to platform capabilities for most straightforward use cases. The same harness files travel with the repository whether you run Google Antigravity 2.0, the agy CLI, or Antigravity inside VS Code, JetBrains, or Cursor. I would encourage you to give these a try. Do remember, however, to keep an eye on trajectory lengths and look for model confusion.
I myself frequently rely on the /goal primitives in Google Antigravity 2.0 when coordinating multi-turn tasks that require extensive validation and measurements before completion. To anchor this execution, use the /grill-me command for an interactive interview to lock in design constraints, invariants, and the tests that decide success before running /goal loops.
Constructing the metrics for this technical article and then editing it is just one example of how I use these execution loops.
By pairing /goal with /grill-me, you can establish an effective pair-programming dynamic: alignment on intent, followed by autonomy in execution.
Custom DIY loops
To understand the evolution of loops, compare two distinct architectures for DIY agentic loops:
Stateless five-liner
Geoffrey Huntley’s “Ralph” loop is a prime example of stateless architecture. Here’s the simplest working version of an Antigravity CLI loop:






