🧠 Roger Brain
62%
@ to mention a file
Roger can make mistakes. He makes a lot of mistakes. Check important info. — tinyfiles.tv / Roger
Template · Proposed · Not connected

⬇ Backend — what a backend could look like

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.

At a glance

šŸ’¬ 1 — Chats + messages

Real chats on disk / DB, not the chats[] array in this page. List, open, new, search — all via API.

🧠 2 — Roger Brain

That 62% number becomes real: brain_events + corrections. +2% per correction is a toy — real one scores quality, not count.

šŸ¤– 3 — Roger engine

One server endpoint that calls the LLM, streams tokens, and keeps the “state-of-the-today” personality. Browser never holds the API key.

āœļø 4 — Corrections

“Tell me if I’m wrong” becomes POST /api/correction. Corrections are reviewed, then become training data — not auto-trusted.

šŸ‘¤ 5 — Auth + users

Users, free plan, usage limits. So your Roger isn’t everyone’s Roger, and your chats stay yours.

šŸ›”ļø 6 — Safety + moderation

Filter bad corrections, rate-limit, log abuse. Roger learns from you, not from anyone shouting at him.

What it’ll take, step by step

  • Step 1 — Server: Deno / Node server. Serves this page + /api/*. WebSocket / SSE for streaming replies.
  • Step 2 — Chats: GET /api/chats lists, GET /api/chat/:id reads, POST /api/chat creates. Messages append, never overwrite.
  • Step 3 — Messages: POST /api/message saves your message, calls Roger, streams his reply back, saves that too.
  • Step 4 — Brain: GET /api/brain returns %. POST /api/brain/event logs what Roger learned. No more brain = min(98, brain+2) in the browser.
  • Step 5 — Corrections: POST /api/correction {chat_id, message_id, correction} queues it for review. Approved = training data.
  • Step 6 — Models: GET /api/models returns Roger v0.0001 / v0.0002 / Pro. Switching models switches prompt + caps.

Effort — plausible, will fix later

PieceFilesPlausible effort
Server + chats APIserver.ts, routes/chats.ts~2–3 hrs
Messages + streamingroutes/messages.ts~2–3 hrs
Brain + correctionsroutes/brain.ts, routes/corrections.ts~2–3 hrs
Auth + users + capsauth.ts, db/*~3 hrs
Wire toy → realroger-interface.html only~1 hr
Total~10 files~2 weekends

Tables — proposed

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);

API — proposed

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}]
šŸ› ļø Fix later — open questions: Which LLM powers Roger? Does learning persist per-user or global? Who reviews corrections? What stops a bad correction from teaching Roger the wrong thing? What’s the per-user cost cap? None decided — modal is the placeholder until we pick.

Template only — chats + brain above are still local-only until this is wired.