DEV Community

Cover image for Recall - An AI Mystery Game built with Cognee and Ollama
Yash Jadhav
Yash Jadhav

Posted on

Recall - An AI Mystery Game built with Cognee and Ollama

Alright, so I had this idea of letting AI (not just LLM but maybe more than that) decide world generation, dialogue and actions of NPCs so that a game could feel more natural, it's like you are actually interacting with game.

So...this is my first and very small attempt towards it with Cognee and Ollama.

Recall is a terminal-based AI mystery game where you play as a detective investigating a murder. Your goal is to figure out the real killer by questioning suspects and piecing together their stories.

Check out the code here at Github which includes how to set it up and play:

GitHub logo lightsigma96 / Recall

A terminal mystery game where the truth isn't written β€” it's remembered. Talk to NPCs with real, persistent memory and piece together who did it, with no fixed script to follow.

Recall

An AI-driven murder mystery terminal game where every run creates a new story, suspects, killer, and conversations.

Players investigate by talking to NPCs. NPCs remember previous conversations, react dynamically, and provide clues based on the generated mystery.

Cognee Python Rich

Recall Title Recall Game Screen

Features

  • AI-generated murder mystery stories
  • Dynamic NPC personalities and conversations
  • Persistent NPC memory system
  • Procedurally selected killer and clues
  • Terminal-based interactive UI
  • Local (ollama) and cloud (Gemini) LLM support

How It Works

  1. A new world and murder mystery are generated.
  2. NPCs are created with unique personalities and knowledge.
  3. Players interrogate NPCs.
  4. Conversations are stored in memory.
  5. Player uses gathered information to accuse the killer.





















Game Stage Cognee Cloud API How Recall Uses It
NPC memory creation /api/v1/remember Stores each NPC's personality, secrets, relationships, and crime knowledge into a dedicated memory dataset
Memory isolation Cognee datasets Creates a separate dataset for every NPC (npc_name_ds) so suspects only know their own memories
…








Building Memory of NPC

The main theme of this hackathon was memory.

An LLM only answer to the question prompted and does not retain any context.

For Recall every NPC has their own persistent memory powered by Cognee.

Whenever you interact with NPC, using cognee.recall() cognee searches through that NPC's existing memories and retrieves the most relevant information from their past interactions and initial backstory.

This information is used to answer player's question, once answered cognee.remember() is used to update that NPCs memory graph.

It's like Cognee is the brain and LLM is the mouth.

Answer generation of NPC

Every NPC has their own cognee dataset, which is created directly by calling cognee.remember() for initializing memory with some initial memory of incident, like where was the NPC when incident occurred, what were they doing and what do they know about the incident.

Additionally during initialization of NPCs each one is given a unique name, personality, and work.

The Whisper Feature

This is an experimental feature where NPCs can randomly interact with each other during the game and exchange memories.

The idea was to make the world feel more alive, where characters don't only react to the player but also influence each other.

This also means the criminal could eventually learn what questions you have been asking other NPCs and adapt accordingly.

I was able to build the core logic for this feature, but due to time constraints I couldn't fully integrate it into the game. The implementation can still be found in the codebase.

Game Setting

I wanted the themes to lean more towards mystery and detective settings, where the environment itself contributes to the investigation.

Initially I wanted to have 4 biomes/setting but again due to time constrain I was only able to add 2.

The story is generated by AI, so memory of every NPC and the story will be different on every playthrough, the only thing which is fixed is the setting of the game.

The 2 biomes are:

  • Victorian England which brings classic detective experience inspired by Sherlock Holmes, includes old buildings and characters.

  • Forest creates a more isolated and mysterious environment, surrounded by wilderness where every character has their own secrets hidden deep within the woods.

Cognee Cloud

We were provided with $35 of free cloud credits and it was really helpful.

Initially, Recall was running completely locally using Cognee along with an Ollama model. While this worked, running both memory operations and model inference locally became slow and resource-intensive, especially without access to high-end compute.

With cloud credits I could increase the speed of memory ingestion and recall.

Also it fixed a compatibility issue that I was having with a local ollama model by providing cloud-hosted infrastructure.

Making ASCII ARTS

Making ASCII Art seemed interesting at first but then quickly became a bottleneck as subtleties started surfacing.

I was using an image to ASCII converter so finding the right image is also an important task.

So for an ASCII art to look good it needs to have a lot of characters, and fitting them within a panel with other panel like Chat panel and header panel obviously meant decreasing the character count.

So I went ahead and did that, I reduced character count to 20, lowest I could go.

I was able to find correct images which were more expressive and different making them still comprehensible even with just 20 characters.

Well this did give a better look to the game.

Also this was the bottleneck due to which I could only make 2 levels and not 4.

ASCII Showcase

Some ASCII Arts...they are comprehensible and there's the overflow I was talking about

Use of AI

Obviously, AI was also part of the development process.

Most of the code was handwritten, and the overall game design, architecture, and ideas were created by me. However, I used AI tools to speed up development when I wanted to quickly experiment, debug issues, or iterate on certain parts of the project.

For this project, I used ChatGPT and Claude through their websites, without any coding agents or external development harnesses, I don't have those :(

Ending

Recall is nowhere close to a complete game, but it represents an idea I wanted to experiment with, making NPCs feel less scripted and more alive.

Games can be much more fun when they feel more natural, interactive, and NPCs don't forget what they just said to you and how you interacted with them.

This was my first attempt at exploring that idea using Cognee and LLMs, and I am excited to see how far this approach can go.

Top comments (0)