Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

`OverlaySystem`'s system-tree list has drifted from what the installers place, so five payload entries are never updated

Open mj-deving opened this issue 3 months ago • 1 comments

What LifeOS does here

Two tools own the two halves of the lifecycle, and each carries its own idea of which trees LifeOS owns.

skills/LifeOS/Tools/DeployCore.ts places the runtime on a fresh install. It enumerates the payload's install/LIFEOS/ directory and copies every top-level entry except a small skip set:

const RUNTIME_SKIP = new Set(["USER", "MEMORY", "node_modules", ".git"]);

skills/LifeOS/Tools/OverlaySystem.ts refreshes system-owned files on an update. It does not enumerate; it walks a hardcoded list:

const SYSTEM_TREES: Array<[string, string]> = [
  ["hooks", "hooks"], ["skills", "skills"], ["agents", "agents"],
  ["LIFEOS/TOOLS", "LIFEOS/TOOLS"], ["LIFEOS/DOCUMENTATION", "LIFEOS/DOCUMENTATION"],
  ["LIFEOS/ALGORITHM", "LIFEOS/ALGORITHM"], ["LIFEOS/RULES", "LIFEOS/RULES"],
  ["LIFEOS/PULSE", "LIFEOS/PULSE"],
];

Its comment states the intent plainly: "Anything not listed here is left alone — absence from this list is the safety property."

Current behavior

The v7.40.4 payload ships eight directories and four files at the top level of install/LIFEOS/. Neither USER nor MEMORY is among them — USER ships as install/USER and is handled by ScaffoldUser.ts, and MEMORY is not shipped at all — so RUNTIME_SKIP matches nothing here and DeployCore copies every entry.

Payload entry Installed by DeployCore Refreshed by OverlaySystem
ALGORITHM, DOCUMENTATION, PULSE, RULES, TOOLS yes yes
LIFEOS_SYSTEM_PROMPT.md, VERSION yes yes (explicit handling)
ATLAS (14 files) yes no
HERMES (12 files) yes no
USER_TEMPLATES (6 files) yes no
CORTEX_INDEX_POLICY.json yes no
LIFEOS_StatusLine.sh yes no

A fresh install therefore gets these five entries, and no update ever refreshes them. copyMissing adds files that are absent, so a later install pass can add a new file, but an existing file is never brought forward. The version marker advances regardless.

Reproduction

On an estate updated from v7.28.3 to v7.40.4 via the documented Workflows/Update.md path (OverlaySystem.ts --apply, then InstallHooks.ts, ScaffoldUser.ts, ActivateImports.ts), with LIFEOS/VERSION reading 7.40.4 and the overlay reporting 443 updated and 0 failures:

LIFEOS/ATLAS:  8 of 14 files still differ from the v7.40.4 payload
LIFEOS/HERMES: the 9 files v7.28.3 shipped are all still at v7.28.3, and the 3
               v7.40.4 adds (LogAnalysis.ts, Heartbeat/Tick.ts,
               Heartbeat/ArtistScan.ts) are absent entirely — the update path
               does not re-run DeployCore, so copyMissing never gets a chance
               to add them either

Impact

The failure is silent and version-skewed rather than loud. VERSION says the estate is current while parts of the runtime are one or more releases behind, so the skew widens with every update and nothing reports it.

HERMES is the sharper case because the tree is a security surface. LIFEOS/HERMES/Policy.ts generates the sidecar's guard policy and plugin/guard.py enforces it. Both stay behind together, so nothing becomes internally inconsistent — what happens instead is that every guard control added after the installed version simply never arrives, while VERSION says it has. An operator reading the shipped documentation for the release they believe they are running will describe protections their estate does not have.

To be clear about ownership: this is not about the Hermes application, which is a separate product with its own installer and its own update path. The files here are LifeOS's own, shipped in the LifeOS payload and placed by LifeOS's own installer. The same is true of ATLAS.

Affected versions

The mismatch exists in v7.40.4. OverlaySystem.ts was introduced after v7.28.3, so this dates from the tool's introduction.

Suggested direction

The safety property the comment describes — an explicit list, so an update cannot wander into user data — is worth keeping. What is missing is anything that notices when the list falls behind the payload.

The narrow fix is to add the missing entries. That leaves the same drift free to recur the next time a directory is added, and it is not sufficient for HERMES on its own — see below.

Deriving the list from the payload the way DeployCore does would close the drift, but it would also discard the property the comment names: a directory added in some future release would become overwriteable before anyone had classified who owns it. That is a real change to the ownership contract, not a refactor, so it should not be made silently.

The fix that closes the cause while keeping the allowlist is to make incompleteness loud. Enumerate the payload's top level, diff it against SYSTEM_TREES plus the explicitly handled files, and refuse the overlay with the unlisted names rather than skipping them. A newly added directory then blocks exactly one release, until someone decides whether it is system-owned, instead of rotting quietly across many.

Whichever is chosen, the top-level files need their own handling: overlayTree walks directories, so CORTEX_INDEX_POLICY.json and LIFEOS_StatusLine.sh have to join SYSTEM_FILES rather than the tree list.

The same drift exists one level up, at the payload root: SYSTEM_TREES lists hooks, skills, and agents, but not commands. Unlike ATLAS, commands is an opt-in component rather than part of the base runtime — Setup exposes it through DeployComponents.ts, which installs it with copyMissing, and the update workflow never re-runs it. So the seven shipped commands go stale on every installation that selected the component, and stay absent on the ones that did not.

That difference matters for the fix: commands cannot simply join an unconditional overlay, or an update would install a component the operator declined. It needs a conditional refresh keyed on the component already being present. A completeness check therefore has to cover the payload root as well as install/LIFEOS, and to distinguish base-runtime trees from opt-in components.

USER_TEMPLATES deserves a separate decision either way: it is scaffolding source rather than runtime, so it may belong to ScaffoldUser.ts instead of the overlay.

HERMES needs a remount, not just a fresher source tree

Adding LIFEOS/HERMES to SYSTEM_TREES refreshes the LifeOS-side source only. The plugin the sidecar actually enforces lives elsewhere: LIFEOS/HERMES/Mount.ts copies __init__.py, guard.py, and plugin.yaml into $HERMES_HOME/plugins/lifeos/ and writes the generated policy alongside them. The documented update workflow never runs Mount.ts.

So an overlay that covers the tree would advance LIFEOS/VERSION and freshen the source while an already-installed sidecar keeps enforcing the previous policy and the previous guard code — the same stale-controls outcome, now harder to notice because the source looks current.

Closing this needs the update path to re-run the mount for an installed sidecar, or the report's claim narrowed to source-tree freshness with the live gap stated outright. The first is better: without it, "LifeOS is updated" and "the guard enforcing my sidecar is updated" remain two different facts with one version marker between them.

mj-deving avatar Aug 22 '26 20:08 mj-deving

Landed: USER_TEMPLATES, CORTEX_INDEX_POLICY.json and LIFEOS_StatusLine.sh are in the overlay lists now (the last two with backup-first). ATLAS and HERMES were already there since 08-17. Next release. Thanks.

danielmiessler avatar Sep 03 '26 23:09 danielmiessler