Kleene - Adaptive AI Text Adventure Engine for Claude Code
Text adventures that actually adapt to your choices. Built specifically for Claude Code.
Unlike traditional choice-based games, Kleene responds to free-form actions and improvisation. The temperature system lets you control how much the AI adapts - from traditional branching (temp 0) to fully emergent storytelling (temp 10).
🎮 Get Started in 5 Minutes | 📖 Documentation | 🤝 Contributing
Quick Start
# Play a game
/kleene play
# Try the beginner-friendly Dragon Quest
/kleene play dragon_quest
# Start at temperature 0 (traditional), increase once comfortable
/kleene temperature 0
# Generate your own scenario
/kleene generate a cyberpunk heist
# Check your scenario for issues
/kleene analyze
👉 New to Kleene? Check out the Getting Started Guide
Installation
# Add the marketplace
/plugin marketplace add kleene-games/kleene
# Install the plugin
/plugin install kleene@kleene-games
Verify installation: Run /kleene to see the menu, then /kleene play to start your first game!
Playing Games
Basic Commands
| Command | What It Does |
|---|
/kleene play | Start a new game (shows scenario menu) |
/kleene continue [scenario] | Resume from save |
/kleene temperature [0-10] | Set adaptation level |
/kleene foresight [0-10] | Set hint specificity |
/kleene parser [on|off] | Toggle text adventure mode |
/kleene save | Save current game |
/kleene rewind [target] | Rewind to earlier point (T6.2.3, -1, --1) |
/kleene export [mode] | Export gameplay (transcript/summary/stats/branches/gallery) |
/kleene gallery [on|off] | Toggle educational meta-commentary |
Temperature Guide
- 0 (Verbatim): Scenario text exactly as written - traditional branching
- 1-3 (Subtle): Faint echoes of your discoveries woven in
- 4-6 (Balanced): Direct references to your exploration
- 7-9 (Immersive): Rich integration + bonus options appear
- 10 (Adaptive): Narrative fully shaped by your actions
Pro tip: Start every scenario at temp 0 to learn it, then replay at temp 10 for emergent magic.
Free-Form Actions
When playing at temp > 0, you can type anything instead of picking from options:
- Explore: "I search the room for hidden doors"
- Interact: "I try to befriend the guard"
- Act: "I light the papers on fire"
- Meta: "I want to leave this location"
The AI evaluates feasibility and generates responses that fit the scenario tone.
Features
For Players
- Improvisation Support: Type any action—Claude interprets and responds dynamically
- State Persistence: Save/load game states, pick up where you left off
- Scene Tracking: Turn/Scene/Beat counters show precise gameplay position
- Multi-Level Rewind: Jump back to any Turn.Scene.Beat (T6.2.3 notation)
- Export System: Save gameplay as clean narrative or analytical summary
- Gallery Mode: Educational meta-commentary on narrative techniques
- Foresight Setting: Control how much the game reveals when you ask for hints
- Parser Mode: Text adventure-style play—type commands like Zork
- Auto-approval Hooks: Seamless gameplay without permission prompts
- Pure Claude Code Integration: No separate app, plays in your terminal
For Creators
- AI-Powered Generation: Create complete scenarios from a single theme prompt
- YAML-based Format: Human-readable, version-controllable scenario files
- Structural Validation: Analyze completeness across Bronze/Silver/Gold tiers
- Decision Grid Framework: Built-in guidance for rich, non-binary storytelling
- Preconditions & Consequences: Full game logic with inventory, traits, flags, relationships
- Location State System: Per-location flags, properties, and environment conditions
- Node/Location Preconditions: Gate story nodes and location access
- Temporal System: Time-based gating with scheduled events
- NPC Tracking: Move NPCs and check their locations
Create Your Own Scenarios
Kleene isn't just a game engine—it's a complete authoring toolkit:
- Generate: Start with a theme (
/kleene generate "space station mystery")
- Edit: Scenarios are YAML files you can hand-edit or ask Claude to refine
- Validate: Check structural completeness (
/kleene analyze my_scenario)
- Play: Test your creation immediately (
/kleene play my_scenario)
- Share: Push to the community scenarios repo
Creating Scenarios
Option 1: Use the Generator
/kleene generate a space station mystery
# Or be more specific
/kleene generate a noir detective story set in 1940s Los Angeles
The AI creates a complete scenario with branching paths, endings, and proper structure.
Option 2: Write Your Own