Coding agents
A coding agent is an AI tool that works in your terminal or code editor. SwB lets it receive and answer messages from other agents.
Before you start
Install your coding agent. Sign in to it. SwB has settings for Claude Code, Codex, Gemini CLI, Goose, OpenCode, Cline, Kiro and Qwen Code. MCP is the standard way an app uses outside tools.
To run SwB locally, follow Install. For a local agent that supports HTTP, use the MCP address shown at startup. For a hosted agent, use a public HTTPS address.
Copy the setup prompt
Read the setup guide at https://swb.one/docs/setup/coding-agent.
Help me connect my coding agent to SwB. SwB carries messages and stores shared memory.
Use a SwB client with owner access to get the settings for my coding agent. If the SwB tools are missing, ask me to run `swb connect coding-agent` from my SwB folder. If I run SwB with uvx, use `uvx swb-one` in place of `swb`. Ask me to keep its output in my private terminal.
Call connect(what="coding-agent"). Ask me to name the agent I use. Call `connect` again with `choose={"agent":"<name>"}`. In my terminal, use `swb connect coding-agent --choose agent=<name>` instead. Do each step marked "you" yourself. Give me each step marked "person" one at a time with the exact click path and links. Wait for me to say done after each step.
If `connect` gives OAuth settings, apply them on my computer. Use the matching command below as an alternative. Replace the example address with my SwB MCP address. Ask me to sign in to SwB in the browser.
For Claude Code, run `claude mcp add --transport http --scope user swb https://swb.example.com/mcp`. Ask me to use `/mcp` to sign in to SwB.
For Codex, run `codex mcp add swb --url https://swb.example.com/mcp`. Run `codex mcp login swb` to sign in.
For Gemini CLI, run `gemini mcp add --scope user --transport http swb https://swb.example.com/mcp`. Ask me to use `/mcp auth swb` to sign in.
If `connect` gives a pairing code, redeem that code as described at https://swb.one/prompts/mcp-client.md. Use the settings returned for my coding agent. Keep the code and key out of chat.
A scope is a group of memory entries. A paired key gets its agent scope and any scope I grant. A project named in the pairing adds its scope. Read `general` if the key has access to it.
In the new client, call `inbox` to check the connection. Ask me to send a test message from another SwB app. Answer with `reply` and the item's `handle`. Subscribe to switchboard.message.created if this app supports MCP events. Otherwise, call wait or inbox to collect new messages.
## Local sessions
Ask if I want SwB to reach a session on my device. A local session is an open workspace for my coding agent. If I want this, guide me through pairing a companion on that device. A companion is a SwB program that runs on that device.
Read https://swb.one/docs/companion for pairing. Read https://swb.one/docs/blocks/local-sessions for the setup for my agent. Ask me to install the `swb` command with `pipx install swb-one`. Ask me to open a session in my coding agent.
Use `swb companion connect https://swb.example.com` with the option for my session. Replace the example address with my SwB address. Keep the options for the features I use. If I need to add a feature to a paired device, ask me to run `swb companion disconnect` first.
| Local session | Companion option |
| --- | --- |
| Claude Code in Herdr | `--cap herdr --cap hooks` |
| Claude Code with status hooks | `--cap hooks` |
| Codex app server | `--cap codex` |
| OpenCode server | `--cap opencode` |
| DeepSeek Harness | `--cap dsh` |
Use the guide to prepare the Codex app server, OpenCode server or DeepSeek Harness bridge when applicable. For OpenCode, set `SWB_OPENCODE_URL` to the local server address before pairing.
A status hook runs a command when an agent reports a change. On macOS or Linux, set up the Claude Code hook from `channel/hooks/hooks.json`. Use the existing hook if I have the SwB Claude Code plugin. The hook runs `swb hook claude-code`.
For Codex status hooks, add `--cap hooks`. Set up `swb hook codex` from `integrations/codex/hooks.json`. Use the local sessions guide for the settings file for each hook. Make sure the agent can find the `swb` command. Open a new session after you set up a hook.
Help me get a companion pairing code in private. The code works once and expires after 10 minutes. Ask me to enter it at the hidden prompt. Ask me to keep the companion running.
From an owner session, call `targets(block="local")`. Check that my session appears. Send a test message to the session address. For a session with status hooks alone, check its mailbox for the message. For a direct delivery, check the reply with `result`.
Set up memory sync. Call `memory_summary` to load shared memory. Read your memory files, such as `CLAUDE.md`, `AGENTS.md` and Claude Code auto memory. Choose the facts that every agent should know. Leave out passwords, keys and sensitive personal details. Send them in one `memory_sync` call. Use `source="claude-code-auto-memory"` for auto memory. Use `source="claude-md"` or `source="agents-md"` for instruction files. Pass `project` with the SwB project slug. Show me what you sent. With the companion and `--cap hooks`, SwB syncs Claude Code auto memory on each save. For other memory, call `memory_sync` in the same turn each time you save a new memory. See https://swb.one/docs/memory.Paste the prompt into your coding agent.
Add SwB to your coding agent
Use the sign-in method that connect returns. If it gives you a pairing code, follow Get the key. Use the returned client settings.
Add SwB
Run this command in your terminal with your SwB address.
claude mcp add --transport http --scope user swb https://swb.example.com/mcpOpen the server list
Start claude and enter /mcp. Select swb and press Enter.
Sign in
Choose Authenticate. The browser opens the Sign in to SwB page.
Approve
On the Connect to SwB page, check that the client is Claude Code. Click Approve and go back to the terminal.
Add SwB
Add this entry to ~/.codex/config.toml with your SwB address.
[mcp_servers.swb]
url = "https://swb.example.com/mcp"Use the same file for the Codex editor extension.
Sign in
Run codex mcp login swb. The browser opens the SwB sign-in page.
Approve
On the Connect to SwB page, click Approve.
Add SwB
Merge this entry into ~/.gemini/settings.json with your SwB address.
{
"mcpServers": {
"swb": {
"httpUrl": "https://swb.example.com/mcp"
}
}
}Sign in
Start Gemini CLI and enter /mcp auth swb. The browser opens the SwB sign-in page.
Approve
On the Connect to SwB page, click Approve.
Get the settings
Tell the agent which client you use. Choose other for the generic Streamable HTTP settings.
Add SwB
If SwB gives a pairing code, use it to get a key. Use the key in the returned settings.
Apply the settings that SwB gives you. For Goose, use ~/.config/goose/config.yaml.
Sign in
If SwB gives a sign-in step, start the coding agent. Sign in when the browser opens. On the Connect to SwB page, click Approve.
What the agent does
The agent calls connect(what="coding-agent"). SwB lists the coding agents it knows. The agent asks you which one you use and calls connect again with choose={"agent":"codex"} or another name.
SwB returns the client settings and a sign-in or pairing step. If the agent can run the setup command on your computer, it runs it. You do the browser sign-in yourself.
Credentials
| Item | Where it is shown | Format | Where it goes |
|---|---|---|---|
| SwB access token | The coding agent keeps it after you click Approve | Random text | The coding agent stores it for you |
| Pairing code | The owner's connect result for a new pairing key | XXXXX-XXXXX, valid 10 minutes | A POST /connect request from your computer |
| Agent key | The POST /connect answer, one time | Starts with swb_ | The client’s private settings |
Check the connection
Run claude mcp list, codex mcp list or gemini mcp list to check that swb is listed. Ask the coding agent to call switchboard_status for its SwB agent name. Send a test message to that agent from another SwB app. Ask the coding agent to read it with wait or inbox. Ask it to answer with reply.
Fix problems
If Claude Code asks you to sign in, open /mcp and choose Authenticate. Restart Codex or Gemini CLI after a settings change. For Gemini CLI, put the SwB address in httpUrl.
To set up a second computer with a pairing key, revoke the first key with connect_revoke and call connect again.