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:

  1. 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.
  2. No mental model — New users don't understand how pieces connect or what order to build them
  3. Context switching — Creating a mode mid-build requires navigating away, losing context
  4. Invisible connections — No way to see that a mode's lorebook provider key expects linked lorebooks
  5. No guidance — No indication of what's complete, what's missing, what's recommended
  6. 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
  7. 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


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:

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:

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:

Center panel — Entity list:

Right drawer — Project detail / Entity preview:

Header:

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:

Database: Project Tables

The schema below has drifted from what shipped. The actual projects and project_deliverables tables in database/v1/24_tables_projects.sql are simpler than this block implies — project_items is the older sub-items table (projects_items family) and project_deliverables no longer carries deliverable_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:

  1. Publish state lives on packages, not deliverables. The old is_published / published_at columns on project_deliverables were dropped by 47c_collapse_deliverable_publish_into_package.sql. Today the deliverable is purely a presentation envelope (name + description + sort order); is_published and published_at are computed by fn_list_project_deliverables from packages.is_public and the latest approved publish_requests row for the package.

  2. Cover image is gallery-FK, not URL. Both packages.cover_image_id and projects.cover_image_id are the live cover fields. The save endpoints accept a gallery image UUID (CoverImageUuid). For packages it is resolved and written inside fn_save_package_full itself, ahead of the publish decision — the post-save SetCoverImageAsync call is gone (WP-29). projects still use the post-save setter. Reads return both coverImageUuid and coverImageUrl (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:

  1. Save — workbench calls POST /api/creator/projects/{projectId}/packages. The endpoint calls fn_save_package_full.
  2. Membership gate — fn_save_package_full checks the caller is project owner or a member with can_contribute. Reject otherwise.
  3. Upsert + sync — package row, lorebook bindings, model-profile bindings, persona-template bindings, deliverable row all upserted in one transaction.
  4. Publish-request dispatch — if the creator intends the package to be public, fn_save_package_full calls fn_handle_publish_request with entity_type = 6. This either:
    • Auto-publishes (when fn_verified_creator_auto_publish clears the creator on trust + content checks) — packages.is_public = TRUE, packages.is_listed = TRUE, was_auto_published = TRUE on the response.
    • Routes into the moderation queue — was_flagged = TRUE on the response, publish_requests row pending.
    • No-ops if the package is being saved as draft.
  5. Response — SavePackageResponse carries 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


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:

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:

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:

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

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:

  1. Context box — One-line explanation of what this component does and why (dismissible, remembered per user)
  2. Current configuration — Full details of the selected/configured entity
  3. Actions — Change (entity picker), Edit (inline form), Create New (inline creation form)
  4. 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:

  1. On first visit, only About is expanded. Remaining sections are visible but dimmed/collapsed
  2. When About is completed (name + description set), Character auto-expands with a subtle highlight animation
  3. Each completed section collapses and the next logical section expands
  4. Sections that depend on earlier ones (e.g., Greeting depends on Character) stay locked until their dependency is met
  5. 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

Character

Greeting

Legacy fallback Mode (read-only compatibility)

World Knowledge (Lorebooks)

Model Profiles

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

Readiness

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:

  1. The entity is created via the normal API
  2. The modal closes
  3. The new entity is automatically linked to the package
  4. 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:

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:

  1. Understanding — New users see how everything connects at a glance
  2. Validation — Missing connections and mismatches are visually obvious
  3. 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

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:

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:

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

  1. Launches a chat conversation using the package's configured character, current model→Entry→Base resolution, greeting, lorebooks, and validated package-safe settings defaults
  2. Enforces locks — locked components cannot be changed during the test session, exactly as an end-user would experience
  3. Applies validated package-safe settings defaults and custom instructions from the User Controls section
  4. 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

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.


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:

  1. Background: From the current scene/greeting/location
  2. Character sprite: From the active character, expression-matched
  3. Text box: The greeting text or AI-generated dialogue
  4. 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

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:

What we use:

What we DON'T need from React Flow:

Dagre (@dagrejs/dagre) — Auto-Layout

Attribute Value
Package @dagrejs/dagre
Bundle ~29 kB gzipped
License MIT
Downloads ~800K/week
Execution Synchronous

Why Dagre:

When to upgrade to ELKjs:

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:

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:

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.

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):

Frontend — Remaining work:

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:

Backend:

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:

Backend:


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:

Implementation phases:

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:

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:

What a template contains:

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:

Workflow:

  1. Creator links Profile → package stores a snapshot of the Profile state
  2. Profile owner updates the profile → dependent packages show "Update available" badge
  3. Package creator clicks "Update" → sees a diff of what changed → confirms or dismisses
  4. "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:

Panel behavior:

Relationship to context boxes:

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:

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:

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:

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:

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

  1. 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."
  2. Share-token driven access — The profile page URL uses the project's entity_permissions share token (e.g., /projects/share/{shareToken}). The share token determines the viewer's permission level.
  3. 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.
  4. 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

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.

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.