# boocode

Self-hosted coding workspace for local and hosted models. 4-app monorepo: BooChat (chat + tools), BooCoder (write tools + agent dispatch), BooTerm (PTY terminals), and BooControl (fleet cockpit for llama-swap hosts), plus the in-app **Orchestrator** for bounded multi-agent analysis/review flows.

**Latest tag:** `v2.8.30-main-sync` (2026-06-17) · [`CHANGELOG.md`](CHANGELOG.md) · **Current focus:** [`CURRENT.md`](CURRENT.md)

**Architecture:** [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) · **Engineering reference:** [`CLAUDE.md`](CLAUDE.md) · **Roadmap:** [`boocode_roadmap.md`](boocode_roadmap.md)

## Stack

- Node 20, Fastify, postgres (porsager/postgres), ws, zod
- React 18, Vite, TypeScript, Tailwind v4, shadcn/ui
- Postgres 16
- pnpm workspaces

## Layout

- `apps/server` - Fastify API + WebSocket + inference loop + file-read tools
- `apps/web` - React frontend; served by Fastify in production, Vite in dev
- `apps/booterm` - Fastify + node-pty + tmux for in-browser terminal panes
- `apps/coder` - Fastify write tools + ACP/PTY dispatcher + MCP server (BooCoder)
- `apps/control` - Fastify fleet control service for llama-swap hosts (BooControl)

## Local dev

Requires Node 20, pnpm, Docker (for Postgres), and ripgrep.

```bash
# install
pnpm install

# bring up postgres only
cp .env.example .env
# edit POSTGRES_PASSWORD if you like; default DATABASE_URL points at the container
docker compose up -d boocode_db

# run server (port 3000) and web (port 5173) in two shells
DATABASE_URL=postgres://boocode:devpass@127.0.0.1:5500/boochat \
LLAMA_SWAP_URL=http://100.101.41.16:8401 \
pnpm dev:server

pnpm dev:web
```

The Vite dev server proxies `/api` and `/api/ws/*` to the Fastify backend with a
synthetic `Remote-User: sam` header so the Authelia auth layer can be skipped
during development.

## Production

```bash
cd /opt/boocode
docker compose up --build -d
```

Binds to `100.114.205.53:9500` (Tailscale). Authelia is expected to gate the
upstream and inject `Remote-User`. Postgres binds loopback only.

BooCoder runs as a **host systemd service** (`boocoder.service`, port `:9502`), not in Docker:

```bash
pnpm -C packages/contracts build && pnpm -C apps/server build && pnpm -C apps/coder build
sudo systemctl restart boocoder
curl http://100.114.205.53:9502/api/health
```

## Services

|Service|Port|Description|
|---|---|---|
|BooChat|`100.114.205.53:9500`|Read-only chat + SPA |
|BooTerm|`100.114.205.53:9501`|PTY/tmux terminal panes |
|BooCoder|host:9502|Write tools + agent dispatch + MCP server (systemd service, not Docker) |
|BooControl|host:9503|Fleet cockpit, gateway, bench/evals/jobs, SSH config, reports |
|Postgres|`127.0.0.1:5500`|Shared database (`boochat`; Docker service `boocode_db`) |
|boocontext|MCP (via BooCoder)|Tree-sitter code analysis (summary, scan, symbols, callgraph, types, health) |

## What's shipped

See [`boocode_roadmap.md`](boocode_roadmap.md) and [`CHANGELOG.md`](CHANGELOG.md) for full version history. Highlights as of **2026-06-17**:

- **BooChat**: streaming chat, file-read tools, compaction, reasoning support, artifact panes, MCP client, memory tools, skills system, multi-pane workspace, and the state-graph/supervisor inference architecture.
- **BooTerm**: in-browser terminal panes via tmux + xterm.js, session metadata, and PTY search over buffered output.
- **BooCoder**: write tools with staged `pending_changes`, files/git diff review, provider snapshot + lifecycle controls, warm ACP/OpenCode/Claude backends, persistent agent sessions, Arena comparisons, MCP server support, and boocontext-backed code analysis.
- **BooControl**: live fleet cockpit for llama-swap hosts with gateway routing, jobs/bench/evals streams, reports, host perf history, SSH config editing, and HuggingFace model-pull management.
- **Orchestrator**: bounded multi-agent research/review/investigation flows with resumable runs, workflow catalog support, and read-only execution on local models.

## Planned

Most prior roadmap milestones have shipped (see [`boocode_roadmap.md`](boocode_roadmap.md)). What remains is optional/exploratory - e.g. a verify-gate ensembler over pending changes (majority-vote diff ranking). No committed milestones currently in flight.

## License

MIT - see [`LICENSE`](LICENSE).
