Galaxy Shell / docs
Docs / Interface and features

Immutable base and overlay (spec, 2026-11-05)

openspec/specs/immutable-base/spec.md · Edit on GitHub ↗

On this page

Immutable base and overlay (spec, 2026-11-05)

Purpose

Lets the user replace whole files of the chat host through an approved overlay, with a safe mode and an automatic return to the stock interface, without touching the base. This spec holds the landed phases 0, 1, 2 and 5.

Requirements

Requirement: Overlay scope is the chat host only

Whole files under <profile>/overlay/ui-src SHALL replace the same path in vendor/interface/ui-src, and only the chat host script and stylesheet build from them. The core maps exactly /shadcn-host.js and /chat-host.css to the active build; the lock screen, recovery, the wallpaper, the protected panels (which link /shadcn-host.css), every other route, the core and the compositor stay in the base, as does ui-src/app.jsx (/trusted-ui.js). Full text: section Binding contract (from AGENTS.md).

Scenario: Request for the lock screen

  • WHEN a route other than the two host assets is requested while an overlay is active
  • THEN it is served from the base

Scenario: Conversation UI

  • WHEN /trusted-ui.js is requested while an overlay is active
  • THEN it is served from the base

Requirement: An overlay has the authority of the host

An overlay SHALL be treated as running with the whole authority of the host. The agent proposes one with change_propose and target overlay; only the user approves it in the protected card, whose fixed lines say so, and approval only records it. Full text: section Binding contract (from AGENTS.md).

Scenario: Agent proposes an overlay

  • WHEN the agent calls change_propose with target overlay
  • THEN a protected card waits for the user and nothing activates

Requirement: A build reads an export of the approved commit

A build SHALL read an export of the approved commit, never a worktree. Full text: section Binding contract (from AGENTS.md).

Scenario: Edit after approval

  • WHEN a file is edited in the worktree after approval
  • THEN the build does not read it

Requirement: Activation is a separate step

Activation SHALL be a separate step: the next start of the core or Aplicar agora in the protected settings, refused while anything is pending. A build that no chat document reports as mounted within 60 s goes back to the previous one, or the base if there is none. Full text: section Binding contract (from AGENTS.md).

Scenario: Build never mounts

  • WHEN no chat document reports the build as mounted within 60 s
  • THEN the core goes back to the previous build, or the base if there is none

Requirement: Safe mode flag and its writers

Safe mode SHALL be the flag <profile>/overlay/disabled.json, read on each request for the two routes. The core, the supervisor (third failure in 180 s), the key Super+Ctrl+Shift+R (input request overlay_safe_mode, capabilities.overlaySafeKey, nothing while locked), the GDM entry "Galaxy Shell (modo seguro)" and the recovery page button write it; only the user clears it in the protected settings, after the main process reported the reload. Full text: section Binding contract (from AGENTS.md).

Scenario: Safe key pressed

  • WHEN the user presses Super+Ctrl+Shift+R with an overlay active and the session unlocked
  • THEN the flag is written and the chat reloads from the base

Requirement: Overlay routes accept only protected callers

The routes /api/overlay/* SHALL take the shell token and /host-overlay-reload the host main key, so no agent tool, MCP entry, scheduled turn, generated HTML or plugin panel approves, activates or clears an overlay. Full text: section Binding contract (from AGENTS.md).

Scenario: Plugin calls overlay route

  • WHEN a plugin panel calls an /api/overlay route
  • THEN it has no token for it

Requirement: execute_command stays outside these rules

These rules SHALL bind agent tools and pages only: execute_command runs as the user and can write the overlay files, and the hash check at serve time catches accidents only. Full text: section Binding contract (from AGENTS.md).

Scenario: Agent writes a build by hand

  • WHEN execute_command writes a build and its active pointer
  • THEN no card is involved; this is the stated limit

Requirement: Invariants of the base and overlay

The lock screen, recovery, the protected panels and every route other than the two host assets MUST NOT load the overlay. A failed install, update or overlay build SHALL leave the running login and last good state in place, and recovery and updates MUST NOT touch the profile or delete the overlay. Full text: section Invariants.

Scenario: Hostile overlay active

  • WHEN a hostile overlay is active and recovery is requested
  • THEN recovery loads from the base

Requirement: The UI stays web and names stay

The UI SHALL stay web (Smithay gets no native recovery UI), and existing agent-native-os paths, AGENT_NATIVE_* names and river-shell profiles keep their names. Full text: section Invariants.

Scenario: Recovery page

  • WHEN the recovery page is shown
  • THEN it is a web page, not a compositor-drawn UI

Requirement: The build refuses unsafe overlays

The overlay build SHALL refuse anything outside ui-src, a link, a dot file, node_modules, a file other than .js, .jsx or .css, a name outside [A-Za-z0-9_.-], an import from outside the base, a bundle input outside the base (checked after the build), a Tailwind @plugin or @config, and a file the chat host does not reach. Full text: section Phase 5 as built (2026-11-05).

Scenario: Override of the lock screen

  • WHEN an overlay replaces a lock screen file
  • THEN the build fails with an explanation

Requirement: Service workers are refused

The core SHALL refuse a request with a Service-Worker header and the CSP MUST have worker-src 'none', so no worker can answer for /recovery or the protected panels. Full text: section Phase 5 as built (2026-11-05).

Scenario: Worker registration

  • WHEN a document tries to register a service worker
  • THEN the request is refused

Requirement: Reload and the safe-mode exit

Sair do modo seguro SHALL refuse until the Electron main process reports a generation once the documents that ran under the flag are gone, because that document holds the shell token and must not lift the flag itself. Full text: section Phase 5 as built (2026-11-05).

Scenario: Exit before the report

  • WHEN the user presses Sair do modo seguro before the reload is reported
  • THEN it refuses

Requirement: valid_release refuses a release directory

Since phase 2 valid_release SHALL refuse a directory with a manifest, so the sibling rollback does not run an old core on a new compositor. Full text: section Recovery.

Scenario: Release directory with a manifest

  • WHEN valid_release sees a directory with a manifest
  • THEN it refuses it and the supervisor keeps retrying

Status

Doc status: partly landed. Landed: phases 0, 1, 2 and 5 (overlay and safe mode) on 2026-11-05. Not landed: phases 3 (install without a toolchain) and 4 (updates). Checked 2026-11-12.

Introduction

Status: phases 0, 1 and 2 landed on 2026-11-05, after the owner chose the direction and said to go on ("pode seguir"). Phase 5, the overlay and the safe mode, landed the same day, ahead of 3 and 4, when the owner answered "Pode seguir com o overlay" to a proposal that named whole files and both ways into safe mode and said that installing still needs Node and Rust until phases 3 and 4. Phases 3 and 4 are still a proposal, so project-loading.md stays the contract of the login. The open questions at the end need the owner before their phases start.

The owner, on 2026-11-05, about a recovery copy made as a repository clone: "não teria como isso ser nativo em vez de precisar de um fallback como clone de repositorio? O usuário médio não vai alterar o compositor, só os arquivos que já tem copia no vendor e que ele pode sobreescrever via novos arquivos", and then "Sim, escrever a spec". Earlier in the same conversation, on why every user needs a way back: "o usuário vai querer modificar o sistema, essa é a filosofia do sistema".

What exists today

Checked against the code at 6046d0a.

  • Outside the checkout, so unable to break it: profile CSS through replace_ui with its journal and checkpoint, the profile color, themes in ~/.config/agent-native-os/themes and isolated panels in web-panels.json.
  • Not an overlay: ~/.local/share/agent-native-os/interface/ only holds links to the vendor/interface of the checkout. The core reads host files from path.join(root, "host", file) with nothing in front of it. The index.html and app.js of the profile are kept but do not run.
  • Already relocatable: the core derives root from import.meta.url, and session-supervisor.py and smithay-session.py use only paths under the root they receive. Neither runs Git, npm or Cargo. Only the active path of the dispatcher prepares a build, and the fallbackRoot path runs unprepared. system.js already returns no source when there is no .git.
  • Login code is not in the tree it starts. configure-project.py copies the dispatcher and the supervisors to dispatch/<id>/, and the login runs that copy. A new release alone therefore changes no supervisor behavior: that takes a new configure run.
  • Two rollbacks exist, and they differ. The dispatcher runs fallbackRoot once with a new compositor after a failure, unless the session is locked. Inside a running login, the supervisor moves host and core to lastGoodRelease after 3 failures in 180 s when that path is a sibling of its root, and keeps the compositor. Its mark_good updates that policy after 10 s of health.
  • Needs a checkout: change-proposals.js refuses a sourceRoot that is not a Git toplevel, and its gates run npm in web-shell/. project.json must hold exactly sourceRoot, fallbackRoot, profile and buildEnv, and older dispatchers refuse any other key.
  • Tied to the tree layout: the supervisor runs web-shell/node_modules/electron/dist/electron, and local-model.js reads ../../runtime/liquid/ and ../../scripts/local-model-server.py.

The earlier release installer was dropped on purpose: on 2026-10-27 the owner chose to load the active tree from the home directory, and AGENTS.md says not to copy the whole application on each update. This spec keeps that model for whoever develops the system, and adds a base for everyone else. Phase 2 needs that rule of AGENTS.md rewritten when it lands.

The model

Recovery removes the layers above the base.

Layer Holds Who changes it Without it
Profile Conversations, settings, CSS, themes, panels User and agent, as today Not applicable
Overlay Replaced source files of the host document User approval in the card The stock interface runs
Dev checkout Everything, as a Git tree (optional) Whoever opts in The base runs
Base Compositor, core, host, Electron, OpenCode Installer and updates only The previous base runs

The profile is never removed by recovery, so a corrupt profile is outside what this design fixes. The checkpoints and journal of core/changes.js still cover it as they do today.

The base

A compiled, read-only directory, with no Git and no toolchain needed at run time: ${XDG_DATA_HOME:-~/.local/share}/agent-native-os/releases/<version>/. The name keeps the compatibility rule of naming.md.

It keeps the layout of a checkout, native/smithay/target/release/agent-native-compositor, scripts/, web-shell/ and runtime/, so the code above runs unchanged. It also carries manifest.json, with the version, the commit and the size and SHA-256 of each file.

Measured on 2026-11-05: 865 MB, built in 13 s from a prepared checkout, against 2.5 GB and 4 min 16 s for the clone. Electron takes 274 MB, OpenCode 230 MB and the other packages about 340 MB. react, lucide-react, react-aria and the other libraries that are already bundled into vendor/interface/host stay out: the builder copies only what RUNTIME_PACKAGES reaches through the lockfile, from the prepared node_modules, with no network and no npm ci. A test fails when the imports of the core leave that list. Electron is a development dependency, so the builder adds its executable without the packages that only install it.

The Liquid runtime (752 MB) lives in agent-native-os/liquid/<manifest hash>/, as hard links to the copy of the checkout when the filesystem allows it, so that no version repeats it. runtime/liquid in the release is a relative link to it, and local-model.js needs no change. A checkout without Liquid builds a release without a local model, with a warning.

What read-only means. File modes and the manifest stop accidents, not intent. In the default location the agent runs as the same user as the base, so execute_command can change or delete it, and can change a manifest kept in the same directory. See open question 1.

The compositor links dynamically to libinput.so.10, libseat, libgbm, libwacom and others, so a binary release is tied to a distribution ABI. See open question 3.

The overlay

This is what the owner described: new files that replace copies in vendor/interface.

Scope: the host document only. <profile>/overlay/ui-src/ mirrors the paths of vendor/interface/ui-src, and only the entry of shadcn-host builds from it. That is the chat, the composer, settings and the bars. The lock screen, recovery, the wallpaper and the protected panel entries (tray menu, quick settings, screenshot, workspace menu, window size) always come from the base. Their boundaries in AGENTS.md stay as they are. The core, the compositor and the scripts are out of scope, and changing them needs the dev checkout.

Build. compileShadcnHost() emits every bundle at once, and ui/button.jsx is shared with recovery and the lock screen, so the overlay build must not reuse it as is. A new entry compiles only the chat script and its stylesheet, with imports resolved in the overlay first and then in the base, and Tailwind @import and @source limited to those two trees. Output goes to <profile>/overlay/build/<base version>-<tree hash>/. The base ships esbuild, the Tailwind compiler and the UI libraries the build needs, and runs them as a child process with the Electron of the base as Node, so the machine needs no Node or Rust of its own. Phase 1 must prove that the native modules of that compiler load this way.

Serving. Seven protected panel pages link /shadcn-host.css too, and a request does not say which page sent it. So the chat document gets its own stylesheet route, /chat-host.css, and the panels keep theirs. index.html is the only page that loads /shadcn-host.js. The core maps exactly /shadcn-host.js and /chat-host.css to the active build, while /shadcn-host.css, /theme.css, /recovery, the lock screen and every other route read the base. The guarantee that recovery and the panels never load the overlay lives in this route rule, and needs a test that asks for each route with a hostile overlay active.

Authority: the hard part. The host document compiles composer.jsx, settings.jsx, approvals.jsx, change-review.jsx and bars.jsx into one script, and that document holds the shell token. An overlay therefore has the whole authority of the host: it can draw any dialog, including the next review card, and call any route that the token opens, including the approval of a pending action. Refusing paths such as approvals.jsx does not change that, and is only a guard against mistakes. So:

  1. The approval of an overlay is the gate, and it grants the authority of the host. The agent proposes and the user approves in the protected card, as with a source change. The card adds a fixed line, computed by the core and never from agent text, that says the overlay runs with the authority of the host, and it marks each changed file that the host treats as protected. After one approval, later cards are only as trustworthy as that overlay. The same is true today of an approved source change.
  2. Activation is a separate press. Approval only records the overlay. It runs at the next login, or at a host reload that the user asks for in the protected host, refused while a turn, approval, preview, model switch or login is pending. The agent cannot ask for the reload, so the rule of AGENTS.md that approval never restarts anything holds, and the conversation survives the reload as it must today.
  3. Base pages stay reachable and can turn it off. The recovery page has its own bundle from the base and lists the active overlay with a button that turns it off. A bad overlay cannot remove this page or the GDM entry of safe mode.
  4. Generated HTML and isolated panels stay in their opaque iframes and reach no overlay route.
  5. What this does not bind. These rules bind the agent tools, MCP entries, scheduled turns, generated HTML and plugin panels. The overlay directory belongs to the user that execute_command runs as, so an agent can write a build and its active pointer with no card, as self-maintenance.md already says for every consent flow. The hash check at serve time detects accidents only. Moving them to a location that the user cannot write is open question 1.

Reusing the card. The overlay is a small Git repository, so change-proposals.js keeps its worktree, diff and tree hash, with the overlay as its repository. Three things differ from a source change. The gates become the overlay build plus the checks that ship in the base, which are fewer than the tests of a checkout, and the card has to say so. The refusal of unknown ignored files applies with an empty list of what a preparer may leave. The lock is the per-profile lock of core/changes.js, since this changes a profile and not the checkout, so coordination.lock does not apply.

Failed activation. The host reports that it mounted within a time limit. Otherwise the core restores the previous build through the journal and checkpoint of core/changes.js, as the CSS flow does.

Other effects. Translucent pixels in the chat window become compositor glass, so overlay CSS follows css-structure.md, section Alpha in the chat window, as profile CSS does.

A new base under an old overlay. A replaced file is a whole copy, so it silently hides later fixes to that file. The overlay records the base hash of each file it replaces. At an update the core rebuilds it; if the build fails, the overlay turns off with a visible notice in the protected host and its files stay. A replaced file whose base changed gets a warning in the card.

Recovery

Safe mode needs no second copy: it is the same base without the overlay. Its one signal is a flag file, <profile>/overlay/disabled.json, that the core checks on each request for the two host assets, so that it serves the base and a reload is enough. An environment variable would not work, because the supervisor environment is fixed at login and the dispatcher takes no arguments. Who writes the flag:

  • The supervisor, on the third host or core failure in 180 s while an overlay is active and the flag is absent. It writes the flag, clears its failure count and restarts host and core, leaving the compositor alone. This check runs before any release rollback, and is new code, so it ships in phase 5 with a new configure run. A hung core takes up to 60 s per failure and can miss that window, but an overlay runs in the renderer, and a hung renderer is the blank row of the table below.
  • A second GDM entry, a wrapper that writes the flag and then starts the same dispatcher.
  • A compositor key (open question 2), sent as an input request like new_chat. The core writes the flag and asks the host to reload. It does nothing while locked. It needs a visible counterpart in the recovery page, by the discoverability rule of AGENTS.md. The compositor draws nothing, and the UI stays web.
  • The core, when the update rebuild fails, and at the recovery page button.

Only the user clears the flag, in the protected settings. An agent that writes the flag only turns an overlay off. One that deletes it is the execute_command case above.

Failure Detected by Result
Bad profile CSS Existing journal Previous CSS (as today)
Overlay crashes the host Supervisor: 3 failures in 180 s Flag, host and core restart with the base
Overlay renders blank but stays up Only the user Key or GDM entry: the flag
Bad update, unlocked Failed login, or repeated crash The previous release, whole stack, once
Bad dev checkout, unlocked Failed preparation or exit The base, whole stack, once
Any failure that exits, while locked Existing lock marker Ends at the login screen, with no fallback
Base altered, no manifest match Dispatcher, at login The previous release, else login screen

One rollback between releases. The sibling rollback of the supervisor would run an old core on a new compositor, a pair nobody tested and the skew that scripts/check-host-skew.py exists to refuse, and the dispatcher would never see a failure. With releases as siblings it would trigger. So since phase 2 valid_release refuses a directory with a manifest, and the supervisor keeps retrying. From phase 3 it exits with failure in this case, and the dispatcher runs the previous release with its own compositor. This costs the open windows, which a broken session has already put at risk, in exchange for only running pairs that shipped together. The rollback of the supervisor between plain sibling checkouts stays as it is.

Which release runs. A new dispatcher reads releases/state.json with current, previous and pending, and it alone writes that file. An installed update is pending, and the dispatcher marks it as tried before it starts it, so that a crash or power loss during the login cannot retry it forever. A thread of the dispatcher watches the supervisor state during supervisor.run, and promotes the release to current after a validated login: core ready, compositor connected and no restart for two minutes. mark_good keeps its own policy and does not take part in this. The update installs its login copy before the first try, never at promotion, because an older supervisor copy would otherwise run the sibling rollback on that try. That copy must also run the previous release. The promotion of a release does not relax the rule against promoting a mutable checkout, because a release is built once and does not change.

The dispatcher is the one piece with no fallback of its own. A release cannot fix a broken copy of it, so its no-sourceRoot path needs its own tests, and previous-login/ keeps what it replaces. Restoring that is a manual copy today, which phase 3 documents, and an older dispatcher refuses the new keys.

Checking the manifest at login. The dispatcher compares file sizes, and the hashes of the compositor and the core entry, which keeps the login fast. A full hash runs before promotion and at install.

Without a previous release. After the first install there is only one base. An overlay failure is still fully covered, because that needs no second copy. A failure of the base itself returns to the login screen until the first update exists. A failed install leaves the current login untouched.

Older code on a newer profile. A rollback runs an older core on a profile that a newer one wrote, and the same risk exists today with the fallback of 2026-10-31. changes.json and web-panels.json refuse a newer version, which is a clear failure, but it also means that a version bump blocks the rollback. So between the two kept releases their formats stay readable by the older one, or the bump ships with a tested downgrade step. Phase 0 audits the other profile files. A base must also be recent enough to know the lock marker.

The dev checkout

Everything that works today keeps working for whoever opts in: sourceRoot becomes optional. With it, the login prepares and runs the checkout, and the review card applies to it as it does today. A failure runs the base instead of a clone. This keeps the philosophy of AGENTS.md, in which the agent can evolve the host, the core and Smithay. In base mode the agent says that such a change needs the dev checkout and offers to set it up, which installs a toolchain and needs the user to accept.

While a base recovers a dev login, AGENT_NATIVE_SOURCE_ROOT still names the failed checkout, as it does with a clone today, so maintenance can repair it from there. system_context already reports runtimeRoot and sourceRoot separately.

Invariants

  • The lock screen, recovery, the protected panels and every route other than the two host assets never load the overlay.
  • No agent tool, MCP entry, scheduled turn, generated HTML or plugin panel approves or activates an overlay. See the limit on execute_command above.
  • A failed install, update or overlay build leaves the running login and the last good state in place.
  • Recovery and updates never touch the profile, and never delete the overlay.
  • The UI stays web. Smithay gets no native recovery UI.
  • Existing agent-native-os paths, AGENT_NATIVE_* names and river-shell profiles keep their names.

Phase 5 as built (2026-11-05)

The code is web-shell/core/overlay.js, compileOverlayHost in web-shell/scripts/build-shadcn-host.js, the overlay target of web-shell/core/change-proposals.js and ui-src/host/overlay-status.js.

  • State. <profile>/overlay/ is a small Git repository with the approved files under ui-src/. It excludes build/, state.json and disabled.json. state.json holds active, previous, pending, the base hash per replaced file and the last failure. A record that cannot be read leaves the base and the original file.
  • The agent. change_propose takes target: "overlay". There is one open proposal and one card, source or overlay. The check is the gate overlay-build, which runs no file of the proposal. Ignored files refuse with an empty allowlist. An approval needs the head of the repository to be the commit the record names, a line of commits with no merge from there, and the base of the submission, so a commit made by hand, a merge and a base that moved under the open card all refuse it. The last two send the card back to editing, so it stops offering the button and the agent gets the reason.
  • The diff of the card. The agent copies a whole file to change one line, so against the repository of the overlay a first override is all new lines, and a hostile line hides among a thousand trusted ones. The card compares a first override with the file of the base that it replaces, in the patch and in the counts of its row, and says so. A later version keeps the diff against the version the user approved. A first override whose diff passes the limit refuses approval, as any other diff does.
  • The bytes. A build never reads a worktree or the working files of the repository: exportTree writes the approved commit to a private directory first, also for the rebuild on a new base. An edit after the check of the tree cannot reach a build, and an edit by hand in the repository changes nothing. The export sets core.autocrlf and core.attributesFile, so the usual settings of the user do not change the bytes.
  • The build refuses: anything outside ui-src/ (a build reads an export or a worktree, so nothing else belongs there), a link, a dot file, node_modules, a file other than .js, .jsx or .css, a name outside [A-Za-z0-9_.-], an import from outside the base by a relative path, an absolute path or a package name with a parent segment, an input of the bundle outside the base (checked after the build, as the last word), a Tailwind @plugin or @config (they run code at build time), and a file the chat host does not reach, so an override of the lock screen fails with an explanation and does not silently do nothing. A replaced file has one name, the file that the base resolves to, so an alias cannot pass under a name the card does not recognize. An empty overlay gives the bytes of the committed host, and the release builder checks that with the Electron of the release.
  • Scope, narrower than "the chat" in one way. ui-src/app.jsx compiles to /trusted-ui.js, the conversation UI. It stays out of the overlay, as the routes above say: the stylesheet of the conversation is the style.css of the profile, through replace_ui.
  • Activation. Approval records pending. It runs at the next start of the core or at "Aplicar agora" in the settings, which refuses while a turn, approval, preview, model switch or login is pending. A start of the core also happens in the host and core maintenance of AGENTS.md, so "the next login" is really "the next start of the core"; no agent tool can start one.
  • Reload. The core has no channel to a broken document, so the Electron main process polls /host-overlay-reload, with the host main key, every 2 s and reloads every window opened on a route of the chat host, marked when it is created and not read from its document, which can change its own URL (core/force-reload.cjs), past any beforeunload. A window whose URL changed loads its address instead of reloading. A window that has not navigated after 3 s loses its renderer and reloads after the renderer is gone, so a document that hangs or blocks its thread cannot stay. A normal reload keeps its renderer, since windows of a partition can share one. The wallpaper and the panels never reload for this. A second press of the key or the button reloads again. The main process reports a generation once each of those documents is gone, and until then "Sair do modo seguro" refuses: the document that ran under the flag holds the token of the shell and must not lift the flag itself. A failed poll only delays that press.
  • Service workers. The core refuses a request with a Service-Worker header and the CSP has worker-src 'none': a worker registered from /shadcn-host.js would have scope / and could answer for /recovery and the protected panels. No document of the shell uses a worker.
  • Trial. A new build is unconfirmed. host.js of the base posts /api/overlay/mounted from a chat document after the chat script ran, the module reached its end and the trusted UI of /trusted-ui.js loaded and rendered (since 2026-11-06): the runtime has Motion, app.js reached its last statement, and no error reached the window during that load, so a real but unrelated error in that moment also sends the build back. A build that renders a wrong or empty page without an error still counts as mounted, the post has no retry, and one healthy chat document confirms for the others, also where another chat failed (test/overlay-mount-report.test.js). The window listener starts with host.js, so a composer or another root of /shadcn-host.js that throws in its own render before that also counts as mounted: the safe mode key and the recovery page stay the way out. Without that report 60 s after the first serve, the core restores the previous build through the journal, or the base if there is none, and asks for the reload. If the journal is busy it writes the flag. Without a newer approved version the repository goes back too, so a later proposal does not carry the failed files unseen; they stay on the branch last-failed. Only a build that mounted becomes the way back. A rebuild of the same files on a new base has no earlier version to go to, so its failure writes the flag and the files stay.
  • New base. The version is a hash of the committed chat script, its stylesheet and the build script, cached by file times. A build of another version is not served, at once, also under a core that runs while the checkout moves. The next start of the core rebuilds from the approved commit, waiting up to 30 s and killing the build after that, and a failure or a commit that is not what the record says writes the flag. "Sair do modo seguro" rebuilds too, and leaves an approved version waiting for its own press. A base hash that changed shows in the settings and in the card.
  • The key is Super+Ctrl+Shift+R, kept apart from Super+Escape, which ends the session. The compositor reports capabilities.overlaySafeKey. It does nothing when no overlay is active. Its visible counterpart is the button of the recovery page, which names the key.
  • The GDM entry needs both scripts/install.sh (the dispatcher that reads its variable is a copy made at install) and sudo scripts/register-smithay-session.sh. An older dispatcher ignores the variable.
  • Writers of the flag. The core writes it for user, key, update-build-failed, tree-changed and trial-failed, the supervisor for supervisor and the dispatcher for login-entry. Any entry at that path turns the overlay off, whatever it holds.
  • Release. A release now ships ui-src, the two build scripts, esbuild, Tailwind and the UI libraries. The release of 2026-11-05 measured 1.1 GB, up from 865 MB, and its smoke check proved with its own Electron that an empty overlay gives the committed bytes.
  • Known limits, accepted as LOW. The base version hashes the committed bundle and not the working ui-src, so uncommitted work in the active checkout enters a build (the release check covers a clean tree). A GET of the two routes needs no launch cookie, like the rest of the base, so a local process can read an overlay and start a trial early, at worst an early rollback. The mounted report names no build, so a document that loaded just before an activation can confirm the next build. An older dispatcher ignores the safe entry and the login screen cannot show it. A renderer that crashes counts for no supervisor failure, so a confirmed overlay that crashes needs the key. After a rollback a file keeps the base hash of the failed approval, so a base change between the two approvals shows no warning. The wait of "Sair do modo seguro" belongs to the Electron host, so a browser against a synthetic core never passes it. The core and the host end together (child.on("exit") in desktop.cjs), so a new core has no document of before to wait for, and a flag that the start of the core writes makes the new host reload once and report it. A request that a dying document queued with keepalive might reach the core after that report and lift the flag (not measured, and the key raises it again). A reload also runs on the recovery page, which stays there and reads its state again, so a message of the page can go after about 2 s; a document that only wrote the address /recovery becomes the real page, and the native menu leads back. A window whose address differs only in the fragment waits the 3 s and ends its renderer. Ending a renderer could take a panel that shares it, which then stays dead until it is reopened; the reload after 3 s can also hit a slow but healthy document, and then costs one more reload. A generation whose renderer ends without the event stays unreported, so "Sair do modo seguro" refuses until the next press of the key.

Proofs. Nested, with the Electron host and synthetic data (no provider, one output): an override reached the composer at the first start; Super+Ctrl+Shift+R wrote the flag and the chat reloaded from the base with no other input; the settings showed the safe mode, its reason and the files, and "Sair do modo seguro" brought the override back with a reload; a composer that throws at load showed the error of the host, and 60 s later the core had restored the base and the windows had reloaded on their own. After the reviews the script and the stylesheet of an override reached the chat and both bars in the Electron host, with the normal styling, through the safe key, the settings and back. An override that starts with while (true) {} hung the chat and both bars on their first load, and came back to the normal desktop both from the safe key and on its own when the trial ended, with the renderers replaced. In test/overlay-http.test.js, a core with a hostile active build serves it only on the two routes. Not proved: the card and "Aplicar agora" in a real window, the recovery page button in a real window (browser-less tests only), the supervisor and the GDM entry on a real login, and a real provider driving the agent side.

Binding contract (from AGENTS.md)

This section holds, word for word, the rule that AGENTS.md kept for this feature until 2026-11-10, when AGENTS.md was reduced to the short invariants (openspec/changes/audit-2026-11-10/design.md, F10). It binds exactly as AGENTS.md does; AGENTS.md keeps the short invariant and points here. Change both in the same commit.

  • Overlay of the chat host (openspec/specs/immutable-base/spec.md, The overlay and Phase 5 as built; since 2026-11-05): whole files under <profile>/overlay/ui-src replace the file of the same path in vendor/interface/ui-src, and only the script and the stylesheet of the chat host build from them. The core maps exactly /shadcn-host.js and /chat-host.css to the active build; the lock screen, recovery, the wallpaper, the protected panels (which link /shadcn-host.css), every other route, the core, the compositor and the scripts stay in the base. An overlay runs with the whole authority of the host. The agent proposes one with change_propose and target: "overlay"; only the user approves it in the protected card, whose fixed lines say so, and approval only records it. A build reads an export of the approved commit, never a worktree. Activation is a separate step: the next start of the core or "Aplicar agora" in the protected settings, refused while anything is pending. A build that no chat document reports as mounted within 60 s goes back to the previous one. Safe mode is the flag <profile>/overlay/disabled.json, read on each request for the two routes; the core, the supervisor (third failure in 180 s, before any release rollback), the compositor key Super+Ctrl+Shift+R (input request overlay_safe_mode, capabilities.overlaySafeKey, nothing while locked), the GDM entry "Galaxy Shell (modo seguro)" and the button of the recovery page write it, and only the user clears it in the protected settings, after the Electron main process reported the reload of the document that ran under the flag. The routes /api/overlay/* take the shell token and /host-overlay-reload the host main key, so no agent tool, MCP entry, scheduled turn, generated HTML or plugin panel approves, activates or clears. execute_command runs as the user and can write these files; the hash check at serve time only catches accidents.