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

docs(done): condense DONE.md to feature-level summaries

[._.]/ Adam Eivyeac608781679
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index f9a4ad7f9e..7b2ccc898a 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,12 +2,15 @@
## Added
+- **Create Suite — Importer page (v1).** New on-ramp to the Create pipeline at `/importer` (also reachable via `⌘K → Importer`). Paste a finished short story / novel / screenplay / comic script + Universe Name + Series Name + content-type radio; the server runs three `heavy`-tier LLM passes (canon + arc in parallel, issue-proposal chained behind the arc summary), returns a preview, and the Review phase lets the user toggle per-entry canon checkboxes + edit the arc + issue titles / synopses / arc roles / per-issue season pickers before committing. On commit, `mergeExtractedBible` LWW-merges characters / places / objects into the universe (case-insensitive name match — preserves locked entries, never duplicates), `series.arc` + `series.seasons[]` are written, and one issue is created per proposal with `stages.prose.output` seeded with the verbatim source excerpt and `stages.idea.input` seeded with the LLM's logline + synopsis. Find-or-create on both universe + series names — re-running with the same names extends the existing world instead of forking a fresh one; series-name match is scoped to its universe so a typo can't cross-link. The series-arc lock is honored end-to-end (analyze fails fast with `ERR_LOCKED` so heavy-tier tokens aren't burned on a doomed run; commit double-checks under the read window). 200K-char hard cap on v1 source size — chunked-extraction follow-up captured in PLAN.md. Three new stage prompts (`importer-canon-extract.md`, `importer-arc-extract.md`, `importer-issue-proposal.md`) ship with per-content-type Liquid `{% if %}` branching; migration `015-importer-stage-prompts.js` seeds them into existing installs (idempotent — never overwrites a customized prompt). Wire-shape `places` maps to storage-shape `settings` at the orchestrator boundary so the UI + prompts already speak the forward-looking Phase 0b vocabulary while the on-disk schema stays unchanged. 11 unit tests cover find-or-create scoping, oversize rejection (no LLM call), locked-arc gating (no LLM call), canon merge correctness, prose+idea seeding, and second-pass dedup. Registered in `navManifest.js` (`nav.create.importer`), `Layout.jsx` sidebar (between Media Gen and Series Pipeline alphabetically), `App.jsx` lazy route, and `apiImporter.js` client wrapper.
+
- **Settings → Image Gen → HuggingFace Token panel.** Adds a first-class place to paste, view, and clear the HuggingFace token used by gated local image models (FLUX.1-dev, FLUX.2-klein). The panel shows live status with source attribution (stored in `settings.json` vs `HF_TOKEN` env var vs `~/.cache/huggingface/token` from `hf auth login`) so it's clear which slot a token lives in; the Clear button only appears for stored tokens (env/CLI come from outside settings). The runner-side `GatedRepoError` message already pointed at "Image Gen settings" — that destination now exists. Backed by `GET /api/image-gen/setup/hf-token-status` (now returns `source`), the existing `POST` for save, and a new `DELETE /api/image-gen/setup/hf-token` for clear. Also: migration `012-mark-flux1-dev-gated.js` retrofits `requiresHfToken: true` + `licenseUrl` onto the FLUX.1-dev entry in existing installs' `data/media-models.json` (fresh installs were already covered via `data.sample`), so the inline banner on the Image Gen page surfaces for that model too — same flow that previously only worked for FLUX.2-klein.
- **Pipeline — issue back covers + volume (trade-paperback) covers + volume PDF.** Every comic issue now generates both a front and a back cover concept as part of the LLM comic-script pass (new `## Back cover concept` section, parsed alongside the existing `## Cover concept`). Both renders use the proof/final workflow and ship in the issue PDF as `cover → pages → back → colophon`. Each volume (season) gets its own front + back cover concepts via a new per-season LLM step (`POST /series/:id/seasons/:seasonId/cover-concepts/generate`) that seeds `season.cover.script` / `season.backCover.script` when blank (never clobbers user edits). The new `GET /series/:id/seasons/:seasonId/volume.pdf` compiles a full trade paperback: `[vol front] → [issue1 front → issue1 pages → issue1 back] → [issue2 …] → [vol back] → colophon`, sorted by `arcPosition ?? number`. Existing seasons get a "Generate cover concepts (LLM)" + "Compile volume PDF" button on each Arc canvas row to backfill. Migration `011-comic-script-back-cover.js` adds the back-cover section to the installed comic-script prompt for unmodified installs.
- **Universe Builder — per-category "Generate N more" variations.** Each category card now has a Generate dropdown (3 / 5 / 10 / custom up to 50) next to the existing Render / + Add buttons. The LLM is given the universe's bible context (logline, premise, style notes, influences) plus the list of existing labels to skip, and returns N additional variations that get appended to the category. Locked items are unaffected — Generate is purely additive. Auto-saves when the universe is already persisted; otherwise hands you a "review then Save" toast. New endpoint: `POST /api/universe-builder/generate-variations`.
## Changed
+- **DONE.md condensed to feature-level summaries.** Dropped file paths, LOC counts, and test counts from the per-date entries; grouped by month with one-line bullets so an LLM can scan completed capabilities without drowning in implementation specifics. Per-release `.changelog/v*.md` files remain the source of truth for the rich details.
- **Pipeline series arc — inline theme editing.** Theme pills on the Series Arc card are now directly editable: click a pill to rename, hover for the × to remove, click the dashed "+ Add theme" chip to append (up to 20 themes, 100 chars each — matching `ARC_LIMITS` on the server). Writes are optimistic with a single-flight save gate so a blur-then-click sequence can't double-persist against stale state. The redundant comma-separated themes input was removed from the "Edit arc" form; logline / summary / protagonist arc / shape still live there.
- **Universe Builder — unify style/negative prompts with the embrace/avoid chip editor.** The prose `stylePrompt` and `negativePrompt` textareas have been removed; the universe's style + negative prompts now live as draggable token lists in `influences.embrace` / `influences.avoid` and are the single editing surface (relabeled in the UI as "Style prompt (embrace)" and "Negative prompt (avoid)"). The renderer joins each list verbatim into the rendered prompt the same way the prose fields used to compose. Existing universes auto-migrate on first read: prose tokens are split on commas, deduped case-insensitively against any pre-existing chips, capped at 30 per list, and persisted (`schemaVersion` bumped to 3). The LLM expand + refine flows now emit `influences` only — no more separate `stylePrompt`/`negativePrompt` keys. Stale-client PATCH payloads still carrying prose fields are absorbed into the chip lists server-side so a stale browser tab doesn't 400.
diff --git a/DONE.md b/DONE.md
index 9865693ef0..4aed18d762 100644
--- a/DONE.md
+++ b/DONE.md
@@ -1,135 +1,56 @@
# PortOS — Completed Milestones
-Archive of completed work. For active roadmap, see [PLAN.md](./PLAN.md). For project goals, see [GOALS.md](./GOALS.md).
+Archive of completed work — feature-level only. Each release ships a per-version file under [.changelog/](./.changelog/) with the full implementation specifics; this file is the bird's-eye view for understanding what the app does and when it shipped.
----
-
-## 2026-05-16
-
-- **Sharing — manifest archive pruning** — Long-lived buckets no longer accumulate thousands of manifest JSONs under `<bucket>/manifests/`. New `pruneBucketManifests(bucket, { maxManifests = 500, localInstanceId })` in `server/services/sharing/manifest.js` moves owned (this-instance-authored) one-shot manifests in excess of the cap into `<bucket>/.archive/manifests/` (oldest first by ISO-prefixed filename). Subscription manifests (`sub-*.json`) and peer-authored manifests are exempt — only the author of a manifest can confidently say it's superseded, and a cross-peer delete would replicate as an unshare. Wired in via a `pruneAfterExport` helper called from `exportSeries` / `exportUniverse` / `exportMedia`, plus a one-shot prune in `attachAllWatchers` on boot to catch up long-running peers. The watcher's `unlink` handler consults a new `isManifestPruning(bucketId, filename)` marker so our own archive renames don't trip `handleUnshare` (the marker is held ~5s, unref'd from the event loop). Classification reads run in bounded-concurrency batches of 32 to avoid `EMFILE` on multi-thousand-manifest buckets; archive renames run in parallel. 6 new tests in `manifest.test.js` cover under-cap noop, oldest-excess archival, subscription exemption, foreign-peer exemption, unknown-instance noop, and the pruning-in-flight marker.
-
-- **Sharing display-name settings — discoverable from the Settings tab structure** — New `client/src/components/settings/SharingTab.jsx` mirrors the display-name + bio strip from the Sharing page top so users can find the source-attribution fields under `/settings/sharing` as well. Standalone tab uses a vertical card layout with a textarea (not single-line input) for the 2000-char bio. Wired into `client/src/pages/Settings.jsx` TABS + switch, sidebar in `client/src/components/Layout.jsx`, and `server/lib/navManifest.js` (`nav.settings.sharing`) so it's reachable from sidebar, `⌘K`, and voice. The existing Sharing page top strip stays in place — both surfaces hit the same `sharingDisplayName` / `sharingBio` settings keys.
-
-## 2026-05-12
-
-- **Civitai / Z-Image follow-ups — six post-merge cleanups** — Six items off the "Civitai LoRA / Z-Image-Turbo follow-ups" backlog in one pass.
- - **`RUNNER_FAMILIES` constants module** — New `server/lib/runners.js` exports `RUNNER_FAMILIES = { MFLUX, FLUX2, Z_IMAGE, ERNIE }` (frozen) plus typed predicates; `client/src/lib/runnerFamilies.js` mirrors it (Vite fs.allow doesn't cross the server boundary). All bare-string usages in `server/lib/civitai.js` (`baseModelToRunner`, `RUNNER_TO_BASE_MODELS`), `server/lib/mediaModels.js` (`isFlux2`/`isZImage`/`isErnie`, flux2 upgrade path), `client/src/pages/ImageGen.jsx` (current runner gate), `client/src/lib/imageGenResolutions.js` (compatibility keys), `client/src/components/imageGen/ImageGenControls.jsx` (isFlux2 gate), and the `RUNNER_LABEL`/`RUNNER_BADGE_CLASS`/`RUNNER_LABELS_SHORT` maps + section list in `client/src/pages/Loras.jsx` now reference the canonical ids. Shape-invariant + mirror-sync tests in `server/lib/runners.test.js`.
- - **`listLoras` exports collision fix** — `server/services/imageGen/local.js#listLoras` renamed to `listLoraFilenames` so the minimal `{ filename, name }` shape can't be confused with `server/services/loras.js#listLoras` (rich Civitai-aware shape). Route + test mock updated.
- - **Generic `deepMerge` utility** — New `server/lib/objects.js#deepMerge` adopts the cleanest existing implementation (from `voice/config.js`). Three call sites collapsed: `services/voice/config.js`, `services/meatspacePost.js`, and `routes/loras.js#POST /auth/civitai`. Documents array-replacement + null-as-value semantics + missing-base tolerance; 10 unit tests cover override, null, missing-base (null/undefined/non-object), mutation guard, and the patch-not-an-object early return.
- - **`assertSafeFilename` helper** — New shared `server/lib/fileUtils.js#assertSafeFilename(filename, { extensions, subject, requiredMessage })` consolidates `services/loras.js#assertSafeLoraFilename` (`.safetensors`) and `services/imageGen/local.js#assertGalleryFilename` (`.png`). Rejects path separators, null bytes, exact `.`/`..`, and non-allowlisted extensions; case-insensitive extension match; enforces each extension starts with `.` (programmer-error otherwise); throws a 400 ServerError with code `VALIDATION_ERROR`. `requiredMessage` lets wrappers preserve their historical missing-input phrase. 13 unit tests in `fileUtils.test.js`.
- - **`mediaModels.js` drift warning** — `loadMediaModels()` now logs a loud `⚠️ media-models drift` warning at boot for any id present in BOTH `_shippedDefaults` AND `DEFAULT_REGISTRY` but missing from the user's live list. Catches the 2026-05-09 silent-drift class. No auto-recover — surfaces the bug, lets a human decide. Warning is honest that intentional deletions are indistinguishable from drift and will keep firing each boot. Covers `image` plus `video.macos` and `video.windows`. 4 new tests.
- - **CLI `defaultModel` for all CLI providers** — `services/runner.js#buildCliArgs` now appends `--model <id>` to claude-code (after `-p -`; claude-code parses flags positionally) and `-m <id>` to gemini-cli, gated on the provider's stored `args` not already containing `--model`/`-m` (both space- and `=`-joined forms; rejects dangling/empty flag forms). Codex behavior unchanged. New `hasModelFlag`/`extractBakedModel`/`stripBrokenModelFlags` helpers exported for reuse. Stage runner / message evaluator / media prompt refiner / world builder refiner per-call model overrides now actually take effect for all three CLIs instead of silently no-op'ing for claude-code and gemini-cli; refiners report the args-baked model id (not defaultModel) when a model is pinned in args. 15+ new tests + 2 regression tests; surfaced from Copilot review on PR #217 and #222.
-- **Extract `scripts/_runner_common.py`** — Pulled the byte-for-byte-duplicated `pick_device` / `make_generator` / `apply_memory_optimizations` / `write_sidecar` / `make_stepwise_callback` / `_emit_user_error` / `_repo_from_hf_error` / HF cause-chain walker (~200 LOC) out of `scripts/flux2_macos.py` + `scripts/z_image_turbo.py` into a shared module. `make_stepwise_callback` now takes an optional `unpack_latents` callable so the flux2 packed-transformer-latent path stays runner-specific while the rest of the decode is shared. `install_hf_error_handler` is a `@decorator` over `main()` that owns the gated/notfound/401 dispatch — `if __name__ == "__main__": main()` collapses to one line in both runners. Mirrors the `lora_utils.py` extraction pattern. Server tests 4012/4012 green; both runners' `--help` resolves cleanly.
-- **Shared `<Modal>` component + `getRenderConfigForItem` extraction** — Two more "Civitai LoRA / Z-Image-Turbo follow-ups" off the backlog. (a) New `client/src/components/ui/Modal.jsx` (~100 LOC) owns the `fixed inset-0 z-50 bg-black/70 ...` backdrop, Esc handler, target-checked click-outside, ARIA + portal + size + align flags. Converted 9 call sites: `Flux2InstallModal`, `EditAppModal`, `MemoryEditModal`, `ResumeAgentModal`, `LayoutEditor`, `KeyboardHelp`, `RapidReaderModal`, `DeployPanel`, and `CivitaiAuthModal` in `Loras.jsx`; net dedup is ~40 LOC after per-site config props and unblocks future modals from owning chrome boilerplate. `MediaLightbox` deliberately stays standalone — its prev/next viewport-edge buttons + layered Esc cascade fight Modal's panel-container wrapper; comment in the file documents why. (b) `getRenderConfigForItem(item)` lives in `client/src/components/media/normalize.js`, surfacing sidecar fields (`cfgScale`/`cfg_scale`, `loraFilenames`/`lora_filenames`, `loraScales`/`lora_scales`, `guidanceScale`/`guidance_scale`/`guidance`, `disableAudio`/`disable_audio`, etc.) so `PromptRefineModal#getRenderConfig` stopped reaching into `item.raw?.*` for snake/camel reconciliation. 11 new unit tests in `normalize.test.js` cover both naming conventions, the deliberate-`0` guidanceScale carve-out, and the camelCase-wins drift safety. Server's `vitest.config.js` now picks up `../client/src/**/*.test.js` so client-side pure helpers stay covered without bootstrapping a separate runner.
-- **Shared `runPromptThroughProvider` runner-wrapper** — Four near-identical "create run → branch on provider.type → executeCliRun/executeApiRun → accumulate text → reject on error" implementations (`worldBuilderExpand#callLLM`, `stageRunner#awaitRunnerCall`, `mediaPromptRefiner#runRefinePrompt`, `messageEvaluator#runPrompt`) collapse onto `server/lib/promptRunner.js`. The unified runner picks the strictest discriminator: rejects on `success === false` OR truthy `error` for BOTH CLI and API. Per-site drift used to let API "soft failures" flow through as empty text — now they reject loudly. Returns `{ text, runId, model }` where `model` is the post-gate effective model that actually executed (per-call model is dropped for providers that don't honor it — see `providerHonorsModelOverride`). 19 unit tests in `promptRunner.test.js` covering happy paths, strictest-discriminator rejection, executeCliRun/executeApiRun pre-onComplete rejection forwarding, and multi-chunk text accumulation.
-- **Shared `findBalancedBlocks` + `tryParseWithRepair` + `extractJson` in `server/lib/jsonExtract.js`** — Three near-identical extractors (`worldBuilderExpand.js`, `mediaPromptRefiner.js#extractRefinementJson`, `stageRunner.js#extractJson`) all solved the same "extract JSON from CLI-banner-prefixed LLM output" problem. Promoted the richest implementation (string-aware brace walker + string-aware trailing-comma + Codex `}}]` orphan-brace repair + `[...]` placeholder cleanup) into the shared lib with optional `shapePredicate` for caller-specific block selection. All three callers re-import from the lib; mediaPromptRefiner keeps its tri-state placeholder-vs-real walker via `findBalancedBlocks` + `tryParseWithRepair` directly so the "schema placeholder" error message stays intact. 33 unit tests in `jsonExtract.test.js`.
-
-## 2026-05-10
-
-- **Pipeline — Story Arc Planning (Phases 1–4 shipped)** — Four-phase rebuild of the PipelineSeries page from a flat issue list into a structural Arc → Season → Episode tree.
- - **Phase 1** — Two-pane layout: sticky bible sidebar (name, format, logline, premise, characters, etc.) + responsive card-grid canvas. Dropped `max-w-5xl` cap; sidebar collapses to a 48px rail (state in `localStorage['portos-pipeline-series-sidebar-collapsed']`); mobile reflows single-column.
- - **Phase 2** — Schema: `series.arc` (logline, summary, themes, protagonistArc, status), `series.seasons[]` (id, number, title, logline, synopsis, episodeCountTarget, themes, endingHook, status, timestamps), and `issue.seasonId` + `issue.arcPosition`. Backed by new `server/lib/storyArc.js` + `server/services/pipeline/seasons.js` (delete-with-reassign re-points child issues atomically). Routes: `GET/POST/PATCH/DELETE /api/pipeline/series/:id/seasons[/:seasonId]`. Pure additive — existing series.json round-trips unchanged.
- - **Phase 3** — Three LLM-driven passes via shared `stageRunner.js`: `pipeline-arc-overview` (proposes arc + season breakdown, `model: 'heavy'`), `pipeline-season-episodes` (per-season episode breakdown with continuity context from prior seasons), `pipeline-arc-verify` (cross-season continuity pass returning `{ severity, location, problem, suggestion }` findings). Backed by `server/services/pipeline/arcPlanner.js`. Routes: `POST /api/pipeline/series/:id/arc/generate`, `POST /api/pipeline/series/:id/seasons/:seasonId/episodes/generate`, `POST /api/pipeline/series/:id/arc/verify`. All accept `{ providerOverride, modelOverride }`; the first two accept `commit: true` to persist in one shot (default returns a preview).
- - **Phase 4** — `client/src/components/pipeline/ArcCanvas.jsx` (~640 LOC): collapsible Season rows with inline edit, episode rows with hover-revealed season picker for cross-season moves + delete, top-of-canvas arc card with logline/themes/collapsible summary + verify panel with severity-badged findings. Generate-arc + per-season-delete use the two-click-arm replace pattern. New client helpers in `apiPipeline.js` wrap all seven new server routes. PipelineSeries.jsx slimmed to a bible-sidebar + `<ArcCanvas />` composition.
- - **Phase 5 deferred** — `seasonContext` prompt injection in `textStages.js#buildStageContext`. Macro continuity already covered by the planning artifacts (series.arc.protagonistArc, season synopses, episode idea-seed); revisit only if executed per-episode prose breaks continuity in practice.
- - Tests: 18 storyArc unit + 13 seasons service + 11 arcPlanner unit + 17 route tests across Phases 2–3. Full server suite 3889/3889 green after Phase 4.
-- **CoS agent dedup race fix** — `spawnAgentForTask` released the `spawningTasks` guard before the agent was queued to the runner, so a concurrent `task:ready` could slip a duplicate past the has-check. Spawn call is now wrapped in `try { spawnViaRunner | spawnDirectly } finally { spawningTasks.delete(task.id) }` (`server/services/agentLifecycle.js:536-547`). New behavioral race-repro + source-text regression guard in `agentLifecycle.test.js`; 3831 tests green.
-- **Video Gen — FFLF keyframe-pair guidance** — `renderFramePanel` in `client/src/pages/VideoGen.jsx` gained a `hint` prop and an accent-coloured line under FFLF mode telling users to use keyframes that share scene geometry. Distinct styling from the experimental advisory.
-- **Deprecate notapalindrome LTX models** — `ltx2_unified`, `ltx23_unified`, `ltx23_distilled_q4` carry `deprecated: true` in `server/lib/mediaModels.js` + the `data.sample/media-models.json` seed; VideoGen + Creative Director dropdowns group them under a `Legacy` `<optgroup>` below the active dgrauet models. `defaultMacos` deliberately stays on `ltx23_distilled_q4` because dgrauet requires an opt-in `INSTALL_LTX2=1` venv install — fresh installs need a model that works out of the box.
-- **Step 4c — `useAsyncAction` hook** — `client/src/hooks/useAsyncAction.js` returns `[run, running]`. Migrated `ProseStage.jsx#handleExtract`, `TextStagePanel.jsx#handleSave` + `#handleGenerate`, and `EpisodeVideoStage.jsx#submit` onto the hook. `StoryboardsStage` stays on its keyed loading state pattern — boolean abstraction wouldn't fit.
-- **Step 2b — Shared zod bible schemas** — `server/lib/validation.js` re-exports `characterBibleCreateSchema` / `settingBibleCreateSchema` / `objectBibleCreateSchema` under kind-neutral names; pipeline routes extend those with back-compat fields + `.passthrough()`. The loose `bibleEntrySchema = z.record(z.string(), z.any())` is gone. Single sanitizer enforces shape for both writers-room + pipeline.
-- **Step 2a — `createBibleStore` factory** — `server/lib/storyBible.js#createBibleStore(...)` derives file paths and id regexes from `kind`; each writers-room domain file (characters / settings / objects) collapses to ~30 LOC. -281 LOC across the three files; 12 new factory tests in `storyBible.test.js`. Settings' slugline-aware dedup and "blank-both → reject" guard flow through the `dedupKey` callback and `validateAfterUpdate`.
-- **Step 4b — Parallel bible extraction** — `extractBibleSchema` accepts `parallel: true`; the three kinds fan out via `Promise.all` for ~3× wall-clock speedup on HTTP-API providers. Default stays sequential — safe for CLI providers that serialize at session level. Merge runs after all kinds complete; baseline read once at top of the route.
-- **Step 4a — `extractAndMergeIntoSeries`** — Bible extract → merge → patch orchestration lives in `server/services/pipeline/series.js`; the route shrinks to a single `seriesSvc.extractAndMergeIntoSeries(...)` call. `mergeExtractedBible` / `extractBible` no longer route-layer imports. Mirrors WR's `mergeExtractedCharacters(workId, extracted)`.
-- **Step 4 — Shared bible-extraction service** — `server/lib/bibleExtractor.js#extractBible({ kind, corpus, existing, context, providerOverride, source })` runs the staged LLM, pulls the `{ characters | settings | objects }` envelope, and routes through canonical `sanitizeBibleList`. Caller owns persistence (avoids the double-merge footgun). Writers-room evaluator's three bible SHAPERS (~75 LOC) deleted; new pipeline route `POST /api/pipeline/series/:id/extract-bible` + an "Extract bibles" button on the Pipeline ProseStage. 12 lib tests + 4 route tests.
-- **Step 3 — Shared staged-LLM runner** — `server/lib/stageRunner.js` exposes `runStagedLLM(stageName, variables, { providerOverride, modelOverride, returnsJson, source })` plus `resolveModel` (tier-aware) and `extractJson` (lenient code-fence stripper). Writers Room evaluator + Pipeline text stages both route through it; ~150 LOC of bespoke CLI-spawn drift deleted. WR analyses now persist transcripts to `data/runs/<runId>/` and pick up tier-name resolution for free. Per-stage temperature override dropped (toolkit's `executeApiRun` doesn't expose temp).
-- **Step 2 — Unified story-bible schema** — `server/lib/storyBible.js` owns canonical `Character` / `Setting` / `Object` shapes + `sanitizeBibleList` + `mergeExtractedBible` with per-kind key normalizers. Writers-room domain files (`characters.js` / `settings.js` / `objects.js`) collapsed onto shared helpers (-299 LOC). Pipeline gains `series.settings[]` + `series.objects[]`; legacy `description` auto-promotes to `physicalDescription`. `composeVisualPrompt` activates the slugline-matching plumbed in step 1 — pipeline storyboard scenes that reuse a setting slugline get the canonical baseline prepended automatically.
-- **Step 1b — `composeStyledPrompt` server mirror** — `server/lib/composeStyledPrompt.js` is the verbatim mirror of the client lib; World Builder's `compileBatchPrompts` now uses it for both variation + composite-sheet paths. Side effect: rendered prompts switch separator from `, ` to `. ` (the composeStyledPrompt convention) — semantically identical for diffusion models. 6 unit tests.
-- **Step 1a — Drop `sceneCardHelpers.js` shim** — Constants moved to new `client/src/lib/wrImageDefaults.js`; SceneCard.jsx + StoryboardPanel.jsx now import `buildScenePrompt` / `matchScene*` / `normCharKey` directly from `client/src/lib/scenePrompt`. Shim file deleted.
-- **Step 1 — Shared scene-prompt composer** — `server/lib/scenePrompt.js` + mirror `client/src/lib/scenePrompt.js` (Vite fs.allow doesn't reach across, follows the project's manual-mirror convention). Pipeline's `composeVisualPrompt` now routes through `buildScenePrompt` so series name + style + universal cast + scene visual all flow through one algorithm with PROMPT_MAX-budgeted truncation. Storyboards stage UI + route schema accept optional per-scene `slugline` so step 2's settings-bible match is plumbed end-to-end. 18 new unit tests.
-- **EpisodeVideoStage aspectRatio + quality picker** — Inline `aspectRatio` + `quality` dropdowns on EpisodeVideoStage's pre-kickoff toolbar, plumbed through to the CD-handoff route. modelId picker deferred until the video-model registry exposes a flagged-stable list.
-- **ScenePreview component + shared CD status helpers** — `client/src/components/creative-director/ScenePreview.jsx` owns the `<video controls poster>` + onError-missing-media + Retry + cache-bust idiom; `sceneStatus.js` exports `SCENE_STATUS*` constants + `getSceneStatusBadge()` + `PROJECT_STATUS_LABEL`. SegmentsTab + EpisodeVideoStage both consume the shared components — EpisodeVideoStage's final-video render gains the missing-onError fallback for free. Side fix: slim CD projection was returning `scene.id` but CD scenes are keyed by `sceneId`; projection + fixture corrected.
-- **Slim `GET /creative-director/:id?slim=1`** — Drops unbounded `runs[]` history + full treatment text; returns `{ id, status, updatedAt, finalVideoId, failureReason, treatment: { scenes: [{ id, order, status }] } }`. EpisodeVideoStage's 4s poll now passes `slim: true`. 2 new route tests.
-- **Pipeline auto-run resumption (demote on boot)** — `recoverStuckAutoRuns()` in `autoRunner.js` walks issues at boot and demotes any `status: 'running'` to `needs-review` (the same terminal state a normal completion lands on). Wired into `server/index.js` alongside brain / writers-room boot recovery. Actual resume deferred — re-attaching SSE + re-running missing stages needs the persisted runId + per-stage progress we don't write to disk. Falling back to `needs-review` is the safe, low-blast-radius fix.
-- **Prompt template partials** — Step 7 of the Writers Room ↔ Pipeline DRY unification. PortOS's prompt engine now supports Mustache-style `{{> partial-name }}` includes via a new `server/lib/promptPartials.js` module. Implemented as a pre-processing pass: `buildPrompt` first calls `expandPartials` to inline `<promptsDir>/_partials/<name>.md` files (recursively, with a MAX_DEPTH=8 cycle guard and loud missing-partial throws), then hands the expanded text to the existing `applyTemplate` for the variable + section pass — so partials carry variable refs naturally and the existing engine stays sync + pure. First two partials shipped: `_partials/bible-deference.md` (character + setting bible deference preamble) and `_partials/scene-output-contract.md` (the canonical scenes[] JSON output shape). `writers-room-script.md` and `pipeline-extract-scenes.md` collapse onto these — bug-fixes to "use canonical character names" or "JSON output contract" logic now land in one place instead of N. 16 unit tests covering reference detection, sync + async expansion, cycle detection, missing-partial throws, and the no-partial fast path. Note: existing installs keep their customized stage prompts (`setup-data.js#ensureSampleContent` only copies missing files); to pick up the partial-using refactor on an existing install, manually re-copy from `data.sample/prompts/stages/`.
-- **Writers Room ↔ Pipeline bridge — Promote to pipeline** — Step 6 of the DRY unification. New `server/services/writersRoom/promoteToPipeline.js#promoteWorkToPipeline(workId, { force })` lifts a WR work into the Pipeline in one call: copies the active draft body into `stages.prose.output` (status `edited`), the latest characters/settings/objects bibles into the new series (canonical sanitizer applied — wr-char-/wr-setting-/wr-object- ids preserved), and the latest succeeded `script` analysis scenes into `stages.storyboards.scenes` (with the same `visualPrompt → description` alias the storyboards-extractor route uses). Records the bidirectional link on both sides — `manifest.pipelineSeriesId` / `manifest.pipelineIssueId` on the WR work; `series.writersRoomWorkId` on the pipeline series — so the menu flips between "Promote to pipeline" and "Open in pipeline" without state. Idempotent: a second promote returns the existing pair (`reused: true`); pass `{ force: true }` for a fresh series. If either linked record is deleted out-of-band, the stale link is dropped and a fresh series is created. Route `POST /api/writers-room/works/:id/promote-to-pipeline`. UI: menu item on WR `WorkEditor`; "Writers Room" badge on PipelineSeries header when linked. Side fix: pipeline `series.js` + `issues.js` switched to lazy `statePath()` (matches writers-room/local.js convention) so the new tests' Proxy-based PATHS mocks load cleanly. 8 service tests + 4 route tests; full server pack 3777/3777.
-- **Pipeline — Storyboards auto-fill from TV script or prose** — Step 5 of the Writers Room ↔ Pipeline DRY unification. New `server/lib/sceneExtractor.js#extractScenes({ source, sourceKind, characters, settings, objects, work, series, issue })` is the single LLM-driven scene-list extractor for both surfaces; mirrors the bibleExtractor pattern (extract→sanitize, caller persists). Two source modes: `prose` uses the existing `writers-room-script` prompt (paragraph-grain breakdown), `tvScript` uses the new `pipeline-extract-scenes` prompt (slugline-grain parse — one entry per teleplay slugline). Shared `sanitizeSceneList` owns the canonical scene shape; Writers Room evaluator's `script` kind now delegates here, deleting ~25 LOC of duplicated SHAPERS.script logic. Pipeline storyboards stage gains "From TV script" + "From prose" buttons via `POST /api/pipeline/issues/:id/stages/storyboards/extract-scenes` — disabled until the source stage has output, two-click-arm guard before replacing existing scenes. Extracted scenes alias `visualPrompt → description` for legacy storyboards-UI compat; rich fields (heading/summary/characters/action/dialogue/sourceSegmentIds) ride along untouched. **Side fix:** `issuePatchSchema.stages` z.union order swapped so visual-stage PATCH bodies (`scenes` / `pages` / `cdProjectId` / `videoPath`) no longer silently strip — the union evaluated the strict text-only schema first, hiding the visual fields. 14 unit tests + 4 route tests; full server pack 3765/3765.
-- **Pipeline — episodeVideo wired end-to-end to Creative Director** — `POST /api/pipeline/issues/:id/stages/episodeVideo/visual` no longer returns 501. New `server/services/pipeline/episodeVideo.js#startEpisodeVideoForIssue` builds a CD treatment from the issue's storyboards scenes (series styleNotes prepended to each scene description, i2v continuation auto-enabled from scene 2 onward), creates a CD project with `autoAcceptScenes: true` + `disableAudio: true` (skips the LLM evaluator round-trip since the human already vetted the storyboards), persists `cdProjectId` on `stages.episodeVideo`, and kicks the CD orchestrator. Idempotent: re-POSTing returns the existing `cdProjectId` unless `force: true`. `EpisodeVideoStage.jsx` swapped its placeholder for a real UI that generates / restarts / polls the CD project (`getCreativeDirectorProject` on a 4s interval until terminal), surfaces per-scene render badges + a progress bar, and renders the final stitched `.mp4` inline when `cdProject.status === 'complete'`. `autoRunner.js` gained an optional `includeVideo` flag that fires the same handoff after text stages complete; a second "Run everything (incl. video)" button on the issue page opts users into it. Errors route through standard middleware (`ERR_NO_STORYBOARDS` → 400). 9 new tests + 1 rewritten (covers buildTreatmentFromStoryboards prompt composition, idempotency, force-restart, missing-storyboards rejection, includeVideo auto-run gating).
-
-## 2026-05-09
-
-- **Creative Director — i2v continuity fidelity (per-scene `imageStrength`)** — Added `imageStrength` (0..1, nullable) to `creativeDirectorSceneSchema` + `creativeDirectorSceneUpdateSchema`; `sceneRunner.resolveImageStrength` defaults continuation scenes (`useContinuationFromPrior=true`) to 0.85 and lets the evaluator override on retry. Already threaded through `videoGen/local.js#generateVideo` → mediaJobQueue. `creativeDirectorPrompts.js` surfaces the current setting on the evaluate view; `cd-treatment.md` / `cd-evaluate.md` document the knob; `TreatmentTab.jsx` shows "str X" on the scene chip. (PR #208)
-- **CoS Workflow tab + canonical scheduled-task ordering** — New `/cos/workflow` page renders the full set of scheduled tasks + autonomous jobs as a left-to-right pipeline grouped into 7 canonical stages (Hygiene → Review → Plan → Audit → Build → Report → Ambient). Each card surfaces schedule, last-run, run count, enabled state, and live "due / waiting / disabled / waiting-on-dependencies" badge plus inline `runAfter` arrows. Backed by `server/services/workflow.js` + `routes/cosWorkflowRoutes.js` (`GET /api/cos/workflow`, `GET /api/cos/workflow/stages`). Two default `runAfter` wirings ship: `do-replan` runs after `pr-reviewer` + `branch-cleanup`, `feature-ideas` runs after `do-replan`. 16 new unit tests + 3 schedule tests. (PR #212)
-- **World Builder for Media Gen** — `/media/world-builder` takes a one-line starter prompt (e.g. "moebius and scavengers reign meets Prophet inspired sci-fi universe") and asks the chosen LLM to expand it into a structured prompt set: positive `stylePrompt` prefix, `negativePrompt`, and 6–10 variations across five canonical buckets (landscapes, environments, characters, structures, vehicles). Per-template provider/model picker, batch-render compiles `stylePrompt + variation.prompt` for every selected bucket and queues through the existing image-gen pipeline (local mflux or Codex). Each batch lands in an auto-named Media Collection ("World: <name> — <timestamp>"). Backed by `server/services/worldBuilder.js`, `worldBuilderExpand.js`, `worldBuilderCollectionHook.js`, `routes/worldBuilder.js`. State in `data/world-builder.json`. 20 new tests. Nav manifest entry `nav.media.world-builder`. (PR #211)
-- **Dismissible CoS Learning AI Recommendations** — Each recommendation in the Learning Analytics panel has an X to dismiss. Persists to `data/cos/dismissed-recommendations.json` and filters from future loads. Count-based alerts ("unknown errors occurred 74 times") record the count snapshot and only re-surface if the count grows ≥1.5× and at least +20. Rate-based recommendations stay dismissed until restored. "Show dismissed" expander lets you restore individually or clear all.
-- **CoS review-loop tasks loop until clean and merge the PR** — Scheduled or user tasks running with worktree + openPR + reviewLoop now spawn a follow-up internal task once the PR is open and the initial Copilot review is requested. The follow-up agent attaches a fresh worktree to the PR branch (new `existingBranch` option on `createWorktree`), runs the full `/do:rpr`-style poll/fix/push/re-request loop until Copilot returns zero unresolved comments (or hits a 10-iteration guardrail), then `gh pr merge --squash --auto --delete-branch`. The follow-up's cleanup pass passes `skipMerge: true` so the worktree branch isn't re-merged on top of the squash-merge. GitLab MRs and other non-GitHub forges still skip the loop. (`server/services/agentLifecycle.js#spawnReviewLoopFollowUp`, `agentPromptBuilder.js#reviewLoopFollowUpSection`)
-- **CyberCity v2 — Phase 1 operational legibility** — Per-building health glyphs, "needs attention" pane, search overlay, status filter chips (`CityFilterBar.jsx`), clickable HUD stats, hover preview with quick actions, mobile/touch support. Phase 2 (interactive systems map / drill-down + agent-paths) still pending — see [docs/features/cybercity-v2.md](./docs/features/cybercity-v2.md).
-- **Better Audit follow-up — socket.js disconnect cleanup** — `socket.on('disconnect')` calls `shellService.detachSocketSessions(socket)` which transitively calls `unsubscribeSessionList(socket)` (`server/services/shell.js:217`). The cleanup the audit flagged as missing is wired correctly via the higher-level helper.
-
-## 2026-05-06
-
-- **Creative Director — multi-frame evaluator sampling** — `extractEvaluationFrames` in `server/lib/ffmpeg.js` probes total frames and writes 5 timeline-tagged samples; `sceneRunner.handleRenderCompleted` calls it before evaluator enqueue; `buildEvaluatePrompt` lists every frame with explicit late-intent guidance. Falls back to single thumbnail on extraction failure.
-- **Creative Director — auto-accept watchdog** — `verifyVideoPlayable()` in `server/lib/ffmpeg.js` checks file-exists / size > 0 / ffprobe-can-read-at-least-1-frame before marking auto-accept; failures route through `handleRenderFailed` honoring `MAX_SCENE_RETRIES`.
-- **Creative Director — smoke-test cost reduction** — `durationSeconds` 3s→2s + hidden `1:1-small` (384×384) aspect preset for the smoke fixture; ~63% pixel-frame cost reduction.
-- **LTX-2.3 audio-to-video (a2v)** — `run_a2v` invokes `AudioToVideoPipeline.generate_and_save` with `--audio` (WAV/MP3) and optional first-frame conditioning. Multipart `uploadFields(['sourceImage','lastImage','audioFile'])`, `mode='a2v'` enum, fail-fast guards (`VIDEO_GEN_AUDIO_REQUIRED`, `VIDEO_GEN_AUDIO_MODE_MISMATCH`, `A2V_REQUIRES_LTX2`), client tile + audio picker, queue-boundary `audioFilePath` sanitization.
-- **LTX-2.3 native video Extend on dgrauet** — `helperMode='extend'` + `extendFromVideoPath` threading in `videoGen/local.js`, `extendFromVideoId` in `routes/videoGen.js`, client routes Extend to native dgrauet path when model runtime='ltx2'. Legacy chained-i2v retained for `mlx_video` runtime. Tests cover route id resolution.
-
-## 2026-04-28
-
-- **Better Audit follow-up — bugs/perf/test quality** — Added `AbortSignal.timeout` to remaining fetch sites (`aiDetect.js`, `meatspacePostLlm.js`, `memoryEmbeddings.js` ×3, `telegramBridge.js`); fixed `httpClient.js` abort-listener leak via cleanup + `{ once: true }`; fixed `MessageDetail.jsx` iframe `load` listener leak via `{ once: true }`; parallelized `feeds.js` refresh with `Promise.allSettled` over `fetchAndParseFeed`; replaced vacuous `usage.test.js` typeof checks with real streak-calculation assertions; `cosRunnerClient.test.js` now uses `.rejects.toThrow` for capacity/spawn/kill/terminate paths; `subAgentSpawner.test.js` imports the real `selectModelForTask` instead of re-implementing it; added `loops.test.js`.
-- **Ask Yourself — slice (b)** — Voice (`ui_ask`) + per-turn promotions ("Save as Brain note" / "Create CoS task" / "Attach to Goal…") with auto-pin to survive 30-day expiry; palette whitelist for `⌘K` → `Ask Yourself`; ask-intent classifier gates the voice tool to RAG-shaped phrasing only; barge-in cancels upstream `askService` stream via `AbortSignal`. 17 new tests; suite 2785/2785 green.
-
-## 2026-04-24
-
-- **Global Command Palette (`⌘K` / `Ctrl+K`)** — `client/src/components/CmdKSearch.jsx` + `server/lib/navManifest.js` (single source of truth) + `server/routes/palette.js` (manifest + action dispatch). Shared backbone with voice agent's `ui_navigate` so navigation, palette, and voice all resolve through one map. See CLAUDE.md "Command Palette & Voice Nav" for the entry shape every new page must register.
-- **Customizable Dashboard with Saved Layouts** — Widget registry (`client/src/components/dashboard/widgetRegistry.jsx`, 15 widgets, 3 data-gated) + named layouts persisted to `data/dashboard-layouts.json` via `GET/PUT/DELETE /api/dashboard/layouts`. Built-in layouts: `default` / `focus` / `morning-review` / `ops`. Keyboard-accessible editor with reorder + add/delete + rename + save-as-new. Palette integration: `⌘K` → any layout name switches instantly. See CLAUDE.md "Dashboard Widgets & Layouts" for the widget contract.
-- **Ask Yourself — slice (a)** — `/ask` and `/ask/:conversationId` live. `server/services/askService.js` orchestrates parallel retrieval across memory (hybrid) + brain notes + autobiography + goals + calendar with kind-weighted reranking. Three modes (`ask` / `advise` / `draft`). API providers stream SSE; CLI providers single-shot. Conversations persist to `data/ask-conversations/` with 30-day auto-expiry. 40 new tests; suite stayed green.
-- **God file decomposition** — `routes/cos.js` (28-line index + 6 modular route files), `routes/scaffold.js`, `client/api.js` (split into 19 focused api*.js modules), `services/digital-twin.js` (split into 10 focused modules), `services/subAgentSpawner.js` (slimmed from monolithic to 192 lines, logic extracted across helper modules).
-
-## 2026-04-21
-
-- **Better Audit remediation — security & overrides** — Added root-package `overrides` for `path-to-regexp` (^8.4.2), `lodash` (^4.18.1), `basic-ftp` (^5.3.0), `follow-redirects` (^1.16.0), `brace-expansion` (^5.0.5), `socket.io-parser` (^4.2.6); upgraded `react-router-dom` to 7.5.2.
-- **Better Audit remediation — code/DRY/bugs** — `pgQuoteIdentifier` helper in `routes/database.js`; `escapeJql` in `services/jira.js`; `atomicWrite` extracted to `lib/fileUtils.js`; `dataManager.js` uses `PATHS.data`; `brain.js` setTimeout cleared on close/error; `telegramClient.js` polling retry with 5s backoff; `clinvar.js` 5-minute AbortSignal; `loops.js` floating promise caught + logged; `systemHealth.js` wrapped in `asyncHandler`; SIGTERM/SIGINT graceful shutdown in `server/index.js`; `agents.test.js` and `socket.test.js` rewritten against real exports; autofixer log statements gained emoji prefixes.
-- **Test coverage** — `cosRunnerClient.test.js` (37 tests, 497 lines), `agentActionExecutor.test.js` (27 tests), CoS routes (170 tests across 6 test files, 83-100% route coverage).
-
-## 2026-03-31
-
-- **Depfree audit (heavy mode)** — Removed 13 of 15 targeted packages (`uuid`, `cors`, `axios`, `multer`, `unzipper`, `node-telegram-bot-api`, `supertest`, `geist`, `globals`, `fflate`, `react-markdown`, `react-diff-viewer-continued`, `react-hot-toast`). ~1,100 lines of owned replacement code across 9 new files (`server/lib/uuid.js`, `httpClient.js`, `multipart.js`, `zipStream.js`, `telegramClient.js`, `testHelper.js`; `client/src/components/ui/Toast.jsx`; etc.). `@dnd-kit/*` and `recharts` deferred — replacement effort exceeds 300-line heavy-mode ceiling.
-
-## 2026-03-20
-
-- **Keyboard Shortcuts Help Modal** — Press `?` to show all keyboard shortcuts; global overlay with section grouping, accessible dialog
+For active roadmap see [PLAN.md](./PLAN.md). For project goals see [GOALS.md](./GOALS.md).
---
-## 2026-03-18
-
-- Fixed PromptManager.jsx fetch calls — response.ok checks now present on all endpoints
-- Fixed memory.js sort comparison — now type-safe with NaN/Date.parse validation
-- Fixed silent catch in useTheme.js — now has console logging instead of swallowing errors
-- Fixed agentActionExecutor.js:137 — reformatted complex ternary for readability
-- Fixed memorySync.js `rows[0]` — added optional chaining with nullish coalescing fallback
-- Fixed db.js `rows[0]` — added optional chaining with empty object fallback
-- Resolved hardcoded localhost in lmStudioManager.js/memoryClassifier.js — server-side connections to local LM Studio with env var overrides, not a bug
-- Resolved empty `.catch(() => {})` in client files — `request()` in api.js already shows `toast.error()` centrally; catches just prevent unhandled rejection warnings
-- Resolved silent catches in runner.js — intentional best-effort writes during error handling
-- Resolved Settings.jsx:366 catch — error toast already fires via centralized `request()` handler
-- DRY: Extended PATHS object with 15 new centralized path constants in fileUtils.js
-- DRY: Migrated 36 files from local `__dirname`/`process.cwd()` path definitions to centralized PATHS
-- DRY: Replaced 57 `mkdir({recursive:true})` calls across 26 files with `ensureDir()`/`ensureDirs()`
+## 2026-05
+
+- **Sharing — manifest archive pruning.** Long-lived sharing buckets no longer accumulate thousands of one-shot manifest JSONs; owned manifests over the cap are archived (peer/subscription manifests exempt).
+- **Sharing — display-name & bio settings tab.** Source-attribution fields now also editable under `/settings/sharing`.
+- **Pipeline — Story Arc Planning.** PipelineSeries rebuilt into an Arc → Season → Episode tree with three LLM passes (arc overview, per-season episodes, cross-season verify) and a two-pane bible-sidebar + card-canvas layout.
+- **Writers Room ↔ Pipeline unification.** Shared story-bible schema (Character/Setting/Object), staged-LLM runner, scene-prompt composer, bible-extraction service, prompt-template partials, "Promote work to Pipeline" bridge, and Storyboards auto-fill from prose or TV script.
+- **Creative Director — episode video end-to-end.** Pipeline `episodeVideo` stage wires storyboards → CD treatment → render → final stitched MP4 inline; slim API endpoint, ScenePreview component, multi-frame evaluator sampling, auto-accept ffprobe watchdog, cheaper smoke-test fixture, per-scene `imageStrength` for i2v continuity.
+- **CoS — Workflow tab.** Left-to-right pipeline view of all scheduled tasks + autonomous jobs grouped into seven canonical stages with `runAfter` dependency arrows.
+- **CoS — review-loop auto-merge.** Tasks with `openPR + reviewLoop` now spawn a follow-up agent that polls Copilot, pushes fixes until clean, and `gh pr merge --squash --auto`.
+- **CoS — dismissible AI recommendations.** Per-card X dismisses Learning Analytics suggestions; count-based alerts only re-surface on significant growth.
+- **World Builder for Media Gen.** One-line starter prompt expands via LLM into a structured prompt set (style prefix, negative, 6–10 variations across five buckets) and batch-renders into an auto-named Media Collection.
+- **Civitai / Z-Image follow-ups (six cleanups).** `RUNNER_FAMILIES` constants module, shared `deepMerge` / `assertSafeFilename` utilities, drift-warning for `mediaModels.js`, and CLI `--model` flag now honored across claude-code + gemini-cli + codex.
+- **Shared `<Modal>` component.** Nine modal call sites converged onto one accessible Modal with backdrop + Esc + portal + ARIA.
+- **Shared LLM / JSON / Python runner helpers.** Unified four near-identical "call provider, accumulate text, reject on error" implementations into `promptRunner.js`; consolidated three CLI-banner JSON extractors into `jsonExtract.js`; extracted ~200 LOC of duplicated device/HF-error handling from flux2 + z-image Python runners into `_runner_common.py`.
+- **Video Gen — LTX-2.3 capabilities.** Native audio-to-video (a2v) on dgrauet (WAV/MP3 + optional first-frame conditioning); native Extend pipeline replacing the legacy chained-i2v fallback; FFLF keyframe-pair guidance hint; deprecated notapalindrome models grouped under "Legacy".
+- **Pipeline — auto-run resumption.** On boot, stuck `running` issues demote to `needs-review` so a crash mid-run doesn't strand the pipeline.
+
+## 2026-04
+
+- **Global Command Palette (⌘K).** Single nav manifest (`navManifest.js`) shared by palette + voice agent's `ui_navigate`; any new page registered there is instantly keyboard- and voice-reachable.
+- **Customizable Dashboard with Saved Layouts.** 15-widget registry + named layouts (`default` / `focus` / `morning-review` / `ops`) with drag/resize Arrange mode; `⌘K` switches layouts by name.
+- **Ask Yourself.** Conversational `/ask` mode with parallel retrieval across memory + brain notes + autobiography + goals + calendar; voice `ui_ask` entry point with intent-classifier gating; per-turn promotions ("Save as Brain note" / "Create CoS task" / "Attach to Goal…").
+- **God-file decomposition.** `routes/cos.js`, `routes/scaffold.js`, `client/api.js`, `services/digital-twin.js`, and `subAgentSpawner.js` split into focused modules.
+- **Better-Audit remediation.** Security overrides for transitive deps (path-to-regexp, lodash, basic-ftp, etc.), centralized helpers (`pgQuoteIdentifier`, `escapeJql`, `atomicWrite`), graceful SIGTERM/SIGINT shutdown, fetch-timeouts via `AbortSignal.timeout` across remaining sites, and significant CoS-route test coverage expansion (83–100%).
+
+## 2026-03
+
+- **Depfree audit (heavy mode).** Removed 13 third-party packages (`uuid`, `cors`, `axios`, `multer`, `unzipper`, `node-telegram-bot-api`, `supertest`, `geist`, `globals`, `fflate`, `react-markdown`, `react-diff-viewer-continued`, `react-hot-toast`) by writing ~1,100 lines of owned in-tree replacements.
+- **Keyboard Shortcuts Help Modal.** Press `?` for a global accessible overlay listing all shortcuts grouped by section.
+- **Code-hardening pass.** `response.ok` checks across PromptManager fetches, type-safe sort comparators, replaced silent catches with logging, optional-chaining on DB row access, centralized 15 path constants in `PATHS`, migrated 36 files to centralized paths, replaced 57 `mkdir({recursive:true})` with `ensureDir()`.
---
-## Milestones
+## Numbered Milestones (M0–M56)
+
+These are the major capability landmarks the app reached over its life. Each links to a feature doc where one exists.
-- [x] **M0-M3**: Bootstrap, app registry, PM2 integration, log viewer — Core infrastructure
+- [x] **M0–M3**: Bootstrap, app registry, PM2 integration, log viewer — Core infrastructure
- [x] **M4**: App Wizard — Register existing apps or create from templates. See [App Wizard](./docs/features/app-wizard.md)
- [x] **M5**: AI Providers — Multi-provider AI execution with headless Claude CLI
- [x] **M6**: Dev Tools — Command runner with history and execution tracking
- [x] **M8**: Prompt Manager — Customizable AI prompts with variables and stages. See [Prompt Manager](./docs/features/prompt-manager.md)
- [x] **M9**: Streaming Import — Real-time websocket updates during app detection
- [x] **M10**: Enhanced DevTools — Provider/model selection, screenshots, git status, usage metrics
-- [x] **M11**: AI Agents Page — Process detection and management with colorful UI
+- [x] **M11**: AI Agents Page — Process detection and management
- [x] **M12**: History Improvements — Expandable entries with runtime/output capture
- [x] **M13**: Autofixer — Autonomous crash detection and repair. See [Autofixer](./docs/features/autofixer.md)
- [x] **M14**: Chief of Staff — Autonomous agent manager with task orchestration. See [Chief of Staff](./docs/features/chief-of-staff.md)
@@ -143,7 +64,7 @@ Archive of completed work. For active roadmap, see [PLAN.md](./PLAN.md). For pro
- [x] **M22**: Orphan Auto-Retry — Automatic retry for orphaned agents
- [x] **M23**: Self-Improvement — Automated UI/security/code analysis with Playwright
- [x] **M24**: Goal-Driven Mode — COS-GOALS.md mission file and always-working behavior
-- [x] **M25**: Task Learning — Completion tracking and success rate analysis
+- [x] **M25**: Task Learning — Completion tracking and success-rate analysis
- [x] **M26**: Scheduled Scripts — Cron-based automation with agent triggering
- [x] **M27**: CoS Capability Enhancements — Dependency updates, performance tracking, learning insights
- [x] **M28**: Weekly Digest UI — Visual digest with insights and comparisons
@@ -152,86 +73,76 @@ Archive of completed work. For active roadmap, see [PLAN.md](./PLAN.md). For pro
- [x] **M31**: LLM Memory Classification — Intelligent memory extraction with quality filtering
- [x] **M32**: Brain System — Second-brain capture and classification. See [Brain System](./docs/features/brain-system.md)
- [x] **M33**: Soul System — Digital twin identity scaffold management. See [Soul System](./docs/features/soul-system.md)
-- [x] **M34 P1-P2,P4**: Digital Twin — Quantitative personality modeling and confidence scoring. See [Digital Twin](./docs/features/digital-twin.md)
+- [x] **M34**: Digital Twin — Quantitative personality modeling and confidence scoring. See [Digital Twin](./docs/features/digital-twin.md)
- [x] **M35**: Chief of Staff Enhancement — Proactive autonomous agent with hybrid memory, missions, LM Studio, thinking levels. See [CoS Enhancement](./docs/features/cos-enhancement.md)
-- [x] **M35.1**: CoS UI — Added Arcane Sigil (3D) avatar style option alongside Cyberpunk 3D
-- [x] **M36**: Browser Management — CDP/Playwright browser page with status, controls, config, and logs
-- [x] **M37**: Autonomous Jobs — Recurring scheduled jobs that the CoS executes proactively using digital twin identity
-- [x] **M38**: Agent Tools — AI content generation, feed browsing, and autonomous engagement for Moltbook agents
-- [x] **M39**: Agent-Centric Drill-Down — Redesigned Agents section with agent-first hierarchy, deep-linkable URLs, and scoped sub-tabs
-- [x] **M40**: Agent Skill System — Task-type-specific prompts, context compaction, negative routing examples, deterministic workflow skills. See [Agent Skills](./docs/features/agent-skills.md)
-- [x] **M41**: CyberCity Immersive Overhaul — Procedural synthwave audio, enhanced post-processing, reflective wet-street ground, settings system
-- [x] **M42 P1-P4**: Unified Digital Twin Identity System — Identity orchestrator, chronotype derivation, personalized taste prompting, behavioral feedback loop, mortality-aware goal tracking, Identity Tab UI dashboard
+- [x] **M36**: Browser Management — CDP/Playwright browser page
+- [x] **M37**: Autonomous Jobs — Recurring scheduled jobs the CoS executes using digital-twin identity
+- [x] **M38**: Agent Tools — AI content generation, feed browsing, autonomous engagement for Moltbook agents
+- [x] **M39**: Agent-Centric Drill-Down — Agent-first hierarchy with deep-linkable URLs and scoped sub-tabs
+- [x] **M40**: Agent Skill System — Task-type-specific prompts and deterministic workflow skills. See [Agent Skills](./docs/features/agent-skills.md)
+- [x] **M41**: CyberCity Immersive Overhaul — Procedural synthwave audio, post-processing, reflective wet-street ground (Phase 1 operational legibility shipped 2026-05)
+- [x] **M42**: Unified Digital Twin Identity System — Identity orchestrator, chronotype derivation, personalized taste prompting, behavioral feedback loop, mortality-aware goal tracking, Identity Tab dashboard
- [x] **M43**: Moltworld Platform Support — Second platform integration for AI agents in a shared voxel world
-- [x] **M44 P1-P7**: MeatSpace — Health tracker with death clock, LEV 2045 tracker, alcohol logging, blood/body/epigenetic/eye tracking, lifestyle questionnaire, TSV import, dashboard widget, compact grid overview, genome/epigenetic migration cleanup, Apple Health integration
-- [x] **M45**: Data Backup & Recovery — Rsync-based incremental backup with SHA-256 manifests, PostgreSQL pg_dump, configurable cron schedule, restore with dry-run preview and selective subdirectory restore, Dashboard widget with health status
-- [x] **M46**: Unified Search (Cmd+K) — Global search across brain, memory, history, agents, tasks, and apps
-- [x] **M48 P1-P10**: Google Calendar Integration — MCP push sync, direct Google API via OAuth2, subcalendar management, goal-calendar linking, daily review, auto-configure via CDP, color-coded events, 15-min Day/Week views, Life Calendar consolidated under Calendar > Lifetime
-- [x] **M49 P1-P4**: Life Goals — Enhanced goal model with todos, progress percentage, velocity tracking, projected completion, time tracking aggregates, AI phase planning, calendar time-blocking, automated weekly check-ins with status tracking
-- [x] **M50 P1-P7**: Email Management — Outlook API+Playwright sync, AI triage with security hardening, draft generation, thread capture, per-action models, full Messages UI, Gmail API sync+send
-- [x] **M51**: Memory System PostgreSQL Upgrade — PostgreSQL + pgvector backend with HNSW vector search, tsvector full-text search, federation sync, and pg_dump backup integration
-- [x] **M52**: Update Detection — GitHub release polling with semver comparison, auto-check every 30 min, Socket.IO real-time notifications, Update tab UI with progress tracking, update executor with health polling
-- [x] **M53**: POST (Power On Self Test) — Daily cognitive self-test with mental math drills (P1) and LLM-powered wit & memory drills (P2)
-- [x] **M54**: MeatSpace Life Calendar — "4000 Weeks" mortality-aware time mapping with responsive grid, goal-activity linking, and time feasibility analysis
-- [x] **M55**: POST Enhancement — Memory builder, imagination drills, training mode, 5-min balanced sessions, wordplay training (4 game modes). See [POST](./docs/features/post.md)
-- [x] **M56**: Telegram Bot Integration — External notification channel via Telegram bot with conversational commands, goal check-in persistence
-- [x] **GSD Tab**: Smart State Detection, One-Click Agent Spawn, Actionable Dashboard
-- [x] **Database Management**: Native PostgreSQL mode (reuses system pg on port 5432), Docker/native switching UI, resource stats, sync/start/stop/destroy controls, per-backend backup buttons
-- [x] **Review Hub**: Aggregated review page with alerts, CoS actions, todos, daily briefings, fullscreen toggle, markdown rendering
-- [x] **JIRA Sprint Manager**: Autonomous JIRA triage and implementation as opt-in per-app scheduled task. See [JIRA Sprint Manager](./docs/features/jira-sprint-manager.md)
-- [x] **App Icons + Non-PM2 Support**: App icon detection/display for iOS/macOS/Swift projects, non-PM2 app type management (Swift/Xcode)
+- [x] **M44**: MeatSpace — Health tracker with death clock, LEV 2045 tracker, alcohol/blood/body/epigenetic/eye tracking, lifestyle questionnaire, TSV import, Apple Health integration
+- [x] **M45**: Data Backup & Recovery — Rsync incremental backup with SHA-256 manifests, `pg_dump`, configurable cron, restore with dry-run preview
+- [x] **M46**: Unified Search (Cmd+K) — Global search across brain, memory, history, agents, tasks, apps (later superseded by the Command Palette)
+- [x] **M48**: Google Calendar Integration — MCP push sync + direct Google OAuth2, subcalendar management, goal-calendar linking, daily review, Life Calendar consolidated under Calendar > Lifetime
+- [x] **M49**: Life Goals — Enhanced goal model with todos, velocity tracking, projected completion, AI phase planning, calendar time-blocking, automated weekly check-ins
+- [x] **M50**: Email Management — Outlook API+Playwright sync, AI triage with security hardening, draft generation, thread capture, Gmail API sync+send
+- [x] **M51**: Memory PostgreSQL Upgrade — pgvector HNSW vector search, tsvector full-text search, federation sync, `pg_dump` backup integration
+- [x] **M52**: Update Detection — GitHub release polling, Socket.IO notifications, Update-tab UI with progress + health polling
+- [x] **M53**: POST (Power On Self Test) — Daily cognitive self-test with mental-math, wit, and memory drills
+- [x] **M54**: MeatSpace Life Calendar — "4000 Weeks" mortality-aware time mapping with goal-activity linking
+- [x] **M55**: POST Enhancement — Memory builder, imagination drills, training mode, balanced sessions, wordplay games. See [POST](./docs/features/post.md)
+- [x] **M56**: Telegram Bot Integration — External notification channel with conversational commands and goal check-in persistence
+
+### Other major capabilities (un-numbered)
+
+- [x] **GSD Tab** — Smart state detection, one-click agent spawn, actionable dashboard
+- [x] **Database Management** — Native PostgreSQL mode reusing system pg on :5432, Docker/native switching UI, resource stats, per-backend backup buttons
+- [x] **Review Hub** — Aggregated review page with alerts, CoS actions, todos, daily briefings
+- [x] **JIRA Sprint Manager** — Autonomous JIRA triage and implementation as opt-in per-app scheduled task. See [JIRA Sprint Manager](./docs/features/jira-sprint-manager.md)
+- [x] **App Icons + Non-PM2 Support** — Icon detection for iOS/macOS/Swift projects, non-PM2 app type management
---
## Code Audits
-See [Security Audit](./docs/SECURITY_AUDIT.md) for the 2025-02-19 security hardening (all 10 items resolved).
-
-### Audit Findings (2026-03-05) — Resolved
-
-Items fixed from audit Passes 1-3 (PRs #67-72):
-- App status computation duplication (apps.js) — unified
-- TOCTOU race in addTask/updateTask/deleteTask — withStateLock mutex added
-- Fetch timeouts missing in cosRunnerClient.js — fetchWithTimeout added to all calls
-- Socket.IO infinite reconnection — capped to 10 attempts with error handler
-- Data race in memory.js loadMemory() — withMemoryLock applied
-- Duplicate getDateString — centralized in lib/fileUtils.js
-- Duplicate HOUR/DAY constants — centralized in lib/fileUtils.js
-- Missing fetch timeouts in moltworld/moltbook api.js — timeout-aware patterns added
-- ChiefOfStaff.jsx useState hooks — reduced from 24 to 19
-
-**Known low-severity:** pm2 ReDoS (GHSA-x5gf-qvw8-r2rm) — no upstream fix, not exploitable via PortOS routes.
+- **2025-02-19 Security Audit** — All 10 items resolved. See [Security Audit](./docs/SECURITY_AUDIT.md).
+- **2026-03-05 Audit (Passes 1–3, PRs #67–72)** — App-status duplication, TOCTOU races, fetch-timeout gaps, Socket.IO reconnection bounds, memory-load races, duplicate constants, hook overuse.
+- **2026-04 Better-Audit remediation** — See the 2026-04 section above.
+- **Known low-severity:** pm2 ReDoS (GHSA-x5gf-qvw8-r2rm) — no upstream fix, not exploitable via PortOS routes.
---
## Documentation
### Architecture & Guides
-- [Architecture Overview](./docs/ARCHITECTURE.md) - System design, data flow
-- [API Reference](./docs/API.md) - REST endpoints, WebSocket events
-- [Contributing Guide](./docs/CONTRIBUTING.md) - Code guidelines, git workflow
-- [GitHub Actions](./docs/GITHUB_ACTIONS.md) - CI/CD workflow patterns
-- [PM2 Configuration](./docs/PM2.md) - PM2 patterns and best practices
-- [Port Allocation](./docs/PORTS.md) - Port conventions and allocation
-- [Security Audit](./docs/SECURITY_AUDIT.md) - 2025-02-19 hardening audit (all resolved)
-- [Troubleshooting](./docs/TROUBLESHOOTING.md) - Common issues and solutions
-- [Versioning & Releases](./docs/VERSIONING.md) - Version format, release process
+- [Architecture Overview](./docs/ARCHITECTURE.md) — System design, data flow
+- [API Reference](./docs/API.md) — REST endpoints, WebSocket events
+- [Contributing Guide](./docs/CONTRIBUTING.md) — Code guidelines, git workflow
+- [GitHub Actions](./docs/GITHUB_ACTIONS.md) — CI/CD workflow patterns
+- [PM2 Configuration](./docs/PM2.md) — PM2 patterns and best practices
+- [Port Allocation](./docs/PORTS.md) — Port conventions and allocation
+- [Security Audit](./docs/SECURITY_AUDIT.md) — 2025-02-19 hardening audit (all resolved)
+- [Troubleshooting](./docs/TROUBLESHOOTING.md) — Common issues and solutions
+- [Versioning & Releases](./docs/VERSIONING.md) — Version format, release process
### Feature Documentation
-- [Agent Skills](./docs/features/agent-skills.md) - Task-type-specific prompt templates and routing
-- [App Wizard](./docs/features/app-wizard.md) - Register apps and create from templates
-- [Autofixer](./docs/features/autofixer.md) - Autonomous crash detection and repair
-- [Brain System](./docs/features/brain-system.md) - Second-brain capture and classification
-- [Browser Management](./docs/features/browser.md) - CDP/Playwright browser management
-- [Chief of Staff](./docs/features/chief-of-staff.md) - Autonomous agent orchestration
-- [CoS Agent Runner](./docs/features/cos-agent-runner.md) - Isolated agent process management
-- [CoS Enhancement](./docs/features/cos-enhancement.md) - M35 hybrid memory, missions, thinking levels
-- [Digital Twin](./docs/features/digital-twin.md) - Quantitative personality modeling
-- [Error Handling](./docs/features/error-handling.md) - Graceful error handling with auto-fix
-- [Identity System](./docs/features/identity-system.md) - Unified identity architecture (M42 spec)
-- [JIRA Sprint Manager](./docs/features/jira-sprint-manager.md) - Autonomous JIRA triage and implementation
-- [Memory System](./docs/features/memory-system.md) - Semantic memory with LLM classification
-- [Messages Security](./docs/features/messages-security.md) - AI prompt injection threat model and defenses
-- [POST](./docs/features/post.md) - Cognitive self-test and training system
-- [Prompt Manager](./docs/features/prompt-manager.md) - Customizable AI prompts
-- [Soul System](./docs/features/soul-system.md) - Digital twin identity scaffold
+- [Agent Skills](./docs/features/agent-skills.md)
+- [App Wizard](./docs/features/app-wizard.md)
+- [Autofixer](./docs/features/autofixer.md)
+- [Brain System](./docs/features/brain-system.md)
+- [Browser Management](./docs/features/browser.md)
+- [Chief of Staff](./docs/features/chief-of-staff.md)
+- [CoS Agent Runner](./docs/features/cos-agent-runner.md)
+- [CoS Enhancement](./docs/features/cos-enhancement.md)
+- [Digital Twin](./docs/features/digital-twin.md)
+- [Error Handling](./docs/features/error-handling.md)
+- [Identity System](./docs/features/identity-system.md)
+- [JIRA Sprint Manager](./docs/features/jira-sprint-manager.md)
+- [Memory System](./docs/features/memory-system.md)
+- [Messages Security](./docs/features/messages-security.md)
+- [POST](./docs/features/post.md)
+- [Prompt Manager](./docs/features/prompt-manager.md)
+- [Soul System](./docs/features/soul-system.md)