- Go 96.3%
- Shell 2.8%
- Dockerfile 0.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo | ||
| chart | ||
| cmd | ||
| internal | ||
| packs | ||
| rootfs | ||
| .dockerignore | ||
| .gitignore | ||
| CHANGELOG.md | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| pack.toml | ||
| README.md | ||
| REVIEW.md | ||
rexcity
rexcity is a Gas City pack that adds a session runtime backed by Rex.
With it, each Gas City agent runs as a Rex session, which you can open in the Rex app to watch the agent or type into it.
The runtime is rexcity runtime, run under the name gc-runtime-rex: gc's exec session provider takes an executable name, not a command line, so gc-runtime-rex is a link to rexcity, which acts as rexcity runtime when started under that name.
It speaks Gas City's exec session provider protocol (RPP version 0), and pack.toml declares it under the name rex.
Requirements
- Gas City's
gc, tested with a build of gascity'smainat commit 6bd609f. Gas City's own installation also requires tmux. - Rex, with
rexon thePATHof the gc supervisor and a Rex server thatrexreaches. - Go 1.27.3 or later, to build the runtime.
Use the runtime in a city
-
Install the runtime into a directory on the gc supervisor's
PATH:go install sarak.sh/mikluko/rexcity/cmd/rexcity@latest ln -s rexcity "$(go env GOBIN GOPATH | head -n1)/gc-runtime-rex"If
GOBINis unset, link in$(go env GOPATH)/bin. -
Import the pack in the city's
pack.toml:[imports.rexcity] source = "https://sarak.sh/mikluko/rexcity.git" version = "^0.1"versionis a semver constraint over this repository's release tags.sha:<commit>, with the full hash of a commit, pins one commit instead. -
Select the runtime in the city's
city.toml:[session] provider = "rex" -
From the city directory, install the import and check the runtime:
gc import install gc runtime check rexThe last line of the output is similar to this:
18 checks: 18 passed, 0 failed, 0 skipped
Packs
packs/forgejo is a pack that makes gastown's Refinery land a rig's work as Forgejo pull requests. Its README shows how to import it on a rig. It is versioned with this repository's release tags.
Container image
sarak.sh/mikluko/rexcity is a kuberex image with tmux, lsof and the fwknop client, and gc, bd, dolt, jmap-mcp, rexcity (and gc-runtime-rex, a link to it), kustomize, kubeconform, yq and bao in /usr/local/bin, claude-agent-acp (a link into /usr/local/lib/claude-agent-acp/, which holds its bundled Claude CLI beside it so that CLI does not shadow claude) and jmap-watch in /usr/bin, built for linux/amd64 and linux/arm64.
Its managed Claude Code settings, /etc/claude-code/managed-settings.d/rexcity.json, turn Claude Code's notifications off.
The image carries a starter .zshrc at /usr/share/rexcity/zshrc. /home is a volume over the image, so /etc/zsh/rexcity-zshrc.zsh, sourced from /etc/zsh/zshenv, copies it to $ZDOTDIR or $HOME as mode 0644 when an interactive shell starts there without a .zshrc, for every account in the login server and the account containers. It never replaces an existing file, so edits to the copy stay. It sets up history, completion, emacs keys, a user@host cwd prompt and fzf's key bindings and completion.
CHANGELOG.md names the kuberex release and tool versions each image carries.
Each release is tagged with its version, its <major>.<minor>, and latest.
Each release also publishes the rexcity Helm chart as oci://sarak.sh/mikluko/charts/rexcity, tagged and versioned with the release's version only.
It wraps the kuberex chart the image is built on, vendored as its dependency, and runs the release's image; its values are kuberex's, under kuberex:.
chart/build.sh VERSION DIR packages it.
A pull request notes its change as a fragment, a Markdown file of its own in .changelog/, and never edits CHANGELOG.md: only a release writes that.
A fragment holds level-3 headings of the Keep a Changelog types (Added, Changed, Deprecated, Removed, Fixed, Security) and the notes under them, as they would read under ## [Unreleased], and nothing else:
### Fixed
- The pane of a rig's tab keeps its place when its command changes.
The file's name is the change's (rig-pane-place.md); two pull requests then never touch the same file.
The changelog job of .forgejo/workflows/test.yaml runs version 2 of the changelog tool over CHANGELOG.md and .changelog/.
Beyond what version 1 checked, it refuses a file in .changelog/ that is not a fragment (fragment-form), refuses a fragment that would make the release fail (fragments-release), and reports a pull request that adds no fragment (missing-fragment).
That last check only warns here, because a change to CI, tests or docs alone carries no note (REVIEW.md).
On a pull request the job first merges the base branch into the checkout, and checks the result: a branch cut before a release and merged after it can be clean on its own head and still put a line into a section the release froze (release-entry-modified), and only the merge shows that.
A branch that does not merge cleanly fails the job and has to be rebased.
To run the check before pushing, from a checkout that has the repository's tags: go run sarak.sh/mikluko/changelog/v2/cmd/changelog@v2.
A release is published when the newest entry in CHANGELOG.md names a version that has no tag yet.
A version is cut from the fragments in one pull request that holds only the release.
On a branch off main, run go run sarak.sh/mikluko/changelog/v2/cmd/changelog@v2 release: it folds every fragment into ## [Unreleased] and deletes them, renames [Unreleased] to the version its notes call for, dated today in UTC, and opens a new empty [Unreleased] above it.
A **Breaking:** note makes it the next major (the next minor below 1.0.0), any type besides Fixed and Security the next minor, and Fixed and Security alone the next patch; -version X.Y.Z names another.
The release pull request then holds the edit of CHANGELOG.md and the deleted files of .changelog/, nothing else.
Merge it on the day its heading is dated: once the tag exists, the check refuses an entry whose date is not the day the tag was cut, and the entry is frozen from then on.
The merge pushes CHANGELOG.md to main, where the release workflow's plan job reads the newest entry with the changelog tool's validate action, and finds the release due when its version has no tag; the rest is as above.
After the chart is published, the release workflow calls each city's Flux Receiver (chart/notify-flux.sh) so the city's OCIRepository reconciles at once: a POST to https://flux.sarak.sh<webhookPath> with the header X-Signature: sha256=<HMAC-SHA256 of the body by the token>.
It reads two repository secrets per city, the webhook path and the HMAC token:
| City | Webhook path secret | Token secret |
|---|---|---|
saraksh-rexcity |
FLUX_RECEIVER_SARAKSH_PATH |
FLUX_RECEIVER_SARAKSH_TOKEN |
uptime-rexcity |
FLUX_RECEIVER_UPTIME_PATH |
FLUX_RECEIVER_UPTIME_TOKEN |
A city whose secrets are unset is skipped with a notice, and a failed call only warns: Flux polls hourly anyway.
An hourly run of the renovate workflow moves the image to each new kuberex release, and the release workflow publishes it: as the next minor version when kuberex's minor version moved, otherwise as the next patch.
The renovate workflow writes its release the way a person does, with the tool's append and release -version, so it folds every fragment that is waiting on main into the release it cuts.
How sessions appear in Rex
-
A city is one Rex session, and each gc session is a pane of a tab in it, labelled by the agent alone:
mayor,witness. A pool session's label drops the-<session ID>gc appends to its name, so a Worker's pane readsworker, notworker-gcg-session-0dfb…. A new pane does not take focus. -
Every agent whose env sets
GC_RIGis a pane of its rig's tab, labelled with the rig's name; pooled or not, no rig agent gets a tab of its own. Every other agent is a pane of the city tab, labelled with the city's name as gc resolves it: theworkspace_nameof the city's.gc/site.toml, else the[workspace]nameof itscity.toml, else the name of the city directory. -
The first agent of a rig opens the rig's tab. Each next one splits the tab's largest pane along its longer edge in pixels, to the right when the pane is wider than tall, else below. Rex reports the size a client laid a pane out at; a pane no client has laid out yet, as in a tab nobody has looked at, counts as its share of the tab.
-
The city tab opens with a pane labelled
logthat follows gc's supervisor log:gc supervisor logs --follow, with thegcthatGC_BINnames, in the city directory, started again 5 s after it ends, unless the city declares panes of its own (next item). The log pane is no gc session: it outlives the agents of the city, a start never prunes its tab, and the city tab gets it back, placed as any other pane, whenever it is missing. -
A city declares the panes of its city tab in
rexcity.toml, a file of the city directory, each[[city_tab.pane]]with alabeland acommand:[[city_tab.pane]] label = "beads" command = "gc roles view beads" [[city_tab.pane]] label = "mail" command = "gc roles view mail"A city that declares panes gets exactly those in its city tab, and no
logpane; a city that declares none, or has no such file, keeps thelogpane.- A declared pane runs its
commandwith/bin/shin the city directory, and runs it again 5 s after it ends. Each run is a subshell of its own, so acd, anexitor ashiftin the command ends with that run. In the command,gcis thegcthatGC_BINnames, or thegcon thePATHwhenGC_BINis not set. It is a shell function, so it holds for agcthe shell runs as a command, and not for one a program starts (env gc,timeout gc, a script that callsgc) or forexec gc, which findgcon thePATH: and thatPATHhas the directory ofGC_BINfirst (see below), so it is the samegc. - The environment of a declared pane (of the city tab's and of a rig's alike) is the Rex server's own for a login shell, with one exception:
PATH. Rex starts the pane as a loginsh, which reads/etc/profileand the user's~/.profile, and those can leave aPATHthat lacks the directories gc's agents have (/opt/homebrew/bin, wherebdanddoltlive, say). So the runtime passes the pane thePATHit was started with, which is thePATHof the process gc ran it from (gc's supervisor), and the pane's script sets it before the command runs, after the profile:bd,doltand the rest of what gc's own tools find are found in the command. The directory ofGC_BIN, when that is an absolute path, goes first on it, so that a program the command starts and that callsgc(themailpane of the roles pack runs a script that does) finds the city'sgc, whatever the supervisor'sPATHholds and whether it holds a directory with anothergc; a runtime with noPATHgets that directory before the shell's own. The runtime'sPATHis read at each start and is not the start's agent's: thePATHgc gives an agent in its env (a Worker's GNUdateandsed, say) is not passed on. Nothing else of the agent's env, noGC_*variable, reaches the pane; the command reads what it needs from files, orgc. A runtime with noPATHand aGC_BINthat is no absolute path leaves the shell's as the profile made it. To name a directory the supervisor does not have, a city setsPATHin the command,command = "PATH=/opt/tools/bin:$PATH bd list --watch", or names the program by its path,command = "/opt/tools/bin/bd list --watch"; each run is a subshell, so that is each run's own. - The declared panes are a column to the right of the main pane, top to bottom in the order declared, whatever the shape of the window: the first goes to the right of the main pane and each next below the one before, when the city tab opens and when a pane is put back. A pane put back while another declared pane is still there goes below the nearest one before it, else above the nearest one after it, so the column keeps its order; with none of them there and no main pane in the tab, it goes where an agent's pane would. The panes of agents keep splitting the largest pane that is not a main pane.
- A declared pane is no gc session, outlives the agents of the city, keeps its tab from being pruned, and is put back at the next start of an agent in the city tab whenever it is missing, as the log pane is.
- Each start of an agent in the city tab reads the file again. A pane the city no longer declares is closed then, a
logpane opened by an earlier version included, after the panes it declares are in; a pane that is still declared and still has the command it was opened with is left alone, and one whose declared command has changed is replaced (see below). gc never readsrexcity.toml, so changing it changes no agent's configuration and restarts no agent. - An entry with no
labelor nocommand, or whoselabelan earlier entry has, is skipped with a warning on the start's stderr; a key the runtime does not know is ignored with one. A file that is not valid TOML, or that has entries and none of them can open (a mistyped key, say), leaves an open city tab as it is, and opens a city tab that is not open yet with thelogpane, with a warning. A file with no[[city_tab.pane]]entry at all, empty or not, declares no panes. - A pane keeps the command it was opened with, as Rex does not change the program of a pane that is open. So the runtime records the command each declared pane was opened with, and a start of an agent in the tab that finds the city's declaration for a label changed replaces that pane: the new pane opens where a missing one would, below the declared pane before it or above the one after it, and only then is the old one closed, so a tab is never left empty, and the pane takes the old one's place in the column. A command a city has corrected thus reaches its panes at the next start of an agent in that tab, without a new label and without the user closing the pane; what the old pane showed is gone with it. A pane left by an earlier version, which recorded no command, is replaced once, at the first start after the upgrade, which is how a pane opened without the
PATHabove gets it. It iscommandthat counts: the pane is not replaced for a change of the runtime'sPATH, ofGC_BINor of the 5 s, which a start from another shell or env would flap between, and a pane whose record is lost is replaced once like one with none. When the record cannot be kept at all (it cannot be read, or written), a pane that has none would be replaced at every start, so the start warns once and leaves the panes it holds as they are, whatever the city has changed, and still opens one that is missing. When the new pane cannot open, the old one stays, the start reports it as it does for a pane that is missing, and the next start tries again.
- A declared pane runs its
-
A city declares panes for every rig's tab in the same
rexcity.toml, each[[rig_tab.pane]]with alabeland acommand, once for all rigs:[[rig_tab.pane]] label = "beads" command = "bd list --watch --limit 10"A rig's tab then holds one copy of each, besides its agents' panes. A city with no
[[rig_tab.pane]], or norexcity.toml, changes nothing for any rig tab, and the city tab's panes are the[[city_tab.pane]]ones alone.- The command runs with
/bin/shin the rig's own directory, and runs again 5 s after it ends, as a declared pane of the city tab does (the samegcfunction, the same subshell per run). The runtime takes the rig's directory fromGC_RIG_ROOTin the env gc gives the agent that starts: the checkout gc knows the rig by, where its.beadsis, never the agent's worktree, sobdin the pane answers from the rig's store. When the start's env has noGC_RIG_ROOT, or it names a path that is no directory, the rig's panes are skipped with a warning on the start's stderr, and a tab that already holds them keeps them; the agent's start does not fail. No start of an agent of the rig fails for these panes: a pane that cannot open, or a record that cannot be written, is a warning. - The pane is no gc session, and it stays: it outlives the rig's agents, so the rig's tab stays open when its last agent's pane closes, and a start of an agent of the rig puts it back whenever it is missing (closed in the Rex app, or lost with a restart of the Rex server), below the declared pane before it, else above the one after it, else where the next item says. A start in another rig never prunes the tab that holds it while the city declares its panes and its rig is there (next item but one). Its tab is the rig's tab, found by the panes of the rig's agents or by the declared panes themselves.
- Placement: the declared panes are a column at the right edge of the rig's tab, at its full height, top to bottom in the order declared, and an agent's pane never splits one or goes beside one: it splits the largest of the tab's other panes, as before. The first declared pane is split off the whole tab to the right, so the column has half of the tab's width, and the agents' panes share the other half however many they are; the column does not shrink with each Worker that starts. A tab with one Worker is the Worker on the left and the list on the right, each half the tab; with two, the Workers split the left half between them (
bd liststill has the right half); with five, the left half is cut into five and the right half is still the list. When the tab holds nothing but the declared panes (its agents have stopped), the next agent takes the left half, and the declared panes keep the right. A main pane (REXCITY_PANE = "main") in a rig's tab goes to the left of everything, as in any tab, and takes half of it. - Each start of an agent in the rig's tab reads the file again. A pane no longer declared is closed then, after the agent's own pane is in, so a tab that held nothing else is never left empty before the agent has its place; a pane that is still declared and still has the command it was opened with is left alone, and one whose declared command has changed is replaced (see below). An entry with no
labelor nocommand, or whoselabelan earlier entry has, is skipped with the warning the city tab's entries get, and an unknown key is ignored with one. A file that is not valid TOML, or that has[[rig_tab.pane]]entries and none of them can open, leaves the rig's panes as they are, with a warning. - A rig's tab that holds nothing but declared panes, with no agent of the rig left, goes when it has no reason to stay: at the next start of an agent of any other rig, the runtime closes the panes the city no longer declares (the tab closes with its last pane), closes the tab of a rig that is no longer in the city, closes the tab of a rig whose directory, as the runtime recorded it when the panes opened, is gone from disk, and forgets the records of declared panes whose tab Rex no longer holds. A rig is no longer in the city when neither the
[[rigs]]of the city'scity.tomlnor the[[rig]]bindings of its.gc/site.tomlname it, as aftergc rig remove, which leaves the rig's checkout on disk; the runtime reads no more of those files than the names, and a rig whose tab it cannot tell about, because a file is missing or does not parse, keeps its tab. A rexcity.toml that cannot be read, or a rig whose directory cannot be told, keeps the tab too. The tab of the rig that starts is never touched by this, only by the start's own handling above. The declaration is read once for all the idle rigs, and the warnings about it are the start's own. Nothing runs when no agent starts anywhere: a city that stops every agent leaves its idle tabs until the next start. A pane the runtime opened before it recorded the rig's directory has none recorded; the rig's next start records it. - A failed read of a tab right after a declared pane opens in it is a warning, not a failed start, in a rig's tab and in the city tab alike: the agent goes into the tab as it was last read, less a pane that was closed to make room for its replacement. The panes the city no longer wants close at the next start. Opening the city tab for the first time is not covered: with no tab read there is nothing to go on with, and the start fails with Rex's error.
- A rig's tab opens with the rig's first agent, so a rig that has run nothing since the city started has no tab and no list. The runtime is not told of the rigs before an agent of one starts: the only thing it receives is one agent's start, with its own env, and the rigs' names and paths are gc's business (
city.tomland.gc/site.toml, whose layout the runtime does not own: it reads only the rigs' names, to tell that a rig is gone, as above). Opening every rig's tab when the city starts would take a start hook of the city that gc does not call and a reading of those files, with the cost of a tab for each rig, suspended or never used; it is left out. - A rig agent's pane is placed in a tab without declared panes as before: a tui agent's pane and the acp box's pane (
rexcity acp follow) split the tab's largest pane.
- The command runs with
-
An agent whose env sets
REXCITY_PANE = "main"gets the main pane of its tab: on the left, at the tab's full height, beside everything else in the tab. A main pane that comes back after a stop takes the left again at full height, whatever the rest of the tab holds. Every other agent's pane of the tab splits the largest pane that is not a main pane, so it never shares the main pane's column; with no other pane, it splits the main pane to its right. The declared panes of the city tab are placed as described above. Incity.toml, for the city's operator:[[patches.agent]] name = "roles.operator" env = { REXCITY_PANE = "main" } -
Stopping an agent closes its pane and nothing else: the runtime re-tiles nothing, so Rex's own layout settings decide what the other panes do, and a rig's tab closes with its last pane, which is never the case while it holds a declared pane. The runtime tracks a pane by its block ID, so
observe,stop,peek,nudgeandis-attachedact on the agent's pane, never on its whole tab. -
rexcity label LABEL, run inside an agent's pane, relabels that pane; its tab keeps the rig's or the city's name. A Worker can name its pane after the bead it claimed. It finds the pane fromGC_SESSION_NAMEandGC_CITY_PATH, which gc sets in every agent's environment, and fails for an agent with no pane: a process box, or a session of its own from an earlier version. An agent an earlier version gave a tab of its own has its tab relabelled. The runtime tracks a pane by its block ID, never by a label, so a relabelled pane is observed, stopped and pruned as before. The next start of the session opens a new pane with the default label. It never renames a Rex session. -
The city session is the first of these that exists:
- The session
REXCITY_SESSIONnames, by label or ID. - The Rex session gc runs in, so gc's own tab sits beside its agents.
- A session labelled with the base name of the city directory, which the first start creates.
- The session
-
An agent whose env sets
REXCITY_SESSIONhas its pane in the session that names, by label or ID, instead of the city session, in that session's tab for its rig, or its city tab, with the city's panes (the log pane, or the declared ones); the first start creates the session. Several agents naming one session share it. Incity.toml:[[patches.agent]] rig = "*" name = "gastown.polecat" env = { REXCITY_SESSION = "polecats" } -
An agent whose env sets
REXCITY_BOX = "process"gets no pane: it runs as a process of its own beside the runtime, in a new process group, with its output in.rexcity/<city-key>/<name>.log, whichpeekreads. Stopping it ends its whole process group, andinterruptsends that group SIGINT;nudgeandsend-keysdo nothing, since nothing reads its input. It suits an agent withprompt_mode = "none", such as gc's control dispatcher:[[patches.agent]] rig = "*" name = "core.control-dispatcher" env = { REXCITY_BOX = "process" } -
nudgereaches a Claude Code agent through its cross-session messaging socket instead of being typed into its tab. Claude Code binds the socket as<claude pid>.sockin a directory namedcc-socks, whose parent depends on its version and the host. As of 2.1.319 it is$XDG_RUNTIME_DIRwhen that is set, else$CLAUDE_CODE_TMPDIR, else/tmp(/private/tmpon macOS), on macOS and on Linux alike, with/tmp/cc-socks-<uid>for a path too long for a socket; Claude Code 2.1.311 on Linux used/tmp/user/<uid>/cc-socks. The runtime finds the pid the wayprocess-alivedoes, looks for its<pid>.sockin each of$XDG_RUNTIME_DIR/cc-socksand$CLAUDE_CODE_TMPDIR/cc-socks(when set),/tmp/cc-socks,/tmp/cc-socks-<uid>,/run/user/<uid>/cc-socksand/tmp/user/<uid>/cc-socks, in that order, and uses the first socket it finds that is its own user's, so a Claude Code that moves its socket again is found as long as the new place is on that list. It writes one JSON line, a message from a sender namedgcthat says it bypasses permissions, as Claude Code's ownSendMessagedoes; an agent started with--dangerously-skip-permissionstakes it with no approval dialog and nocrossSessionInboundsetting. The agent sees it as a message from another session: between tool calls when busy, as the start of a turn when idle, and nothing lands in its composer. The message'sfromaddress isuds:/nonexistent/gc, which no socket answers, so an agent that replies gets a refused connection. When the agent has no socket (another provider, an older Claude Code), the socket refuses or closes the connection, or it answers with an error, the text is typed into the tab as before. gc queues a nudge for a busy Claude Code agent and hands it to the runtime later inside a<system-reminder>block that tells the agent to handle it after the turn; the runtime strips that block and sends only the- [source] textlines. The startup prompt never goes through the socket: the agent sees a socket message as a request from another session, and may refuse its own startup prompt as one. A fresh Claude Code agent (commandclaude, no--resume/--continue) gets the prompt as its positional launch argument instead,claude [flags] "<prompt>", read by the wrapper from.rexcity/<city-key>/<name>.prompt, so nothing is typed and no ready prompt is awaited; any other provider, a resume, and a prompt starting with-get it typed into the tab once the ready prompt shows. The wire format is Claude Code's own and not documented; it was read from 2.1.311 and checked against 2.1.319 on macOS, which takes the same line with no auth line (it asks for one only on Windows), so pin the Claude Code version in the image. -
The city session belongs to the city, and so does every session an agent's
REXCITY_SESSIONnames. Each start closes every tab in its session that no agent holds, by its window or by one of its panes, except the tab gc runs in and the tab that holds a pane of the city's own (the log pane or a declared one), so tabs a Rex server restores after a restart do not pile up. Run gc in a session of its own, or setREXCITY_SESSION, and name no session that holds anything else. -
A pane's terminal stays open after its agent exits, so the screen of an agent that finished or crashed stays readable until gc stops the session.
-
An agent started by an earlier version, in a Rex session of its own labelled
<name>@<city-key>or in a tab of its own, keeps working there until gc stops it. Its next start opens a pane. -
The runtime talks to whichever Rex server
rexselects.REXCITY_REXnames a differentrexbinary. -
The runtime keeps its state in
.rexcity/<city-key>/in your home directory, taken from the user database, not from$HOME.GC_EXEC_STATE_DIRmoves it.<city-key>is 8 hex digits derived from the host name and the city path gc passes inGC_EXEC_CITY_PATH. The state is a record of the pane or process that holds each name, the panes of the city tab of each session (the log pane, or the declared ones, by label), the output of each process, the metadata gc sets on each session, the wrapper script that applies the session's environment and starts the agent, and one lock file per name.
Reconciler v2 and the host filesystem
The handshake declares observe.v1 and report-attachment, which admit the runtime to gc's reconciler v2, and fs.host with "locality": "local", so gc stages each work dir, runs pre_start and session_setup on the host itself, and materializes the agent's skills and MCP configuration.
-
observeandinventoryread a pane as running while the program its start launched runs, and as dead once that program has exited, whatever runs in the pane since. A pane's object is its block ID and the time its start created it; a tab's from an earlier version is its window ID; a process box's is its pid. -
kill-objectcloses the pane, or forgets the process box, only while it is still the object gc names and is not attached, under the name's lock. -
A start whose config carries a failing
pre_startcommand fails, and creates no pane. -
A pane is attached only while it is the focused pane of the active window of its Rex session and a client other than the
rexcommand line, and not a tagged Tailscale device, is attached to that session; a tab from an earlier version, while it is that active window. This departs from gc's rule that any attached client counts. The Rex app attaches to every session on its server, so under that rule every pane would read attached while the app runs, and reconciler v2 would idle-stop no session, defer every configuration-drift restart and recycle no dead pane. Rex keeps one active window per session, and one focused pane per window, shared by every client, and does not report which session a client shows, so the focused pane of the session's active tab reads attached even while the app shows another session. A session that shows no window holds no attached pane, and looking at a tab attaches one of its agents, not all of them. A process box is never attached. -
An agent whose env sets
REXCITY_ATTACH = "never"never reads attached tois-attached,inventoryorkill-object, whoever looks at its pane. gc refuses to stop an attached session, even one whose agent has rungc runtime drain-ack, and retries on a backoff of up to 5 minutes; with this set, a Worker that finished is stopped at once while you watch its tab:[[patches.agent]] rig = "*" name = "roles.worker" env = { REXCITY_ATTACH = "never" } -
With the Rex app open,
gc runtime conformancefails RPP-OBSERVE-017: its box is the only tab of its Rex session, so it is the active window of a session the app is attached to.
The acp box: rexcity acp -- ADAPTER
gc's ACP provider runs an agent as a child it talks JSON-RPC to over stdio, and owns the session: nudge, interrupt, peek, permissions and turns. rexcity acp -- ADAPTER [ARG...] is the command gc runs as the provider's acp_command. It passes the lines between gc and the adapter through untouched, and gives the agent a read-only pane.
-
Every line passes as it is, in both directions. The wrapper never rewrites
session/newand never answers a request of the adapter's: gc holds asession/request_permissionas a pending interaction. The adapter's stderr passes through (gc reports its tail when a handshake fails), and its exit status is the wrapper's, 75 included; a death by signal is 128 plus its number. -
The adapter is a child of the wrapper and stays in the process group gc made for the agent, so a signal gc sends the group reaches both once. The wrapper does not die of SIGINT and forwards no signal. On SIGTERM, SIGQUIT, a hangup or the end of gc's input it ends the adapter's input, and signals the adapter (SIGTERM, then SIGKILL) only if it outlasts a 5 s grace each. It never exits before the adapter.
-
The session is rendered to
.rexcity/<city-key>/<name>.log(mode 0600, appended to, a header per adapter start), as plain text acat, agrepor atail -freads. It shows gc's prompts marked▶ gc, agent text with thinking dimmed, each tool call twice, when it starts (▷, with its input) and when it ends (✓,✗), plan updates, each permission request (?) with gc's answer (→), and each turn's end with its stop reason (■).<name>isGC_SESSION_NAMEand the cityGC_CITY_PATH; without them there is no log and no pane. The logs are bounded: a log larger than 8 MiB when a run starts is set aside as<name>.log.1, in place of the one before it, and the run begins a log of its own (a run's own log is never cut while it is written, since the pane follows it), and a start removes the logs of acp agents,<name>.logand<name>.log.1, that nothing has written to for 30 days, unless a pane is recorded for the name. An acp agent that has no pane recorded (its pane failed to open, or it runs withREXCITY_BOX = "process") and has written nothing for 30 days while it still runs loses its log in the same way, and its wrapper goes on writing to the unlinked file. Each pool session of an agent has a name of its own, so this is what keeps the state directory from growing with every session. Only a file that begins with the log's header (━━ acp) is taken for an agent's log; a process box's output is left alone. -
Every entry of the log begins with its time,
HH:MM:SS. The exceptions carry one already: gc's prompt (▶ gc HH:MM:SS) and the header of a run (with its date). It is when the wrapper saw the message, or the time the message carries, if it does (atimestampin the_metaof its params or of its update, in RFC 3339;claudeacpsends none). An entry is a tool call, a run of agent text or of thinking (stamped once, on its first line, however long it is), a plan update, a permission request, gc's answer to a request, a cancel, the settings of the session and any change to them, a line of the adapter's stderr, a note of the wrapper's, a turn's end, and the end of a run. -
The line after the session's start says which model, effort and mode the agent runs on, so that a pane says what it is showing:
HH:MM:SS · model claude-opus-5-5 · effort high · mode bypassPermissions. It is written when the adapter answerssession/new(andsession/load,session/resume), from the reply: a config option whoseidismodel,effortormode(else whosecategoryismodel,thought_levelormode) gives itscurrentValueas the adapter reports it, with no lookup of the id or the name, and the reply'smodes.currentModeIdis the mode when no option says it. A field the reply does not carry is taken from what gc asked of the adapter:--modeland--effortof the adapter's arguments (the last of each), and forgooseits env'sGOOSE_PROVIDER, shown asprovider P, andGOOSE_MODEL; a field neither says is left out of the line. A laterconfig_option_updateorcurrent_mode_updatewrites the line again with the new values, unless the line would be the same. Only the model, the effort and the mode show; the adapter's other options (fast, say) do not. The line is the same dim one-line entry as the other notes in the pane. -
A tool call is two entries, tied by the call's number in the run,
#1,#2, and so on, which both carry: calls of one turn overlap, and they end in any order. The start entry isHH:MM:SS ▷ Bash #3, and its input is under it, indented two spaces, as the adapter sent it: a shell command keeps its line breaks and indentation (an empty line stays empty, with no indent), and any other input is its JSON, indented, with the keys in the order they came and the strings as they came. A call whose adapter sent no input is one line, labelled by its title. The start is written when the call's own status says it is running or over, when agent text or another entry follows it, when its turn ends, or when the stream has been quiet for the settle time (2 seconds by default): a message that has no entry of its own, a usage update or another call's end, does not write it, for the adapter sends a call's input a moment after the call opens. A call the adapter says is in progress is timed from that message, and not from the first message about it. The end entry isHH:MM:SS ✓ Bash #3 (4s): the time it ended, the final status (✗for a failed call, with the first line of why after a dash: for a shell command that exited with a status,exit 2 —and the next line that says anything, where the adapter's first line is onlyExit code 2) and how long it ran, since the call was first seen, as<1s,12s,3m04sor1h02m. It does not say the input again. A call still without a final status when its turn ends, or the run does, ends as… Bash #3 (no final status). -
The start entry is written once the input is complete, which the adapter does not say:
claudeacpopens a call with an empty input, then sends the fields the model has finished writing, then the whole input, and the status only once the tool has run. The log therefore writes the start when the adapter moves on from the call: its own status goes past pending, agent text or another entry follows it, its turn ends, or the stream has been quiet for 2 seconds (a call that runs on, with nothing after it). A message that has no entry of its own, a usage update or another call's end, is not the adapter moving on from it. A call that runs for minutes is thus in the log within seconds of starting, stamped with the time the call was first seen, or with itsin_progressmessage when the adapter sends one. A call that runs beside others can therefore have its start written after their ends, stamped with its earlier time, so the times of the log are not always in order. The log is only appended to, so an input that changes after the start is written is not written again: if the model was still writing it after the stream's quiet, the start shows the fields known then. The wrapper holds an input, as the lines that show it, only until the start is written, and a call's title (aBashcall's is its whole command) cut to a line; it holds the ids of the calls that ended, until the run does, and ignores a message about one of them, so a late update does not open the call again as a new one. -
A tool call's input shows its first 30 lines, each cut at 240 characters. A cut line ends in
…, and the lines left out are counted:… 12 more lines. A file written in one call is a single JSON string, which the width cuts. Control characters of an input show as their pictures (␛for an escape), so an input cannot drive the terminal of a pane. -
Nothing else the log renders carries a control character either: agent text and thinking, gc's prompts, plan entries, tool names and titles, why a call failed, permission options, the adapter's stderr and the other fields of the stream show them as their pictures,
\x1b[2Jas␛[2J, and a line break in a one-line field is a space. Agent text is also set apart from the box's own entries, which begin at column 0 with their time: the lines of a run of text after its first are indented two spaces, and its first line, which follows the entry's time, has a space before it when it begins like an entry (with→,■,?,!,·and the other marks of the box). However an agent words its text, no line of it reads as→ permission allow_once (Yes), as a turn's end or as a call's start, to a person or torexcity acp follow, which drops the indent when it lays the sentence out. -
The pane reads the log as the agent's narrative and does not show it as it is:
rexcity acp followderives what it draws from the log, which stays what it is above (append-only, one start and one end record per call). The agent's sentences are in full brightness, each with its time and a●, wrapped to the pane's width, the lines after the first indented 2 columns, an empty line before each; its thinking is dim and italic, each run with its○. Each tool call is one line, indented 2 columns under the sentence it follows (not by the width of the time, which would push the line far to the right): its state (▷running,✓done,✗failed,⊘without a final status), the tool's name, the first line of its input cut to what is left of the width, how many lines the input has beyond it ((+9 lines)), and how long it ran. A call whose start entry carried no input (a log written before the adapter had sent it) is described by the label of its end entry. The first line of the input of a shell call is its command's first line; of any other call it is the value of the first field of its JSON, which for the tools a model calls is the path, the pattern, the address or the description, and the lines it has beyond it are the other fields. A failed call is red, with why on the next line, which is the one detail shown by default. The pane indents by 2 columns for each level it nests: a turn's calls are 2 in, and what is under a call (the why of a failed one, the input with--input full) is 4 in; the lines a sentence wraps onto are 2 in. The head line's text starts after the time and the marker, so the first line of a sentence has 9 columns less than the lines after it. gc's prompt is one line with a count of the rest: the first line that is not its header ([root] rexcity/roles.worker-2 • 2026-11-12T13:19:40, which the pane's label says too), and a plan update is one line of how far the plan is. Every other entry of the log (a note, an answer to a permission, a turn's end, the adapter's stderr) is one line, dim when it is only a record. A call is on its own line where it ends, so calls that overlap end in any order, and a sentence that comes while a call runs is written above it. -
A call that has run for 2 seconds has a line at the foot of the pane:
▷ Bash go test ./... running 41s, one line for each call running, the newest last, and a count of… 3 more calls runningfor the oldest when they outnumber half the pane's rows. Sentences and the lines of the calls that end are written above them, so a running call never scrolls out of sight, and its line is taken off the screen when the call ends, replaced by its final line, in the order the calls ended. A call that ends within 2 seconds only ever shows its final line. The pane moves the cursor for this (up, and clear to the end of the screen) and to draw itself again after a resize (home, and clear the screen), and for nothing else, and rewrites the running lines once a second. It writes the running lines with autowrap off (DECAWM), and the autowrap is on again after them, so that a line that is still too long for the terminal, because the terminal's width is not the one Rex laid the pane out at, is cut at its edge and is never two rows; it hides the cursor while it follows and shows it again when it ends. It moves the cursor over the running lines by counting one row for each, so each is cut to the terminal's own width, less one column, whatever width the pane is laid out for (--widthincluded): a line that wrapped would leave a stale copy of itself at every redraw. When its output is not a terminal, whenTERMisdumbor unset, or when the terminal does not say how wide it is, the pane writes lines only, no control sequence: a call running for 2 seconds gets one line (▷ … running) and its final line when it ends, and nothing is replaced. The pane never writes a control sequence that came from the log: control characters of the log's text show as their pictures (␛), as those of an input do. -
On a terminal the pane also tells Rex what the agent is doing, with Rex's program status escape sequence,
OSC 7501(Program Status Protocol, revision 0.4):ESC ] 7501 ; state=working:app=rexcity-acp ESC \, a list ofkey=valuepairs separated by:, themsgin base64. It is derived from the log by the same follower that draws the pane, from the entries the log already holds, and written to the pane's terminal only: the wrapper adds nothing to the JSON-RPC stream and waits for nothing, the log never holds a sequence, and--rawand output that is not a terminal (or whoseTERMisdumbor unset) get none.the log says Rex's status a run begins ( ━━ acp …)idle: the agent waits for gc's promptgc's prompt ( ▶ gc)workinga permission request waits ( ?)blocked,kind=permission,msg"needs permission": gc holds the request, and nobody answers at the panethe request is answered ( →) or withdrawn by the agentworkingagain, once none waitsa turn's end ( ■), whatever its stop reasonidle,msgthe stop reason (end_turn,cancelled;turn failedfor an error, without the adapter's words)the adapter exits ( ━━ adapter exited …), or the follower endsclear: the record is removedEvery report carries
app=rexcity-acpand replaces the record, as the protocol has it. Themsgof a blocked record does not name the tool or its input, for a command may hold a secret and Rex shows the record outside the pane. A turn's end isidleand notdone:doneis "finished, and you have not seen it yet", which every turn of every agent would be. A pane that starts in the middle of a run (replaced, or attached late) reads the log from where the run begins and reports where the agent stands, not each step it took to get there; a run that ended before it started reports nothing. A terminal that does not know OSC 7501 ignores it and shows nothing, as terminals do with an operating system command they do not know. The sequence opens each write of the pane, before its cursor moves, and takes no column and no row, so it never splits a redraw of the running lines. Rex does the rest of it with its own settings, per status (Settings → Notifications → Program Activity → Blocked): tab indicators, a macOS notification while Rex is in the background, the Dock badge and a sound. The pane raises no notification of its own, for Rex's are the setting that already decides it; ablockedagent gets what you set forblocked, and nothing is turned on by this. -
Tool calls are not grouped: a call before the first sentence of a turn comes under gc's prompt, and a long run of calls with no sentence between them is one line each under the sentence before it, with no collapsing, since each line is a record the pane could not take back once written. A sentence or a prompt is set apart by an empty line.
-
The width is the pane's: the terminal's size, read again each time the pane writes, which is how a resize is followed;
--width Nsets it, and when it is not known (output that is not a terminal) it is$COLUMNS, and else 100. Nothing narrower than 40 is laid out, but for the running lines, which are cut to the terminal's width whatever it is. A line is never longer than the width (the running lines, the terminal's own; the others, the layout's, at least 40): text wraps at words (a word longer than the line is cut at the width, as it is read, so a word of megabytes costs what its length does) and an input is cut with…. What the pane shows is a function of the log and the width, so after a resize it clears the screen and lays the tail of the log out again at the new width, as a pane that was just started would: the last 32 KiB of the log, from an entry, which is a few screens, and not the whole run. No row of the old layout is left, a running call's line least of all, for how the terminal reflowed the rows it had is not known and a cursor moved by a count that may be wrong would erase text. The pane notices the new size at its next poll (150 ms), and the scrollback is left as it is. The replay tells the terminal nothing new about the agent's status. What the replay lays out is what the pane kept, which is the last 32 KiB of the log from an entry, and an entry too long to fit twice that is not kept: a call whose start entry is older than that, such as a longgo testwhile a long turn goes on around it, has no running line after a resize, though it runs on, and its final line, when it ends, is made from the end entry alone. A resize in a pane that writes lines only (output that is not a terminal,TERM=dumb, or a terminal that does not say how wide it is) redraws nothing: it has no rows to replace. -
Styles are used on a terminal unless
NO_COLORis set orTERMisdumb;--color alwaysand--color neverdecide it by hand. They are the 16 ANSI colours, so the terminal's theme applies, and colour marks a state, not a noun: only what the agent said and what needs a person is bright.Element Style time stamp dim ●sentencethe terminal's own ○thinkingdim, italic, marker kept ▷runningyellow, with the seconds counting (red past 5 minutes) ✓donegreen mark, the rest as below ✗failedred mark, and why in red on the next line ⊘without a final statusmagenta tool name cyan input the terminal's own (highlighting stays opt-in) duration dim; yellow past 30 seconds, red past 5 minutes (+N lines)dim ▶ gcpromptbold blue ?permissionbold magenta !stderryellow ━━header,■turn end, notes and answersdim Without styles the markers carry the layout:
●a sentence,○thinking, and▷,✓,✗,⊘for the calls, with the tool lines indented under the sentences as before. -
How much of a call's input the pane shows is the agent's env
REXCITY_ACP_INPUT:first(the default) is the first line, as above;fullis the input as the log holds it (its first 30 lines of 240 characters, as before), under the call's line, dim;noneis the tool's name only. Any other value is reported on stderr, once, and leaves the default. The wrapper passes it as--inputtorexcity acp follow, which takes it by hand too, with--raw, which writes the log's bytes as they are (with--highlight, as before). The pane is a reader of the log file and sits nowhere in the wrapper's path, so it can neither slow the passthrough nor hold it up. -
A pane highlights the shell of a
Bashcall, and infullmode the JSON of any other, when the agent's env setsREXCITY_ACP_HIGHLIGHTto1,true,yesoron; it is off unless set. The wrapper passes--highlighttorexcity acp follow, which applies the colour as it shows the log: the log holds none of it (but the dim of thinking and of stderr, which it has always held), so it stays plain text for every other reader, and a pane can be switched without touching a log that is appended to. Infirstmode only the shell of aBashcall's line is coloured, for the first line of any other input is a value, not JSON. -
A pane runs
rexcity acp followon the log from where this run begins, with the options the agent's env asks for. It is placed exactly as a tui agent's pane is (see How sessions appear in Rex): the rig's tab for an agent withGC_RIG, else the city tab, withREXCITY_PANE,REXCITY_SESSION, the longer-edge split and the pane label. It opens when the adapter starts, in the background, and closes when it exits, however it ends (its own end, a signal, a crash): the wrapper starts closing it the moment the adapter has exited, beside the wait for the adapter's last output, and tries three times, half a second apart, when Rex fails a close. The runtime forgets a view's record only once its pane is closed, so a close that failed leaves the record, and the next start of the runtime or of a pane closes the pane by it, as it does for a wrapper that was killed. A pane that cannot be closed is said in the log (· pane not closed: …) as well as on the wrapper's stderr, which gc shows to nobody. A pane of the same agent that an earlier start left is replaced. An adapter that exits while its pane is being placed does not cut the opening short: the placing is let finish, bounded by the open timeout, so that the view is recorded and closed, and no pane is left that no record names.rexcity labelrelabels it. An agent whose env setsREXCITY_BOX = "process"gets the log only. People reach an acp agent throughgc nudge,gc mailor gc's answers to permissions, never by typing into its pane. -
On a terminal the follower reads no input and shows none: it puts the terminal's input in raw mode without echo for as long as it runs, reads what is typed and throws it away, so that a key pressed in the pane (an arrow, a focus report) is not echoed into the middle of the screen as
^[[B. The interrupt key keeps its meaning. The terminal's modes and the cursor are put back when the follower ends, onSIGINT,SIGTERMandSIGHUPtoo. Rex starts the pane's program with no login shell (theloginoption of its terminal block is false for the split that makes a pane of an acp agent), sologin(1)prints noLast login:line above the pane. A tui agent's pane and the panes a city declares are started as before. -
If Rex is unreachable or the pane fails, the wrapper says so on stderr, the adapter runs and the log is written, and the next start tries again. The agent never fails because its viewer did.
-
The pane is no box of the runtime's: it is kept as
views/<name>in the state directory, apart from the runtime's records, solist-running,inventoryandobservenever list it. A start of the runtime keeps the tab of a view whose wrapper runs and closes the pane of one whose wrapper has exited.
The adapter
The adapter is claudeacp of mikluko/claudeacp, a fork of afrase/claude-acp-go (whose program is claude-acp), pinned as a tool in go.mod at v0.5.0, whose hash go.sum records. The fork is what lets gc use its ordinary claude provider: gc appends the claude CLI's options to an ACP command (--dangerously-skip-permissions, --effort, --model, and --settings with the file that holds gc's hooks), and upstream's claude-acp takes no option and exits 2. The fork takes them and passes them to every claude it starts. go install tool in a rexcity checkout installs it as claudeacp beside rexcity, so whatever builds rexcity from the locked commit builds the adapter with it:
GOBIN="$REX_BIN_DIR" go install ./cmd/rexcity tool
The module is fetched through proxy.golang.org and checked against sum.golang.org like any other: no GOPRIVATE, GONOSUMDB or GOFLAGS is needed on a developer's machine or in CI.
The image does not carry it: the image's acp path is rexcity acp claude over claude-agent-acp (below), and nothing in the Dockerfile, rootfs/, the chart, the packs or the smoke test starts claudeacp. It is the adapter of a city on a Mac, where the apply order installs it beside rexcity.
go tool claudeacp runs it without installing. It runs the claude on PATH, or $CLAUDE_CODE_EXECUTABLE, with the settings of CLAUDE_CONFIG_DIR and of the project, and those of --settings.
Configuring gc for it
-
gc's claude options reach claude. For a provider of the claude family gc appends them to the
acp_command:rexcity acp -- claudeacp --dangerously-skip-permissions --effort max --settings "<city>/.gc/settings.json". The wrapper passes the command's arguments to the adapter as they are, andclaudeacpv0.5.0 passes them on toclaude. So gc's hooks (gc prime --hookonSessionStart, the nudge and mail checks onUserPromptSubmit) run from--settings, and--dangerously-skip-permissionsputs the session inbypassPermissions, as for a tui agent. Where a session's_meta.claudeCode.optionssetsmodel,permissionModeorsettings, they replace the command line's; gc sends none.[providers.claudeacp] base = "builtin:claude" acp_command = "rexcity acp -- claudeacp" supports_acp = true -
Hooks in the user settings (
$CLAUDE_CONFIG_DIR/settings.json) and the project's.claude/settings.jsonrun too, as they do for any claude. Identical hooks there and in--settingsrun once. -
claudeacprefuses, with exit 2, the options that would change how the agent runs claude (print mode, resuming a session,--bareand the like), and--session-id, which it sets itself. The gc supervisor appends none of them to a session it starts: the live city'sclaudeacpprocesses carry only--dangerously-skip-permissions,--effort,--modeland--settings. A session started withgc session newin a city with no controller running (checked with gc 6bd609f) is different: gc appends--session-id <uuid>as well,claudeacpexits 2 (--session-id can't be set: the package names each session itself), and gc reportsacp handshake ...: connection closed during initialize. Not checked: whethergc start's own sessions in a throwaway city carry it; the live city's are the evidence for the supervisor. -
Model and effort come from gc's options, the agent's
envor the settings; the wrapper does not send them.
Running an agent through ACP: rexcity acp claude
rexcity acp claude lets gc run a Claude agent with session = "acp". gc's ACP runtime is headless: it starts the provider's acp_command, sends initialize, session/new and session/prompt over stdin and stdout, holds each session/request_permission as a pending interaction, and answers nothing else the agent asks. The proxy sits between gc and claude-agent-acp (in the image, a pinned standalone build) and adds what gc cannot send:
--model M,--effort Eand--settings FILE|JSONgo into the client'ssession/newas_meta.claudeCode.options.model,.effortand.settings(a settings file's path, or a JSON object), where claude-agent-acp reads them. Give them the values the agent has under the rex provider: the provider's model and effort options and its--settingsfile. A client's own_metastays, and a flag overrides the same option the client sent.--bypasssendssession/set_modebypassPermissionsright aftersession/new, and holds thesession/newreply until the agent has accepted it, so gc's first prompt finds the mode set and nosession/request_permissionis left pending in gc for an agent that nobody watches. If the agent refuses the mode (claude-agent-acp refuses it for root unlessIS_SANDBOXis set), gc gets a JSON-RPC error forsession/newinstead of a session that would hang on its first tool call.--pre-start CMD, repeatable, runs CMD with/bin/sh -cin the proxy's directory and environment before the agent starts, in the order given. gc's ACP runtime never runs an agent'spre_start, which under the rex runtime is how a polecat gets its git worktree (worktree-setup.sh), so give the same commands here. A failing command is warned on stderr and logged (pre-startevent), and the agent starts anyway.
Everything else is relayed unchanged, both ways. The proxy appends each message, with direction and time, to $XDG_STATE_HOME/rexcity-acp/<session>.jsonl, and its own set_mode as proxy>agent. In a provider:
[providers.claude-proxy]
base = "builtin:claude"
acp_command = "rexcity"
acp_args = ["acp", "claude", "--model", "claude-sonnet-5-5", "--effort", "medium", "--settings", "/path/to/settings.json", "--bypass", "--pre-start", "/path/to/worktree-setup.sh RIG_ROOT WORK_DIR AGENT --sync"]
The agent defaults to claude-agent-acp on PATH; REXCITY_ACP_AGENT or the arguments after -- name another.
When it runs in a Rex tab (REX_SESSION set) it opens a tab in that session running rexcity acp view --follow --from <log size at start> on the log, so a session name reused by later runs shows only the current one. The tab shows the run readably, not as JSON-RPC: the prompt, the agent's text as it streams (each message cut at 2000 characters), each tool call with its title and a short result (at most 6 lines, long lines clipped), plan updates, the agent's stderr and the stop reason. When the proxy has exited, the viewer waits 5 minutes (REXCITY_ACP_GRACE) and closes its own tab, so the proxy returns as soon as the agent exits and does not hold gc. A proxy killed without a trace ends the view too, once its pid is gone. rexcity acp view LOG renders a finished log to stdout. The log is private to the user (mode 0600, directory 0700).
REXCITY_ACP_SESSION names the log (default $GC_SESSION_NAME), REXCITY_ACP_TAB=0 opens no tab, and REXCITY_ACP_GRACE sets how long the tab outlives the agent (default 5m).
Outside the image, make acp-agent downloads the pinned claude-agent-acp standalone build into bin/, and cmd/rexcity-acp-client stands in for gc: it runs initialize, session/new and session/prompt against a command. cmd/rexcity-mock-api stands in for the Anthropic API, answering a prompt with a Bash tool call and then with text; the image's smoke test drives a run through it (.forgejo/scripts/smoke-image.sh), and so can you:
make acp-agent
go build -o bin ./cmd/rexcity ./cmd/rexcity-acp-client ./cmd/rexcity-mock-api
bin/rexcity-mock-api -addr-file /tmp/mock.addr &
ANTHROPIC_BASE_URL=http://$(cat /tmp/mock.addr) ANTHROPIC_API_KEY=x REXCITY_ACP_TAB=0 \
bin/rexcity-acp-client -cwd "$(mktemp -d)" bin/rexcity acp claude --model claude-sonnet-5-5 --bypass bin/claude-agent-acp
Limitations
- The runtime does not report activity, so gc's sleep capability for it is
timed_only: interactive sessions do not sleep. - The runtime has no
execoperation. gc drives agents throughnudge,send-keys,interruptandpeek, so input fencing and full idle sleep are not available. - The acp box's pane and
rexcity labelfind the state directory from the agent'sGC_CITY_PATH, and the runtime fromGC_EXEC_CITY_PATH. They name the same directory only when both give the same city and one state root. Where they differ, which gc 1.5.1 does for a pack-declared runtime (it sets noGC_EXEC_CITY_PATH), an acp agent's view gets a tab of its own, a city agent's a second city tab, and the runtime's next start closes it as held by no agent: the pane is gone until the adapter starts again. No agent fails of it, and no tab of the runtime's is closed. A city agent's second city tab also starts the city's declared panes a second time. - gc 1.5.1 does not set
GC_EXEC_CITY_PATHfor a pack-declared runtime, so every city on the host gets the same<city-key>and shares one state directory. With that version, run one city per user on a host. - An agent that is not a fresh Claude Code gets its startup prompt typed once it shows its ready prompt. One that does not show it within 10 seconds, such as one held by a startup dialog that gc dismisses after the start, does not get the prompt. Claude Code receives its role through gc's
SessionStarthook either way. gc session attachdoes not work. Open the city session in the Rex app.- A tab you select in the Rex app stays attached after you switch the app to another Rex session, until another tab of its own session is selected. gc stops no attached session, so an agent that finished and acknowledged its drain while you looked at its tab keeps its tab and its gc session open. Select another tab of the city session; gc stops the agent at its next retry, which can be up to 5 minutes later.
Development
Run the tests. The pack tests skip without bash, jq, curl and git:
go test ./...
The TestLive* tests in internal/rex create and kill sessions on the Rex server the rex on PATH selects, which is your own on a development machine, so they skip unless you ask for them with REXCITY_LIVE_TESTS. They also skip when no server answers:
REXCITY_LIVE_TESTS=1 go test ./internal/rex
Build the runtime and run Gas City's protocol checks against the build:
go build -o bin/rexcity ./cmd/rexcity
ln -sf rexcity bin/gc-runtime-rex
gc runtime check ./bin/gc-runtime-rex
gc runtime conformance ./bin/gc-runtime-rex
To try the runtime in a throwaway city, point GC_HOME at a scratch directory and run gc supervisor run there.
Caution: Give a throwaway city
catas its agent, never a shell. gc types the startup prompt into the agent, and a shell runs each line of it as a command.
Caution:
gc startinstalls a launchd agent,~/Library/LaunchAgents/com.gascity.supervisor.<gc-home-id>.plist, even whilegc supervisor runis running. Remove it when you are done with the throwaway city.
Work on rexcity is tracked with beads in city saraksh, which serves the database rexcity and is its only writer.