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

Merge origin/main into claim/issue-7459

[._.]/ Adam Eivy8b483f31b615
diff --cc docs/features/eidoverse.md
index e0f41c87b6,2954416ab7..0b50ad38cb
--- a/docs/features/eidoverse.md
+++ b/docs/features/eidoverse.md
@@@ -803,30 -783,72 +803,99 @@@ What is still to come is the receiving
envelope's own `candidateVersion` is what that will gate on. Until it lands,
`baseline` means "this install offers this foundation"; nothing pulls it yet.
+### Creative toolkit for minds (#7459)
+
+Authoring a foundation from a blank `body`/`style` is a lot to invent from
+scratch every time. `server/lib/eidoverseCreativeToolkit.js` is a small,
+documented, closed vocabulary a mind reaches for instead: named **materials**
+and **motifs** (cosmetics — install-local `style`, the same class of value
+`styleLeakFindings` refuses inside a `body`) and named **generative placement
+layouts** (`radial-ring`, `grid-plot`, `arc-row`, `grove-cluster` — structure,
+safe as `body`). `eidoverse.creative-catalog` (`manageEidoverse`, read) lists
+all three; nothing here calls an AI provider — every layout is deterministic
+and seeded (`generateDistrictTemplatePlacement`), so the same
+`{layoutId, anchor, seed}` reproduces the same geometry on replay or on a peer
+that later inherits the promoted foundation.
+
+Two ways to use a chosen layout:
+
+- `buildDistrictTemplateAugmentOperations()` turns a placement into
+ ready-to-submit `eidoverse.augment` `spawn` operations for the *live* scene
+ (asset-path validity is still checked where `eidoverse.augment` lands them).
+- `buildDistrictTemplateFoundationDraft()` composes a placement plus a
+ material/motif choice into an `eidoverseFoundationInputSchema`-shaped
+ `district-template` input — the generative substance (layout id, anchor,
+ seed, resulting positions) in `body`, the material/motif cosmetics in
+ `style` — ready to pass straight to `eidoverse.record`. It always lands on
+ the local `vernacular` layer, matching every other authored foundation;
+ publishing it to the shared baseline remains the separate, explicit
+ `eidoverse.promote` act above.
+ ## Executable world controllers (#7456)
+
+ SwarmWorld's strongest result is that technologies are *executable*: they keep
+ running once the agent that authored them is gone. PortOS minds wake
+ intermittently, so a world that only changes during a mind turn is a world that
+ is dead most of the time. A **controller** is the durable thing that keeps
+ running between wakes — a resource tick, an ambient verb, a gentle NPC, a
+ maintenance hook — supervised by PortOS rather than by whoever installed it.
+
+ **Behavior is code PortOS ships; an install is data a mind authors.** The only
+ thing an install may say about behavior is a `controllerId`, resolved by
+ `server/services/eidoverseControllerRegistry.js` against a fixed directory of
+ shipped modules. There is deliberately no path-taking export on that resolver at
+ all: an install arrives from an HTTP body or a mind's tool call, and "import the
+ module this request names" is arbitrary code execution wearing a feature's
+ clothes. This is the same rule the resilience-assay contribution registry
+ already applies, for the same reason.
+
+ **A tick cannot reach an AI provider.** `runControllerStep`
+ (`server/lib/eidoverseControllers.js`) refuses a step that returns a Promise, so
+ there is no await for a network, disk, or provider call to hide behind. Root
+ `AGENTS.md`'s "no cold-bootstrap LLM calls" rule is therefore a structural
+ property of the tick path rather than a convention — boot arms a timer and
+ nothing else. The same synchronous rule is why every shipped controller is
+ replayable by the agent-free assay with no extra authoring: the controller
+ registry is the assay's **second contribution source**, behind the same
+ `findContributionById` resolver, so a `controller` foundation can name its
+ controller's id as its `contributionId` and be gated for promotion on evidence
+ it still runs with its author gone.
+
+ **Effects are proposals, from a closed vocabulary.** A step returns effects, it
+ does not perform them — the same proposal-versus-consequence separation the
+ construction tools have. `note` never leaves the ledger; `say` and `augment`
+ reach the world only for an install whose `deliverEffects` was explicitly turned
+ on (it defaults to `false`), and `augment` reuses the existing world-verb
+ operation schema rather than inventing a second one. A delivery that fails is
+ recorded and the step still counts: the controller's own state advanced, and
+ re-running it to retry a world write would double-count everything it did.
+
+ **Supervision.** `server/services/eidoverseControllerRuntime.js` registers one
+ `eidoverse-controller-tick` interval with the event scheduler and steps every
+ install whose own cadence is due. Arming is reconciled at every gate move —
+ install, retire, arm/disarm — and not only at boot, so a controller installed at
+ 16:00 is not waiting for a restart to start ticking. A pass never replays a
+ backlog: a machine asleep for three days wakes to ONE tick, because a cadence is
+ "about this often", never a ledger of owed executions. A controller that fails
+ `maxConsecutiveFailures` ticks in a row is disarmed with a recorded reason rather
+ than retried forever, and an install whose `controllerId` this version no longer
+ ships is disarmed immediately.
+
+ **Storage** is `data/eidoverse/controllers.json` — `file-primary` and machine
+ local, never federated (`docs/STORAGE.md`). A controller crosses to a peer only
+ as the *body* of a promoted foundation, which carries no install.
+
+ **Shipped controllers.** `ambient-beacon` counts ticks and marks a pulse every
+ Nth one (`announce` decides whether that pulse is spoken into the world or kept
+ as a note). `lantern-keeper` re-issues the `light` verb for a fixed set of world
+ entities every Nth tick, so lamps an author placed stay lit across host restarts
+ while the author is away — re-lighting an already-lit lamp is a no-op, which is
+ what makes running it on a schedule safe.
+
+ **The mind needs its own grant to install.** `eidoverse.install-controller` and
+ `eidoverse.retire-controller` are gated on `manageEidoverse` **and** the separate
+ default-off `installEidoverseControllers` grant, and are mind-scope only:
+ building in the world during a turn is a different act from leaving something
+ running in it afterwards. The read beside them, `eidoverse.controllers`, needs
+ only `manageEidoverse` — a mind that can build should be able to see what is
+ already ticking, and seeing is what makes the writes usable rather than
+ guesswork.
diff --cc server/lib/README.md
index 966203f834,962936d5a5..f1b78b006c
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@@ -574,7 -574,7 +574,8 @@@ pm` default, `NPM_CONFIG_PREFIX`, nvm/V
| `federationSafety.js` | "Does this JSON-shaped payload carry anything that must not leave the install?" — the structured, REFUSAL-side counterpart to the scrubbers (`secretText.js`, `homePath.js`) that rewrite text for a log. `federationSafetyFindings(value, { limit })` walks every string AND every object key, returning `{ code, path, detail }` for a home/Windows path, IPv4 or IPv6 literal, `.ts.net`/`.local` host, MAC, email, phone number, labelled GPS coordinate (the shared table is `piiRedactionPatterns.js`), credential-shaped value (`scrubSecretTokens`) or credential-NAMED key (`secretKeys.js#isSecretKey` — the half no value-shape scan can see). Deliberately over-refuses rather than under-detects: a payload leaving the machine should fail on "looks like an address", and the finding names the exact JSON path to fix. `walkJsonText` / `describeJsonPath` are the reusable path-reporting walk. Pure; reads no environment. |
| `piiRedactionPatterns.js` | `PII_PATTERNS` — the machine-identity/PII `{ code, pattern, replacement }` table shared by `federationSafety.js` (detection, via `pattern.test()`) and `services/agentContextMcp.js#redactAgentContextText` / `services/agentErrorAnalysis.js#redactFailureSnippet` (replacement, via `redactPii(text)`). One list for home/Windows paths, IPv4/IPv6, MAC, `.ts.net`/`.local` hosts, email, phone, and labelled GPS coordinates, so a correction reaches every consumer instead of drifting across independent copies (#7474). `globalPattern(pattern)` derives a global-flagged copy for a `.replace()` caller without mutating the shared (deliberately non-global) regex object. Dependency-free leaf — credential-shaped/-named checks stay in `secretText.js`/`secretKeys.js`. Pure; reads no environment. |
| `secretKeys.js` | `isSecretKey(key)` — does a payload KEY name hold a credential (`api_key`/`apiKey`/`API-KEY` all normalize to `apikey`; a trailing `Key`/`Keys` counts; short names like `auth`/`env` match only whole). The key-side half of the pair whose value side is `secretText.js#scrubSecretTokens`. Split out of `services/userActions.js` so `lib/federationSafety.js` can reach it; deliberate over-redaction (losing `tokenCount` beats shipping `refreshToken`). |
+| `eidoverseCreativeToolkit.js` | The documented creative toolkit for minds building Eidoverse vernacular content (#7459): a closed catalog of `EIDOVERSE_CREATIVE_MATERIALS` and `EIDOVERSE_CREATIVE_MOTIFS` (cosmetics — style-layer only) plus `EIDOVERSE_CREATIVE_LAYOUTS` (named generative placement algorithms — `radial-ring`/`grid-plot`/`arc-row`/`grove-cluster`). `generateDistrictTemplatePlacement` is deterministic and seeded (mulberry32, no `Math.random`, no AI call) so the same `{layoutId, anchor, seed}` always reproduces the same geometry. `buildDistrictTemplateAugmentOperations` turns a placement into ready-to-submit `eidoverse.augment` `spawn` operations; `buildDistrictTemplateFoundationDraft` shapes a placement plus a material/motif choice into an `eidoverseFoundationInputSchema`-ready `district-template` input, keeping the generative substance in `body` and the material/motif cosmetics in `style`. `describeCreativeCatalog()` is the prompt-safe catalog projection. Pure: no I/O, no clock, no provider calls. |
+ | `eidoverseControllers.js` | Executable Eidoverse world controllers — the install schema and the sandboxed step boundary (#7456). `eidoverseControllerInstallSchema` / `eidoverseControllerRecordSchema` describe an install (a registry `controllerId`, a bounded `config`, a `tickIntervalMs`, and a `deliverEffects` flag that is FALSE by default, so installing arms bookkeeping and never a world verb). `runControllerStep` is the sandbox: it hands the controller JSON copies of its state and config, REFUSES a step that returns a Promise (an await is the shape every network/disk/AI-provider call takes, so the tick path is provider-free structurally rather than by convention), caps the state it may return, and validates its effects against a closed vocabulary — `note` (never leaves the ledger), `say`, and `augment`, which reuses `eidoverseValidation.js`'s own world-verb operation schema. `controllerTickDue` / `nextControllerTickAt` are the scheduling math, measured from now so a machine that slept wakes to ONE tick and not a replayed backlog. `summarizeControllerInstall` is the prompt-shaped projection that keeps a 16KB state blob out of a mind turn. Pure: callers pass `now`. |
| `eidoverseFoundations.js` | Local-vs-baseline ownership for Eidoverse world foundations and the promote-candidate packaging gate (#7455). `EIDOVERSE_FOUNDATION_LAYERS` (`runtime` / `baseline` / `vernacular`, defaulting to `vernacular` so nothing is shared by omission) and `layerPromoteRefusal`; the record / input / candidate-envelope Zod schemas, where a foundation is `{ body, style }` BY CONSTRUCTION — packaging carries `body` and drops `style`, so an inheriting peer never receives its author's cosmetics, and `styleLeakFindings` REFUSES an unambiguously cosmetic key smuggled into `body` (spatial/asset keys stay allowed — they are a district template's substance). `assayEvidenceFromVerdict` folds an agent-free resilience verdict (#7460) into the evidence the gate reads, including the binding that it ran against the contribution this foundation names. `packageFoundationCandidate` and `verifyFoundationCandidate` are the one gate seen from the sending and receiving sides, over a content-addressed `fingerprint` hashed from the payload AS SENT; federation safety comes from `federationSafety.js`. `summarizeFoundation` is the prompt-shaped projection of a ledger record (layer, identity, assay outcome, whether a candidate exists) that keeps the local style layer and the packaged envelope out of a mind turn. Pure: callers pass `now`. |
| `eidoverseWorldDesign.js` | Immutable Eidoverse World Design V1/V2/V3 registry, override migration, semantic districts, 48-signal ceiling, and install-local asset locks for PortOS Commons. |
| `eidoverseWorldLabels.js` | The `comp.label` component PortOS attaches to every entity it projects into Eidoverse (eidoverse-worlds#5), so a rendered building says what it represents instead of only naming its decorative model. `buildEidoverseLabel(component, alias?)` reads one already-built `comp.portos` payload and returns `{name, description?, visibility, offset?}` — district and world-identity landmarks always visible, live indicators labelled `nearby`, path markers `inspect`-only so a walkway cannot bury the district it leads to — and `null` for anything not `managedBy: 'portos'`, so a caller cannot label somebody else's entity. Names and descriptions are built from PortOS's own vocabulary (district label, kind label, resource category, coarse status, freshness) plus an opaque hashed resource ref for disambiguation, never from record contents, machine identity, addresses, or filesystem paths — the append-only world log is the strictest privacy boundary PortOS writes to. Also owns bounded opaque-key alias normalization and V1 renderer capability parsing; aliases are explicit opt-in names and are never inferred from private records. Owns `safeWorldText`, the one control-character/length sanitizer shared with `services/eidoverseWorldProjection.js` so a component field and the label built from it cannot disagree about what is safe. Pure. |
diff --cc server/lib/index.js
index dde6a6fd9a,1f58f34d1a..8179092e81
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@@ -555,7 -555,7 +555,8 @@@ export * from './concurrencyGate.js'
export * from './dispatchLabels.js';
export * from './domainAutonomy.js';
export * from './domainBudgets.js';
+export * from './eidoverseCreativeToolkit.js';
+ export * from './eidoverseControllers.js';
export * from './eidoverseFoundations.js';
export * from './federationSafety.js';
export * from './secretKeys.js';
diff --cc server/services/cosToolRegistry.js
index aaf3dd918d,2ba492a164..c536a5f41d
--- a/server/services/cosToolRegistry.js
+++ b/server/services/cosToolRegistry.js
@@@ -27,8 -27,8 +27,9 @@@ import
eidoverseWorldSaySchema,
eidoverseChatReadSchema, eidoverseTravelVisitSchema, eidoverseVisitChatSchema, eidoverseVisitLeaveSchema,
} from '../lib/validation.js';
-import { eidoverseFoundationIdParamSchema, summarizeFoundation } from '../lib/eidoverseFoundations.js';
+import { eidoverseFoundationIdParamSchema, eidoverseFoundationInputSchema, summarizeFoundation } from '../lib/eidoverseFoundations.js';
+ import { eidoverseControllerArmSchema, eidoverseControllerIdParamSchema, eidoverseControllerInstallSchema, summarizeControllerInstall } from '../lib/eidoverseControllers.js';
+import { describeCreativeCatalog } from '../lib/eidoverseCreativeToolkit.js';
import { persistentMindChooseNameSchema } from '../lib/persistentMindChosenName.js';
import { persistentMindProtectMemorySchema } from '../lib/persistentMindMemory.js';
import { persistentMindThinkingRequestSchema } from '../lib/persistentMindThinkingPresets.js';
@@@ -379,32 -377,26 +380,51 @@@ const eidoverseFoundationTools =
idempotent: sideEffect === 'read', async: false, confirmation: 'capability-grant' },
adapter: { kind: 'eidoverse-foundations', operation },
}));
+// The documented creative toolkit (#7459): named materials, motifs, and
+// generative placement layouts a mind reaches for instead of inventing
+// coordinates and colors from scratch. Purely a catalog read — deterministic,
+// seeded, no AI provider call (`lib/eidoverseCreativeToolkit.js`). Feed a
+// chosen layout into eidoverse.record (a district-template) or
+// into eidoverse.augment (live spawn operations).
+const eidoverseCreativeCatalogTool = Object.freeze({
+ type: 'portos_tool',
+ name: 'eidoverse.creative-catalog',
+ version: COS_TOOL_SCHEMA_VERSION,
+ providerName: providerToolName('eidoverse.creative-catalog'),
+ aliases: [providerToolName('eidoverse.creative-catalog')],
+ description: 'List the documented creative toolkit for Eidoverse vernacular building: named materials and motifs (cosmetics for a foundation\'s `style`) and named generative district-template placement layouts (structure for a foundation\'s `body`). Deterministic and seeded — no AI provider call.',
+ input_schema: zodToOpenApiSchema(z.object({}).strict()),
+ output_schema: objectOutputSchema,
+ policy: {
+ scopes: ['mind'],
+ requiredCapabilities: ['manageEidoverse'],
+ sideEffect: 'read',
+ idempotent: true,
+ async: false,
+ confirmation: 'capability-grant',
+ },
+ adapter: { kind: 'eidoverse-creative', operation: 'catalog' },
+});
- const eidoverseTools = [...eidoverseTravelTools, ...eidoverseFoundationTools, eidoverseCreativeCatalogTool, eidoverseStatusTool, eidoverseProjectTool, eidoverseAugmentTool, eidoverseSayTool];
+ // Installing a controller leaves something RUNNING in the world after the turn
+ // ends, which is a different act from building in it during a turn — so it
+ // carries its own default-off grant on top of `manageEidoverse`, the same way
+ // promotion does. The read beside them needs only `manageEidoverse`: a mind
+ // that can build in the world should be able to see what is already ticking in
+ // it, and seeing is what makes the writes usable rather than guesswork.
+ const eidoverseControllerTools = [
+ ['controllers', 'List the executable world controllers PortOS ships and the ones installed here — each install\'s cadence, whether it is armed, whether its effects reach the world, its tick count, and why the supervisor disarmed it if it did. Read this before installing: `controllerId` must be one of the registry ids it returns.', z.object({}).strict(), ['manageEidoverse'], 'read'],
+ ['install-controller', 'Attach a bounded controller to the private world so it keeps ticking between your wakes. `controllerId` names one of the ids eidoverse.controllers returns — a controller is never a path or code you supply. Every tick is synchronous and provider-free, and `deliverEffects` (default false) decides whether its effects reach the world at all. This is a REQUEST: the result is `outcome: "installed"` only when it landed, and any other outcome means nothing is running — read `reasons`. The first tick is one interval away, never immediate.', eidoverseControllerInstallSchema, ['manageEidoverse', 'installEidoverseControllers'], 'write'],
+ ['arm-controller', 'Pause or resume one installed controller without losing the state it has accumulated. Use this to resume a controller the supervisor disarmed after repeated failures, once you have fixed what it was failing on — re-installing would work too but starts its state over.', eidoverseControllerArmSchema, ['manageEidoverse', 'installEidoverseControllers'], 'write'],
+ ['retire-controller', 'Stop and remove one installed controller by its install id. Retiring deletes the install and its accumulated state; re-installing starts it fresh.', eidoverseControllerIdParamSchema, ['manageEidoverse', 'installEidoverseControllers'], 'write'],
+ ].map(([operation, description, schema, requiredCapabilities, sideEffect]) => ({
+ type: 'portos_tool', name: `eidoverse.${operation}`, version: COS_TOOL_SCHEMA_VERSION,
+ providerName: providerToolName(`eidoverse.${operation}`), aliases: [providerToolName(`eidoverse.${operation}`)],
+ description, input_schema: zodToOpenApiSchema(schema), output_schema: objectOutputSchema,
+ policy: { scopes: ['mind'], requiredCapabilities, sideEffect,
+ idempotent: sideEffect === 'read', async: false, confirmation: 'capability-grant' },
+ adapter: { kind: 'eidoverse-controllers', operation },
+ }));
-const eidoverseTools = [...eidoverseTravelTools, ...eidoverseFoundationTools, ...eidoverseControllerTools, eidoverseStatusTool, eidoverseProjectTool, eidoverseAugmentTool, eidoverseSayTool];
++const eidoverseTools = [...eidoverseTravelTools, ...eidoverseFoundationTools, eidoverseCreativeCatalogTool, ...eidoverseControllerTools, eidoverseStatusTool, eidoverseProjectTool, eidoverseAugmentTool, eidoverseSayTool];
const thinkingTools = ['mind.thinking-presets', 'mind.request-thinking-preset'].map((name, index) => ({
type: 'portos_tool', name, version: COS_TOOL_SCHEMA_VERSION,
providerName: providerToolName(name), aliases: [],
@@@ -710,9 -691,36 +731,39 @@@ const executeAdapter = async (tool, arg
// envelope on a success is a duplicate of the body the mind already wrote.
return { ...result, candidate: null, foundation: result.foundation ? summarizeFoundation(result.foundation) : null };
}
+ if (tool.adapter.kind === 'eidoverse-creative') {
+ return describeCreativeCatalog();
+ }
+ if (tool.adapter.kind === 'eidoverse-controllers') {
+ // Lazy for the same reason the foundations pair is: the runtime drags the
+ // controller registry, the file store and the event scheduler, and only
+ // this tool group reaches them.
+ const runtime = await import('./eidoverseControllerRuntime.js');
+ if (tool.adapter.operation === 'controllers') {
+ const [{ describeControllerDefinitions }, listed] = await Promise.all([
+ import('./eidoverseControllerRegistry.js'),
+ runtime.listEidoverseControllers(),
+ ]);
+ return {
+ available: await describeControllerDefinitions(),
+ counts: listed.counts,
+ installs: listed.installs.map((install) => summarizeControllerInstall(install)),
+ };
+ }
+ if (tool.adapter.operation === 'arm-controller') {
+ const armed = await runtime.setEidoverseControllerArmed(args.id, args.armed);
+ return { ...armed, install: armed.install ? summarizeControllerInstall(armed.install) : null };
+ }
+ if (tool.adapter.operation === 'install-controller') {
+ const result = await runtime.installEidoverseController(args, { installedBy: 'mind' });
+ // State included here and nowhere else: the mind just authored this
+ // config and the initial state is what tells it the controller
+ // understood it. The list projection stays state-free.
+ return { ...result, install: result.install ? summarizeControllerInstall(result.install, { includeState: true }) : null };
+ }
+ const result = await runtime.retireEidoverseController(args.id);
+ return { ...result, install: result.install ? summarizeControllerInstall(result.install) : null };
+ }
if (tool.adapter.kind === 'eidoverse-world') {
const world = await import('./eidoverseWorld.js');
if (tool.adapter.operation === 'status') return world.getEidoverseWorldStatus({ compact: true });
diff --cc server/services/cosToolRegistry.test.js
index d1f9f18d93,b272a2e059..fd2e3a9e7c
--- a/server/services/cosToolRegistry.test.js
+++ b/server/services/cosToolRegistry.test.js
@@@ -239,10 -185,11 +239,14 @@@ describe('cosToolRegistry', () =>
'eidoverse.visit-chat',
'eidoverse.leave',
'eidoverse.foundations',
+ 'eidoverse.contributions',
+ 'eidoverse.record',
'eidoverse.promote',
+ 'eidoverse.creative-catalog',
+ 'eidoverse.controllers',
+ 'eidoverse.install-controller',
+ 'eidoverse.arm-controller',
+ 'eidoverse.retire-controller',
'eidoverse.status',
'eidoverse.project',
'eidoverse.augment',