Local sessions
This page works best with your SwB address. Set your address
A local session is an open workspace for a terminal agent on a paired device. SwB lists it as a target. A target is an address that can receive a message.
Pair the device
Follow Pair a device. Use the command for your agent below. Use one --cap option for each feature. To change the features on a paired device, disconnect it first.
Ask an agent with SwB owner access to call targets(block="local"). Copy the address of your session. It has the format local:session:<companion>:<harness>:<session>. The program that runs the agent is part of the address.
Send a message
Pass the session address as to in send. SwB tries to deliver the message to the open session. For a session with a matching agent, mailbox delivery requires access to that agent's mailbox. Use the returned conversation ID with result to read the reply.
| Status | Meaning |
|---|---|
working | The agent is working |
blocked | The agent is waiting for approval or input |
idle | The agent is ready for work |
done | The agent completed its work |
unknown | The status is still to be confirmed |
For a blocked session, respond to the request in the session. SwB keeps the message in the mailbox if the sender can use that mailbox.
The companion reports session status to your SwB server. It can also report the session name and folder name. The companion can send back one answer to each message it delivers directly. The rest of the session stays on the device.
Status hooks
A hook runs a command when an agent reports a change. Status hooks work on macOS and Linux.
swb companion connect https://swb.example.com --cap hooksInstall the swb command with pipx. Make swb available on the agent's command search path. If you set SWB_COMPANION_HOME, use the same folder for the agent and the companion.
| Agent | Event command | Configuration |
|---|---|---|
| Claude Code | swb hook claude-code | Merge the hooks from channel/hooks/hooks.json into ~/.claude/settings.json |
| Antigravity CLI | swb hook antigravity <event> | Install the SwB plugin as shown below |
| Codex | swb hook codex | Merge the hooks from integrations/codex/hooks.json into ~/.codex/hooks.json |
Use the files from the SwB release checkout. The SwB Claude Code plugin also includes these hooks. For a custom Codex settings folder, use the hooks.json in that folder.
swb hook antigravity --install-pluginOpen a new session after you set up the hook. Check for its address in targets(block="local"). With the hooks capability by itself, sessions receive messages through their mailboxes.
Herdr
Open a terminal agent in a Herdr pane, an area in the terminal. The companion gets session events through Herdr's socket. A socket is a connection that programs use on the same device.
For a named session or a custom socket path, see the Herdr companion settings.
swb companion connect https://swb.example.com --cap herdr --cap hooksFor replies from the pane, set up the applicable status hook. Check for a local:session:<companion>:herdr:<session> target. Send a short test message to the target. Check that it appears in the pane. If you set up a status hook, check the reply with result.
Rex
Rex is a terminal app from Superlogical. A Rex server keeps sessions running. A pane is one terminal area in Rex, and each pane has a block ID that stays the same.
Use Rex 0.1.0-preview.25 or later. The companion lists the terminal panes of the Rex server on the device.
swb companion connect https://swb.example.com --cap rex --cap hooksEach pane becomes the target local:session:<companion>:rex:<block uuid>. The block uuid is the part of the block ID after block:. SwB pastes the message into the pane and presses Enter. SwB delivers a message to a pane that runs a known agent, such as Claude Code, Codex, or Antigravity CLI. For a pane with a shell or another program, SwB keeps the message in a mailbox.
For replies from the pane, set up the applicable status hook. The hook reads REX_BLOCK, which Rex sets in each pane. The state of a session shows as unknown until a status hook reports it. Send a short test message to the target. Check that it appears in the pane. If you set up a status hook, check the reply with result.
To list panes on other Rex hosts, set SWB_REX_HOSTS to host labels from rex hosts, separated by commas. A host is a computer that runs a Rex server. Status hooks run where the agent runs. Replies come from panes on the companion's own device. Run a companion on the other host for replies there. See Rex setup.
Codex
The Codex app server is a process that gives other programs access to open Codex sessions. Start it in one terminal.
codex app-server --listen unix://Open a session from a second terminal.
codex --remote unix://Use a separate terminal for the companion. Use the same Codex settings folder in all terminals. For a custom socket, use unix://<path> in both commands above. Set SWB_CODEX_SOCKET to that path in the companion's terminal.
swb companion connect https://swb.example.com --cap codexThe companion reads session events from the app server. Check for a local:session:<companion>:codex:<session> target. Send a short test message to the target. Check the reply with result.
OpenCode
Start the OpenCode server on the device.
opencode serve --hostname 127.0.0.1 --port 4096Open a session on that server. Set SWB_OPENCODE_URL to the server's local address. For a password-protected server, see the OpenCode companion settings.
SWB_OPENCODE_URL=http://127.0.0.1:4096 swb companion connect https://swb.example.com --cap opencodeThe companion reads session events from the OpenCode server. Check for a local:session:<companion>:opencode:<session> target. Send a short test message to the target. Check the reply with result.
DeepSeek
Use DeepSeek 0.2.2-rc.5. A profile is a set of app settings. Install the SwB bridge in the web profile. The bridge sends session events to the companion.
Use a local copy of the main branch. Replace /path/to/SwB with the full path to that copy.
dsh plugin --profile web add /path/to/SwB/integrations/dshRestart DeepSeek with the web profile. Open a session. If you set SWB_COMPANION_HOME, use the same absolute path for DeepSeek and the companion.
swb companion connect https://swb.example.com --cap dshCheck for a local:session:<companion>:dsh:<session> target. Send a short test message to the target. Check the reply with result.
Apps with open sessions
Orca and Paseo use a driver, which tells the companion how to list and message open sessions. Amp uses a plugin, which adds features to Amp. Open sessions appear in targets(block="local"). Use the full address from the result.
Orca
Install the Orca command. Run the companion in an Orca terminal. Start the agent in a second Orca terminal.
swb companion connect https://swb.example.com --cap ade --cap hooksSwB uses Orca's message system to send work and collect replies. Ask the agent to answer on the same Orca message thread. See Orca setup to connect the agent's tools.
Paseo
Start the Paseo background service on the device. Open an agent session. Run the companion with the same Paseo settings.
swb companion connect https://swb.example.com --cap ade --cap hooksSwB sends work to a session that is ready. It reads the reply from Paseo. See Paseo setup to connect the agent's tools.
Agent of Empires, Claude Squad, cmux and Emdash
These apps use a driver too. Each setup page shows what the companion needs.
swb companion connect https://swb.example.com --cap ade --cap hooksAgent of Empires Claude Squad cmux Emdash
Amp
Install Amp. Make swb available on Amp's command search path. Install the SwB plugin on the device that runs Amp.
swb hook amp --install-plugin
swb companion connect https://swb.example.com --cap hooksOpen a new local Amp thread. The plugin reports the thread's state and passes work from SwB to the thread. See Amp setup to connect the agent's tools.