# The Model Is Not the Agent

Inside the shared loop behind Claude Code, Codex, Pi, fx, OpenCode, and the rest.

13 minresearched from primary sources

Claude Code, Codex, Pi, fx, OpenCode, Aider, Goose, and the rest do not share one codebase. They share a shape: a model inside an execution harness. The model proposes; the harness decides what reaches your machine.

Official fx coding agent artwork
fx·tiny Zig harness · shell-shaped
Official Pi coding agent artwork
Pi·minimal core · deeply extensible
Official OpenCode artwork
OpenCode·open source · provider-flexible

# first: local agent does not mean local model

“Local” describes where the harness and its tools run. The agent can read your live worktree, execute your shell, reach a local database, and observe uncommitted changes. The model inference may still happen through OpenAI, Anthropic, Google, or another remote provider.

Some harnesses can point at a local model, but that is an independent decision. Treating runtime location and inference location as the same switch hides the most important security boundary in the system.

agent = model + context + tools + policy + runtime + proof

The model supplies judgment. Everything after it determines what that judgment can see, do, and safely return.

The model determines capability. The harness determines how that capability touches reality.

share this line

# the category is wider than five names

The useful split is not Claude versus Codex. It is the product opinion wrapped around the loop.

Claude Codefirst-party · SDK + hooks
Codexopen harness · sandboxed
Antigravity CLIGoogle · successor terminal
GitHub Copilotrepository and platform native
Piminimal · TypeScript extensions
fxsmall · Zig · embeddable
OpenCodeopen source · shared service
Aider / Goosemodel-agnostic · composable
first-partyClaude Code and Codex can tune the harness, model behavior, permissions, and product surface together.
open harnessPi, fx, OpenCode, Aider, and Goose make provider choice, extension shape, and inspectability part of the product.
editor-nativeCursor, Windsurf, Zed, and IDE agents trade terminal purity for selection context, inline diffs, diagnostics, and visual review.
cloud workerOna, Devin, Codex cloud, Jules, and background agents wrap the loop in scheduling, provisioning, persistence, and remote handoff.
embeddedSDKs and app servers expose the loop as infrastructure inside another product instead of forcing the user into a generic chat UI.

# the loop underneath all of them

Anthropic documents Claude's loop plainly: receive prompt, evaluate, call tools, feed results back, repeat, return a final result. OpenAI calls the reusable layer around that process the harness. Open-source agents expose variations of the same state machine directly in code.

prompt → decide → use a tool → observe → repeat → verify

  1. 01

    assemble contextLoad instructions, repository state, history, and available tools.

  2. 02

    decideThe model chooses the next useful action.

  3. 03

    check permissionThe harness allows, asks about, or rejects that action.

  4. 04

    executeA tool reads a file, edits code, runs a command, or controls another system.

  5. 05

    observeThe result returns to the model and changes the next decision.

  6. 06

    verifyTests, builds, and review decide whether the work is actually done.

The middle of the sequence loops; verification and handoff are what turn activity into useful work.

conceptual harness loop
context = assemble(system, projectRules, history, repo, tools)

while (!done) {
  response = model(context)

  if (response.toolCalls.length === 0) break

  for (const call of response.toolCalls) {
    policy.check(call)
    const result = sandbox.execute(call)
    context.append(result)
  }

  context = compactIfNeeded(context)
}

return verifyAndSummarize(diff)

The model never reaches into the filesystem by magic. It emits a structured request such as “read this file” or “run this command.” The harness validates the arguments, checks policy, performs the action, captures the result, and gives that observation back to the model. That mediation layer is where most of the engineering lives.

# seven decisions make harnesses feel different

01

Context assembly

Which instruction files are loaded? How is the repository mapped? Does the harness search lazily, preload a tree, or ask a subagent? A model cannot reason over context it never sees.
02

Tool grammar

A narrow read/edit/bash toolkit is cheap and predictable. Browser, MCP, computer use, image tools, and deployment integrations expand capability while consuming context and authority.
03

Permission boundary

“Ask before shell,” allowlisted command patterns, filesystem sandboxes, network rules, and per-agent capabilities decide the blast radius of a wrong tool call.
04

Memory and compaction

Long sessions overflow. A good harness compresses observations while retaining the objective, decisions, changed files, failures, and proof state—not merely the latest conversation turns.
05

Editing protocol

Whole-file rewrites, patches, search/replace blocks, language-server edits, and IDE transactions fail differently. The same model can look careful or chaotic depending on the edit primitive.
06

Orchestration

Subagents can isolate research and parallelize independent work, but they also create merge conflicts, partial truths, and summaries that hide evidence. Delegation needs ownership, not just concurrency.
07

Observability

Tool logs, approval events, token use, checkpoints, session replay, and final diffs determine whether a human can understand what happened after a thirty-minute run.

# five philosophies, not five winners

Claude CodeA batteries-included first-party harness. The Agent SDK exposes tools, permissions, hooks, cost controls, sessions, and the same execution loop used by Claude Code.
CodexAn open harness with explicit sandbox and approval policies, available through CLI, app, SDK, and app-server integration layers.
PiA deliberately small TypeScript core extended through skills, prompt templates, themes, packages, and arbitrary extensions. It treats the harness as something you should reshape.
fxA tiny experimental Zig harness with a Unix-shell form factor, model/provider independence, WASM support, and an unusually small context and memory footprint.
OpenCodeAn open-source terminal client whose local background service owns sessions, configuration, integrations, permissions, and tool execution across clients.
Aider / GooseTwo older, durable open approaches: Aider centers git-aware terminal pair programming; Goose spans desktop, CLI, API, MCP extensions, and provider choice.

A ranking would be obsolete by the time it is indexed. The durable question is: which harness gives this task the right context, tools, boundaries, feedback speed, and proof?

# why I still want the agent beside the repo

  • The working tree is honest. The agent sees the migration I have not committed, the local fixture I am debugging, and the exact branch state producing the bug.
  • Steering is immediate. I can interrupt after one wrong assumption instead of receiving a polished implementation of the wrong architecture.
  • Local systems are reachable. Databases, emulators, design files, browsers, device simulators, and proprietary tooling often exist only on the development machine.
  • Taste loops stay tactile. Animation timing, spacing, loading states, accessibility, and interaction quality need a human looking at the product while it changes.
  • The harness is composable. A terminal agent can call the same scripts, linters, test runners, and git tooling the team already trusts.

# the workflow that earns trust

The impressive workflow is not one giant prompt. It is a sequence that keeps intent, execution, and judgment separate enough to inspect.

  1. 01readMap the code before touching it.
  2. 02isolateOne task, one worktree, one owner.
  3. 03changeKeep the diff smaller than the task description.
  4. 04exerciseRun the product, not only the type checker.
  5. 05proveLint, tests, build, and a visual pass.
  6. 06reviewFresh context reads the final diff.
  1. 01Start in read-only mode. Ask for the request path, relevant files, existing conventions, risk surfaces, and verification commands.
  2. 02Write the acceptance criteria before the patch. If success cannot be observed, the agent cannot close the loop honestly.
  3. 03Give one owner the edit surface. Other agents may research or review, but simultaneous writers need separate worktrees and non-overlapping boundaries.
  4. 04Run the narrow check early. Exercise the changed component or failing test before paying for the full suite.
  5. 05Run the broad checks late. Lint, types, tests, production build, and product-level QA catch integration failures.
  6. 06Review from fresh context. A second pass reads the requirement and final diff without inheriting the builder's justifications.

# worktrees are an isolation primitive, not an org chart

Multiple local agents writing into one directory is a race condition with prose attached. Git worktrees give each task a branch and a filesystem boundary. They do not decide which agent owns the schema, shared component, or architectural choice.

one task, one writable lane
main worktree       human integration + final review
feature worktree    one implementation owner
research session    read-only; returns evidence
review session      read-only; reads requirement + final diff

don't

Launch five agents into the same checkout because the tasks sound independent.

do

Partition by outcome and edit surface; give each writer an isolated worktree.

Concurrency is useful only when the merge cost stays lower than the time it saved.

# context is not memory

A large context window lets a model receive more tokens. It does not guarantee that the right evidence remains salient. Repository instructions, session history, tool schemas, search results, command output, images, and diffs all compete for attention.

durable rulesProject instruction files hold commands, conventions, safety boundaries, and architectural facts that should survive every session.
working stateThe current objective, plan, touched files, decisions, failures, and next check belong in the active session.
tool outputLogs are evidence, not memory. Preserve the error and conclusion; discard repetitive noise once it has served the next decision.
subagent resultReturn a finding with file paths and proof. A confident paragraph without traceable evidence is context pollution.
system of recordThe repository, issue, tests, and git history—not the chat transcript—must contain everything needed to continue the work.

# permissions are product design

The question is not whether an agent is “autonomous.” The useful question is which actions can happen without interruption, which need approval, and which should be impossible in this task.

a sane default policy
read repository           allow
search files              allow
edit inside workspace     allow after plan
run known test commands   allow
network access            task-specific
read secrets              deny
destructive git           always ask
publish / deploy / merge  human approval

# what I do not delegate

  • The reason the product should exist. Agents can research alternatives; they cannot own the consequence of choosing one.
  • Irreversible architecture under ambiguity. Database ownership, public contracts, security posture, and data deletion need accountable human judgment.
  • Final visual taste. An agent can inspect, compare, and iterate. The decision that something feels coherent is still mine.
  • Claims without sources. Especially in fast-moving agent markets, a plausible acquisition or feature is not a fact until the primary announcement supports it.

# the durable takeaway

Local agents are not valuable because the terminal looks serious. They are valuable because the harness can sit next to the real system: the live repository, the shell, the running product, and the human who still understands why the change matters.

Tool names will rotate. Companies will merge. Models will leapfrog one another. The stable architecture is the loop—and the craft is in designing its context, permissions, tools, memory, verification, and stopping conditions well enough that useful intelligence becomes trustworthy work.

# primary docs

  1. 01Claude Code — how the agent loop worksPrompt, model evaluation, tool execution, repeated turns, sessions, and compaction.
  2. 02Codex as a platformOpenAI's description of the harness, app server, tools, sandbox, approvals, and state.
  3. 03Pi documentationOfficial description of Pi's minimal core and extension surfaces.
  4. 04fxOfficial product page for the Zig harness, size, WASM support, and provider flexibility.
  5. 05OpenCode CLIOfficial description of its terminal clients, automation mode, and shared local service.
  6. 06Aider documentationGit-aware AI pair programming in the terminal.
  7. 07GooseOfficial open-source agent documentation covering CLI, desktop, API, and MCP.
  8. 08Gemini CLI to Antigravity CLI transitionOfficial Google repository announcement from May 2026.