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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(universes): list/table CRUD index + rename page route to /universes (#463)
[._.]/ Adam Eivyca7ac230ebaa
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 54beec748c..5c80439756 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -8,7 +8,10 @@- **Multiple, ordered code-review agents per task.** The custom-task form (`TaskAddForm`) and scheduled-task form (`ScheduleTab`) now expose an ordered multi-reviewer picker (new `client/src/components/cos/ReviewerPicker.jsx`) instead of a single reviewer dropdown: click reviewers to add them (run order = click order, numbered badges), reorder with ↑↓, remove with ✕, plus a **stop-mode** selector (`run all` / `stop on first fix` / `stop on first clean`) and a **reviewer-applies** toggle. Task metadata gains `reviewers: string[]` (ordered, replacing the single `reviewer`), `reviewStopMode`, and `reviewerApplies`; a read-side `normalizeReviewers()` (server `server/lib/validation.js` + client mirror in `constants.js`) keeps legacy single-`reviewer` tasks/schedules working. The agent prompts thread the list through as slashdo `--review-with a,b,c [--review-stop-on-findings|--review-stop-on-clean] [--reviewer-applies]` on the self-completion path, and the system-spawned review-loop follow-up agent runs each reviewer in the configured order (`buildReviewWithArgs()` builds the flag string; Copilot is pre-requested only when it *leads* the list — otherwise the follow-up requests it at its turn so it reviews the post-fix diff — and the follow-up still runs the CLI reviewers on non-GitHub forges where Copilot is unavailable).+- **Universes list/table index — CRUD all universes at a glance.** New `client/src/pages/Universes.jsx` lists every universe in a table (desktop) / card stack (mobile) with canon-entity count, linked-series count, last-updated, and per-row Share / Sync-to-peer / two-click delete (optimistic remove + rollback, no `window.confirm`) — mirroring the Series Pipeline index. Series counts come from a client-side join against `listPipelineSeries()` (reverse of the join `Pipeline.jsx` already does); canon counts sum the `characters`/`places`/`objects` trunks. The PipelineSeries "Open" link beside the Linked-Universe picker now opens the actually-linked universe instead of a blank builder.+## Changed+- **Universe page route renamed `/universe-builder` → `/universes`.** `/universes` is now the list/table index; the editor lives at `/universes/:universeId`, and `/universes/new` is the create-mode entry point (the `UniverseBuilder` editor treats the `new` sentinel as no-id → blank draft; real ids are UUIDs so no collision). The "Universe" sidebar entry is relabeled "Universes" and points at the index; the editor header gains a "← All Universes" back link. Legacy `/universe-builder*` (and the older `/media/universe-builder*`) paths redirect to `/universes*` preserving search + `#canon`, so existing bookmarks and in-app deep-links keep working. The `/api/universe-builder/*` backend endpoints are unchanged. `useUniverseNav`'s exported `universeBuilderBasePath` is renamed `universesBasePath`; the nav-manifest entry + voice/`⌘K` aliases follow the new path.- **Bumped the bundled `lib/slashdo` submodule v2.18.0 → v3.1.0.** v3.1.0's `/do:pr` / `/do:release` accept an ordered, comma-separated `--review-with` list plus `--review-stop-on-*` and `--reviewer-applies` flags — the slashdo capability this release wires into the task forms. Added `.claude/commands/do/` symlinks for the new `depfree` / `pr-better` / `scan` commands so the in-repo project slash-command set matches the vendored submodule.- `data.sample/` renamed to `data.reference/` to reflect its actual role: the canonical reference / seed source consumed by `scripts/setup-data.js` (and by migrations that look up the post-migration shipped version of a file). The old name implied "optional samples"; the new name conveys "this is what `./data/` is bootstrapped from and compared against." All code, tests, and active docs (CLAUDE.md, README, docs/) updated; historical `.changelog/v*.md` entries kept as-is since they describe past releases. The `DATA_SAMPLE_DIR` constant in `server/index.js` is now `DATA_REFERENCE_DIR`; `sampleDir` in `setup-data.js` is now `referenceDir`.- `server/services/universeBuilder.js` rewritten to consume `collectionStore` instead of `readJSONFile` + `atomicWrite` against a monolithic file. The per-entity `CURRENT_SCHEMA_VERSION = 4` (stamped INSIDE each universe record) is preserved unchanged — it describes record shape and is orthogonal to the new type-level `schemaVersion: 5` (storage layout). Cross-record state (`runs[]` history) moves to `data/universes/index.json` under `config.runs`. Per-record edits no longer serialize against unrelated universe edits — concurrent PATCHes on different universes now run in parallel.diff --git a/CLAUDE.md b/CLAUDE.mdindex 1077e51a08..5df4b7cfdb 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -214,6 +214,7 @@ When CoS agents or AI tools work on managed apps outside PortOS, all research, p- **No hardcoded localhost** - use `window.location.hostname` for URLs; app accessed via Tailscale remotely- **Alphabetical navigation** - sidebar nav items in `Layout.jsx` are alphabetically ordered after the Dashboard+CyberCity top section and separator; children within collapsible sections are also alphabetical- **Every new page registers in the nav manifest** - when adding a `<Route>` + sidebar link, also add a `NAV_COMMANDS` entry in `server/lib/navManifest.js`. This makes the page reachable via `⌘K` and voice (`ui_navigate`) automatically. See the "Command Palette & Voice Nav" section above for the entry shape.+- **New page → pick the right Layout scroll mode.** `Layout.jsx` has an `isFullWidth` route list: matched routes get a bare `relative overflow-hidden` `<main>` (the PAGE must own an internal `overflow-y-auto`, like the editor's `<section>`); unmatched routes get the default `overflow-auto p-4 md:p-6` scrolling+padded main. A list/index page (e.g. `/universes`, `/pipeline`) should usually be a plain `<div>` and stay OUT of `isFullWidth` so the main scrolls it; only full-bleed editors that manage their own scroll belong in the list. Match `/route/` (trailing slash) to scope full-width to detail/editor sub-routes without catching the bare index. A full-width page with no internal scroll container silently clips below the fold.- **Reactive UI updates** - after mutations (delete, create, update), update local state directly instead of refetching the entire list from the server. Use `setState(prev => prev.filter(...))` or similar patterns for immediate feedback- **Single-line logging** - use emoji prefixes and string interpolation, never log full JSON blobs or arrays```jsdiff --git a/PLAN.md b/PLAN.mdindex 9dda9f381a..d3baf0b4ef 100644--- a/PLAN.md+++ b/PLAN.md@@ -37,6 +37,7 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [.changel- [ ] [tui-handledata-finish-rejection-not-handled-by-trycatch] **TUI `handleData`'s try/catch covers most awaits but `await finish(...)` on command-not-found can still reject inside the same body.** The v2.7.0 wrap is fine for `updateAgent` rejections but `finish` is `async` and could be extended in the future to surface a rejection on its own write path. Add a defensive `.catch` on the `await finish(...)` invocation OR confirm in a one-line comment that `finish` is idempotent and never rejects. Reviewer-4 in v2.7.0 release review.- [ ] [mortalloom-writestore-transient-set-widen] **`mortalLoomStore.writeStoreAtPath`'s `withTransientRetry` accepts a narrower errno set than what real iCloud writes throw.** `isTransientFsError` covers EAGAIN/EDEADLK/-11 but not the EBUSY/EIO that `bird` daemon contention can surface on busy iCloud paths. Either widen the predicate OR document the choice. Reviewer-4 in v2.7.0 release review.- [ ] [video-gen-remix-stale-model-toast] **VideoGen `validateModelId` effect silently drops a Remix-supplied model to default when the original is gone.** A user who Remixes a clip generated on a model they later uninstalled gets dropped to default with no toast — they think they're rendering with the same model. Add a single one-shot `toast.info('Original model X no longer available — using default')`. Reviewer-6 in v2.7.0 release review.+- [ ] [universes-sidebar-per-universe-grandchildren] **Sidebar parity: expand the "Universes" nav item into per-universe sub-links (like Series Pipeline).** The Series Pipeline sidebar entry uses `dynamic: 'pipelineSeries'` to render one grandchild link per series (`client/src/components/Layout.jsx:434` `decoratePipelineChild`, fed by a `listPipelineSeries()` fetch at 399–423). The new `/universes` index (PR for `[work] universe-builder-crud`) left the "Universes" entry as a plain link — no per-universe grandchildren. For parity, add a `dynamic: 'universes'` flag to the `{ to: '/universes', label: 'Universes' }` child, a sibling `listUniverses()` fetch + `setUniverses` (mirror the pipelineSeries effect, including the 30s focus-refresh + signature guard), and a `decorateUniverseChild` in the `resolvedNavItems` memo that maps each universe to `{ to: '/universes/<id>', label, activePathPrefix: '/universes/<id>' }`. Skipped in the CRUD PR as scope creep — the user asked for a list/table page, not sidebar sub-links. Low urgency; nice-to-have discoverability.- [ ] [ref-watch-phosphene-lazy-eval-env-bootstrap] **Lazy-eval env bootstrap for M-series perf.** From `reference-watch` review of phosphene (commit `a6e4573f`, context from `ec1437fe`, 2026-05-22). Phosphene measured ~15–25× perf loss on M4 Max with the upstream default `LTX2_DIT_EVAL_EVERY=8` vs `=0`/`=1`, caused by per-block Metal command-buffer churn. The env vars only exist post-May-9 upstream, so this is a "land it with the pin bump" item. Fix: at the very top of `scripts/generate_ltx2.py` (BEFORE any `ltx_*` import, because `ltx_core_mlx.model.transformer.model` reads `LTX2_DIT_EVAL_EVERY` at import time), add `os.environ.setdefault("LTX2_DIT_EVAL_EVERY", "0")` and `os.environ.setdefault("LTX2_GEMMA_EVAL_EVERY", "0")`. User-supplied env still wins via `setdefault`. Phosphene's matrix suggests `=1` is a slightly safer middle if `=0` produces a post-decode hang; use `=0` and revisit if regressions appear.## Deferred Architecture (human-led planning)diff --git a/client/src/App.jsx b/client/src/App.jsxindex bb5e669baf..1a7afba9b8 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -40,6 +40,7 @@ const MediaCollectionDetail = lazyWithReload(() => import('./pages/MediaCollecticonst MediaModels = lazyWithReload(() => import('./pages/MediaModels'));const Loras = lazyWithReload(() => import('./pages/Loras'));const UniverseBuilder = lazyWithReload(() => import('./pages/UniverseBuilder'));+const Universes = lazyWithReload(() => import('./pages/Universes'));const VideoTimeline = lazyWithReload(() => import('./pages/VideoTimeline'));const VideoTimelineEditor = lazyWithReload(() => import('./pages/VideoTimelineEditor'));const CreativeDirector = lazyWithReload(() => import('./pages/CreativeDirector'));@@ -82,17 +83,18 @@ const PageLoader = () => (</div>);-// Preserve query string when redirecting legacy media routes — Settings.jsx's-// /image-gen?settings=1 chain depends on ?settings=1 reaching the new path.+// Preserve query string + hash when redirecting legacy routes — Settings.jsx's+// /image-gen?settings=1 chain depends on ?settings=1 reaching the new path, and+// legacy universe bookmarks may carry a hash (e.g. `#canon`) we must not drop.function RedirectWithSearch({ to }) {- const { search } = useLocation();- return <Navigate to={`${to}${search}`} replace />;+ const { search, hash } = useLocation();+ return <Navigate to={`${to}${search}${hash}`} replace />;}// Canon page was folded into Universe Builder; redirect the old sub-route to// the builder so deep-links and bookmarks keep working. Strips the trailing// `/canon` (with optional trailing slash — React Router matches both forms,-// otherwise `/universe-builder/abc/canon/` would self-loop), preserves the+// otherwise `/universes/abc/canon/` would self-loop), preserves the// query string (e.g. `?series=<id>` filter), and adds `#canon` so the// browser scrolls to the embedded canon section instead of the bible at the// top of the builder (UniverseCanonSection renders with `id="canon"`).@@ -101,16 +103,18 @@ function CanonRedirect() {return <Navigate to={`${pathname.replace(/\/canon\/?$/, '')}${search}#canon`} replace />;}-// /media/universe-builder/* → /universe-builder/* redirect for legacy bookmarks-// after the MediaGen tab for Universe Builder was removed in favor of the-// Create sidebar link. The canon variant forces `#canon` to scroll the-// embedded canon section; non-canon preserves whatever hash the user had.-function UniverseBuilderRedirect({ canon = false }) {+// Redirect a legacy universe mount to the current `/universes/*` route. Two+// legacy prefixes feed this: `/media/universe-builder` (MediaGen tab removed in+// favor of the Create sidebar link) and `/universe-builder` (page route renamed+// when the list/table index landed). Both keep old bookmarks + in-app+// deep-links alive. The canon variant forces `#canon` to scroll the embedded+// canon section; non-canon preserves whatever hash the user had.+function UniverseRouteRedirect({ fromPrefix, canon = false }) {const { pathname, search, hash } = useLocation();- const rest = pathname.replace(/^\/media\/universe-builder/, '');+ const rest = pathname.replace(fromPrefix, '');const target = canon- ? `/universe-builder${rest.replace(/\/canon\/?$/, '')}${search}#canon`- : `/universe-builder${rest}${search}${hash}`;+ ? `/universes${rest.replace(/\/canon\/?$/, '')}${search}#canon`+ : `/universes${rest}${search}${hash}`;return <Navigate to={target} replace />;}@@ -221,12 +225,12 @@ export default function App() {<Route path="timeline/:projectId" element={<VideoTimelineEditor />} /><Route path="models" element={<MediaModels />} /><Route path="loras" element={<Loras />} />- {/* Universe Builder lives at /universe-builder (Create sidebar- link). These redirects keep legacy /media/universe-builder- bookmarks working after the MediaGen tab was removed. */}- <Route path="universe-builder" element={<Navigate to="/universe-builder" replace />} />- <Route path="universe-builder/:universeId" element={<UniverseBuilderRedirect />} />- <Route path="universe-builder/:universeId/canon" element={<UniverseBuilderRedirect canon />} />+ {/* Universes live at /universes (Create sidebar link). These+ redirects keep legacy /media/universe-builder bookmarks working+ after the MediaGen tab was removed. */}+ <Route path="universe-builder" element={<RedirectWithSearch to="/universes" />} />+ <Route path="universe-builder/:universeId" element={<UniverseRouteRedirect fromPrefix={/^\/media\/universe-builder/} />} />+ <Route path="universe-builder/:universeId/canon" element={<UniverseRouteRedirect fromPrefix={/^\/media\/universe-builder/} canon />} /></Route><Route path="image-gen" element={<RedirectWithSearch to="/media/image" />} /><Route path="video-gen" element={<RedirectWithSearch to="/media/video" />} />@@ -235,9 +239,20 @@ export default function App() {<Route path="wiki" element={<Navigate to="/wiki/overview" replace />} /><Route path="wiki/:tab" element={<Wiki />} /><Route path="rapid-reader" element={<RapidReaderPage />} />- <Route path="universe-builder" element={<UniverseBuilder />} />- <Route path="universe-builder/:universeId" element={<UniverseBuilder />} />- <Route path="universe-builder/:universeId/canon" element={<CanonRedirect />} />+ {/* `/universes` is the universe index (list/table). The editor lives+ at `/universes/:universeId`; `new` is the create-mode sentinel+ (UniverseBuilder treats it as no-id → blank draft). Universe ids are+ UUIDs, so `new` can never collide with a real record. */}+ <Route path="universes" element={<Universes />} />+ <Route path="universes/new" element={<UniverseBuilder />} />+ <Route path="universes/:universeId" element={<UniverseBuilder />} />+ <Route path="universes/:universeId/canon" element={<CanonRedirect />} />+ {/* Legacy /universe-builder* → /universes* (route renamed when the+ index landed). Keeps old bookmarks + in-app deep-links working. */}+ <Route path="universe-builder" element={<RedirectWithSearch to="/universes" />} />+ <Route path="universe-builder/:universeId/canon" element={<UniverseRouteRedirect fromPrefix={/^\/universe-builder/} canon />} />+ <Route path="universe-builder/:universeId" element={<UniverseRouteRedirect fromPrefix={/^\/universe-builder/} />} />+ <Route path="universe-builder/new" element={<RedirectWithSearch to="/universes/new" />} /><Route path="writers-room" element={<WritersRoom />} /><Route path="sharing" element={<Sharing />} /><Route path="importer" element={<Importer />} />diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex 48efef2ad0..88771ef0b9 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -200,7 +200,7 @@ const navItems = [{ to: '/media', label: 'Media Gen', icon: Layers },{ to: '/pipeline', label: 'Series Pipeline', icon: WorkflowIcon, dynamic: 'pipelineSeries' },{ to: '/sharing', label: 'Sharing', icon: Share2 },- { to: '/universe-builder', label: 'Universe', icon: Globe },+ { to: '/universes', label: 'Universes', icon: Globe },{ to: '/writers-room', label: 'Writers Room', icon: NotebookPen }]},@@ -990,7 +990,11 @@ export default function Layout() {location.pathname === '/review' ||location.pathname.startsWith('/settings') ||location.pathname.startsWith('/wiki') ||- location.pathname.startsWith('/universe-builder') ||+ // Only the universe EDITOR (/universes/:id, /universes/new) is+ // full-width — it manages its own scroll. The /universes index+ // (list/table) takes the normal padded+scrolling main, mirroring+ // the Series Pipeline index (/pipeline is not full-width either).+ location.pathname.startsWith('/universes/') ||location.pathname.startsWith('/writers-room') ||location.pathname.startsWith('/agents') ||location.pathname === '/shell' ||diff --git a/client/src/components/universe/UniverseCanonSection.jsx b/client/src/components/universe/UniverseCanonSection.jsxindex 6b2db9a191..5cfff662d3 100644--- a/client/src/components/universe/UniverseCanonSection.jsx+++ b/client/src/components/universe/UniverseCanonSection.jsx@@ -511,7 +511,7 @@ export default function UniverseCanonSection({const charCount = (universe.characters || []).length;return (- // `id="canon"` is the scroll target for `/universe-builder/:id#canon`+ // `id="canon"` is the scroll target for `/universes/:id#canon`// deep-links (legacy `/canon` route redirect + PipelineSeries "Manage// characters, places, and objects" link). Keep this id stable.<section id="canon" className="bg-port-card border border-port-border rounded p-4 flex flex-col gap-3 scroll-mt-4">diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex e1ad56e861..276e435224 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -98,6 +98,6 @@ grep -i "what you want to do" client/src/hooks/README.md| `useProviderModels` | AI providers + two-step provider→model selection. | Any UI that picks a provider + model. || `useTheme` | Dark/light theme + paired-theme switching. | Theme picker. || `useUniverseAction` | LLM-driven universe mutation scaffolding. | Universe Builder action UIs. |-| `useUniverseNav` | `goToWorld(id)` → navigate to `/universe-builder/:id`, preserve `location.search`. | Any Universe Builder caller that needs to switch worlds via URL. |+| `useUniverseNav` | `goToWorld(id)` → navigate to `/universes/:id`, preserve `location.search`. | Any Universe Builder caller that needs to switch worlds via URL. || `useVoiceUiSync` | Keeps voice server's UI index in sync with current page. | Wire once at root for voice agent support. || `useMoltworldWs` | Moltworld WebSocket feed. | Moltworld surfaces only. |diff --git a/client/src/hooks/useUniverseNav.js b/client/src/hooks/useUniverseNav.jsindex e96e90d999..c50d0a5b2b 100644--- a/client/src/hooks/useUniverseNav.js+++ b/client/src/hooks/useUniverseNav.js@@ -2,14 +2,14 @@ import { useCallback } from 'react';import { useLocation, useNavigate } from 'react-router-dom';// Strips any trailing `/:universeId` (or deeper path) so the result is always-// the "/universe-builder" root for the current route prefix. Mirrors the regex-// previously inlined in UniverseBuilder.jsx so consumers don't have to re-think-// the basePath derivation.-export function universeBuilderBasePath(pathname) {- return (pathname || '').replace(/\/universe-builder(?:\/.*)?$/, '/universe-builder');+// the "/universes" root. The editor mounts at `/universes/:universeId` (and the+// create sentinel `/universes/new`); this collapses either back to the index+// root for navigation.+export function universesBasePath(pathname) {+ return (pathname || '').replace(/\/universes(?:\/.*)?$/, '/universes');}-// Returns `goToWorld(id)`. Calling it navigates to the Universe Builder route+// Returns `goToWorld(id)`. Calling it navigates to the Universe editor route// for `id` (or back to the index when id is null/undefined), preserving the// current `location.search` so query state like `?tab=&bucket=` survives the// create-from-idea round-trip. The id is `encodeURIComponent`-wrapped so@@ -17,7 +17,7 @@ export function universeBuilderBasePath(pathname) {export function useUniverseNav() {const navigate = useNavigate();const location = useLocation();- const basePath = universeBuilderBasePath(location.pathname);+ const basePath = universesBasePath(location.pathname);return useCallback((id) => navigate({pathname: id ? `${basePath}/${encodeURIComponent(id)}` : basePath,search: location.search,diff --git a/client/src/hooks/useUniverseNav.test.jsx b/client/src/hooks/useUniverseNav.test.jsxindex d607991e73..7ae48e3ac6 100644--- a/client/src/hooks/useUniverseNav.test.jsx+++ b/client/src/hooks/useUniverseNav.test.jsx@@ -1,12 +1,12 @@import { describe, it, expect } from 'vitest';import { renderHook, act } from '@testing-library/react';import { MemoryRouter, useLocation } from 'react-router-dom';-import { useUniverseNav, universeBuilderBasePath } from './useUniverseNav';+import { useUniverseNav, universesBasePath } from './useUniverseNav';// Pair the hook with `useLocation` so each test can read back the URL the// `goToWorld(id)` call produced — the contract here is URL transitions, so// that's what we assert on. Mirrors the `usePreviewRoute.test.jsx` pattern.-const renderUniverseNav = (initial = '/universe-builder') => {+const renderUniverseNav = (initial = '/universes') => {const wrapper = ({ children }) => (<MemoryRouter initialEntries={[initial]}>{children}</MemoryRouter>);@@ -16,61 +16,57 @@ const renderUniverseNav = (initial = '/universe-builder') => {}), { wrapper });};-describe('universeBuilderBasePath', () => {+describe('universesBasePath', () => {it('strips a trailing /:universeId from the root mount', () => {- expect(universeBuilderBasePath('/universe-builder/u-123')).toBe('/universe-builder');+ expect(universesBasePath('/universes/u-123')).toBe('/universes');});it('strips deeper trailing paths', () => {- expect(universeBuilderBasePath('/universe-builder/u-123/extra/path')).toBe('/universe-builder');+ expect(universesBasePath('/universes/u-123/extra/path')).toBe('/universes');});- it('preserves a prefixed mount (e.g. /media/universe-builder)', () => {- expect(universeBuilderBasePath('/media/universe-builder/u-123')).toBe('/media/universe-builder');- });-- it('returns the input unchanged when /universe-builder is the leaf with no id', () => {- expect(universeBuilderBasePath('/universe-builder')).toBe('/universe-builder');+ it('returns the input unchanged when /universes is the leaf with no id', () => {+ expect(universesBasePath('/universes')).toBe('/universes');});it('tolerates null / empty input without throwing', () => {- expect(universeBuilderBasePath(null)).toBe('');- expect(universeBuilderBasePath('')).toBe('');+ expect(universesBasePath(null)).toBe('');+ expect(universesBasePath('')).toBe('');});});describe('useUniverseNav', () => {- it('navigates to /universe-builder/:id when called with an id', () => {+ it('navigates to /universes/:id when called with an id', () => {const { result } = renderUniverseNav();act(() => result.current.goToWorld('u-42'));- expect(result.current.location.pathname).toBe('/universe-builder/u-42');+ expect(result.current.location.pathname).toBe('/universes/u-42');});it('navigates back to the basePath when called with null', () => {- const { result } = renderUniverseNav('/universe-builder/u-42');+ const { result } = renderUniverseNav('/universes/u-42');act(() => result.current.goToWorld(null));- expect(result.current.location.pathname).toBe('/universe-builder');+ expect(result.current.location.pathname).toBe('/universes');});it('preserves location.search across the transition', () => {- const { result } = renderUniverseNav('/universe-builder?tab=cast&bucket=heroes');+ const { result } = renderUniverseNav('/universes?tab=cast&bucket=heroes');act(() => result.current.goToWorld('u-42'));- expect(result.current.location.pathname).toBe('/universe-builder/u-42');+ expect(result.current.location.pathname).toBe('/universes/u-42');expect(result.current.location.search).toBe('?tab=cast&bucket=heroes');});it('preserves location.search when clearing back to the index', () => {- const { result } = renderUniverseNav('/universe-builder/u-42?series=s1');+ const { result } = renderUniverseNav('/universes/u-42?series=s1');act(() => result.current.goToWorld(null));- expect(result.current.location.pathname).toBe('/universe-builder');+ expect(result.current.location.pathname).toBe('/universes');expect(result.current.location.search).toBe('?series=s1');});@@ -81,7 +77,7 @@ describe('useUniverseNav', () => {// Spaces / `&` / `?` / `#` would otherwise smear into the path or split// off as query / hash — verify they all land inside the encoded segment.- expect(result.current.location.pathname).toBe('/universe-builder/id%20with%20spaces%20%26%20%3F%23');+ expect(result.current.location.pathname).toBe('/universes/id%20with%20spaces%20%26%20%3F%23');});it('URI-encodes ids containing forward slashes (path-segment smear guard)', () => {@@ -89,22 +85,14 @@ describe('useUniverseNav', () => {act(() => result.current.goToWorld('a/b'));- expect(result.current.location.pathname).toBe('/universe-builder/a%2Fb');- });-- it('honors a prefixed mount when computing basePath', () => {- const { result } = renderUniverseNav('/media/universe-builder/u-old');-- act(() => result.current.goToWorld('u-new'));-- expect(result.current.location.pathname).toBe('/media/universe-builder/u-new');+ expect(result.current.location.pathname).toBe('/universes/a%2Fb');});it('swaps id-for-id when already on a world', () => {- const { result } = renderUniverseNav('/universe-builder/u-old');+ const { result } = renderUniverseNav('/universes/u-old');act(() => result.current.goToWorld('u-new'));- expect(result.current.location.pathname).toBe('/universe-builder/u-new');+ expect(result.current.location.pathname).toBe('/universes/u-new');});});diff --git a/client/src/pages/PipelineSeries.jsx b/client/src/pages/PipelineSeries.jsxindex 8100377c01..eec64342b3 100644--- a/client/src/pages/PipelineSeries.jsx+++ b/client/src/pages/PipelineSeries.jsx@@ -370,7 +370,7 @@ function BibleSidebar({ series, universes, patchSeries, onSeriesUpdate, onFlushP{universes.map((w) => <option key={w.id} value={w.id}>{w.name}</option>)}</select><Link- to="/universe-builder"+ to={series.universeId ? `/universes/${encodeURIComponent(series.universeId)}` : '/universes'}className="inline-flex items-center gap-1 text-xs text-port-accent hover:underline whitespace-nowrap"><Globe size={12} /> Open@@ -412,7 +412,7 @@ function BibleSidebar({ series, universes, patchSeries, onSeriesUpdate, onFlushP// UniverseCanonSection) so users land on the folded-in canon UI// instead of the bible at the top of the builder.<Link- to={`/universe-builder/${encodeURIComponent(series.universeId)}#canon`}+ to={`/universes/${encodeURIComponent(series.universeId)}#canon`}className="block text-xs text-port-accent hover:underline">Manage characters, places, and objects on the linked Universe →diff --git a/client/src/pages/UniverseBuilder.jsx b/client/src/pages/UniverseBuilder.jsxindex 7161220df4..a17a815400 100644--- a/client/src/pages/UniverseBuilder.jsx+++ b/client/src/pages/UniverseBuilder.jsx@@ -12,7 +12,7 @@ import { Link, useLocation, useParams, useSearchParams } from 'react-router-dom'import {Plus, Trash2, Sparkles, Wand2, Loader2, Save, FolderOpen,Edit3, X, MessageSquarePlus, Play, Lock, Unlock,- ArrowUpCircle, Search, ChevronDown, Check,+ ArrowUpCircle, ArrowLeft, Search, ChevronDown, Check,BookOpen, Users, MapPin, Package, Layers, ImagePlus, FolderTree,} from 'lucide-react';import toast from '../components/ui/Toast';@@ -467,12 +467,15 @@ export function UniverseSelector({ universes, selectedId, value, onChange, onPicexport default function UniverseBuilder() {// The selected world id lives in the URL so deep-linking + back/forward- // work. The page is mounted at /universe-builder, /universe-builder/:universeId,- // and /media/universe-builder(/:universeId) — strip any trailing /<id> off the- // current pathname to derive the base for navigation back to the list.+ // work. The editor is mounted at /universes/:universeId and /universes/new —+ // strip any trailing /<id> off the current pathname to derive the base for+ // navigation back to the list.const params = useParams();const location = useLocation();- const selectedId = params.universeId || null;+ // `/universes/new` is the create-mode entry point from the Universes index —+ // treat the `new` sentinel as "no id" (blank draft). Real universe ids are+ // UUIDs, so this can never shadow an actual record.+ const selectedId = params.universeId && params.universeId !== 'new' ? params.universeId : null;// `goToWorld` preserves `location.search` (e.g. `?tab=&bucket=&series=`) so// the auto-save → create path doesn't snap the user back to the Bible tab// after they triggered Generate From Idea from inside Cast/Places/Objects.@@ -874,7 +877,7 @@ export default function UniverseBuilder() {// Hash-scroll for deep-links — the legacy `/canon` redirect and// PipelineSeries' "Manage characters, places, and objects" link both- // navigate to `/universe-builder/<id>#canon`. React Router doesn't+ // navigate to `/universes/<id>#canon`. React Router doesn't// auto-scroll to hashes, so wait until the section is rendered (gated by// `draft.id === selectedId`) then scroll. The element id (`canon`) is set// on UniverseCanonSection's root <section>.@@ -1005,7 +1008,7 @@ export default function UniverseBuilder() {// delete. Otherwise the user would see both a red "Delete failed" toast// AND a green "World deleted" toast, with the world apparently gone from// the sidebar even though it's still on disk.- const ok = await deleteUniverse(id)+ const ok = await deleteUniverse(id, { silent: true }).then(() => true).catch((e) => { toast.error(`Delete failed: ${e.message}`); return false; });if (!ok) return;@@ -1749,6 +1752,13 @@ export default function UniverseBuilder() {return (<div className="flex flex-col h-full"><section className="flex-1 flex flex-col gap-3 p-4 min-h-0 overflow-y-auto">+ {/* Back to the universe index (list/table at /universes). */}+ <Link+ to="/universes"+ className="inline-flex items-center gap-1 text-xs text-gray-500 hover:text-port-accent self-start"+ >+ <ArrowLeft size={14} /> All Universes+ </Link>{/* Thin action header — autocomplete universe selector doubles as thename field; Save + Share + Delete sit beside it so they're reachablefrom any tab. The Bible-tab actions (Generate / Refine, starterdiff --git a/client/src/pages/Universes.jsx b/client/src/pages/Universes.jsxnew file mode 100644index 0000000000..63c6ace890--- /dev/null+++ b/client/src/pages/Universes.jsx@@ -0,0 +1,219 @@+/**+ * Universes page — universe index.+ *+ * Lists every universe (the long-lived style/canon parent that pipeline series+ * inherit from) in a table and lets the user create, open, or delete any of+ * them. Mirrors the Series Pipeline index (`Pipeline.jsx`): the heavy editor+ * lives at `/universes/:id`, and `New Universe` drops into a blank editor at+ * `/universes/new`.+ */++import { useEffect, useMemo, useState } from 'react';+import { Link } from 'react-router-dom';+import { Plus, Globe, Trash2, Users, Workflow as WorkflowIcon } from 'lucide-react';+import toast from '../components/ui/Toast';+import ShareToButton from '../components/sharing/ShareToButton';+import SyncToPeerButton from '../components/sharing/SyncToPeerButton';+import OriginBadge from '../components/sharing/OriginBadge';+import { timeAgo } from '../utils/formatters';+import { listUniverses, deleteUniverse, listPipelineSeries } from '../services/api';++// Named canon entities across all trunks — the "Canon" column reflects the+// characters/places/objects the user has registered, not the looser variation+// buckets (which are render scratch space, not canon).+const canonCount = (u) =>+ (Array.isArray(u?.characters) ? u.characters.length : 0) ++ (Array.isArray(u?.places) ? u.places.length : 0) ++ (Array.isArray(u?.objects) ? u.objects.length : 0);++// Shared between the desktop table row and the mobile card so the armed-state+// styling + a11y labels stay in one place.+function DeleteButton({ universe, armed, onDelete }) {+ const name = universe.name || '(untitled universe)';+ return (+ <button+ type="button"+ onClick={() => onDelete(universe)}+ className={`p-2 ${armed ? 'text-port-error' : 'text-gray-500 hover:text-port-error'}`}+ aria-label={armed ? `Confirm delete universe ${name}` : `Delete universe ${name}`}+ title={armed ? 'Click again to confirm delete' : 'Delete universe'}+ >+ <Trash2 size={16} />+ </button>+ );+}++export default function Universes() {+ const [universes, setUniverses] = useState([]);+ const [series, setSeries] = useState([]);+ const [loading, setLoading] = useState(true);++ useEffect(() => {+ // Guard setState against a navigate-away before the fetch resolves —+ // mirrors the editor's load effect (UniverseBuilder.jsx).+ let cancelled = false;+ // Universes drive the page; resolve `loading` as soon as they land so a+ // slow/hung series fetch can't keep the list stuck on "Loading…".+ // silent: the custom catch below owns the error toast (CLAUDE.md).+ listUniverses({ silent: true })+ .catch((err) => {+ toast.error(err.message || 'Failed to load universes');+ return [];+ })+ .then((u) => {+ if (cancelled) return;+ setUniverses(Array.isArray(u) ? u : []);+ setLoading(false);+ });+ // Series counts are a nice-to-have join, fetched independently — a failed+ // or slow request should never block the universe list (counts just show+ // 0). silent: swallowed to [] with no toast, so suppress request()'s.+ listPipelineSeries({ silent: true })+ .catch(() => [])+ .then((s) => {+ if (cancelled) return;+ setSeries(Array.isArray(s) ? s : []);+ });+ return () => { cancelled = true; };+ }, []);++ // universeId → linked-series count. Reverse of the join Pipeline.jsx does+ // (series carry universeId; here we tally per universe).+ const seriesCountByUniverse = useMemo(() => {+ const m = {};+ for (const s of series) {+ if (s.universeId) m[s.universeId] = (m[s.universeId] || 0) + 1;+ }+ return m;+ }, [series]);++ // Two-click delete: first click "arms" the row, second click fires. Avoids+ // window.confirm (banned per CLAUDE.md) without pulling in a modal. armedId+ // resets after the action or when a different row is armed.+ const [armedId, setArmedId] = useState(null);+ const handleDelete = async (u) => {+ if (armedId !== u.id) {+ setArmedId(u.id);+ return;+ }+ setArmedId(null);+ setUniverses((prev) => prev.filter((x) => x.id !== u.id));+ // silent: the custom catch below owns the error toast (CLAUDE.md).+ await deleteUniverse(u.id, { silent: true }).catch((err) => {+ toast.error(err.message || 'Delete failed');+ // Roll back only this row (re-insert if still missing) so a concurrent+ // delete's optimistic removal isn't clobbered by a stale full-list+ // snapshot. Re-sort by the server's order (createdAt desc, newest-first)+ // so the restored row lands in its original position, not at the end.+ setUniverses((prev) =>+ prev.some((x) => x.id === u.id)+ ? prev+ : [...prev, u].sort((a, b) => (b.createdAt || '').localeCompare(a.createdAt || '')),+ );+ });+ };++ return (+ <div>+ <div className="flex items-center justify-between mb-6 flex-wrap gap-3">+ <div className="flex items-center gap-3">+ <Globe className="w-6 h-6 text-port-accent" />+ <h1 className="text-2xl font-bold text-white">Universes</h1>+ </div>+ <Link+ to="/universes/new"+ className="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-port-accent hover:bg-port-accent/90 text-white text-sm font-medium"+ >+ <Plus size={16} aria-hidden="true" />+ New Universe+ </Link>+ </div>++ <p className="text-sm text-gray-400 mb-6">+ A universe holds the shared style, influences, and canon (characters, places, objects) that every+ pipeline series and batch render inherits. Build one here, then link series to it from the Series Pipeline.+ </p>++ {loading ? (+ <div className="text-gray-500 text-sm">Loading universes…</div>+ ) : universes.length === 0 ? (+ <div className="text-gray-500 text-sm">+ No universes yet. Click <span className="text-port-accent">New Universe</span> to start.+ </div>+ ) : (+ <>+ {/* Desktop table */}+ <div className="hidden sm:block overflow-x-auto bg-port-card border border-port-border rounded-lg">+ <table className="w-full min-w-[640px]">+ <thead>+ <tr className="border-b border-port-border">+ <th className="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Name</th>+ <th className="px-4 py-3 text-right text-xs font-semibold uppercase tracking-wider text-gray-500">Canon</th>+ <th className="px-4 py-3 text-right text-xs font-semibold uppercase tracking-wider text-gray-500">Series</th>+ <th className="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500">Updated</th>+ <th className="px-4 py-3 text-right text-xs font-semibold uppercase tracking-wider text-gray-500">Actions</th>+ </tr>+ </thead>+ <tbody>+ {universes.map((u) => (+ <tr key={u.id} className="border-b border-port-border/50 last:border-0 hover:bg-port-bg/40 transition-colors">+ <td className="px-4 py-3 align-top">+ <Link to={`/universes/${encodeURIComponent(u.id)}`} className="block min-w-0 group">+ <div className="text-white font-medium flex items-center gap-2 flex-wrap group-hover:text-port-accent transition-colors">+ <span>{u.name || '(untitled universe)'}</span>+ {u.origin ? <OriginBadge origin={u.origin} compact /> : null}+ </div>+ {u.logline ? (+ <div className="text-xs text-gray-500 mt-0.5 line-clamp-1 break-words">{u.logline}</div>+ ) : null}+ </Link>+ </td>+ <td className="px-4 py-3 text-right whitespace-nowrap text-sm text-gray-300 font-mono">{canonCount(u)}</td>+ <td className="px-4 py-3 text-right whitespace-nowrap text-sm text-gray-300 font-mono">{seriesCountByUniverse[u.id] || 0}</td>+ <td className="px-4 py-3 whitespace-nowrap text-xs text-gray-500">{timeAgo(u.updatedAt || u.createdAt)}</td>+ <td className="px-4 py-3">+ <div className="flex items-center justify-end gap-1">+ <ShareToButton kind="universe" ids={[u.id]} compact />+ <SyncToPeerButton recordKind="universe" recordId={u.id} compact />+ <DeleteButton universe={u} armed={armedId === u.id} onDelete={handleDelete} />+ </div>+ </td>+ </tr>+ ))}+ </tbody>+ </table>+ </div>++ {/* Mobile cards */}+ <ul className="space-y-2 sm:hidden">+ {universes.map((u) => (+ <li key={u.id} className="p-3 bg-port-card border border-port-border rounded-lg">+ <div className="flex items-start justify-between gap-3">+ <Link to={`/universes/${encodeURIComponent(u.id)}`} className="flex-1 min-w-0">+ <div className="text-white font-medium flex items-center gap-2 flex-wrap">+ <span>{u.name || '(untitled universe)'}</span>+ {u.origin ? <OriginBadge origin={u.origin} compact /> : null}+ </div>+ {u.logline ? (+ <div className="text-xs text-gray-500 mt-0.5 break-words">{u.logline}</div>+ ) : null}+ <div className="flex items-center gap-3 mt-2 text-xs text-gray-500">+ <span className="inline-flex items-center gap-1"><Users size={12} /> {canonCount(u)} canon</span>+ <span className="inline-flex items-center gap-1"><WorkflowIcon size={12} /> {seriesCountByUniverse[u.id] || 0} series</span>+ <span>{timeAgo(u.updatedAt || u.createdAt)}</span>+ </div>+ </Link>+ <DeleteButton universe={u} armed={armedId === u.id} onDelete={handleDelete} />+ </div>+ <div className="flex items-center gap-1 mt-2">+ <ShareToButton kind="universe" ids={[u.id]} compact />+ <SyncToPeerButton recordKind="universe" recordId={u.id} compact />+ </div>+ </li>+ ))}+ </ul>+ </>+ )}+ </div>+ );+}diff --git a/client/src/services/apiPipeline.js b/client/src/services/apiPipeline.jsindex 38c54e7149..5376ed80b4 100644--- a/client/src/services/apiPipeline.js+++ b/client/src/services/apiPipeline.js@@ -59,7 +59,9 @@ export const PIPELINE_STAGE_STATUS_COLOR = Object.freeze({});// ---- Series -----export const listPipelineSeries = () => request('/pipeline/series');+// `options` lets a caller suppress request()'s auto-toast with `{ silent: true }`+// (e.g. an optional join that should fail quietly) — see CLAUDE.md.+export const listPipelineSeries = (options = {}) => request('/pipeline/series', options);export const getPipelineSeries = (id) => request(`/pipeline/series/${encodeURIComponent(id)}`);export const createPipelineSeries = (data) => request('/pipeline/series', {method: 'POST',diff --git a/client/src/services/apiUniverseBuilder.js b/client/src/services/apiUniverseBuilder.jsindex d2870091ae..cc5f2605d2 100644--- a/client/src/services/apiUniverseBuilder.js+++ b/client/src/services/apiUniverseBuilder.js@@ -14,7 +14,9 @@ export const WORLD_STYLE_NOTES_MAX = 4000;export const WORLD_INFLUENCE_ENTRY_MAX = 120;export const WORLD_INFLUENCES_PER_LIST_MAX = 30;-export const listUniverses = () => request('/universe-builder');+// `options` lets a caller that owns its own error toast pass `{ silent: true }`+// so request() doesn't also toast — see CLAUDE.md "Custom catch ⇒ silent: true".+export const listUniverses = (options = {}) => request('/universe-builder', options);export const getUniverse = (id) => request(`/universe-builder/${encodeURIComponent(id)}`);export const createUniverse = (data) => request('/universe-builder', {@@ -28,8 +30,12 @@ export const updateUniverse = (id, patch, options = {}) => request(`/universe-bu...options,});-export const deleteUniverse = (id) => request(`/universe-builder/${encodeURIComponent(id)}`, {+// `options` lets callers that own their own error toast (a custom `.catch`)+// pass `{ silent: true }` so the request() helper doesn't also toast — see+// CLAUDE.md "Custom catch ⇒ silent: true". Mirrors updateUniverse's signature.+export const deleteUniverse = (id, options = {}) => request(`/universe-builder/${encodeURIComponent(id)}`, {method: 'DELETE',+ ...options,});export const expandUniverse = ({diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex e3abd150dd..7e41e2e9c7 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -18,7 +18,7 @@ export const NAV_COMMANDS = [{ id: 'nav.media.creative-director', path: '/media/creative-director', label: 'Creative Director', section: 'Create', aliases: ['creative-director', 'creative', 'director', 'long-form', 'episode'], keywords: ['story', 'episode', 'narrative', 'agent', 'auto-video', 'long-form'] },{ id: 'nav.media.timeline', path: '/media/timeline', label: 'Timeline', section: 'Create', aliases: ['timeline', 'video-timeline', 'editor'], keywords: ['edit', 'trim', 'composite', 'stitch', 'cut', 'compose'] },{ id: 'nav.media.models', path: '/media/models', label: 'Media Models', section: 'Create', aliases: ['media-models', 'image-models', 'video-models', 'huggingface'], keywords: ['hf cache', 'model storage', 'disk'] },- { id: 'nav.create.universe-builder', path: '/universe-builder', label: 'Universe', section: 'Create', aliases: ['universe', 'universe-builder', 'worldbuilder', 'worldbuild', 'world', 'lore', 'universe-canon', 'canon'], keywords: ['style template', 'sci-fi', 'fantasy', 'concept art', 'batch render', 'variations', 'characters', 'settings', 'objects', 'canon entries'] },+ { id: 'nav.create.universe-builder', path: '/universes', label: 'Universes', section: 'Create', aliases: ['universes', 'universe', 'universe-builder', 'worldbuilder', 'worldbuild', 'world', 'lore', 'universe-canon', 'canon'], keywords: ['style template', 'sci-fi', 'fantasy', 'concept art', 'batch render', 'variations', 'characters', 'settings', 'objects', 'canon entries', 'list', 'manage'] },{ id: 'nav.create.importer', path: '/importer', label: 'Importer', section: 'Create', aliases: ['importer', 'import'], keywords: ['paste', 'screenplay', 'novel', 'short story', 'comic script', 'analyze', 'reverse-engineer', 'extract'] },{ id: 'nav.create.pipeline', path: '/pipeline', label: 'Series Pipeline', section: 'Create', aliases: ['series', 'pipeline', 'production', 'series-pipeline', 'production-pipeline'], keywords: ['series', 'issue', 'episode', 'comic', 'script', 'prose', 'storyboard', 'narrative', 'workflow'] },{ 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'] },diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.jsindex d0906bf88f..faa73c378f 100644--- a/server/lib/navManifest.test.js+++ b/server/lib/navManifest.test.js@@ -47,10 +47,12 @@ describe('resolveNavCommand — fuzzy matching', () => {expect(resolveNavCommand('goals')?.path).toBe('/goals/list');});- it('resolves Universe Builder to its new standalone Create path', () => {- // Promoted out of /media/universe-builder; nav alias must follow.+ it('resolves Universe Builder to the /universes index path', () => {+ // Promoted out of /media/universe-builder; renamed to /universes when the+ // list/table index landed (command id stays nav.create.universe-builder).+ // Nav alias must follow.const hit = resolveNavCommand('world builder');- expect(hit?.path).toBe('/universe-builder');+ expect(hit?.path).toBe('/universes');expect(hit?.command?.id).toBe('nav.create.universe-builder');});