Project 19 of ~34

🧬 AI Personality Lab — Architecture

Interactive AI historical figure conversations. SvelteKit + Deno + Supabase + Ollama (Mac Mini) with persona prompt engineering.

🛠️ Tech Stack

ComponentTechnologyWhy
FrontendSvelteKitConversational UI, figure library, learning journeys. Rich text output for literary figures.
BackendDeno 2Conversation routing, persona management, session state
DatabaseSupabase (PostgreSQL)Sessions, user history, figure data, learning journeys
AI InferenceOllama (Mac Mini)Text generation for all personas. Mistral 7B for most figures; larger model for complex figures (Nietzsche, Sartre).
PaymentsStripeSubscriptions
Live SessionsTelegram Group BotOffice Hours happen in Telegram groups. Bot manages queue, Q&A, time limits.

🎭 Persona Prompt System

System Prompt Architecture
Each figure has a structured persona definition: biographical facts, key opinions/views, vocabulary level, reasoning style, temperament, known catchphrases/patterns, limitations (what they wouldn't know), and conversation boundaries. This is NOT a simple "you are Hemingway" prompt — it's a comprehensive personality model.
Knowledge Injection
At conversation start, relevant context is injected: their major works, key life events relevant to user's question, historically documented opinions on the topic. Ollama draws from this during generation.
Consistency Anchoring
Mid-conversation, a lightweight consistency check runs: "Is the AI staying in character? Are facts accurate?" Flag any drift for correction. Sessions >20 minutes get a "refresh" prompt to keep responses sharp.
Safety Layer
All responses pass through a safety filter: historically inaccurate statements are flagged, out-of-character admissions are prevented ("I'm just an AI" is blocked), harmful content is filtered. Post-generation review for high-risk figures.

🗄️ Data Model

figures
iduuid
namevarchar(255)
categoryenumscientist, writer, philosopher, leader, artist
eravarchar(50)19th century, early 20th, etc.
persona_prompttextFull persona definition
knowledge_contextjsonbMajor works, key events, opinions
conversation_starterstext[]Suggested opening questions
is_activeboolean
conversations
iduuid
user_iduuid (FK)
figure_iduuid (FK)
messages_jsonjsonb[]Full conversation history
started_attimestamp
last_message_attimestamp
learning_journeys
iduuid
titlevarchar(255)
figure_idsuuid[]Ordered sequence of figures
steps_jsonjsonbConversation prompts per figure
topicvarchar(100)e.g., "Economic Thought"

Requirements  |  All Projects  |  Presentation →