Plausible plan for Roger. We’ll fix the details later — this is the shape of it, not the final wiring. The chats + brain % you see now are local-only toys.
Real chats on disk / DB, not the chats[] array in this page. List, open, new, search ā all via API.
That 62% number becomes real: brain_events + corrections. +2% per correction is a toy ā real one scores quality, not count.
One server endpoint that calls the LLM, streams tokens, and keeps the “state-of-the-today” personality. Browser never holds the API key.
“Tell me if I’m wrong” becomes POST /api/correction. Corrections are reviewed, then become training data ā not auto-trusted.
Users, free plan, usage limits. So your Roger isn’t everyone’s Roger, and your chats stay yours.
Filter bad corrections, rate-limit, log abuse. Roger learns from you, not from anyone shouting at him.
/api/*. WebSocket / SSE for streaming replies.GET /api/chats lists, GET /api/chat/:id reads, POST /api/chat creates. Messages append, never overwrite.POST /api/message saves your message, calls Roger, streams his reply back, saves that too.GET /api/brain returns %. POST /api/brain/event logs what Roger learned. No more brain = min(98, brain+2) in the browser.POST /api/correction {chat_id, message_id, correction} queues it for review. Approved = training data.GET /api/models returns Roger v0.0001 / v0.0002 / Pro. Switching models switches prompt + caps.| Piece | Files | Plausible effort |
|---|---|---|
| Server + chats API | server.ts, routes/chats.ts | ~2ā3 hrs |
| Messages + streaming | routes/messages.ts | ~2ā3 hrs |
| Brain + corrections | routes/brain.ts, routes/corrections.ts | ~2ā3 hrs |
| Auth + users + caps | auth.ts, db/* | ~3 hrs |
| Wire toy → real | roger-interface.html only | ~1 hr |
| Total | ~10 files | ~2 weekends |
CREATE TABLE users (id TEXT PRIMARY KEY, email TEXT, plan TEXT, created_at DATETIME); CREATE TABLE chats (id TEXT PRIMARY KEY, owner_id TEXT, title TEXT, model TEXT, created_at DATETIME); CREATE TABLE messages (id INTEGER PRIMARY KEY, chat_id TEXT, role TEXT, content TEXT, created_at DATETIME); CREATE TABLE corrections (id INTEGER PRIMARY KEY, chat_id TEXT, message_id INTEGER, correction TEXT, status TEXT, created_at DATETIME); CREATE TABLE brain_events (id INTEGER PRIMARY KEY, owner_id TEXT, kind TEXT, delta REAL, created_at DATETIME); CREATE TABLE models (id TEXT PRIMARY KEY, name TEXT, prompt TEXT, cap_per_day INT);
GET /api/chats -> [{id, title, model}]
GET /api/chat/:id -> {chat, messages[]}
POST /api/chat {title, model} -> 201 {id}
POST /api/message {chat_id, text} -> stream (SSE) Roger reply
POST /api/correction {chat_id, message_id, correction} -> 202 queued
GET /api/brain -> {pct, events[]}
GET /api/models -> [{id, name}]
Template only ā chats + brain above are still local-only until this is wired.