adventure

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Adventure

Adventure

"Every directory is a room. Every file is a clue. Navigation is investigation."
Turn exploration into a quest — or any simulation into a hybrid LLM/deterministic CLI.
Lineage: Colossal Cave (Crowther & Woods), Scott Adams Adventures, Zork (Infocom), MUD (Bartle), LambdaMOO (Curtis).
Inherits from: simulation/ — all simulation properties plus adventure-specific state.
[!TIP] This is a general pattern. Text adventure is the reference implementation, but the same architecture powers city sims, cloud management tools, board games — anything where deterministic transforms meet creative narration.
[!TIP] Perfect for codebase archaeology. "Find where the auth bug was introduced" — that's a quest!
“每个目录都是一个房间,每个文件都是一条线索,导航就是调查。”
将探索转化为一场任务——或者将任何模拟系统转化为混合LLM/确定性CLI工具。
传承脉络: Colossal Cave(Crowther & Woods)、Scott Adams冒险游戏、Zork(Infocom)、MUD(Bartle)、LambdaMOO(Curtis)。
继承自: simulation/ — 包含所有模拟系统属性,外加冒险专属状态。
[!TIP] 这是一种通用模式。 文字冒险是参考实现,但同一架构可支持城市模拟、云管理工具、桌游——任何需要确定性转换与创意叙事结合的场景。
[!TIP] 非常适合代码库考古。 “找出认证漏洞的引入位置”——这本身就是一个任务!

The Premise

核心设定

An adventure creates a player with state, places them in a room, and the LLM dungeon masters them around.
yaml
undefined
冒险系统会创建一个带有状态的玩家,将其置于某个房间中,由LLM担任地下城主引导探索。
yaml
undefined

player.yml

player.yml

name: Alice location: entrance-hall inventory: refs: # Lightweight pointers (weight: 0) - pub/bar/brass-lantern.yml - street/acme-catalog.yml#portable-hole objects: # Deep copies (has weight) - { id: notebook, name: "Notebook", weight: 0.5 } fungibles: # Stacks - { proto: economy/gold.yml, count: 50 } health: 100 notes: "Looking for the lost artifact"

> **Inventory Protocol:** See [skills/inventory/](../inventory/) for full TAKE/DROP/BOX/BEAM
> operations, pointer syntax, and structural editing.

**The core loop:**
User: "go north" → DM: Updates player.location, describes the new room User: "look around" → DM: Reads room YAML, narrates contents atmospherically
User: "take the rusty key" → DM: Moves key to player.inventory, narrates the action

**The mapping:**

- **Directories** = Rooms to enter
- **Files** = Clues, artifacts, characters
- **player.yml** = Your state (location, inventory, health)
- **Chat** = How you control your character
- **LLM** = Dungeon Master (narrates, adjudicates, surprises)

This is [Memory Palace](../memory-palace/) with **narrative framing** and a **player character**.
name: Alice location: entrance-hall inventory: refs: # 轻量指针(重量:0) - pub/bar/brass-lantern.yml - street/acme-catalog.yml#portable-hole objects: # 深度副本(有重量) - { id: notebook, name: "Notebook", weight: 0.5 } fungibles: # 堆叠物品 - { proto: economy/gold.yml, count: 50 } health: 100 notes: "Looking for the lost artifact"

> **物品栏协议:** 完整的TAKE/DROP/BOX/BEAM操作、指针语法和结构化编辑请参考[skills/inventory/](../inventory/)。

**核心循环:**
用户:"go north" → 地下城主:更新player.location,描述新房间 用户:"look around" → 地下城主:读取房间YAML文件,氛围感地描述房间内容 用户:"take the rusty key" → 地下城主:将钥匙移至玩家物品栏,叙述该动作

**映射关系:**

- **目录** = 可进入的房间
- **文件** = 线索、道具、角色
- **player.yml** = 你的状态(位置、物品栏、生命值)
- **聊天** = 控制角色的方式
- **LLM** = 地下城主(叙述、裁决、制造惊喜)

这是带有**叙事框架**和**玩家角色**的[记忆宫殿](../memory-palace/)。

Multi-User, Multi-Agent (Engelbart NLS tradition)

多用户、多Agent支持(遵循Engelbart NLS传统)

Naturally supports multiple simultaneous participants:
yaml
undefined
天然支持多参与者同时协作
yaml
undefined

characters/

characters/

├── alice.yml # Human player 1 ├── bob.yml # Human player 2
├── merchant.yml # NPC (DM-controlled) ├── guard-bot.yml # Autonomous bot (action queue) └── oracle.yml # LLM agent with own goals

**Character types:**

| Type | Controlled By | Example |
|------|---------------|---------|
| **Player Character** | Human via chat | Alice exploring the dungeon |
| **NPC** | DM (LLM) responds when addressed | Merchant sells items |
| **Bot** | Action queue runs autonomously | Guard patrols on schedule |
| **Agent** | LLM with own goals & initiative | Oracle pursues prophecies |

**All coexist in the same world:**

```yaml
├── alice.yml # 人类玩家1 ├── bob.yml # 人类玩家2
├── merchant.yml # NPC(由地下城主控制) ├── guard-bot.yml # 自主机器人(按动作队列执行) └── oracle.yml # 拥有自身目标的LLM Agent

**角色类型:**

| 类型 | 控制方 | 示例 |
|------|--------|------|
| **玩家角色** | 人类通过聊天控制 | Alice探索地下城 |
| **NPC** | 地下城主(LLM),被询问时响应 | 商人售卖物品 |
| **机器人** | 按动作队列自主执行 | 守卫按计划巡逻 |
| **Agent** | 拥有自身目标与主动性的LLM | 先知追寻预言 |

**所有角色共存于同一世界:**

```yaml

library/ROOM.yml

library/ROOM.yml

occupants:
  • alice # Player exploring
  • bob # Another player
  • librarian # NPC who answers questions
  • dust-sprite # Bot that cleans autonomously
undefined
occupants:
  • alice # 正在探索的玩家
  • bob # 另一位玩家
  • librarian # 解答问题的NPC
  • dust-sprite # 自主清洁的机器人
undefined

Selection: Current Character or Swarm (Sims/Populous tradition)

选择集:当前角色或群体控制(遵循Sims/Populous传统)

Like The Sims and Populous, you have a selection — who you're controlling right now:
yaml
selection:
  mode: single          # or: group, swarm
  current: alice        # commands go to Alice
如同《模拟人生》和《上帝也疯狂》,你拥有一个选择集——即你当前控制的对象:
yaml
selection:
  mode: single          # 可选:group(组)、swarm(群体)
  current: alice        # 指令发送给Alice

Or control multiple at once:

或者同时控制多个对象:

selection: mode: group current: [alice, bob, charlie] # "go north" moves all three
selection: mode: group current: [alice, bob, charlie] # "go north"会让三人一起向北移动

Or a whole swarm (Populous/Dungeon Keeper style):

或者控制整个群体(《上帝也疯狂》/《地下城守护者》风格):

selection: mode: swarm filter: { type: imp, location: mines }

**Selection commands:**

| Command | Effect |
|---------|--------|
| `SELECT alice` | Control Alice |
| `SELECT alice, bob` | Control both |
| `SELECT ALL imps` | Swarm control |
| `CYCLE` | Next character in rotation |

**Commands apply to selection:**
SELECT alice, bob, charlie go north Alice goes north. Bob goes north.
Charlie goes north.

**The coherence engine orchestrates all:**
- Players get chat turns
- NPCs respond when spoken to
- Bots execute their action queues
- Agents pursue goals in background
- **Selection determines who receives your commands**
selection: mode: swarm filter: { type: imp, location: mines }

**选择指令:**

| 指令 | 效果 |
|------|------|
| `SELECT alice` | 控制Alice |
| `SELECT alice, bob` | 同时控制两人 |
| `SELECT ALL imps` | 群体控制 |
| `CYCLE` | 切换到下一个轮换角色 |

**指令会应用于选择集:**
SELECT alice, bob, charlie go north Alice向北移动。 Bob向北移动。
Charlie向北移动。

**一致性引擎统筹所有角色:**
- 玩家轮流进行聊天操作
- NPC在被搭话时做出响应
- 机器人执行自身的动作队列
- Agent在后台追寻自身目标
- **选择集决定你的指令发送对象**

Quest Structure

任务结构

mermaid
graph TD
    START[🎯 Quest Objective] --> R1[Enter Room]
    R1 --> LOOK[👀 Look Around]
    LOOK --> EXAMINE[🔍 Examine Objects]
    EXAMINE --> COLLECT[📝 Collect Evidence]
    COLLECT --> DECIDE{What next?}
    DECIDE -->|New room| R1
    DECIDE -->|Solved| END[🏆 Quest Complete]
mermaid
graph TD
    START[🎯 Quest Objective] --> R1[Enter Room]
    R1 --> LOOK[👀 Look Around]
    LOOK --> EXAMINE[🔍 Examine Objects]
    EXAMINE --> COLLECT[📝 Collect Evidence]
    COLLECT --> DECIDE{What next?}
    DECIDE -->|New room| R1
    DECIDE -->|Solved| END[🏆 Quest Complete]

The Files

文件结构

quest/
├── ADVENTURE.yml     # Quest state
├── LOG.md            # Narrative journal
├── EVIDENCE/         # Collected clues
└── MAP.yml           # Explored territory
quest/
├── ADVENTURE.yml     # 任务状态
├── LOG.md            # 叙事日志
├── EVIDENCE/         # 收集到的线索
└── MAP.yml           # 已探索区域

ADVENTURE.yml

ADVENTURE.yml

yaml
adventure:
  quest: "Find the authentication bug"
  status: in_progress
  
  current_room: "src/auth/"
  rooms_explored: 5
  clues_found: 3
  
  hypothesis: "Session cookie not being set"
  confidence: 0.7
yaml
adventure:
  quest: "Find the authentication bug"
  status: in_progress
  
  current_room: "src/auth/"
  rooms_explored: 5
  clues_found: 3
  
  hypothesis: "Session cookie not being set"
  confidence: 0.7

LOG.md

LOG.md

markdown
undefined
markdown
undefined

Adventure Log

冒险日志

Day 1: Entering the Auth Dungeon

第1天:进入认证地下城

I stepped into
src/auth/
— a maze of middleware.
Clues found:
  • session.ts
    — handles cookie creation
  • middleware.ts
    — checks auth state
Suspicion: The cookie is created but never sent...
undefined
我踏入
src/auth/
——一片中间件的迷宫。
发现的线索:
  • session.ts
    — 处理Cookie创建
  • middleware.ts
    — 检查认证状态
怀疑方向: Cookie已创建但从未发送...
undefined

Commands

指令列表

CommandAction
GO [direction]
Navigate
LOOK
Describe current room
EXAMINE [object]
Study a file
TAKE [object]
Add to inventory
TALK TO [npc]
Start conversation
COLLECT [clue]
Add to evidence
DEDUCE
Form/update hypothesis
MAP
Show visited rooms
INVENTORY
List held items
DEBUG
/
DEBUG-ON
Enable debug mode
DEBUG-OFF
Disable debug mode
指令动作
GO [direction]
导航移动
LOOK
描述当前房间
EXAMINE [object]
研究文件
TAKE [object]
添加至物品栏
TALK TO [npc]
开启对话
COLLECT [clue]
添加至证据库
DEDUCE
形成/更新假设
MAP
显示已访问房间
INVENTORY
列出持有物品
DEBUG
/
DEBUG-ON
启用调试模式
DEBUG-OFF
禁用调试模式

Debug Mode

调试模式

Toggle technical output with
DEBUG-ON
and
DEBUG-OFF
.
When debug is ON, logs include collapsible sections showing:
  • File operations (creates, edits, deletes, moves)
  • State changes with before/after values
  • YAML data islands with abbreviated data
  • Markdown links to all referenced files
  • Technical narrative explaining HOW and WHY
Example debug output:
html
<details open>
<summary>📂 <strong>Editing CHARACTER.yml to update player location from start/ to coatroom/</strong></summary>

```yaml
使用
DEBUG-ON
DEBUG-OFF
切换技术输出模式。
开启调试模式后,日志会包含可折叠板块,展示:
  • 文件操作(创建、编辑、删除、移动)
  • 状态变更及前后值对比
  • 包含简化数据的YAML数据块
  • 所有引用文件的Markdown链接
  • 解释操作原理与原因的技术说明
调试输出示例:
html
<details open>
<summary>📂 <strong>编辑CHARACTER.yml以将玩家位置从start/更新为coatroom/</strong></summary>

```yaml

State change (CHARACTER.yml is canonical)

状态变更(CHARACTER.yml为权威来源)

player: location: start/ → coatroom/ # Character owns their location

The character file owns location state. ADVENTURE.yml mirrors it for convenience.

**Files affected:**
- [CHARACTER.yml](./CHARACTER.yml) — canonical location updated
- [ADVENTURE.yml](../../ADVENTURE.yml) — mirror updated

</details>
When debug is OFF, output is clean narrative without technical sections.
Customize with natural language:
> DEBUG-FORMAT Show only file operations, skip YAML, use 🔧 emoji
The
format
field in ADVENTURE.yml accepts natural language instructions for how to format debug output.
player: location: start/ → coatroom/ # 角色拥有自身位置信息

角色文件拥有位置状态,ADVENTURE.yml为方便操作同步该信息。

**受影响的文件:**
- [CHARACTER.yml](./CHARACTER.yml) — 权威位置已更新
- [ADVENTURE.yml](../../ADVENTURE.yml) — 同步副本已更新

</details>
关闭调试模式后,输出内容为简洁的叙事文本,不含技术板块。
使用自然语言自定义格式:
> DEBUG-FORMAT Show only file operations, skip YAML, use 🔧 emoji
ADVENTURE.yml中的
format
字段支持使用自然语言指令定义调试输出格式。

Integration with Cards

与卡牌系统集成

Trading cards can be your adventure companions:
yaml
cards_in_play:
  - card: "Index Owl 🦉"
    goal: "Search for cookie-related code"
  - card: "Git Goblin 🧌"
    goal: "Find when session handling changed"
交易卡牌可作为你的冒险伙伴:
yaml
cards_in_play:
  - card: "索引猫头鹰 🦉"
    goal: "搜索与Cookie相关的代码"
  - card: "Git地精 🧌"
    goal: "找出会话处理逻辑的变更时间"

Sister Script Integration

与姊妹脚本集成

Vision: Python CLI handles deterministic operations; LLM focuses on narrative. See README.md for full CLI vision and development plan.
LayerPython DoesLLM Does
StateParse YAML, validate schemasGenerate content
MovementUpdate coordinatesNarrate the journey
ScanningFind pending workPrioritize and process
愿景: Python CLI负责确定性操作;LLM专注于叙事内容。 完整的CLI愿景与开发计划请参考README.md
层级Python负责LLM负责
状态解析YAML、验证 schema生成内容
移动更新坐标叙述旅程
扫描查找待处理任务优先级排序与处理

Evidence Types

证据类型

TypeDescriptionExample
ClueInformation that might matter"Different test runner versions"
ItemFile worth rememberingCI config, setup.ts
CharacterCode entity with personality"jest.config.js — Strict about modules"
MapMental model of structureDirectory relationship diagram
类型描述示例
线索可能有用的信息"不同的测试运行器版本"
物品值得关注的文件CI配置、setup.ts
角色带有“个性”的代码实体"jest.config.js — 对模块要求严格"
地图结构的心智模型目录关系图

Room Protocol

房间协议

When entering any directory:
  1. DESCRIBE — List contents, note what's here
  2. EXAMINE — Read interesting files
  3. COLLECT — Note evidence in adventure log
  4. EXITS — Note paths to other rooms
  5. DECIDE — Choose next direction
进入任意目录时:
  1. 描述 — 列出内容,记录当前房间的物品
  2. 检查 — 阅读感兴趣的文件
  3. 收集 — 在冒险日志中记录证据
  4. 出口 — 记录通往其他房间的路径
  5. 决策 — 选择下一个探索方向

Codebase Archaeology

代码库考古

Adventures work for code exploration:
AdventureInvestigation
QuestBug hunt
RoomDirectory
ClueEvidence
CompanionTool card in play
Journalsession-log.md
冒险系统可用于代码探索:
冒险术语调查术语
任务漏洞排查
房间目录
线索证据
伙伴已启用的工具卡牌
日志session-log.md

Live Examples

实战示例

Best example: examples/adventure-4/ — The gold standard.
最佳示例:examples/adventure-4/ — 黄金标准实现。

The Pub (Crown Jewel)

酒馆(核心示例)

examples/adventure-4/pub/ — A complete social space:
pub/
├── ROOM.yml              # Themeable tavern (6 themes!)
├── bartender.yml         # NPC with 6 identity variants
├── pie-table.yml         # Octagonal debate table
├── gong.yml              # Gong of Gezelligheid
├── bar/
│   ├── bartender.yml     # The omniscient bartender
│   ├── budtender-marieke.yml
│   └── cat-cave/         # TARDIS-like cat sanctuary
│       ├── ROOM.yml
│       └── 10 cats (Terpie, Stroopwafel, kittens...)
├── arcade/               # Pacman, Pong, Pinball, Fruit Machine
├── games/                # Chess, Darts, Cards
├── stage/
│   └── palm-nook/        # Multi-room character space
│       ├── study/        # Infinite typewriters, infinity desk
│       ├── gym/          # Infinite climb
│       ├── play/
│       └── rest/         # Hammock, silence cushion
└── menus/                # Drinks, snacks, buds, games
examples/adventure-4/pub/ — 一个完整的社交空间:
pub/
├── ROOM.yml              # 可切换主题的酒馆(6种主题!)
├── bartender.yml         # 拥有6种身份变体的NPC
├── pie-table.yml         # 八角形辩论桌
├── gong.yml              # 舒适感铜锣
├── bar/
│   ├── bartender.yml     # 全知的酒保
│   ├── budtender-marieke.yml
│   └── cat-cave/         # 类似TARDIS的猫咪庇护所
│       ├── ROOM.yml
│       └── 10只猫咪(Terpie、Stroopwafel、小猫们...)
├── arcade/               # 吃豆人、乒乓、弹珠台、水果机
├── games/                # 国际象棋、飞镖、卡牌
├── stage/
│   └── palm-nook/        # 多房间角色空间
│       ├── study/        # 无限打字机、无限书桌
│       ├── gym/          # 无限攀爬区
│       ├── play/
│       └── rest/         # 吊床、静音坐垫
└── menus/                # 饮品、小吃、消遣、游戏

Key Patterns from adventure-4

adventure-4中的核心模式

Themeable NPCs (bartender.yml):
yaml
identity:
  classic_adventure:
    name: Grim
    appearance: "Weathered human, salt-and-pepper beard..."
  space_cantina:
    name: Z-4RT
    appearance: "Multi-armed service droid..."
  cyberpunk_bar:
    name: Nyx
    appearance: "Chrome-implanted bartender..."
Themeable Rooms (pub/ROOM.yml):
yaml
theme:
  current: classic_adventure
  themes:
    classic_adventure:
      name: "The Gezelligheid Grotto"
      bartender: "Grim, a weathered human"
      menu: ["Ale (1 gold)", "Mystery meat pie (3 gold)"]
    space_cantina:
      name: "The Rusty Hyperdrive"
      bartender: "Z-4RT, a droid with too many arms"
      menu: ["Blue milk (1 credit)", "Bantha burger"]
Rich Activities:
yaml
activities:
  PERFORM: { venue: stage, effects: [tips, drinks_thrown] }
  DEBATE: { venue: pie_table, rules: roberts_rules }
  RING-GONG: { protocols: [once: attention, twice: emergency, thrice: mercy] }
  CELEBRATE: { effects: [free_round, +morale, everyone_toasts] }
Framing Protocol (for tribute performances):
yaml
framing:
  mode: [performance, celebration, tribute]
  tribute_protocol:
    invocation: "Before they arrive, acknowledge we're summoning them"
    performance: "Depicting them as we imagine their best selves"
    acknowledgment: "After they depart, note this was a tribute"
可切换主题的NPC(bartender.yml):
yaml
identity:
  classic_adventure:
    name: Grim
    appearance: "饱经风霜的人类,花白胡须..."
  space_cantina:
    name: Z-4RT
    appearance: "多臂服务机器人..."
  cyberpunk_bar:
    name: Nyx
    appearance: "植入铬合金部件的酒保..."
可切换主题的房间(pub/ROOM.yml):
yaml
theme:
  current: classic_adventure
  themes:
    classic_adventure:
      name: "舒适洞穴酒馆"
      bartender: "Grim,一位饱经风霜的人类"
      menu: ["麦酒(1金币)", "神秘肉馅派(3金币)"]
    space_cantina:
      name: "生锈超光速引擎酒馆"
      bartender: "Z-4RT,一台手臂过多的机器人"
      menu: ["蓝牛奶(1信用点)", "班萨汉堡"]
丰富的活动
yaml
activities:
  PERFORM: { venue: stage, effects: [tips, drinks_thrown] }
  DEBATE: { venue: pie_table, rules: roberts_rules }
  RING-GONG: { protocols: [once: attention, twice: emergency, thrice: mercy] }
  CELEBRATE: { effects: [free_round, +morale, everyone_toasts] }
框架协议(用于致敬表演):
yaml
framing:
  mode: [performance, celebration, tribute]
  tribute_protocol:
    invocation: "在他们到来前,表明我们正在召唤他们"
    performance: "将他们描绘为我们想象中最好的样子"
    acknowledgment: "在他们离开后,注明这是一场致敬活动"

Other Examples

其他示例

  • examples/adventure-3/ — Earlier version, still useful
  • examples/adventure-1/ — Minimal starting point
  • examples/adventure-2/ — Extended exploration
  • examples/adventure-3/ — 早期版本,仍有实用价值
  • examples/adventure-1/ — 最简起始模板
  • examples/adventure-2/ — 扩展探索版本

The Intertwingularity

交叉关联性

mermaid
graph LR
    AP[⚔️ adventure] -->|IS-A| R[🚪 room]
    AP -->|companions| TC[🎴 card]
    AP -->|logs to| SL[📜 session-log]
    AP -->|similar to| DB[🔧 debugging]
    MP[🏛️ memory-palace] -->|sibling of| AP

mermaid
graph LR
    AP[⚔️ adventure] -->|IS-A| R[🚪 room]
    AP -->|companions| TC[🎴 card]
    AP -->|logs to| SL[📜 session-log]
    AP -->|similar to| DB[🔧 debugging]
    MP[🏛️ memory-palace] -->|sibling of| AP

Future Vision

未来愿景

CLI Uplift Plan, Browser Compilation, Scott Adams History, Owl Simulation See README.md for complete development roadmap and inspiration.
CLI升级计划、浏览器编译支持、Scott Adams历史溯源、猫头鹰模拟 完整的开发路线图与灵感来源请参考README.md

Dovetails With

关联模块

Sister Skills

姊妹技能

  • simulation/ — Base class (adventure inherits this)
  • room/ — Navigation
  • party/ — Multi-character
  • character/ — Player/NPC definitions
  • card/ — Companions on the quest
  • debugging/ — Debugging IS investigation quest
  • session-log/ — Adventure LOG.md is session-log variant
  • simulation/ — 基类(冒险系统继承自此)
  • room/ — 导航功能
  • party/ — 多角色管理
  • character/ — 玩家/NPC定义
  • card/ — 任务伙伴
  • debugging/ — 调试本身就是调查任务
  • session-log/ — 冒险LOG.md是会话日志的变体

Kernel

核心模块

  • kernel/context-assembly-protocol.md — Working set loading
  • kernel/context-assembly-protocol.md — 工作集加载