bridge-cli is the terminal client for Bridge, the all-in-one personal agent
app. It opens an interactive TUI, authenticates against a Bridge backend,
streams agent sessions over SSE, and registers the current checkout as a local
connector environment over WebSocket so the remote agent can inspect files, edit
files, and run approved shell commands on the user's machine.
The CLI is intended for local development workflows where an agent needs both a chat surface and controlled access to a repository on disk.
- Interactive terminal chat UI built with Ratatui and Crossterm.
- Email code login flow with locally stored JWT auth state.
- Session creation, resuming, listing, renaming, cancellation, and compaction.
- Live response streaming, reasoning summaries, tool status, and transcript view.
- Local connector runtime for file reads, writes, stats, listing, glob, grep, streamed file transfer, and shell execution.
- Approval prompts for shell commands and writes outside the current directory.
- Read-only shell command auto-approval for a constrained allowlist.
- Automatic connector reconnection and session stream reconnection.
- Bridge product repository: contains the Go backend that serves the
/v1/user/agent/*HTTP, SSE, and WebSocket APIs used bybridge-cli, plus the macOS app, web surfaces, and evaluation tooling. unbox: the distributed multi-agent runtime used by the broader Bridge system. It provides agent execution infrastructure, remote environment access, and bridge integrations that complement the local connector exposed by this CLI.
- Rust toolchain with edition 2024 support.
- A running Bridge backend. By default the CLI talks to
http://localhost:8080. - A terminal that supports alternate-screen TUI applications.
For a released binary:
curl -fsSL https://github.com/AFK-surf/bridge-cli/releases/latest/download/install.sh | shFor local development:
cargo build
cargo run -- chatStart or point at a Bridge backend, then log in:
export BRIDGE_BASE_URL=http://localhost:8080
cargo run -- loginThe login flow prompts for an email address, requests a six-digit verification code from the backend, then stores the returned JWT locally.
Start the TUI:
cargo runor:
cargo run -- chatWhen the TUI starts, bridge-cli:
- ensures the user is authenticated;
- checks the backend agent config;
- detects the nearest Git repository root from the current directory;
- connects that root as a Bridge connector environment;
- opens or creates an agent session when the first message is sent.
bridge-cli [--log-file <path>] [command]If no command is provided, bridge-cli starts chat.
| Command | Description |
|---|---|
chat [--session <id>] |
Open the interactive TUI, optionally resuming a specific session. |
login |
Force the email code login flow and store fresh auth state. |
logout |
Clear stored auth state. |
sessions |
Print recent sessions for the current account. |
new [title] |
Start the TUI with a new draft session title. |
connector status |
Print the computed local connector name, alias, root, and backend URL. |
Use --log-file <path> to write tracing output to a file. Without this flag,
tracing is initialized with a sink writer.
Inside the chat composer, slash commands control the active session and UI:
| Command | Description |
|---|---|
/new [title] |
Create a fresh draft session. |
/resume [id] |
Resume a session by id, or open the recent-session chooser. |
/sessions |
Open the recent-session chooser. |
/permissions |
Inspect pending approval requests. |
/transcript |
Toggle between chat and transcript displays. |
/search |
Search the transcript. |
/rename <title> |
Rename the current or draft session. |
/cancel |
Cancel the active run. |
/compact |
Request backend context compaction for the current session. |
/status |
Show connector, session, run, and approval state. |
/help |
Open in-app help. |
/quit |
Exit the TUI. |
Useful key bindings:
| Key | Action |
|---|---|
Enter |
Send the current message. |
Ctrl+Enter, Alt+Enter, or Shift+Enter |
Insert a newline. |
Ctrl+T |
Toggle chat/transcript display. |
PgUp / PgDn |
Scroll transcript content. |
| Mouse wheel | Scroll transcript content. |
Esc |
Close overlays. |
Ctrl+C |
Quit. |
In the permissions overlay, use a to approve, r to reject, Tab to enter
feedback, and Up/Down or j/k to switch requests.
Config and auth files are stored via the platform config directory resolved by
the directories crate for bridge-cli.
The store contains:
config.tomlbase_url: backend URL. Defaults toBRIDGE_BASE_URL, thenhttp://localhost:8080.machine_id: generated 12-character machine id used in connector aliases.last_session_id: reserved session state field.
auth.jsonjwt: bearer token returned by login verification.email: login email address.
To switch backends, either set BRIDGE_BASE_URL before the first run or edit
config.toml.
The connector runtime registers over:
/v1/user/agent/connect
using a WebSocket URL derived from base_url. The local environment alias is
computed from the machine id and a short hash of the detected repository root:
local-cli-<machine_id>-<path_hash>
The connector exposes methods for:
read,write,delete,stat, andlist;globandgrep;read_streamandwrite_stream;exec;request_permission.
Paths are resolved under the detected root. The CLI detects the nearest parent
directory containing .git; if none is found, it uses the current directory.
Shell execution runs through /bin/bash -lc in the requested working directory.
Known read-only commands are auto-approved. Other commands trigger an in-TUI
approval prompt before execution. Writes inside the current directory are
allowed by default; writes outside the current directory but still under the
connector root require approval.
Common commands:
cargo check
cargo build
cargo build --release
cargo fmt --all
cargo fmt --all -- --check
cargo clippy --lib -p bridge-cli --message-format=shortRun tests:
cargo testFrom the Bridge product repository root, start the local Bridge backend:
docker compose -f backend/.docker/dev/compose.yml up -d
cd backend
cp config.example.json config.json
make run CONFIG_PATH=./config.jsonThen, from this repository:
export BRIDGE_BASE_URL=http://localhost:8080
cargo run -- login
cargo run -- chatsrc/
|-- main.rs # Tokio entry point
|-- lib.rs # crate exports
|-- cli.rs # Clap command definitions and top-level dispatch
|-- config.rs # config/auth store
|-- auth.rs # email-code login and JWT extraction
|-- api/ # Bridge REST and SSE client
|-- session.rs # session service and stream handling
|-- events.rs # UI event bus types
|-- terminal.rs # plain terminal helpers
|-- ui.rs # Ratatui TUI rendering and input handling
`-- connector/
|-- mod.rs # WebSocket connector runtime
|-- protocol.rs # connector protocol message types
|-- handlers.rs # file/search/exec request handlers
|-- approvals.rs # approval broker
`-- shell_safety.rs # read-only command analysis