Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OpenClaw Agent Basecamp

A private, OpenClaw-native web app for working with a roster of agents in a Discord-like interface: a room per agent, persistent threads, browser voice notes, per-agent voices, and live realtime calls.

The idea: a shared canvas

Most chat UIs treat the agent as something you send messages to. This one is built as a shared canvas — a single surface the operator and their agents both write to, where either side can put something down and the other can pick it up.

In practice that means the conversation isn't only text going one direction:

  • Agents post into the room, not just reply. During a live voice call, Karma can drop a formatted SQL snippet or a diagram into the chat mid-sentence and keep talking about it; Senua can post a CV bullet or a STAR answer the same way. The spoken channel and the written canvas stay in sync.
  • Artifacts become first-class. When an agent generates a file, it references it as a MEDIA: marker; the server imports it into a hardened media store and rewrites it to /api/media/<uuid>, so a generated chart or audio clip renders inline in the room instead of living as a path on some disk the browser can never see.
  • Work leaves the canvas and persists. Notes go to Craft, career files to Nextcloud, tasks to Plane — written by the agent, from the conversation, without the operator leaving the room.
  • The operator stays in the loop. Tool calls surface as cards, an action queue holds approvals, and a gateway status panel shows what's actually running.

The goal is one place where thinking gets done together, rather than a chat window bolted onto an agent runtime.

Rooms

Seven live rooms, three reserved:

Room Agent Voice Focus
main Kara 🌙 marin Primary partner / coordinator
karma Karma 📚 sage Learning coach — data, SQL, Python
senua Senua 🧭 shimmer Career, CV, interview strategy
killjoy Killjoy 🛠️ — Coding runtime
ekko Ekko 📈 ash Analytics
sova Sova 🛡️ — Security
vayne Vayne 🕶️ — Recon
alhaitham Alhaitham 🪶 — Reserved
wayfinder Wayfinder 🧳 — Reserved
ops Yelan 💧 — Reserved (homelab/ops)

Reserved rooms are read-only: the composer is disabled, and send / stream / history return 403 at the API layer. Realtime voice calls are enabled for Kara, Karma, and Senua.

Rooms are editable at runtime — /admin/agents writes display name, emoji, avatar, voice, and status overrides to .basecamp-data/agent-overrides.json, so the roster isn't a code change.

What works today

Chat. Each room sends to its own canonical session key (agent:<agentId>:basecamp-local), so every agent has an independent persistent thread. /api/chat/stream streams started / delta / end / aborted / error over SSE; the composer renders tokens as they arrive with a stop button wired to /api/chat/abort. The non-streaming /api/chat/send is kept for callers wanting a single final response.

Voice. Browser-native record → upload → transcribe → send → reply → TTS, designed to beat Telegram round-trip latency. Per-agent voices, with [[tts:...]] markers stripped before rendering or speaking.

Realtime calls. Server-minted OpenAI Realtime sessions with a live tool surface: time, memory notes, Craft search/create/append, Nextcloud career files, Plane issues, and the post-to-chat tools that make the canvas shared. Calls end with a structured recap — key learnings, weak spots, practice assigned, next lesson.

Slash commands. Two layers: Basecamp-local commands handled in-app, and the Gateway/OpenClaw catalog discovered at runtime via commands.list. Both appear in the palette; //hello is the literal-slash escape.

Uploads. Magic-byte sniffing via file-type rejects MIME-spoofed binaries, SHA-256 content hashing dedupes re-uploads, and a 1 GB store quota (BASECAMP_MEDIA_STORE_MAX_BYTES) caps growth.

Auth, independent of the Gateway. The browser holds only a signed basecamp_session cookie (HMAC-SHA256). Pluggable provider in lib/auth/config.ts: OIDC when the four OIDC vars are set, dev password as an explicitly-enabled fallback. middleware.ts redirects unauthenticated /rooms/* to /login?next=… and 401s unauthenticated API hits. Public paths: /login, /api/auth/*, /api/healthz, /_next/*. See docs/AUTH.md.

Strict CSP in production. Middleware emits a per-request policy with a fresh nonce plus 'strict-dynamic' for script-src; production carries no 'unsafe-inline' or 'unsafe-eval' for scripts. Dev keeps the relaxed policy so HMR works. BASECAMP_DISABLE_CSP_MIDDLEWARE=1 falls back to the static policy in next.config.mjs for an emergency rollback.

Mock mode. With OPENCLAW_GATEWAY_PASSWORD unset, every chat call short-circuits at the API layer and returns [mock · <agent>] echo: .... The mode is reported in the response body and shown in the composer footer, so it can't be mistaken for a live reply — the whole UI stays demo-able without credentials.

Security posture

The browser never receives Gateway credentials. OPENCLAW_GATEWAY_PASSWORD is read only in lib/openclaw-client.ts, BASECAMP_* secrets only in lib/auth/* — all server-side. npm run verify:no-secret greps the built client bundle for both the names and values of every secret env var and fails the build on a hit.

This repo is intentionally not the live OpenClaw Control UI. It runs beside an existing deployment without touching live OpenClaw config, nginx, systemd, or secrets.

Layout

app/
├── admin/agents/page.tsx              # runtime agent roster editor
├── api/
│   ├── actions/route.ts               # approval/action queue
│   ├── admin/agents/{,avatar}/route.ts
│   ├── agents/{,status}/route.ts      # roster + per-agent liveness
│   ├── auth/
│   │   ├── {login,logout,me}/route.ts
│   │   └── oidc/{start,callback}/route.ts
│   ├── chat/
│   │   ├── {send,stream,abort}/route.ts
│   │   ├── {history,context}/route.ts
│   │   └── {active,status,runtime}/route.ts
│   ├── commands/route.ts              # Gateway command catalog
│   ├── craft/karma-note/route.ts
│   ├── gateway/status/route.ts
│   ├── healthz/route.ts               # public probe + rate limit
│   ├── media/{[id],upload}/route.ts
│   ├── sessions/{,[sessionKey],title}/route.ts
│   └── voice/
│       ├── {transcribe,speak}/route.ts
│       └── realtime/{session,tool,message,summary}/route.ts
├── login/page.tsx
└── rooms/[agentId]/page.tsx
components/                            # RoomsShell, ChatRoom, Composer,
                                       # RealtimeCallButton, VoiceRecorder,
                                       # AgentAdminDashboard, ContextPanel, …
lib/
├── agents.ts / agent-config.ts        # static roster + runtime overrides
├── auth/{config,oidc,server,session}.ts
├── openclaw-client.ts                 # WS adapter, chatSendAndStream, chatAbort
├── openai-{realtime,speak,transcribe}.ts
├── craft.ts / senua-{env,nextcloud}.ts  # outbound integrations
├── media-store.ts / artifact-resolver.ts # uploads, dedupe, MEDIA: rewriting
├── slash-commands.ts / commands-catalog.ts
├── owner.ts                           # configurable operator identity
└── session-{key,store}.ts / active-runs.ts / types.ts
middleware.ts                          # auth gate + per-request CSP nonce

Stack

  • Frontend: Next.js App Router, React 19, TypeScript.
  • Backend: Next.js Route Handlers on the Node runtime, with one server-side OpenClaw Gateway WebSocket adapter.
  • Runtime: OpenClaw Gateway on loopback.
  • Storage: OpenClaw sessions/transcripts as source of truth; local JSON only for UI metadata and overrides.
  • Deployment: loopback service on port 14400 behind its own nginx vhost.

Running it

npm install
npm run typecheck
npm run build
npm run dev          # http://127.0.0.1:14400

Copy .env.example to .env.local and fill in what you need — every value is optional, and the app degrades to mock mode rather than failing. .env.local is gitignored.

Live mode

Read the Gateway password from ~/.openclaw/openclaw.json (gateway.auth.password):

OPENCLAW_GATEWAY_URL=ws://127.0.0.1:18789/
OPENCLAW_GATEWAY_PASSWORD=<paste from ~/.openclaw/openclaw.json>

Restart npm run dev after editing. Smoke test: open /rooms/main, send "ping, reply with one word". The optimistic bubble appears immediately and the reply lands when the Gateway returns its final chat event (typically 1–3 s). The composer footer should read transport · live gateway.

Backend probe: curl -s http://127.0.0.1:14400/api/healthz returns { ok: true, mode: "live" } once the WS handshake succeeds.

Validation

npm run typecheck
npm run build
npm run verify:no-secret   # fails if any secret reached the client bundle

What's next

Fix host-side Playwright/Chromium dependencies so mobile and desktop screenshots can be verified in CI, then continue UI/PWA polish and session ergonomics. See docs/ROADMAP.md and STATUS.md.

Read next

License

MIT — use it, fork it, ship it, commercially or otherwise. Attribution is the only requirement: keep the copyright notice and license text in copies or substantial portions. Contributing back is welcome but not expected.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages