beetlebug▾
/

How it works

The daemon

jcode serve starts the daemon. It listens on 127.0.0.1 only, on port 7717 by default. It keeps its state in one folder, ~/.local/state/jcode by default (The state folder).

The daemon has one event loop. Each agent is a coroutine of the loop. A model call and a command of an agent do not block the loop, so many agents run at one time.

An agent

An agent has a brief (a text file), a work folder, a model, and an isolation level. It runs a loop:

  1. The daemon sends the brief, the transcript so far, and the list of tools to the model.
  2. The model answers with text and tool calls.
  3. The daemon runs each tool call and adds the result to the transcript.
  4. The loop goes on until the agent calls finish or ask_coordinator, or a cap stops it.

The tools read, write, and search files of the work folder. With --run, an agent also runs shell commands. Each agent has a state: running, asks, done, stalled, failed, capped, or stopped.

The isolation level

The level applies to the commands of the run tool:

Level In one line
none The command has the full power of the user.
process The command can change only the work folder, and has no network unless --net. Linux only.
vm Each command runs in a new Linux guest that sees only the work folder. Needs KVM.

The file tools stay inside the work folder at each level. Isolation says what each level protects and what it does not protect.

The coordinator

The coordinator starts agents, reads their transcripts, answers their questions, and reads their reports. It uses one of the clients:

Next: Run your first agent.