Case study · 01
An AI companion that remembers across sessions, speaks in a consistent voice, and runs a layered narrative state — built and operated solo on a low-spec server.
Most companion AI products treat conversation as stateless. Each chat starts fresh, the character drifts, and there's no real sense of continuity. The interesting problem isn't whether a model can converse — it's whether a character can feel like a continuous presence across weeks of interaction, on a budget that fits a solo project.
Backend in FastAPI. Frontend in Next.js. PostgreSQL with pgvector for a multi-type memory layer: episodic memories, semantic facts, and diary entries — each retrieved with composite scoring at conversation time. Anthropic API for cognition, ElevenLabs for voice synthesis.
The character system is the differentiator. A canonical character bible defines voice, history, and behaviour phases. Memory retrieval is layered into the system prompt at runtime — recent context, relevant long-term memories, current narrative phase — so the model has the right state to respond in character without needing fine-tuning.
Quest and crisis subsystems run alongside conversation, gating which narrative beats unlock based on relationship state. Daily literary diary generation runs as a background job on a cheaper model tier.
pgvector over a managed vector DB — cost, data sovereignty, single Postgres instance for everything.Running in production. Survives unattended deploys via CI. The memory architecture supports the character maintaining continuity across months of interaction. The same patterns — layered memory, character-driven state, low-cost deployment — transfer cleanly to other companion, agent, and narrative AI projects.