switchboard
README.md
# switchboard
**An MCP server that turns coding agents into something you can delegate to by talking.** Start, steer, answer and resume [Claude Code](https://code.claude.com) or any [Agent Client Protocol](https://agentclientprotocol.com) agent (OpenCode, Codex, Gemini CLI, ...) from any MCP client, including claude.ai on your phone, by voice.
You talk to Claude. Claude hands the work to a real coding agent on a machine you control (for example a home server or a Raspberry Pi), relays the agent's questions back to you, and you get a ping when it is done.

## Why
Regular Claude, in the app or by voice, is a good place to think out loud, but it cannot touch your code. Coding agents can, but they live in a terminal on your machine. The goal: say "build me a packing list app", walk away, and have a real agent do it, asking you the one question it needs to ask, while you are in the car.
Existing options did not cover that:
- **Terminal scrapers and remote-session bridges** drive tmux or an undocumented API. They can start work, but they cannot answer an agent's questions or approvals.
- **Phone apps for one agent** are tied to one vendor and one client.
- **Long blocking calls** break on flaky mobile and voice connections, which cut tool calls off after a short time.
switchboard is the missing control plane: a small MCP server whose tools map to how you would talk about the work, whose calls always return quickly, and whose sessions survive restarts and hang-ups. Research and decisions are in [docs/NOTES.md](docs/NOTES.md) and [docs/design/research](docs/design/research).
## How it works

**Sessions.** Each `start` creates a session: a live agent process in a workspace (a directory you list in the config), named by a short word like "otter". A session is in one of seven states: `starting`, `working`, `waiting` (the agent asked a question or needs approval), `idle` (turn finished, process warm), `parked` (process gone, context kept), `failed` and `closed`. See the [lifecycle diagram](docs/design/diagrams/4-lifecycle.png). Idle sessions park after `idle_park_after` (30 minutes) and `send` resumes them with their context; if all `max_live_sessions` slots are busy, the oldest idle one is parked to make room. Only one turn runs at a time per session; messages sent meanwhile are queued (see below).
**Bounded waits.** No tool call blocks longer than `max_wait` (25 s by default); `start`, `send` and `respond` return within about 10 s. Long work is followed with `wait`, which takes a cursor and returns the activity since then, or returns early when a question appears or the turn ends. Hang up mid-build and nothing is lost.
**Questions and approvals.** When the agent asks something (Claude Code's `AskUserQuestion`, or a permission request), the session goes to `waiting` and the request comes back through MCP as structured data with its options. The state holds until someone answers. Claude answers from context or asks you, and passes your words to `respond` ("blue", "2", "allow", "deny", "always").
**Drivers.** Two drivers behind one small interface, producing the same normalized events:
- `claude` drives Claude Code through the official [Agent SDK](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk), the most direct way to answer its questions and approvals.
- `acp` drives any [ACP](https://agentclientprotocol.com) agent by command (`opencode acp`, `codex-acp`, `gemini`, ...). Adding one is a config entry.
A `fake` driver exists for tests. Agents can optionally run as another Unix user (`run_as`).
**Subagents.** Agents spawn subagents (Claude Code's `Agent`/`Task` tool, OpenCode's `task` tool). switchboard tracks them, without putting their chatter in the transcript: a `subagents` table records each one with its session, description, type, model, status (`running`, `completed`, `failed`, `stopped`) and start and end times. For OpenCode, whose subagents run in the background and whose task tool call returns at launch, the real lifetime is read from OpenCode's own SQLite record of child sessions (read-only; it falls back to the tool call if the database is unreadable or its layout is not the expected one). A background subagent keeps running after its turn ends, so the session counts as executing and is not parked until it finishes. Interrupting, closing, a crashed agent process or a server restart marks the running ones `stopped`. The `sessions` tool and the dashboard show how many are running.
**Storage.** State lives in SQLite (`node:sqlite`, no native dependencies) under `state_dir`: sessions, an event log with cursors, OAuth grants, usage, queued messages. After a restart sessions come back `parked`, and work that was in flight continues (see Restarts).
**Queue and send now.** `send` to a session that is working, waiting on a request, running subagents or being drained for a restart queues the message instead of refusing, and answers with its position (`delivery: "queued"`, `position`). Any number can be queued. When the turn ends they are delivered together as one next turn, in order; with more than one the turn reads `N messages arrived while you were busy, in order:` followed by the messages separated by blank lines (a single message is sent as is). `send` with `now: true` interrupts the current turn (a pending question or approval is cancelled) and delivers everything queued plus that message as one turn at once; on an idle session it is a plain send. A send to an idle or parked session is immediate and carries anything already queued. `stop` with `interrupt` ends the turn and keeps the queue (delivered with the next send); `stop` with `clear_queue` drops the queued messages; `close` drops them too. The queue lives in the `queued_messages` table, so it survives restarts. `sessions` and the dashboard show the queued count and the dashboard drawer lists the queued messages (truncated). Queueing follows the same access policy as `send`. An idle session whose background subagents are still running counts as busy: a plain `send` queues until they finish, `now` goes straight through.
**Restarts.** On SIGTERM or SIGINT switchboard drains: it stops starting turns (sends queue, `start` is refused with a "restarting, try again" message), lets working sessions finish their turn for up to 10 minutes (`DRAIN_LIMIT_MS`, a constant), then exits. Sessions still executing at the limit are interrupted and marked `carry_on`. On the next start every session that was cut off (marked, or found `working`, `waiting` or with subagents running after a crash or kill) is resumed with its conversation and told that switchboard restarted, its last turn was cut off, any pending request was cancelled and to carry on; its queued messages follow in the same turn. Sessions that only have queued messages get them delivered. Idle sessions stay parked. A second signal while draining exits at once (work continues after the next start). Run switchboard under a service manager whose stop timeout is longer than the drain limit (for systemd, `TimeoutStopSec` above 10 minutes), and make sure stopping signals only the main process at first (systemd `KillMode=mixed`; the default `control-group` also signals the agent children at once and ends their work).
**Notifications.** When a turn ends, fails, or the agent needs you, and no client is already waiting, switchboard sends a message through Telegram, ntfy or a command you provide. A question nobody answers triggers a reminder after `nag_after` (10 minutes).
**Machine clients.** A local program with no browser (a job runner, a workflow worker) can act as one configured user: `[machine_clients.<name>] token_file = "...", user = "<email>"`, with `[users."<email>"]` listing its `agents` and `workspaces`. It sends the file's token (at least 32 characters) as a bearer token. Switchboard accepts it only from loopback, and refuses it on anything that came through Cloudflare (`cf-ray` / `cf-connecting-ip` present). The file is read on every request, so deleting or rotating it revokes the client; `switchboard grants` lists machine clients.
**Auth.** Over stdio there is no auth. Over HTTP switchboard is its own OAuth 2.1 authorization server (PKCE, CIMD and DCR, RFC 9728 / 8414 / 8707), so claude.ai connects as a normal custom connector. The one human step, `/authorize`, is delegated to Cloudflare Access (see [Remote](#remote-claudeai-as-the-client)). The [inside diagram](docs/design/diagrams/3-inside.png) shows the layers.
## Tools
| Tool | What it does |
| --- | --- |
| `agents` | configured agents (with their model catalogs) and workspaces, with descriptions, plus a usage hint |
| `start` | new session on a task (optional `agent`, `workspace`, `model`, `title`); returns within ~10 s with its state |
| `send` | follow-up in a session (resumes parked ones); queues while the session is busy; `now: true` interrupts and delivers everything queued plus the message |
| `wait` | progress since a cursor: activity, a pending question, or the reply |
| `respond` | answer a question or approval in the user's words ("blue", "2", "allow") |
| `sessions` | everything, one line each (with how many subagents are running and how many messages are queued), optionally filtered by state |
| `stop` | `interrupt` the current turn (keeps the queue), `clear_queue`, or `close` the session |
| `refresh` | restart a session's agent with its conversation intact so it reloads instructions, skills, plugins and MCP servers; no `session` refreshes every idle session |
| `history` | search live and archived sessions, or read an archived summary (only with `[archive]`) |
The server's MCP instructions tell the client it is pairing with a live agent, not filling in a form: delegate whole tasks, give short natural updates while waiting (8 to 10 s waits in voice), answer the agent's questions itself only when you already told it the answer, otherwise ask you and pass your answer to `respond`, report the outcome when a turn ends, use `refresh` when the machine's instructions, skills or MCP servers changed, queue with `send` when a session is busy or use `now` to interrupt, and use `stop` only when asked. The dashboard shows the exact text.
`refresh` closes the agent process and resumes it with the same conversation id, without sending a message, and the session ends `idle`. It works on `idle` sessions and, for a single named session, on `parked` ones (resumed now). It refuses with a `busy` error while a session is `working` or `waiting`: finish the turn, answer the request or `stop` with `interrupt` first. `failed`, `closed` and sessions without a conversation id get an error. Without `session`, every idle live session the caller can see is refreshed and the rest are listed as skipped; parked sessions need nothing, because they start a fresh process on their next `send`. Cost and turn counts are not double counted, and restricted users can only refresh their own sessions.
## Quick start (local, Claude Code or Claude Desktop)
```sh
git clone https://github.com/jeffclimbsbikes/switchboard && cd switchboard
npm ci && npm run build
mkdir -p ~/.config/switchboard && cp switchboard.example.toml ~/.config/switchboard/config.toml
$EDITOR ~/.config/switchboard/config.toml # set a workspace
node dist/cli.js check
claude mcp add switchboard -- node "$PWD/dist/cli.js" stdio
```
Node 22.13+ is required. `switchboard check` confirms the agent executables and workspaces exist. The config path comes from `--config`, `$SWITCHBOARD_CONFIG` or `~/.config/switchboard/config.toml`. Commands: `serve` (HTTP), `stdio`, `check`, and `grants` (`--revoke` signs every client out).
## Configuration
[switchboard.example.toml](switchboard.example.toml) is a commented starting point. Every key:
| Key | Meaning |
| --- | --- |
| `listen` | `host:port`, default `127.0.0.1:8787` |
| `public_url` | public HTTPS URL; required for OAuth (anything but `auth = none`) |
| `state_dir` | default `~/.local/state/switchboard` |
| `max_wait` | longest any tool call blocks, default `25s` (`ms`, `s`, `m`, `h`, `d`) |
| `idle_park_after` | idle time before a session's process exits, default `30m` |
| `max_live_sessions` | concurrent agent processes, default 4 |
| `[agents.<id>]` | `driver = "claude"`, `"acp"` or `"fake"`; see below |
| `[workspaces]` | `id = "path"` or `id = { path, description, default }` |
| `[auth]` | `login = "none"`, `"cloudflare-access"` (`team`, `aud`, `allow`) or `"dev"` (`email`) |
| `[users."email"]` | per-user `agents`, `workspaces`, `notify_chat` |
| `[usage.ollama]`, `[usage.claude]` | optional usage pollers |
| `[archive]` | optional: summarize and remove old sessions; see Archive and history |
| `[notify]` | `telegram = { token_env, chat }`, `ntfy = { url }`, `command`, `nag_after` |
Agent keys: every agent takes `description` (max 300 characters), `models` and `default`. `claude` agents also take `executable` (defaults to the SDK's bundled or PATH `claude`), `model`, `permission_mode` (`default`, `acceptEdits`, `plan`, `bypassPermissions`, `dontAsk`, `auto`; default `default`), `append_system_prompt` and `run_as`. `acp` agents take `command` (required), `env`, `model` and `run_as`. Without `[auth]` the login is `none`.
### Agents, workspaces and descriptions
Give every agent and workspace a short `description` (max 300 characters) so
the client can pick by what each is for. It is optional; the `agents` tool
lists them and the client falls back to the defaults.
```toml
[agents.claude]
driver = "claude"
description = "Strongest model; best for hard or open-ended work."
[workspaces]
site = { path = "~/src/site", description = "My website", default = true }
scratch = "~/scratch" # the plain path form still works
```
### Models
Give an agent a `models` catalog so the client can choose a model per session
with the cost in view. Every field except `id` is optional:
```toml
[agents.opencode]
driver = "acp"
command = ["opencode", "acp"]
models = [
{ id = "ollama-cloud/kimi-k3.1-pro", label = "Kimi K3.1 Pro", description = "Strong and cheap.", input_price = 0.6, output_price = 2.5, default = true },
{ id = "ollama-cloud/glm-5.3", notes = "Fast for small edits." },
]
```
- `id` is what the agent itself expects: `provider/model` for OpenCode, `opus`
or `sonnet` for Claude Code.
- Prices are USD per million tokens, list prices for comparison only; the
Models tab shows "price not published" when they are omitted.
- At most one model is `default`. The agent's own top-level `model` wins when
it is set; the catalog default only applies when `model` is unset.
- With a catalog, `start({ model })` must be one of its ids, otherwise the
error lists the options. Without a catalog the model string is passed
through as before.
- The `agents` tool lists each agent's models, one per line, and the structured
result carries the whole catalog. `start`'s `model` is "model id from the
agents tool for the chosen agent".
- Claude Code gets the model as the SDK `model` option. ACP agents get it
through the agent's model config option (`session/set_config_option`); if
the agent does not offer that id, the session records a non-fatal error
instead of silently running another model.
### Usage
The dashboard has a **Usage** tab (and a **Models** tab for the catalog).
- **Cost.** Drivers report `costUsd` and token counts on each turn (Claude Code
from the result message, ACP agents from `usage_update` cost when they send
one). switchboard keeps per-session totals in its database plus a small
per-turn table for the today / 7 days figures. For Claude this is
API-equivalent cost on a subscription, not a bill.
- **Claude plan windows.** Claude Code's `rate_limit_event` messages (5-hour,
7-day, 7-day Opus, ...) are stored process-wide with utilization, status and
reset time, and survive restarts.
- **Optional pollers** (both off unless configured, both fail soft):
```toml
[usage.ollama]
api_key_env = "OLLAMA_API_KEY" # every 10 min and on demand, cached
[usage.claude]
probe = true # EXPERIMENTAL
```
`[usage.ollama]` reads `https://ollama.com/api/me` (only the `Plan` field is
kept; email, name and ids are dropped) and `https://ollama.com/api/usage`
(daily request counts for 7 days). Both endpoints are undocumented and may
change; the UI says so. Ollama's quota percentage is not available through
the API, so the tab links to ollama.com/settings.
`[usage.claude] probe = true` fills the plan windows when no live
`rate_limit_event` arrived in the last 15 minutes. It opens a short-lived SDK
query with the first claude agent that has no `run_as`, calls the SDK's
experimental usage request and closes it. It never sends a prompt, so it
spends no tokens. It depends on an SDK method named
`usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET`; any error is
logged and ignored.
The `agents` tool ends with a one-line hint when something is known, for
example `Usage: Claude plan: 5-hour 34%, 7-day 61% (resets Tue); Ollama: Pro,
412 requests this week`, so the client can steer toward a cheaper agent.
Restricted users get the hint only for the providers their own agents use, and
the dashboard shows them only their own sessions' cost.
## Archive and history
Old sessions should not pile up, and their history should not be lost. With an `[archive]` section, sessions that are not live, are `idle`, `parked`, `failed` or `closed`, and were last updated more than `after` ago are summarized in detail by an agent of your choice, written to a searchable archive, and then removed from the live store.
```toml
[archive]
after = "35d" # default
# dir = "/var/lib/switchboard/archive" # default <state_dir>/archive
summarizer = { agent = "claude", model = "claude-haiku-4-5" } # required; model optional
# max_per_run = 20 # default
# delete_agent_transcripts = false # default
# agent_hint = true # default
```
| Key | Meaning |
| --- | --- |
| `after` | age (`updated_at`) before a session is archived, default `35d` |
| `dir` | where summaries go, default `<state_dir>/archive` |
| `summarizer` | `{ agent, model }`; the agent must exist and the model must be in its catalog, if it has one |
| `max_per_run` | sessions archived per run (oldest first), default 20 |
| `delete_agent_transcripts` | also delete the agent's own transcript (Claude Code's `.jsonl`), default `false` |
| `agent_hint` | tell new sessions where the archive is, default `true` |
**Runs.** Once a day (the first about 10 minutes after the server starts), and on demand with `switchboard archive`; `switchboard archive --dry-run` only lists what would be archived. A run that archived something sends the notifier one line ("archived 3 sessions").
**What is summarized.** A transcript built from switchboard's own events (prompts, assistant text, tool lines, requests and the answers given, turn results, errors, cost) plus, when readable, the agent's native transcript. For Claude Code that is `~/.claude/projects/<slug>/<agentSessionId>.jsonl`, where `~` is the home of the agent's `run_as` user (or the current user), and `<slug>` is the session's cwd with every non-alphanumeric character replaced by `-` (`/home/me/my.app` becomes `-home-me-my-app`). An unreadable transcript is skipped silently. Each part is cut to a size budget, keeping its head and tail with an elision marker. The summarizer runs through the normal driver interface as a one-shot session in a temporary directory; it must not need approvals (a request fails that session's archiving). Its cost is not recorded.
**Output.** `<dir>/<YYYY>/<MM>/<YYYY-MM-DD>-<session>-<agent>.md` (the date is when the session was created): YAML front matter (`session`, `agent`, `workspace`, `cwd`, `owner`, `model`, `title`, `state`, `created`, `updated`, `archived`, `turns`, `cost_usd`, `agent_session_id`), the summary (Goal, What happened, Changes, Decisions and why, Outcome, Open issues / follow-ups, Notable errors) and an Outline of the user's prompts with timestamps. A line with the same metadata, the file name and a 2-3 sentence `abstract` is appended to `<dir>/index.jsonl` (newest last). Files are written atomically, mode 0644 (directories 0755), so other accounts can read them.
**Safety.** The session's rows (session, events, usage) are deleted only after the summary and index line are on disk. Any failure leaves the session untouched; it is logged and retried on the next run. With `delete_agent_transcripts` the agent's transcript is removed right after the rows; a failure there is logged only.
**Agent hint.** With `agent_hint`, every new Claude Code session gets "Past sessions are summarized in `<dir>` (markdown files plus index.jsonl, newest last). Grep them when earlier work matters." appended to its system prompt; for ACP agents the same line is prepended to the first prompt (the event log keeps your original text). Agents that run as another account need read access to `<dir>` and its parents.
**The `history` tool** (offered when `[archive]` is configured). `history({ query?, session?, limit? })` searches live sessions (name, title, latest activity) and the archive (index abstracts, then the full text of the summaries); all words must match, case-insensitively, newest first, `limit` default 10, max 50. Each result has the session name, date, agent, title, abstract, `state` (`live` or `archived`) and, for unrestricted callers, the file path. With `session` (a name, or the id shown in results) it returns the whole archived summary, or one line about a session that is still live. Restricted users only see their own sessions and archives.
**Dashboard.** An Archive tab shows the count and the newest 20 (click one to read its summary) with a search box backed by `/dashboard/api/history?q=` (or `?session=<id>`), under the same access rules.
## Agents that die at launch
If an agent process emits a fatal error within 10 seconds of starting, before any `session`, `text` or `tool` event (for example Claude Code exiting with code 1 while refreshing an expired login), switchboard restarts it once with the same prompt and records a note, "agent exited at launch; retried". This covers new sessions and resume-on-send. Later failures are not retried.
## Remote: claude.ai as the client
Run `switchboard serve` behind HTTPS and add `https://<host>/mcp` as a custom connector in claude.ai (Settings, Connectors). The recommended setup is a Cloudflare Tunnel (your server dials out, no open ports) with two Access applications:
| Host / path | Access policy | Why |
| --- | --- | --- |
| `<host>/authorize` and `<host>/dashboard` | allow your email (and any guests) | the human steps; switchboard verifies the Access JWT |
| `<host>` (everything else) | bypass | claude.ai's servers call `/mcp`, `/token`, discovery; switchboard checks its own bearer tokens |
Give the first application a more specific path so it wins over the host-wide bypass, and check with `curl` from outside your network. If you use a WAF, skip it for Anthropic's published egress range (160.79.104.0/21). Then set `[auth] login = "cloudflare-access"` with your team name, the AUD tag of the Access application, and the allowed emails:
```toml
public_url = "https://switchboard.example.com"
[auth]
login = "cloudflare-access"
team = "your-team" # your-team.cloudflareaccess.com
aud = "..." # AUD tag of the /authorize application
allow = ["you@example.com"]
```
Cloudflare's built-in managed OAuth does not work with claude.ai today, which is why switchboard runs its own. See the [design site](docs/design/site/index.html) for the full flow and diagrams (OAuth sequence, routing, example Terraform). Any reverse proxy that gives you HTTPS and a way to sign the owner in can replace Cloudflare.
## Dashboard
`GET /dashboard` is a read-only mission-control page (no build step, no
external assets) that works on a phone and can be saved to the home screen. It
leads with what is executing right now (sessions working, subagents running,
sessions waiting on you, each busy session with its running-subagent count),
then the sessions grouped by state with their pending questions, every
configured agent and workspace, plan usage and cost, a per-session event
timeline, subagent list (description, type, model, status, duration) and queued messages, the exact MCP
tool contract and instructions a client sees, connected clients, and a config
summary without secrets. It polls `/dashboard/api/state` every 3 s;
`/dashboard/api/sessions/<name>?since=<seq>` pages one session's event log
(500 max; without `since` you get the newest events).
Auth follows `[auth] login`: `none` and `dev` are open on loopback;
`cloudflare-access` verifies `Cf-Access-Jwt-Assertion` like `/authorize`, so add
`/dashboard` to the Access application that covers `/authorize`. Users listed
under `[users]` see only their own sessions, agents and workspaces, and no
connected clients.
## Multiple people (users and run_as guests)
By default everyone who can sign in is the admin: all agents, all workspaces,
all sessions. List someone under `users` (keyed by the email they sign in with)
to restrict them. They only see the agents and workspaces you list (omit a list
for "all"), the first listed one is their default, and they only see and act on
sessions they started. Someone else's session looks exactly like a missing one.
Emails not listed stay unrestricted, and so do stdio and `auth = "none"`.
```toml
[users."alice@example.com"]
agents = ["alice"]
workspaces = ["alice-site"]
notify_chat = "123456789" # her Telegram chat; needs [notify.telegram] for the bot token
```
To give a guest a less-privileged agent, run it as another Unix user with `run_as`
on a `claude` or `acp` agent:
```toml
[agents.alice]
driver = "claude"
run_as = "alice"
```
switchboard then starts the agent with `sudo -n -u alice -H`, so it needs a
sudoers rule such as `switchboard ALL=(alice) NOPASSWD: ALL`. The target user
must be able to execute the agent binary and read the workspace. Only `PATH`,
`CLAUDE_*`, `ANTHROPIC_*` and `SWITCHBOARD_*` variables (plus an acp agent's
configured `env`) are passed through; the agent gets her `HOME`, her
credentials, and her permissions, not yours.
## Claude login
Each Unix user has its own Claude Code login, and it expires. The dashboard has a **Claude login**
card (hidden when no `claude` agent is configured) so you can log the right account back in from a
phone, without SSH.
- **Accounts** are derived from the config: one per Unix user a `claude` agent runs as (`self` is the
switchboard user, for agents without `run_as`). The card shows the agents using each account.
- **Access**: unrestricted callers see every account. Users under `[users]` see only the accounts their
allowed agents run as; any other account answers 404. No extra config.
- **Status** comes from `claude auth status --json` (run through `sudo -n -u <user>` for `run_as`
accounts): `logged_in`, `expiring` (sign-in ends within 3 days), `expired_refreshable`,
`logged_out`, `unknown`. Only the status, the sign-in end time and the plan are read; tokens are
never read, returned or logged.
- **Log in** runs `claude auth login --claudeai` as that user (plain pipes, no TTY needed), returns the
authorize link, and you tap it to sign in with Anthropic in your own browser. Anthropic shows a code;
paste it in the card and switchboard writes it to the CLI. The card then re-reads the status.
A login that is not finished in 10 minutes is killed, and starting again replaces the old one.
API (all under the dashboard's identity check):
| Route | |
|---|---|
| `GET /dashboard/api/accounts` | `[{ account, agents, status, expiresAt?, subscriptionType? }]` for the accounts you may see |
| `POST /dashboard/api/accounts/:account/login` | `{ loginId, url }` |
| `POST /dashboard/api/accounts/:account/login/:loginId` with `{ code }` | `{ ok: true, account }`, or 422 `{ ok: false, error }`, 409 if the login is gone |
The POSTs need `Content-Type: application/json` and an `Origin` (or `Referer`) matching `public_url`
or the request host. The sudo rule that already lets switchboard run agents as the guest covers this.
Details of the CLI's behaviour: [docs/notes-claude-login.md](docs/notes-claude-login.md).
## Security model
switchboard runs coding agents with whatever permissions you configure; with `bypassPermissions`, anyone who can call it can run code as that user. So:
- Remote access always goes through OAuth with an email allowlist; `auth = "none"` and `"dev"` refuse to listen beyond loopback.
- Tokens are stored hashed, and refresh tokens rotate with reuse detection.
- The Access bypass on the host only exposes switchboard's own token check; `/authorize` and `/dashboard` verify the Cloudflare Access JWT.
- `[users]` restricts what a signed-in person can see and start, but it is not a sandbox: it is bookkeeping inside one process. For real isolation give a guest a `run_as` agent, so their agent runs as a separate Unix user with its own files and credentials.
- `run_as` needs a sudoers rule for the switchboard user; only `PATH`, `CLAUDE_*`, `ANTHROPIC_*` and `SWITCHBOARD_*` variables are passed through.
- Run switchboard as a user whose blast radius you accept. It has no built-in sandbox for the agents themselves.
## Development
```sh
npm run check # biome + tsc + vitest (no network, no secrets)
SWITCHBOARD_LIVE=1 npx vitest run test/live # real claude (haiku) + opencode handshake
```
Every outside dependency has a stand-in in `test/fixtures`: a fake `claude` CLI speaking its stream-json control protocol, a fake ACP agent, a local JWKS for Cloudflare Access. One driver contract suite (`test/contract/driver-contract.ts`) runs against every driver. See the [testing diagram](docs/design/diagrams/7-testing.png).
## Design docs
- [Design site](docs/design/site/index.html): open locally; diagrams are draw.io files with the source embedded (`docs/design/diagrams`, regenerate with the `d*_*.py` scripts and the `drawio` CLI).
- [docs/NOTES.md](docs/NOTES.md): requirements and the decisions log.
- [docs/design/research](docs/design/research): prior art, agent protocols, auth, CLI probes.
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues