Skip to main content
Back

Goal-Driven's Two-Agent Loop Builds a TypeScript Compiler in 100 Hours

A prompt-only framework turns Claude Code and Codex into self-supervising agents that run for hundreds of hours without human babysitting

Repo, Full Access
  • What it is: A prompt-only multi-agent pattern (Goal-Driven) that runs Claude Code or Codex for 300+ hours autonomously on hard coding problems.
  • Core mechanic: A master agent evaluates a verifiable success criterion every 5 minutes and restarts the subagent if the goal is not yet met.
  • Real outputs: A TypeScript compiler in C++ (~100 hrs) and a SQLite implementation in Rust (~30 hrs) were built entirely by this system.
  • No install required: The entire framework is a prompt template you paste into Claude Code, Codex, or any multi-agent tool.
  • Key constraint: Only works for tasks with machine-checkable success criteria (e.g., a test suite); vague goals cause infinite loops or early stops.
  • Industry signal: Claude Code shipped a native /goal command in v2.1.139, validating the pattern as a first-class workflow for long-running agent tasks.

Goal-Driven is a multi-agent pattern that has accumulated 1.4k stars on GitHub. The entire repo is a README and a prompt template. No SDK, no library, no framework to install. You define a goal, define a measurable success condition, and let a two-agent loop run until the work is done, potentially for hundreds of hours.

The wall every agent user hits

Anyone who has run a long Claude Code or Codex session has encountered this: you ask the agent to implement a complete feature, it runs for 30 minutes and does most of the work, but context is running low. You start a new session and discover it has no memory of which decisions were made, why option A beat option B, or what state the tests are in.

Long-running agentic sessions inevitably hit the context window ceiling. When accumulated messages exceed the model's context budget, performance degrades, costs spike, and earlier work gets forgotten. The standard advice is to use /compact or design sessions carefully. Goal-Driven takes a different architectural route: delegate isolated tasks to sub-agents, each of which gets a fresh context window, and return results to the parent as concise summaries. The master agent never accumulates a bloated context because its only job is to evaluate criteria and restart workers.

Four primitives, one loop

The system suits tasks that are intricate, time-consuming, and logically complex, but can be evaluated for success with a binary check. Typical examples include compiler design, mathematical theorem proving, database architecture, and EDA simulation challenges.

The entire system reduces to four concepts:

  • Goal — the single objective every agent is working toward