Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Merge origin/main into claim/issue-7461
[._.]/ Adam Eivy15b0abf01595
diff --cc docs/STORAGE.mdindex 53348cf61e,df6f0d5fde..c69e3f63a8--- a/docs/STORAGE.md+++ b/docs/STORAGE.md@@@ -68,7 -68,8 +68,8 @@@ PostgreSQL is a **required** install/ru- MortalLoom / Health / Meatspace health data — `data/health`, `data/meatspace`, MortalLoom iCloud store. Kept file-backed to preserve iCloud/file sync and avoid routing sensitive health records through the app DB before that boundary is designed.- App scaffolds / cloned repos / browser profiles — `data/repos`, `data/browser-profile` — inherently filesystem-oriented.- Eidoverse PortOS integration and world logs — `data/eidoverse/portos-world.json` stores the PortOS-owned private-world identity, versioned design selection, explicit display aliases keyed by opaque resource identity (never backfilled from records), user overrides, deterministic asset-resolution lock (paths, fingerprints, size, and provenance only; never model bytes), migration report, and last-good reconciliation checkpoint; `data/eidoverse/worlds` stores the external runtime's append-only world files. Both are `file-primary`, included in filesystem backups, and intentionally machine-local — never federated by PortOS. Guest travel sessions and live chat cursors are ephemeral transport state held only in memory; they are not a new record store or sync category. Explicit guest conversation follows the [guest-chat ADR](decisions/2026-09-05-eidoverse-guest-chat.md). PortOS selects the runtime's world-store location through `.env.portos` but does not edit the external checkout to build content. The separately licensed git checkouts and Eidoverse-owned asset library/cache live under the existing re-cloneable `data/repos/` backup class.-- Eidoverse world foundations ledger — `data/eidoverse/foundations.json` (#7455). The install-local record of every durable world foundation this instance authored: its ownership layer (`vernacular` by default, `baseline` once promoted), the promotable `body`, the vernacular `style` layer that never leaves, provenance (opaque instance id + author kind), the last agent-free resilience verdict, and the last packaged promote candidate. `file-primary` and **intentionally machine-local — never federated**: the only thing authorized to leave the install is a packaged candidate envelope, and only through an explicit promote. No `data.reference/` seed and no migration — an absent file IS the empty ledger every install starts from, so a seed would only put shipped defaults where a user's foundations belong. Backed up with the rest of `data/eidoverse/`.+- Eidoverse world foundations ledger — `data/eidoverse/foundations.json` (#7455, #7461). The install-local record of every durable world foundation this instance authored OR inherited: its ownership layer (`vernacular` by default, `baseline` once promoted or inherited), the promotable `body`, the vernacular `style` layer that never leaves, provenance (opaque instance id + author kind), the last agent-free resilience verdict, and the last packaged promote candidate. A record this install pulled from a peer additionally carries an `inheritance` edge (`{ originInstanceId, foundationId, fingerprint, sourceInstanceId, inheritedAt }`) and is stored under a `peer:<originInstanceId>:<foundationId>` key disjoint from any locally-authored id, so it can never shadow or collide with a same-id local vernacular foundation. The proposal → commit → promote/inherit lineage is not stored — `foundationLineage()` derives it on every read from fields the record already carries. `file-primary` and **intentionally machine-local — never federated**: the only thing authorized to leave the install is a packaged candidate envelope, and only through an explicit promote (out) or an already-verified candidate handed to `recordEidoverseFoundationInheritance()` (in) — the peer pull/inherit wire transport itself is the still-open remainder of #7455, so nothing calls the inherit path in this install yet. No `data.reference/` seed and no migration — an absent file IS the empty ledger every install starts from, and the `inheritance`/`lineage` additions are additive/nullable so an older file on disk reads back unchanged. Backed up with the rest of `data/eidoverse/`.+ - Eidoverse executable world controllers — `data/eidoverse/controllers.json` (#7456). The install-local set of controllers attached to this instance's private world: which shipped controller each install names (by REGISTRY ID — never a module path, so an install can never become an import), its bounded config, its cadence, whether it is armed, whether its effects are allowed to reach the world, and the durable state the controller advances one step per supervised tick. `file-primary` and **intentionally machine-local — never federated**: an install names this world's own entities and carries its author's intent, which the [machine-local privacy ADR](decisions/2026-08-08-privacy-records-machine-local.md) keeps off the federation layer; a controller is shared with a peer only as the BODY of a promoted foundation, which carries no install. No `data.reference/` seed and no migration — an absent file IS the empty set every install starts from. Backed up with the rest of `data/eidoverse/`.- Sprite animation-track definitions — `data/sprites/animation-tracks.json` (#3152). A small hand-editable authoring config: which animation types exist beyond the compiled-in `walk` (label, directionality, frame/fps bounds, prompt template, and the on-disk `setKind` strings). `file-primary` rather than `db-primary` because it is **machine-local and inseparable from the on-disk sprite tree it describes** — a row names the `setKind` an approved set under `data/sprites/{id}/` already carries, so the two travel together or neither means anything — and because it has no cross-record queries, no relationships beyond `kinds` strings, and no sync cursor. Read synchronously and cached per process (`server/services/sprites/animationTrackStore.js`): `server/lib/validation.js` builds sprite Zod ranges from it at module load, so it must resolve without `await`. Seeded from `data.reference/sprites/animation-tracks.json` (migration 211), which is also the fallback read when no user copy exists yet. Backed up in full by the rsync snapshot.- Quota-burn plan — `data/cos/quota-burn.json` (#3390). The install's burn plan: master switch, poll interval, and per-provider-family windows + an ordered list of steps, each a REFERENCE to a scheduled task (`data/cos/task-schedule.json` or the app job store) plus its per-invocation overrides. `file-primary` and **intentionally machine-local — never federated**: quota belongs to a particular machine and provider account, so a synced plan would have each peer spending against the other's window budget, and a step's scheduled-task reference names task types and managed apps that only exist on this machine. No sync cursor, no tombstone. Its four companions are `ephemeral-file` — regenerable telemetry, all safe to delete: `data/cos/quota-burn-dispatches.json` (per-window dispatch counts, self-pruning at 30 days), `data/cos/quota-burn-runs.json` (capped run log), `data/cos/quota-burn-inflight.json` (entries a burn job has enqueued but whose renders have not completed, self-pruning at 6 hours — deleting it only risks re-queueing a render already in flight), and `data/cos/quota-burn-denials.json` (per-family blocks from an observed provider refusal, cleared by the next successful burn or a 5-hour TTL — deleting it only risks one dispatch into a still-exhausted window). Backed up with the rest of `data/cos/`; a restored plan simply re-applies on this machine. See [Quota Burn](./QUOTA-BURN.md).- Manual maintenance runs — `data/cos/maintenance-runs.json`. A capped list of the Schedule tab's "Run maintenance now" records: the app, the pinned provider/model/effort, the ladder's steps, the per-step completion ledger and the current hold reason. `ephemeral-file` and machine-local like the burn plan (its steps name task types and managed apps that only exist here); deleting it only forgets progress — a run in flight would have to be started again. See [Quota Burn → Maintenance sequence](./QUOTA-BURN.md#maintenance-sequence).diff --cc docs/features/eidoverse.mdindex 600a2eae92,0b50ad38cb..7ab79aa58a--- a/docs/features/eidoverse.md+++ b/docs/features/eidoverse.md@@@ -779,50 -791,111 +791,156 @@@ Both tools return summaries (`summarizethe local style layer and the packaged envelope have no business riding into aprompt.+ A mind can also author, not just list and promote. `eidoverse.record` wraps the+ same `recordEidoverseFoundation()` the HTTP route above uses, gated on+ `manageEidoverse` alone (no promote grant needed — authoring stays local by+ construction) and mind-scope only. `authorKind` is stamped `'mind'` server-side+ regardless of what the call arguments claim, the same reason `layer` is never+ caller-supplied. `eidoverse.contributions` (`manageEidoverse`, read) lists the+ `contributionId` values a new foundation may bind to before it is promotable.+-What is still to come is the receiving side — peer pull/inherit — and the-envelope's own `candidateVersion` is what that will gate on. Until it lands,-`baseline` means "this install offers this foundation"; nothing pulls it yet.+### Provenance graph and inheritance edges (#7461)++Every foundation carries queryable provenance: who authored it (an opaque+instance id + coarse `authorKind` — `mind` / `cos` / `user`, never a display+name) and its ordered lineage. `foundationLineage()`+(`server/lib/eidoverseFoundations.js`) derives that lineage — `authored` →+`assayed` → `packaged` → `promoted`, or `inherited` → `assayed` for a local+copy of a peer's — from fields the record already persists, so it costs no+extra storage and a ledger written before this existed still projects+correctly. `GET /api/eidoverse/world/foundations` returns it on every entry,+and the mind tools' `summarizeFoundation()` projection carries `provenance`,+`inheritance`, and `lineage` too — the same identity fields a candidate+envelope was already authorized to carry, now surfaced consistently+everywhere a foundation is read. `GET /api/eidoverse/world/foundations/:id`+only reaches a locally-authored (plain-id) record: an inherited copy lives+under a separate ledger key precisely so it can share a human-readable id+with a local vernacular foundation without colliding, which also means a+single bare id cannot disambiguate the two — the list endpoint is the+provenance query surface for an inherited entry.++**`recordEidoverseFoundationInheritance()`** (`eidoverseFoundationLedger.js`)+is the accept-side of a peer pull: given an already-verified candidate+envelope, the peer this install pulled it FROM, and this install's own+instance id, it re-runs the exact gate a peer runs on a candidate it was+handed — schema, content-addressed fingerprint, the embedded assay evidence,+and federation safety — and, on a pass, stores a `baseline` local copy+carrying an `inherited-from` edge (origin instance, source instance, the+envelope's fingerprint, and when it was pulled). It refuses a self-referential+pull (a peer handing back a foundation this install itself originated) and+never re-runs the resilience assay itself — replaying a peer's controller code+on the receiving install is exactly what the assay harness exists to keep off+every OTHER install.++The inherited copy is stored under `peer:<originInstanceId>:<foundationId>` —+deliberately disjoint from any id a local author could ever write — so it can+never shadow, collide with, or erase a same-id local vernacular foundation;+both simply coexist in the listing. An inherited foundation can never be+re-promoted from this install (`packageFoundationCandidate` refuses it by+name): promotion publishes only what this install itself authored, never a+relay of another install's work.++**What is still to come is the wire transport** — the peer pull/inherit+protocol itself, tracked as the remainder of #7455. `recordEidoverseFoundationInheritance()`+is written and tested as the function that transport will call once it+exists; nothing in this install invokes it yet, so `baseline` in practice+still means "this install offered this foundation" until a transport starts+calling it.++ ### 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/services/cosToolRegistry.jsindex 7317cd8189,c536a5f41d..6c5941b6c2--- a/server/services/cosToolRegistry.js+++ b/server/services/cosToolRegistry.js@@@ -366,7 -368,9 +368,9 @@@ const eidoverseTravelTools =// is what makes the promote tool usable — a mind that cannot see which// foundations exist and why one is refused can only guess at ids.const eidoverseFoundationTools = [- ['foundations', 'List the world foundations this install authored — ownership layer (`vernacular` = local, `baseline` = promoted), the recorded agent-free assay outcome, and whether a gated promote candidate currently exists. Local style is never included.', z.object({}).strict(), ['manageEidoverse'], 'read'],+ ['foundations', 'List the world foundations this install authored or inherited from a peer — ownership layer (`vernacular` = local, `baseline` = promoted or an inherited copy), the recorded agent-free assay outcome, whether a gated promote candidate currently exists, provenance (opaque instance id and author kind, never a display name), any `inheritance` edge back to the peer it was pulled from, and the derived `lineage` (authored/inherited → assayed → packaged → promoted). Local style is never included.', z.object({}).strict(), ['manageEidoverse'], 'read'],+ ['contributions', 'List the resilience-assay contributions registered on this install — the ids a foundation\'s `contributionId` may bind to before it is promotable.', z.object({}).strict(), ['manageEidoverse'], 'read'],+ ['record', 'Record (or re-author) a local vernacular foundation — a durable, promotable creative build (a `schema`, `affordance`, `controller`, or `district-template`). It always lands on this install\'s local `vernacular` layer; the layer is not accepted from you and nothing crosses to a peer until eidoverse.promote is called separately. Use eidoverse.creative-catalog for material/motif/layout ids and eidoverse.contributions for a valid `contributionId` first. `style` (palette, motif, aliases) stays local forever; a cosmetic key found inside `body` refuses the write instead of being silently dropped.', eidoverseFoundationInputSchema, ['manageEidoverse'], 'write'],['promote', 'Offer one local foundation to the shared PortOS baseline population. The server re-runs the agent-free resilience assay and every promote gate itself, so this is a REQUEST, not an assertion: the result is `outcome: "promoted"` only when it published. Any other outcome means nothing moved — read `reasons` and fix those before asking again, and never narrate a refused promote as done.', eidoverseFoundationIdParamSchema, ['manageEidoverse', 'promoteEidoverseFoundations'], 'write'],].map(([operation, description, schema, requiredCapabilities, sideEffect]) => ({type: 'portos_tool', name: `eidoverse.${operation}`, version: COS_TOOL_SCHEMA_VERSION,