Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat([issue-1633]): add a 'Start a Story' onramp page that routes into the three story engines

[._.]/ Adam Eivy526e12feb051
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 4a71b39786..35b26758d4 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -93,6 +93,7 @@ const WritersRoomGuide = lazyWithReload(() => import('./pages/WritersRoomGuide')
const Pipeline = lazyWithReload(() => import('./pages/Pipeline'));
const Sharing = lazyWithReload(() => import('./pages/Sharing'));
const Importer = lazyWithReload(() => import('./pages/Importer'));
+const StartStory = lazyWithReload(() => import('./pages/StartStory'));
const StoryBuilder = lazyWithReload(() => import('./pages/StoryBuilder'));
const PipelineSeries = lazyWithReload(() => import('./pages/PipelineSeries'));
const PipelineSeriesRoadmap = lazyWithReload(() => import('./pages/PipelineSeriesRoadmap'));
@@ -318,6 +319,7 @@ export default function App() {
<Route path="sharing" element={<Sharing />} />
<Route path="sharing/:section" element={<Sharing />} />
<Route path="importer" element={<Importer />} />
+ <Route path="start-story" element={<StartStory />} />
<Route path="story-builder" element={<StoryBuilder />} />
<Route path="story-builder/:storyId" element={<Navigate to="idea" replace />} />
<Route path="story-builder/:storyId/:step" element={<StoryBuilder />} />
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index dd137ebb82..b5b0d34f70 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -60,6 +60,7 @@ import {
Shield,
Lock,
Wand2,
+ Rocket,
Zap,
Inbox,
RefreshCw,
@@ -209,6 +210,7 @@ const navItems = [
{ to: '/rounds', label: 'Rounds', icon: Music },
{ to: '/pipeline', label: 'Series Pipeline', icon: WorkflowIcon, dynamic: 'pipelineSeries' },
{ to: '/sharing', label: 'Sharing', icon: Share2 },
+ { to: '/start-story', label: 'Start a Story', icon: Rocket },
{ to: '/story-builder', label: 'Story Builder', icon: Wand2 },
{ to: '/universes', label: 'Universes', icon: Globe, dynamic: 'universes' },
{ to: '/writers-room', label: 'Writers Room', icon: NotebookPen },
diff --git a/client/src/pages/StartStory.jsx b/client/src/pages/StartStory.jsx
new file mode 100644
index 0000000000..cdc5f5a218
--- /dev/null
+++ b/client/src/pages/StartStory.jsx
@@ -0,0 +1,163 @@
+import { useEffect, useState } from 'react';
+import { useNavigate } from 'react-router-dom';
+import { Rocket, Lightbulb, FileInput, NotebookPen } from 'lucide-react';
+import { listUniverses } from '../services/api';
+import toast from '../components/ui/Toast';
+
+// The "Start a Story" onramp (issue #1633, Phase 1). One clear front door that
+// answers "how do you want to begin?" and routes into the existing engines
+// unchanged — Story Builder (idea), Importer (existing work), Writers Room
+// (prose). It also asks the universe question up front: start fresh, or attach
+// the new story to an existing universe. The chosen universe is forwarded to
+// the engines that already accept it (?universeId=…); prose-mode binding lands
+// in a later phase (Writers Room works have no universe link yet).
+const MODES = [
+ {
+ id: 'idea',
+ title: 'From an idea',
+ icon: Lightbulb,
+ desc: 'Start with a seed idea and let the guided Story Builder shape it into a universe, series, and issues.',
+ to: '/story-builder',
+ consumesUniverse: true,
+ },
+ {
+ id: 'import',
+ title: 'From an existing work',
+ icon: FileInput,
+ desc: 'Bring in a finished prose or script. The Importer reverse-engineers canon, arc, and an issue split seeded with your text.',
+ to: '/importer',
+ consumesUniverse: true,
+ },
+ {
+ id: 'prose',
+ title: 'From writing prose',
+ icon: NotebookPen,
+ desc: 'Open the Writers Room and draft freely, then promote into the production pipeline when you’re ready.',
+ to: '/writers-room',
+ consumesUniverse: false,
+ },
+];
+
+export default function StartStory() {
+ const navigate = useNavigate();
+ const [universes, setUniverses] = useState([]);
+ const [useExisting, setUseExisting] = useState(false);
+ const [universeId, setUniverseId] = useState('');
+
+ useEffect(() => {
+ let cancelled = false;
+ // silent: the custom catch below owns the toast (CLAUDE.md). A failed load
+ // just leaves the "use an existing universe" option empty — the onramp
+ // still works in "start fresh" mode.
+ listUniverses({ silent: true })
+ .catch((err) => {
+ toast.error(err?.message || 'Failed to load universes');
+ return [];
+ })
+ .then((u) => {
+ if (cancelled) return;
+ setUniverses(Array.isArray(u) ? u : []);
+ });
+ return () => { cancelled = true; };
+ }, []);
+
+ // A universe must actually be picked before the mode cards can attach it.
+ const needsUniversePick = useExisting && !universeId;
+
+ const go = (mode) => {
+ if (needsUniversePick) return;
+ const attach = useExisting && universeId && mode.consumesUniverse;
+ const query = attach ? `?universeId=${encodeURIComponent(universeId)}` : '';
+ navigate(`${mode.to}${query}`);
+ };
+
+ return (
+ <div className="max-w-4xl mx-auto space-y-6">
+ <header>
+ <h1 className="text-2xl font-bold flex items-center gap-2">
+ <Rocket className="w-6 h-6 text-port-accent" /> Start a Story
+ </h1>
+ <p className="text-gray-400 mt-1">
+ How do you want to begin? Every path lands in the same place — a universe, a series, and the
+ production pipeline — so pick whichever door fits where your story is today.
+ </p>
+ </header>
+
+ {/* Universe choice, asked up front for all three modes. */}
+ <section className="bg-port-card border border-port-border rounded-lg p-4 space-y-3">
+ <h2 className="text-sm font-semibold text-gray-200">Which universe?</h2>
+ <div className="flex flex-col sm:flex-row sm:items-center gap-3">
+ <label className="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
+ <input
+ type="radio"
+ name="universe-choice"
+ checked={!useExisting}
+ onChange={() => { setUseExisting(false); setUniverseId(''); }}
+ className="accent-port-accent"
+ />
+ Start fresh
+ </label>
+ <label className="flex items-center gap-2 text-sm text-gray-300 cursor-pointer">
+ <input
+ type="radio"
+ name="universe-choice"
+ checked={useExisting}
+ onChange={() => setUseExisting(true)}
+ className="accent-port-accent"
+ disabled={universes.length === 0}
+ />
+ Use an existing universe
+ </label>
+ {useExisting && (
+ <select
+ id="start-story-universe"
+ aria-label="Existing universe"
+ value={universeId}
+ onChange={(e) => setUniverseId(e.target.value)}
+ className="bg-port-bg border border-port-border rounded px-3 py-1.5 text-sm text-gray-200 sm:ml-auto"
+ >
+ <option value="">Select a universe…</option>
+ {universes.map((u) => (
+ <option key={u.id} value={u.id}>{u.name || '(untitled universe)'}</option>
+ ))}
+ </select>
+ )}
+ </div>
+ {needsUniversePick && (
+ <p className="text-xs text-port-warning">Pick a universe above to continue, or switch to “Start fresh.”</p>
+ )}
+ </section>
+
+ {/* The three intake modes. */}
+ <section className="grid gap-4 sm:grid-cols-3">
+ {MODES.map((mode) => {
+ const Icon = mode.icon;
+ const attaches = useExisting && universeId && mode.consumesUniverse;
+ return (
+ <button
+ key={mode.id}
+ type="button"
+ onClick={() => go(mode)}
+ disabled={needsUniversePick}
+ className={`text-left bg-port-card border border-port-border rounded-lg p-4 space-y-2 transition-colors ${
+ needsUniversePick
+ ? 'opacity-50 cursor-not-allowed'
+ : 'hover:border-port-accent'
+ }`}
+ >
+ <Icon className="w-6 h-6 text-port-accent" />
+ <h3 className="font-semibold text-gray-100">{mode.title}</h3>
+ <p className="text-sm text-gray-400">{mode.desc}</p>
+ {attaches && (
+ <p className="text-xs text-port-success">Will attach to the selected universe.</p>
+ )}
+ {useExisting && universeId && !mode.consumesUniverse && (
+ <p className="text-xs text-gray-500">Universe linking for prose drafts is coming in a later phase.</p>
+ )}
+ </button>
+ );
+ })}
+ </section>
+ </div>
+ );
+}
diff --git a/client/src/pages/StartStory.test.jsx b/client/src/pages/StartStory.test.jsx
new file mode 100644
index 0000000000..932bc2e5f4
--- /dev/null
+++ b/client/src/pages/StartStory.test.jsx
@@ -0,0 +1,85 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
+import StartStory from './StartStory';
+
+const navigateMock = vi.hoisted(() => vi.fn());
+vi.mock('react-router-dom', async (io) => {
+ const actual = await io();
+ return { ...actual, useNavigate: () => navigateMock };
+});
+
+const listUniverses = vi.hoisted(() => vi.fn());
+vi.mock('../services/api', () => ({
+ listUniverses: (...a) => listUniverses(...a),
+}));
+
+const toastError = vi.hoisted(() => vi.fn());
+vi.mock('../components/ui/Toast', () => ({
+ default: { error: (...a) => toastError(...a) },
+}));
+
+describe('StartStory onramp', () => {
+ beforeEach(() => {
+ navigateMock.mockReset();
+ toastError.mockReset();
+ listUniverses.mockReset().mockResolvedValue([
+ { id: 'u1', name: 'Alpha' },
+ { id: 'u2', name: 'Beta' },
+ ]);
+ });
+
+ it('renders all three intake modes', async () => {
+ render(<StartStory />);
+ expect(await screen.findByText('From an idea')).toBeTruthy();
+ expect(screen.getByText('From an existing work')).toBeTruthy();
+ expect(screen.getByText('From writing prose')).toBeTruthy();
+ });
+
+ it('routes to the engine with no universe param when starting fresh', async () => {
+ render(<StartStory />);
+ fireEvent.click(await screen.findByText('From an idea'));
+ expect(navigateMock).toHaveBeenCalledWith('/story-builder');
+ });
+
+ it('forwards the chosen universe to engines that consume it', async () => {
+ render(<StartStory />);
+ await screen.findByText('From an idea');
+ // Opt into an existing universe, then select one.
+ fireEvent.click(screen.getByLabelText('Use an existing universe'));
+ const select = await screen.findByLabelText('Existing universe');
+ fireEvent.change(select, { target: { value: 'u2' } });
+
+ fireEvent.click(screen.getByText('From an idea'));
+ expect(navigateMock).toHaveBeenCalledWith('/story-builder?universeId=u2');
+
+ fireEvent.click(screen.getByText('From an existing work'));
+ expect(navigateMock).toHaveBeenCalledWith('/importer?universeId=u2');
+ });
+
+ it('does not forward a universe to prose mode (no universe link yet)', async () => {
+ render(<StartStory />);
+ await screen.findByText('From writing prose');
+ fireEvent.click(screen.getByLabelText('Use an existing universe'));
+ const select = await screen.findByLabelText('Existing universe');
+ fireEvent.change(select, { target: { value: 'u1' } });
+
+ fireEvent.click(screen.getByText('From writing prose'));
+ expect(navigateMock).toHaveBeenCalledWith('/writers-room');
+ });
+
+ it('blocks the cards until a universe is picked when using an existing one', async () => {
+ render(<StartStory />);
+ await screen.findByText('From an idea');
+ fireEvent.click(screen.getByLabelText('Use an existing universe'));
+ // No universe selected yet — clicking a card should not navigate.
+ fireEvent.click(screen.getByText('From an idea'));
+ expect(navigateMock).not.toHaveBeenCalled();
+ expect(screen.getByText(/Pick a universe above/)).toBeTruthy();
+ });
+
+ it('surfaces a toast when the universe list fails to load', async () => {
+ listUniverses.mockRejectedValueOnce(new Error('boom'));
+ render(<StartStory />);
+ await waitFor(() => expect(toastError).toHaveBeenCalled());
+ });
+});
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index 4a26663bc1..a34723f637 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
-import { useParams, useNavigate, Link } from 'react-router-dom';
+import { useParams, useNavigate, useSearchParams, Link } from 'react-router-dom';
import { filterSelectableModels } from '../utils/providers';
import { composeCanonStyledPrompt } from '../lib/composeStyledPrompt';
import { descriptorForCanonEntry } from '../lib/canonPrompt';
@@ -95,6 +95,11 @@ function ProviderModelPicker({ value, onChange }) {
function StoryBuilderIndex() {
const navigate = useNavigate();
+ const [searchParams] = useSearchParams();
+ // The "Start a Story" onramp can deep-link here with a pre-chosen universe
+ // (?universeId=…); pass it through so the new session attaches to it instead
+ // of auto-creating a fresh universe. The create schema already accepts it.
+ const onrampUniverseId = searchParams.get('universeId') || undefined;
const [sessions, setSessions] = useState([]);
const [mode, setMode] = useState('seed');
const [title, setTitle] = useState('');
@@ -108,7 +113,10 @@ function StoryBuilderIndex() {
const create = async () => {
if (!title.trim()) { toast.error('Give your story a working title'); return; }
setCreating(true);
- const created = await createStorySession({ title: title.trim(), seedIdea: seedIdea.trim() }, { silent: true })
+ const created = await createStorySession(
+ { title: title.trim(), seedIdea: seedIdea.trim(), universeId: onrampUniverseId },
+ { silent: true },
+ )
.catch((err) => { toast.error(err?.message || 'Failed to create'); return null; });
setCreating(false);
if (created) navigate(`/story-builder/${created.id}/idea`);
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index 5237cf38ba..4db3464428 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -30,6 +30,7 @@ export const NAV_COMMANDS = [
{ id: 'nav.create.pipeline-continuity-bible', path: '/pipeline', label: 'Series Continuity', section: 'Create', aliases: ['continuity-bible', 'continuity', 'series-continuity', 'facts-ledger', 'established-facts', 'canon-ledger'], keywords: ['continuity', 'bible', 'facts', 'ledger', 'established', 'knowledge-leak', 'contradiction', 'timeline', 'wardrobe', 'prop', 'physical-traits', 'who-knows-what'] },
{ id: 'nav.create.sharing', path: '/sharing', label: 'Sharing', section: 'Create', aliases: ['sharing', 'share', 'buckets', 'share-buckets'], keywords: ['google drive', 'dropbox', 'icloud', 'syncthing', 'export', 'import', 'collaborate', 'federation', 'peer', 'cross-network'] },
{ id: 'nav.create.sharing-duplicates', path: '/sharing/duplicates', label: 'Duplicates', section: 'Create', aliases: ['duplicates', 'duplicate-universes', 'duplicate-series', 'dedupe', 'merge-duplicates'], keywords: ['duplicate', 'merge', 'rename', 'same name', 'two copies', 'reconcile', 'collision'] },
+ { id: 'nav.create.start-story', path: '/start-story', label: 'Start a Story', section: 'Create', aliases: ['start-story', 'start-a-story', 'start', 'begin-story', 'create-story', 'onramp'], keywords: ['start here', 'begin', 'idea', 'import', 'prose', 'story builder', 'writers room', 'importer', 'how to start', 'new', 'front door', 'choose'] },
{ id: 'nav.create.story-builder', path: '/story-builder', label: 'Story Builder', section: 'Create', aliases: ['story-builder', 'storybuilder', 'guided', 'new-story', 'story-wizard'], keywords: ['idea', 'universe', 'arc', 'reader map', 'guided', 'wizard', 'linear', 'lock', 'front door', 'episode', 'series'] },
{ id: 'nav.create.rounds', path: '/rounds', label: 'Rounds', section: 'Create', aliases: ['rounds', 'round', 'songs', 'song', 'a-cappella', 'acappella', 'sing'], keywords: ['round', 'song', 'lyrics', 'melody', 'harmony', 'dirge', 'ballad', 'a cappella', 'vocal', 'choir', 'singing', 'arrangement', 'quodlibet', '500 miles'] },
{ id: 'nav.create.rounds-guide', path: '/rounds/guide', label: 'Rounds Guide', section: 'Create', aliases: ['rounds-guide', 'round-guide', 'songs-guide', 'song-guide', 'singing-guide', 'round-learning'], keywords: ['rhythm shapes', 'dirge', 'voice layers', 'harmony', 'notation', 'lead sheet', 'solfege', 'learn round', 'learn song', 'a cappella', 'singing help'] },