Bond is a personal AI assistant that runs entirely on your machine. It connects to LLM providers of your choice (Anthropic, OpenAI, Ollama, etc.), manages conversations through a WebSocket gateway, and gives you a clean web UI — all without sending your data to third-party services.
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Frontend │────▶│ Gateway │────▶│ Backend │────▶│ SpacetimeDB │
│ (Next.js) │ │ (WebSocket) │ │ (FastAPI) │ │ (Database) │
│ :18788 │ │ :18789 │ │ :18790 │ │ :18787 │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
| Service | Tech | Port | Purpose |
|---|---|---|---|
| Frontend | Next.js 15 / React 19 | 18788 | Web UI for chat, settings, deployments |
| Gateway | TypeScript / Express / WS | 18789 | WebSocket server, channels, session management |
| Backend | Python / FastAPI | 18790 | LLM orchestration, tools, memory, vault |
| SpacetimeDB | SpacetimeDB v2 | 18787 | Real-time database for state & sync |
| Tool | Version | Install |
|---|---|---|
| Python | 3.12+ | python.org |
| Node.js | 22+ | nodejs.org |
| Docker | Any recent | docker.com |
| uv | Latest | curl -LsSf https://astral.sh/uv/install.sh | sh |
| pnpm | Latest | npm install -g pnpm |
git clone <your-repo-url> bond
cd bond
# Install all dependencies (Python, Gateway, Frontend, SpacetimeDB)
make installThis will:
- Check for the SpacetimeDB CLI (offers to install it if missing)
- Optionally start a local SpacetimeDB instance via Docker
- Install Python dependencies via
uv sync - Install Gateway dependencies via
pnpm install - Install Frontend dependencies via
pnpm install
make setupThe wizard walks you through:
- Pick your LLM provider — Anthropic, OpenAI, Google, DeepSeek, Groq, Mistral, Ollama, OpenRouter, xAI, Azure, Bedrock, LM Studio, or any OpenAI-compatible API
- Choose a model — sensible defaults are suggested (e.g.
claude-sonnet-4-20250514for Anthropic) - Enter your API key — stored in an encrypted local vault (skipped for local providers like Ollama)
Configuration is saved to bond.json and ~/.bond/.
# Start SpacetimeDB via Docker (recommended)
make spacetimedb-upVerify it's running:
make spacetimedb-healthmake migrateThis applies the current Bond migrations and publishes the SpacetimeDB module. Bond operational state is stored in SpacetimeDB. SQLite should only be assumed for explicitly local or vector-storage use cases.
make devThis starts all three services concurrently:
- Backend → http://localhost:18790
- Gateway → ws://localhost:18789
- Frontend → http://localhost:18788
Open http://localhost:18788 in your browser and start chatting.
make install && make setup && make spacetimedb-up && make migrate && make devRun everything in a single container:
docker compose up --buildThis exposes the same three ports (18788, 18789, 18790) and manages data in a Docker volume.
For development with hot-reload:
docker compose -f docker-compose.dev.yml upPrimary configuration file — LLM provider, model, ports, SpacetimeDB connection:
{
"llm": {
"provider": "anthropic",
"model": "claude-sonnet-4-20250514"
},
"backend": { "host": "0.0.0.0", "port": 18790 },
"gateway": { "host": "0.0.0.0", "port": 18789 },
"frontend": { "port": 18788 },
"spacetimedb": {
"url": "http://localhost:18787",
"module": "bond-core-v2"
}
}Optional overrides and secrets. See .env.example for all options:
cp .env.example .envKey variables:
SPACETIMEDB_TOKEN— Auth token for SpacetimeDB (auto-configured by setup)ANTHROPIC_API_KEY/OPENAI_API_KEY— API keys (prefer the vault viamake setup)BOND_VAULT_KEY— Encryption key for the local vault (auto-generated if unset)
Bond's local data directory:
~/.bond/
├── data/ # Local worker/vector data only when explicitly configured
├── logs/ # Application logs
├── cache/ # LLM response cache, repo maps
├── workspace/ # Agent working directory
├── spacetimedb/ # SpacetimeDB data (Docker volume)
└── config.json # Package manager preference
| Provider | API Key Env Var | Local? |
|---|---|---|
| Anthropic | ANTHROPIC_API_KEY or OAuth |
No |
| OpenAI | OPENAI_API_KEY |
No |
| Google (Gemini) | GOOGLE_API_KEY |
No |
| DeepSeek | DEEPSEEK_API_KEY |
No |
| Groq | GROQ_API_KEY |
No |
| Mistral AI | MISTRAL_API_KEY |
No |
| xAI (Grok) | XAI_API_KEY |
No |
| OpenRouter | OPENROUTER_API_KEY |
No |
| AWS Bedrock | BEDROCK_API_KEY |
No |
| Azure OpenAI | AZURE_API_KEY |
No |
| Ollama | (none needed) | Yes |
| LM Studio | (none needed) | Yes |
| Other (OpenAI-compatible) | OTHER_API_KEY |
Varies |
Switch providers anytime by re-running make setup or editing bond.json.
If you have a Claude Max or Pro subscription ($20–100/mo), you can use your subscription's OAuth token instead of paying per-API-call. This means unlimited usage (within subscription rate limits) at a flat monthly cost.
How to set it up:
-
Install Claude CLI (if you haven't already):
npm install -g @anthropic-ai/claude-code
Or run it once with
npx @anthropic-ai/claude-codeto trigger the OAuth flow. -
Run
claudeonce — it opens a browser for Anthropic login and creates~/.claude/.credentials.json. -
Run
make setupand select Anthropic. When prompted for authentication method, choose "OAuth (Claude Max/Pro)" instead of entering an API key. -
Bond auto-detects the credentials, refreshes tokens automatically, and injects the required headers — you don't need to manage anything.
Note: OAuth tokens require specific HTTP headers and a system prompt prefix for the Anthropic API. Bond handles all of this automatically via the gateway's OAuth module. Some models may have different rate limits under OAuth vs a standard API key.
| Command | What it does |
|---|---|
make dev |
Start all services (backend + gateway + frontend) |
make setup |
Run the first-time setup wizard |
make install |
Install all dependencies |
make migrate |
Run database migrations |
make test |
Run all tests (Python + Gateway + Frontend) |
make lint |
Lint all code |
make clean |
Remove caches and generated files |
make images |
Build Docker images for agent containers |
| Command | What it does |
|---|---|
make spacetimedb-up |
Start SpacetimeDB via Docker |
make spacetimedb-down |
Stop SpacetimeDB |
make spacetimedb-health |
Check if SpacetimeDB is running |
make spacetimedb-logs |
Tail SpacetimeDB logs |
make spacetimedb-reset |
| Command | What it does |
|---|---|
make langfuse-up |
Start Langfuse (LLM tracing) at :18786 |
make langfuse-down |
Stop Langfuse |
make langfuse-health |
Check Langfuse status |
| Command | What it does |
|---|---|
make webhook-setup |
Interactive webhook configuration |
make webhook-test |
Test webhook endpoint |
make webhook-status |
Show webhook configuration |
Bond kills stale processes on startup, but if you still get conflicts:
lsof -ti :18788 :18789 :18790 | xargs kill -9# Check if Docker is running
docker ps
# Try the simple compose (no network config)
make spacetimedb-simple-up
# Or start manually
docker run -d --name bond-spacetimedb -p 18787:3000 \
-v ~/.bond/spacetimedb:/var/lib/spacetimedb \
clockworklabs/spacetime:v2.0.2 start# Install golang-migrate with SQLite support
make install-migrate
# Check current migration version
make migrate-version
# Roll back one migration
make migrate-downRe-run the setup wizard:
make setupOr set the key directly in .env:
echo 'ANTHROPIC_API_KEY=sk-ant-...' >> .envcd frontend && pnpm install && pnpm buildbond/
├── backend/ # Python FastAPI backend
│ ├── app/
│ │ ├── agent/ # LLM orchestration, tools, memory
│ │ ├── api/ # REST API routes
│ │ ├── core/ # Vault, database, config
│ │ ├── sandbox/ # Code execution sandboxing
│ │ └── main.py # FastAPI app entrypoint
│ └── tests/
├── gateway/ # TypeScript WebSocket gateway
│ └── src/
├── frontend/ # Next.js web UI
│ └── src/
├── spacetimedb/ # SpacetimeDB module (TypeScript)
│ └── spacetimedb/
├── migrations/ # SQLite schema migrations
├── prompts/ # System prompt fragments
├── scripts/ # Setup & maintenance scripts
├── docs/ # Architecture docs & guides
├── docker/ # Dockerfiles for agent containers
├── bond.json # Primary configuration
├── Makefile # All commands live here
└── pyproject.toml # Python project config
make backend # Just the FastAPI server
make gateway # Just the WebSocket gateway
make frontend # Just the Next.js UImake test # All tests
uv run pytest # Python tests only
cd gateway && pnpm test # Gateway tests only
cd frontend && pnpm test # Frontend tests only# Create migration files
~/go/bin/migrate create -ext sql -dir migrations -seq <name>
# Edit the .up.sql and .down.sql files, then:
make migratePrivate — see repository for details.