marauder-actual a783da7415 refactor: drop dead sidecar, cart becomes source of truth for persona
The sin:4098 sidecar service has been dead since the last reboot, and the
real binding mechanism is the chat-persona.ts opencode plugin (now in
madcat-plugin) that reads the operator cart file directly. The sidecar
HTTP round-trip was vestigial.

Changes:
- Remove SIDECAR_URL env, _sidecar_get_binding(), _sidecar_bind(),
  _session_id_for_user() — all dead code paths.
- Add _slug_from_cart(cart): derives canonical PERSONAS slug from a cart's
  persona_name (case-insensitive) or voice prefix fallback.
- Simplify _pick_system_prompt(cart): cart.system_prompt (calibrated) →
  BT default. No more sidecar override layer.
- / route: bound_slug from _slug_from_cart(cart) instead of sidecar lookup.
- /api/persona POST: mutates the cart file in-place (preserves calibrated
  UI prefs), creates a minimal cart for fresh operators. The opencode plugin
  re-reads the cart on every turn, so switches take effect on the very next
  message — no session reconnect.
- /api/persona/current GET: reads from cart, returns {slug, display, voice,
  bound}.
- WS handler: re-loads cart at the start of each turn for live persona
  switching; voice falls back cart.voice → TTS_VOICE.

Operator cart at /home/madcat/.local/share/chat-saiden/operators/<email>.json
is now the single source of truth.
2026-05-29 22:54:45 +02:00

chat.saiden.dev

A quiet channel. Spike Jonze's Her (2013) as a chat UI.

chat.saiden.dev
  → Caddy reverse-proxy (TLS via Let's Encrypt)
  → FastAPI on marauder.saiden.dev:8765
      ├─ Google OAuth (authlib) + email whitelist
      └─ WebSocket → Anthropic API streaming

Status

Phase 3 — Her-aesthetic. UI plan in UI-PLAN.md. Phase 1 (ttyd + CF Tunnel) archived in _archive-ttyd/.

Local dev

cd ~/Projects/chat-saiden
uv sync
cp .env.example .env
# fill in ANTHROPIC_API_KEY, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, COOKIE_SECURE=false
uv run python -m app.main
# → http://127.0.0.1:8765

Google OAuth redirect URI for local dev (add to your Google Cloud Console OAuth client): http://127.0.0.1:8765/auth/callback

Files

Path What
app/main.py FastAPI: OAuth, session, WS streaming, Anthropic client
app/templates/chat.html Single-page UI (chat + operator prompt)
app/templates/denied.html Whitelist-rejection page, Her-styled
app/static/chat.css Design system: warm pastels, Cormorant + Caveat
app/static/chat.js WebSocket, typewriter queue, label dedup, smooth scroll
pyproject.toml uv deps
.env.example env scaffold
UI-PLAN.md Design doctrine (Her aesthetic translated to chat)
_archive-ttyd/ Phase 1 (ttyd + CF Tunnel + CF Access) — kept for reference

Deployment

Not deployed yet. Stages remaining:

  1. Caddyfile on marauder.saiden.dev (reverse proxy chat.saiden.dev → :8765)
  2. systemd unit for the FastAPI app
  3. DNS swap: chat.saiden.dev CNAME → marauder.saiden.dev (currently broken — points to deleted CF tunnel from Phase 1)
  4. Google OAuth client production redirect URI: https://chat.saiden.dev/auth/callback
  5. Smoke test live

Persona

System prompt currently hardcoded as BT-7274 (placeholder). Will swap to a dedicated Samantha cart when authored — see EEMS subject project.samantha-cart.

S
Description
Web chat interface with persona calibration, SSE streaming, and real-time TTS playback.
Readme 182 KiB
Languages
Python 65.5%
JavaScript 12.3%
CSS 12.1%
Shell 6.2%
HTML 3.9%