Inventory System — Design Document

Status: Concept — depends on Trackers for state management and Gallery & Image Storage for visual assets.

Overview

An inventory is a gamified collection of items that a character can acquire, lose, equip, and use during a conversation. It reuses patterns familiar from RPGs and adventure games — slots, quantities, categories — but is entirely code-driven: creators define the rules, the tracker system maintains state, and the gallery provides the visuals.

The inventory is not a standalone system. It is a specialized tracker type backed by gallery images, with structured schema and UI rendering rules. A tracker of type inventory stores the current item list; each item references a gallery image for its icon/sprite; the LLM evaluation step adds or removes items based on narrative events.

Core Goals


How It Works

Inventory as a Tracker

An inventory is defined as a tracker with type: inventory. Like all trackers, it:

The difference from a generic keyword tracker is the schema: an inventory tracker has structured item definitions, quantity tracking, category grouping, and optional slot/equipment mechanics.

Item Definitions

Each item in the inventory is linked to a gallery image and optionally a lorebook entry. The creator defines items upfront as part of the character/mode/package setup:

Field Type Description
name string Display name ("Iron Sword", "Health Potion")
slug string Unique identifier for LLM reference (iron_sword)
imageId gallery_image_id Gallery image used as the item icon/sprite
lorebookEntryId uuid (optional) Linked lorebook entry for item description/lore
category string (optional) Grouping category ("Weapons", "Consumables", "Key Items")
stackable boolean Whether multiples collapse into quantity (potions) vs occupy separate slots (unique weapons)
maxQuantity int (optional) Maximum stack size (null = unlimited)
equippable boolean Whether the item can be equipped to a slot
equipSlot string (optional) Target slot ("main_hand", "armor", "accessory")
description string Short description shown in inventory UI tooltip
extractionHint string Hint for the evaluation LLM on when to add/remove this item

Inventory State (Per Message)

The tracker stores the current inventory state as structured JSON:

{
  "items": [
    { "slug": "iron_sword", "quantity": 1, "equipped": true },
    { "slug": "health_potion", "quantity": 3, "equipped": false },
    { "slug": "dungeon_key", "quantity": 1, "equipped": false }
  ],
  "capacity": { "current": 5, "max": 20 }
}

LLM Evaluation

The evaluation LLM receives the current inventory state plus the item definitions and determines what changed. The extraction hint on each item guides the LLM:

The evaluation output is a diff: items added, removed, or quantity-changed. The tracker system applies the diff to produce the new state.


Inventory Slots & Equipment

Creators can optionally define equipment slots — named positions where items can be equipped. This enables classic RPG mechanics:

Slot Description
main_hand Primary weapon
off_hand Shield, secondary weapon, or torch
armor Body armor
head Helmet, crown, circlet
accessory Ring, amulet, charm

Slots are creator-defined strings, not hardcoded. A horror scenario might have flashlight, medicine, journal. A fantasy might have the classic RPG set. A sci-fi adventure might have primary_weapon, suit_module, data_chip.

Equipping an item to a slot:


UI Rendering

Inventory Panel

When a character has an inventory tracker, the chat UI shows an inventory panel accessible from the tracker bar or a dedicated icon. The panel renders:

+--------------------------------------------------+
|  INVENTORY                          5 / 20 slots  |
|--------------------------------------------------|
|  [Equipped]                                       |
|  Main Hand:  [sword icon] Iron Sword              |
|  Armor:      [empty slot]                         |
|                                                    |
|  [Bag]                                            |
|  [potion icon] Health Potion    x3                |
|  [key icon]    Dungeon Key      x1                |
|  [scroll icon] Ancient Map      x1                |
+--------------------------------------------------+

Collapsed View (Tracker Bar)

In the collapsed tracker bar, inventory shows a compact summary:

Inventory: Iron Sword, Health Potion x3, Dungeon Key, Ancient Map | 5/20

Every item must have a gallery image. This is what makes inventories visual rather than just a text list. The gallery provides:

Creators set up a dedicated gallery (e.g., "Item Sprites") and upload item images there. When defining inventory items, they pick from their gallery using the existing ImagePickerModal.


Lorebook Integration

Items optionally link to lorebook entries. When an item is in the inventory:

This means a "Cursed Blade of Shadows" in the inventory automatically pulls its lorebook entry describing the blade's history, powers, and curse — without the user mentioning it.


Creator Setup Flow

  1. Create a gallery for item sprites/icons
  2. Upload item images to the gallery
  3. Create lorebook entries for items that need rich descriptions (optional)
  4. Define the inventory tracker on the character/mode:
    • Set tracker type to inventory
    • Define equipment slots (optional)
    • Set capacity limit (optional)
    • Add item definitions, linking each to a gallery image and optionally a lorebook entry
  5. Write extraction hints for each item so the evaluation LLM knows when to add/remove them
  6. Define starting inventory — which items the player begins with

Dependencies

Dependency Status What's Needed
Trackers Phase 1 shipped (2026-05-30) — eval LLM, per-message snapshots and typed values (freeform / numeric / percentage / enum / list / datetime) are live; the type this needs is not inventory tracker type, structured JSON state, evaluation LLM integration
Gallery Shipped Gallery image references for item icons/sprites
Lorebook Shipped Optional lorebook entry linking for item descriptions
Packages In progress (packages are live in Browse; see its status) Package-level inventory presets (a package can ship with pre-defined items)

Scope Boundaries

In scope:

Out of scope (future):