Idea · Jul 2, 2026
Persistent NPC Memory Engine
Students build a conversational game NPC with retrievable long-term memory: every player dialogue turn is embedded and stored in Supabase pgvector so the NPC can recall specific past events, form evolving opinions about the player, and exhibit measurable persona drift across extended sessions.
What it would do
Students design and implement a conversational game NPC (shopkeeper, quest giver, or villain) that maintains a persistent memory of every past conversation with a player. Each dialogue turn is embedded via the Claude API and stored in Supabase pgvector. When the player speaks, the NPC retrieves the three most semantically similar past memories via cosine similarity, injects them into the system prompt, and generates a response that references or reacts to prior events. Students also implement a lightweight 'persona state' vector tracking trust, curiosity, and hostility levels toward the player, updated after each exchange using sentiment classification. The assignment culminates in a controlled comparison: students test their NPC with (a) RAG retrieval memory, (b) rolling summarization memory, and (c) no memory, then write a reflection on narrative coherence, response latency, and token cost across the three strategies.
Key features
- Every dialogue turn embedded with Claude API and stored in Supabase pgvector; retrieval via cosine similarity
- Persona state vector (trust, curiosity, hostility) updated per exchange using sentiment classification
- Three memory strategies to implement and compare: RAG retrieval, rolling summarization, sliding window
- Simple web frontend to play as the player and inspect the NPC's current memory store and persona state in real time
- Written reflection comparing strategies on narrative coherence, latency, and API token cost