Agent integration¶
Roost drives the tab dot, the sidebar rollup, the Agents panel and the desktop banner for the coding agents you run in its tabs. It connects them without editing their settings files:
- Claude Code and OpenCode get Roost's hooks from the tab's
environment. Every Roost tab names a plugin folder Roost owns in
CLAUDE_CODE_PLUGIN_DIRSand an OpenCode plugin inOPENCODE_CONFIG_CONTENT, added to any value you set yourself. Nothing is written under~/.claudeor~/.config/opencode. - Codex and Grok report their own status to the terminal over OSC
7501. Roost installs nothing for them. So do
Antigravity (
agy), crush and pi. - Cursor is retired: updating
cursor-agentinstalls Grok Build, which reports over OSC 7501 as Grok (Cursor is Grok Build now).
All of these are on by default, with no question asked, and each has an off switch (The Agent Integration card), though a switched-off Codex or Grok still reports over OSC 7501.
Upgrading from a release that wrote hook entries into the agents' files removes those entries once, automatically, keeping a backup, and only the ones Roost can prove it wrote (Upgrading: the retire).
A sixth agent, craze, reports its own state over the socket, which any
agent can do (Reporting directly, without a hook).
Remote hosts follow the same rules on their own roost-session; see
Remote hosts.
Supported agents¶
Every agent reports through the same four-axis model — ownership,
lifecycle, attention, and free-form metadata — over one wire op
(tab.agent_report, ipc.md).
What differs is where each signal comes from:
| Agent | source |
How Roost connects it | Blocked signal | Turn-end signal | Interrupt signal |
|---|---|---|---|---|---|
| Claude Code | claude |
the roost plugin folder named in CLAUDE_CODE_PLUGIN_DIRS; nothing written to ~/.claude (needs Claude Code 2.1.280 or newer) |
PermissionRequest (immediate); the Notification types agent_needs_input and elicitation_dialog also set it, unconditionally |
Stop |
none — the post-turn idle_prompt notification is the only later signal, guarded so it can't overwrite a real waiting/failed |
| Codex | codex |
OSC 7501, built in; nothing installed. Older releases wrote ~/.codex/hooks.json + [hooks.state] in config.toml |
PermissionRequest |
Stop |
Interrupt |
| Grok | grok |
OSC 7501, built in; nothing installed. Older releases wrote $GROK_HOME/hooks/roost.json |
Notification notificationType: permission_prompt |
Stop on its first fire; a fire with stopHookActive: true (a blocking Stop gate already continued the turn) keeps working instead, and the idle_prompt Notification settles it |
StopCancelled |
| legacy cursor-agent | cursor |
retired; only an explicit roostctl agent install cursor writes ~/.cursor/hooks.json |
none — an accepted gap, see Per-agent caveats | stop |
stop (same event as turn-end; see caveats) |
| OpenCode | opencode |
a plugin named in OPENCODE_CONFIG_CONTENT; nothing written to ~/.config/opencode |
permission.asked / question.asked |
session.idle |
session.error |
| craze | craze |
none — craze reports directly, no hook install | a permission, question or plan card is open | turn end → finished, banner body "Turn complete" |
Esc → finished with attention cleared |
The Codex and Grok columns describe the hook events an older release's
file entries delivered; today both report over OSC 7501 instead. A
StopFailure from such an entry maps to failed, its banner body
carrying the agent's errorDetails (or error_details) verbatim.
Claude and the legacy cursor-agent also load hooks from
~/.claude/settings.json themselves (grok can be configured to, and the
legacy cursor-agent always does via its claudeUserHooks), so both
adapters positively reject any payload that carries the other's telltale
fields rather than relying on which file it came from — see Per-agent
caveats.
craze is the first entry that needs
no hook install at all: it is the process driving the agent over ACP
(cursor-agent or grok), so it calls tab.agent_report directly on
every state change rather than being invoked as a hook. Behavior worth a
sentence beside its row:
- Ownership is keyed by the ACP session id. The first report of a
session claims the tab with
inactiveand metadatamodel,craze.providerandversion; exit releases it. - An errored turn reports
failedwith the error's first line as the banner body. - craze removes
ROOST_AGENT_HOOKfrom the environment of the agent it spawns, so that agent's own installed Roost hooks stay inert inside craze and cannot claim the tab out from under it — which is also why a craze tab shows one agent rather than two. - Nothing is reported until craze's session is ready, so a restored session never raises a spurious "Turn complete".
See Reporting directly, without a hook
below for the rules craze itself follows, and for the wire shape any
other agent driving tab.agent_report by hand needs.
Reporting directly, without a hook¶
A TUI or script that is the process driving the coding agent — craze
is the first, over ACP — has no separate hook to install: it calls
tab.agent_report itself, on
every state change, the same op every installed hook ends up calling
too. The rules below are what any such caller has to get right, stated
once here rather than per integration. roostctl tab report
(cli.md) is the same op as a verb,
for a script or an agent with no adapter of its own that would rather
shell out than hand-build the JSON.
- Gate on
ROOST_SOCKETplus a positiveROOST_TAB_ID, exactly as every installed hook does. Both are set only inside a Roost tab; a process started outside one — or with its environment stripped by a sanitizing launcher — has nothing to report to and no tab to claim. ReadingROOST_TAB_IDwith the variable gone (but the value cached from a parent process) risks claiming, or reporting on, some other Roost's tab entirely. - Claim per session, preserve for state, release on every exit —
including
SIGHUP.ownership_actionis required on every report because "take the tab" and "I already own it" have opposite failure modes:claimwhen a session starts,preservefor every state update in between,releasewhen it ends. Roost hangs up the tab's tty when the tab closes, so a reporter that forked its agent into its own process group has to catchSIGHUPitself and release from the handler — the tty going away is not something the child necessarily sees on its own stdin/stdout (craze#22 tracks this for craze). - Never add a field the wire doesn't already name.
TabAgentReportParamsisdeny_unknown_fields: a report carrying one field the server doesn't recognize is rejected whole — not the field, the report — which reads to the caller as nothing happening at all. Anything that doesn't fit the existing axes belongs inmetadatainstead. metadatakeys are namespaced. A key a product defines itself is prefixed<product>.(craze.provider); a key Roost itself defines stays bare snake_case (model,version). See Metadata keys below.- Pin to the oldest server you support, and validate against the
schema.
identify.opssays which ops a server serves, not which fields of an op's params it accepts — a server can listtab.agent_reportand still reject a report carrying a field it predates, the samedeny_unknown_fieldswhole-report rejection as above. There is no field-level capability channel to detect this at runtime, so the answer is to know, ahead of time, the oldest server version the integration supports and stay inside what that version's schema accepts.roostctl schema(cli.md) prints the pinned JSON Schema bundle with no socket and no running Roost, so this is checkable offline, against the exact server version being targeted. lifecycle_ifguards a reported lifecycle on the tab's current one — seetab.agent_reportfor the full semantics. It is absent from a server built before the release that follows v0.0.19: sending it to one of those rejects the whole report,deny_unknown_fieldsagain, so an integration that needs to support that generation has to guard the transition on its own side instead, the way craze does today.
craze as a worked example. craze keys ownership on the ACP session
id, claims with inactive on session start and metadata model,
craze.provider and version, reports working/waiting/finished/failed
as the turn proceeds, and releases on exit — see craze#25
for its own tracking issue and test plan for this integration. One
minimal wire example, a claim, a mid-turn preserve, and a release, each
validating against the pinned schema:
{"tab_id": "7", "source": "craze", "session_id": "acp-9f2",
"ownership_action": "claim", "lifecycle": "working",
"metadata": {"craze.provider": "cursor-agent", "model": "claude-opus-4"}}
{"tab_id": "7", "source": "craze", "session_id": "acp-9f2",
"ownership_action": "preserve", "lifecycle": "waiting",
"attention": "set", "title": "Needs input",
"body": "approve the shell command?"}
Program status (OSC 7501)¶
Some agents also say what they are doing in the terminal itself, with
the OSC 7501 program-status sequence: a state (working, blocked,
done, error, idle), what a blocked agent needs (permission,
question, auth), and a one-line message. Roost reads it from the
terminal that owns the tab — its own in-process terminal, or a host
session's — and answers the OSC 7501 ; ? probe agents send to ask
whether it is listened to. Nothing is installed and nothing is asked:
an agent that speaks it is heard the moment it starts.
| Agent | Speaks 7501 | app it names |
|---|---|---|
| Claude Code | yes | claude-code |
| Codex | yes | codex |
Grok CLI (1.0.70 or later), and Grok Build 2.x, which a cursor-agent updated to it also runs |
yes | grok (1.0.77 or later), grok-build before |
| crush | yes | crush |
| pi | yes | pi |
Antigravity CLI (agy, checked with 1.5.24) |
yes | antigravity |
the legacy Cursor CLI (cursor-agent), OpenCode (1.19) |
no — hooks only |
What it gives you, beside the hooks:
- The why. The tab's message shows in the Agents panel and the
agents palette:
Waiting · approve Bash: npm test,Working · reading src/,Failed · <reason>. - Agents without hooks get a row. A tab whose only signal is a program-status record — crush, pi, Antigravity, or a Claude Code you declined hook wiring for — is listed in the Agents panel under the agent's name (Crush, Pi, Antigravity, Claude Code) and the tab's title.
- Interrupts and exits land. Hooks have no interrupt event; an
agent that reports
idleon Esc, orclearon exit, settles the tab at once.
The rules you see:
- The program decides while it is mid-turn. While a record says
workingorblocked, or the agent's last word wasidle,doneorerrorand the shell hasn't shown a prompt since, the tab shows the record — and the hooks for that tab keep who owns it but stop moving its state. A hook from a different agent trying to claim the tab then is refused (foreign_appinroostctl doctor), and so is a new Claude session starting during the owner'sworkingorblockedrecord in the foreground, such as aclaude -pit runs (nested_claim). - A shell prompt hands it back. An OSC 133 prompt mark (
A,BorD; Roost's shell integration sends them) ends aworkingorblockedrecord, the way a crashed agent's state should end. A finisheddoneorerrorstays on the tab after the prompt until you start the next command. Claude Code sends prompt marks of its own only in Screen Reader Mode, and they count the same way. The record layer and the hook layer read the same marks, in the same order, so which forms count is one rule for both. - So does the agent's process. While its records decide the tab,
Roost notes the agent's process, as it does for a hook claim. Once
that process is gone and the shell has the terminal back, its records
end as a prompt would end them — within about a second in a shell
that prints no prompt marks. A
Ctrl-Zsets them aside instead: the row reads Suspended, and afterfgorbgthey are back. See when a tab stays running. - One banner per change. A record moving the tab into Waiting, Failed or Finished raises one desktop banner, titled with the record's title (else the agent's name) and carrying its message (else "Needs your input", "Failed" or "Finished"). The hook that reports the same moment raises nothing more, a program's own OSC 9 alongside it is dropped, and a tab you are looking at stays quiet as always. A Finished banner in an agent's first second is skipped — Codex flashes through states at startup.
roostctl tab list --json carries the summary as program_status on
each tab (ipc.md).
The Agent Integration card¶
Which agents Roost connects is one config.conf key,
agent-integration. Absent
means the defaults: every agent on. So a fresh install connects Claude
Code, OpenCode, Codex and Grok without asking, because none of them
needs a file changed. There is no card at startup.
Agent Integration… in the command palette (and, on Mac, the View
menu; the keybind action is agent_hooks, unbound by default) opens a
card with a switch for every agent and a status line for each:
Connected · nothing written: Claude Code or OpenCode, through the tab environment.Built in: Codex or Grok, which report over OSC 7501.Off: switched off.Skipped: blocked by your organization's Claude policy: see Claude's plugin policy.- Any of these followed by what the retire left behind, or an old entry that came back.
"Apply" writes agent-integration. Switching Claude Code or OpenCode off
reaches the next tab you open; tabs already running keep their
environment. No switch writes an agent's file.
The switches for Codex and Grok are recorded but have no effect yet: both report over OSC 7501 on their own, and Roost does not yet ignore an agent you switched off.
Toasts¶
Each is shown once, never as a dialog:
- After an upgrade that removed old entries: which agents now connect without their settings files, where the backup is, and how many entries Roost left in place.
- After an upgrade from
agent-hooks = off: Claude Code and OpenCode can now connect without editing their settings files, and they stay off. - While Claude's plugin policy blocks Roost's plugin: that Claude Code isn't connected. It is said again only if the policy lifts and returns.
roostctl agent status and roostctl doctor's Agents section say the
same things durably.
Claude's plugin policy¶
An organization can set disableSideloadFlags in Claude Code's managed
settings. Claude then refuses to start with CLAUDE_CODE_PLUGIN_DIRS
set. Roost checks before it hands Claude the variable: a managed-settings
file under /etc/claude-code (/Library/Application Support/ClaudeCode
on macOS), Claude's cached server settings, and claude plugin list
--json run once in the background with the variable set. That last
check waits until Claude has run on the machine (~/.claude, or
$CLAUDE_CONFIG_DIR, exists), because Claude's first run writes its
config and Roost would otherwise create it for someone who only
installed Claude. Roost reads $CLAUDE_CONFIG_DIR from its own
environment, so one set only in your shell's startup file isn't seen
by a Roost started from the desktop. With no ~/.claude either, that
check keeps waiting, and a policy that reaches you only through Claude's
server settings goes unseen; roost.log says once that it is waiting.
If the policy
is there, Roost leaves Claude's variable out, so Claude starts normally,
and its status still shows over OSC 7501. Doctor names the policy and
where it was found; switch Claude Code off under Agent Integration… to
silence the line. Roost never works around the policy, for example with
--settings.
Upgrading: the retire¶
Releases before this one wrote hook entries into each agent's own
settings: ~/.claude/settings.json, ~/.codex/hooks.json and
config.toml, $GROK_HOME/hooks/roost.json, and
~/.config/opencode/plugins/roost-agent-state.js. With the agents
connected another way, those entries would report every event twice.
So the first launch of this release retires them, once per machine.
Cursor's entries in ~/.cursor/hooks.json are retired too, whatever
its switch said (Cursor is Grok Build now).
Only what Roost can prove it wrote is removed:
- a handler whose command is exactly one an earlier release wrote, with exactly the keys and values that release wrote, in a group with nothing else in it;
- Grok's
roost.jsonwhen it holds only Roost's entries; - the OpenCode plugin file when it is byte for byte the one an earlier release wrote;
- a Codex trust key with Roost's own hash, and
[features] hooksput back as it was, but only when no other hooks remain.
Anything else is left in place and reported: an entry you edited
(edited), one in a group with a matcher or another key (annotated),
a second copy (duplicate), a Codex entry something follows (shifted),
a file Roost's printer would reformat (would_reformat), a file that
doesn't parse (unreadable, retried at each launch), a roost.json
with someone else's entries in it (foreign), or a file that kept
changing under the retire (changed_underneath). A leftover still runs,
so that agent's events arrive twice until you remove it by hand;
roostctl agent status and doctor name the file and event.
Backups. Every file the retire changes or deletes is copied first to
~/.config/roost/agent-backups/v4/<agent>/, with an index.json naming
each original. The first backup of each file is always kept, plus the
newest ones, three in all. To roll a file back, copy its backup over it;
there is no restore command, because a restore would overwrite whatever
you or the agent changed since.
Once, never chased. The retire runs once per agent at this version.
If an old entry comes back afterwards (a synced dotfile, an older Roost
on another machine), agent status and the card report it as
came_back and it is not removed again; roostctl agent uninstall
<agent> takes it out.
The keys. An earlier answer carries over: agent-hooks = off
becomes agent-integration = off, and a list becomes the same choice in
agent-integration. agent-hooks is then set to off. An older Roost
on the same machine reads only that key, so it does not put Claude's
entries back.
A local roost-session. When your local tabs run on a
roost-session, the UI leaves the retire to that session's own start,
because an older session's tabs still need the file entries. Restart the
session (the UI offers this after an upgrade) and it retires them.
Cursor is Grok Build now¶
Updating cursor-agent (cursor-agent update) installs Grok Build 2.x:
cursor-agent, agent and grok become one program, which reports
over OSC 7501 as Grok. It runs the entries in ~/.cursor/hooks.json
only behind a feature flag that is off by default, and while any hooks
file is there it asks you to trust every folder you start it in. So
Roost no longer connects Cursor: there is no switch for it, and the
retire removes the entries an earlier release wrote, with a backup.
If you still run the legacy Cursor CLI (cursor-agent update --channel
cursor), roostctl agent install cursor writes its entries again, and
roostctl agent uninstall cursor takes them out. agent status and
doctor then report them as having come back after the retire.
How to turn an agent off¶
agent-integration = -opencode # every default but OpenCode
agent-integration = off, claude # only Claude Code switched on
agent-integration = off # nothing
The value records departures from the defaults, so an agent a later
release adds takes its own default rather than being switched off by a
list written before it existed. -name turns an agent off, a bare name
turns it on, and off turns everything off (off, claude switches on only
Claude Code). A cursor left in the value changes nothing. See
config.md.
The card's Apply and roostctl agent set write a full list, which reads
the same way. agent-hooks, the older key, is only read once, to carry
an answer over; see config.md.
A switch changes what the next tab gets. Tabs already running keep the environment they started with, and a Claude or OpenCode already running keeps the plugin it loaded.
Commands¶
roostctl agent status [--json] # per agent: delivery, switch, policy, leftovers
roostctl agent set claude,codex # via the running UI: write the switches here
roostctl agent set off --local # write the switches here directly, with nothing running
roostctl agent ensure [--json] # run the retire if it is due
roostctl agent install <agent>|--all # explicit: write an agent's file entries anyway
roostctl agent uninstall <agent>|--all # remove any entry whose command is Roost's
agent status --json reports, per agent, on, delivery (env,
7501, retired for Cursor, or none when switched off or blocked by
Claude's policy), policy for Claude, retired (version, time,
backups, leftovers with their reasons) and came_back. Every verb but
bare set works with nothing running. See
cli.md.
agent install still writes an agent's file entries when you ask for
it by name: for the legacy Cursor CLI, or to test the file path. An
entry reports only from inside a Roost tab, which exports
$ROOST_AGENT_HOOK, ROOST_SOCKET and ROOST_TAB_ID; there, for an
agent switched on, it doubles what Roost already hears. --all means
the agents Roost connects, not Cursor. agent uninstall removes any handler whose command is Roost's,
the looser rule an explicit request may use; it leaves the switches
alone. --all includes Cursor.
roostctl claude install remains a bare alias of agent install claude.
Every write goes through one advisory lock per config file, so the UI,
roostctl and a host session never race; a plan re-checks the file
immediately before writing and skips it (changed-underneath) rather
than overwriting a file that moved in between.
Ownership¶
A tab is "owned" by whichever agent's hook last reported activity on
it, via tab.agent_report's (source, session_id) pair.
An agent that another agent runs, such as a codex exec review
started from a Claude Code turn, inherits the tab's ROOST_TAB_ID
and fires its own hooks into the same tab. Roost ignores it while the
outer agent is mid-turn in the foreground, so the outer agent keeps
the tab, its status and its notifications. Once that agent exits back
to the shell prompt, the next agent you start takes the tab as usual.
This needs shell integration that marks each
command's start: zsh, or bash 4.4 or newer. macOS's own /bin/bash
3.2 can't
(details),
and without the mark the inner agent takes the tab over, as it did
before. (Claim rules.)
The same holds for a claude -p that Claude Code runs from a tool call.
A Claude session that starts while Claude owns the tab mid-turn is
ignored. A running Claude that moves to another session still takes the
tab: /clear, /resume and a compaction do, and so does a claude -p
--resume, because Claude reports it the same way. For a Claude that
reports over OSC 7501, mid-turn is its own
working or blocked report, and the same shell integration is
needed: without it no prompt mark would end a killed Claude's report.
Agent status isn't supported inside tmux, herdr or an ssh session
running in a tab. Every pane there shares the tab's ROOST_TAB_ID, so
the tab can show only one of their agents, and not reliably the one
you're looking at.
When a tab's row disappears from the sidebar's Agents panel while the
agent is still running, roostctl doctor shows the reports the tab
dropped (tab.dropped_reports). An agent whose reports are dropped on a tab
nobody owns has lost the tab, and its next session start (in Claude
Code, /compact or /clear) takes it back.
Doctor's
owning checks read this off the running UI's tab list — there is no
durable "ever observed" store, so they can only say who owns a tab
right now, not whether an agent has ever fired here.
Separately — and this is the sense of "ownership" the install engine itself cares about — an entry in an agent's config file is Roost's if, and only if, its command string is byte-for-byte one Roost has ever produced, at any past integration version. That is deliberately not a substring test:
- A hook you wrote yourself that happens to mention
$ROOST_AGENT_HOOKis yours. It is never touched, and it survives everyensureand everyuninstall. - A Roost entry you've since hand-edited (a different timeout, an added
matcher) stops being recognized as Roost's the moment it no longer matches exactly. It is left exactly where it is — never rewritten, never removed — and doctor names it as a modified entry rather than pretending it's current.
Only a file Roost itself created is ever deleted on uninstall, and only
the state record can say which those are; a {} or an empty file that
predates Roost is written back empty rather than removed.
When a tab stays running¶
An agent that is hard-killed — kill -9, a crash, a closed laptop lid
over SSH — fires no Stop/SessionEnd hook, so its last lifecycle
(working, waiting) stands with nothing from the agent to tell Roost
otherwise.
What clears it. Ownership is deliberately not TTL'd — Claude fires no periodic hook, so a long tool call would look stale and get released mid-turn — so what clears a stuck tab is evidence from the tab itself: the shell's OSC 133 prompt marks (which forms count) and the agent's own process.
- The agent's process. When an agent claims a tab, or its OSC 7501
records start deciding it, the server that holds the tab notes the
process in front of the tab's terminal, and
roostctl tab list --jsonshows it as the tab'sprocess. Once that process is gone and the shell has the terminal back, the agent is released and its live records end: its row leaves the Agents panel, the tab leavesrunning, and raw notifications work again. Roost looks when the shell prints its prompt mark, right after a command ends, and once a second while it has a process noted — so a shell that prints no marks clears within about a second too. - The shell back in front. When no process was noted because the agent claimed from the background, a prompt mark with the shell itself in front of the terminal releases the agent.
- Behind
tmux,screen,zellij,sshormosh. Roost never notes the process of the client in front, and the agent outlives it: detaching tmux puts the shell back in front while the agent runs on. A prompt mark keeps such an agent's ownership as a label, as it always did, so what it reports after you reattach still counts. If it dies behind the multiplexer, its row stays until another agent claims the tab or you clear it by hand. - Anything else. A prompt mark with some other program in front
drops the lifecycle to
inactiveand keeps ownership as a label, so the tab falls through to shell-derived state instead of staying stuck. Ctrl-Z. A stopped agent is still alive. It keeps the tab, itsprocessreadssuspended, its Agents row reads Suspended (until another agent you run in front of it reports or works), and the tab shows what a prompt shows, so it mutes nothing while you work at the prompt. Afterfg(orbg), what it was doing comes back, OSC 7501 record included. A 7501 agent with no hooks keeps its row through the suspend, named by itsprocess. One that clears its own status as it stops — Codex does — leaves nothing to set aside, so its row comes from its process's name instead (agents known by name) and reads Suspended all the same.
A process Roost can't read (another user's, say) counts as alive, and a
pipeline whose first command exited keeps the agent while the pipeline
still has the terminal. The rules are spelled out under
tab.agent_report
and, for OSC 7501 records, under
Tab.program_status.
A command tab (roostctl tab open -- claude) needs none of this: when
its program exits, the tab closes and its state goes with it.
Which shells emit those marks. Roost's bundled integration
(crates/roost-engine/resources/shell-integration/) wires them for zsh
and bash: zsh's
preexec/precmd hooks fire the C and D marks unconditionally;
bash's PROMPT_COMMAND fires D on every version, but the C
(command-start) mark needs bash ≥ 4.4 — PS0 is silently ignored on
older bash, including macOS's stock /bin/bash 3.2. Every D carries
the command's exit status (D;<status>), on every bash and zsh
version. A shell with no
prompt marks at all — dash, plain sh, or bash/zsh with the
integration disabled — relies on the agent's process: a noted process
that is gone clears the tab within about a second. An agent Roost
noted no process for (one behind tmux or ssh) can stay stuck there;
the manual clear below is the way out.
When an agent dies mid-turn. If Roost ends an agent this way while
it was working or waiting on you, and the shell's D says it failed,
Roost raises one notification under the agent's name:
exited (3)— it exited with that status (1 to 128);killed (SIGKILL)— it died of a signal (a status above 128 is 128 plus the signal, named as the machine running the tab numbers it; one with no name readskilled (signal N)).
The status is the one the shell's D reports as it takes the terminal
back from the agent, so a later command's status is never taken for
the agent's. Like any notification, the banner is dropped while you are
looking at the tab. Nothing is raised when the agent exited 0, was idle
at its own prompt, ended with its own SessionEnd, or died in the
background (bg) where no D reports it. A Ctrl-Z raises nothing
either: the D it causes reports 128 + SIGTSTP (148 on Linux, 146 on
macOS), a stop rather than an exit, and an agent killed while stopped
(kill -9 %1) has no D of its own. A shell that sends no status —
sh, dash, the integration off, or a D with no code — gives no
banner: Roost can't tell a crash from a normal exit there.
Manual clear. From any shell:
This claims ownership as manual and releases it in the same step,
falling the tab through to shell-derived state (see
cli.md).
fish. Tested with fish 4.9.3: fish marks its own prompts and
commands (OSC 133) with no Roost integration installed, so a fish tab's
shell state reads at_prompt from the first prompt, and a tab left
running by an agent that was killed clears as soon as fish draws its
next prompt — the same as Roost's own bash integration. Older fish
releases were not tested.
Roost reads a tab's processes when something happens there — the agent reports, the shell prints a mark, the tab is focused, or a session tab gains or loses a viewer — and once a second for each tab with a process noted (#519), never for any other. The once-a-second read only gathers evidence: nothing ends because time passed, only because the process is gone.
Which marks count¶
A session tab and an in-process tab take their OSC 133 marks from libghostty, the same stream the program-status records read, so a mark moves the hook layer and the records at the same byte. libghostty's reading is the spec's:
| The mark | What it does |
|---|---|
A, P, N — a prompt starting (with k=i or no k); B, I — input starting; D, D;<exit code> — a command ending |
the shell is at a prompt: an agent's lifecycle drops to inactive and its working/blocked records end; ownership stays as a label unless the agent is gone, and what a stopped or backgrounded agent had is set aside until it runs again. The exit code of the D that takes the terminal back from an agent decides whether its end raises a banner |
C, C;<options> — a command starting |
the shell has a foreground process; the agent's lifecycle stays |
A;k=s, A;k=r, A;k=c, and P/N with those — a secondary, right or continuation prompt |
nothing |
a letter not followed by ; or the end (Axyz, D0), L, an empty or unknown body |
nothing |
a mark over 2048 bytes after 133; (a long C;cmdline_url=…) |
nothing: libghostty drops an OSC sequence that overflows its buffer, a known limit |
A host tab's client shows what the session made of the marks; it reads none itself.
Agents known by name¶
An agent that neither claims its tab with a hook nor reports over OSC 7501 still gets an Agents row: the legacy cursor-agent, or Codex before it reports anything, on its sign-in screen. Roost names it from its process, once it looks at the tab — when you switch to the tab or away from it, when a session tab gains or loses a viewer, or when the shell marks a command starting. So start an agent at a zsh or bash (4.4 or later) prompt with Roost's integration, and its row appears within about a second; anywhere else, it appears once you switch to another tab. The shell marks the command before it starts it, so the first look can be too early (on macOS it nearly always is); when it finds no agent, Roost looks once more a second later, unless the command has already ended.
| The process in front | The row |
|---|---|
claude, codex, opencode, cursor-agent, grok, crush, pi, agy (Antigravity) |
that agent |
node, bun, deno or python running a script named like one of those (codex.js), or kept in a claude-code, codex, opencode, opencode-ai or cursor-agent directory |
that agent |
The row reads Running, or Suspended after Ctrl-Z, and never
guesses more: no Working or Waiting, no banner, nothing muted, no owner,
and the tab's own state is whatever its shell says. It goes once the
process is gone and the shell has the terminal back, by the same rule as
any noted process. Once the agent claims
the tab or reports over OSC 7501, those decide the row again.
Codex clears its own OSC 7501 status as it stops, so a Ctrl-Z would
leave nothing to show; its process's name keeps its row, reading
Suspended, and fg brings it back. A Codex that clears its status
as it exits shows no row in between.
The name only labels the row: nothing ends because of it. A launcher
that runs the agent as its child rather than becoming it (npx) is not
named, nor is an agent inside tmux, screen, zellij, ssh or
mosh. Beyond that second look after a command starts, Roost never
reads a tab's processes on a timer to find one, so an agent started
with no prompt mark, in a tab you never look at again, shows no row.
Codex trust¶
This applies only while a Roost hook is in Codex's config: one you wrote
with roostctl agent install codex, or an older release's entry the
retire left in place. Codex itself reports over OSC 7501 and needs none.
Codex additionally records a trusted_hash per hook handler under
[hooks.state] in config.toml — the mechanism that stops it asking
"Hooks need review — trust all?" on the next launch. Writing that hash
is Roost approving its own hook command on your behalf, ahead of the
review codex's own dialog exists to gate; see Security
below for that trade-off stated plainly.
The trust keys are index-based and built from the absolute
hooks.json path, so two things move them even though nothing about
Roost's own hooks changed:
- Reordering — a hook group you (or another tool) insert ahead of Roost's shifts Roost's index, so the stale key no longer matches and codex shows one review dialog on the next launch.
- A moved
CODEX_HOME— the path is part of what's hashed, so relocating it (or a dotfile sync that changes it per machine, withoutallow_symlinked_codex_home = true) has the same effect.
Both cost exactly one dialog; roostctl agent install codex recomputes
and rewrites the stale keys, and roostctl agent uninstall codex takes
the hook out instead. Doctor's agent.codex.trust check compares the
hash codex would compute for the handler Roost installed against what's
on disk right now, so a
hand edit, a moved home, or a codex-side change to the hash formula
itself is diagnosed by name instead of reappearing as an unexplained
dialog with no cause attached.
Legacy Claude settings¶
Before this feature existed, roostctl claude install wrote a
Roost-owned file at ~/.config/roost/claude-settings.json and asked you
to alias claude to pass --settings at it. That file is retired:
claude install is now a bare alias of roostctl agent install claude,
which merges hook entries directly into Claude's own
~/.claude/settings.json instead.
If both the old file and the alias are still active, every Claude hook event is delivered twice — harmless to Roost's state, but wasteful, and the old file's absolute path is wrong on any other machine. Remove it:
- Delete
~/.config/roost/claude-settings.json(or runroostctl agent uninstall claude, which removes it when it still matches the shapeclaude installused to write, and leaves it alone — with a warning — if you've since hand-edited it). - Remove the
alias claude=…line it asked you to add from your shell rc (.bashrc,.zshrc,.bash_profile, or fish'sconfig.fish/alias --saveoutput).
roostctl doctor's agent.claude.legacy_settings check watches for
both independently and says which one (or both) it found.
The guarantee¶
Stated as plainly as the mechanism allows, because "Roost edits your agent's config file automatically" is the most consequential thing this feature does:
Off and uninstall remove only what Roost wrote. Whether that removal can restore the file byte-for-byte depends on the format:
- TOML (codex's
config.toml) is edited withtoml_edit, so it is byte-preserving outside the tables Roost touches — comments and layout elsewhere in the file survive untouched. - JSON (every other agent's file) cannot be: parsing and re-serializing loses the original bytes, full stop. The guarantee there is semantic, not byte-exact: every value Roost did not add is equal after the write, key order is preserved, numbers keep the token the file originally spelled them with, and the file's indent unit, line-ending, and trailing-newline conventions are detected and reused. A file is written only when the parsed value would actually change — an already-current file isn't touched at all.
What that does not cover: escape spellings (c comes back as
c, a\/b as a/b) and any layout the printer doesn't reproduce — a
compact file, an inline array, a blank line between keys — are
normalized the first time Roost has to write. A file already in the
printer's own layout round-trips byte for byte; one that wasn't comes
back semantically equal, reformatted, and an uninstall can't undo that
reformatting.
Two more properties worth knowing: bytes that aren't valid UTF-8 are a skip, never a lossy substitution — a lossy decode would risk silently destroying something like an API token on the next write — and every write is atomic (temp file + rename, in the same directory, through a symlink to its real target rather than over it), so a crash mid-write never leaves a torn config file.
Inert outside Roost¶
The installed command is unconditional — it's the same string whether or not Roost is running:
sh -c 'if [ -n "${ROOST_AGENT_HOOK:-}" ] && out=$("${ROOST_AGENT_HOOK:-}" agent-hook <agent> 2>/dev/null); then [ -n "${out:-}" ] || out="{}"; printf "%s" "${out:-}"; else cat >/dev/null; printf "{}"; fi'
Every variable carries a :- default deliberately, the local out
included. grok doesn't hand the command to a shell unexamined — it
checks every $ reference against its environment first and refuses
to run the hook at all when one is unset, drawing a red hook not
executed: required env var(s) not set row on every tool call in any
terminal that isn't Roost. The ${NAME:-} form passes that check and
reaches the shell unchanged, so grok runs the command and the fallback
below answers quietly. It's identical POSIX shell for sh, dash and
bash, so no other agent notices. Not every agent shells out, so this
guarantee is only as good as the last time each agent was actually run
in a plain terminal — which is why that run is part of the release
checklist, per agent.
Outside a Roost tab, ROOST_AGENT_HOOK is unset: the command drains
stdin, prints {}, and exits 0 — inert, and safe for the agent (a
decision hook like Claude's PermissionRequest needs exactly this
shape to avoid blocking the dialog), but not free. Every hook event,
on every machine the entry is installed on, spawns a sh and a cat
regardless of whether Roost is running there at all. That's the price
of a host-independent, dotfile-syncable entry with no absolute path
baked in — worth naming plainly rather than leaving as a surprise the
first time someone notices the extra process per tool call.
Remote hosts¶
A host's roost-session connects agents the same way for the tabs it
serves: it puts the plugin variables into each tab's environment from
its own agent-integration, so Claude Code and OpenCode on a host
need nothing written there either, and Codex and Grok report over OSC
7501 through the ssh session. A v4 roost-session also runs the retire
at its own start, so a host comes clean of an older release's entries
even before an upgraded client connects; the backups are on the host.
A connecting client sends nothing about agents: each machine keeps its
own switches, and nothing on a host needs a file written. An older
client still sends session.set_agent_hooks after it connects; a
current session answers it without writing anything
(ipc.md). To change a
host's switches, run roostctl agent set <list|off> --local there,
over SSH say.
Security¶
Three things worth stating as a stance rather than leaving implicit:
- The
$ROOST_AGENT_HOOKindirection is not a security boundary. A process running inside a Roost tab could read that variable and invoke the binary it names directly — but it could just as easily run that same binary without reading the variable at all, since it's already running with the same privileges the hook process would have. The indirection exists so the installed command is host-independent and dotfile-syncable, not to fence anything off. - Writing codex's
trusted_hashbypasses a human gate on purpose. Codex's review dialog exists so a person confirms a hook change before it runs with their authority; pre-computing the hash Roost's own entry would produce and writing it in ahead of time is Roost approving its own command for you. That's a deliberate trade-off in favor of "every agent works with zero manual steps," not an oversight — and it only ever covers the exact command Roost installed; anything else still gets codex's normal review.agent.codex.trustis the check that keeps this honest by flagging drift instead of silently re-trusting on every run. - A bare
opencodein a Roost tab exposes that session's server on loopback. Roost's opencode plugin fronts the TUI's in-process server with a127.0.0.1listener so a client can actually drive the session Roost reports (see OpenCode keys) — and that server is the whole surface: the global session store, tool execution, permission replies. Any process on the same host can reach it, unauthenticated unlessOPENCODE_SERVER_PASSWORDis set to a non-empty value — an empty one means "no auth" to opencode itself, and so to this front end. Roost's own sockets are unchanged and nothing binds off loopback — but this is a real widening of what a tab exposes, which is whyROOST_OPENCODE_NO_SERVER=1turns it off.
The first two points introduce no capability a same-UID client didn't
already have: on a host, any client that can reach the socket can
already run arbitrary commands there via tab.open. The third does
widen the surface, on purpose, and the opt-out is the answer to it.
Metadata keys¶
metadata is the open extension channel every adapter writes into
(ipc.md), and this is the rule
for using it without collisions: a key owned by one product is
prefixed <product>. (craze.provider), while a key Roost itself
defines stays bare snake_case (model, session_title).
metadata is merge-only, with no delete channel: a key stays until a
new claim replaces the whole map. So a key that names something live,
such as an address, is a discovery hint, not proof that it is still
there.
One key decides something. A claude claim's source is Claude's own
SessionStart source, and a claim saying startup while the tab's
Claude is mid-turn is refused as nested (Ownership).
OpenCode keys¶
OpenCode's adapter writes four keys into the owning tab's metadata.
All four are bare snake_case under the convention above: they are
Roost's own, read off opencode's event bus by the plugin Roost ships,
not a product stamping its name on a shared channel.
| Key | Source |
|---|---|
model |
session.created → info.model.id |
agent |
session.created → info.agent |
version |
session.created → info.version, the opencode build |
server_url |
the loopback address the session can be driven at |
server_url¶
A bare opencode binds no socket at all — the TUI talks to its server
in-process, and opencode's server.port setting only applies to
opencode serve — so there is nothing for a client to dial. Roost's
plugin runs inside that server process and is handed a client whose
fetch is the in-process app, so it puts a loopback listener
(127.0.0.1, port 0) in front of that fetch and reports the address as
server_url. What a client reaches there is opencode's own REST and SSE
surface.
- In-process vs external. When opencode is already listening on a
socket of its own —
opencode serve,opencode web,--port, and the rest — the plugin serves nothing and reports opencode's own address instead. It tells the two apart from the client opencode hands the plugin, which carries an in-processfetchonly when there is no real listener, rather than by reading the command line. - Loopback only. Roost records
server_urlonly when it parses as a token-free loopback base URL:http://127.0.0.1:<port>,localhost, or[::1], with nothing after the port. An external server started with--hostname 0.0.0.0announces an address that fails that check and is dropped rather than stamped — that session is status-only. - The password rule. When
OPENCODE_SERVER_PASSWORDis set to a non-empty value, the loopback front end demands the same Basic credentials opencode's own server does (username fromOPENCODE_SERVER_USERNAME, defaultopencode) and answers401otherwise. Roost carries no credentials —server_urlis just the URL — so a consumer without them reads a password-protected session as status-only. - The opt-out.
ROOST_OPENCODE_NO_SERVER=1in the tab's environment: no listener, no key, status reporting unaffected. The same outcome if the runtime has noBun, or if the listener fails to start — one line on opencode's log, and nothing else changes. - What the opt-out does not cover. It suppresses the loopback
listener Roost creates. It does not suppress reporting a server
you started: the external case is checked first, so an opencode
already listening still reports its own address as
server_urleven with the opt-out set. That ordering is deliberate — Roost stands up no server there, which is the whole of the variable's promise, and the address it reports is a listener you explicitly asked for. If you want noserver_urlat all, don't start one. - The mid-session limitation, and its bound.
server_urlrides the ownership claim onsession.createdand the key-by-key upsert on every event after it — so a plugin that loads mid-session onto a tab the same opencode session already owns lands the key on the very next forwarded event, whatever kind it is. The limitation is only the unowned tab: an upsert is authorized against the current owner, so against a tab nobody owns it creates nothing, andopencode attachor an install that happened while a session was already running never sees thesession.createdthat would claim one. There the key first lands at the nextsession.created, and until then that session is status-only.
Treat it as a discovery hint, not liveness. metadata is merge-only
with no delete channel, so the key
outlives the listener that announced it — a restarted opencode in the
same tab publishes a new port on its next session.created, and until
then the old one is stale. Dial it before believing it.
Per-agent caveats¶
- The legacy cursor-agent has no blocked state (only with its entries
installed by hand, see Cursor is Grok Build now).
beforeShellExecutionfires roughly 0.1 s beforeafterShellExecutionwhen a command is auto-approved, so there is no reliable way to distinguish "waiting on your approval" from "running" — an accepted gap, not a bug to file. Every cursorstopstatus (including the two an Esc produces in a row) maps tofinished, with the raw status carried indetail, because readingstatus: erroras a failure would misreport every interrupt as one. opencode attachreports against the server's tab. OpenCode's plugin runs inside theopencodeserver process, which inherited whichever tab's$ROOST_TAB_IDstarted that server — so attaching to a server another tab already started reports activity there, not on the tab you attached from. There's no reliable fix from the plugin side (a session'sdirectorymatching your tab's cwd isn't a safe enough signal), so this is documented rather than papered over.- grok's Stop gate leaves a residual "finished" window on the first
blocked fire. This and the next two apply only to hooks from a
roost.jsonan older release wrote; grok itself reports over OSC - A blocking Stop hook that blocks the very first
Stopof a turn shows the tab asfinished(with a "Turn complete" banner) from that fire until the next tool event or the nextStop— which, once the gate has fired at least once, carriesstopHookActive: trueand correctly reads asworkingagain. In that gate case the user never sees a second "Turn complete"; instead they see grok's ownidle_promptbanner roughly a minute after the turn actually ended. If the 8-continuation cap is hit, grok forces a stop with no hook fired at all, so the tab staysworkinguntilidle_promptsettles it. A passive observer — which is all roost's adapter is — cannot close this gap without delaying every turn's "Turn complete" by that same minute, gated or not; that trade was rejected. - grok's
agent_errorNotification is deliberately silent. It fires immediately before theStopFailurethat reports the same failure, so banner-ing both would show the same error twice; only theStopFailurebanner (with grok'serrorDetailstext) reaches the tab. - grok subagents never claim the tab. A subagent (from
spawn_subagent) runs as its own session id, stampssubagentTypeon every event, and never fires its ownSessionStart— so its reports never match the tab's owning(source, session_id)pair and the server drops them on the ordinarypreservemismatch path. No adapter filter is needed. - codex re-trusts on reordering or a moved path. See Codex
trust above — either one costs a single review dialog,
cleared by
roostctl agent install codex. - codex
/renamedoesn't reach the tab label on codex 0.153 and earlier. Roost's tab label mirrors whatever the program writes into the terminal title, and codex's default title items on those versions are onlyactivityandproject— the thread name isn't in it, so a rename changes nothing. Addterminal_title = ["activity", "thread-title", "project-name"]under[tui]inconfig.tomland the rename lands in the label at once (an unnamed thread then shows its UUID until you name it). Newer codex adds athread-nameitem that's omitted when unnamed and puts it in the default set, so no config is needed there. Claude, grok and cursor already put the session name in the title. - The legacy cursor-agent (and optionally grok) also execute Claude's
hook format. The legacy cursor-agent always
loads
~/.claude/settings.json(claudeUserHooks), and grok can be configured to; with Roost's Claude entries installed, both would otherwise runagent-hook claudeon their own events and report undersource: claudewith the wrong session id. The Claude adapter defends against this by rejecting any payload carrying cursor'sconversation_id/cursor_versionfields or grok's camelCasehookEventNametwin, verified by a cross-adapter test that replays every agent's fixtures through every other agent's adapter and asserts zero claims.
Troubleshooting¶
Run roostctl doctor -v first — its Agents section covers most of
what you'd otherwise have to guess at, per agent:
agent.hook_binary— is$ROOST_AGENT_HOOKset and does it resolve to something executable, from inside a tab.agent.<name>.wired— how that agent is connected. For Claude Code and OpenCode, "connected through the tab environment"; for Codex and Grok, "reports over OSC 7501"; either one switched off, or Claude skipped by its organization's plugin policy (with where the policy was found). It also names an old Roost entry still in the agent's file — a retire leftover, or one that came back — as the cause of doubled events, and the backup the retire made. A switched-off Codex or Grok still reports over OSC 7501, and doctor says so.agent.cursor.wired— Cursor is retired:okonce its entries are gone, a warning while Roost's entries are still in~/.cursor/hooks.json, where Grok Build runs none of them and asks for folder trust because of them.agent.<name>.owning— does that source currently own a tab on this UI (not a durable "ever observed" record — just right now).agent.codex.trust— when a Roost hook is in Codex's config (see Codex trust), does the trust hash on disk match what codex would compute for it. Without one there is nothing to trust.agent.claude.legacy_settings— is the retired~/.config/roost/claude-settings.jsonfile or its shell alias still around.
-v breaks the section out per agent; the plain summary line names
whichever fact is most actionable. Every warn/fail links back to the
exact section above that explains it.
If Claude Code or OpenCode never reports, check that the tab has the
variables: CLAUDE_CODE_PLUGIN_DIRS should end with a folder under
Roost's agent-integration cache directory, and OPENCODE_CONFIG_CONTENT
should name Roost's plugin. A tab opened before you switched the agent
on does not have them; open a new one. Claude Code older than 2.1.280
ignores the variable. A startup file that sets CLAUDE_CODE_PLUGIN_DIRS
outright (export CLAUDE_CODE_PLUGIN_DIRS=… rather than appending to it)
would drop Roost's folder; the shell integration's
path feature adds it back at the first
prompt, after your own entries.
If a hook genuinely never fires, check first whether something strips
the tab's environment before the agent sees it — a wrapper using env
-i, a sudo re-exec, or a sanitizing launcher all make the installed
hook silently inert. Roost has no durable "ever observed" store, so
doctor can only say whether this UI has seen the agent fire this
session — a wired-but-quiet agent that has genuinely never run in a
Roost tab yet looks the same as one whose hook can't reach Roost at
all.