Inspiration
Most mystery games limit you to fixed dialogue choices. We wanted witnesses you can ask anything, and a game where the hard part is social: what do you share with your friends, whose account do you trust, and which evidence is actually proof?
What it does
Alibi AI is a three-player cooperative mystery. The first adventure, The Last Signal, is set at a research station where the lights go out for ninety seconds and a valuable scanner disappears. Three people had access, and each gives an alibi.
- Private perspectives. Three roles (Systems analyst, Records specialist, Field investigator) each hold two clues nobody else can see until the owner chooses to share them.
- AI witnesses with limited knowledge. Two witnesses answer free-text questions. Each only knows its own facts, separated into what it observed, what it believes, and what it doesn't know. Ask something outside that and the witness says so instead of inventing an answer.
- Evidence archive. Players search the evidence they are allowed to see, and every result links back to its source clue.
- PayPal purchase. One host buys the adventure through PayPal. Friends join with a room code and don't pay.
- Accusation and reveal. The host submits one final accusation. The reveal shows the true timeline and explains which evidence was strong and which was weak (a badge scan or a jacket colour is not proof).
- Solo demonstration mode. A free, clearly labelled mode that shows all three files so one person can try the whole case.
How we built it
- Backend: Node.js with its built-in HTTP server and built-in SQLite. No npm dependencies.
- Frontend: plain HTML, CSS and JavaScript.
- The server owns the truth. The solution, permissions, payment status and game phases are decided by ordinary code. The AI only phrases facts it is allowed to use. The solution is never sent to a model.
- Restricted witness knowledge. Each witness prompt contains only that witness's fact sheet. The model must reply in JSON that names the fact IDs it used. Replies with bad structure, over-long answers or invented fact IDs are rejected, not shown. Player questions are treated as untrusted input, length-limited and rate-limited.
- Permission-aware archive. Keyword retrieval (not semantic search) runs only over clues the player can see, before anything reaches the model. The AI summary's citations are validated.
- PayPal (sandbox). The server creates the order at a server-controlled price and captures it. It then re-reads the order from PayPal and checks the status, capture, amount, currency and room before unlocking anything. A browser success message alone never grants access. Repeated requests cannot create duplicate purchases. A verified webhook handler is included for reconciliation.
- Labelled modes. If no AI key is configured, witnesses answer in a scripted mode that is always labelled as scripted in the interface.
- AI tools: Google Gemini (model
gemini-3.5-flash, via Google AI Studio's OpenAI-compatible API) powers the witnesses and the archive summaries. Claude (Anthropic) was used as an AI coding assistant while building the project.
Challenges we ran into
- Keeping the AI inside its knowledge boundary: prompts, structured output, and rejecting replies that don't pass validation.
- Making payments trustworthy: the browser can't be trusted, so access depends on the server's own check with PayPal.
- Real-world API behaviour: a model our first attempt used was no longer available to new accounts, and another returned "high demand" errors, so we added automatic retries and clear error messages.
- Running on whatever Node.js version a judge has: the built-in database needed a flag on slightly older Node 22 versions.
Accomplishments that we're proud of
- A complete game from room creation through payment, private clues, witness interviews and a final reveal, all working end to end.
- 59 automated tests covering clue privacy, room isolation, witness prompt isolation, model-reply validation, retries and the whole payment flow (against a simulated PayPal), plus a full game played over real HTTP.
- An honest design: scripted and solo modes are clearly labelled, and the README states what has and hasn't been verified.
What we learned
How to make an interactive AI application reliable: restrict what the model knows, validate what it says, keep game state and payments on the server, and test what happens when the model, the payment provider or the player misbehaves.
What's next for Alibi AI
- Limitations today: it runs locally (setup instructions are in the README) with no hosted demo yet, there is one authored adventure, the archive uses keyword search rather than embeddings, updates use polling, and refunds and disputes are not handled.
- Next: embedding-based retrieval with metadata filters, generated cases, more adventures, hosting, and built-in voice chat.