Dev.to
7/5/2026

How I built an AI Dungeon Master that actually remembers what you did three sessions ago
Short summary
Built a Cognee-powered AI Dungeon Master that maintains narrative continuity across sessions through persistent memory graphs. Breakthrough: rewriting player action declarations as explicit canon queries improved recall accuracy from 8% to 100% using a simple Python template rewriter. Includes end-to-end implementation walkthrough, Groq token budget optimization, LLM backend testing across 23 models, and reproducible open-source setup.
- •Cognee graph-based memory maintains campaign continuity across D&D sessions via remember()/recall() APIs
- •Rewriting player actions as explicit canon lookups achieved 12/12 accuracy—deterministic Python template, not LLM
- •Complete reproducible implementation with local/cloud architecture swap, Groq token budgeting, and 23-model comparison
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



