Skip to content

Theaters

A Theater is where a Run actually works: the host or environment whose processes and files the agent harness uses. A Station is the node that places and supervises the Run; the Theater is the place it works. They are separate on purpose, the way a Kubernetes node is separate from the container runtime it drives.

A Station reaches a Theater through a transport: the way in. The Station's own machine, an SSH server, a container, a QEMU guest, an Android device and a WSL distribution are each a provider of the shared agentic-host crates, linked into ai6, that declares what it can do. A Theater is whatever its transport reaches.

Declaring Theaters

A Station's Theaters are theater records in its configuration provider (Operations), edited in Outer Office's Roster page (Theaters), with ai6ctl or through /v1/user/roster/theaters. In a directory provider, theaters.toml (or .json, .yaml) for every Station and stations/<id>/theaters.toml for one Station's own, which it reads over the global ones. A change applies at the Station's next poll.

[theater.build-box]
access = { ssh = { host = "build.example.net", user = "ci", host_key = "sha256:…" } }
labels = { os = "linux", gpu = "yes" }
agents = "auto"
egress = "direct"
harnesses = ["claude"]
workdir = "/srv/work"
Key Meaning
access The transport: "local", { ssh = { … } }, or { transport = { provider = "…", config = { … } } } for any other transport provider; { ephemeral = { … } } makes the Theater a template (see Ephemeral Theaters).
labels Labels an Operation's station_labels may match, overlaid on the Station's own.
agents Where the harness may run: "auto" (default), "local" or "remote-hands". See Two ways to work on a Theater.
egress How the Theater reaches the provider's API: "direct" (default), { proxy = "http://…" }, "station" (a proxy the Station provides over the transport's forward) or "none" (no internet).
harnesses Harnesses installed on the Theater ("claude", "codex"). Another host without a runner needs one here before a harness runs on it, in the detached wrapper.
workdir Where a Mission works on this Theater when its Operation names no path there.
runner The field runner that supervises harnesses on the Theater: {} for every default, or command, state_dir, plugin_paths and terminal.
requires What the Theater must have before Runs run there: os, harnesses, tools, disk_mb. See Fitting a Theater out.
provision How ai6 theater provision installs what it lacks: runner, plugins, install, install_timeout_secs.
cables Whether a Run here must reach its Cable endpoint: "required" (default) rules out field mode where the harness would have no way to it; "optional" starts such a Run without Cables, reported as weakened.

A Station's own host is always reachable as the Theater local without any configuration; declaring [theater.local] only adds labels, facts or a runner to it.

Fitting a Theater out

Q Branch fits Theaters out. A Theater says what Runs need there and how to install what is missing, and the Station checks it before it sends work there:

[theater.build-box.requires]
os = "linux"
harnesses = ["claude>=2.1", "codex"]   # AgentHandler provider IDs, also the command names
tools = ["git", "cargo>=1.89"]
disk_mb = 2048                         # free MiB in `workdir` (the default directory without one)

[theater.build-box.provision]
runner = "dist/linux-aarch64/ai6"      # an ai6 build for the Theater, on the Station
plugins = ["dist/linux-aarch64/libai6_agent_claude.so", "dist/linux-aarch64/libai6_terminal_pty.so"]
install = { git = "sudo dnf install -y git", claude = "npm install -g @anthropic-ai/claude-code" }
install_timeout_secs = 600

A program is written name (any version) or name>=version, compared number by number, so 2.10 is after 2.9. Its version is the first number in what name --version prints.

The probe. A Station looks over each POSIX Theater it reaches through the transport's run (a few command -v, --version and df calls, no writes) when it first contacts it and every five minutes after. It publishes what it found at check-in: versions, free space, the requirements that are unmet and why. Placement uses it:

  • A Theater whose requirements are unchecked, or whose os, tools or disk_mb are unmet, is ruled out with the reason.
  • In field mode the harness runs on the Theater, so a Theater that lists harnesses hosts only Agents whose handler is listed and installed there; the others are ruled out there, each with the reason (harness "claude" is missing on this Theater: claude>=2.1: not installed). Remote-hands mode runs the harness on the Station and is not affected.
  • A Theater without requires is not checked.

Resources. The probe also reads the Theater's CPUs (nproc), one-minute load average (/proc/loadavg) and memory (MemTotal, MemAvailable in /proc/meminfo). In a container with cgroup v2 limits it reads the container's own (/sys/fs/cgroup/cpu.max, memory.max, memory.current), so a container started with --memory 256m --cpus 1.5 reports 256 MiB and 1.5 CPUs, not the host's. macOS has no /proc: sysctl gives its CPUs, load and total memory, and its available memory stays unknown. A figure the Theater does not give is left empty, never guessed. Between full probes the Station samples just these figures every 60 seconds (ai6 serve --resources-every SECS; 0 leaves only the full probe). The Station's own host (local) carries the Station's own sample instead. Windows Theaters are not sampled. Placement uses the figures (see Stations).

The probe also reports ambient credentials: credentials already on the Theater that AI6 did not lease (a ~/.git-credentials store, a git credential helper, an SSH agent or private key, a GitHub CLI, Claude Code or Codex login, a provider key in the login environment). It names where they are, never their values, and each is a weakening the Station publishes and Outer Office shows: a Run there can use them whatever its own leases allow. Removing them is the operator's choice; AI6 does not refuse the Theater.

Provisioning. ai6 theater provision THEATER fits a Theater out over its own transport, checking before each step and acting only where the Theater differs:

Step Checks Acts
os, disk the probe never: a mismatch fails
each program in tools, then harnesses the probe runs its provision.install command with sh -c, then probes again
runner SHA-256 of runner.command on the Theater copies provision.runner (the Station's own executable when the Theater has the Station's OS and architecture)
plugin NAME SHA-256 in the first runner.plugin_paths directory copies each of provision.plugins

Each step prints ok, changed or failed, so a second run on a fit Theater prints ok for every step. A file is written beside its destination and moved over it, so a running runner is replaced safely. --check only looks: a step that would act prints would-change, and nothing on the Theater is written. The command exits non-zero when a step failed, or with --check when one would change. Pass --plugin-path for the Theater's transport provider and --config for another bootstrap file.

runner.command must be a path for the runner to be installed (~/ is the transport's default directory, the login user's home over SSH). Provisioning carries no secret: harness and forge credentials reach a Run as leases, never as files on the Theater.

By the Station's charge. The Chief of Station runs the same steps through its provision_theater { theater, apply } tool: apply = false is --check, and apply = true fits the Theater out unattended, because the operator declared every step it can take. What the declaration does not cover is reported, never changed. A run that changed something is audited (head_of_station.provisioned), and the probe report placement reads is refreshed at once. A Theater made for one Mission and an ephemeral template are refused.

SSH access

access = { ssh = { host = "build.example.net", user = "ci", port = 22,
                   identity = "~/.ssh/ci_ed25519", host_key = "sha256:…" } }

user defaults to the Station's user, port to 22 and identity to the first of ~/.ssh/id_ed25519, id_ecdsa and id_rsa that exists. A key is never in configuration: only the path of an unencrypted private key file is, and a passphrase-protected key is refused. The SSH client is built into the ssh provider (russh), so nothing depends on an installed ssh or on ControlMaster, and it behaves the same on every OS. A host key nobody pinned is checked against ~/.ssh/known_hosts. The remote side must have a POSIX shell.

Three more optional keys bound a connection: exit_grace_ms (default 1000) is how long output and the end of the channel are awaited once a command has exited, keepalive_secs (default 30, 0 sends none) the seconds between keepalive probes of an idle connection and keepalive_max (default 3) the unanswered probes before it is dropped. connect_timeout_secs (default 15) is the wait for the connection and login.

Pin the host key. host_key = "sha256:HEX" is the SHA-256 of the host's public key, the same text a peer ID uses. Get it on the host with:

awk '{print $2}' /etc/ssh/ssh_host_ed25519_key.pub | base64 -d | sha256sum

A host that presents any other key is refused. With no pin, the first contact is refused too, and the message names the key the host presented so you can pin it. trust_on_first_use = true accepts the first key instead. That is weaker than pinning, so the Station logs it, GET /v1/stations lists it as weakened, and the key it trusted is published in the Theater's capability notes so you can pin it afterwards.

What a transport can do

Each transport declares its capabilities, and a Station publishes them at check-in with the Theater's declared facts (GET /v1/stations, and the Theater's tooltip in Outer Office):

Capability Meaning
terminal Start a program on a terminal. On the Station's own host this comes from its Terminal provider.
run Run a command to completion and get its output.
files Read, write and list files.
forward Make a port on the Theater reach an address on the Station.
os, arch What the host is, once the transport has looked.
Transport Capabilities
native run, files, terminal; the Station's own machine (the local Theater)
ssh terminal (a pty), run, files (SFTP), forward (reverse); os and arch from the connection
adb run, files; an Android device, so agents = "remote-hands"
container run, files; a running Docker or Podman container, files need a POSIX sh in it
qemu run, files; a QEMU guest through its guest agent, files need a POSIX sh in the guest
wsl run, files; a WSL distribution, on a Windows Station

The adb, container, qemu and wsl transports are configured with access = { transport = { provider = "adb", config = { serial = "emulator-5554" } } } (and { container = "build", engine = "podman" }, { address = "127.0.0.1:4555" }, { distribution = "…" }); each provider's API header (in the agentic-host repository) lists its settings, and the Station's own host takes [providers.native] of the station record. Paths on a Theater are absolute.

A Theater that has not answered yet is probed in the background, so a dead host never delays a check-in; until it answers the Theater is listed as unreachable with the reason, and placement rules it out.

Two ways to work on a Theater

  • Field mode: the harness runs on the Theater, in a terminal there. It needs the harness installed and a route to the provider's API (egress not "none", and forward when it is "station"). A Theater with a runner qualifies (another host also needs run, which is how the Station reaches the runner). Without one, the Station's own host needs terminal and files, and another host needs run, files, a POSIX os, a declared harness and forward (which takes the harness to its Cable endpoint, unless cables = "optional") for the detached wrapper. The Mission works in the Operation's path on the Theater when the Operation is bound to it, else in the Theater's workdir, which must be absolute.
  • Remote-hands mode: the harness runs on the Station and acts on the Theater through the transport. It needs only run. For hosts that cannot run an agent: an Android device, an appliance, an air-gapped VM, a host with no internet.

agents = "auto" picks field mode where it is possible and remote-hands mode otherwise; "local" and "remote-hands" force one, and a Theater that cannot do what is forced is ruled out with the missing capability named. Placement previews show the mode of each choice.

In remote-hands mode the Station starts the harness in a scratch directory under its state directory (remote-hands/<mission>, not removed) and gives it the Theater's environment, in the way its harness takes best:

  • Codex works through its own environment backend: the Station serves an exec-server over the Theater and Codex registers it (environment/add), so every tool Codex has, a later one too, acts on the Theater.
  • Claude Code keeps its shell, and a hook of a plugin the Station writes runs each command on the Theater and refuses its file tools; the file tools are the MCP tools below. A hook that cannot run refuses the call.
  • Any other harness, and a Run at desk or read clearance, gets the tools only: its own shell and file tools are switched off (Claude Code's --disallowedTools; Codex's features.shell_tool = false, and a read-only sandbox that asks nothing, which refuses its patches).

The tools are on a per-Run authenticated MCP endpoint, bound to the Mission:

Tool Does
exec Run a program (program, args, cwd); returns its output and exit status.
fs_read Read a UTF-8 file, from a line, up to a limit.
fs_write Write a UTF-8 file, replacing it.
edit Replace a string in a file; its other bytes stay as they are.
apply_patch Apply a patch of added and updated files.
fs_list List a directory.

Every command passes the green ink gate first, in each way. A tool call may take as long as [theater_tools] max_timeout; the Station tells the harness's MCP client to wait that long and 30 s more.

A harness whose own shell is taken over (Claude Code) gets its first message only once its hook has reported that it started with the take-over in force, so no command runs on the Station first. [theater_tools] take_over_wait is how long a start waits for that; past it the Run does not start. A Claude Code older than the hook's minimum version is refused.

Relative paths are resolved against the Mission's working directory on the Theater: the Operation's path when the Operation is bound to this Theater (its checkout is there), else the Theater's workdir. An Operation with a path that is not bound to a Theater is placed on a remote-hands Theater only if that Theater has a workdir. A Theater without files offers no file tools and the harness is pointed at exec.

Ephemeral Theaters

A Theater can be a template instead of a host: each Mission bound to it gets a fresh Theater made from it, so no Mission sees what another left behind.

[theater.scratch]
access = { ephemeral = { provider = "ephemeral-container", config = { image = "registry.fedoraproject.org/fedora:44", engine = "podman", run_args = ["--network", "none"] }, keep_failed = 3, keep_failed_hours = 24 } }
agents = "remote-hands"
workdir = "/work"

[theater.scratch.requires]
tools = ["git"]

[theater.scratch.provision]
install = { git = "dnf install -y git" }
  • provider is a Theater provider (kind ai6_theater_provider); ephemeral-container (ai6-theater-container) makes a Docker or Podman container from image; the Station reaches it through its built-in container transport. config is the provider's own settings.
  • An Operation binds to the template by its ID (theater = "scratch"). When the Mission first starts, the Station has the provider make scratch-<mission>, reaches it through the transport the provider names, fits it out as requires and provision say (the same steps as ai6 theater provision; a failed step fails the start), and runs the Run there. The new Theater inherits the template's other keys; without a workdir of its own it works in the Operation's path. A Mission that is blocked, parked or started again comes back to the same Theater.
  • After each check-in the Station sweeps: a Theater whose Mission is done or abandoned is destroyed. One whose Mission failed or was blown, or which no Mission on this Station knows, is kept for inspection: at most keep_failed (default 3) per template, each for at most keep_failed_hours (default 24), the oldest going first. A Station that restarts adopts the Theaters the provider still lists.
  • The ephemeral-container provider's config also takes engine_timeout_ms (default 600000, how long one engine command may run, 0 to wait for it), engine_output_bytes (default 1048576, the output of an engine command kept) and reader_grace_ms (default 1000).
  • Placement chooses the template like any Theater (its requirements count as met, since they are fitted when a Theater is made) and never chooses a Theater made for another Mission; check-ins publish those with made_for.
  • A container has no terminal and no forward: no runner can be reached there, and a wrapped harness would have no way to its Cable endpoint, so a container Theater works in remote-hands mode: set agents = "remote-hands".

The field runner

A harness the Station supervises itself is the Station's child: if the Station stops or dies, so does the work. A runner keeps it going. It is the same ai6 binary in its Theater mode, ai6 runner serve: it loads the same AgentHandler and Terminal providers, starts harnesses for Stations, and writes every event a harness emits to disk, numbered, before any Station reads it. It has no scheduler, no Registry and no roster.

[theater.local]
access = "local"
runner = {}

[theater.build-box]
access = { ssh = { host = "build.example.net", user = "ci", host_key = "sha256:…" } }
harnesses = ["claude"]
workdir = "/srv/work"
runner = { command = "/opt/ai6/bin/ai6", plugin_paths = ["/opt/ai6/lib"] }
Key Default
command ai6 on the Theater's PATH; on the Station's own host, the Station's own binary.
state_dir runner in AI6's state directory on the Theater.
plugin_paths None: give the directories or libraries that hold the harness's handler and a terminal provider on the Theater.
terminal An available terminal provider on the Theater that suits the handler: pipe preferred for a JSON harness, pty otherwise. A pin that gives a JSON harness a terminal is refused.
connect_timeout_ms 30000: how long a Station waits to connect to the runner, and for ai6 runner connect to be ready through a transport.
initialize_timeout_ms 20000: how long the runner may take to answer initialize.
request_timeout_ms 30000: how long it may take to answer any other request.

A Station starts the runner when none answers, then starts each Run's harness on it. A Station that is shut down, killed or fenced out leaves the harness running, and its Mission stays Working. When the Station starts again it re-attaches to the same runner Run and receives every event it missed, in order, from the last one it acknowledged (the last event it took may come twice). A Station that loses the Run's lease lets go the same way. When a Station goes dark for good, another Station that reaches the same runner (a Theater with the same ID and a runner) adopts the Run and re-attaches in the same way (Station loss). A Mission parked at a provider limit resumes in a new harness instead, as before.

The runner listens on a loopback port only, behind a bearer token kept in its state directory (token, readable only by its user). On the Station's own host the Station talks to it directly. On another host it opens ai6 runner connect there on a terminal through the Theater's transport and speaks the Agent Client Protocol (ACP) over it, and runs ai6 runner serve --detach when no runner answers; a link that drops costs only time, since the runner keeps every event and the Station attaches again with session/load, which replays what it missed. A second Station's connection to a Run takes it over from the first. The Theater's runner settings connect_timeout_ms, initialize_timeout_ms and request_timeout_ms bound the connection steps.

A Station starting a runner hands it its station record's [runner] table and [providers.<id>] tables (Station runtime limits) as JSON, {"runner": {...}, "providers": {...}}: in settings.json in the runner's state directory on its own host, over standard input on another (--settings -). ai6 runner serve --settings PATH reads such a file, a key left out keeping its default, and records what it runs by as settings.json in its state directory, where ai6 runner connect reads it.

A runner out of reach for longer than the Operation's lost_after_secs is probed once more and, if it is gone, its Run is lost and the Mission tried again (Runner loss). The harness's Cable tools go through a relay the runner gives each Run on the Theater's loopback, with its own URL and token. The runner carries each request over the connection of the Station attached to the Run, and that Station answers from its own Cable endpoint for the Run: the endpoint's bearer never leaves the Station, and the Theater needs no forward. A Station that re-attaches, or adopts the Run, answers from then on; while none is attached the relay answers 503, saying so. The [runner] keys cable_request_bytes, cable_connect_timeout and cable_streams bound it (Station runtime limits).

Run one by hand with ai6 runner serve [--state-dir PATH] [--plugin-path PATH]... (or --detach to start it in the background); ai6 runner connect relays standard input and output to it over ACP. Stopping the runner stops the harnesses it supervises, and a runner that restarts ends the Runs it lost with a lost event saying why, which their Station takes as the Run lost. Its events are in runs/<key>/events.jsonl; ended Runs are removed a week after they started, the next time a runner starts.

The Station's watchdog sees a runner's harness only through its events: the checks that read terminal output (a blocked prompt, repeated output) do not apply to it.

The detached wrapper

A host where nothing can be installed still runs a harness if it has one: a POSIX Theater with run, files and a declared harness, and no runner (an ssh Theater, typically). The Station starts the harness over the transport in a run of its own (setsid, or nohup where there is none), so the link that started it can drop without ending it:

  • Its files are in ~/.ai6/detached/<mission>-<id>/ on the Theater (the login user's home over SSH; readable only by that user): env (a FIFO the Run's environment passes through once, so no value is on a command line or on disk; removed after it is read), in (a FIFO it reads), out (everything it writes), pid and, once it ends, exit. The directory stays after the Mission for inspection.
  • The Station reads out from the last byte it took and writes to in. While the link is down a read finds nothing new and the harness keeps running; once the transport reconnects, the Station reads on from where it stopped, so nothing is lost. A link down, or a harness quiet, for the Operation's lost_after_secs gets one probe over the transport; a Theater that cannot be reached, or a harness whose process is gone with no exit recorded, loses the Run (Runner loss).
  • The harness reaches the Station's Cable endpoint through a reverse forward on a loopback port of the Theater, which the transport re-opens on the same port after a reconnect. A transport without forward leaves it no way there, so placement rules the wrapper out unless the Theater says cables = "optional".
  • The harness gets the host's login environment plus the Run's, and no terminal: it is for harnesses that speak a protocol on standard input and output, as the claude and codex handlers do.

The Station still supervises the harness: shutting the Station down stops it, and one whose Station died is ended by the next start of the same Mission before another starts. Only a runner keeps the work going while no Station is attached.

Overlays on a Theater

The overlays a Run is issued go where it runs. A Station copies each one from its store to .ai6/overlays/trees/<digest>/ under the transport's default directory, the login user's home over SSH, file by file through the transport, and it appears there only when whole. Every later start hashes that copy against what the store holds and reuses it, so nothing is staged on a Theater by hand and a helper in an overlay's bin/ is on the Run's PATH there with no other step. A copy with other bytes, a missing or an added file, or a link in it refuses the start, naming the directory; remove it and the next start places it again.

Beside the trees, under .ai6/overlays/: state/<overlay>/, envs/<digest>/ for its dependencies, tools/<digest>/ for a pinned dotagents, and runs/<Mission>/ for what one Mission keeps, removed when it ends. Each directory of an overlay's is read-only (chmod a-w) outside its preparation. An Agent's PATH is what its Run's commands look on; with none, the Station asks the Theater for its login PATH, so the overlay's bin/ goes before it rather than in place of it.

  • What a Theater must have. A POSIX shell, find, and one of sha256sum, shasum, sha256 or openssl, for every overlay, text included. A Theater that runs Windows through a transport is refused for overlays: copies, hashes and steps go through sh. A Station's own Windows host needs none of it.
  • Text. An overlay with only text needs nothing else there. An overlay with code waits for what it needs, as Code in an overlay says.
  • Remote hands. The harness is on the Station and has no file or shell tool, so the overlays go to the Theater, its context names them there, fs_read reads them, and exec's commands get their environment. Skills are routing lines. desk keeps both tools from running anything.
  • Records. Which digest was last prepared on a Theater is kept on the Station, per Theater, under its state directory. An ephemeral Theater is a new one each time, so its overlays are placed and prepared each time.
  • A container runs as root unless its image says otherwise, and chmod a-w does not stop root: there the check at the next start is all that holds, and the container is gone by then anyway.

Reaching a Theater

A Station publishes the Theaters it reaches at each check-in: ID, access (local, ssh or transport), the SSH host or transport provider, labels, capabilities, agents, the kind of egress (never a proxy URL), harnesses, requires with the last probe's report, and why a Theater is unreachable. The SSH user, port, key path and provision settings stay on the Station. GET /v1/stations and Outer Office's Stations view list them with their last resources sample (resources, with sampled_at) and the Runs running there (runs); a Theater whose requirements are unmet or unchecked shows a tool icon, and its tooltip says what is missing.

A Run records the Station that supervises it, the Theater it works on and the mode (station_id, theater_id, mode); Outer Office shows them on the Mission detail.

An Operation's theater binds it to one Theater by ID. See Placement for how the Station, Theater and Agent are chosen and how to ask why.

Not yet

  • Remote safe houses: a remote-hands Mission has no safe house, so no per-Mission isolation, history or cover check; it works in the directory it is given.
  • A Station-provided egress proxy (egress = "station") is recorded and requires forward, but no proxy is started yet.
  • A terminal over the adb, container and qemu transports, and a container or QEMU guest that can end a process it started (a timeout ends the client, and a program in the guest may keep running).
  • Ephemeral virtual machines: only containers have a Theater provider. Destroying a kept Theater early is not yet a step an operator approves in green ink; the sweep's bounds remove it.
  • A Theater is refitted by the Station's charge only when it asks; nothing refits it on a schedule of its own.