Self-maintenance of the shell through conversation
Purpose
Lets the shell AI inspect, operate and evolve its own environment with the privileges of the user, with product source changes reviewed by the user through a protected review card.
Requirements
Requirement: Source changes go through the review card
Changes to the product sources SHALL go through the review card: the agent uses change_propose, edits only the proposal worktree, and change_submit runs the gates there; these actions MUST NOT be given to generated HTML. Full text: section Binding contract (from AGENTS.md).
Scenario: Agent changes the product
- WHEN the agent wants to change product sources
- THEN it proposes with change_propose, edits only the worktree and submits with change_submit
Requirement: Only the user approves in the protected card
Only the user SHALL approve, in the protected host card, a manual popover in the top layer over a slot of the composer footer, opaque with the fixed colors of the approval dialogs, whose buttons do not move through the pinned offset and stay in its footer, and which hides while a modal dialog of the host is open. Profile CSS can still restyle what is around the card. Full text: section Protected host card.
Scenario: Profile CSS applied
- WHEN profile CSS is applied with no click
- THEN it cannot cover the card or move its buttons
Scenario: Approval dialog opens
- WHEN an approval dialog opens while the card shows
- THEN the card hides and shows again when the dialog closes
Requirement: Approve button arming
The approve button SHALL arm 1.5 s after the card really shows with the whole button in the card and in one place; a move or a cancelled discard SHALL start the delay over. Full text: section Binding contract (from AGENTS.md).
Scenario: Window moves
- WHEN the chat window or the button moves
- THEN the delay starts over
Scenario: Slot leaves the view
- WHEN a scroll or a clip of the page takes the slot of the card out of view
- THEN the card closes, the button disarms, and the delay starts over when the slot is in view again
Requirement: Gates prove no safety
The gates run code of the proposal, so green proves no safety, and the core SHALL refuse them while the worktree holds ignored files that the preparer did not leave or a new embedded repository. Full text: section Binding contract (from AGENTS.md).
Scenario: Ignored file in the worktree
- WHEN the worktree holds an ignored file the preparer did not leave
- THEN the core refuses to run the gates
Requirement: Agent text comes after the facts
The agent text SHALL come after the facts of the card, labeled, in at most four lines until a press, and every proposal string SHALL show invisible characters as markers. Full text: section Binding contract (from AGENTS.md).
Scenario: Long summary
- WHEN the summary has more than four lines
- THEN it shows four lines until the user presses Mostrar tudo
Requirement: Fixed lines come from the core
Fixed lines computed by the core and the host, never from agent text, SHALL say when the tree changed under the open card and when the proposal changes its own checks. Full text: section Binding contract (from AGENTS.md).
Scenario: Tree changes
- WHEN the tree hash changes while the card is open
- THEN the fixed line "Alterada depois da última submissão" appears
Requirement: Approval is a local fast-forward
Approval SHALL fast-forward the clean active checkout under coordination.lock and take effect at the next login; it MUST NOT push and MUST NOT restart anything. Full text: section Binding contract (from AGENTS.md).
Scenario: Approved
- WHEN the user approves a proposal
- THEN the checkout fast-forwards and nothing is pushed or restarted
Requirement: Each execute_command call needs approval
Each execute_command call SHALL wait for the approval of the user in the host, and a refusal SHALL cancel the turn. Full text: section Introduction.
Scenario: Refusal
- WHEN the user refuses a tool request
- THEN the turn is cancelled
Requirement: Approval dialog arming and queue
Only one approval dialog SHALL be open at a time, "Permitir uma vez" SHALL arm 1.5 s after a new request appears, and until it arms Enter and Space MUST do nothing on both buttons while Esc stays an immediate refusal. Full text: section The tool approval dialog (2026-10-31).
Scenario: Key before arming
- WHEN Enter is pressed before the allow button arms
- THEN nothing happens
Requirement: Approval route is exact
/api/approve SHALL take exactly {id, allow} and refuse an id that is not in the queue, and the core SHALL remove the request before it answers OpenCode so a second click cannot answer it again. Full text: section The tool approval dialog (2026-10-31).
Scenario: Unknown id
- WHEN /api/approve receives an id not in the queue
- THEN it is refused
Requirement: Approval queue is host only
Only the protected host SHALL read the approval queue, through /api/state; the trusted React state and generated HTML iframes MUST NOT receive it. Full text: section The tool approval dialog (2026-10-31).
Scenario: Generated HTML
- WHEN a generated HTML iframe asks for state
- THEN it does not receive the approval queue
Requirement: Launch key stays out of jobs
The launch key SHALL be passed on an inherited socket (file descriptor 3) and the core SHALL close the descriptor and remove both variables before it starts any child, so jobs do not see the key; the host main key opens only the window declaration routes and MUST NOT go into a cookie, URL, log, renderer or environment. Full text: section The launch key does not reach the jobs (2026-10-31).
Scenario: Job reads the environment
- WHEN an execute_command job reads the core environment and descriptors
- THEN the launch key and the host main key are not there
Requirement: Consent flows are advisory against a job
A job SHALL run as the user, so the consent flows bind the agent tools, the protected host and generated HTML but are advisory against an agent that a prompt injection steers into execute_command; a job can lock but cannot unlock or register another lock host on the control socket while the host process lives. Full text: section What a job can still reach.
Scenario: Steered agent
- WHEN a prompt injection steers the agent into execute_command
- THEN the consent flows are advisory and the protection is the review of its actions
Requirement: No claim of recovery without confirmation
The AI MUST NOT claim recovery if it only started a process, and before it replaces the host or the core it SHALL persist the plan and the previous release, confirm no other response is in progress and prepare independent supervision with rollback. Full text: section What a job can still reach.
Scenario: Core restarted
- WHEN the AI started a new core process
- THEN it confirms the runtime and the continuity of the conversations before it claims recovery
Requirement: Profile UI edits are CSS only
The legacy index.html and app.js of the profile MUST NOT be loaded or editable by replace_ui, and authenticated maintenance SHALL change the trusted sources instead of copying code from the profile. Full text: section Trusted React UI of the host.
Scenario: Profile app.js
- WHEN a profile has a customized app.js
- THEN it is not loaded
Requirement: Desktop capture tool
Generated HTML MUST NOT receive the desktop capture tool, and browser pixels MUST NOT be presented as a desktop capture. Full text: section Smithay desktop capture.
Scenario: Generated HTML asks
- WHEN generated HTML asks for a desktop capture
- THEN it does not receive the tool
Requirement: Proposal worktree rules
change_propose SHALL create the worktree in the profile directory, never in /tmp, with at most one proposal open per profile, and the gates SHALL run in a fixed order stopping at the first failure, under a memory limit; with no limiter they SHALL fail and never run unlimited. Full text: section Source change review card.
Scenario: No limiter available
- WHEN neither heavy-run nor systemd-run is available
- THEN the gates fail with an explicit message
Requirement: Approve only the reviewed tree
If the files change while the gates run, or after they finish, the result SHALL be void and the state SHALL go back to editing; approval SHALL commit exactly the tree that was tested, checked by tree hash. Full text: section Source change review card.
Scenario: Files change
- WHEN files change after the gates finish
- THEN the result is void and the agent must submit again
Requirement: Card needs an explicit press
Only a press on a button of the card SHALL call approve or discard; a failing, skipped or unfinished gate, or a diff larger than 1 MiB, SHALL disable the approve button, and there MUST be no MCP tool to approve or discard. Full text: section Protected host card.
Scenario: Failing gate
- WHEN a gate fails
- THEN the card still shows but the approve button is disabled with the reason
Requirement: Approval checks the real state
Approval SHALL take coordination.lock with a non-blocking flock, refuse when the lock is busy, and require the active checkout to be on the recorded branch and HEAD and clean; any refusal SHALL keep the worktree and the branch and show the reason. Full text: section Approval.
Scenario: Dirty checkout
- WHEN the active checkout has untracked files
- THEN approval is refused with the reason dirty-source-root
Requirement: Discard needs confirmation
Discard SHALL need confirm: true and SHALL be refused while the gates run. Full text: section Discard.
Scenario: Discard during gates
- WHEN discard is requested while the gates run
- THEN it is refused
Requirement: Scheduled intents need approval
The protected host SHALL approve each schedule_create, schedule_update and schedule_delete, and a scheduled turn MUST NOT change schedules or approve a tool by itself. Full text: section Scheduled intents.
Scenario: Scheduled turn
- WHEN a scheduled turn tries to change a schedule
- THEN it cannot
Requirement: Skew checks stop the plan
Before a host and core restart or rollback, the check-host-skew.py result SHALL be followed: exit 1 (refused) and exit 2 (could not run) MUST be treated as a stop. Full text: section Window layers phase 4 capability checks.
Scenario: Exit 1
- WHEN check-host-skew.py exits 1
- THEN the plan stops
Requirement: Turn Canvas off before a rollback
Before the core or the compositor is rolled back across Canvas phase 3, the protected setting canvas SHALL be turned off so every Canvas workspace returns to Grid. Full text: section Canvas rollback order.
Scenario: Rollback planned
- WHEN the core is about to be rolled back
- THEN canvas is turned off first
Requirement: Launch key environment fallback
AGENT_NATIVE_LAUNCH_KEY SHALL stay as the fallback for older launchers and synthetic tests; with it the key is again in /proc/<core pid>/environ. Full text: section The launch key does not reach the jobs (2026-10-31).
Scenario: Fallback launcher
- WHEN an older launcher or a synthetic test passes
AGENT_NATIVE_LAUNCH_KEY - THEN the key is again in
/proc/<core pid>/environ
Requirement: Exceptions to the lock protection against a job
The lock exception on the control socket SHALL NOT hold on older hosts whose inspector stays open, where code that a job evaluates inside the host keeps its authority. A job that kills the host can still name the core as the host in the gap before the new host registers and then send unlock, and a job that kills the core can end the lock authority. Full text: section What a job can still reach.
Scenario: Job kills the host
- WHEN a job kills the host
- THEN it can name the core as the host in the gap before the new host registers, and then send
unlock
Status
Doc status: current contract. Self-maintenance tools and the source change review card; some descriptions keep earlier decisions (River) as history. Checked 2026-11-10.
Introduction
Implementation update: River was removed from the product. Login can now load the active checkout in the home directory, with build preparation and independent Smithay recovery. See the current loading and recovery contract. The descriptions below keep earlier decisions and evidence; old releases can remain as known-good recovery, without bringing a River backend back into the product.
The shell AI operates and can evolve its own environment with the privileges of the user. The capability does not depend on opening the ChatGPT application or on instructions copied from another chat.
system_context identifies the running release, PID, profile, configured checkout, current recovery address, Smithay compositor connection, change journal and IDs of recent commands. The prompt receives the profile path automatically and tells the agent to check the current state before maintenance. It does not include credentials or an indiscriminate copy of the environment.
execute_command starts any executable with separate arguments and working directory, without depending on the compositor. It can read and edit sources, inspect processes and logs, run tests, build, install releases and prepare recovery. Use /bin/sh with -c explicitly when you need shell syntax. command_status reads the output and status by the persisted ID. The default is to wait up to one second and to limit the execution to two minutes; wait_ms accepts up to ten seconds and timeout_ms up to one hour. The result tells apart a running process, a launch failure, output, a signal and a timeout. Each of the two outputs keeps a tail limited to 32 KiB and carries a truncation flag. Since 2026-10-31, each execute_command call waits for the approval of the user in the host, because pages that the agent's browser opens can inject instructions; a refusal cancels the turn.
The tool approval dialog (2026-10-31)
The core keeps each OpenCode permission.asked event of the live turn in the conversation field approval: null, or a queue of {id, tool, resources, input, message?} in arrival order. For an MCP tool, OpenCode 2.1.4 sends the tool name in action, resources: ["*"] and the call arguments in metadata.input; the core keeps input as given. OpenCode 2.1.4 does not apply ask rules to plugin tools, so our plugin web-shell/core/memory-plugin/index.js registers tool.hook("execute.before") and calls assertNoteApproval (core/memory-plugin.js). It asserts memory_add_note with the same shape, with the note in metadata.input, so the dialog shows the full note text. Only the protected host reads the queue, through /api/state. The trusted React state (window.shell.onState) and the generated HTML iframes never receive it, and core/state-response.js sends it to the host in conversationMetadata. The core resets approval to null at startup, and also when the runtime stops (OpenCode exits or its event stream fails) or the send of the turn fails, because no turn is left to take an answer. The host opens the dialog only for a conversation that is busy.
The host shows the first request in a modal <dialog> (showModal()) of the host document, outside the ShadowRoot. The dialog is in the top layer and makes the rest of the page inert, so profile CSS from replace_ui cannot cover it or take its clicks, and its colors are fixed light/dark pairs that no profile or wallpaper palette changes. It shows the action, the tool name, the conversation (its label, cut at 60 characters with an ellipsis), every argument and an optional OpenCode message as plain text, wrapped. Since HeroUI phase 8 React renders the content inside the native dialog (ui-src/host/approvals.jsx, store host/approval-state.js), and every model string is a React text child, never markup; host.js still opens the dialog, arms the button, moves the focus and calls the route. The arguments come first, in a scrollable list. The message is untrusted text of any length: it comes after the arguments, shows at most six lines, scrolls, and shrinks to one line before the arguments shrink. The summary, the hint and the buttons never shrink, and the dialog itself scrolls only in a very short window, so a long message cannot hide the arguments or the buttons. In a window 640 px high or less, the dialogs use smaller padding and gaps, so the arguments keep more room (114 px instead of 85 px at 409x520 with a long message, with the 36 px HeroUI buttons). The theme card detail has its own limit of six lines and scrolls inside it. Control, invisible and bidirectional characters show as \u{...} escapes. Focus moves to "Recusar" for each new request, also the next one in a dialog that stays open; "Permitir uma vez" arms 1.5 s after a new request appears, so a click aimed at the previous request cannot allow the next one; the hint says so, and the disabled button shows a muted label on the field color with a dashed border. When a focused button becomes disabled (the arm delay starts again, or a refusal is being answered), the focus returns to "Recusar". The 1.5 s count only while the host window has the focus and is visible: a blur, a focus or a visibility change disarms the button and starts the count again, so a window over the shell cannot use up the delay. Esc is an explicit refusal, and the dialog says so.
Until the allow button arms, Enter and Space do nothing on both buttons of the three dialogs (the user, 2026-11-04), because the focus jumps to "Recusar" when a request shows and a key in that time was typed for something else. Esc stays the immediate refusal, a pointer press on "Recusar" works at once, and a click from assistive technology (no key event) still answers.
The schedule approval (/api/schedule-approval) and the theme approval (/api/theme/approve) use the same kind of modal dialog, with the same fixed colors, the same focus on "Recusar", the same 1.5 s arming of the allow button and the same explicit Esc refusal. The host shows no approval dialog in the desktop bar window.
Only one approval dialog is open at a time, across the three kinds. The open dialog stays until the user answers it or its request ends; then the next pending approval opens (tool requests first, then the schedule, then the theme), with the focus on its "Recusar" and its own 1.5 s arming. When more than one approval waits, every dialog shows "1 de N pedidos pendentes", where N adds the tool queue, every pending schedule proposal and a theme card; a single approval shows no count, and the empty count element takes no place in the header. When the workspace overview opens over an approval dialog, the host opens the approval again on top of it, with the focus on "Recusar".
/api/approve takes exactly {id, allow} and refuses an id that is not in the queue. The core removes the request before it answers OpenCode, so a second click cannot answer it again. The answer to OpenCode times out after the runtime request timeout (5 s). If OpenCode does not take an allow, the request waits again, unless a permission.replied event for that id arrived while the answer was sent: then OpenCode took it and the request stays out of the queue. A refusal cancels only the turn it was sent in. An allow answers only that id and the next request stays in the queue. A refusal answers that id with reject and cancels the turn, which clears the queue; it cancels the turn also when OpenCode does not take the reply. A permission.replied event removes its request. Each new request also raises and focuses the chat window once (focusChat), so the agent's browser window cannot hide it; a repeated event for the same request does not take the focus again. A schedule proposal and a theme card raise the chat once too, when they start to wait in the host.
Checks: test/approvals.test.js (also the memory plugin assert), test/approval-http.test.js (queue, ids, refusals, one raise per request with a fake compositor) and scripts/test-approval-browser.js, a headless check of the real host with a hostile profile style.css that sets :host and an overlay to position: fixed; z-index: 2147483647. It checks the tool, schedule and theme dialogs; the theme card comes from a synthetic host state, because a real card needs a compositor that compiles shaders (test/theme-create-http.test.js covers the core flow). Not exercised: the Electron host, Smithay, and a real OpenCode ask with a real provider.
The Electron host attaches no WebContentsView or BrowserView to the chat window: web-shell/desktop.cjs creates only BrowserWindows, a web panel is its own BrowserWindow (PanelWindows calls createWindow(route, spec)), and the agent's Chrome is a separate process started by the Playwright MCP server. A separate window can still cover the chat; the raise of the chat window for each new tool request answers that.
The commands run with the privileges and the file access of the user. There is no extra sandbox and no root grant. The tools stay in the authenticated MCP of the agent, which requires an active turn; HTML documents do not receive these capabilities. Memory helpers keep their own permissions, and the global tool block remains valid outside the main agent.
The requests and results live in maintenance-jobs/<UUID>/ in the profile, with private directories and 0600 files. A helper process independent of the core captures the output; restarting the core does not remove the results and does not by itself end the command. Logout, a machine restart or a supervisor that ends the whole process group can interrupt it. This does not replace an external recovery service. Do not use command output to print credentials; it can enter the history sent to the model. The records are not deleted automatically; keep the ones you need and remove the old ones when they are no longer useful.
The launch key does not reach the jobs (2026-10-31)
The launch key opens the session cookie of the protected host, and that page carries the CSRF token of the approval routes. A value in the environment of the core stays readable in /proc/<core pid>/environ for the whole life of the core, also after delete process.env, and any process of the user can read that file. So the Electron host (web-shell/desktop.cjs) sends the key on an inherited socket (Node "pipe" stdio), file descriptor 3, and sets only AGENT_NATIVE_LAUNCH_KEY_FD=3. The core (core/launch-key.js) refuses a descriptor that is not a socket, reads the key to the end, closes the descriptor and removes both variables before it starts any child. A bad descriptor or key stops the core. AGENT_NATIVE_LAUNCH_KEY stays as the fallback for older launchers and synthetic tests; with it the key is again in /proc/<core pid>/environ. Without either, the core makes a key and prints the session URL. The Python supervisors start Electron, not the core, and pass no key. test/launch-key.test.js starts a synthetic core like the host does and runs an execute_command job that reads the core environment, its own environment and its descriptors: the key is not there.
The same descriptor carries a second line since window layers phase 2 (openspec/specs/window-layers/spec.md): the host main key, a second 32-byte key that only the Electron main process holds. It opens the window declaration routes /host-window and /host-window-forget, in the header x-agent-native-host-key. The launch key does not open them, because the trusted renderers of the host send the launch cookie, so the launch key does not prove the main process. The core refuses a main key that is not 64 hex characters, a third line, and a main key equal to the launch key. The main key never goes into a cookie, a URL, a log, a renderer or the environment; with the environment fallback or a one-line launcher the core has no main key, and the routes refuse every request. The same test checks that the job does not see the main key either, and that the routes refuse a request without it, with the launch cookie, with the launch key in the header, and with an Origin header.
What a job can still reach
A job runs as the user, so it reaches everything the user reaches. The pipe closes one path to the approval routes, not the others:
- every file of the user: the profile (
state.jsonwith the conversations,notifications.json,manual-control.json, schedules, the change journal), the OpenCode credential store, the themes in~/.config/agent-native-os, the checkout and the releases; - every process of the user: it can send signals and read
/proc/<pid>metadata. Withkernel.yama.ptrace_scope=1(the Ubuntu default)ptracecannot read the memory of the core, because the core is not its descendant. Withptrace_scope=0it can.ptrace_scopedoes not close the Node inspector:SIGUSR1opens it on127.0.0.1:9229with no authentication, and a process that is no relative read a value from the memory of synthetic processes through it, withptrace_scope=1(measured on 2026-11-06; openspec/changes/portability-platform-contract/design.md, section "Medição do inspetor"). Since that datedesktop.cjsstarts the core with--disable-sigusr1, which takes effect at the next login or host and core maintenance. The Electron main process ignores that flag: a signal opened the port on the host in a nested session in the original measurement. Since 2026-11-07 the preparer makes a private Electron distribution withnodeCliInspectdisabled andrunAsNodeenabled, without editing the shared dependency cache. The supervisor, desktop launcher and nested QA require this runtime; releases ship that copy. It takes effect at the next login, and closes only the inspector path: a job can also rewrite the checkout and kill the core, and the supervisor then starts that code with fresh keys, which is noisier because the host restarts visibly. The OpenCode server password (/proc/<opencode>/environ) and the MCP bearer (its config file) need no inspector; - the private Smithay control socket, which accepts every typed command from any process of the user: window actions on any window, including a held one,
send_to_output,capture, workspace and theme commands, andlock.unlockstays bound to the connection of the lock host, andlock_hostaccepts only the parent of the connecting process while no other host process lives; - the session bus and the accessibility bus: it can read notifications with
dbus-monitorand read the text of any window through AT-SPI without the per-window consent; - the network, as the user;
- the screen, through a theme package: since manifest v4 (openspec/specs/window-effect-slots/spec.md) a
window-closepass in~/.config/agent-native-os/themesruns its fragment shader on every application window close onceselectorreloadon the control socket picks it, with no approval of the protected host (theme approval covers onlycreate_theme, which still generatesoverview-f9passes only) and no draw-time GPU budget or watchdog for a heavy shader on a quad up to 8 times the window size. The shader samples the closing window on the GPU, and nothing hands those pixels back to web code.
So these consent flows bind the agent tools, the protected host and generated HTML, but they are advisory against an agent that a prompt injection steers into execute_command: manual control of a window ("Devolver ao agente"), consent to read a window (read_window_text), a window capture shown by the user, schedule approval, theme approval (create_theme), the source change review (change_propose/change_submit; see below), the memory policy close, and the notification privacy rule. The session lock is the exception on the control socket: a job can lock, but it cannot unlock there or register another lock host while the host process lives, because its parent is the core, not the host. On older hosts whose inspector stays open, code that a job evaluates inside the host keeps the authority of the host, so this exception does not hold on that path (a consequence of the measurement above, not run against a lock). A job that kills the core can still end the lock authority; the session then stays locked until the restarted core registers. A job that kills the host can still name the core as the host in the gap before the new host registers, and then send unlock (see openspec/specs/lock-screen/spec.md). The protection against a steered agent is the review of its actions in the conversation, not a sandbox.
To link an installation to the maintenance checkout, set AGENT_NATIVE_SOURCE_ROOT in the core environment or write maintenance.json in the profile:
{ "sourceRoot": "/absolute/path/to/checkout" }
The context reports the source and the release separately. Editing one does not update the other. When you run a checkout directly, the Git root is discovered automatically. The explicit setting helps with independent releases and stays outside the portable package. It does not import the history of another application; local memory and the shell conversations remain the basis of continuity.
Before you change the shared environment, check the current processes, logs and project instructions. Prepare changes in a separate checkout, preserve WIP, run the relevant tests and produce a verifiable release. Visual changes keep using read_ui/replace_ui, with the existing validation and rollback. Do not use generic execution to get around a pending recovery, to delete locks or to overwrite checkpoints.
Before you replace the host or the core, persist the plan and the previous release, confirm that no other response is in progress and prepare independent supervision with rollback. Preserve the profile, the applications and the compositor. Then confirm the new runtime, the continuity of the conversations and the real operation through the interface. The AI must not claim recovery if it only started a process. If the core, the provider or the compositor is unavailable, the conversation may not be reachable: external recovery through the supervisor/TTY remains necessary.
Loading the project from the home directory
The direction was implemented in scripts/project-session.py, prepare-project.py and configure-project.py. The active project stays in a folder in the home directory, with the build in place and explicit user configuration. Recovery uses an independent Python dispatcher and a Smithay version known to work. See configuration, criteria and rollback.
AGENT_NATIVE_SOURCE_ROOT identifies the active source for maintenance; runtimeRoot identifies the code actually running, which can be the fallback. system_context.supervisors.project reports the phase and the two roots. Do not declare the update active only because login was configured or the checkout was published. The compiled seed does not replace the profile and the customized UI.
Validation in the real session
On 2026-10-26, release release-wrmNMBOV was activated in the GDM Agentic Shell session after a machine restart, preserving the River and ChatGPT processes and the seven existing conversations. The maintenance checkout was linked to the local project. The AI itself, with the already selected model openai/gpt-6-luna, received a read-only request through the interface: it queried the context and ran /usr/bin/uname with -s. The response correctly showed the checkout, the release, Linux and exit code 0; the persistent command record confirmed the result. No provider switch was needed.
The 77 Node tests, the syntax check and the formatting passed. The persistence test ends with SIGKILL the process that started a command and confirms the result through another instance of the controller. The GDM login was also proven by the real session and by the ChatGPT window on Wayland. This is not a test of a complete autonomous update of the AI, nor of recovery after a compositor crash. A transient user unit supervises the activation of the current host; the next login uses the release the GDM launcher points to.
Trusted React UI of the host
The main React UI now comes from the trusted sources web-shell/ui-src and runs in the host document, under a ShadowRoot in #surface. The profile can customize CSS through read_ui/replace_ui; the preview uses this same React application and the existing journal. The legacy index.html and app.js remain preserved for recovery, but they are neither loaded nor editable by replace_ui. The host reports when it finds these customized files. To change React behavior, authenticated maintenance must change the sources, build the bundle and prepare an updated host; do not copy code from the profile into the trusted UI. HTML responses remain isolated in opaque iframes.
Smithay desktop capture
For native visual inspection, run scripts/capture-desktop.py from the checkout with the real socket of AGENT_NATIVE_SMITHAY_SOCKET, following capture and coordination. The private bridge reads the composed framebuffer without depending on grim. A protocol error on an old compositor requires the new build at the next login; do not restart the session automatically and do not present browser pixels as a desktop capture. Generated HTML does not receive this tool.
Source change review card
An overlay of the chat host takes the same card, with target: "overlay" and a different ending: the only check is the build, a fixed line says that it runs with the whole authority of the host, and approval only records it. See immutable-base.md, The overlay.
A source change that the agent makes to the product is reviewed by the user before it reaches the active checkout. The contract is implemented in web-shell/core/change-proposals.js, core/coordination.js and the protected host card host/change-review.js. It is separate from core/changes.js, which keeps handling UI, frame and model changes.
Typed tools of the authenticated MCP (they need an active turn, generated HTML never gets them):
change_propose {title, summary}creates a git worktree of the activesourceRootand a new branchshell-change/<id>from the current HEAD. The worktree lives in the profile, inchange-proposals/worktrees/<id>. It is never in/tmp: the core refuses a profile directory in a temporary area. The command does not touch the working tree of the active checkout. It only adds git metadata (the branch and the worktree entry). Uncommitted work of the active checkout is not part of the worktree. At most one proposal is open per profile.- The agent edits files only inside the returned worktree, with the existing maintenance tools (
execute_command). change_submit {wait_ms?}stages the worktree and records the diff, the file list with+/-counts and the tree hash. The diff uses--text,--no-textconvand--no-ext-diff, and git reads no system or user attributes file (GIT_ATTR_NOSYSTEM=1,core.attributesFile=/dev/null). So an attribute such as-difforbinary, or a NUL byte, cannot hide content behind "Binary files differ". The counts read the attributes of the base commit (GIT_ATTR_SOURCE, git 2.41 or later), because--textdoes not reach--numstat, so a.gitattributesof the proposal fakes neither the totals nor the label. A file that git still calls binary, which on an older git includes one marked by the proposal, keeps the label "binário" and shows the lines counted from the patch when it has any, also in the totals. Then it runs the repository gates in that worktree through the existing command runner (System.execute, so the jobs are durable) and records, for each gate, the status, the exit code, the duration and a 4000 character log tail. The call returns at once unlesswait_msasks to wait; pollchange_status.change_statuskeeps its old output and now also carriesproposal: the open card (state, files, gates, refusal reason) and the last results.
Gates, in this order, stopping at the first failure (later gates are shown as skipped): python3 -I scripts/prepare-project.py --root <worktree> --dependencies-only (-I, so a file beside the script cannot shadow the standard library for it), then npm run format:check, npm run check and npm run test in web-shell/. When the diff touches native/smithay/, the prepare-project.py --cargo fmt --check, --cargo test and --cargo clippy gates are added. The command lines of the gates are fixed in the core, but what they run comes from the proposal itself: its package.json, its tests and its scripts. A green gate does not prove the proposal safe, and the lead decided on 2026-11-04 not to build a separate checkout for the gates, so the card says this in a fixed sentence and the review of the diff stays the check. Each gate runs under a memory limit: the shared heavy-run helper from ~/.local/state/agent-native-os/ when it exists, otherwise systemd-run --user --scope with MemoryHigh=3G, MemoryMax=4G, MemorySwapMax=2G. With neither available the gates fail with an explicit message and never run unlimited. The gate processes do not inherit AGENT_NATIVE_COMPOSITOR, AGENT_NATIVE_SMITHAY_SOCKET, AGENT_NATIVE_DATA_DIR, AGENT_NATIVE_LAUNCH_KEY, AGENT_NATIVE_SOURCE_ROOT, DISPLAY or WAYLAND_DISPLAY.
Ignored files refuse the gates. git add -A skips them, so they make no row and no diff, while npm, eslint and prettier still find them by name: a self-ignoring node_modules/ at the root with a fake .bin/node turned npm run test, check and format:check green in a synthetic test, and a self-ignoring web-shell/core/ with an eslint.config.js or a .prettierrc did the same for its gate. At submit, before the gates, and again right before a result counts, the core lists git ls-files -z --others --ignored --exclude-standard and refuses with a reason in its own words (the state goes back to editing and the card shows it as a note) for anything outside what the preparer itself leaves, each path exact: .project-build.lock, .project-build.json, .project-build.tmp and native/smithay/target/release/agent-native-compositor as regular files, and web-shell/node_modules only as a link to <build cache>/npm/<key>/web-shell/node_modules. A real web-shell/node_modules directory refuses too: a proposal worktree starts without one and the preparer links it, so that directory is agent work, and the preparer would trust a marker file in it. Any other file below native/smithay/target/ refuses as well, because a gate in a worktree uses the shared target; remove it and submit again. For the same reason a new embedded repository (a gitlink in the index that the base commit does not have) refuses: it makes a row, but its files are not in the diff.
If the files change while the gates run, or after they finish, the result is void: the state goes back to editing and the agent must submit again. Approval commits exactly the tree that was tested (checked by tree hash).
Each gate records the job id of its durable command. When the core restarts during the gates, the proposal goes back to editing, and a new submit is refused while a gate job of the earlier core still runs in the worktree.
Protected host card
The card is part of the protected host (#change-review in host/index.html, module /change-review.js). Since phase 7 of heroui-migration.md React and HeroUI render its content (ui-src/host/change-review.jsx, in /shadcn-host.js); change-review.js keeps the reads, the approve, discard and diff routes and the state, and the section stays in index.html. It shows, in this order, the fixed heading and the state, the fixed warnings of "What the card says" below, the totals, the files with +/- counts, an expandable diff, each gate with pass or fail and its log tail (HeroUI Disclosures), the fixed sentence "As verificações executam código da própria proposta, então aprovadas não provam que ela é segura: revise o diff.", what the core reports, the fixed hint, and only then the text of the agent, followed by the footer with the two buttons "Aprovar e aplicar ao checkout" and "Descartar". Every proposal string is a React text child, so the diff, the paths and the logs are text and never HTML; the card has no dangerouslySetInnerHTML, and a unit test rejects HTML from a string in the React sources of the cards. A browser test (test/shadcn-composer-cards.test.js) renders hostile markup in every field and checks that no element is created. Only a press on a button of the card calls approve or discard; change-review.js also refuses an approval of a blocked card and a discard without the first press. A failing, skipped or unfinished gate still shows the card but disables the approve button and shows the reason. So does a diff larger than 1 MiB, which cannot be reviewed in full. The card is hidden in the recovery page, in palette mode and in the workspace overview. A new revision renders into the same elements, so the keyboard focus and an open diff or log stay, and so does the scroll position unless the submitted tree changed. Above the composer, the card and the memory notice shrink and scroll when the composer area has no more room; the composer stays visible. The protected HTTP API needs the host token:
The card is an approval surface, hardened on 2026-11-04 against a prompt-injected agent, which applies profile CSS through replace_ui with no user click. That CSS lives in the ShadowRoot of #surface. What holds now, each proven in a headless browser by npm run test:review-overlay, with a control that the attack took effect:
- The card is a manual popover in the top layer (naaando/galaxy-shell#17), anchored over
#change-review-slot, an empty slot of the composer footer that takes the room the card took (its height is the natural height of the card, under the minimum from--change-actions-heightandmax-height: min(60vh, 520px)). No element of the page or of the ShadowRoot paints over it or takes its press, and the opacity, transform and filter of the footer do not reach it. It is open only while the slot is drawn (every rule that hides the card hides the slot:[hidden], the box, the command palette, the overview) and in view (a trusted scroll or clip that takes the slot out of view closes the card, #18) and no modal dialog is open, so it hides under an approval dialog, the settings or the overview and shows again after. - Nothing in the ShadowRoot paints or takes the pointer above the footer:
#surface-frameis a stacking context (isolation: isolateinhost/host.css). - Nothing shows through the card. It is not glass and is not a chat glass region: it is opaque and takes the fixed
--approval-*pairs of the approval dialogs, in both modes, for its text, sections and buttons. A cover behind it, also with forged text, leaves the pixels of the card as they were, withdata-chat-glasson or off. The pairs are not palette tokens:/theme.csswrites only the fixed keys ofpaletteCSSand of the profile color, so a forged palette changes no color of the card.@propertyin the shadow sheet does not reach the tokens of the document. - The buttons do not move through the pinned column.
--pinned-offsetis measured from#pinnedin the ShadowRoot, so profile CSS can drive it; while the card shows the footer sets it to 0 in CSS. The price: a pinned surface can sit under the footer while a card shows. With no card the measured value stops at half of the window, so the composer stays on screen. - "Aprovar" arms like "Permitir": 1.5 s after this revision really shows. The delay starts only while the window has the focus and is drawn, the card is drawn (not in the box or the palette, not hidden by the compositor), its slot is in view, no modal dialog of the host is open and the whole button is inside the card, and it starts over when any of that ends, when the window loses or takes the focus, and for a new revision. The armed state names its revision and the state of a discard, so a new revision is disabled in its first commit, and a cancelled discard starts the delay over, because in a narrow window "Cancelar" sits where "Aprovar" comes back. A press on the disabled button reaches no route.
- The delay is bound to where the press lands. It starts over on a window resize and when the rectangle of the button changes, which a
ResizeObserveron the footer, the card and the button, anIntersectionObserverwith the card as root and a read every 250 ms notice; the click handler reads the place again and runs the sync of the top layer first, so a press in the same moment as a move, a clip or an anchor that stops resolving answers nothing (#19). A move of the Wayland window fires no page event, so the host writes the rectangle of the chat window from the compositor state (presentationof thewindowsentry with the rolechat,chatPlacementinhost/workspace-zoom.js) todata-chat-placementon the body, and a change of it starts the delay over. That read follows the state poll, so a pure move shows after up to 600 ms. A move between the column and the centered dock usually changes the height too, which fires a resize at once. .change-actionsis a sticky footer of the card, so the buttons stay in view while the content scrolls, and nothing that the agent wrote stands between the user and them. The host measures the footer into--change-actions-heighton the card: that height gives the card its minimum, so "Aprovar" fits and can arm in a short window where the footer wraps, and itsscroll-padding-bottom, so a control that takes the focus does not stay under the footer. A card held smaller than the button still does not arm.
What the card says, so a proposal cannot pass for what it is not:
- The agent text comes after every fact of the card, in a block of its own with the fixed label "Descrição escrita pelo agente", set apart by its background and a dashed border. The title belongs to it, and the heading of the card is fixed.
host/change-review.jscollapses the line breaks of the title, the summary, the note and each path (also U+0085, U+2028, U+2029, form feed and vertical tab), so none can draw a row of its own, and the summary shows at most four lines until a press on "Mostrar tudo". The core keeps the summary as written for the commit message. - Paths, title, summary, note, branch, refusal, blocked reason, log tails, diff and the raw error of a failed route show bidirectional and invisible characters as markers such as
<U+202E>(showInvisible: U+00AD, U+034F, U+061C, U+115F, U+1160, U+17B4, U+17B5, U+180B-180E, U+200B-200F, U+202A-202E, U+2060-2064, U+2066-2069, U+3164, U+FE00-FE0F, U+FEFF, U+FFA0, the tag characters U+E0000-E007F and the variation selectors U+E0100-E01EF). - "Alterada depois da última submissão": when the tree hash changes within one proposal while the page is open, the line appears and stays until the tree returns to the first one, the proposal closes or the page reloads, and the card goes to its top at each of those changes of tree. It lists the paths that differ from the first tree that this page showed, from
GET /api/proposal/changed?id=&from=<tree>(at most 20, with the total); with no answer, such as a tree that git dropped, the line shows alone. There is no new acknowledgement: the delay starts over with the revision. - "Esta proposta altera as próprias verificações": the gates run scripts of the worktree, so one changed line in
web-shell/package.jsongets green gates. The core computesselfChecksat submit from all the staged paths, never from agent text (gateControlPathsincore/change-proposals.js):scripts/*.py,scripts/test/,web-shell/package-lock.json,web-shell/test/,web-shell/scripts/, the files that git, npm, eslint, prettier and cargo find by name at any depth (package.json,package.yaml,.npmrc,.editorconfig,.prettierrc*,.prettierignore,prettier.config.*,eslint.config.*,.gitignore,.gitattributes,.cargo/,rust-toolchain*,rustfmt.toml,clippy.toml), any path with anode_modulessegment, the Cargo files ofnative/smithay/and its Rust test files. It names what is known to steer the gates; it is not a complete list, and its absence proves nothing. - "A verificação dos arquivos que controlam os testes não está disponível para esta proposta.": host pages change at a reload and the core at the login, so a new host can read a core with no
selfChecks, and a proposal saved before that field recomputes it from a list capped at 500 files (selfChecks.partial). The line does not block the approval.
What remains, stated plainly:
-
Profile CSS can still restyle the conversation around the card, and move or forge UI that is not an approval surface, so text around the card proves nothing. Only the card is protected.
-
A forged wallpaper palette can still hurt the legibility of surfaces that are not approvals:
validatePalettechecks the format of each color, not its contrast. -
The agent can submit a new revision while the user reads. The card shows it as tests running with the button disabled, and it arms again afterwards.
-
The arm delay is a guard against a misplaced click, not against a user who is misled by the proposal itself.
-
The gates run code of the proposal, so green is not proof of safety. The line about the checks names known paths and is not complete: a change in
web-shell/core/can still weaken a test that imports it, and its absence does not prove the gates honest. -
The check of ignored files sees two moments, so an agent that writes an ignored file after the first and removes it before the second is not seen. It covers the worktree only: the shared npm and cargo caches are outside it, and files there can steer the gates for a process that writes outside the worktree, which the threat here does not assume.
-
The line about a new tree knows only what this page saw: a reload forgets the first tree, and a summary that says the wrong thing stays the agent's words, now labeled as such.
-
These flows are advisory against
execute_command, which runs as the user; see "What a job can still reach". -
The Electron host and the direct session have not been proven for the card; the proof is a headless browser with a synthetic core. A nested run proved only that the chat rectangle of the compositor state changes between the centered chat and the column.
-
GET /api/proposal,GET /api/proposal/diff?id=andGET /api/proposal/changed?id=&from=read the card, the diff and the paths that differ from an earlier tree./api/statecarries only a light summary (proposal: {id, state, title, revision}), and the host reloads the card when the revision changes. -
POST /api/proposal/approve {id, revision}. The revision must be the one the user saw. It covers the state, the tree hash and the gate results. -
POST /api/proposal/discard {id, confirm: true}. The host asks for a second click before it sendsconfirm.
There is no MCP tool to approve or discard. The card is a review step, not a sandbox: the agent already has the privileges of the user through execute_command, so this flow does not stop a determined agent from running git in the checkout. It makes the normal path explicit and auditable.
Approval
Approval takes the shared coordination.lock with a non-blocking flock and keeps it for the whole operation. A busy lock refuses the approval. Under the lock the core rereads coordination.log, appends start to it (flock on the log file itself), and checks the real state: the active checkout is the configured sourceRoot, is on the branch recorded at proposal time, has the HEAD recorded at proposal time (otherwise a fast-forward is impossible), and is clean (untracked files count). Then it checks the worktree tree hash, commits in the worktree (message: title, blank line, summary, proposal id; the repository hooks run), checks that the commit tree is still the reviewed tree hash (a hook can stage other content; then the refusal is commit-changed-tree and the proposal goes back to editing), and runs git merge --ff-only in the active checkout. Afterwards it removes the worktree and the merged branch and appends complete with the commit. Any refusal appends blocked with a reason code (dirty-source-root, not-fast-forward, branch-changed, tree-changed, lock-busy, ...), keeps the worktree and the branch, and shows the reason in the card. The proposal stays open, so the user can clean the checkout and approve again, or discard.
After the fast-forward, a failure to save the proposal record or to append complete does not turn the result into a refusal. The approval reports success with a warning, because the checkout already changed.
The core never pushes and never restarts the host, the core or the compositor. The running core and compositor keep the old code until the next login. The core reads the host pages, the trusted UI bundle and the protected panel assets from the checkout on each request (also when no web-panels.json exists and the built-in panel declarations apply), so those can change at the next reload of the interface, before the next login. The result message says both. Publication to main, the build preparation, the next-login routing and the real activation stay separate steps (see project-loading.md). The log lines carry only operational metadata (proposal id, paths, branch, commits, reason codes), never titles, summaries, diffs or conversation text.
Discard
Discard needs confirm: true. It removes the worktree and the branch (git branch -D) and closes the proposal. It is refused while the gates run. When the active checkout no longer exists, discard removes only the worktree directory of the profile.
Persistence
change-proposals/proposals.json in the profile (directory 0700, file 0600, atomic writes) holds the open proposal and up to 30 closed ones, so an open proposal survives a core restart. The worktree path is always derived from the proposal id, never read from the file. A validation that a restart interrupted goes back to editing with a note. An unreadable record is preserved and blocks new proposals with an error, but it does not stop the core from starting.
Evidence and limits
Unit tests use a temporary git repository as the active checkout and a temporary coordination directory. They cover the refusal with a dirty checkout, the successful fast-forward, a moved HEAD, a switched branch, a busy lock, edits after the tests, failing gates, the missing limiter, discard, persistence and the host card (with a fake DOM). A synthetic core (test/change-proposal-http.test.js) drives the tools through the real MCP endpoint with the default gates against a fixture repository. It uses AGENT_NATIVE_PROPOSAL_SYNTHETIC=1, which exists only for such cores: it removes the memory limiter and allows a temporary directory. The real core never sets it. These tests do not prove the card in Electron, the memory limiter in a real session, the real heavy-run helper, or the activation at a real login.
Canvas rollback order
A core older than phase 3 of canvas windows disconnects while any workspace is in Canvas or any presentation scale is above 1. Before you roll back the core or the compositor, turn the protected setting canvas off in Configurações: every Canvas workspace returns to Grid. Without that step, the compositor still converts every Canvas workspace to Grid 60 s after the last core that renewed the lease disconnects, and the older core then connects at its next retry.
A core older than phase 7 keeps window-session.json readable, but its first save drops the canvas rectangles, cameras and dock states that a phase 7 core saved there. After such a rollback the windows of a canvas come back from their last grid cells, or as new Grid windows. The same loss comes with a rollback of only the compositor to a build without capabilities.canvasTools (the known-good Smithay of phases 3 to 6, say), and with a login while the setting is off: the canvas restores as Grid, and the first save after that restore drops the canvas fields. The documented order (turn the setting off first) gives this loss too.
Phase 8 adds the protected setting canvasSharpZoom. An older core never sends it, and a newer core sends nothing to a compositor without capabilities.canvasSharpZoom, so a rollback of either side needs no extra step. Turning the setting off sends scale 1 to every surface and frees the downscale cache; the globals wp_viewporter and wp_fractional_scale_v1 stay until the compositor restarts.
Window layers phase 3 rollback pairs
A host and core rollback alone leaves a core older than window layers phase 3 on a phase 3 compositor (capabilities.hudPlugins). That pair loses two things. The compositor refuses the overlay declaration of every isolated plugin ("Layer not allowed for this role"), so no isolated plugin gets a window; the host logs Web panel <id>: Layer not allowed for this role once per panel, and protected panels are not affected. The older chat declares no camera_exclusive, so in Canvas the camera fit can go under the chat dock. Before such a rollback, add this pair to the persistent plan: either roll back the compositor at the next login too, or accept both losses until the next login. The reverse pair (a phase 3 core on an older compositor) loses nothing: the core declares plugins in overlay without plugin fields, and refuses a web-panels.json with plugin fields with the error in GET /api/web-panels.
Window layers phase 4 capability checks
Since window layers phase 4 the compositor gives no title a role, and a host and core of phase 4 open every window only through a declaration. Before a host and core restart, add two capability checks to the persistent plan, from one read-only state query of the live compositor:
- A host and core of phase 4 or later need
capabilities.windowDeclarations. Without it, every surface waits except the chat and recovery, which open as plain windows after 10 s, and the host logs the version skew once. The native menu item "Restaurar aparência…" also loads recovery in the chat window. - A host and core from before phase 2 must not run on a compositor that reports
capabilities.declarationsRequired: that compositor gives their windows no role, so the bars, the panels and the lock window stay unbound and a shell lock is refused.
python3 scripts/check-host-skew.py --socket <control socket> --checkout <checkout to deploy> runs both checks. --checkout is required, and the persistent plan passes the path of the checkout that it deploys, never the checkout that holds the script. It prints JSON and exits 0 when the pair is allowed, 1 when it is refused and 2 when the check could not run; treat 1 and 2 as a stop. An allowed phase 2 or phase 3 rollback also prints warnings with what that pair loses (isolated plugin windows for a phase 2 host on a compositor with hudPlugins; a fallback chat that never binds on a phase 4 compositor). A rollback across this phase rolls back the compositor and the host together, at the next login.
The same query has a third check since phase 2 of shared workspace cameras (Version skew):
- A checkout whose core does not know the
shared_workspaceslease (itsweb-shell/core/smithay.jsnever sendsshared_workspaces_enabled, the phase marker) must not run while the compositor reports a livesharedWorkspaceslease: until the lease ends, 60 s after the last connection that renewed it closes, that core would meet a Canvas workspace on several outputs. A core that knows the lease is fine on any compositor; on one withoutcapabilities.sharedCanvasit keeps one output per workspace.
check-host-skew.py runs it from the same state query and reports sharedWorkspacesLive and coreSharesWorkspaces; a refusal exits 1, so the plan stops. To roll the core back across phase 2 with the lease live, roll back the core and the compositor together at the next login, or rely on the lease end: the plan stops the new core, keeps the old core from starting until the compositor no longer reports a live sharedWorkspaces lease (60 s after the last connection that renewed it closes), and runs the check again. The setting workspaceOutputs is gone since 2026-11-03, so no core turns the leases off on request (history: until then the plan turned it off first, and the core ended both leases). The first save of a new core drops the workspaceOutputs key from state.json: an expected hash change in a before/after comparison of the profile, not data loss. A rollback core reads the missing key as off, renews no lease, and the leases end through the 60 s grace. When the plan compares profile hashes, it expects that key to go.
A fourth check came with phase 1 of Super mode (2026-11-04):
- A checkout whose core does not know the chat box (its
web-shell/core/smithay.jshas noconst chatDockStates = ["expanded", "collapsed", "box"], the marker) must not run on a compositor that reportscapabilities.chatBox: that core refuses a state with a box chat and drops the connection, and a new workspace starts in the box. A core that knows the box on a compositor withoutchatBoxis allowed with a warning: the Super tap shows or hides the whole chat as before, Super+Shift+F stays, and Alt+scroll and Super+N do nothing.
check-host-skew.py reports chatBox and coreKnowsChatBox; a refusal exits 1. Roll the compositor, the core and the host back together across this phase.
Planned restart in the session in use
Use the host/core procedure. The existing supervisor must keep its PID and the healthy compositor; stopping the core triggers recovery through the host exit or through a missing health signal. If Electron stays alive, the guard can also end that identified host, preserving the supervisor. The plan and the rollback guard live in private state outside Git. The product conversation can be unavailable during this switch; the external guard does not depend on it. Do not promise to preserve unsent drafts without a specific check.
Resources imported by the Electron host
Each module the host imports must be served by the core and admitted by the Electron network filter. On 2026-10-29, the absence of system-typography.js in the filter blocked the whole host.js graph: the bar kept only its static HTML, with no conversations, clock and indicators, even though the browser worked. The helper admits this module only at the exact URL of the core. Blob images of the authenticated local icons are admitted only when their embedded origin matches the current origin of the core; blob:null, external origins and URLs with a query/fragment remain refused. HTTP and browser tests do not replace this check of the host filter. Changing the filter requires a new Electron process, preserving the supervisor and the compositor through the activation procedure above.
Scheduled intents
The agent can propose recurring prompts with schedule_create, schedule_update and schedule_delete, and read them with schedule_list. The protected host must approve each change. A scheduled turn cannot change schedules and approves no tool by itself. See scheduled intents.
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.
- Changes to the product sources go through the review card: the agent uses change_propose, edits only the proposal worktree, and change_submit runs the gates there. Only the user approves, in the protected host card, which is opaque with the fixed colors of the approval dialogs, whose buttons do not move through the pinned offset and stay in its footer, and whose button arms 1.5 s after the card really shows with the whole button in the card and in one place (the page rectangle and the chat window of the compositor state), so a move or a cancelled discard starts the delay over; profile CSS applied with no click can still restyle what is around it; the gates run code of the proposal, so green proves no safety, and the core refuses them while the worktree holds ignored files that the preparer did not leave or a new embedded repository; the agent text comes after the facts of the card, labeled, in at most four lines until a press, and every proposal string shows invisible characters as markers; fixed lines computed by the core and the host, never from agent text, say when the tree changed under the open card and when the proposal changes its own checks; approval fast-forwards the clean active checkout under coordination.lock and takes effect at the next login. It never pushes and never restarts anything. See openspec/specs/self-maintenance/spec.md, section "Source change review card". Do not give these actions to generated HTML.