← Essays

From For-Loops to Colonies

How agentic coding grows from a persistent loop into coordinated systems, and what that asks of their human designers.

Rajesh Vasa11 min read
In this essay
  1. The Agent Is Just a For-Loop
  2. The Ralph Loop: Persistence Until Done
  3. When Single Agents Aren't Sufficient
  4. The Colony Pattern: Decentralized Coordination
  5. The Human Layer
  6. The Integrated Architecture
  7. What Remains Unsolved
  8. The Synthesis
  9. Sources

In April 2025, thirty practitioners gathered in Melbourne to address an urgent question: not whether AI would transform software development, but how quickly the entire socio-technical system could be redesigned so humans, machines, and metrics evolve responsibly together.

Nine months later, practical insights have emerged from experience rather than theory. Teams have deployed hundreds of agents for extended periods. Individual agents have constructed complete programming languages overnight. Through months of building full systems with coding agents, clear patterns of success and failure have become apparent.

This synthesis draws from five distinct agentic coding experiments plus research on AI's effects on human cognition:

  • Browser Use's minimal agents
  • The Ralph Loop approach
  • Cursor's multi-agent scaling
  • The Colony pattern
  • The human cognitive layer

These reveal a layered architecture with potential for genuine scaling, along with important cautions about removing "noise" from workflows.

The Agent Is Just a For-Loop

Gregor Zunic of Browser Use advocates for minimalism. An agent fundamentally consists of "a for-loop of messages" with minimal state management. Browser Use discovered that complex abstractions—message managers, planning modules, verification layers—eventually hindered rather than helped development.

The core insight: "Agent frameworks fail not because models are weak, but because their action spaces are incomplete." Rather than constraining actions upfront, better to assume models can accomplish almost anything, then selectively restrict capabilities.

Browser Use provides raw Chrome DevTools Protocol access plus browser extension APIs. When one approach fails, the model routes around it. Every abstraction encodes assumptions about intelligence that reinforcement learning can overturn. Models trained on millions of examples have encountered more patterns than humans can anticipate.

One critical discovery involves ephemeral messages. Browser state—DOM snapshots, screenshots, element indices—easily exceeds 50KB per request. Without ephemeral handling, context rapidly explodes. Marking certain tool outputs to retain only recent instances prevents this accumulation. This pattern reflects a temporary issue; as agent memory techniques mature, humans won't need to manage this manually.

The Ralph Loop: Persistence Until Done

A fundamental problem exists with naive agent loops: agents terminate prematurely, returning no tool calls when stuck rather than when genuinely complete.

Ralph Loop, emerging from Geoff Huntley's experiments, addresses this through continuous prompt cycling:

while :; do cat PROMPT.md | claude-code ; done

The approach lets AI observe its previous work in the filesystem and Git history, achieving self-referential iteration through external state rather than mere output-feedback-as-input cycling.

This matters because LLM self-assessment proves unreliable. Models exit thinking they've finished, not when objectively verifiable success criteria are met.

Ralph Loop employs three elements: clear completion criteria (machine-verifiable success), Stop Hook interception (forced continuation if standards aren't met), and max-iterations safeguards (preventing infinite loops).

The done() tool forces explicit completion instead of implicit "I suppose we're done?" Both Claude Code and Gemini CLI implement this approach.

Each iteration functions as a fresh session. Rather than reading bloated history, agents scan current project structure and log files directly. State management shifts from LLM memory (token sequences) to disk (filesystem).

Key files include progress.txt (appended logs of attempts and confirmed patterns), prd.json (structured task lists with pass/fail status), and git-history (successful steps committed, providing clear change differentials).

This enables Ralph to support continuous development across hours or days, with Git history becoming cumulative memory.

Results prove striking: a complete programming language built overnight, a $50K contract delivered for $297 in compute costs, multi-week refactoring projects running unattended.

The philosophy: "Building software with Ralph requires faith and belief in eventual consistency. Each iteration tunes the system."

When Single Agents Aren't Sufficient

Ralph Loops excel for single-agent persistence. But parallel development requiring twenty agents on identical codebases demands different approaches.

Cursor's research team conducted large-scale experiments with hundreds of concurrent agents, weeks of runtime, and millions of lines of code.

Their achievements included:

  • Web browser development from scratch (1M+ lines; partial webpage rendering)
  • Solid-to-React migration (+266K/-193K lines over three weeks)
  • Windows 7 emulator work (1.2M lines, 14.6K commits)

Initial attempts revealed valuable failure modes. Agents coordinating through shared files with locking created severe bottlenecks. Twenty agents reduced to two-or-three's throughput—most time spent waiting for locks. Agents held them too long or forgot releasing them.

Optimistic concurrency control proved simpler and more robust, but exposed a deeper problem: "With no hierarchy, agents became risk-averse. They avoided difficult tasks and made small, safe changes instead."

The successful solution employed Planners continuously exploring codebases and creating tasks (spawning sub-planners recursively), Workers executing tasks without worker-to-worker coordination, and Judges determining cycle-end continuation.

Notably, they removed more structure than added. An initial integrator role for quality control and conflict resolution created more bottlenecks than benefits. Workers already handled conflicts themselves.

Model choice matters for sustained tasks. Different models excel in different roles. Prompts matter more than architecture. Optimal structure balances too-little (creating conflicts and drift) with too-much (creating fragility). Even well-architected systems require periodic fresh starts combating drift.

The Colony Pattern: Decentralized Coordination

Cursor's planner/worker hierarchy functions effectively but maintains integration points becoming bottlenecks at scale. Humans face cognitive overload merging machine-speed output.

Consider twenty agents generating diffs at machine speed: merge conflicts explode across hundreds of files, semantic mismatches emerge undetectable by diff tools, one agent optimizes for performance while another prioritizes readability—both "correct" yet incompatible.

Ralph Loops provide linear persistence. Swarms deliver parallel power with centralized merges. The situation resembles directing 300 Kmph traffic without lights.

Ant colonies offer a biological model. No ant understands full nest design. Each follows simple local rules. Yet colonies build bridges, optimize paths, adapt to disasters—without central planning. Intelligence emerges from organization rather than centralization.

This direction remains work-in-progress. After extensive hands-on agentic coding building complete systems, clear patterns emerge. Failing approaches are centralized: bottlenecking integrators, contention-prone coordination files, humans as merge-resolution layers for machine-speed output. Successful patterns are distributed: workers resolving their own conflicts, recursively decomposing planners, locally-resolved stress propagating upward.

A colony architecture would incorporate biological principles:

Agents signal "stress levels" when goals face threats. Test agents spike stress when proposed changes break tests—before committing. Coherence agents flag rising stress when agents drift semantically. Signals remain local (no bottlenecks), ephemeral (old signals decay), continuous (always flowing).

Rather than just handling errors, actively defend desired states: compilable codebase, passing tests, maintained invariants. When contributions threaten these, attempt local recovery before escalating. This distributes defense, addressing Cursor's bottlenecking-integrator finding.

Each agent possesses full capabilities but focuses on its domain. Test Defenders can do anything but attend to test integrity. Hierarchy emerges from scope rather than authority.

LLM communication proves lossy. Force agents stating understanding, confidence, and ambiguities. This catches "confident but wrong" divergences requiring periodic fresh starts.

Won't better models eventually obsolete this structure? It depends on structure type.

Intelligence structures (how to think, what to decide) will be obsoleted. This already belongs to hyperscalers; most organizations won't build them. Infrastructure structures (how to communicate, when to signal) won't—these are protocols rather than intelligence, areas where all practitioners can contribute without millions of GPUs.

TCP/IP doesn't encode knowledge about communication content; it provides communication protocols. The colony architecture would be infrastructure, not intelligence. Stress signals wouldn't dictate agent actions—they'd provide coordination channels.

The Human Layer

Overlooked question: what happens to humans in the loop?

The April 2025 Melbourne unconference surfaced this tension sharply. Every cognitive micro-struggle outsourced to models withdraws from hard-won tacit knowledge reserves. Sufficient withdrawals create organizational fragility.

Ralph Loop practitioners have established a simple framework:

HITL (Human-in-the-Loop): Run once, observe, intervene. Use for learning, prompt optimization, high-risk tasks, accepting humans become bottlenecks.

AFK (Away From Keyboard): Run in loops with iteration limits. Use for batch work, mechanical tasks, low-risk execution.

Start with HITL, developing system understanding and optimizing prompts. HITL resembles pair programming—working alongside AI, reviewing during creation. Graduate to AFK after prompts stabilize and foundations validate. Set iteration limits, create notifications, review commits upon return.

Pure AFK carries massive risk. Without developing intuition for underlying system internals—just high-level behavior—knowledge differs fundamentally from code. Traditionally, engineers developed through debugging loops, stack traces, resilience from failures, re-architecting for cross-cutting features. If machines perform everything, engineers might lack deep system understanding. Whether this remains necessary remains uncertain. It feels necessary based on pre-AI coding experience, though this intuition may prove inaccurate for AI-augmented futures. Evidence will eventually show human-AI operating limits.

Research on human-AI augmentation revealed something counter-intuitive. When deploying LitQuest (a literature review classification tool), it increased cognitive load (subjective exhaustion) while improving productivity (objective speed). Researchers felt more depleted despite working faster. This isn't the promised outcome.

The working hypothesis: previously, researchers used System 1 thinking (fast, automatic) for obvious "No" classifications, occasionally switching to System 2 (slow, effortful) for ambiguous cases. The AI tool, filtering easy cases, forced System 2 faster, keeping them there.

Drawing from Kahneman's research on "noise," traditional workflows contain significant random variability. While eliminating this seems desirable, in cognitive workflows this manifests as easy decisions—cognitive rest intervals. Successfully eliminating noise inadvertently eliminates recovery periods.

Users face a "purified" stream of difficult decisions maintaining chronic System 2 activation. Overload arises not from increased information volume but from artificially maximized decision entropy. Workflows lack cognitive padding.

Human cognition operates as scale-free, fractal systems. Neurons require refractory periods. Individuals oscillate between automatic execution and methodical analysis. Teams oscillate between focused work and context-building.

When AI maximizes information density, it forces monostable states. Natural work's fractal topology flattens. Workflows become "smooth" (consistent difficulty) rather than "rough" (oscillating difficulty).

The consequence: epistemic brittleness. Without low-entropy valleys, humans cannot recover from fatigue accumulation. They disengage—not from incompetence but from cognitive duty-cycle collapse.

This directly affects human-agent system design:

HITL isn't merely oversight; it's cognitive sustainability. It serves dual functions: catching agent errors and maintaining human engagement and judgment. Remove the second and "looks good to me" rubber-stamping quickly emerges.

Intentional friction proves necessary. Optimal human-AI interaction requires AI re-introducing low-stakes interactions—not as errors but pacing matching biological operators' needs. This might mean showing easy classifications despite AI capability or interleaving quick wins with complex decisions.

Ralph Loop's HITL/AFK spectrum matters cognitively. Starting Human-in-the-Loop isn't just prompt learning—it's maintaining cognitive oscillation keeping humans effective. Graduate to AFK only for mechanical work where human judgment isn't the bottleneck.

If five PRs hourly are shallow reformats, speed metrics lie. AI inflates vanity metrics. As organizations scale agent usage, they inadvertently create metrics around task allocation, token consumption, or utilization rates. Leaderboards emerge from IDE logs, curated and watched continuously.

Cognitive load research indicates what actually matters: metrics tracking whether human-AI systems produce durable value while remaining cognitively sustainable.

Verification depth matters more than verification speed. How thoroughly did humans engage outputs? Surface approval after exhaustion isn't verification—it's uninsured liability.

Recovery integration needs tracking. Are natural cognitive workload valleys present? Systems eliminating easy work maximize short-term throughput while destroying long-term effectiveness.

Tacit knowledge accumulation remains valuable. Every cognitive micro-struggle outsourced withdraws from hard-won reserves. Are junior engineers building intuition or becoming prompt-writers unable to debug without AI? What intuition develops from constant agent use?

Epistemic resilience remains necessary. When assumptions need revision, how costly is change? Systems with high AI dependency and low human understanding become brittle when AI's frozen training distribution diverges from evolving reality while humans lack deep compensation knowledge.

These metrics share common threads: focusing on human cognitive sustainability and capability preservation rather than throughput alone. Human capability must exist within frameworks enabling human flourishing—no value in capable yet miserable humans.

The Integrated Architecture

Synthesizing inputs reveals layered architecture addressing distinct problems:

Agent level: Browser Use demonstrates viable direction—minimal internals, maximal action space. For-loops of tool calls. Let models work. Don't encode intelligence assumptions.

Single-agent persistence: Ralph Loop solves premature termination. Continue until verifiably done. Use done() tools for explicit completion. Maintain state through files and Git, not token sequences. Ephemeral messages prevent context explosion.

Multi-agent coordination: Cursor's planner/worker hierarchy provides necessary structure without over-engineering. Planners decompose; workers execute without coordinating each other. Remove integrator bottlenecks. Different models suit different roles. Periodic fresh starts combat drift.

Scale beyond human mediation: The colony direction suggests stress signaling and homeostatic defense instead of centralized coordination. This postulate represents patterns potentially working when current approaches hit limits. The principle: coordination emerges locally, not through central bottlenecks.

Human layer: Recognize augmentation's paradox. HITL serves cognitive sustainability, not just oversight. Intentional friction preserves duty cycles. Metrics should track verification depth, tacit knowledge accumulation, and epistemic resilience—not just throughput.

What Remains Unsolved

Cursor acknowledges honestly: "Multi-agent coordination remains a hard problem. Our system works but nowhere near optimally. Planners should wake when tasks complete. Agents occasionally run too long. We still need periodic fresh starts combating drift."

Open colony-pattern questions: What stress signal vocabulary proves right? How do effective coordination norms bootstrap quickly? When does colonies genuinely need human input versus self-recovery capability?

Deeper cognitive load question: Can AI systems enhance human capability rather than replacing struggle with exhaustion? The goal isn't faster output—it's sustainable augmentation preserving tacit knowledge and judgment making humans valuable.

The Synthesis

Nine months ago, debate centered on whether AI changes software engineering. Now the focus shifts to redesigning socio-technical systems.

The architecture is layered: minimal agent internals with maximal affordances; Ralph Loop persistence until verifiable completion; planner/worker hierarchy for multi-agent structure; colony-style coordination for true scale; careful human cognitive sustainability attention throughout.

The Bitter Lesson applies to intelligence, not infrastructure. The focus isn't encoding thinking—it's building coordination protocols.

But cognitive load research teaches deeper lessons: AI augmentation isn't purely technical. Eliminating "noise" eliminates cognitive rest. Maximizing information density collapses the fractal structure making human cognition sustainable. Forward progress requires systems where humans and machines co-evolve—not machines doing everything while humans rubber-stamp results.

Tools increasingly open. Browser Use releases agent-SDKs. Ralph Loop patterns document across frameworks. Cursor shares learnings publicly. What matters now is experimenting and observing what happens to loop-humans, not just produced code.

If you're building agentic tools, scaling struggles, considering sustainable human-AI collaboration, or deploying AI in real systems—let's connect.

@rajesh-vasa.bsky.social | @rvasa on X.com | linkedin.com/in/rvasa

Sources

  1. Browser Use - Gregor Zunic, "An Agent is Just a For-Loop" (16 Jan 2026) https://x.com/gregpr07/status/2012052139384979773

  2. Ralph Wiggum Blog - Geoff Huntley, "Ralph Wiggum as a Software Engineer" (July 2025) https://ghuntley.com/ralph/

  3. Alibaba Blog - DanKun, "From ReAct to Ralph Loop" (15 Jan 2026) https://www.alibabacloud.com/blog/from-react-to-ralph-loop-a-continuous-iteration-paradigm-for-ai-agents_602799

  4. Cursor Blog - Wilson Lin, "Scaling Long-Running Autonomous Coding" (Jan 2026) https://cursor.com/blog/scaling-agents

  5. Melbourne Unconference - Rajesh Vasa, "Melbourne Unconference reflections" (April 2025) https://aiengineering.leaflet.pub/3mclg34ufbc2s