CodeWork
Agent

How the Agent Works

What happens between a prompt and an answer.

CodeWork is a loop around a model. You send a prompt, the model answers or asks for a tool, CodeWork runs the tool and returns the result, and the model goes again. The loop ends when the model answers without a tool call.

A Run, Step by Step

  1. You send a prompt. It’s saved to the session before any work starts.
  2. CodeWork builds the request. The system prompt, the conversation so far, and the session’s tools.
  3. The model responds. It streams text, and reasoning on models that support it. It may call tools.
  4. CodeWork runs the tools. Each runs in the session’s sandbox. The output, or the error, goes back to the model.
  5. Repeat until the model answers without a tool call.

Each model response is one turn. A prompt usually takes several.

Tool calls from one response run one after another. Set model.toolExecution to parallel in your settings to run them at the same time.

Streaming Output

InterfaceWhat it shows
codework runThe answer on stdout. Header and usage on stderr.
ACP editorsThe answer, reasoning, and each tool call
RPC serverEvery event, through event.subscribe

So you can redirect just the answer:

codework run "Summarize the open TODOs in this repo" > todos.md

The System Prompt

The system prompt is a short base prompt plus your project’s AGENTS.md or CLAUDE.md files. See Instructions.

Retries

CodeWork retries rate limits, overloads, server errors, timeouts, and dropped connections. The failed attempt isn’t kept in the conversation.

By default it retries up to 3 times, waiting 2 seconds and doubling each time, up to 60 seconds. If the provider asks for a longer wait, the turn fails. Quota, billing, bad request, and prompt-too-long errors are never retried.

Change the limits with retry in your settings.

Sending More While It Works

codework run and ACP editors send one prompt at a time. An editor’s second prompt to a busy session is rejected.

With the RPC server, session.prompt takes a delivery field:

deliveryWhen the model sees it
steer (default)Before its next model request, mid-task
followUpAfter the current work. Queued one at a time.

codework run --server <url> --session <id> sends a follow-up, so it waits its turn.

Stopping a Run

InterfaceHow to stop
codework runctrl-c. With --server, it stops the session.
ACP editorsThe stop button (session/cancel)
RPC serversession.interrupt

Stopping ends the response and any running tool calls, which are recorded as aborted. The session is kept, so send another prompt when you’re ready.

No Permission Prompts

CodeWork never asks before it acts. Every tool runs as soon as the model calls it. Work in a git repository so changes are easy to review and undo, and use a sandbox for work you don’t want on your machine.