Creator Workbench - Design Document
Problem Statement
Creators build interconnected components — characters, modes, lorebooks, model profiles, greetings, personas, trackers — that form coherent experiences. These components are deeply interconnected: a mode's sub-prompts reference provider keys that inject character data, lorebook entries, tracker state, and persona context. Model profiles map specific LLM models to optimized modes.
Today, creators build these components in isolation (Characters tab, Modes tab, Lorebooks tab) and then link them. This works for individual items but fails at scale because:
- No workspace — There's no concept of "these things belong together." A creator building a fantasy RPG has a character, 3 lorebooks, 2 modes, and a model profile scattered across separate tabs with no grouping.
- No mental model — New users don't understand how pieces connect or what order to build them
- Context switching — Creating a mode mid-build requires navigating away, losing context
- Invisible connections — No way to see that a mode's
lorebookprovider key expects linked lorebooks - No guidance — No indication of what's complete, what's missing, what's recommended
- No publishing workflow — Creators can publish individual items, but there's no way to bundle them into a curated experience (a package) or to publish multiple outputs from the same creative effort
- Future complexity — Trackers, living lorebook presets, lorebook trackers (NPCs, locations, factions), and visual novel assets will make the connection web genuinely graph-shaped
Design Philosophy
- Teach while building — Every section explains what it does and why it matters
- Create in context — Never leave the workbench to create a sub-component
- Make connections visible — Show how pieces link; surface gaps and mismatches
- Scale gracefully — The architecture must accommodate trackers, living lorebooks, visual assets, and visual novel rendering without rewrites
- Multiple outputs — One creative effort should be able to produce multiple deliverables
Projects, Sub-items, and Deliverables
The Creator experience is split into two distinct pages: the Projects page (organize, plan, manage) and the Workbench (create, edit, connect). Projects are the entry point; the workbench is the studio; packages and individual published items are the outputs.
Two Pages, Two Purposes
| Projects Page | Workbench | |
|---|---|---|
| Purpose | Organize, plan, manage | Create, edit, connect, build packages, test |
| Mental model | File manager | Studio / IDE |
| Entity interaction | Move, assign, reorder (drag-and-drop) | Create, edit in-place, preview, link, configure packages |
| Key actions | Create/delete projects, drag items between projects, manage deliverables, view changelog | Create entities, edit entities in-context, view relationship map, build and test packages |
| Layout | Three-panel: project list / entity list / project detail | Three-panel: entity drawer / editor-map-sandbox / project context |
The Projects page is the organizational hub. Creators see all their projects, browse sub-items, move items between projects with drag-and-drop, and manage deliverables and publishing. It answers "what do I have and where does it belong?"
The Workbench is the unified creative studio. Creators open a specific project and work inside it -- creating entities, editing them in-place, assembling packages, viewing the relationship map, and testing the experience in a sandbox. There is no separate "Package Builder" page -- package configuration happens within the workbench, selected from the left drawer alongside entities. It answers "what am I building and how do the pieces connect?"
Project
A Project is a creator's workspace — a container that groups all the components related to a creative effort. A project called "Crystal of Dawn RPG" might contain two characters, 3 lorebooks, a combat mode, a model profile, and greetings.
Projects are the entry point. A creator opens the Projects page and sees their list of projects. From there they can organize items, or open a project in the Workbench to start creating.
A project is NOT a published entity — users never see projects. Projects are the creator-side workspace; deliverables are what users browse and consume.
Sub-items
Sub-items are the components that belong to a project: characters, modes, lorebooks, model profiles, greetings, persona templates, trackers, custom instructions, and package-safe settings defaults.
Sub-items use a hybrid ownership model: items live in the creator's account, and the project links to them. There are two ways to populate a project:
- Create new — Create a character, lorebook, mode, etc. directly inside the project. The item is created in the creator's account and automatically linked to the project.
- Add existing — Link an item that already exists in the creator's account. An entity picker lets creators browse their existing characters, lorebooks, modes, etc. and add them to the project.
Either way, the project holds a reference, not a copy. The same character can appear in multiple projects.
Sub-items are displayed as a flat list with type badges — not grouped into fixed sections. This keeps the interface clean and lets creators work with whatever they need, in whatever order.
Deliverables
A deliverable is a publishable output from a project — something users can browse and consume. One project can produce multiple deliverables.
| Deliverable Type | What it is | What users see |
|---|---|---|
| Playable Package | A curated bundle of sub-items with locks, settings, and configuration. The full experience. Uses the Package Workbench for assembly. | "Start Experience" button in Hub. Pre-configured conversation. |
| Individual Character | A character published on its own. | Character card in Hub/Browse. Users can start conversations with it. |
| Individual Lorebook | A lorebook published on its own. | Lorebook in Hub/Browse. Users can attach it to their conversations. |
| Individual Mode | A mode published on its own. | Mode in Hub/Browse. Users can select it for their conversations. |
| Individual Model Profile | A model profile published on its own. | Profile in Hub/Browse. Users can apply it. |
Why deliverables matter: A creator building a fantasy RPG might want to publish:
- The full RPG package (character + Model Profile Base mappings + lorebooks + trackers, all locked and pre-configured)
- The world lorebook on its own (for other creators to use with their own characters)
- The combat mode on its own (for anyone who wants tactical combat)
One project, three deliverables, shared sub-items.
Architecture Diagram
Project ("Crystal of Dawn RPG")
│
├── Sub-items (flat list, type-badged)
│ ├── 🧑 D&D 5e Rules (character, type: system)
│ ├── 🧑 Elara the Narrator (character, type: character)
│ ├── 🎭 Campaign Mode (mode)
│ ├── 🎭 Quick Combat Mode (mode)
│ ├── 📚 Realms Lore (lorebook, 142 entries)
│ ├── 📚 Party Background (lorebook, 8 entries)
│ ├── 📚 Bestiary (lorebook, 45 entries)
│ ├── ⚡ Claude Optimized (model profile)
│ ├── 👋 The Tavern Opening (greeting)
│ └── 👋 The Dungeon Entrance (greeting)
│
├── Deliverables
│ ├── 📦 Crystal of Dawn - Full RPG (playable package)
│ │ └── Bundles: D&D 5e Rules + Campaign Mode + all lorebooks
│ │ + Claude Optimized + The Tavern Opening
│ │ Locks: character 🔒, mode 🔒, lorebooks 🔓
│ │
│ ├── 📦 Crystal of Dawn - Quick Play (playable package)
│ │ └── Bundles: Elara + Quick Combat Mode + Realms Lore
│ │ Locks: all unlocked
│ │
│ ├── 📚 Realms of Crystal Lore (individual lorebook)
│ │ └── Publishes: Realms Lore lorebook to Hub
│ │
│ └── 🎭 Tactical RPG Combat (individual mode)
│ └── Publishes: Quick Combat Mode to Hub
│
└── Metadata
├── Name, description
├── Created/updated timestamps
└── Template used (if any)
Projects Page Layout
The Projects page is a three-panel layout (matching the lorebook assistant and v2 chat pattern):
┌─────────────────────────────────────────────────────────────────────────┐
│ [ Crystal of Dawn RPG [✏] [+ Add Item] │
├──────────────┬──────────────────────────────────┬───────────────────────┤
│ Projects │ Entity List │ Project Detail │
│ │ │ │
│ ┌────────┐ │ [All] [Chars] [Modes] [Lore]..│ About │
│ │All Items│ │ │ Crystal of Dawn RPG │
│ │ 14 │ │ 🧑 D&D 5e Rules ⋮ │ A complete tabletop │
│ └────────┘ │ 🧑 Elara the Narrator ⋮ │ fantasy adventure.. │
│ │ 🎭 Campaign Mode ⋮ │ │
│ ┌────────┐ │ 🎭 Quick Combat Mode ⋮ │ Changelog │
│ │Crystal │ │ 📚 Realms Lore ⋮ │ + Added "Bestiary" │
│ │of Dawn │ │ 📚 Party Background ⋮ │ ~ Renamed project │
│ │RPG │ │ 📚 Bestiary ⋮ │ + Added "Campaign" │
│ │ 10 │ │ ⚡ Claude Optimized ⋮ │ │
│ └────────┘ │ 👋 The Tavern Opening ⋮ │ [Open in Workbench] │
│ │ 👋 The Dungeon Entrance ⋮ │ │
│ ┌────────┐ │ │ │
│ │Quick │ │ ☐ Select All [Bulk Actions ▼]│ │
│ │Play │ │ │ │
│ │ 3 │ │ │ │
│ └────────┘ │ │ │
│ │ │ │
│ [+ New] │ │ │
├──────────────┴──────────────────────────────────┴───────────────────────┤
Left drawer — Project list:
- Pinned "All Items" virtual project showing unassigned (unclaimed) items
- User-created projects with item counts
- Create new project via placeholder card
- Context actions: delete project, open in workbench
Center panel — Entity list:
- Type filter chips (All, Characters, Modes, Lorebooks, etc.)
- Flat list of sub-items with type badges
- Multi-select with bulk actions: Add to project, Remove from project
- Drag-and-drop to move items between projects (future)
Right drawer — Project detail / Entity preview:
- When no entity is selected: project info, changelog, "Open in Workbench" button
- When an entity is selected: entity preview with metadata
Header:
- Editable project name (click pencil to rename)
- [+ Add Item] button opens a modal with entity creation cards (same PlaceholderCard style as the workbench create section). Options: Create Character, Create Mode, Create Lorebook, Create Model Profile, Create Persona Template, or Link Existing (entity picker for items already in the creator's account).
Each sub-item row has an actions menu (⋮): Edit, Remove from project, Open in editor, Duplicate.
Individual Item Deliverables
When publishing an individual item (not a package), the editor is a lightweight publishing wrapper:
┌─ Publish Lorebook: Realms of Crystal Lore ───────────────────┐
│ │
│ Publishing: 📚 Realms Lore (142 entries) │
│ │
│ Hub Name: [Realms of Crystal Lore ] │
│ Description: [Comprehensive world lore for the Crystal...] │
│ Tags: [fantasy] [world-building] [lore] [+] │
│ Cover Image: [upload] │
│ │
│ Visibility: ○ Public and listed ○ Public, unlisted ● Draft│
│ │
│ [Save Draft] [Publish / Update] │
└───────────────────────────────────────────────────────────────┘
Sub-item Ownership
Creating a sub-item inside a project creates it in the creator's account. The project links to it. This means:
- The same character can appear in multiple projects
- Items are visible in the Characters tab, Lorebooks tab, etc.
- Deleting a project does NOT delete its items (just the links)
- Deleting an item removes it from all projects that reference it
Database: Project Tables
The schema below has drifted from what shipped. The actual
projectsandproject_deliverablestables indatabase/v1/24_tables_projects.sqlare simpler than this block implies —project_itemsis the older sub-items table (projects_itemsfamily) andproject_deliverablesno longer carriesdeliverable_type/item_type/item_id/is_published/published_at/cover_image_url/tags_json. The actual shapes:
-- Actual projects table (24_tables_projects.sql)
CREATE TABLE projects (
id SERIAL PRIMARY KEY,
uuid UUID NOT NULL UNIQUE DEFAULT gen_random_uuid(),
owner_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
slug VARCHAR(80),
name VARCHAR(200) NOT NULL,
description TEXT,
cover_image_url VARCHAR(500), -- legacy; superseded by cover_image_id
cover_image_id INTEGER REFERENCES gallery_images(id), -- added by 31d_entity_avatar_image_links.sql
is_deleted BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- Actual project_deliverables (24_tables_projects.sql + 47c_collapse_deliverable_publish_into_package.sql)
CREATE TABLE project_deliverables (
id SERIAL PRIMARY KEY,
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
package_id INTEGER NOT NULL REFERENCES packages(id) ON DELETE CASCADE,
name VARCHAR(255) NOT NULL,
description TEXT,
sort_order INTEGER NOT NULL DEFAULT 0,
is_deleted BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
Two changes worth calling out:
Publish state lives on
packages, not deliverables. The oldis_published/published_atcolumns onproject_deliverableswere dropped by47c_collapse_deliverable_publish_into_package.sql. Today the deliverable is purely a presentation envelope (name + description + sort order);is_publishedandpublished_atare computed byfn_list_project_deliverablesfrompackages.is_publicand the latest approvedpublish_requestsrow for the package.Cover image is gallery-FK, not URL. Both
packages.cover_image_idandprojects.cover_image_idare the live cover fields. The save endpoints accept a gallery image UUID (CoverImageUuid). For packages it is resolved and written insidefn_save_package_fullitself, ahead of the publish decision — the post-saveSetCoverImageAsynccall is gone (WP-29).projectsstill use the post-save setter. Reads return bothcoverImageUuidandcoverImageUrl(pre-minted best-variant URL), mirroring the avatar pattern on characters.
Individual-item deliverables (the older deliverable_type = 'character' | 'lorebook' | … design) never shipped. The current table only supports packages — package_id is NOT NULL. Publishing a standalone character/mode/lorebook still goes through that entity's own publish-request flow, not through a deliverable row.
Project sub-items. The project_items table referenced above was part of an earlier polymorphic design. The current implementation uses entity-typed tables (character_project, mode_project, lorebook_project, etc.) — check the relevant entity's SQL for the exact join shape.
Publish Flow
The workbench has no separate "publish" button at the deliverable level — publishing happens implicitly when the creator saves a package whose state passes the moderation gate. The end-to-end path:
- Save — workbench calls
POST /api/creator/projects/{projectId}/packages. The endpoint callsfn_save_package_full. - Membership gate —
fn_save_package_fullchecks the caller is project owner or a member withcan_contribute. Reject otherwise. - Upsert + sync — package row, lorebook bindings, model-profile bindings, persona-template bindings, deliverable row all upserted in one transaction.
- Publish-request dispatch — if the creator intends the package to be public,
fn_save_package_fullcallsfn_handle_publish_requestwithentity_type = 6. This either:- Auto-publishes (when
fn_verified_creator_auto_publishclears the creator on trust + content checks) —packages.is_public = TRUE,packages.is_listed = TRUE,was_auto_published = TRUEon the response. - Routes into the moderation queue —
was_flagged = TRUEon the response,publish_requestsrow pending. - No-ops if the package is being saved as draft.
- Auto-publishes (when
- Response —
SavePackageResponsecarries the package row plus the three publish-flow result columns (isPublic,wasAutoPublished,wasFlagged). The workbench renders the publish-status pill from these.
Computed is_published on the deliverable. fn_list_project_deliverables derives is_published from packages.is_public and published_at from the most recent approved publish_requests row. There's no separate state on the deliverable to keep in sync.
Cover image flow runs inside the save, ahead of the publish decision. The workbench uploads to the gallery first (yielding a gallery_images.uuid) and passes the UUID as coverImageUuid in the save request; fn_save_package_full resolves it against the caller's gallery, writes packages.cover_image_id and the gallery_image_entity_links moderation row, and only then runs the publish flow. Omit to preserve, nil UUID to clear, a non-owned UUID rejects the entire save with 403. The cover_image_url legacy column is migrated from but not written to.
Known Constraints
fn_create_conversation_from_packagerequirescharacter_id. BYOC ("bring your own character") packages can be saved and listed, but starting a conversation from them raises'Package % has no character assigned'. A reader who hits it gets409 { code: "package_has_no_character" }with written copy naming the package, not the raise text — the raise is diagnostic and stays in the log (ConversationsEndpoints.MapPackageStartRefusal). Lifting the constraint itself depends on greeting-ownership unification (greetings need to be package-owned rather than character-owned before a package can stand alone without a character). See packages.md for the unification design.Tracker bindings are deferred.Shipped 2026-09-04 (3aa0275e, P1): a package carries a tracker set in the polymorphicentity_tracker_bindings(owner_type = 6) — thepackage_tracker_bindingssketch is retired. The builder has a "Story State" step on every preset, saved throughfn_save_package_full(p_tracker_uuids, p_trackers_locked).trackers_lockedis stored but not enforced on a conversation.- Individual-item deliverables don't exist yet. Only package deliverables are supported. The "publish a standalone character / mode / lorebook" path still goes through each entity's own publish-request flow, not through
project_deliverables.
Project Workbench (Unified)
The Project Workbench is the unified creative studio for a single project. It opens when a creator clicks "Open in Workbench" from the Projects page (route: /creator/projects/:id/workbench). This is where entities are created, edited, assembled into packages, and tested -- all in one place.
There is no separate Package Builder page. Package configuration is part of the workbench -- selecting a deliverable in the left drawer switches the center panel to the package editor. This keeps everything in one studio and avoids context-switching between pages.
Layout
The workbench uses a three-panel layout with a tabbed center:
┌─────────────────────────────────────────────────────────────────────────┐
│ Crystal of Dawn RPG [ Editor ] [ Map ] [ Sandbox ] │
├──────────────┬──────────────────────────────────┬───────────────────────┤
│ Left Drawer │ Center Panel │ Right Drawer │
│ │ │ │
│ + Create │ Content depends on: │ Project Context │
│ ─────────── │ 1. Active tab (Editor/Map/Sand) │ ───────────── │
│ [All] [Ch] │ 2. Selected item in left drawer │ Inventory │
│ [Mo] [Lo].. │ │ 🧑 Characters 2 │
│ │ Editor: entity form OR package │ 🎭 Modes 2 │
│ Entities │ builder sections │ 📚 Lorebooks 3 │
│ 🧑 D&D 5e │ Map: React Flow graph of all │ ⚡ Profiles 1 │
│ 🧑 Elara │ project connections │ 👋 Greetings 2 │
│ 🎭 Campaign │ Sandbox: test chat with package │ │
│ 🎭 Quick │ config applied │ Deliverables │
│ 📚 Realms │ │ 📦 Full RPG pub │
│ 📚 Party BG │ │ 📦 Quick Play draft │
│ │ │ │
│ ─────────── │ │ │
│ Deliverables│ │ │
│ 📦 Full RPG │ │ │
│ 📦 Quick Pl │ │ │
├──────────────┴──────────────────────────────────┴───────────────────────┤
Left Drawer — Unified Navigation
The left drawer is the workbench's navigation. It contains both entities and deliverables, separated by a divider. Clicking any item switches the center panel's Editor tab to show the appropriate editor:
- Click an entity (🧑 D&D 5e) → Editor shows the entity form (character editor, mode editor, etc.)
- Click a deliverable (📦 Full RPG) → Editor shows the package builder sections (About, Character, Greeting, World Knowledge, Model Profiles, optional read-only legacy fallback, User Controls, Readiness)
This means the left drawer doubles as both entity inventory AND deliverable navigation. The selected item determines what the Editor tab shows.
Left drawer contents:
- Expandable "+ Create" section with PlaceholderCards for each entity type
- Type filter chips with counts (only shown for types that have items)
- Entity list -- click to select and edit in center panel
- Divider
- Deliverables list -- click to select and configure in center panel
Center Panel — Three Tabs
The center panel has three tabs that represent three views of the same project data:
| Tab | Purpose | Mobile | Desktop |
|---|---|---|---|
| Editor | Edit the selected entity or configure a package deliverable | Primary view -- vertical section cards, fully touch-friendly | Full editor with all sections |
| Map | Visual overview of the entire project's entity graph | Disabled or full-screen overlay | Primary discovery tool -- see all connections at a glance |
| Sandbox | Test chat with package configuration and locks enforced | Full-screen chat | Inline chat with config bar |
Editor and Map show the same information from different perspectives:
- Editor is the mobile-friendly, linear view -- vertical cards you can scroll through, edit, and interact with. Works on any screen size.
- Map is the desktop-friendly, spatial view -- a React Flow graph showing all entities as nodes with labeled edges. Gives an overview of the entire ecosystem at a glance.
Both read from the same Zustand store. Editing in the Editor updates the Map in real-time. Clicking a node in Map switches to Editor and scrolls to the relevant section. They are not separate features -- they are two lenses on the same data.
Right Drawer — Project Context
- Project metadata and settings
- Inventory breakdown by entity type
- Deliverables list with publish status (mirrors left drawer deliverables, but as a compact summary)
Header
- Project name
- View toggle tabs (Editor / Map / Sandbox) on the right
- Save / Publish actions (context-aware -- shown when a deliverable is selected)
The main application sidebar is automatically collapsed when the workbench is open to maximize workspace area.
Editor and Map: Two Perspectives, Same Data
The Editor and Map tabs are two representations of the same underlying project graph. This is a core architectural decision:
Editor (Mobile-First, Linear)
The Editor view renders the selected item as a vertical stack of editable sections. When an entity is selected, it shows the entity's form fields. When a package deliverable is selected, it shows the package builder sections (About, Character, Greeting, World Knowledge, Model Profiles, etc.) as collapsible cards; a legacy fallback card appears read-only only when the old row exists.
Why mobile-first: Section cards stack naturally on any screen width. No minimum viewport requirement. Touch-friendly expand/collapse. The Editor is usable on a phone -- the Map is not.
Map (Desktop-First, Spatial)
The Map tab renders the entire project as an interactive node graph using React Flow. Every entity is a node. Every relationship (character→greeting, mode→lorebook provider key, package→component) is a labeled edge. Diagnostic overlays highlight missing connections and warnings.
Why desktop-first: Graph visualizations need screen real estate to be useful. Zoom, pan, and hover interactions require a pointer device. The Map is the "helicopter view" that shows the whole ecosystem -- something the linear Editor cannot provide.
Symmetry
| Action | Editor | Map |
|---|---|---|
| See what a package includes | Scroll through section cards | See component nodes connected to package node |
| Find a missing connection | Warning banner in section card | Red dashed edge or pulsing warning node |
| Edit a component | Expand section, modify fields | Click node → switches to Editor, scrolls to section |
| Understand dependencies | Read connection warnings per section | See the directed graph of dependencies |
| Navigate between items | Click in left drawer | Click a node in the graph |
Both views surface the same validation warnings -- the Editor shows them inline per-section, the Map shows them visually as node/edge decorations. A creator can use either or both depending on their screen size and preference.
Editor Tab — Package Sections
When a package deliverable is selected in the left drawer, the Editor tab shows the package builder sections. This replaces what was previously a separate "Package Builder" page.
Layout
A vertically-scrollable stack of collapsible section cards. Each section represents one component type. Sections are ordered by creation dependency -- what you need first appears first.
┌─ Header ──────────────────────────────────────────────────────┐
│ ← Back to Forge "My D&D Campaign" [Publish ▼] │
├───────────────────────────────────────────────────────────────┤
│ │
│ ┌─ About ─────────────────────────── ✅ ──────────────────┐ │
│ │ My D&D Campaign · RPG · Mature · v1.0.0 │ │
│ │ "A complete D&D 5e campaign experience with..." │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Character ─────────────────────── ✅ 🔒 ───────────────┐ │
│ │ D&D 5e Rules (system) │ │
│ │ "Enforces D&D 5e combat, spells, and skill checks" │ │
│ │ [Change] [Edit] [Unlock] │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Greeting ─────────────────────── ✅ ──────────────────┐ │
│ │ "The Tavern" · from D&D 5e Rules │ │
│ │ "You push open the heavy oak door..." │ │
│ [Change] [Create New] │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ World Knowledge ───────────────── ✅ ──────────────────┐ │
│ │ Forgotten Realms Lore (142 entries) │ │
│ │ Party Background (8 entries) │ │
│ │ [+ Link Lorebook] [Create New] │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Model Profiles & Base prompts ─── ✅ 🔒 ───────────────┐ │
│ │ Claude Optimized ★ · 2 model → Base entries │ │
│ │ Bases: Campaign Mode, Deep Roleplay │ │
│ │ Style & rules: 3 available │ │
│ │ [+ Add Entry] [Edit Profile] [Package Flavor defaults] │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ User Controls ─────────────────── ✅ ──────────────────┐ │
│ │ Locks: Char 🔒 Plan 🔒 Lore 🔓 Instr 🔓 │ │
│ │ Custom Instructions: "Focus on dramatic combat..." │ │
│ │ Persona Suggestion: None │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Readiness ──────── Ready to publish ───────────────────┐ │
│ │ ✅ Name and description set │ │
│ │ ✅ Character configured │ │
│ │ ✅ Creator-configured Base mappings │ │
│ │ ✅ Greeting set │ │
│ │ 2 model profiles · 3 reachable Base variants │ │
│ │ Suggestion: A reachable Base uses the "lorebook" │ │
│ │ key. Consider linking a lorebook for richer context. │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ [Cancel · disabled] [Save · disabled] │
└───────────────────────────────────────────────────────────────┘
The bottom-right Cancel/Save pair is sticky within the package form and always visible: both are disabled while clean, then enabled for staged changes; Cancel precedes primary Save. Publish remains a separate header action and is disabled while the form is dirty or invalid.
Section Behavior
Collapsed state (default after configuration): Shows a summary line with the configured entity name, type badge, lock status, and status indicator.
Expanded state (click to expand): Shows:
- Context box — One-line explanation of what this component does and why (dismissible, remembered per user)
- Current configuration — Full details of the selected/configured entity
- Actions — Change (entity picker), Edit (inline form), Create New (inline creation form)
- Connection warnings — Mismatches between this component and others
The read-only legacy-fallback card is the exception: it has no Change/Edit/Create actions. It exposes only inspection plus the separately confirmed Remove legacy fallback action.
Guided Mode (progressive reveal)
Seven collapsed sections with status badges can feel like a wall. Guided mode addresses this by progressively revealing sections as the creator completes them — a wizard-within-a-page rather than a wizard-instead-of-a-page.
Behavior:
- On first visit, only About is expanded. Remaining sections are visible but dimmed/collapsed
- When About is completed (name + description set), Character auto-expands with a subtle highlight animation
- Each completed section collapses and the next logical section expands
- Sections that depend on earlier ones (e.g., Greeting depends on Character) stay locked until their dependency is met
- The creator can always manually expand any section to skip ahead — guided mode is a suggestion, not a gate
Toggle: A "Guided / Free" toggle in the workbench header. Defaults to Guided for new packages, Free for editing existing packages. Power users can permanently set their preference.
Interaction with templates: Templates can define a custom guided sequence. The RPG Campaign template might expand Character first (with a hint to use "system" type), while the Chat Bot template might expand Model Profiles / its first Base mapping first.
Section Details
About
- Fields: Name, description, genre/category, content rating, cover image, version
- Required: Name, description
- Notes: Version auto-increments on publish. Cover image is the first visual asset in the package.
Character
- Picker: EntityPicker showing user's characters + public characters, with Create New
- Shows: Character name, type badge (character/system/assistant), description excerpt
- Lock toggle: Inline 🔒/🔓 — controls whether end-users can swap the character
- Connection warnings:
- Character type is "system" but a reachable Base has no
rulesprovider key - Character type is "assistant" but a reachable Base has no
assistant_responseprovider key - Each warning names the exact Profile/Entry/Base; never union all variants into one fictitious Mode
- Character type is "system" but a reachable Base has no
Greeting
- Picker: Filtered to greetings belonging to the selected character, with Create New
- Shows: Greeting name, first few lines of content
- Depends on: Character section (must be set first)
- Empty state: "Select a character first to see available greetings"
- Naming note: Uses "Greeting" consistently everywhere (UI, API, data model). Avoid "Opening Scene" — it sounds evocative but creates confusion when users encounter "greeting" in other parts of the app.
Legacy fallback Mode (read-only compatibility)
- Visibility: Render only when an existing package already has
packages.mode_id. New packages and ordinary Workbench saves keep it null; there is no picker, Create New, or replacement flow. - Preservation: Hydrate the legacy value and omit it from ordinary package writes so unrelated Save cannot clear it. Remove legacy fallback is a separate owner-only staged/reverse-impact action; the durable replacement is a policy-1
*Entry, not another direct package Mode. - Shows: Compatibility badge, Mode name, and provider keys used by its sub-prompts. Explain that it is reached only after no Profile Entry matches and before the selected-character/built-in outer fallback.
Mode lock: Lives under User Controls and blocks manual Entry/Mode changes even when there is no legacy fallback; it never blocks creator-defined automatic Profile resolution.Retired 2026-09-20 —packages.mode_lockedis enforced by nothing (Model Profiles govern which mode runs); see Packages § Component Locking.- Connection awareness: When this fallback exists and is reachable, list which provider keys the current package config satisfies:
character✓ (character is set)lorebook⚠️ (no lorebooks linked)persona⚠️ (no persona template set)summary✓ (handled by system)
World Knowledge (Lorebooks)
- Multi-select: Can link multiple lorebooks
- Picker: EntityPicker with Create New
- Shows: Each linked lorebook as a card with name, entry count, unlink button
- Connection warning: Report this per reachable Model Profile Entry/Base and outer fallback; do not infer the whole package from only the legacy fallback Mode.
Model Profiles
- Status: Optional (indicated by ⚡ instead of ✅/❌)
- Visibility: Progressive-disclosure/advanced in v1, but available without a legacy fallback Mode because each Entry selects its own Base prompt.
- Quick presets: Before manual model→Base mapping, offer "Optimize for Claude" / "Optimize for GPT". A "Works with everything" catch-all is available only for a policy-1 package after explicit resolver opt-in.
- Inline management: Create Profiles, add Entries (model → Base prompt with parameter recommendations), and configure optional Web Classic Flavors.
- Shows: Each profile as a collapsible card with its model entries in a table
- Default profile: Star badge; exactly one active binding is normalized as default whenever the set is nonempty.
- Resolver policy: Show the current legacy/corrected policy and its winner preview. The owner-only Opt into corrected resolver action explains
%/_/\and*changes and uses the standard reverse-impact transaction; it never silently upgrades an existing package. - Package Flavor overrides: An authorized package/project editor can hide a Profile Flavor or change its initial default. These are staged dirty fields under the package form’s single Cancel/Save pair; they cannot edit Profile content, order, groups, or Entry recommendations.
- Context box: “Different AI models respond differently. Model Profiles select an always-on Base prompt per model and can offer optional Style & rules choices. An old package may show a read-only legacy fallback; new fallback behavior belongs in an Entry.”
Mode enforcement — Each model profile has a mode_enforcement setting that controls how strictly its mode mappings are enforced when the profile is used in a package:
| Level | Behavior | UI Indicator |
|---|---|---|
| Optional (default) | User can switch to another Mode when the package’s separate Plan lock permits it. The profile mappings are suggestions; available Web Classic Flavor toggles remain optional. | No lock icon |
| Recommended | UI encourages the profile mappings and asks for confirmation when switching away, unless the package’s separate Plan lock blocks that manual action. Available Web Classic Flavor toggles remain optional. | Warning badge |
| Mandatory | The selected model must match an Entry in the governing Profile and use that Entry’s Base; no-match generation and arbitrary Mode detachment are blocked. Exact winner governs, or the package’s single normalized default Profile when none wins. Package Mode lock additionally blocks manual Entry/Mode overrides, not creator-defined automatic re-resolution. | Lock icon |
This is set per-profile (not per-package-link), so the creator decides the enforcement level when authoring the profile. The same profile can be linked to multiple packages, and each use inherits the profile's enforcement setting.
Profile card expanded:
┌─ Claude Optimized ★ (default) ─────────────────────────────┐
│ Mode enforcement: [Optional ▼] │
│ │
│ Model │ Base prompt │ Recommendations │
│ ─────────────────────┼─────────────────┼───────────────── │
│ claude-3.5-sonnet │ Campaign Mode │ temp: 0.8 │
│ claude-3-opus │ Deep Roleplay │ defaults │
│ │
│ [+ Add Model Entry] │
│ [Edit] [Remove] │
└─────────────────────────────────────────────────────────────┘
Add model entry form (inline):
┌─ Add Model Entry ─────────────────────────────────────────┐
│ Model: [anthropic/claude-3.5-sonnet ▼] (known models) │
│ Base prompt: [Campaign Mode ▼] (your modes) │
│ │
│ Parameter Recommendations (optional): │
│ Temperature: [0.8 ] Max Tokens: [ ] │
│ Top P: [ ] Freq Penalty: [ ] Pres Penalty: [ ] │
│ │
│ [Cancel] [Add] │
└───────────────────────────────────────────────────────────┘
User Controls
- Locks: Toggle row for each lockable component (character, lorebooks, trackers). Mode/Entry selection is not lockable —
mode_lockedwas retired 2026-09-20 (see Packages § Component Locking); the About form's "Pipeline choice" radio that wrote it was removed 2026-09-29. Not built: no lock toggle renders anywhere in the builder today — tracked in Packages. Custom instructions is not lockable — the instructions lock was retired 2026-07-22 (Custom Instructions is purely user-driven; see Prompt Presets). - Custom instructions: Textarea for a default value injected into new conversations. The reader can always edit or replace it — this seeds the field, it does not own it.
- Settings defaults: Typed picker over the exact server-owned allowlist in Packages §Package-safe settings defaults. It is not a free-text key/value editor; package Save rejects the entire payload for unknown/malformed/non-allowlisted keys, including every
Generation.*,*Llm.*, secret, admin/default, or entitlement key. - Persona template: Optional persona suggestion for the user
Readiness
- Always visible at the bottom (or as a sticky summary bar)
- Categories:
- Required: name, description (✅/❌)
- Recommended: character, creator-configured prompt path, greeting (✅/⚠️)
- Optional: lorebooks, additional Model Profiles/Flavors, persona, custom instructions (✅/⚡)
- Smart suggestions: Based on current state, surface actionable tips
- Publish gate: Cannot publish until all required items are ✅
Inline Creation Flow
When a user clicks "Create New" in any picker, a modal opens with the full creation form for that entity type (reusing existing form components from CharacterFormPage, ModeFormPage, LorebookFormPage). On save:
- The entity is created via the normal API
- The modal closes
- The new entity is automatically linked to the package
- The section updates to show the new entity
This is critical — users should never need to leave the workbench, create something elsewhere, then come back and link it.
Quick Start Templates
For new packages, before the workbench loads, show a template picker:
┌─────────────────────────────────────────────────────────────┐
│ │
│ What kind of experience are you creating? │
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ │ │ │ │ │ │
│ │ RPG │ │ Chat Bot │ │ Writing │ │
│ │ Campaign │ │ │ │ Workshop │ │
│ │ │ │ Simple │ │ │ │
│ │ System │ │ character │ │ Assistant │ │
│ │ char + │ │ + basic │ │ char + │ │
│ │ detailed │ │ mode │ │ writing │ │
│ │ mode + │ │ │ │ mode │ │
│ │ lorebooks │ │ │ │ │ │
│ └────────────┘ └────────────┘ └────────────┘ │
│ │
│ ┌────────────┐ ┌────────────┐ │
│ │ │ │ │ │
│ │ Story │ │ Blank │ │
│ │ World │ │ │ │
│ │ │ │ Start from │ │
│ │ Character │ │ scratch │ │
│ │ + mode + │ │ │ │
│ │ lorebooks │ │ │ │
│ │ + greets │ │ │ │
│ └────────────┘ └────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Each template includes a one-sentence pitch so creators can self-select without understanding the component list:
| Template | Pitch |
|---|---|
| RPG Campaign | Best for persistent worlds with rules enforcement and stat tracking |
| Chat Bot | Best for simple, single-character conversations with minimal setup |
| Writing Workshop | Best for writing assistants that help with prose, editing, or brainstorming |
| Story World | Best for open narrative with character-driven storytelling and deep lore |
| Blank | Start from scratch — full control, no suggestions |
Templates pre-populate the workbench with:
- Suggested section states (which sections to expand first)
- Placeholder guidance text in context boxes
- Pre-selected component types (e.g., "system" character type for RPG Campaign)
- Custom guided mode sequence (see Guided Mode above)
Templates do NOT create actual entities — they guide the user through what to create.
Map Tab
Purpose
The Map tab renders the project's entity graph as a visual diagram. It shows all entities as nodes and their connections as labeled edges. This serves three purposes:
- Understanding — New users see how everything connects at a glance
- Validation — Missing connections and mismatches are visually obvious
- Navigation — Click any node to jump to its Build section
Architecture: Generic Graph Editor
The Map View is a generic graph editor from day one — a type-agnostic renderer that accepts a registry of node types and edge types. Adding new component types (trackers, living lorebooks, visual assets) means registering new node renderers, not rebuilding the graph system.
// Node type registry — new phases just add entries
const nodeRenderers: Record<PackageComponentType, React.ComponentType<NodeProps>> = {
character: CharacterNode,
greeting: GreetingNode,
mode: ModeNode,
lorebook: LorebookNode,
model_profile: ModelProfileNode,
controls: ControlsNode,
// Phase 2 — just register, no graph engine changes:
// tracker: TrackerNode,
// lorebook_tracker: LorebookTrackerNode,
// living_preset: LivingPresetNode,
}
// Edge style registry — new edge semantics are just style configs
const edgeStyles: Record<MapEdge['type'], EdgeStyleConfig> = {
dependency: { stroke: colors.border.default, animated: false },
data_flow: { stroke: colors.status.info, animated: true },
reference: { stroke: colors.border.muted, dashed: true },
}
This means the graph editor ships fully interactive from v1 — zoom, pan, hover highlighting, click-to-navigate. Later phases only expand what types of nodes appear in the graph.
Layout
Nodes are positioned using dagre auto-layout (see Libraries section). The layout is computed from the graph structure — users don't position nodes manually. If dagre struggles with complex graphs (likely only after trackers are added), swap to ELKjs as a drop-in layout engine replacement.
Example: Base package graph (v1 node types):
┌─────────────────────────────────────────────────────────────┐
│ │
│ ┌──────────────┐ has greeting ┌──────────────┐ │
│ │ Character │───────────────→│ Greeting │ │
│ │ D&D 5e Rules │ │ The Tavern │ │
│ │ (system) 🔒 │ └──────────────┘ │
│ └──────────────┘ │
│ │
│ ┌──────────────┐ selects by model ┌──────────────┐ │
│ │ Model Profile │───────────────────→│ Base Modes │ │
│ │ Claude Opt ★ │ │ Campaign │ │
│ │ 3 entries │ │ Deep RP │ │
│ └──────────────┘ └──────┬───────┘ │
│ │ injects from │
│ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Lorebook │ │ Lorebook │ │
│ │ Realms Lore │ │ Party BG │ │
│ │ 142 entries │ │ 8 entries │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ │
│ │ Controls │ │
│ │ 2 locked │ │
│ │ instructions ✓│ │
│ └──────────────┘ │
│ │
│ Click any node to edit in Editor tab │
└─────────────────────────────────────────────────────────────┘
Example: Extended graph with trackers (same engine, more node types):
┌─────────────────────────────────────────────────────────────┐
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Character │ │ Model Profile │ │
│ └──────┬───────┘ └──────┬───────┘ │
│ │ has greeting │ selects Base │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Greeting │ │ Base Mode │ │
│ └──────────────┘ └──────┬───────┘ │
│ │ injects state │
│ ▼ │
│ ┌──────────────┐ │
│ │ Trackers │ │
│ │ HP, Quests, │ │
│ ┌──────────────┐ │ Inventory │ │
│ │ Lorebook │──────────→└──────┬───────┘ │
│ │ Realms Lore │ feeds │ │
│ └──────────────┘ │ drives state of │
│ ▼ │
│ ┌──────────────┐ │
│ │ LB Trackers │ │
│ │ NPCs (alive?) │ │
│ │ Locations │ │
│ │ Factions │ │
│ └──────┬───────┘ │
│ │ │
│ │ evolves via │
│ ▼ │
│ ┌──────────────┐ │
│ │ Living │ │
│ │ Presets │ │
│ │ (evo rules) │ │
│ └──────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Visual storyboard (v3 enhancement): Nodes display thumbnail previews of their visual assets. The map becomes a storyboard — creators see the visual journey at a glance. Character nodes show portrait thumbnails. Greeting/scene nodes show background thumbnails. Location nodes show environment art. This is a node renderer enhancement, not a graph engine change.
Node Data Model
interface MapNode {
id: string
type: PackageComponentType
label: string
subtitle: string
status: 'configured' | 'empty' | 'warning' | 'optional'
locked: boolean
thumbnail?: string // v3: asset preview
position: { x: number; y: number } // computed by layout
}
interface MapEdge {
id: string
source: string // node id
target: string // node id
label: string // "selects Base", "has greeting", etc.
type: 'dependency' | 'data_flow' | 'reference'
animated?: boolean // true for data_flow edges
}
// Extensible — new phases register new types here and in the node renderer registry
type PackageComponentType =
| 'character'
| 'greeting'
| 'mode'
| 'lorebook'
| 'model_profile'
| 'controls'
| 'tracker'
| 'lorebook_tracker'
| 'living_preset'
Interaction
- Hover: Highlight connected edges and nodes
- Click: Package-section nodes navigate/scroll to that section; entity nodes such as a Base Mode or Model Profile open that entity’s existing drawer/editor. There is no editable package Mode section.
- Zoom/Pan: Standard scroll-to-zoom and drag-to-pan (via React Flow)
- Future: Click to edit in place (inline editing overlay on the map)
Interactivity scope: The Map is fully interactive from v1 (zoom, pan, hover, click-to-navigate) but read-only — nodes and edges are derived from the Editor tab state, not user-drawn. Users don't drag to create connections or manually add nodes. Later phases may add light editing (e.g., reordering lorebook priority via drag, unlinking by right-clicking an edge) but the Editor tab remains the primary editing surface.
Diagnostic Mode
The Map's primary value isn't being a pretty diagram — it's surfacing what's broken. The visual treatment makes issues impossible to miss:
- Warning nodes pulse with a subtle amber glow animation
- Error nodes (missing required connections) have a red border
- Broken edges (e.g., mode expects
lorebookkey but none linked) render as dashed red lines with an⚠icon at the midpoint - Healthy nodes have a solid border with a checkmark badge
- "Show issues only" filter — toggle in the Map toolbar that dims healthy nodes and edges, making only problems visible. Useful once the graph gets complex.
Clicking a warning/error node or edge navigates to the relevant Build section with the connection warning already highlighted.
Accessibility
Custom React Flow nodes must include:
- ARIA labels on each node (e.g.,
aria-label="Character: D&D 5e Rules, configured, locked") - Keyboard navigation — Tab to traverse nodes, Enter to navigate to Build section, arrow keys for spatial movement
- Focus indicators — visible focus ring on the active node matching the design system
- Screen reader announcements — on hover/focus, read node type, label, status, and connection count
- Edge labels — exposed via
aria-describedbyor grouped landmark for screen readers
React Flow supports custom nodeTypes with full DOM control, so all of this is achievable without fighting the library.
Sandbox Tab
Purpose
The Sandbox tab lets creators experience their package as an end-user would — with locks enforced, hidden components hidden, and only the customizable bits exposed. This catches configuration mistakes that aren't visible in the Editor or Map.
This is NOT the v3 visual novel Preview. It's a standard chat session launched with the package config applied. The existing chat system already supports everything needed — the Sandbox just wires it up with the current workbench state.
Requires a package deliverable to be selected in the left drawer. When no deliverable is selected, the Sandbox tab shows a prompt to select or create one.
What it does
- Launches a chat conversation using the package's configured character, current model→Entry→Base resolution, greeting, lorebooks, and validated package-safe settings defaults
- Enforces locks — locked components cannot be changed during the test session, exactly as an end-user would experience
- Applies validated package-safe settings defaults and custom instructions from the User Controls section
- Shows what the user sees — it executes the real Entry → legacy-package → selected-character → built-in resolver chain and exposes the exact winning provenance; it never invents an unlabeled placeholder when a configured component is absent
Layout
The Sandbox fills the center panel area (between the left and right drawers):
┌─────────────────────────────────────────────────────────────────┐
│ [ Editor ] [ Map ] [*Sandbox*] [Reset Chat] │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─ Config bar ───────────────────────────────────────────────┐ │
│ │ Char: D&D 5e Rules 🔒 │ Profile: Claude Optimized ★ │ │
│ │ Entry: sonnet → Base: Campaign │ Style & rules: 2 on │ │
│ │ Lore: 2 linked 🔓 │ Instructions: set 🔓 │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Chat ─────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ D&D 5e Rules: │ │
│ │ "You push open the heavy oak door of the Gilded │ │
│ │ Coin tavern..." │ │
│ │ │ │
│ │ [Type a message...] [Send] │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Issues ───────────────────────────────────────────────────┐ │
│ │ ⚠ Manual plan and component edits are locked. │ │
│ │ Style & rules: 2 optional choices remain. [Edit Locks] │ │
│ └────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Key behaviors
- Config bar shows exact resolver policy + Profile/Entry/Base/fallback provenance and lock status. Locked manual plan actions display 🔒; creator-defined automatic resolution remains visible rather than being described as a packaged Mode.
- Issues panel surfaces problems detected during the test:
- All lockable component edits disabled; describe this as zero customization only when no Flavor or other unlocked controls actually remain
- No greeting configured (chat starts blank)
- A reachable Base/enabled-Flavor plan uses dependencies that have no matching components
- Reset Chat clears the conversation and starts fresh. The test conversation is disposable — not saved to the user's conversation list
- Opening and role pickers in the chat header let the creator test every start-time choice a reader gets: any of the package's greetings (or the character's linked ones), and any of the package's bound persona templates — or "Just my persona", the reader's opt-out. Picking either starts a fresh sandbox conversation with that choice applied. The role picker offers only what the saved package binds — roles are attached to the saved package, not the draft — so a template just dropped into the builder shows up in the picker after the next Save
- Live reload within the frozen roster — after Save, Base/Flavor content edits, current-link hide/delete suppression, and non-roster package changes are revalidated for the next accepted message. Adding/unhiding a Flavor or changing its initial default/order/group/stage never mutates the existing Profile roster: Sandbox shows Reset Chat to use new Style & rules choices, and Reset launches a fresh mapped/Sandbox plan. It never claims unrestricted in-place reload.
- [Edit Locks] on issue warnings navigates to the Editor tab and scrolls to the relevant section
Why this matters for v1
The Editor tells you what's configured. The Map tells you how things connect. But neither tells you what the experience feels like. The Sandbox closes that loop. It's the difference between reading a recipe and tasting the food.
Gallery View (v3)
A visual asset browser that aggregates all images, sprites, backgrounds, and audio across every node in the graph. Organized by entity:
┌─ Gallery ─────────────────────────────────────────────────┐
│ │
│ Character: D&D 5e Rules │
│ ┌────────┐ ┌────────┐ ┌────────┐ ┌──────────┐ │
│ │portrait│ │neutral │ │angry │ │+ Add │ │
│ │ .png │ │ .png │ │ .png │ │ sprite │ │
│ └────────┘ └────────┘ └────────┘ └──────────┘ │
│ │
│ Greeting: The Tavern │
│ ┌────────────────┐ ┌──────────┐ │
│ │ bg_tavern.png │ │+ Add │ │
│ │ │ │ asset │ │
│ └────────────────┘ └──────────┘ │
│ │
│ Locations (from Lorebook Trackers) │
│ ┌────────────────┐ ┌────────────────┐ ┌──────────┐ │
│ │ bg_forest.png │ │ bg_castle.png │ │+ Add │ │
│ │ Dark Forest │ │ Iron Keep │ │ asset │ │
│ └────────────────┘ └────────────────┘ └──────────┘ │
│ │
└───────────────────────────────────────────────────────────┘
Visual assets are properties on graph nodes — not a separate system. A character node has a sprites array. A greeting node has a background field. A location lorebook tracker has an environmentArt field. The Gallery view just aggregates and displays them.
Preview View (v3)
A visual novel-style playback that traverses the package graph. It renders:
- Background: From the current scene/greeting/location
- Character sprite: From the active character, expression-matched
- Text box: The greeting text or AI-generated dialogue
- UI chrome: Based on the mode's theme settings
┌─────────────────────────────────────────────────────────────┐
│ │
│ [bg_tavern.png] │
│ │
│ │
│ ┌─────────────┐ │
│ │ Character │ │
│ │ (neutral) │ │
│ └─────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ D&D 5e Rules │ │
│ │ │ │
│ │ "You push open the heavy oak door of the Gilded │ │
│ │ Coin tavern. The warmth hits you first, then the │ │
│ │ smell of roasting meat and spilled ale..." │ │
│ │ [Continue] │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
The Preview view uses the same graph data but renders it as a visual novel experience. This is also the rendering approach used at runtime when users interact with the package — the workbench preview is just the creator-facing version of the same renderer.
State Management
The workbench uses a single Zustand store that merges the current workbenchStore (project context, entity inventory, drawers) with the package builder state. There is no separate packageBuilderStore — both entity editing and package configuration share one store.
interface WorkbenchState {
// Project context
projectId: number | null
projectName: string
// Entity inventory (all items in the project)
items: ProjectItem[]
deliverables: ProjectDeliverable[]
// Selection — what's active in the left drawer
selectedItemId: string | null // entity ID or null
selectedDeliverableId: number | null // deliverable ID or null (mutually exclusive with selectedItemId)
// Package data (populated when a deliverable is selected)
package: PackageData | null
isDirty: boolean
isSaving: boolean
// Package component selections (for the active deliverable)
character: CharacterSummary | null
greeting: GreetingSummary | null
mode: ModeSummary | null
personaTemplate: PersonaTemplateSummary | null
lorebooks: LorebookSummary[]
modelProfiles: ModelProfileWithEntries[]
// Package configuration
locks: PackageLocks
customInstructions: string
settingsOverrides: Record<string, string>
// UI state
activeTab: 'editor' | 'map' | 'sandbox'
expandedSections: Set<string>
activeModal: ModalState | null // for inline creation modals
// Readiness
readiness: ReadinessCheck
// Map tab
mapNodes: MapNode[]
mapEdges: MapEdge[]
// Actions
setCharacter: (char: CharacterSummary | null) => void
setGreeting: (greeting: GreetingSummary | null) => void
setMode: (mode: ModeSummary | null) => void
addLorebook: (lorebook: LorebookSummary) => void
removeLorebook: (lorebookId: number) => void
toggleLock: (component: LockableComponent) => void
setCustomInstructions: (text: string) => void
save: () => Promise<void>
publish: () => Promise<void>
computeReadiness: () => ReadinessCheck
computeMapGraph: () => { nodes: MapNode[]; edges: MapEdge[] }
// Undo/redo
undo: () => void
redo: () => void
canUndo: boolean
canRedo: boolean
}
Undo/Redo
Linking/unlinking entities, toggling locks, and changing settings are all easy to do accidentally. The store maintains a history stack of the last 20 state snapshots. Each action that modifies package state pushes to the stack. Ctrl+Z / Ctrl+Shift+Z triggers undo/redo.
Implementation: Use Zustand's temporal middleware (from zundo) or a simple manual implementation — snapshot the relevant state slice before each mutation, push to an array, pop on undo. Only package data fields are tracked (not UI state like expandedSections or activeTab).
Readiness Computation
interface ReadinessCheck {
canPublish: boolean
items: ReadinessItem[]
suggestions: string[]
}
interface ReadinessItem {
label: string
status: 'required_met' | 'required_missing' | 'recommended_met' | 'recommended_missing' | 'optional'
detail?: string
}
Readiness is computed reactively whenever package state changes. Rules:
| Check | Category | Condition |
|---|---|---|
| Name set | Required | name.trim().length > 0 |
| Description set | Required | description.trim().length > 0 |
| Character selected | Recommended | character !== null |
| Creator-configured prompt path | Recommended | at least one valid Model Profile Entry exists, or the selected character has a valid default Mode, or an existing read-only legacy fallback remains; built-in DefaultSections keeps runtime valid but does not satisfy this authoring recommendation |
| Greeting selected | Recommended | greeting !== null |
Lorebooks linked (if a reachable Base uses lorebook) |
Recommended | lorebooks.length > 0 when any reachable Entry/Base or outer fallback declares lorebook |
Persona set (if a reachable Base uses persona) |
Recommended | personaTemplate !== null when any reachable Entry/Base or outer fallback declares persona |
| Model profiles configured | Optional | modelProfiles.length > 0 |
| Custom instructions set | Optional | customInstructions.trim().length > 0 |
Connection Warning Computation
interface ConnectionWarning {
source: { kind: 'base' | 'flavor' | 'fallback'; id: string; label: string }
severity: 'warning' | 'info'
message: string
action?: { label: string; target: { kind: 'section' | 'entity'; id: string } }
}
Warnings are actions, not just information. Each warning includes a one-click resolution when possible:
| Warning | Action |
|---|---|
Reachable Base “Campaign” uses lorebook but no lorebooks are linked |
[+ Add a lorebook] — opens World Knowledge picker inline |
Character is type “system” but reachable Base “Quick Chat” has no rules dependency |
[Edit Base] — opens that Mode entity editor; it never scrolls to a package Mode slot |
Reachable Base/Flavor plan uses persona but no persona template exists |
[Set persona] — scrolls to User Controls |
Lorebooks are linked but a reachable Base omits lorebook/knowledge |
[Edit Base] — opens that exact Base; warnings remain per variant rather than unioned |
This turns passive warnings into the fastest path to fixing them.
Responsive Behavior
| Breakpoint | Layout |
|---|---|
| Desktop (900px+) | Full workbench with all three tabs (Editor, Map, Sandbox) |
| Tablet (768-900px) | Editor + Sandbox tabs, Map as full-screen overlay |
| Mobile (<768px) | Editor + Sandbox tabs, Map disabled |
Mobile users can still create, configure packages, and test in the Sandbox — they just don't get the Map visualization. The Editor's section-card pattern already works well in vertical stacked layouts.
Important: Connection warnings are the most valuable part of the workbench, and on mobile the Map (which visualizes them) is disabled. The Editor must surface all connection warnings prominently on mobile — each section card shows its warnings inline, and the Readiness panel at the bottom aggregates all issues. Mobile users get the same diagnostic information, just without the graph visualization.
This is the core reason Editor and Map exist as separate views of the same data: Editor is the mobile-friendly entry point, Map is the desktop-friendly overview. They are complementary, not redundant.
Library Recommendations
Current Stack (already installed)
| Library | Version | Usage in Workbench |
|---|---|---|
| React | 18.3 | UI framework |
| Zustand | 5.x | Workbench state store |
| react-router-dom | 7.x | Routing to workbench page |
| react-icons | 5.x | Section icons, status indicators |
Recommended Additions
React Flow (@xyflow/react) — Map View
| Attribute | Value |
|---|---|
| Package | @xyflow/react |
| Bundle | ~93 kB gzipped |
| License | MIT (core — sufficient for our needs) |
| Downloads | ~850K/week |
| Stars | ~31,800 |
| TypeScript | First-class |
Why React Flow:
- Industry standard for node-based UIs in React
- Custom nodes (render any React component as a node — our section cards)
- Custom edges (labeled, styled, animated)
- Built-in zoom/pan, minimap, controls
- Integrates with dagre for auto-layout
- Actively maintained by dedicated team
- The Map View is literally what this library was built for
What we use:
- Custom node components (package component cards with thumbnails, badges, status)
- Custom edge components (labeled connection lines)
- Zoom/pan for navigating large graphs
- Click handlers for node → Editor tab navigation
- Minimap for orientation in complex graphs (v2+)
What we DON'T need from React Flow:
- Drag-and-drop node creation (our nodes come from Editor tab actions)
- Connection drawing (connections are computed, not user-drawn)
- Sub-flows (not needed for v1)
Dagre (@dagrejs/dagre) — Auto-Layout
| Attribute | Value |
|---|---|
| Package | @dagrejs/dagre |
| Bundle | ~29 kB gzipped |
| License | MIT |
| Downloads | ~800K/week |
| Execution | Synchronous |
Why Dagre:
- Simple directed graph layout — exactly what package connections are
- Synchronous execution (no async complexity)
- Small bundle size
- Well-documented integration with React Flow (official example exists)
- Handles variable node sizes
- Top-to-bottom or left-to-right layout modes
When to upgrade to ELKjs:
- If/when the graph gets complex enough that dagre's single algorithm produces poor layouts (likely v2+ with trackers). ELKjs (~150 kB gzip) should be lazy-loaded if added.
react-archer (react-archer) — Build View Connection Lines (Optional)
| Attribute | Value |
|---|---|
| Package | react-archer |
| Bundle | ~5-15 kB gzipped |
| License | MIT |
| Downloads | ~130K/week |
Why consider react-archer:
- Lightweight declarative arrows between DOM elements
- Could draw subtle connection lines between Editor tab sections
- Shows relationships without needing the full Map tab
- Simple API: wrap sections in
<ArcherElement>, define targets
When to use: Only if we want visual connection lines in the Editor tab itself (between section cards). If the Map tab is sufficient for showing connections, skip this library.
Future Libraries (v3 — Visual Novel)
These are NOT needed for v1 or v2. Documented here for architectural awareness.
Option A: NarraLeaf React (narraleaf-react) — Pure React VN
| Attribute | Value |
|---|---|
| Bundle | Lightweight (pure React, no canvas) |
| License | MPL-2.0 |
| Rendering | DOM-based (character sprites as <img>, text as styled <div>) |
Pros: Pure React/TypeScript, no canvas dependency, aligns with our stack, lightweight. Cons: v0.4.x (not 1.0 yet), smaller community.
Option B: Pixi'VN (@drincs/pixi-vn) — PixiJS-powered VN
| Attribute | Value |
|---|---|
| Bundle | Larger (PixiJS dependency) |
| License | Open source |
| Rendering | Canvas-based (PixiJS 2D rendering) |
Pros: More mature, Ren'Py-inspired, Zustand-compatible, better for complex sprite effects. Cons: Canvas rendering (not DOM), heavier bundle, more complex integration.
Option C: Custom VN Renderer
Build a minimal VN renderer using standard React components:
- Background:
<img>with CSS transitions - Sprites: Absolutely positioned
<img>elements - Text box: Styled
<div>with typewriter effect - Choices: Button list overlay
Pros: Zero new dependencies, full control, matches design system. Cons: More development effort, no scripting language.
Recommendation: Start with Option C (custom) for the Preview view. The VN rendering we need is simple — background + sprite + text box. If complexity grows (animations, transitions, branching dialogue), evaluate NarraLeaf or Pixi'VN. The graph data model supports any renderer.
Libraries NOT Recommended
| Library | Why Not |
|---|---|
| ELKjs (v1) | ~150 kB gzip, overkill for v1's simple DAG. Dagre is sufficient. Revisit for v2. |
| Reaflow | Bundles ELKjs internally — same size concern. React Flow + dagre is more modular. |
| JointJS | Not React-native, commercial tier needed for advanced features. |
| jsPlumb | Fully commercial. React Flow covers our needs. |
| d3-hierarchy | Tree-only (single root). Our graph has multiple entry points. Dagre handles this. |
| react-xarrows | Unmaintained. Author recommends React Flow. |
| Leader Line | Not React-native, archived. |
Phased Implementation Plan
Phase 1 — Minimum Viable Workbench
Goal: Creators can manage projects with sub-items, create package deliverables, and publish individual items — with full visibility into connections and readiness. All within a single unified workbench.
New dependencies: @xyflow/react, @dagrejs/dagre, zundo (undo/redo middleware for Zustand)
What already exists (implemented):
- ✅ Projects page with 3-panel layout, entity list, drag-and-drop, changelog
- ✅ Project CRUD (DB + API + frontend)
- ✅ Project items management (add/remove/reorder, bulk ops, unclaimed items)
- ✅ Model profile CRUD (DB + API + frontend)
- ✅ Workbench shell with ThreePanelLayout, EntityDrawer, ProjectContextDrawer
- ✅ Package builder section components (About, Character, Greeting, World Knowledge, Model Profiles, User Controls, Readiness; legacy fallback is compatibility-only)
- ✅ Zustand stores (
workbenchStore,sandboxStore,projectStore) - ✅ Types (MapNode, MapEdge, ReadinessCheck, ConnectionWarning, etc.)
- ✅ Entity changelog (partitioned, triggers, view, API)
- ✅ Merged
packageBuilderStoreintoworkbenchStore(single store) - ✅ Deliverables in left drawer (EntityDrawer) alongside entities
- ✅ Context-sensitive Editor tab: entity form when entity selected, package builder sections when deliverable selected
- ✅ Map tab: React Flow + dagre graph (GraphCanvas, MapView) with node type registry
- ✅ Sandbox tab: chat as end-user with package config and locks enforced (SandboxChat + sandboxStore)
- ✅ Removed separate
PackageBuilderPageroute — all package work in workbench - ✅ Readiness panel with validation (ReadinessSection + packageValidation)
- ✅ Entity pickers for character, greeting, mode, lorebook (EntityPickerModal)
- ✅ Model profile inline editor with quick presets (PresetBuilderView)
- ✅ Individual item deliverable editor in EntityDrawer
- ✅ Deliverable CRUD endpoints (CreatorProjectEndpoints)
- ✅ Package CRUD endpoints (CreatorPackageEndpoints)
- ✅ Package save orchestrator (
fn_save_package_full) — single-call upsert that resolves UUIDs, gates on project owner /can_contribute, syncs lorebook + model-profile + persona-template bindings, upserts the deliverable, and bumps the patch version, all in one transaction. Used by every production save path. - ✅ Package read functions (
fn_get_package_for_edit,fn_list_package_presets,fn_create_conversation_from_package,fn_get_conversation_model_profiles) - ✅ Maturity helper (
fn_is_mature_rating) wired intopackage_view,admin_packages_view, and the browse path viaBrowseQuery.IncludeMature - ✅ Package views (
package_view,admin_packages_view) — both use LATERAL aggregates forlorebook_count/conversation_countand expose anis_maturecolumn - ✅ Deliverable DB functions (
fn_list_project_deliverables— owner /can_viewgated, derivesis_published/published_atfrompackages.is_public+publish_requests;fn_delete_deliverable).fn_publish_deliverablewas removed by47c_collapse_deliverable_publish_into_package.sql— publishing is now part of the package save flow viafn_handle_publish_request(see Publish Flow below). - ✅ Publish flow:
fn_save_package_fullreturns three result columns —is_public(current publish state),was_auto_published(auto-publish tripped on this save, viafn_verified_creator_auto_publishwithentity_type = 6),was_flagged(routed into the moderation queue). The TypeScript client (packages.ts) mirrors these onSavePackageResponseso the workbench can show "published" / "pending review" / "auto-approved" states inline. - ✅
fn_get_package_for_editreturnscover_image_uuid+resolved_cover_url(gallery-FK pattern) andpublish_request_status(latest publish-request state for the package). The editor reads these to render the cover thumbnail and the publish-status pill. - ⚠️ Legacy lower-level primitives (
fn_save_package,fn_save_project_deliverable,fn_sync_package_lorebook_bindings,fn_sync_package_model_profile_bindings) are still present and exercised byDatabase.Tests, but their C# wrappers are marked[Obsolete]— production code must usefn_save_package_full. The twofn_sync_*functions are still called internally byfn_save_package_fullviaPERFORM.
Frontend — Remaining work:
- Actionable connection warnings (each warning includes a one-click fix)
- Guided mode (progressive section reveal) with Guided/Free toggle
Phase 2 — Trackers and Living Lorebooks
Goal: Packages can include stateful elements that evolve during gameplay.
New dependencies: Possibly elkjs (lazy-loaded) if dagre can't handle the graph complexity.
Frontend:
- Tracker section in Editor tab
- Lorebook tracker section (NPC state, locations, factions)
- Living lorebook preset section (evolution rules)
- Register new node types (tracker, lorebook_tracker, living_preset) in graph editor
- Data flow edge styles (animated) for tracker connections
- Tracker configuration UI (define trackable values, thresholds, triggers)
Backend:
- Tracker state management endpoints
- Living lorebook preset CRUD
- Lorebook tracker link management
- State evolution engine (process tracker changes → lorebook updates)
Phase 3 — Visual Assets and Visual Novel
Goal: Packages become visual experiences with character sprites, scene backgrounds, and VN-style rendering.
New dependencies: Potentially narraleaf-react or custom VN renderer.
Frontend:
- Gallery view (asset browser across all graph nodes)
- Asset upload/management per entity (character sprites, scene backgrounds)
- Preview view (VN-style playback)
- Thumbnail previews on graph nodes (storyboard mode — node renderer enhancement)
- VN renderer component (background + sprites + text box + choices)
Backend:
- Asset storage and CDN integration
- Asset metadata (expressions, scene tags, etc.)
- VN scene sequencing data
Design Decisions
Resolved from external review and internal constraints.
1. Template persistence — Database, with user-created templates
Store templates in the database, not hardcoded. This enables:
- Admin-created templates that can be updated based on user feedback and trends
- User-created templates — creators can save their package structure as a shareable template (post-v1)
- Community templates — users can browse and use templates published by other creators
Implementation phases:
- v1: Admin-seeded templates stored in DB, selected at package creation
- Post-v1: "Save as template" action on any package, template browsing/sharing in the template picker
2. Collaborative editing — Deferred, design for it later
Not in scope for v1. If added later, use read-only sharing first (invite collaborators to view), then co-editing with last-write-wins conflict resolution per section. The Zustand store structure already isolates sections cleanly, which helps.
3. Version diffing — Desired, but blocked by DB infrastructure
Showing a changelog on re-publish (added/removed components, major config changes) would be valuable for both creators and end-users. However, our current database infrastructure does not support version history or snapshot storage for packages.
Current limitation: No package version history tables, no snapshot mechanism, no diff computation in the DB layer.
What's needed before this can happen:
- Package version history table (storing snapshots or deltas per publish)
- DB functions for computing diffs between versions
- Potentially a
package_versionstable with serialized state per version
Decision: Skip for v1 and v2. The Entity Changelog feature partially unblocks this — changelog entries between two publish events can reconstruct what changed per version. Full snapshot-based diffing would require additional infrastructure. In the meantime, the version field in the About section auto-increments on publish but has no stored history to diff against.
4. Model profile sharing — Shareable by default; V1 roster overrides only
Model profiles are global entities owned by a creator and can be linked to multiple packages. The shipped/V1 link is live. A package may choose its one default Profile and may hide a Flavor or change that Flavor’s initial default without modifying the Profile. It has no package-scoped generation-parameter override layer: Entry parameters are recommendations, applied only when a chat user explicitly chooses Apply Entry recommendations. Any future package-specific parameter layer needs its own precedence/storage spec rather than being smuggled into the Flavor override table.
This reduces duplication for creators managing similar packages and enables a future "profile library" where popular profiles can be discovered.
5. Map layout persistence — Auto-layout by default, optional manual mode
Always auto-layout (dagre) by default. Add an "Edit Layout" toggle where users can drag nodes to custom positions. Custom positions are saved in the package data. Auto-layout acts as a reset.
This avoids forcing users to arrange nodes manually while still allowing customization for creators who care about presentation.
6. Inline creation depth — One level of nesting
Limit inline creation to one level. For example, creating a character inline opens the character form modal. If that character needs a greeting, the greeting creation opens as a sequential modal (after character save), not a nested modal inside the character form.
Deep nesting leads to modal stacking, lost context, and confusing navigation. Sequential modals with auto-linking (character saved → greeting form opens → greeting auto-linked to character and package) keeps the flow linear.
7. Template content model — Guidance only, no entity references
When a user saves a package as a template, it stores structure and guidance only — which sections are active, suggested component types (e.g., "system character"), and guidance text. It does NOT include references to specific entities (characters, lorebooks, etc.).
Why no entity references:
- Referenced entities can be deleted, made private, or changed — creating fragile dependencies
- Templates should encourage creation, not copy-pasting someone else's components
- Guidance-only templates are simpler to share and maintain
What a template contains:
- Active section list with suggested order
- Per-section guidance text (e.g., "Create a system character that enforces your game rules")
- Suggested component types (e.g., character type = "system")
- Recommended lock configuration
- Template metadata (name, description, category, author)
8. Future: Model profile versioning — Pin on link, explicit upgrade
In that future model, linking a Profile would pin the package to the current published Profile version. Later Profile publication would show Update available rather than silently changing the package.
Why pin, not auto-update:
- Base mappings, optional Flavors, and parameter recommendations are tuned to specific model behavior — silent package-level changes can subtly break experiences
- Creators need to test after updates, not discover breakage from users
- Aligns with how package managers work (lockfiles, explicit upgrades)
Workflow:
- Creator links Profile → package stores a snapshot of the Profile state
- Profile owner updates the profile → dependent packages show "Update available" badge
- Package creator clicks "Update" → sees a diff of what changed → confirms or dismisses
- "Fork to local" option — copies the profile into a package-scoped version, breaking the link entirely
9. Contextual help panel — Slide-out drawer, context-aware
A ? button in the workbench header opens a side panel with help content relevant to the currently active Build section. This addresses onboarding and cognitive load without requiring a separate tutorial system.
Why a panel, not a tab:
- The workbench tabs (Build, Map, Gallery, Preview) are all views of the package graph — help content is reference material, not package data
- A slide-out panel stays accessible without navigating away from work
- Context-awareness puts the right information in front of the user at the right time
Panel behavior:
- Opens from the right side, does not displace the main content (overlay on mobile, side-by-side on desktop)
- Content updates when the user expands a different Build section
- Each section has: a short explanation, a "how it connects" diagram snippet, common mistakes, and a link to full docs
- Dismissible — remembers open/closed state per session
Relationship to context boxes:
- Context box (inline in each section) = one-line explanation, dismissible permanently
- Help panel = deeper dive, always available via
?button
Content examples by section:
| Section | Help Panel Content |
|---|---|
| Character | What character types mean, how they interact with modes, when to use "system" vs "character" |
| Mode | What provider keys are, how sub-prompts compose, how to test a mode |
| World Knowledge | How lorebook injection works, entry limits, keyword vs semantic matching |
| Model Profiles | Why different models need different settings, how to test profiles |
Future (post-v1): Evolve into a full knowledge base tab with longer guides, example packages to study, and community tips. The contextual panel remains as the quick-access layer.
10. Sub-item independence — Items live in the creator's account
Creating an item inside a project creates it in the creator's account. The project links to it (hybrid ownership). This means:
- The same character can appear in multiple projects
- Items are visible in the Characters tab, Lorebooks tab, etc.
- Deleting a project does NOT delete its items (just the links)
- Deleting an item removes it from all projects that reference it
11. Deliverables vs. direct publishing
Individual items can already be published (characters have is_public, lorebooks have is_public, etc.). Deliverables add a project-scoped publishing layer on top:
- A deliverable tracks that this item was published as part of this project
- Multiple projects can publish the same item as separate deliverables with different metadata
- The deliverable has its own name, description, cover image, and tags — independent of the item's own metadata
For v1, individual item deliverables may simply set is_public = true on the underlying item and add Hub metadata. The full deliverable abstraction (independent metadata, multiple deliverables for the same item) can come later.
Impact on Existing Pages
The Creator Workbench introduces concepts (projects, packages, locks, deliverables) that affect the chat UI and lorebook assistant. This section documents what existing patterns translate directly and what changes each page needs.
What Translates Directly
Both the v2 chat UI and the lorebook assistant already use ThreePanelLayout with Zustand stores. These patterns carry over to the workbench without changes:
| Pattern | Where it exists today | How the workbench uses it |
|---|---|---|
ThreePanelLayout |
Chat (HowDrawer / ChatPanel / WhoDrawer), Lorebook Assistant (Sessions / Chat / Inspector) | Project view, Package Workbench |
EntityPickerModal |
Chat WhoDrawer (persona, lorebook selection) | Sub-item "Add existing", Editor tab entity pickers |
| Inline creation in picker | Chat WhoDrawer (create persona inside picker modal) | "Create New" in any sub-item or Editor tab picker |
DrawerSection collapsible sections |
Chat WhoDrawer (persona, lorebooks, instructions) | Editor tab section cards |
| Zustand store with state slices | Chat (useChatViewStore), Assistant (useLorebookAssistantStore) |
usePackageWorkbenchStore, useProjectStore |
| SSE streaming | Chat (conversation messages), Assistant (chat + proposals) | Sandbox tab (reuses chat streaming) |
| Bind/unbind with type badges | Chat WhoDrawer lorebooks (character / persona / conversation badges) |
Sub-items flat list (type badges per item) |
| Custom instructions inline edit | Chat WhoDrawer | Editor tab User Controls section |
PanelErrorBoundary per panel |
Lorebook Assistant (all panels wrapped) | All workbench panels |
| Session lifecycle management | Lorebook Assistant (active → completed → abandoned) |
Project lifecycle (concept parallel, not direct reuse) |
| Diff tracking (snapshot vs. current) | Lorebook Assistant (session diff panel) | Future: version diffing for packages (Design Decision #3) |
| Batch operations | Lorebook Assistant (batch approve/reject proposals) | Bulk sub-item management (multi-select remove, reorder) |
Changes Needed: V2 Chat UI
The chat UI needs to support package conversations — conversations created from a package that enforce locks and display package context.
1. Package-aware conversation creation
Current: CharacterPicker creates a conversation with { characterId, greetingId? }. No package concept.
Needed: A "Start Experience" flow that creates a conversation with { packageId }. In current scope it requires the package’s bound character; public null-character/BYOC launch remains blocked on greeting ownership. The backend resolves the model→Entry→Base plan (or outer fallback) and applies package lorebooks, greeting, custom instructions, and only the validated package-safe settings defaults. The frontend navigates to /chat/v2/{conversationId} as normal — the conversation is a regular conversation with a package_id FK.
Where: New entry point from Hub/Browse package detail page, not inside the chat UI itself. The CharacterPicker at /chat/v2/new stays as-is for non-package conversations.
2. Lock enforcement in drawers
Current: All components in HowDrawer and WhoDrawer are always editable. Mode can be changed, lorebooks can be bound/unbound, persona can be swapped.
Needed: When conversation.packageId is set, check the package's lock state for each component:
| Component | Drawer | When locked | When unlocked |
|---|---|---|---|
| Character | — | Character is fixed. No swap option anywhere. | Normal (but package provides default) |
| Entry / Mode plan | HowDrawer | Current Base/provenance remains visible; Use Profile Entry / Use Mode actions remain visible disabled with “Locked by this package.” Automatic model→Entry resolution and optional Flavor toggles remain active. | Normal selection subject to the governing Profile’s enforcement |
| Lorebooks | WhoDrawer | Bind/unbind buttons hidden for package lorebooks. "Managed by package" label. | Normal — user can add/remove. Package lorebooks always present but removable. |
| Custom instructions | WhoDrawer | Textarea read-only or hidden. Shows package instructions as non-editable text. | Normal — package instructions pre-filled, user can edit. |
Important: Lorebook presence is never mandatory just because a mode has a lorebook provider key. The provider key means the mode can inject lorebook content if lorebooks are available — it does not mean lorebooks must be present. A conversation without lorebooks still works; the lorebook injection step simply has nothing to inject.
3. Package indicator in header
Current: Header shows character name and drawer toggles.
Needed: When a package conversation is active, show:
- Package name/icon in the header (e.g., "Crystal of Dawn RPG")
- Visual distinction from regular conversations
4. Future package update notification — blocked on version snapshots
Current: Package and conversation version strings exist as metadata, but there is no snapshot-backed component history, diff, restore, or upgrade transaction. The stored string cannot prove that live component rows still equal the graph at conversation creation.
Not V1: The current live-link schema cannot preserve or restore “the version this conversation started on.” After package/component snapshot storage, diffing, and an atomic upgrade contract exist, a later UI may offer:
- Notification bar below header: "Package updated — [View changelog] [Update] [Dismiss]"
- An update/restart action whose component and Flavor-roster behavior is specified against stored versions rather than inferred from live rows
- The existing conversation
package_versionmay act as a notification cursor only after the snapshot/diff substrate gives that comparison defined component semantics
5. Detach from package
Current: No concept.
Needed: Option in conversation settings (the ⋮ or settings dropdown): "Detach from package" with a confirmation. Removes package_id, removes all locks. One-way operation. After detaching, the conversation becomes a regular conversation with all current settings preserved but fully editable.
6. Context budget: package-aware labels
Current: HowDrawer context budget shows token breakdown by source (character, scenario, persona, lorebook).
Needed: When in a package conversation, the budget visualization could label sources with lock icons to show which are fixed vs. user-controlled. Not strictly required for v1, but a natural enhancement.
Changes Needed: Lorebook Assistant
The lorebook assistant operates on a single lorebook at a time. Projects group lorebooks as sub-items. The assistant itself doesn't need major structural changes, but needs awareness of the project context.
1. Project context indicator
Current: Accessed via /creator/lorebooks/{id}/assistant. No project awareness.
Needed: When opened from within a project (via sub-item "Edit" → "Open in assistant"), show a breadcrumb or back link: ← Project: Crystal of Dawn RPG > Realms Lore > Assistant. This is navigation only — the assistant's functionality doesn't change.
2. Entry archetype field (future)
Current: ProposedEntryData and LorebookEntryFull have no archetype field.
Needed (when archetypes ship): Add archetype to entry types ('lore' | 'entity' | 'scene' | 'vibe'). The assistant's proposal cards and entry editor gain an archetype selector. The LLM's system prompt gets updated to understand archetypes and suggest appropriate types for proposed entries. This is additive — no existing fields change.
3. Package-aware entry suggestions (future enhancement)
Current: The assistant's system prompt describes lorebook mechanics generically.
Needed (post-v1): When opened from a project that has a mode as a sub-item, the assistant could be informed of the mode's provider keys and suggest entries that align with the injection strategy. For example: "This lorebook is used in a package with Campaign Mode, which has a lorebook provider key. Entries with strong keyword matches will be injected into the lorebook section of the prompt." This is a system prompt enhancement, not a UI change.
4. Cross-lorebook awareness (future enhancement)
Current: The assistant only sees entries from the current lorebook.
Needed (post-v1): When a project has multiple lorebooks, the assistant could be aware of sibling lorebooks to avoid duplication. "The Bestiary lorebook already has an entry for 'Dragon' — consider referencing it rather than duplicating." This requires passing sibling lorebook metadata into the assistant context.
Changes Needed: Creator Hub (Forge)
1. Projects tab
Current: CreatorHubPage has tabs: Hub, Characters, Modes, Lorebooks, Collaborations.
Needed: Add a "Projects" tab (or make it the default/first tab) showing the creator's project list. Each project card shows name, description, sub-item count, deliverable count, and last-updated timestamp. Clicking a project navigates to the Creator Workbench page.
2. Item-to-project linking
Current: Items in Characters/Modes/Lorebooks tabs have edit/delete actions.
Needed: Add "Add to project" action in item context menus. Opens a project picker (or "create new project") and links the item. Shows which projects an item belongs to (e.g., "Used in: Crystal of Dawn RPG, Quick Combat Demo").
Changes Needed: Hub / Browse
1. Package cards and detail page
Current: Hub/Browse shows characters, lorebooks, modes as individual items.
Needed: Add package cards showing cover image, name, creator, component icons, lock indicators, and "Start Experience" button. Package detail page shows full description, component breakdown, lock summary, reviews, and changelog.
2. Individual deliverable attribution
Current: Published characters/lorebooks/modes have no project context.
Needed: When an item is published as a deliverable from a project, the Hub listing can optionally show "From: Crystal of Dawn RPG" as attribution. This is a display enhancement, not structural — the item's is_public flag is what controls visibility.
Project Profile Page
Every project has a profile page — a public-facing view of the project and its contents. The profile page is accessed via the project's share token and shows the viewer only the items they have permission to see. Profile pages support visual customization (banner, accent color, section ordering, featured items) — see Profile Customization for the full design.
Core Principles
- Every project has a profile page — Regardless of whether any items are shared. If nothing is shared or the viewer has no permissions, the page displays the project name/description and an empty state: "No items to show."
- Share-token driven access — The profile page URL uses the project's
entity_permissionsshare token (e.g.,/projects/share/{shareToken}). The share token determines the viewer's permission level. - Server-driven data — All permission filtering happens on the backend. The API endpoint resolves the share token, determines the viewer's effective permissions, and returns only the data the viewer is allowed to see. The frontend is a pure display layer — it renders whatever the server returns and never performs its own permission checks or filtering. This ensures security is enforced at a single point regardless of client implementation.
- No authentication required for viewing — Unauthenticated users can view the profile page if the project has an unlisted share token (
granted_to_user_id IS NULL). The permission flags on that token control what's visible.
What the Profile Page Shows
- Project header — Name, description, cover image, creator attribution
- Deliverables section — Published packages with "Start Experience" action (requires auth)
- Items section — Grouped by entity type (characters, modes, lorebooks, model profiles, greetings, personas). Each item shows its name, brief description, and type icon. Clicking an item navigates to that entity's existing detail/preview page (subject to the viewer's permissions on that specific entity)
- Empty state — When the viewer has no access to any items: project header is still shown, item sections display "No items to show"
Architecture: Server-Driven Profile
The project profile page uses the same dashboard pipeline as the creator profile — see Profile Customization for the full design (JSON layout config, section renderers, tier gating, edit drawer). The response shape, storage (profile_customizations with entity_type = 7), and rendering pipeline are identical. Only the owning entity differs.
Do not confuse the public profile with the internal workbench summary. The workbench has its own views for listing project items for editing; the public profile is the presentational dashboard that visitors see via a share link.
API endpoint:
GET /api/projects/share/{shareToken}
The endpoint resolves the share token to a project via entity_permissions, loads the project's profile_customizations row, and runs the same fn_get_profile_page orchestrator used for creator profiles. Section sub-functions that resolve project items (characters, modes, lorebooks, packages, featured, spotlight) additionally intersect against the viewer's entity_permissions so inaccessible items never appear in the response.
The response shape is the unified sections-based shape documented in Profile Customization — Response Shape. No flat {project, deliverables, items} shape — that representation exists only inside the workbench for creator-facing lists.
Permission Model
The project profile page reuses the existing entity_permissions system. The project itself is an entity type that gets a share token. The viewer's access to individual items within the project is determined by each item's own entity_permissions, not the project-level token alone.
- Project-level token — Controls whether the viewer can see the profile page at all and see the project metadata (name, description, cover image)
- Item-level permissions — Each item (character, mode, lorebook, etc.) retains its own permission grants. The server intersects: "items in this project" ∩ "items the viewer can access" and returns only the intersection
This means a creator can share a project profile that shows only a subset of its items — e.g., share the project but only grant can_use on the character and one lorebook, keeping modes and other lorebooks private.
URL Structure
/projects/share/{shareToken}
The share token is a UUID from entity_permissions.share_token where entity_type corresponds to the project entity type. The backend resolves the token to a project ID, assembles the permission-filtered profile data, and returns it as a single response.