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([cleanplateprompt-migrate-to-rich-canon-fragments]): remove from PLAN.md and log to changelog

[._.]/ Adam Eivy8dc7aaac2f73
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index e474290c16..d41b4758c1 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,8 @@
## Changed
+- **[cleanplateprompt-migrate-to-rich-canon-fragments] Clean-plate descriptor body now flows through `richCanonDescriptorFragments('place', setting)`.** `composeCleanPlatePrompt` (`client/src/lib/cleanPlatePrompt.js`) was hand-rolling `description + Palette + recurringDetails` extraction at lines 26–30 and silently dropped `era` / `weather` — the same gap `[pipeline-visual-stages-setting-field-injection]` closed for storyboard + comic-panel renders. Migrated the descriptor body to `mapCanonDescriptorFragments(richCanonDescriptorFragments('place', setting), { trailingPeriod: true })`, matching the existing place-side helper call in `scenePrompt.js:104`. Output is byte-identical for the legacy three-field case (verified via the existing populated test) and now surfaces era + weather when populated. Two new tests in `cleanPlatePrompt.test.js` lock in both halves — the era/weather positive case and the blank/whitespace-only negative case. 242/242 client tests pass.
+
- **[imagegen-local-defer-module-load-side-effects] Drop the module-load `IMAGE_MODELS` snapshot in `server/services/imageGen/local.js`.** The `export const IMAGE_MODELS = Object.fromEntries(getImageModels().map(...))` line ran `loadMediaModels()` at import time — which `mkdirSync`s the registry dir and `writeFileSync`s a default registry on first run. Any importer reaching `imageGen/local.js` via a test that mocks `PATHS.data` to a non-writable path (e.g. `routes/pipeline.test.js → routes/pipeline.js → universeBuilderCollectionHook.js`) failed on `mkdirSync('/mock/data')`. The export was dead (zero callers — grep confirmed) and `generateImage()` already reads the live registry via `getImageModels()`. Removed the export, reverted the 2026-05-19 lazy-import workaround in `services/universeBuilderCollectionHook.js` (now a normal static `import { readImageSidecar }`). Also tightened `enrichSidecar` to use `atomicWrite` (temp+rename) instead of `writeFile` — the prior plain write had a flaky race in tests where five-at-a-time batch enrichment let concurrent readers observe a mid-truncate empty file. 6090/6090 server tests + 234/234 client tests pass; the previously-flaky `enriches every sidecar in a batch` test now passes 10/10 runs.
- **[promote-provider-type-constants-to-shared-module] Promote provider-type literals to a shared `PROVIDER_TYPES` enum.** `server/lib/aiToolkit/constants.js#PROVIDER_TYPES` grows `TUI: 'tui'` alongside the existing `CLI`/`API`, and the object is now `Object.freeze`d so callers can't mutate the shared enum. Server-side `LIGHT_CONTEXT_PROVIDER_TYPES` set + the `isTui` / `providerType` default in `server/services/agentPromptBuilder.js` now read from `PROVIDER_TYPES.{CLI,TUI,API}` instead of bare string literals. A mirror `PROVIDER_TYPES` is exported from `client/src/utils/providers.js` (the toolkit dir is intentionally kept self-contained per CLAUDE.md, so the client can't import the server copy directly), and the four client helpers (`isTuiProvider`, `isCliProvider`, `isProcessProvider`, `providerTypeClass`) now read from it. A new `providers.test.js` case statically imports the server enum and asserts the two enums stay in lockstep, so a future divergence fails CI instead of silently drifting. 13/13 provider helper tests pass; 25/25 agentPromptBuilder tests pass.
diff --git a/PLAN.md b/PLAN.md
index 15eec91022..212175eb06 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -12,7 +12,6 @@ _Nothing currently parked — pick the next item from the Backlog._
### Code quality / dedup (from `/simplify` passes)
-- [ ] [cleanplateprompt-migrate-to-rich-canon-fragments] **Migrate `client/src/lib/cleanPlatePrompt.js#composeCleanPlatePrompt` to `richCanonDescriptorFragments('place', setting)`.** Clean-plate prompt builder (Cluster A — A4 setting reference renders) hand-rolls `description + Palette + recurringDetails` extraction at `cleanPlatePrompt.js:26-30` and is missing `era` / `weather` for the same reason `[pipeline-visual-stages-setting-field-injection]` was missing them — both are visual prompts that benefit from period/atmosphere cues. Tightly scoped sibling change (one client file + one test file). Deferred from that PR because the PLAN item targeted storyboard+comic-panel specifically; clean plates are setting-reference renders, adjacent but distinct.
- [ ] [extract-readcertmeta-helper] **Extract a shared `readCertMeta()` helper from `data/certs/meta.json` readers.** Three independent readers exist: `server/lib/peerSelfHost.js:13-18` (hostname only), `server/services/certRenewer.js:30-31` (mode + hostname), `server/lib/networkExposure.js:25-29` (mode + hostname + ips). Each does its own `statSync({ throwIfNoEntry: false }) + readFileSync + safeJSONParse`. Consolidate into `server/lib/certMeta.js` exporting `readCertMeta() → { mode, hostname, ips } | null`. Surfaced by /simplify during `[codex5-network-exposure-ui]`; deferred to keep that PR scoped. Note `peerSelfHost.js` is in a hot path — verify perf when consolidating.
- [ ] [hoist-loopback-host-helper-to-client-lib] **Hoist `isLoopbackHost` to `client/src/lib/loopbackHost.js`.** `server/lib/networkExposure.js` exports `isLoopbackHost`, but `client/src/components/NetworkExposureWidget.jsx:22-30` re-declares the same `LOOPBACK_HOSTS` Set and `describeMicAvailability()` helper inline (server export isn't reachable from browser). Move the client copy into `client/src/lib/loopbackHost.js` + add a barrel entry so future secure-context callers (voiceClient, etc.) can reuse it. When hoisting, broaden the IPv4 check from a single literal `127.0.0.1` to the full `127.0.0.0/8` loopback range to match browser secure-context behavior — easy `/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/` regex. Surfaced by /simplify and the codex review during `[codex5-network-exposure-ui]`.
- [ ] [image-gen-mode-enum-unify] **Unify image-gen mode enum across server + client.** Server has `IMAGE_GEN_MODES = ['external','local','codex']` (a Zod-validator alphabet) at `server/services/imageGen/index.js:21`; client has `IMAGE_GEN_MODE` constants at `client/src/lib/imageGenBackends.js:3`. Code reads strings (`'codex'`, `'local'`, `'external'`) inline at ~10 sites across `server/services/imageGen/{codex,local,external}.js`, `server/routes/imageGen.js`, and several client pages. `IMAGE_GEN_MODES` is actively used (Zod enum + voice tool enum), so the choice is "export a typed enum object on the server (`IMAGE_GEN_MODE = Object.freeze({ CODEX: 'codex', ... })`) alongside `IMAGE_GEN_MODES` and adopt it at dispatch sites" — not "drop `IMAGE_GEN_MODES`". Surfaced by /simplify after the per-render checkbox PR.