Back to blog

Blog

5 Minute Crafts: The Agency

Published: Feb 03, 20263 min read
#ai#5minutecrafts#storytelling#cli#game-dev

I am starting a new series on here where I post my quick vibe-coded projects. The first project is the Agency, a local, AI-driven text adventure about a mysterious organization. You play, the narrator responds, and each turn ends with a question about what you do next. The experience reads like a collaboration with a live game master, but it is powered by a tight set of design rules and systems.

Here are the five themes that hold the project together.

Theme 1: The Narrative Contract

The Agency only works if the narrator has a tight contract. The system prompt enforces a second-person, cinematic voice, a modern investigative mood, and the presence of The Agency as a recurring thread.

Every response ends with 2 to 4 numbered options plus a question. That structure keeps the pacing sharp and keeps the player moving.

Theme 2: Two Modes, Two Moods

I wanted a single-player mystery and a tabletop-flavored D&D mode without splitting the codebase. The solution was a dual prompt system.

In single-player, the tone is focused and investigative. In D&D mode, the narrator treats a party like a live table, rotates turns, and suggests options without forcing them.

Theme 3: Short-Term Memory, Long-Term Memory

Long stories break if the model forgets. The game keeps two memory streams: a short rolling message history and a compact summary list. The summaries are injected as a system message so they always carry weight.

Single-player summarizes every three turns. D&D summarizes every turn and also keeps per-player notes, which helps continuity over long sessions.

Theme 4: The Player Loop

Every turn follows the same loop. The player acts, the narrator responds, choices appear, and the game stores a recap.

Turn length stays tight (around 120 to 200 words) so the experience feels snappy. It is not just about word count. It is about a consistent cadence: reveal, react, ask.

Theme 5: The Interface Split

There are two ways in: a no-frills CLI and a Tkinter desktop UI. The CLI is fast and transparent. The GUI is approachable and runs narration in a background thread so the interface never freezes.

Both share the same engine and the same save/load system, so you can switch interfaces without breaking the story.

The Agency looks simple from the outside, but it is a careful loop of choices, memory, and tone. Each piece is small, but the system only works when they all line up.

If you want a deeper technical breakdown later, I can post a follow-up with the prompt templates, memory formatting, and how the summarization fallback works when the model fails.

Repo

If you want to test this out for yourself, check it out here.