# Internal APIs

> The daemon services, frames, subcommands and hidden commands the Workroom app uses beyond the terminal API, documented for anyone who finds them useful, with no promise that they stay the same.

<!-- Generated from the workroom binary's commands by `make docs-cli`. Don't edit by hand. -->

> [!WARNING]
> These are what the Workroom app uses to talk to its daemons and its CLI. They are documented for anyone who finds them useful, but they are not covered by the terminal API's compatibility promise, and may change in any release, without notice. For anything a script or a coding agent relies on, use the [terminal API](/docs/reference/terminal-api.md), which only ever adds.

To notice a change, compare the protocol version and the version you built against: `workroom protocol` prints the protocol that `workroom` binary speaks (a daemon says its own in its greeting, below), and `workroom version` prints its version. Compare the terminal API's `revision` too, which `workroom api describe` shows. This page is generated from the `workroom` binary's source, so it describes the build it came with.

## The socket

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

Every daemon listens on one Unix socket. On the Mac, it is the one the app starts in its Application Support folder (`<bundle>/sessions/workroomd`), or, when that path is too long for a socket's name, in a folder of its own under `/tmp` (`/tmp/workroom-<uid>-<bundle>`). On a host, it is the one its supervisor starts. A Workroom terminal names it in `WORKROOM_DAEMON`. The socket is the only security boundary: anything that can reach it can do what its user can.

Both sides first send a greeting, then every message is an envelope that names its service and stream:

```text
Hello:     "WRA1" | protocol_version: u16 | build_len: u8 | build: [u8]
Envelope:  service: u8 | stream: u32 | length: u32 | payload: [u8]
```

Integers are big-endian, and a payload is at most 1 MiB. Both sides speak the lower of their two versions, and a client checks the daemon's own version before it uses a service that arrived later, since an older daemon drops what it doesn't know. This build speaks protocol 12. Each request opens a stream of its own; a service's events, where it has any, come on stream 0.

## Services

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

| Byte | Service | Since protocol | What it is for |
| ---- | ------- | -------------- | -------------- |
| `0x00` | Control | 1 | Session control not tied to one attach: list, kill, hand off, signal a run, retag, and say the connection pings. Its frames are the Terminal service's framing. |
| `0x01` | Terminal | 1 | One attach to a session's pty: the session's output, and the client's typing and size. `workroom attach`, which every pane runs, speaks it. |
| `0x02` | VCS | 2 | A workroom's repository, read and written where its files are: Git reads (history, changes, diffs, file contents), `git` runs for writes, and file stats. |
| `0x03` | File | 3 | A workroom's files: listing, reading, resolving paths and watching for changes. |
| `0x04` | Status | 4, retired | Retired. Every request is answered `{"unsupported": …}` for apps that still ask. |
| `0x05` | Forward | 5 | Port forwarding: one loopback TCP connection on the daemon's machine per stream, or a listener whose connections the client claims. |
| `0x06` | Layout | 7 | Each remote workroom's tabs and splits, kept on its host so every Mac opens the same ones. |
| `0x07` | ProgramStatus | 8 | What each session's program reports through OSC 7501 (a coding agent working, done or waiting on you), and how its shell's last long command ended. |
| `0x08` | Terminal API | 12 | The public terminal API. Not internal: see the [terminal API reference](/docs/reference/terminal-api.md). |

## Terminal and Control frames

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

The Terminal and Control services carry frames: one byte of kind, a big-endian `u32` length, then the payload, at most 1 MiB. A pane's `workroom attach` sends `Attach` and then the user's typing and size; the app's own connection to each daemon sends the Control frames, to list the sessions it shows as detached, close one, hand the daemon off to a newer build, restart or stop a Run tab, and move a session to another workroom.

| Byte | Frame | Direction | Since protocol | Payload | What it does |
| ---- | ----- | --------- | -------------- | ------- | ------------ |
| `0x01` | `Attach` | to the daemon | 1 | The 16-byte session id, then NUL-terminated `KEY=VALUE` entries (below). | Attaches to the session, creating it unless `CREATE=0`. Answered `Attached`, then the session's screen and its `Output`, or `Failure`. |
| `0x02` | `Input` | to the daemon | 1 | Bytes. | Typed into the session's pty. |
| `0x03` | `Resize` | to the daemon | 1 | Columns and rows, then the width and height in pixels, each a big-endian `u16`. | The client's window size. The session follows the size of the client that last typed or clicked. |
| `0x11` | `Attached` | to the client | 1 | None. | The attach was accepted. |
| `0x12` | `Output` | to the client | 1 | Bytes. | What the session's program printed. |
| `0x13` | `Exited` | to the client | 1 | The shell's exit code, a big-endian `i32`. | The session ended. |
| `0x14` | `Failure` | to the client | 1 | A UTF-8 reason. | A request failed. `no session …` means the session is gone. |
| `0x21` | `List` | to the daemon | 1 | None. | Lists the live sessions. Answered `Sessions`. |
| `0x22` | `Info` | to the daemon | 1 | None. | Reserved: the app's frame decoder knows its byte, and this daemon answers nothing to it. |
| `0x23` | `Kill` | to the daemon | 1 | The 16-byte session id. | Ends the session. Answered `Acknowledged` once its processes are gone. |
| `0x24` | `KillAll` | to the daemon | 1 | None. | Ends every session. Answered `Acknowledged`. |
| `0x25` | `HandOff` | to the daemon | 6 | `force` as one byte, then the absolute path of a binary. | Replaces the daemon's program with that binary in place, keeping every session and its processes. Answered `Acknowledged` with `handing off` or `current`, or `Failure` with why it was refused. |
| `0x26` | `Signal` | to the daemon | 9 | The 16-byte session id, then one run signal byte (below). | Asks a run session's supervisor to restart, stop or quit its command. Answered `Acknowledged` once sent. |
| `0x27` | `Retag` | to the daemon | 10 | The 16-byte session id, then the workroom as UTF-8. | Tags a live session with another workroom. Answered `Acknowledged`. |
| `0x28` | `Pings` | to the daemon | 11 | None. | Says the client sends something at least every 15 s, so the daemon may close the connection after 60 s of silence. Answered `Acknowledged`. |
| `0x29` | `Peer` | to the daemon | 11 | NUL-terminated `KEY=VALUE` entries: the ssh login's environment. | Sent by `relay` alone, right after the greeting, and never answered. Sessions this connection creates from the host's environment are built from it. |
| `0x31` | `Sessions` | to the client | 1 | A count, then each session's id, pid, tty, folder, whether it is attached and its metadata. | The answer to `List`. |
| `0x32` | `Acknowledged` | to the client | 1 | None, or a UTF-8 word. | A control request was done. |

### Attach entries

| Entry | What it says |
| ----- | ------------ |
| `SHELL` | The shell to start, when the attach creates the session. |
| `COMMAND` | The command to run in place of a login shell. |
| `CWD` | The folder it starts in. |
| `RESOURCES` | Ghostty's resources folder, whose shell integration the shell is pointed at. |
| `COLS` | The client's columns. |
| `ROWS` | The client's rows. |
| `XPIXELS` | The client's width in pixels; 0 for unknown. |
| `YPIXELS` | The client's height in pixels; 0 for unknown. |
| `CREATE` | `0`: attach only to a session that exists, never create one. A restored pane sends it. |
| `HOST` | `1`: build the session from the host's own environment and account (a remote pane). |
| `CLIENT` | The client's kind, `pane`, `app` or `cli`, as `sessions --clients` reports it. |
| `HOSTNAME` | The machine the client is on: for a pane, the Mac showing it. |
| `RESUME_ARG` | One word of the tab's resume record's command, in order, sent only with the attach that makes a restored pane's gone session again: the session's login shell runs it. A remote pane sends it with its first attach, `CREATE=0` too: a gone session is then made again with it, once however many clients ask, unless it is a run session or the daemon runs as root, which are refused as before. Only a session that ended with its daemon or host is made again: never one that ended under this daemon, killed or exited, nor, on a daemon that keeps screens (`serve --screens`), one whose last screen it didn't keep. Such an attach is answered as one with no record. |
| `RESUME_CWD` | The folder the resume record's command runs in; a folder that is gone means no resume. |
| `RESUME_AT` | When the resume record was reported, in milliseconds since the Unix epoch. |
| `ENV:NAME` | One variable for the session's environment, the client's own, not the daemon's. |

### Run signals

The byte a `Signal` frame carries.

| Byte | What it asks |
| ---- | ------------ |
| `1` | `SIGUSR1`: stop the command and run it again in place. |
| `2` | `SIGUSR2`: stop the command and keep the pane. |
| `3` | `SIGTERM`: stop the command, then end the session. |

## JSON services

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

### VCS

JSON on the chunked envelope: each payload starts with one byte, `0` for a continuation and `1` for the last, and a reply is at most 16 MiB. A read is `{"version": 1, "root", "backend": "git", "method", …}` with `limit`, `revision`, `path` and `base` as it needs them; a write or a stat names its `kind` instead. A reply is `{"version": 1, "result": …}` or `{"version": 1, "error": …}`. The app sends it to the daemon where a workroom's files are: this Mac's for a local workroom, which falls back to the Mac's own Git when that daemon can't answer, and its host's for a remote one.

| Request | Takes and answers | When the app sends it |
| ------- | ----------------- | --------------------- |
| `capabilities` | → `{version, reads, exec}`: the read version, how many reads, and the exec service's version. | Before anything else on a connection. |
| `log` | `limit` (at most 10000) → a page of history. | Showing a workroom's history. |
| `changeset` | `revision` → one commit's files and stats. | Selecting a commit. |
| `current_ref` | → the branch and commit checked out. | The branch shown for the workroom. |
| `working_status` | → uncommitted changes. | Showing a workroom's changes. |
| `file_diff` | `revision`, `path` → one file's diff in a commit. | A file's diff in a commit. |
| `working_file_diff` | `path`, `base: working_copy` → one file's uncommitted diff. | A changed file's diff. |
| `file_content` | `revision`, `path` → a file's contents at a commit. | Showing a file as it was. |
| `commit_parent_file_content` | `revision`, `path` → the file in the commit's parent. | The left side of a commit's diff. |
| `working_base_file_content` | `path`, `base: working_copy` → the file at `HEAD`. | The left side of an uncommitted diff. |
| `exec` | `kind: exec`, `executable: git`, `args`, `dir`, `timeout_ms`, and optional `stdin`, `env` and `host_environment` → `stdout`, `stderr`, `exit_code`, `timed_out`, `signaled`. | Git writes (commit, push, pull and the rest), whose output the app reads as it would a `git` it ran itself. |
| `stat` | `kind: stat`, `paths` (at most 64), `read` → each path's `exists`, `is_dir`, `modified_at` and, for a file of at most 4 KiB in `read`, its `text`. | Checking whether paths exist on a host, and reading small files there. |

### File

JSON on the VCS service's chunked envelope, one envelope per request: `{"version": 1, "method", "root", …}` with `path`, `symlinks`, `max_bytes` and `subscription` as it needs them. Paths are relative to the repository and resolved where its files are. The app sends it as it sends VCS requests, falling back to reading a local workroom's files itself.

| Request | Takes and answers | When the app sends it |
| ------- | ----------------- | --------------------- |
| `capabilities` | → the service's `version`, `max_read_bytes` and `max_subscriptions`. | Before the first file request on a connection. |
| `list` | `root` → the repository's files, from a fixed `git` listing. | Listing a workroom's files. |
| `read` | `root`, `path`, optional `max_bytes`, and `symlinks`: `follow_within_root` (the file viewer: a link is followed only to a target inside the root) or `refuse` (a diff, where a link is its target's path) → one file's bytes, base64. | Opening a file, and the files of a diff. |
| `resolve` | `root`, `path` → the repository path a path with `..` or links names, resolved where the files are. | Opening a file path clicked in a terminal. |
| `watch` | `root`, `subscription` → changes, sent on stream 0 until `unwatch`. | Refreshing what the app shows of a workroom when its files change. |
| `unwatch` | `subscription` → stops it. | Closing what watched. |

### Layout

JSON on the chunked envelope. The daemon never parses a layout: it is the app's own JSON, kept as bytes beside `serve --screens`. A daemon with no screens folder keeps none and says so.

| Request | Takes and answers | When the app sends it |
| ------- | ----------------- | --------------------- |
| `capabilities` | → `{version, available, maxBlobBytes, maxKeys}`. | Before reading a remote workroom's layout. |
| `get` | `key` → `{revision, blob}`; revision 0 and no blob for a key never written. | Opening a remote workroom. |
| `put` | `key`, `expected` (the revision read), `blob` → `{revision}`, or a `stale` error with the current one. | Saving a remote workroom's tabs and splits when they change. |

### Forward

Each payload is one opcode byte, then a body: `0x01` OPEN (the JSON request, once), `0x02` REPLY (`{"version": 1, "result" | "error"}`), `0x03` DATA (the connection's bytes), `0x04` EOF (a half-close), `0x05` CLOSE (the stream is done; the daemon's is always its last word on it), `0x06` ACCEPTED (a listener has a connection to claim).

| Request | Takes and answers | When the app sends it |
| ------- | ----------------- | --------------------- |
| `open` | `host` (a loopback address), `port` → `{opened: true}`, then DATA both ways. | A port forwarded from a remote workroom, one stream per connection to it. |
| `listen` | `port` → a listener on the host's loopback, which sends ACCEPTED per connection. | Forwarding a port from the Mac to the host, such as Git's credential relay. |
| `accept` | `listener` → claims one waiting connection on a new stream. | Each ACCEPTED connection. |

### ProgramStatus

JSON, one envelope per request, each answered `{"version": 1, "result" | "error"}`. Events go to stream 0, as the next section shows. What programs send is OSC 7501, described in the repository's [docs/program-status.md](https://github.com/joelmoss/workroom/blob/master/docs/program-status.md).

| Request | Takes and answers | When the app sends it |
| ------- | ----------------- | --------------------- |
| `subscribe` | optional `answers` → `{available: true}`, then the events. A daemon built without its terminal state answers `available: false`. With `answers: true` the app answers held requests: while it is subscribed, every session's coding agent's permission requests are held for it. | On every daemon connection, for the tabs' status marks and alerts; with `answers` while Settings ▸ Labs ▸ Agents is on. |
| `unsubscribe` | → `{ok: true}`. | When the app stops listening. |
| `seen` | `session`, `revision`, optional `states` → drops the `done` and `error` reports shown as of `revision`. | You looked at the pane. |
| `clear` | `session` → drops every report. | Clear Status. |
| `answer` | Nightly only. `session`, `held` (the held request's id), `decision` ("allow", "always", "deny", or {"option": &lt;index>} for a question) → `{ok: true}`, handing the coding agent's hook its decision. The first answer wins: one for a request no longer held is `stale`, and one the request doesn't offer (Always allow where the held table's label is null, an option on a permission or on a question Workroom can't answer, a plain allow on a question) is `unsupported` and leaves it held. | An answer button in the Agents tab, the panel or a notification. |
| `release` | Nightly only. `session` → `{ok: true}`; its held request, if any, ends with no decision, so its program's own prompt asks. `all: true`, with no `session`, does so for every session on the daemon and drops every Codex Always allow rule it keeps. | Turning Settings ▸ Labs ▸ Agents off sends `all: true`. |
| `transcripts` | Nightly only. optional `cwd` (one path) or `under` (paths), optional `limit` (200 by default, at most 1000) → `{transcripts, truncated, pending?}`: the past Claude Code and Codex conversations in their own transcripts on the daemon's machine whose recorded cwd is `cwd`, or is or is inside one of `under`, or any, newest first. Each row: `program`, `sessionId`, `cwd`, `branch`, `model`, `title`, `messages`, `messagesCapped`, `firstPrompt`, `updatedAt` (ms), `transcriptPath`, `configDir` or `codexHome` when not the default, `resume` `{argv, env}`, run in `cwd`, and `running` when a live program holds the conversation now: `{pid, session?}` with the Workroom terminal session `session` it runs in, or `{}` for a Codex thread whose process wasn't found (absent: not known to run; worked out for each reply, never cached, and left out of a reply whose 2 s wait for it ran out). `truncated` says older ones may exist. A path matches as given and as it resolves through symlinks. One scan runs at a time: a request joins its scope's, and one not done in 20 s gets the rows found so far with `truncated` and `pending: true` (absent otherwise), and a queued scan no request waits for any more is dropped; with 8 scans queued it is `busy`. Malformed fields are `unsupported`, as an older daemon answers the method. | The Agents tab's Ended group, and its Refresh; a pending reply shows Looking… and is asked again. |

## Events on stream 0

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

The ProgramStatus service sends its events to every subscribed connection, and the File service its watches' changes. Each table lists an event's fields as the daemon writes them.

### ProgramStatus `status`

A session's records, as they are now: one per session in the snapshot that follows `subscribe`, then one each time they change.

| Field | What it says |
| ----- | ------------ |
| `event` | `status`. |
| `boot` | Names the daemon's numbering of these events. |
| `session` | The session's id. |
| `revision` | The session's revision of its records, which `seen` names. |
| `reporting` | Whether a program run in the session is reporting now, until its prompt, a reset or its end. |
| `records` | Its records, each as the next table says. |
| `run` | Only on a run session: what its supervisor last wrote, such as `running` or `exited 3`. |
| `resume` | The session's resume record whole, as the next-but-one table says, or null for none. The app saves it in the tab's saved-layout entry. A daemon that predates resume records leaves it out, which says nothing about the tab's record. |
| `resumeStarted` | `true`, sent only then and in every event after: the program the session was started to resume has started, its helper's report of the record accepted, so the pane says it resumed. Left out of a session that resumes nothing, or whose resume the daemon declined (`resumeDeclined`). A hand-off's next program doesn't carry it. |
| `resumeFailed` | `true`, sent only then and in every event after: the program the session was started to resume could not start, or exited with an error within 5 s of starting, so the pane says it couldn't be resumed. It can come with `resumeStarted` or, for a program that never started, without it. A hand-off's next program doesn't carry it. |
| `resumeDeclined` | `true`, sent only then and in every event after: the daemon declined the resume the session was started for, so the pane says it got a new shell and the tab forgets the record. Sent from the session's first event when the record's folder is gone or its shell has no Workroom hook (only zsh and bash have one); else, for a shell that never said the hook loaded in it (one that skipped `.zshenv` or `ENV`), at its first OSC 133 prompt when its helper had not reported, or 30 s after the session started for a shell whose prompt sends no OSC 133. A shell whose hook loaded is waited for as long as it runs, so a hook its startup files keep from running is never declined. The daemon claims the unused launch file first, so nothing starts the program later, and the record it seeded goes with it. A hand-off's next program doesn't carry it. |
| `changedAt` | Nightly only. When the session's state last changed, in milliseconds since the Unix epoch: a record's state, a record appearing or going, the command result, or a held request starting or ending. A message or progress alone doesn't change it. 0 until the first change. Carried by a hand-off. |
| `agent` | Nightly only. What the session's coding agent last told its hooks, as the agent table below says, or null until the first report. Experimental, behind Settings ▸ Labs: only a session whose Claude Code or Codex runs Workroom's hooks has one. Carried by a hand-off. |
| `held` | Nightly only. The coding agent's permission request Workroom holds for an answer, as the held table below says, or null for none. While one is held the session needs the user, whatever its records say. Experimental, behind Settings ▸ Labs. Never carried by a hand-off. |
| `backgroundWork` | Nightly only. Sent only while there is some: the background work (a shell run in the background, a background subagent) that Claude Code's finished turn left running, which will wake it with a turn of its own. Each entry has `id`, `kind` (`shell` or `subagent`), `description`, `since` (when the turn finished, in milliseconds since the Unix epoch) and `tracked` (whether the daemon follows it to its end; false when Claude Code reports no record of it). From a Claude Code `Stop` hook that names background work until its next turn starts, its root record's `working` is sent as `done` (`idle` once the app has seen it) and each task's own `working` record is left out of `records`. Experimental, behind Settings ▸ Labs. Carried by a hand-off. |
| `now` | Nightly only. The daemon's wall clock when the event was made, in milliseconds since the Unix epoch: what the app measures `changedAt` and the agent's times against, since a host's clock need not agree with the Mac's. Always the event's last field. |

### ProgramStatus `status` records

One record of a `status` event's `records`: what one program said through OSC 7501, or how the shell's last long command ended.

| Field | What it says |
| ----- | ------------ |
| `id` | The record's id, as the program gave it; empty for its main one. |
| `state` | `idle`, `working`, `done`, `blocked` or `error`. |
| `kind` | What a blocked program needs: `none`, `permission`, `question` or `auth`. |
| `progress` | Its progress in percent, or -1 for none. |
| `app` | The program, such as `claude-code`. |
| `title` | Its title. |
| `message` | Its message. |
| `episode` | Which time this record blocked, counted across the session; 0 until it first does. |
| `notify` | Whether the app may alert for it. |
| `changedAt` | Nightly only. When its state last changed, in milliseconds since the Unix epoch: a report in the state it was already in keeps it. 0 for not known, from a daemon that predates it, until the session's next change. |
| `exitCode` | Only on the shell command's record: the command's exit code. |

### ProgramStatus `status` agent (Nightly only)

A `status` event's `agent`: what the session's coding agent last told the hooks Workroom installs in Claude Code and Codex (`workroom hook`, through the terminal API's `session.hook`). It adds detail to the records and never makes a mark. It follows the session's outermost conversation: another conversation's reports (a `claude -p` or `codex exec` the agent runs through its shell) are ignored until the kept one ends (`SessionEnd`), its program exits, or the shell's prompt comes back; then a new conversation (another `session_id` or program, or a start after an end) starts it afresh, as does the kept program moving to another conversation (`/clear`, `/new`, `/resume`). A report that changes nothing but `reportedAt` sends no event. Texts are made safe as a record's message is.

| Field | What it says |
| ----- | ------------ |
| `program` | `claude` or `codex`. |
| `sessionId` | The program's own id for the conversation. |
| `transcriptPath` | Where the program writes the conversation's transcript; null from Codex. |
| `cwd` | The folder the program runs in, as its latest report said, or null: where the app resumes the conversation once its terminal has ended. |
| `title` | The conversation's title (Claude Code's `session_title`), or null. |
| `prompt` | The last prompt submitted, cut to 512 bytes, or null. |
| `tool` | The tool the agent is running, or null: `{name, summary, at}`, `summary` one line (the `Bash` command, a search's pattern, an edit's or read's path, a fetch's URL, else the tool's name), `at` when it started in milliseconds since the Unix epoch. Set by `PreToolUse`, cleared by its `PostToolUse` and by `Stop`. |
| `subagents` | The subagents running, oldest first, at most 32: `{id, type, tool?}`, `tool` as the agent's own. `SubagentStart` adds one, `SubagentStop` removes it. |
| `todos` | The session's todo list, or null until a todo tool keeps one: `{items: [{id?, subject, status, activeForm?}]}`, at most 100, from `TaskCreate` and `TaskUpdate` (with `id`), or `TodoWrite`, which replaces it whole. |
| `reportedAt` | When the last report arrived, in milliseconds since the Unix epoch, as of the last one that changed anything else: one that changes only this sends no event. |
| `ended` | Whether the conversation ended (`SessionEnd`). |

### ProgramStatus `status` held (Nightly only)

A `status` event's `held`: the permission request or question a coding agent's `PermissionRequest` hook asked Workroom to hold (the terminal API's `session.hold`), until `answer` answers it or it ends with no decision. It ends when the terminal answers it (program status leaves `blocked`, or the tool's `PostToolUse` arrives), a newer request replaces it, its hook goes, no app is left to answer, `release`, or its deadline. Texts are made safe as a record's message is.

| Field | What it says |
| ----- | ------------ |
| `id` | Names this request, for `answer`; random, so one from before a hand-off never answers the next. |
| `program` | `claude` or `codex`. |
| `sessionId` | The conversation that asked (its `session_id`), or null when it named none. It can be another than `agent`'s: a nested run (a `claude -p` or `codex exec` the agent runs through its shell) asks in the same session, and its request is held and answered all the same. |
| `tool` | The tool's name, such as `Bash` or `AskUserQuestion`. |
| `summary` | One line: the tool's summary, as the agent table's, or the question. |
| `kind` | `permission`, or `question` for Claude Code's AskUserQuestion. |
| `options` | A question's options, `[{label, description?}]`, which `{option: <index>}` answers; for several questions, the first one's. Empty for a permission. |
| `answerable` | Whether Workroom can answer it: false for several questions or a multiple choice, which only the terminal answers. |
| `alwaysLabel` | What the Always allow button says, or null when it isn't offered: `Always allow` for Claude Code's rules and for Codex, `Allow all edits` for Claude Code's switch to accepting edits. It allows for this session only. |
| `alwaysScope` | What Always allow covers beyond this request, for the app to show with the button, or null when it covers exactly this request (a Claude Code `Bash` rule that is the command itself, or any Codex rule). Otherwise Claude Code's rules as it writes them, joined with ", " (such as `Bash(git commit:*)` or `WebFetch(domain:example.com)`), or `every edit this session` for Allow all edits, with `; access to <directories>` when it adds any. Rules past 2 KiB are counted (`, and 2 more`), never left out unsaid. |
| `detail` | The request's full text, `{text, truncated}`, or null when the summary says it all (a question): a shell command whole; an edit's path, then what it replaces and with what; a write's path, then its content; an `apply_patch` patch; any other tool's input as indented JSON. Line breaks are kept; it is cut at 16 KiB on a character boundary, `truncated` saying so. |
| `at` | When the hold started, in milliseconds since the Unix epoch. |
| `deadline` | When it gives up with no decision, in milliseconds since the Unix epoch. |

### ProgramStatus `status` resume

A `status` event's `resume`: how the session's program last said, over OSC 7577, it should be started again (ADR 0082). Only here: its arguments can hold secrets, so the terminal API lists a record without them.

| Field | What it says |
| ----- | ------------ |
| `argv` | The command, as the program reported it. |
| `cwd` | Where it starts: the folder it reported, else its own when it reported; null when neither is known. |
| `reportedAt` | When it reported, in milliseconds since the Unix epoch. |

### ProgramStatus `snapshot-complete`

The snapshot's end. Live `status` events follow.

| Field | What it says |
| ----- | ------------ |
| `event` | `snapshot-complete`. |
| `boot` | As `status` gives it. |
| `sessions` | The ids of the snapshot's sessions. |

### ProgramStatus `ended`

A session ended, and its records with it.

| Field | What it says |
| ----- | ------------ |
| `event` | `ended`. |
| `boot` | As `status` gives it. |
| `session` | The session's id. |

### File `changed`

Files under a watched root changed.

| Field | What it says |
| ----- | ------------ |
| `event` | `changed`. |
| `subscription` | The `watch` it belongs to. |
| `paths` | The absolute paths that changed. |
| `overflow` | Whether more changed than were listed, so the app reads everything again. |

### File `ended`

A watch ended without an `unwatch`.

| Field | What it says |
| ----- | ------------ |
| `event` | `ended`. |
| `subscription` | The `watch` that ended. |
| `reason` | Why, such as `root_removed`. |

### The terminal API, as the app uses it

The app makes one subscription to each daemon's [terminal API](/docs/reference/terminal-api.md): `events.subscribe` with `all: true` for `session.input` (the typing marker on a pane another session types into), `session.created` and `session.ended` (what `workroom new` and `workroom close` ask of the app) and `session.labelled` (tab names), and `events.unsubscribe` when it stops listening. It calls `session.label` when you rename a tab, and `api.describe` to learn which event types an older daemon has. Those are public, and described there.

## The daemon's subcommands

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

The same binary is the daemon. These subcommands are its own, never the CLI's commands, and `list` is the daemon's only with `--socket`. On a host the binary is installed as `workroomd`, the name this text uses:

```text
  workroomd serve --socket <path> [--idle-timeout <secs>|never] [--screens <dir>]
                  [--user <name|uid[:gid]> [--own <dir>]...]
        own ptys and services (the daemon role).
        --idle-timeout never is for a supervised remote daemon, which must keep running with no
        client attached.
        --screens <dir> keeps each session's screen in <dir>, so a pane reattaching after the
        host reboots is shown its last one. <dir> must survive a reboot: not the socket's.
        --user, run as root (a container's entrypoint), makes the socket's folder and each
        --own <dir> for that user, then becomes it; a ~ in --screens is that user's home.
  workroomd serve --stdio
        serve one connection over stdin/stdout, whose sessions die with it; a transport test
        entry point, not a persistent remote daemon (that is serve --idle-timeout never + relay)
  workroomd attach --socket <path> [--session <uuid>]
        relay stdio to a session; what libghostty forks
  workroomd attach [--no-create] --dial <command> [<argument>...]
        the same, to a daemon reached through the command's stdio (a remote pane,
        `--dial ssh -T <host> <binary> relay --socket <path>`): the session is built
        from the host's environment; exits 255 for a link to retry
  workroomd relay --socket <path>
        copy bytes between stdio and a running daemon's socket, and nothing else;
        what a driver runs on the far side (`ssh host workroomd relay --socket <path>`)
  workroomd list --socket <path>
        print the daemon's live sessions
  workroomd program-status --socket <path> [--json]
        print what each session's program says it is doing (OSC 7501), as the app is told it
  workroomd hand-off --socket <path> --binary <path> [--force]
        replace the running daemon's program with <binary>, keeping every session and its pid.
        Prints `current` when the daemon is running that binary already, `handed off` when it was
        replaced. Refused, with the daemon left running, when <binary> cannot restore its sessions
        (exit 1) or the daemon predates hand-off (exit 3). --force hands off to the same binary.
  workroomd handoff-check <table>
        whether this build can restore the sessions a hand-off table describes; run by the daemon
        handing off, before it replaces itself
  workroomd credential <get|store|erase>
        git's credential helper for a local container workroom: answers github.com with what the
        Mac relays
  workroomd credential relay --port <port>
        have a local container workroom ask the Mac for git's credentials through <port> on this
        box's loopback, reading the relay's secret from stdin, and make `workroomd credential`
        git's helper for https://github.com
  workroomd run-script --dir <dir> --timeout <secs> [--env NAME=VALUE]... -- <script>
        run a remote workroom's setup or teardown script in <dir>, with the login shell's
        environment and each NAME=VALUE, streaming its output. Exits with the script's status,
        124 when <secs> ran out, 126 when it could not start; the whole tree is killed on a
        timeout or a SIGTERM, SIGHUP or SIGINT
  workroomd run-supervisor --status <path> -- <command>
        what a run session's pty runs: the run supervisor around <command> in the login shell,
        writing its state (running, stopped, exited <code>) to <path>; USR1 restarts the command,
        USR2 stops it and keeps the pane, TERM stops it and exits
  workroomd resume-launch <file>
        what a resuming session's shell runs at its first prompt (#825), as its first job:
        claims <file>, a launch file the daemon wrote, and runs the program it names, in its
        folder, saying so when it fails
  workroomd resume-launch --hook-loaded
        what a resuming session's shell runs as Workroom's hook loads in it (#825): reports, as
        the shell, that the hook is there to run the program
  workroomd protocol
        print the protocol version this build speaks
```

A hand-off starts the daemon's next program in place as `serve --socket <path> --handoff <table>`, the table naming the sessions it takes over; nothing else passes `--handoff`.

| Subcommand | Who runs it |
| ---------- | ----------- |
| `serve` | The app, on the Mac when it first needs a daemon; a host's supervisor, on a host. A hand-off starts the next program as `serve --handoff <table>`. |
| `attach` | Every pane: it is what libghostty forks; with `--dial`, a remote pane's. |
| `relay` | A host driver, on the far side of ssh or a container's exec. |
| `list` | The app's host bootstrap, to check a host's daemon and its sessions. |
| `program-status` | Nobody: it is for a person, to see what the app is told. |
| `hand-off` | The app, to update a running daemon in place, on the Mac and on hosts. |
| `handoff-check` | The daemon handing off, against the binary it would become, before it replaces itself. |
| `credential` | Git, as a local container workroom's credential helper; `credential relay` is set up when the container is. |
| `run-script` | The app, to run a remote workroom's setup and teardown scripts on its host. |
| `run-supervisor` | The daemon: it is what a run session's pty runs around its command. |
| `resume-launch` | The daemon: a resuming session's own shell runs it at its first prompt, through Workroom's zsh or bash hook, as its first job: it runs the program the tab's resume record names, in its folder, and says so when that fails. With `--hook-loaded`, the same shell runs it as the hook loads, before the user's startup files, to report that the hook is there, so the daemon waits for it however late the first prompt comes. |
| `protocol` | The app, to ask a binary which protocol it speaks before using it. |

## Hidden commands

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

The CLI has commands that `workroom --help` doesn't list, because the app runs them, not people. They take `--json` and keep the [JSON output contract](/docs/reference/json-output.md) like every other command, and their kinds are in its tables. Shell completion runs one more, `workroom __complete ARGS… WORD` (and `__completeNoDesc`), which prints what to complete.

### `workroom add-project`

Register a project (internal; used by the macOS app via --json). The app runs it for: Adding a project, and with `--clone`, cloning one from a URL first.

Runs on a Mac only.

```text
workroom add-project [PATH]
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--clone` | yes |  | Clone this repository URL into PATH, then register it |
| `--create` |  |  | Create and git-initialize the directory if it does not already exist |

### `workroom agent-hooks` (Nightly only)

Install, remove or report Workroom's hooks plugin for Claude Code and Codex (used by the desktop app). The app runs it for: Settings ▸ Labs ▸ Agents, and each host's bootstrap, to install, remove or check the hooks plugin for Claude Code and Codex.

```text
workroom agent-hooks install|remove|status
```

#### `workroom agent-hooks install`

Install the plugin in each Claude profile and in Codex.

```text
workroom agent-hooks install
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--login-environment` |  |  | Read PATH, CLAUDE_CONFIG_DIR and CODEX_HOME from the login shell's environment |
| `--owner` | yes |  | Who wants the plugin, as the app's bundle id: install adds it (cli when not given), remove takes it away and uninstalls only when no owner is left |

#### `workroom agent-hooks remove`

Remove the plugin from each Claude profile and Codex, then its folder, once no owner wants it.

```text
workroom agent-hooks remove
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--login-environment` |  |  | Read PATH, CLAUDE_CONFIG_DIR and CODEX_HOME from the login shell's environment |
| `--owner` | yes |  | Who wants the plugin, as the app's bundle id: install adds it (cli when not given), remove takes it away and uninstalls only when no owner is left |
| `--all` |  |  | Uninstall whoever wants it, as remove without --owner does |

#### `workroom agent-hooks status`

Say whether each Claude profile and Codex has the plugin, and who wants it.

```text
workroom agent-hooks status
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--login-environment` |  |  | Read PATH, CLAUDE_CONFIG_DIR and CODEX_HOME from the login shell's environment |

### `workroom claim-provisioned`

Move the remote entries a build made from another config into this one (used by the desktop app). The app runs it for: At launch, moving the remote workrooms a build made into its own config.

Runs on a Mac only.

```text
workroom claim-provisioned
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--from` | yes | yes | The config to move entries out of |
| `--provisioner` | yes | yes | The bundle ID of the build that made them |

### `workroom delete-project`

Remove a project (internal; used by the macOS app via --json). The app runs it for: Removing a project.

Only a person may run it. Under a coding agent, such as Claude Code or Codex, it is refused with NeedsTheUser and changes nothing, on a Mac or elsewhere, before anything else is checked: the agent asks you to do it in the Workroom app or in your own terminal. With --pretend, which changes nothing, it runs. That stops a confused coding agent, not a determined one.

Otherwise it runs on a Mac only.

```text
workroom delete-project [PATH]
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--confirm` | yes |  | Required in --json mode; must match the project path |
| `--from-disk` |  |  | App-only: runs teardowns, drops config, returns trash_paths; the caller (macOS app) moves those dirs to the Trash |
| `--skip-teardown` |  |  | With --with-workrooms or --from-disk: run no workroom's teardown script (after one failed) |
| `--with-workrooms` |  |  | Also tear down every workroom (worktree dirs + files; branches kept) |

### `workroom host`

Set or clear a project's or workroom's host descriptor (used by the desktop app). The app runs it for: Storing or clearing a project's or a remote workroom's host descriptor.

Runs on a Mac only.

```text
workroom host
```

#### `workroom host clear`

Remove the host descriptor.

```text
workroom host clear
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--project` | yes |  | Project directory (defaults to the current directory) |
| `--workroom` | yes |  | The project's workroom; omitted, the project's own descriptor |

#### `workroom host set`

Store DESCRIPTOR, a JSON object, as the host descriptor.

```text
workroom host set DESCRIPTOR
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--project` | yes |  | Project directory (defaults to the current directory) |
| `--workroom` | yes |  | The project's workroom; omitted, the project's own descriptor |

### `workroom include-archive`

Write the project's included files to a tar (used by the desktop app). The app runs it for: Creating a remote workroom: the project's `.worktreeinclude` files, packed to copy over.

Runs on a Mac only.

```text
workroom include-archive
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--output` | yes | yes | The file to write the tar to |
| `--project` | yes |  | Project directory (defaults to the current directory) |

### `workroom hook` (Nightly only)

Report a Claude Code or Codex hook event to this session's daemon (run by the hooks Workroom installs). The app runs it for: Every hook entry Coding Agents installs in Claude Code and Codex (`claude` or `codex`), to report each event to the session's daemon. Experimental, behind Settings ▸ Labs.

```text
workroom hook claude|codex
```

#### `workroom hook claude`

Report a Claude Code hook event, its input on stdin.

```text
workroom hook claude
```

No flags.

#### `workroom hook codex`

Report a Codex hook event, its input on stdin.

```text
workroom hook codex
```

No flags.

### `workroom resume-hook`

Report how to resume Claude Code, or install or remove the hook that does (used by the desktop app). The app runs it for: Claude Code's `SessionStart` hook, to report how to resume its conversation (`report`); Settings ▸ Terminal, and each host's bootstrap, to install or remove that hook.

```text
workroom resume-hook report|install|remove
```

#### `workroom resume-hook report`

Report the running Claude Code's conversation to the pane, from its hook.

```text
workroom resume-hook report
```

No flags.

#### `workroom resume-hook install`

Install the hook in each Claude profile's settings.

```text
workroom resume-hook install
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--login-environment` |  |  | Read CLAUDE_CONFIG_DIR from the login shell's environment |

#### `workroom resume-hook remove`

Remove the hook Workroom installed, keeping the rest.

```text
workroom resume-hook remove
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--login-environment` |  |  | Read CLAUDE_CONFIG_DIR from the login shell's environment |

### `workroom skill`

Install or remove the Workroom skill for Claude Code and Codex (used by the desktop app). The app runs it for: Settings ▸ AI Agents, and each host's bootstrap, to install or remove the Workroom skill.

```text
workroom skill install|remove
```

#### `workroom skill install`

Install the skill in Claude Code's and Codex's skill folders, where each is set up.

```text
workroom skill install
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--login-environment` |  |  | Read CLAUDE_CONFIG_DIR and CODEX_HOME from the login shell's environment |

#### `workroom skill remove`

Remove the skill Workroom installed, keeping anything else.

```text
workroom skill remove
```

| Flag | Takes a value | Required | Usage |
| ---- | ---- | ---- | ---- |
| `--login-environment` |  |  | Read CLAUDE_CONFIG_DIR and CODEX_HOME from the login shell's environment |

## Hidden flags

*Internal: not covered by ADR 0079's compatibility promise, and may change in any release.*

Flags of public commands that `--help` doesn't list, because the app passes them.

| Command | Flag | Takes a value | Usage |
| ------- | ---- | ---- | ----- |
| `workroom create` | `--host` | yes | Record a remote workroom with this host descriptor, a JSON object (used by the desktop app) |
| `workroom create` | `--host-parent` | yes | The absolute parent folder on the host; the generated name supplies the workroom's folder (with --host) |
| `workroom create` | `--host-path` | yes | The remote workroom's path on its host (with --host) |
| `workroom create` | `--start-commit` | yes | Start from this commit, the start_commit a refused create reported, without fetching (used by the desktop app) |
| `workroom trust` | `--stdin` | yes | Judge this script's contents, read from stdin, in place of the project's file (used by the desktop app) |
| `workroom trust` | `--base` | yes | Judge the setup script at this branch, on origin unless it names a remote ("" is origin's default), in place of the project's base (used by the desktop app) |
| `workroom trust` | `--devcontainer` |  | Judge the devcontainer.json a container create from --base would use too (used by the desktop app) |
| `workroom trust status` | `--stdin` | yes | Judge this script's contents, read from stdin, in place of the project's file (used by the desktop app) |
| `workroom trust status` | `--base` | yes | Judge the setup script at this branch, on origin unless it names a remote ("" is origin's default), in place of the project's base (used by the desktop app) |
| `workroom trust status` | `--devcontainer` |  | Judge the devcontainer.json a container create from --base would use too (used by the desktop app) |
