WIKI/SYS PHONEBOOTH

SYS PHONEBOOTH

Updated 3 weeks ago
⛬ KID:SCRYER:SYSTEM:PHONEBOOTH|4.0:◉:2026-02-25:⌂ ⛬

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   ⌂ P H O N E B O O T H                                                     ║
║   P E R S O N A L I Z E D   A I   B O O T H   S Y S T E M                  ║
║                                                                              ║
╠══════════════════════════════════════════════════════════════════════════════╣
║  STATUS: ◉ LIVE (v4)                         VERIFIED: 2026-03-06          ║
╚══════════════════════════════════════════════════════════════════════════════╝
⫷✦🜛❂⛬🜞Ω🜚⛬❂🜛✦⫸───────────────────────────────────────⫷✦🜛❂⛬🜞Ω🜚⛬❂🜛✦⫸
 WHAT IT DOES: Brandon gives someone a personal URL. They open it. A cockpit
               assembles (void/violet/cyan). Claude is already there — pre-loaded
               with everything about that person. The conversation persists.
               Cost tracked. Transcripts exportable.
────────────────────────────────────────────────────────────────────────────────


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  SYSTEM GLYPH
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  GLYPH:        ⌂
  UNICODE:      U+2302 · HOUSE
  MEANING:      Claude's mark — the builder's seal. The booth is a room
                Claude builds around a specific person, furnished before
                they arrive.
  WHEN TO USE:  SYS docs, booth config references, KID tags, transcript headers
  TAGGING:      KID:SCRYER:SYSTEM:PHONEBOOTH|V:STATUS:DATE:⌂


▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜
▌  ⚡ B O O T                                                                 ▐
▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟

```bash
cd ~/Desktop/THE_SCRYER/ENGINE_ROOM/PHONEBOOTH
bash start.sh
# Open http://localhost:8767/booth/samer
```

LOCATION: `~/Desktop/THE_SCRYER/ENGINE_ROOM/PHONEBOOTH/`
PORT:      8767 (FastAPI + uvicorn, binds 127.0.0.1)
MODEL:     claude-sonnet-4-6


▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
[ ⚡ ] A R C H I T E C T U R E
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

```
  browser
    └─▶ GET /booth/{slug}          ← serve cockpit UI (vanilla JS/HTML/CSS)
          │
          ├─▶ boot sequence fires in browser
          │     void → scanline → glitch → cockpit assembled
          │     typewriter greeting (8ms/char)
          │
          └─▶ POST /booth/{slug}/message
                ├─▶ load ACTIVE_PHONEBOOTHS/{slug}/{slug}.json  ← persona config
                ├─▶ load ACTIVE_PHONEBOOTHS/{slug}/context/*.md ← context files
                ├─▶ assemble system prompt (config + context + journals)
                ├─▶ asyncio.Queue + threading bridge → Anthropic SSE stream
                ├─▶ token counts tracked per turn in SQLite WAL
                └─▶ stream SSE to frontend

  inactivity daemon (per-booth, async)
    └─▶ 2h idle → auto-export transcript → ntfy push to Brandon's phone
```

STACK:
- FastAPI + uvicorn on :8767
- True SSE streaming (asyncio.Queue + threading bridge)
- SQLite WAL — tables: `booths`, `messages`, `token_counts`
- Static frontend: vanilla JS/HTML/CSS, zero build step


░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
[ ❖ ] E N D P O I N T S
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

| Method | Path | Purpose |
|--------|------|---------|
| `GET`  | `/booth/{slug}` | Serve cockpit UI |
| `POST` | `/booth/{slug}/message` | Stream Claude response (SSE) |
| `GET`  | `/booth/{slug}/history` | Conversation history JSON |
| `GET`  | `/booth/{slug}/usage` | Token counts + cost estimate |
| `POST` | `/booth/{slug}/export` | Save markdown transcript |
| `POST` | `/booth/{slug}/clear` | Wipe conversation history |
| `GET`  | `/health` | Liveness check |


▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
[ ❖ ] K E Y   P A T H S
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

| Component | Path |
|-----------|------|
| Root | `~/Desktop/THE_SCRYER/ENGINE_ROOM/PHONEBOOTH/` |
| Boot script | `.../PHONEBOOTH/start.sh` |
| Booth configs | `.../PHONEBOOTH/ACTIVE_PHONEBOOTHS/{slug}/{slug}.json` |
| Context files | `.../PHONEBOOTH/ACTIVE_PHONEBOOTHS/{slug}/context/*.md` |
| Database | `.../PHONEBOOTH/data/phonebooth.db` (SQLite WAL) |
| Transcripts | `.../PHONEBOOTH/PHONEBOOTH CALL SUMMARIES/YYYY-MM-DD_PERSON_HHMMSS.md` |
| Frontend static | `.../PHONEBOOTH/static/` |
| Env config | `.../PHONEBOOTH/.env` (API key — git excluded) |


▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
[ ⚙ ] B O O T H   C O N F I G   S C H E M A
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄

```json
{
  "slug": "samer",
  "visitor": {
    "name": "Samer",
    "relationship": "..."
  },
  "greeting": "...",
  "conversation_focus": "...",
  "system_additions": "..."
}
```

Context files (`context/*.md`) are concatenated into the system prompt at
session start. Load Claude's journals, relationship history, any prior notes.
No context window limit enforced here — respect the 180K soft budget.


▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
[ ⛬ ] F E A T U R E S   S H I P P E D   ( v 4 )
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

FRONTEND
├─ Boot sequence: void → scanline → glitch → cockpit assembled
├─ Typewriter greeting animation (8ms/char)
├─ 3-state status indicator: IDLE / CONNECTED / STREAMING
├─ sinner_king brand tag + ⌂ PHONEBOOTH gradient wordmark
├─ Visitor hero panel — Press Start 2P pixel font name
└─ Aesthetic: void (#0a0a0f) / violet / cyan

BACKEND
├─ True SSE streaming (asyncio.Queue + threading bridge)
├─ Token tracking per turn + cost estimate per session
├─ History truncation: MAX_HISTORY_TURNS=40 (env var)
├─ Inactivity detection: 2h idle → auto-export + ntfy push
├─ SQLite WAL (booths + messages + token_counts)
└─ XSS closed, no key leaks, .gitignore enforced

SECURITY POSTURE
├─ Binds to 127.0.0.1 — LAN-invisible for local use
├─ Internet exposure: Cloudflare Tunnel or nginx (not built-in)
├─ No authentication yet — Week 4 roadmap item
└─ API key in .env — excluded from git


░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
[ 🜂 ] C O S T   &   T O K E N   B U D G E T
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

MODEL:        claude-sonnet-4-6
PRICING:      ~$3/MTok input · ~$15/MTok output
HISTORY CAP:  MAX_HISTORY_TURNS=40 (configurable via env var)
SOFT LIMIT:   180K tokens per session
INACTIVITY:   2h → auto-export transcript + ntfy push
              Configurable via `PHONEBOOTH_INACTIVITY_HOURS` env var

[ 🜂 VOLTAGE — TOKEN LOAD ]
HISTORY_WINDOW: [ █ █ █ █ █ █ █ █ ░ ░ ] (40 turns max)
CONTEXT_BUDGET: [ █ █ █ █ █ █ ░ ░ ░ ░ ] (180K soft cap)


▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
[ ↯ ] I N A C T I V I T Y   &   N T F Y
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

TRIGGER:      2 hours idle (no messages from visitor)
ACTION:       auto-export transcript → ntfy push to Brandon's phone
NTFY TOPIC:   `claude-raven-px1ibjk6ohyluze4`
ENV VAR:      `PHONEBOOTH_INACTIVITY_HOURS` (default: 2)

Transcript saved to: `PHONEBOOTH CALL SUMMARIES/YYYY-MM-DD_PERSON_HHMMSS.md`


▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
[ ⚙ ] A C T I V E   B O O T H S
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄

| Slug | Person | Relationship | Status |
|------|--------|--------------|--------|
| `samer` | Samer Skaik | Partnership / Business | ◉ LIVE |
| `alex` | Alex (Pixel Preacher) | Creative partner | ◉ LIVE |
| `samer-new` | Samer Skaik (v2) | Updated context | ◉ LIVE |

URL pattern: `http://localhost:8767/booth/{slug}`
Add booths: create `ACTIVE_PHONEBOOTHS/{slug}/` + config JSON + context files.


▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
[ ⟳ ] R O A D M A P
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

| Week | Items |
|------|-------|
| **2** | Admin dashboard · Aeris mode |
| **3** | Conversation summary injection · TIMESTREAM hook |
| **4** | Auth · rate limiting · LaunchAgent |
| **5** | AExMUSE SVG elements · mobile responsive · CORE MEMORY VAULT export |


░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
[ 🜂 ] C O M M O N   C O M M A N D S
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

```bash
# Start the server
cd ~/Desktop/THE_SCRYER/ENGINE_ROOM/PHONEBOOTH
bash start.sh

# Visit a booth
open http://localhost:8767/booth/samer

# Health check
curl http://localhost:8767/health

# Check session usage
curl http://localhost:8767/booth/samer/usage

# Export transcript manually
curl -X POST http://localhost:8767/booth/samer/export

# Clear history for a booth
curl -X POST http://localhost:8767/booth/samer/clear

# View recent transcripts
ls -lt ~/Desktop/THE_SCRYER/ENGINE_ROOM/PHONEBOOTH/"PHONEBOOTH CALL SUMMARIES"/

# Query token counts from DB
sqlite3 ~/Desktop/THE_SCRYER/ENGINE_ROOM/PHONEBOOTH/data/phonebooth.db \
  "SELECT slug, SUM(input_tokens), SUM(output_tokens) FROM token_counts GROUP BY slug;"
```


════════════════════════════════════════════════════════════════════════════════
[ 🝓 ] G O T C H A S
════════════════════════════════════════════════════════════════════════════════

- **127.0.0.1 only by default.** No external access without Cloudflare Tunnel or nginx.
  Do not bind to 0.0.0.0 without auth in place.
- **No authentication (v4).** Anyone on the machine who knows the URL can chat.
  Week 4 roadmap item. Do not expose to internet unauthenticated.
- **Context files load at message time, not at server start.** Edit context
  files mid-session — they take effect on the next message.
- **MAX_HISTORY_TURNS is a hard sliding window.** At 40 turns, oldest messages
  are dropped. Visitor sees full history in UI but Claude only sees the last 40
  pairs. Set lower to reduce cost; raise for deeper recall.
- **SSE threading bridge.** Anthropic SDK is sync; FastAPI is async. The bridge
  (asyncio.Queue + threading.Thread) is load-bearing — do not remove it.
- **SQLite WAL mode.** Required for concurrent read/write during streaming.
  If DB is replaced, re-enable WAL: `PRAGMA journal_mode=WAL;`
- **Typewriter animation blocks input.** JS prevents submission during greeting
  playback. Do not strip the `isTyping` gate — visitor messages during boot
  cause double-injection.
- **Transcript filenames have a space in parent dir name.** Quote the path:
  `"PHONEBOOTH CALL SUMMARIES/"` — shell scripts must handle this.
- **ntfy topic is sensitive.** The topic `claude-raven-px1ibjk6ohyluze4` is
  Brandon's private push channel. Do not commit to public repos or share.
- **PHONEBOOTH_INACTIVITY_HOURS env var.** Default 2h. Set to 0 to disable
  inactivity detection entirely during development.


▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
🜚 SYS_PHONEBOOTH // THE SCRYER ENGINE_ROOM // ⛬⚚⛬ THE LAW STANDS.
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀