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
plan: mark 16 catalog items in review (PRs #554-560) + capture 6 review-surfaced follow-ups
[._.]/ Adam Eivy914dda0b3935
diff --git a/PLAN.md b/PLAN.mdindex 5e98048298..96451fc56b 100644--- a/PLAN.md+++ b/PLAN.md@@ -8,8 +8,19 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [.changelThe catalog backend, schema, federation routes, ingest extraction service, and Catalog/Ingest/Detail UI all landed in one PR (see `docs/plans/2026-05-29-creative-ingredients-catalog.md` for the design record). Phase-7-onward slices remain:+_In review 2026-05-30 (7 PRs, claude+codex reviewed): 16 "ready" items across both catalog sections are implemented and awaiting merge — #554 roundtrip-and-cast bug fixes (`catalog-export-bundle-import-refs`, `catalog-markdown-roundtrip-fences-scraps`, `catalog-cast-panel-multi-role-unlink`); #555 `catalog-universe-builder-picker`; #556 `catalog-writers-room-version-refs`; #557 `catalog-tests`; #558 the combined schema stack (`catalog-shared-type-registry`, `catalog-payload-schemaversion-per-type`, `catalog-ingredient-relations`, `catalog-tag-taxonomy`, `catalog-ingredient-revisions`, `catalog-ingredient-media-refs`, `catalog-federation-orchestrator`, `catalog-bundled-universe-push`); #559 `catalog-source-kinds-url-file-voice`; #560 `catalog-character-sheet-enrichment` (slice — see its remaining-scope note). Check items off on merge. The 4 gated items (`catalog-type-table-vs-check`, `catalog-user-defined-types`, `catalog-ask-retrieval`, `catalog-scrap-chunking`) were intentionally excluded pending a human-led decision/research pass._++New follow-ups surfaced during the 2026-05-30 review pass:++- [ ] [catalog-bulk-import-route-db-tests] **Route-level DB integration tests for `/bulk-import` and `/ingredients/:id/revisions/:revisionId/restore`.** Both establish producer↔consumer contracts pinned only at the parser/unit layer today (bundle-ref → refLink recreation + role precedence; restore preserves the revision's `payload.schemaVersion`). Needs the Postgres test fixture the `catalog-tests` PR establishes. Surfaced by claude review of #554 + #558.+- [ ] [catalog-bulk-import-scrap-persistence] **Persist scraps on markdown bulk-import.** `parseMarkdownBulk` now round-trips `### Scraps` into a non-enumerable `entry.scraps[]`, but the bulk-import route does NOT create `catalog_scraps`/`catalog_ingredient_sources` rows from them (lossy-but-not-corrupt per the PLAN). Wire scrap creation into the bulk-import transaction (createScrap needs a `{ client }` option). Surfaced by codex review of #554.+- [ ] [catalog-sync-apply-kind-helper] **Extract an `applyKindEnvelope(kind, items, upsertFn, statsTally)` helper in `server/services/catalogSync.js`.** The 7 per-kind apply loops (scraps/ingredients/sources/refs/relations/tags/media) share a try/catch + stats-tally shape. Deferred from #558 to avoid churning tested sync code in an already-large PR. Surfaced by codex review.+- [ ] [catalog-detail-batched-endpoint] **`GET /api/catalog/ingredients/:id/details` to collapse the detail page's 4 round-trips** (relations + revisions + media + missing-media) into one hydrated response. Nice-to-have; surfaced by simplify review of #558.+- [ ] [browser-navigate-ssrf-guard] **Apply the catalog-ingest SSRF guard to the pre-existing `POST /api/browser/navigate` route.** `server/lib/catalogValidation.js:isSafeIngestUrl` + the DNS-resolution + post-redirect re-check from #559 should be reused by `server/routes/browser.js` (it has the same bare-`z.string().url()` gap — `file://`/loopback/link-local reachable). Surfaced by claude review of #559.+- [ ] [catalog-friendlify-universe-tags-on-sync] **Friendlify late-synced legacy universe tags.** The one-time boot repair (`repairUniverseTags.js`) is marker-gated, so a catalog ingredient synced from an older/offline peer AFTER the marker is written keeps its raw `from-universe`/`universe:<uuid>` machine tags. Either run `friendlifyUniverseTags` on inbound catalog rows in the sync-apply path, or replace the one-shot marker with a periodic/high-water repair. Surfaced by codex review of #560.+- [ ] [catalog-universe-builder-picker] **Add "Pick from Catalog" button to `client/src/pages/UniverseBuilder.jsx` character/place/object panels (~3736 LOC file).** When a catalog ingredient is picked, copy its `payload` into a new embedded canon entry with `ingredientId` stamped, AND post `linkCatalogIngredient(id, { refKind: 'universe', refId, role: 'canon-character'|'canon-place'|'canon-object' })`. Picker component lives at `client/src/components/IngredientPicker.jsx` (already built). Deferred from the initial PR because of the file size — needs targeted exploration of the canon-panel structure first (CanonTab / BibleTab around `UniverseBuilder.jsx:1835` + `:2945`).-- [ ] [catalog-character-sheet-enrichment] **Upgrade `client/src/pages/CatalogIngredient.jsx` character detail/edit routes (for example `/catalog/character/cat-chr-224496f9-22ec-4784-b84a-f69cecdd4f01`) into a full editable DnD-style character sheet backed by the enriched universe-canon payload.** Character rows should expose and edit all enriched canon data already present in universe records: identity, role/archetype, appearance, personality, goals/fears, relationships, stats/abilities, color palette, style notes, prompt/render hints, reference images, and any future `payload.schemaVersion` fields. If a character reference sheet has already been rendered, show it in the detail page; if none exists, allow rendering one from this page using the linked universe's style data (`styleNotes`, `influences`, `styleImageRefs`, palette, and render settings) when the ingredient has an associated universe ref. Catalog ingredients and universe canon characters must become the same durable records rather than copy-on-write mirrors: editing either the Catalog detail page or the universe canon surface should update the same `catalog_ingredients` row (with the universe canon entry carrying only a stable `ingredientId`/projection cache if needed), so enriched fields cannot diverge between Catalog and Universe Builder. Migration/backfill: update universe-backfilled character tags from machine tags like `from-universe, universe:14590a09-5a49-4994-b401-395ee354528d` to friendly, user-facing universe-name tags while preserving a structured universe ref for querying; ship a one-time data repair for the current instance as part of the implementation. Pairs with `[catalog-universe-builder-picker]`, `[catalog-bundled-universe-push]`, `[catalog-ingredient-media-refs]`, and `[catalog-payload-schemaversion-per-type]`.+- [ ] [catalog-character-sheet-enrichment] **Upgrade `client/src/pages/CatalogIngredient.jsx` character detail/edit routes (for example `/catalog/character/cat-chr-224496f9-22ec-4784-b84a-f69cecdd4f01`) into a full editable DnD-style character sheet backed by the enriched universe-canon payload.** Character rows should expose and edit all enriched canon data already present in universe records: identity, role/archetype, appearance, personality, goals/fears, relationships, stats/abilities, color palette, style notes, prompt/render hints, reference images, and any future `payload.schemaVersion` fields. If a character reference sheet has already been rendered, show it in the detail page; if none exists, allow rendering one from this page using the linked universe's style data (`styleNotes`, `influences`, `styleImageRefs`, palette, and render settings) when the ingredient has an associated universe ref. Catalog ingredients and universe canon characters must become the same durable records rather than copy-on-write mirrors: editing either the Catalog detail page or the universe canon surface should update the same `catalog_ingredients` row (with the universe canon entry carrying only a stable `ingredientId`/projection cache if needed), so enriched fields cannot diverge between Catalog and Universe Builder. Migration/backfill: update universe-backfilled character tags from machine tags like `from-universe, universe:14590a09-5a49-4994-b401-395ee354528d` to friendly, user-facing universe-name tags while preserving a structured universe ref for querying; ship a one-time data repair for the current instance as part of the implementation. Pairs with `[catalog-universe-builder-picker]`, `[catalog-bundled-universe-push]`, `[catalog-ingredient-media-refs]`, and `[catalog-payload-schemaversion-per-type]`. _In review 2026-05-30 (#560): SLICE shipped — the editable grouped character/place/object sheet (registry-driven `editorSections`/`editorFields`, scalar fields keyed to mirror `sanitizeCharacter` so edits land in the same `catalog_ingredients` row the canon reads), the "Reference sheet" panel, and the friendly-universe-tag data repair (`repairUniverseTags.js`, marker `053`). REMAINING: the deep durable-record unification (collapse the embedded universe-canon entry to a pure `ingredientId` projection so the catalog row is the single store of record) and the structured array-field editors (color palette / stats / aliases, currently read-only here). Keep this item open until those land._- [x] [catalog-pipeline-series-cast] **Add a "Cast (from Catalog)" section to `client/src/pages/PipelineSeries.jsx` that surfaces `listCatalogIngredientsForRef('series', seriesId)` and lets the user attach/detach via `IngredientPicker`.** Series records carry no embedded `characters[]` array, so this is purely additive — backed entirely by `catalog_ingredient_refs`. Same pattern applies to `client/src/pages/PipelineIssue.jsx` (refKind `'issue'`) and `client/src/pages/WritersRoom.jsx` work bibles (refKind `'work'`). _Shipped 2026-05-29: `CatalogCastPanel` reusable component wired into all three pages._- [ ] [catalog-federation-orchestrator] **Wire the catalog into `server/services/syncOrchestrator.js` (or `server/services/sharing/peerSync.js`, whichever owns memory sync orchestration) so the existing `/api/catalog/sync` + `/api/catalog/sync/apply` routes auto-replicate between peers.** Today the routes exist and are version-gated via `PORTOS_SCHEMA_VERSIONS.catalog = 1`, but no scheduler pulls from peers. Mirror how memory sync is registered (it's the only existing Postgres-backed sync category). Outbound `portosMeta.schemaVersions.catalog` is already stamped server-side. **Universe/series sync today does NOT block on catalog sync** — universes carry their full embedded canon payloads, so a peer-pushed universe still arrives complete; the receiving peer's boot-time backfill walks the freshly-arrived universe and (now, post-`[catalog-universe-builder-picker]`'s peer-reconciliation fix) creates local catalog rows with the original IDs preserved. Direct catalog sync only matters for **orphan ingredients** (idea/scene/concept rows not attached to a universe) and for **post-`[catalog-universe-builder-picker]`** universe-ingredient picker links (the `catalog_ingredient_refs` rows themselves) so the "Appears in" panel populates across peers.- [ ] [catalog-bundled-universe-push] **Bundle catalog ingredients into universe peer-push payloads.** When peer A pushes a universe to peer B, the push should include the `catalog_ingredients` rows referenced by that universe's embedded canon plus the `catalog_ingredient_refs` rows linking universe→ingredient. Today the embedded canon payloads still replicate (so universes work end-to-end across peers), but the `tags`, `embedding`, `payload.summary`-style enrichments that live ONLY in the catalog row do not — they get re-derived from the embedded entry on the receiver's first backfill, which is a strictly-lossy view. Mirror the `bundleAdditionalKinds` pattern in `server/services/sharing/peerSync.js`. Schema-version gating already covers the new bundle: `RECORD_KIND_SCHEMA_CATEGORIES.universe` would need `['universes', 'catalog']` appended OR the bundling can rely on `cat-ingredient` arriving as its own already-gated kind in the same push. Pairs with `[catalog-federation-orchestrator]`.