Skip to content
codeband is pre-release. These docs describe its first release, and some of what they describe is still being built.

Architecture

codeband is a few processes on your machine or server and the folders they work on. You start the long-running processes: the daemon, and a factory code server for each factory. Runs start from the CLI or from a GitHub issue, and the CLI and the web interface reach runs only through the daemon. The daemon runs each run and is the only process that writes run data. Each code server runs the pipeline code of its factory when the daemon asks. For each attempt of an agent step, the daemon starts a harness, such as Claude Code, in a new sandbox with a new workspace. All of them find each other through one folder, the state folder.

After this page you know which process runs your pipeline code, which one runs your agents, which one records the run, and where each file of a run lives.

The parts of codeband and the state folder they share GitHub issues a ticket system Web interface on the daemon's API CLI codeband run in your terminal Target repository your git repository Daemon codeband daemon Engine invokes the code server starts a harness for each attempt runs shell steps writes the run journal Code server codeband codeserver runs pipeline code, checks step outputs Factory your pipeline code Sandbox Harness Claude Code or Codex CLI Workspace a repository of its own run requests daemon API start, follow invocation starts loads once finds the start commit the daemon fetches the start commit the only writer of run data State folder$XDG_STATE_HOME/codeband repos/ a bare clone of each target repository, with hidden refs store/ the run store: run journals and blobs daemon.lock held by the one daemon that uses this folder daemon.sock the CLI reaches the daemon here codeserver.sock the daemon reaches the code server here
Part What it is Started by What it writes
CLI The codeband command. It is a daemon client, and codeband run is a trigger, a source of run requests: it asks the daemon for a run and follows it to its end You, for each run Nothing in the state folder
Web interface The page that codeband web and codeband dev serve. It is a daemon client too, and a trigger when it starts a run: it starts runs, answers human steps, cancels runs and delivers run results, and shows the scores of the runs on the dashboard of each factory. It acts only through the daemon’s API, as the CLI does. With --read-only it shows the same screens without their actions, for visitors You, with codeband web or codeband dev Nothing in the state folder
GitHub issues A ticket system. Each of its tickets, a GitHub issue, can be a trigger next to the CLI and the web interface: the label codeband/FACTORY/PIPELINE starts that pipeline, and the daemon polls the repositories that codeband.toml names for it. A run that an issue starts posts its human step questions and the notice of how it ended in the issue’s thread, its notification channel, and people with write access answer there Not a process Nothing in the state folder
Daemon The long-running process that runs in the foreground of a terminal. It hosts the engine, and every command reaches runs through it. It dials the code server of each factory that its config file codeband.toml names You, once, with codeband daemon or codeband dev Everything in the state folder except codeserver.sock
Engine The part of the daemon that executes runs: it invokes the code server, runs agent steps and shell steps in workspaces and writes the run journal The daemon The run journal of each run, its blobs, the bare clones, their hidden refs and the workspaces
Factory code server The process that loads one factory, runs its pipeline code and function steps for the engine, and checks each step output against its agent’s output type. The short form is code server. Each SDK ships one, and codeband codeserver starts the one of the factory. It never learns the name of its factory You, in the factory folder, with codeband codeserver or codeband dev Its socket, such as codeserver.sock, and whatever your function steps write
Harness An existing agent runtime that runs one attempt of an agent step: Claude Code or Codex CLI. codeband harness list shows which ones can run on this machine The engine, for each attempt Files and commits in its workspace
Factory The folder that holds your pipelines, your agents and the settings that list them. The daemon knows it under a name that codeband.toml gives, and the name of each of its pipelines starts with that name, such as py-factory/intake Not a process
Target repository The git repository a run works on, such as the one codeband run --repo names Not a process
Run store The store/ folder in the state folder, with one run journal per run and a blob store for files such as prompts, agent transcripts, patches and the full output of each shell step Not a process

Function steps, shell steps and agent steps run in different places. A function step is a function of your pipeline code whose result is recorded, and it runs inside the code server, with the code server’s environment variables. A shell step is a program that runs with an argument list in a workspace, and the engine runs it. An agent step is the recorded work of one agent in a run, from its step request to its step output, and the engine runs each attempt of it with a harness in a workspace. A workspace is a checked-out commit of the target repository, in a git repository of its own that the engine makes in the sandbox of one attempt or one shell step. It goes away with the sandbox.

Each attempt and each shell step runs in a new sandbox around its workspace: a process on the daemon’s machine for the kind host, or a container for the kind docker. The pipeline names the sandbox definition, and codeband.toml defines it.

The intake pipeline of the example py-factory has two function steps: received_at reads the clock and post_summary sends a summary to a webhook when one is set. It ends the run with one new ticket for each bullet of its input.

  1. You start the code server in the factory folder examples/py-factory. It reads the settings of the factory, loads its pipelines once and listens on codeserver.sock in the state folder. It does not see code that changes after it starts.
  2. You start the daemon. Its codeband.toml has the table [factories.py-factory], whose code_server is the address of that socket, so the daemon knows the factory as py-factory. It takes the lock daemon.lock in the state folder, opens the run store, asks the code server for the factory manifest, which describes what the factory defines, and listens on daemon.sock. A daemon that starts before the code server logs The code server does not answer, so runs start once it does and keeps running.
  3. You run codeband run --repo PATH/TO/REPO py-factory/intake with the run input in --input. PATH/TO/REPO is any folder in the target repository. The CLI finds the top folder of the target repository and turns --commit, HEAD by default, into a commit ID: the start commit. It warns when the repository has uncommitted changes, because the run does not see them. Then it sends a run request to the daemon over daemon.sock.
  4. The engine makes a bare clone of the target repository in repos/, the first time it sees that repository. It fetches the start commit into the clone and keeps it under the ref refs/codeband/runs/RUN-ID/start, where RUN-ID is the ID of the new run.
  5. The engine invokes the code server with the run input. An invocation is one run replay of the pipeline from the start: the code server checks the input against the pipeline’s parameters and runs the pipeline function until it reaches the first step that has no record. The engine creates the run journal, the ordered list of entries that records everything the run produces, with a first entry that records the pipeline, the name of its factory, the factory folder and its commit, the target repository, the start commit, the input and the user who asked for the run.
  6. A function step without a record runs in the code server, and the invocation ends with its value. A shell step, an agent step or a human step, a question that a person must answer, ends the invocation too when it has no record, and goes back to the engine as a new step. The engine writes each step and its value to the run journal. It runs a shell step in a new sandbox and workspace, runs an agent step as the next section shows, and at a human step it waits for a person’s answer. Then it invokes again, and every recorded step returns its recorded value instead of running again.
  7. When the pipeline function returns or stops the run, the engine delivers the run result, such as the files of its new tickets, and writes the last journal entry with where each part went. The CLI follows the run journal entries through the daemon and prints how the run ended, such as no code change, and the path of each new ticket. Run lists every way a run ends.

The run of intake took three invocations. The first two each ended at one function step, and the third ended the pipeline. The daemon logs the start and the end of each step.

Daemon log
Nov 24 10:08:06.212 INF Step started run=j0trba0sxh step=received_at#0
Nov 24 10:08:06.212 INF Step finished run=j0trba0sxh step=received_at#0
Nov 24 10:08:06.246 INF Step started run=j0trba0sxh step=post_summary#0
Nov 24 10:08:06.246 INF Step finished run=j0trba0sxh step=post_summary#0
Nov 24 10:08:06.279 INF Run finished run=j0trba0sxh status=finished reason=""

The run journal of this run is store/runs/j0trba0sxh/journal.jsonl in the state folder. Its 9 entries are the start of the run, one entry per invocation, a start and a value for each function step, and the end of the run with its new tickets.

The write_hello pipeline of py-factory runs one agent step of the agent writer, which may write to the target repository, and ends the run with that agent step’s commit as its code change. writer runs on the fake harness, which follows a script that the agent’s code gives and runs no model, so every agent step writes the file hello.txt.

  1. The invocation reaches the line of write_hello that calls the agent writer. The agent step writer#0 has no record, so the invocation ends and gives the engine the agent step: its step request, the agent’s harness and output type, its access and its timeout. The step request is everything the agent step starts from: the rendered prompt, the input and the start commit, which is the run head. The engine writes the agent step and its step request to the run journal and keeps the prompt in the blob store.
  2. The engine starts a new sandbox for attempt 0 and makes the workspace in it: a new git repository, into which it sends the start commit from the bare clone with git’s own transfer, and in which it checks that commit out.
  3. The engine starts the harness in the workspace and gives it the prompt and the output type. The harness runs the agent, and the engine keeps the harness’s raw agent transcript in the blob store. The fake harness of writer writes hello.txt and gives the step output that its script names.
  4. When the harness ends, the engine makes the attempt’s end commit. For an agent that may write, it is the agent’s own commits plus a commit of the files it left uncommitted, unless the agent discards those. For an agent that may only read, it is the start commit. The engine does this with git in the sandbox, fetches the end commit into the bare clone, keeps it under the hidden ref attempts/writer/0/0 of the run and removes the sandbox with its workspace.
  5. The engine asks the code server to check the step output against the agent’s output type. The code server rejects an output that does not match it, and the attempt fails with the attempt failure kind invalid_output.
  6. The engine keeps the end commit of the accepted attempt under the hidden ref agent_steps/writer/0 and writes the agent step’s value to the run journal: the step output, the end commit, the cost and the agent transcript.
  7. The engine invokes again. The call of writer returns the recorded step output, and write_hello returns a code change built from it. The engine makes the commit of the code change under the hidden ref code_change, keeps its patch in the blob store and delivers it to the run’s run result destination, here a patch file.

An attempt can fail, for example when the harness crashes, hits a rate limit or runs past its timeout. Depending on the kind of its attempt failure, the engine then starts a new attempt of the same agent step in a new workspace, and the step output comes from the last attempt.

Agent steps that the pipeline starts in parallel run at the same time, each attempt in its own workspace. The engine invokes the code server again after each of them ends, and checks their step outputs one at a time.

The daemon logs the start and the end of the agent step and of each of its attempts, with the cost of the attempt in US dollars.

Daemon log
Nov 24 15:34:26.456 INF Step started run=dhscd8mj0y step=writer#0
Nov 24 15:34:26.504 INF Attempt started run=dhscd8mj0y step=writer#0 attempt=0
Nov 24 15:34:26.607 INF Attempt finished run=dhscd8mj0y step=writer#0 attempt=0 cost_usd=0
Nov 24 15:34:26.633 INF Step finished run=dhscd8mj0y step=writer#0
Nov 24 15:34:26.733 INF Run finished run=dhscd8mj0y status=finished reason=""

The run journal of this run has 8 entries: the start of the run, two invocations, the start of the agent step, the start and the end of its attempt, the agent step’s value and the end of the run. The bare clone holds four hidden refs of the run, which git for-each-ref refs/codeband lists in the bare clone’s folder under repos/.

Hidden refs of the run
781cff918858ba21a774edac5549ad75931387ce commit refs/codeband/runs/dhscd8mj0y/attempts/writer/0/0
d7603f533034384777d4bc863404f01d78ccdc78 commit refs/codeband/runs/dhscd8mj0y/code_change
23960fcae0b32f66cf6a05fdcbf0447f19830360 commit refs/codeband/runs/dhscd8mj0y/start
781cff918858ba21a774edac5549ad75931387ce commit refs/codeband/runs/dhscd8mj0y/agent_steps/writer/0

The daemon, the code server and the CLI use the same state folder: $XDG_STATE_HOME/codeband, or ~/.local/state/codeband when XDG_STATE_HOME is not set. Each of them takes --stateDir, or the environment variable CODEBAND_STATE_DIR, to use another folder. The CLI and the daemon find each other only in the same state folder. The daemon finds each code server at the address that codeband.toml names, in the state folder or elsewhere.

Path in the state folder Written by Holds
daemon.sock Daemon The Unix socket of the daemon. The CLI connects here
daemon-read.sock Daemon The read-only address of the daemon’s API, which refuses every call that starts, answers, cancels, delivers or scores. codeband web --read-only connects here
codeserver.sock Code server The Unix socket of the code server that codeband dev starts, and the default of codeband codeserver. The daemon connects here when codeband.toml names it
daemon.lock Daemon A lock that the daemon holds while it runs
repos/ Daemon One bare clone per target repository, with the hidden refs of each run under refs/codeband/runs/
store/ Daemon The run store: runs/ with a folder per run that holds journal.jsonl and run.json, and blobs/

The daemon makes the state folder readable only by your user, and both sockets accept only your user. The daemon reads the user at the other end of each request from its socket, and records that user as the one who asked for a run or answered a human step.

The code_server field of each [factories.NAME] table names the address of a code server, a Unix socket as unix:PATH or a TCP address as http://HOST:PORT. The code server must listen on the same address: the Python SDK’s code server takes it as codeband codeserver --address. Each code server of a daemon needs its own address. codeband daemon --storeDir puts the run store in another folder.

The daemon is the only process that writes run data. codeband run, codeband answer, codeband graph, codeband check, codeband cancel and codeband web act only through its API. One writer needs no locking between processes, and the web interface can stop and start again without touching a run. A second daemon on the same state folder stops at once with another daemon uses the state folder …. The CLI never starts the daemon: you start it in its own terminal, so its lifetime and its log stay visible.

The code server never runs agents or touches workspaces

Section titled “The code server never runs agents or touches workspaces”

Function steps run in the code server, without a workspace. An invocation tells the code server the start commit’s ID but not where the target repository is. Everything that works on the code of a target repository, agent steps and shell steps, runs in the engine inside a workspace, so all of codeband’s access to code goes through one path. The code server keeps no state between requests, and the daemon can reach it at an http://HOST:PORT address as well as on a Unix socket.

codeband drives existing agent runtimes, Claude Code and Codex CLI, instead of an agent loop of its own. Harnesses improve faster than one tool could follow, and your team keeps the harness it knows. For each attempt, codeband starts the harness in the workspace, gives it the prompt, keeps its raw agent transcript and takes its final output, which the code server checks against the agent’s output type. Each harness has its own typed options, so an agent can use what its harness offers.

Every attempt and every shell step runs in a new workspace at its start commit, and the engine removes the workspace when it ends. Nothing carries over between them, including ignored files such as .venv or build output. An agent step starts only from what its step request records, so a run fork sees the same files on another machine, and a new attempt never meets a process that a stopped harness left running. The cost is that a shell step that installs dependencies installs them each time; tool caches outside the workspace, such as uv’s global cache, keep this fast.

The daemon fetches each start commit into its own bare clone, never into yours. Each workspace is a repository of its own in its sandbox, and the daemon runs git only in the bare clone, so an agent can’t plant a hook that the daemon’s git runs. The end commit of every attempt, a failed one too, comes back into the bare clone and stays on a hidden ref there, so many runs and agent steps can live side by side without a branch each. Your git worktree list, git branch and git log --all don’t show codeband’s workspaces and refs, and your git gc or a rewrite of your branches can’t remove run data. When the target repository is on the same file system as the state folder, the first clone uses hard links and costs little disk space. Uncommitted changes in your working tree are never part of a run. The work leaves codeband only through the run’s run result destination.

Pipelines and the engine in different languages

Section titled “Pipelines and the engine in different languages”

The engine is one Go binary that handles many runs at the same time, and the programs they start. Pipeline code runs in the code server of its SDK, in the SDK’s language, and the engine talks to it over a protocol. The same protocol lets each factory run as its own code server process.

A company can keep its pipelines in a central repository and in a .codeband/ folder inside a product repository. One daemon serves both: each factory runs in its own code server, with its own dependencies and its own SDK version. Whoever runs the daemon names each factory in codeband.toml, so two factories that both define intake stay apart as factory/intake and webshop/intake, and a run journal says which one it came from. A pipeline calls only the agents and the function steps of its own factory.

A factory whose code server does not answer, or whose code does not load, does not stop the daemon. The daemon logs it as failed, and the runs of the other factories go on. The runs of the failed factory wait until its code server answers and its code loads. codeband check and the web interface name it with its reason.

The daemon reads its factories from codeband.toml only when it starts. To add, remove or rename one, change the file and restart the daemon; runs go on after the restart. A run whose factory is no longer in the file waits until the factory is back or a person cancels the run.

The daemon trusts each address in codeband.toml and sends no credentials to a code server. Run the daemon and its code servers inside one network that you control.

The code server loads the factory once, when it starts. codeband dev starts it again when a file of the factory changes. A code server that you started with codeband codeserver needs a new start after you change pipeline code.

A daemon that stops leaves its runs where their run journals end. When the daemon starts again, each of those runs continues from its run journal by run replay.

  • The Quickstart starts the code server and the daemon and runs intake step by step.
  • Agent step explains step requests, attempts, end commits and step outputs.
  • Run result explains how a run’s code change becomes a patch file or a pull request.
  • The py-factory example is the factory of both runs on this page, with the commands that start each part.