Skip to content

App Shell and Layout

Wijanarko Putra Rajeb edited this page Nov 17, 2026 · 74 revisions

App shell and layout

Architecture & Agent Roles

The Oh-My-Pi Autonomous Agent (oh-my-pi)

  • Primary Function: Autonomous CI/CD pipeline monitoring, build log analysis, dependency resolution, and edge deployment verification.
  • Runtime Target: Bun 1.4.x with native ESM and TypeScript striping.
  • Framework Integration: Elysia edge routes & Rsbuild plugins.

Kabmo Web View Interface

  • Session Sidebar (left, default 280px — DEFAULT_LEFT_PANEL_WIDTH in shared/lib/workspace/sidebar-width.ts; floor 264, ceiling 500): workspace folders bound to oh-my-pi projects, each listing its sessions, plus search/sort/archive toolbar and the settings/about/new-workspace/scheduler modals (src/client/components/layout/session-sidebar/). It has TWO chromes behind one setting — see the entry below.

  • The session sidebar has TWO chromes behind ONE setting, and the setting is a presentation choice — never a second sidebar (sidebarStyle: 'classic' | 'modern', shared/lib/workspace/sidebar-style.ts, client/hooks/workspace/sidebar-style.ts, Settings → Appearance → Layout). The structure that makes it safe: SessionsView (desktop) and mobile/SessionSidebar are DISPATCHERS that own the controller, the search/archive/sort state, the batch machine and every dialog, and each chrome receives exactly one SessionSidebarVariantProps (layout/session-sidebar/variant-props.ts). A chrome therefore cannot grow a private copy of an action — the batch bar is drawn by the dispatcher for the same reason. classic is ClassicView + mobile-session-sidebar/ClassicDrawer, i.e. the shipped markup moved verbatim, and it is the DEFAULT (DEFAULT_SIDEBAR_STYLE) so an upgrade rearranges nothing. modern is layout/session-sidebar/modern/ on desktop and the SAME component with touch density in the phone drawer — one row implementation (common/session-row/) at two sizes, not two implementations. Four measured details: the icon and title columns are shared with the workspace header, numerically — 4px inset, a 16px slot (18px on touch), 8px before the text, in both modern/WorkspaceHeader and common/session-row; before that rule the folder mark centred at x=20 against the row's status glyph at 24, the folder name sat at 34 against the title's 40, and the two ⋯ triggers were 9px apart (folder 8px from the panel edge, row 16px) — a 4px, a 6px and a 9px step, which is why the list read as two lists. The trailing column is 22px on desktop and 28px on touch in BOTH, ending 4px inside the list's content edge. The modern skeleton draws only the LIST — the search line, chips and action row are real controls that already render while initializing, so a skeleton with its own copies put two search fields on screen and its own px-2 doubled the container's inset; its heights are the live ones (26/31 desktop, 32/32 touch — the header and its rows are one height there), measured, because a placeholder of a different height is a layout shift with extra steps. And the filter row never wraps: four chips measured 265px against 256px of content at the 280px default, so Select fell to a second line and grew the row by 27px. The fix is a measured two-form Select (filterSelectForm in shared/lib/workspace/sidebar-filter-row.ts): a 28px glyph in the trailing slot below ~286px, a fourth chip above it. Only Select is right-aligned; the filter group is not. The group is a reading order that starts at the same left edge as the search field and the rows, and two mistakes were measured here: ml-auto on the GROUP pushed All/Running/Archived to the right edge as soon as the chip form appeared (the filters jumped sideways while the panel was dragged), and ml-auto on the chip while it was still INSIDE the group did nothing at all — the group is shrink-0 and only as wide as its chips, so it had no free space to claim and the chip sat flush after Archived. Select is therefore a SIBLING of the group, and the row's own spare space is what pushes it to the trailing edge in both forms. The classic chrome keeps its h-full-less flex-1 because the batch bar is a sibling BELOW it in the same column (a h-full child pushed the bar out of the panel); the classic search field force-opens when a query is present, because a query that survived a style switch otherwise left a filtered list with nothing on screen explaining it (and closing search clears the query for the same reason); modern's trailing column overlays the age and the ⋯ in ONE box (opacity only — never display:none), because at the 264px floor the title has ~176px and two trailing columns cost it a third. The live switch is announced, not polled: the settings modal calls applySettingsSideEffects → applySidebarStyle → omp:sidebar-style-changed, and useSidebarStyle is the single subscriber — the sidebar is visible BEHIND the modal, so a missing announcement shows the old chrome until a reload.

  • A session has ONE branch, and one chevron opens it: child sessions first, then the subagent roster (common/session-branch/). The old shape had two disclosures on one row — a chevron for children and a Boxes button for the roster — so a row could be open in one sense and closed in the other; the badge is gone and expandedSessionIds now drives both halves. Each child is drawn by the CHROME's own row component (renderSession), so a rule fixed on a root also holds at depth three. A subagent is a LEAF: its status sits in the same 16px leading slot every row uses for chevron/state, and the robot mark (Bot) takes the harness column, so the mark column answers "what kind of row is this" wherever it appears. A leaf CHILD with no chevron and no run cue draws a GitBranch child mark in that same slot (data-testid="child-indicator"), so the indicator column is never an unexplained hole. Tree guides are one level = 22px (BranchGuides): the cell is the distance from a row's leading-slot centre to its harness centre (slot half 8 + the row's 8px mark gap + glyph half 6), so the child's indicator slot lands exactly under the parent's harness icon. The line stays on the parent chevron's column; the separation is VERTICAL — the first row of a branch starts its stem 6px above its own row (clear of the chevron ink), while siblings continue from the row above. Every vertical is extended 2px past its cell (the list's space-y-0.5 gap), the own stem is calc(100% + 2px) when last (a 50% height measured as a BREAK: it ended on the row's top edge), strokes are 2px — the chevron's own ink weight — and bg-ink/40 (15% was invisible in both palettes); the arm is drawn above the row background because it crosses that row's inset. Each vertical segment ABUTS the next (the row above covers the 2px list gap with bottom:-2px, the next starts at its own top) instead of overlapping: a translucent stroke painted twice by two stems read as darker bands (the reported "belang") down a two-child branch. The chrome supplies the row's inset/padding/mark size (SESSION_ITEM_BRANCH_STYLE, sessionRowBranchStyle(touch), MOBILE_BRANCH_STYLE) because the three chromes differ. Measured in Chromium at 1440x900 on the modern chrome: the parent harness centre is x=42, the child indicator slot centre is x=42 (aligned), the guide line is x=19 (2px wide, centre 20, the chevron's own centre) and its stem starts at y=209 — 4.7px below the chevron's ink — with the arm x=19→34 (15px, 2px thick) ending on the child slot's left edge; each deeper level repeats the 22px pitch. The "New child session" dialog owns a PENDING row from the click, exactly like New Session: startPendingSession(folder, { parentSessionId, harness, title: 'New Child - …' }) puts it under its parent through the ordinary parentSessionId tree fold, expandSessionBranch(parent) fires omp:expand-session so a collapsed parent opens, the harness pick is patched onto the row live, a successful spawn adoptPendingSessions the id (parent/harness/title preserved so it stays in the branch while omp writes the transcript), and closing without a spawn releases it. Smoke-tested in the running app: the pending row appeared first under the parent with harness antigravity, and disappeared again after the dialog was cancelled.

  • The modern chrome's sticky folder surface and its touch row height are DENSITY facts, and both were wrong on the phone (layout/session-sidebar/modern/WorkspaceHeader.tsx, common/session-row/index.tsx, modern/Skeleton.tsx). The folder header is sticky and opaque, so the colour it paints is a visible band behind every workspace — it was bg-paper unconditionally, the DESKTOP column's surface, while the phone drawer is bg-canvas (the same split shared/lib/theme/chrome.ts already states for the window chrome). Measured in the drawer: header rgb(250,248,243) over rows at rgb(244,241,234) — the reported "warnanya belang"; the header now takes its surface from touch (bg-canvas at h-8, bg-paper at h-[26px]). The touch ROW was py-2.5, which made it 48px — its trailing ⋯ box is 28px (p-1.5 + a 16px glyph) and 2 × 10px of padding added to that — while Skeleton draws its rows from the live height and stated 44px, and the folder header above them is 32px (h-8). Three numbers, so the drawer read as three rhythms: a thin folder name over tall rows. The row is now py-0.5 — 28px box + 2px each side = 32px, the header's own h-8 — and Skeleton draws h-8 for a touch row, so the header, the rows and the placeholder are one height and the list's rhythm is 34px per item (32 + the 2px space-y-0.5). Padding rather than a fixed h-8, because a row carrying a second line (a held prompt, a worktree badge) has to grow and a fixed height would clip it. The gap itself stays space-y-0.5 at both densities: 6px was tried and rejected — the classic phone drawer separates its rows by 2px too, and the extra air is what made a 15-row list read as sparse rather than as a list.

  • A row whose action menu is open says so, in all three chromes (common/session-row/row-state.ts → SESSION_ROW_ATTENTION_CLASS). The menu is portaled to body, so without a cue on the row the user has to remember which ⋯ they pressed — and the sidebar lists identically-titled chats. The open row wears the SAME tint batch selection already used (bg-ink/10 + ring-1 ring-inset ring-ink/20; the ring is what survives a palette where the fill is nearly invisible) and carries data-menu-open="true", which is what the row tests assert. One constant for common/session-row (modern), layout/session-sidebar/SessionItem (classic) and mobile-session-sidebar/SessionRow (phone): a second tint for the menu would make one question look like two. Verified in the running app at 1440x900 and 390x844 — the row under the open menu is tinted in all three.

  • A brand-new chat's sidebar row belongs to a CLIENT store, not to the URL — and both layouts read the same one (pending-sessions.ts, src/client/hooks/chat/omp/). omp writes a session's .jsonl only when the first assistant message settles (measured ~17s, its writes are buffered), so until then the row exists only because Kabmo draws it. It used to be derived from ?sessionId= inside the controller, which made it a property of the ACTIVE session: clicking another session deleted the row, and it reappeared seconds later when omp's scan caught up (the reported "hilang dari session sidebar dan muncul setelah beberapa saat"). And because only the desktop sidebar passed includePendingSessions, a phone showed no row at all until the scan landed. The store is now the single owner: startPendingSession mints the id at the click (every creator — both sidebars, the New Chat dialog, the plugin openNew bridge — writes what it returns into the URL, because an id the store does not know is a row nothing can draw), markPendingSessionSent is called by the send path, adoptPendingSession moves the entry onto the omp UUID a spawn answers with, and hydratePendingSession registers an id a reload (or a second tab) re-enters with an empty store — including a mid-run adopted id, whose stream row is the only thing that keeps its row after a switch. withPendingRows (pending-rows.ts, split out because the store hit the per-file ceiling — the store owns an entry's LIFETIME, that module owns how one is DRAWN) folds the entries in for BOTH layouts, before the search filter (a row the user's own search hides is a row the search never offered to find), forces its host folder open (desktop reads isExpanded; the phone seeds its drawer expansion from the same list, so a seed taken from the raw folders would collapse the one row nothing else can recover), and stamps the row from the ID's OWN clock (pendingSessionTitle), never Date.now() — a re-stamp on every revalidate advanced the title's seconds and re-shuffled LATEST_SESSION ordering mid-run. Retention: an authoritative row always wins, a live run holds its row wherever the user navigates, an UNSENT draft keeps its row ONLY while there is a draft to get back to (hasComposerDraft over the session's own UI state: blank text and no attachments retires the row, and an UNREAD slot keeps it — a blob still in flight means the answer is unknown, not empty; the OPEN chat's own row is exempt, because that is the row on screen), because its content is real — the draft lives in that session's UI state — so the row is what makes it reachable again; MAX_UNSENT_DRAFTS bounds how many real drafts are held, and a SENT entry is released after PENDING_SETTLE_MS so a child that died before writing a transcript cannot leave a row behind for the life of the tab. A plain move away from a pending chat is not an adoption: consumeAdoption records the fromId → toId pair a SPAWN produced and the session-state provider migrates only on that claim, because every switch away looks identical from the URL and the ungated version copied the pending chat's chat.draft into the session the user clicked next (measured). useSessionSidebarController's only remaining layout option is expandSearchMatches (desktop); the pending row is not a per-layout request. Pinned by pending-sessions.test.ts (the rules), session-sidebar-controller.test.ts (mounted through the real provider, so a case mounted with NO options is the phone's own call) and sidebar.e2e.ts / mobile.e2e.ts (a real click, a real switch — both fail with the old URL-derived row restored).

  • A workspace opens itself when a row inside it needs to be seen — a run in flight, or a chat with no transcript yet (folder-auto-expand.ts, src/client/hooks/chat/omp/). A collapsed workspace drew the spinner and the new-… row inside a body nobody could see, so the one answer to "did my prompt land?" was hidden by the folder's own state. Two halves, because a render flag alone does not survive the run ending: the controller force-opens a folder hosting a stream session in the list it renders (the same rule withPendingRows already applied to a pending row's host), and writes workspace_folders.is_expanded through the one toggle the category header uses (folder-expansion.ts — the phone's drawer now calls it too, instead of its own raw fetch), so a reload and the other layout read one answer. The write is EDGE-triggered per session id, which is what keeps a tool call's structure push from re-issuing it several times a minute. Measured against a real server: a collapsed omptest with one stream row went is_expanded 0 → 1 and rendered its 75 rows after a sidebar refresh, and New session in general on a collapsed folder wrote the same flag before the row was ever sent in.

  • The workspace list is the user's, and the omp-project sync only SEEDS it — once per database, and only while it is still empty (syncWorkspaceFoldersFromDiscovery, src/server/lib/db/workspace-sync.ts, called once from getDb()). It is a bootstrap, not a background indexer: with any row present — bound or unbound, a hand-made grouping counts — it returns without touching the table, and SYNC_WORKSPACE=false skips it outright. Two conditions because "empty" has two meanings a row count cannot separate: a database that has never been seeded, and one whose owner deleted every folder on purpose. The workspace_sync_ran marker in app_settings covers the second, and it is written on EVERY path that decides — including the "list is non-empty, step aside" one, which is the upgrade path: an install that predates the marker arrives with folders and no marker, so skipping without recording would leave the hole open for exactly the installs that have been running longest. It is written BEFORE the insert loop — a pass that found no project still counts as run, or the first session written afterwards would seed the list. The sync's input is every session file under ~/.omp/agent/sessions, and a session's cwd is whatever directory omp was spawned in, so without the gate each scratch directory that appeared after the user had curated their sidebar became a new folder on the next boot. Measured on the author's install: 556 session files carrying 43 distinct cwds, 33 of them scratch (/tmp/omp-*, /var/folders/.../T/opencode/*, $HOME itself), against a sidebar of 3 — and 88 folders already deleted, 13 of them in a single minute. The delete path is why it could not self-correct: it only tombstones the paths it saw (deleted_workspaces), so the next scratch cwd is a fresh insert, not a resurrection. Verified end to end on real boots against database copies: a curated 3-folder one stayed at 3 with no banner line, an emptied one seeded from discovery, one already carrying the marker stayed at 0 with the list empty, and a pre-marker 3-folder database recorded the marker on its first boot and then stayed at 0 after its folders were deleted. workspace-sync.test.ts pins both gates and both directions — a non-empty list is never appended to, an empty one is seeded, an emptied one is not refilled, a no-project pass still spends the one run, and a pre-marker database records it.

  • The New Workspace dialog is two tabs, and both of them write a row into that list (src/client/components/layout/session-sidebar/new-workspace-modal/, reached from the toolbar's FolderPlus on both layouts). Create registers a directory that already exists; Clone fetches a repository and registers it in one step. Two tabs rather than one column of controls because the two flows ask for different things and neither is a variation of the other: Create needs a name and a listing to pick from, Clone needs a URL and a parent and produces its own name. The modal owns the ONE value both tabs share — the directory being browsed — so a folder entered in Create is the parent Clone shows; a second path state per tab is two fields that can disagree about where the user is.

  • The listing is read from /api/fs/browse, through one shared module (src/shared/lib/fs/browse.ts, also used by FolderPicker, which Browse… still opens for deep navigation). Clicking a row ENTERS that folder and moves the path field with it: the dialog has no second destination, so a row can only mean "go there" and the path it sets is what a submit reads. ⟳ Refresh re-reads the current directory; 📁+ New folder opens an inline name field. The new folder is created, NOT selected — the listing is refreshed and the user picks it — because "make a folder" and "use this folder" are two decisions. A refusal (name taken, slashes in the name, missing parent) is reported inline and leaves the field open, since a refusal that closed it would read as success.

  • mkdir and clone are their own routes, NOT /api/fs/action's create (src/server/routes/folders/{mkdir,clone}.ts). That route scopes through resolveRoot, which only accepts the app root, a path beneath it, or a registered project_path — and the whole point of this dialog is to name a directory that is NOT registered yet (~/projects). A request for one would fall back to the app root and create the folder in the wrong place. So both routes validate an absolute existing parent themselves, and the folder name must be one path segment (isSinglePathSegment), which is what proves join(parent, name) cannot resolve outside the parent.

  • Clone checks the name collision BEFORE it clones, and removes the partial tree on failure. A rejected workspace that already cost a full download is a failure the user can only undo by hand; and git clone creates the destination before it knows the fetch will work, so a failure leaves a partial directory in the user's projects. The workspace row is written from the RESOLVED destination — a name derived from the URL after the clone picked its own path is exactly how the row and the directory drift. git runs as argv with GIT_TERMINAL_PROMPT=0 (runGit, lib/fs/git-run.ts), because a private repository would otherwise block on a credential prompt with no terminal to answer it and the URL is user input.

  • Both creation paths share one insert (registerWorkspaceFolder, src/server/lib/workspace/register-folder.server.ts, used by folders/create.ts and folders/clone.ts): case-insensitive name guard, tombstone clear by CANONICAL key (a deleted_workspaces row for the same directory would otherwise make the new folder vanish on the next boot), the skill-discovery watcher sync, and the sidebar-structure signal. isGitUrl/repoSlug live in @/shared/lib/git/url so the Clone button's enabled state and the route's refusal read the same predicate — a per-caller copy is what lets the button enable on a string the server then rejects. Both routes refuse under MOCK=true.

  • Batch delete is TWO modes, not one, because the noun differs (src/client/hooks/workspace/batch-selection.ts + src/client/components/common/batch-selection/). The checkboxes do not exist until the user asks for them — mode is null and every row is an ordinary row — because a sidebar that draws a checkbox on every row turns every click into a choice between selecting and opening. workspace mode starts from the top toolbar's Select workspaces (a SIDEBAR_TOOLBAR_PRIORITY entry, so a narrow sidebar moves it into the ⋯ menu) and deletes workspace REGISTRATIONS — the same semantics as the folder's own Delete Workspace, tombstone included, so the sync cannot re-add it; transcript files are untouched. session mode starts from ONE workspace's ⋯ → Select sessions and is SCOPED to that workspace's rows (scopeFolderId): its header checkbox selects the rows it offers, other folders stay ordinary lists, and "select all" is therefore unambiguous. A row in select mode toggles the selection instead of opening the session and loses its ⋯ action trigger, its roster chevron and its context menu — an action beside a checkbox is a second thing the click could mean. The header checkbox is tri-state (indeterminate is a DOM PROPERTY, assigned through a ref in SelectionCheckbox — no attribute equivalent), computed by selectionSummary over the rows the ARCHIVE FILTER currently offers, so "select all" can never select a row the user cannot see or unselect. The session mode expands every folder; the workspace mode deliberately does not — it selects folders, not rows, and expanding three trees to pick a folder is motion for nothing. Select-all and unselect-all are two buttons, not one toggle: after a partial selection the user needs both directions and one alternating control cannot say which it means. The count and the payload are the LIVE selection (liveSelection), not the raw array: a selection is deliberately never pruned as the list changes — a row can vanish for one render (a folder collapsing under a filter, a push mid-refresh) and an effect that dropped it would discard a real choice — but an id that is gone from the scope must not be counted or sent. Measured with two tabs open: one deleted a session, and the other's bar went on reading 1 of 0 sessions selected with Delete enabled for an id that existed nowhere. A session selection also lifts the list's pagination window (selectVisibleSessions is bypassed while sessionCheckboxes): "select all" counts what the folder offers, and a window would tick rows with no checkbox on screen and no way to untick them — the reveal controls are hidden in that mode for the same reason. Delete is refused with nothing selected, then opens BatchDeleteModal, which names what actually disappears per mode and lists per-id refusals after the run — the bar's Delete never deletes on its own, and a refusal leaves the mode and its selection standing so the surviving rows can be retried. tests/e2e/specs/batch-delete.e2e.ts is the assembled proof (no checkbox before the mode, both entry points, a header checkbox that selects exactly its scope, a real delete that removes exactly the counted rows), and it taught two things a unit test cannot: the desktop folder trigger had no aria-label at all (title only), and a ⋯ menu row built as a <div onClick> is not a button to assistive tech or to getByRole — both now carry the role their job implies.

  • Both batch verbs are ONE request each, and they share the single-delete sequence (sessions/batch-delete.ts, folders/batch-delete.ts). A client loop would pay N round trips and republish the sidebar N times; the server answers {removed, refused[]} so the dialog reports counts and reasons instead of reassembling N answers. Session removal moved into removeSession (lib/omp/session/delete-flow.server.ts) precisely so the batch cannot drift from DELETE /api/sessions/:sessionId: pending new-… refusal, isSinglePathSegment, the busy-child 409, destroyAndWait, then purgeBtwForSession → purgeSessionData — in that order. A refusal is a VERDICT, never an abort: a batch holding one mid-run session still deletes the rest. The static batch-delete segment is registered BEFORE the :id routes (an id route winning the match would turn every batch into a 405). sidebar-toolbar.ts gained the select control, so SIDEBAR_TOOLBAR_PRIORITY still decides what survives a narrow row.

  • Batch archive is the same bar's reversible sibling, and it exists ONLY in session mode (sessions/batch-archive.ts, client/hooks/workspace/batch-archive.ts + batch-archive-run.ts). A workspace has no archive state — is_archived is a session field and archived_sessions is keyed by session id — so BatchActionBar draws Archive only when the caller passes onArchive and the mode is session; the action row is a 2-column grid with it and a 3-column grid without it, which is what keeps four labels readable in the 264px sidebar. The static batch-archive segment is registered before the :id routes for the same reason as batch-delete. The route is INSERT OR IGNORE into archived_sessions (the id is the primary key, so re-archiving is idempotent and creates no duplicate row) and emits sidebar-structure ONCE per batch, only when something moved. It needs no busy-child check and no removeSession sequence because it never touches the transcript; the only refusals are the two the single verbs already share — pending new-… (session_pending, no transcript to archive yet) and a non-single-path-segment id (invalid_id). There is no confirmation dialog: archive is reversible, so the bar's Archive acts on the live selection, the run refreshes once and reports itself as one toast (archiveOutcomeMessage, which names both the archived and refused counts), and a COMPLETED run ends the mode — including when some ids were refused, because an archive refusal is structural (a pending new-… chat can never be archived until it exists), not the retryable busy-child refusal delete keeps the mode for; only a request-level error keeps the selection so the user can retry. Delete and archive carry SEPARATE in-flight flags (busy / archiving): a shared one made an in-flight archive print Deleting… on the Delete button, and the reverse would claim rows were being archived while they were being destroyed. tests/e2e/specs/batch-archive.e2e.ts is the assembled proof (Archive refused with nothing ticked, one row archived leaves the list and is the only row in the archive view, and workspace mode draws no Archive control at all).

  • Top Navbar: active session title plus view controls — switch to mobile view, toggle the editor panel, and toggle the right panel (src/client/components/layout/desktop-layout/TopNavbar.tsx).

  • The header wordmark's halo is ONE variant on BrandWordmark (glow), white at 10%, dark palettes only, and it is a filter rather than a text-shadow. Four headers draw the lockup — both layouts' sidebar headers and both top navbars — and on a dark palette the word ends in text-ink over a near-black bar, and its leading run is a #0b5d3b plate: legible, but flat and half-lost. The halo is two drop-shadows of rgb(255 255 255 / 10%) at 0.35em and 0.9em, in em so it scales with the size the caller sets. drop-shadow and not text-shadow because the word's first run is an SVG (the K's plate) and the second is gradient-clipped text (background-clip: text), and a glyph shadow paints under neither. The colour is the whole history of this effect, and it took three attempts: orange (--color-brand) at 40%/22% moved the ring 1–8px outside the lockup by 3 in mean red — invisible; at 100%/85%/50% it moved that ring +41 of warm bias and tinted the whole bar, which read as a lamp rather than as light. The chroma was the mistake: the lockup's ink is near-white, so an orange halo is a second colour fighting the first. White at the same radii leaves the warm bias untouched (−10.7 vs the bare header's −10.8) and raises luminance +3.0 in the 1–8px ring and +0.7 in the 8–22px one, with a falloff over ~25px. Both layers stay at 10%: opacity is what made the earlier attempts invisible or heavy, and the visible edge of a halo is its radius. It applies on html[data-theme-variant='dark'] only (measured: filter: none on paper), where a white glow is a no-op anyway. The four call sites pass the flag rather than their own class — the desktop draws its sidebar and its navbar side by side, so a halo on one and not the other is two products on one screen.

  • Both headers draw ONE control cluster, in one order (src/client/components/common/header-controls/, HeaderControls). The two navbars are separate components — a phone's title area and a desktop titlebar have nothing in common — so the ORDER was written twice and drifted: the phone drew reload → context → sign out → panel while the desktop drew plugin slots → install → reload → sign out → editor → context → panel, and a user switching layouts had to re-find every control. The order is now stated once, in the component: install → plugin header slots → reload → context → lock (sign out) → editor → right panel, with each layout passing only what it has (install and the editor toggle are desktop-only; the right panel is an open-the-drawer button on the phone). The dev-only layout switch sits AFTER that list, so it cannot push a product control out of the agreed order. PWAInstallButton and HeaderPanelButtons moved out of desktop-layout/ with it, and withChord (the keymap-derived tooltip suffix) moved to src/client/lib/ui/with-chord.ts because both headers label the same toggles. Plugin headerPanel entries render on both layouts now — the slot was documented as desktop-only, and a phone that dropped it was one more control that moved when the layout changed. Only the dropdown's geometry is per-layout: anchored under its trigger on the desktop, pinned to the viewport on the phone, which has no room for a 320px panel hanging off a control near the right edge. header-controls/index.test.tsx asserts the RENDERED sequence for both layouts (a table in a module would pass while a call site rendered something else), with install made visible through a real beforeinstallprompt and sign-out through the auth store primed the way the bootstrap primes it. The cluster carries titlebar-no-drag ITSELF, and it draws the page-owned caption buttons on BOTH layouts — two bugs with one root cause: a shell fact stated at one call site. app-region INHERITS (WebView2's own spec says so, and Chromium 152 began enforcing it), so a header marked app-region: drag makes every descendant a drag handle unless something below it says otherwise — and a drag handle swallows the click, silently. The desktop navbar wrapped this cluster in a titlebar-no-drag div and the PHONE's header did not, so on Windows every control in a phone-width window (reload, context, sign out, the right panel, ⋯) looked right and did nothing. The marker now sits on the cluster's own root, so the next layout that draws it is correct by construction. The same reasoning moves WindowControls here from the desktop navbar: a desktop shell window may be NARROWER than App's 768px breakpoint (all three shells allow a 720px window), so a Windows/Linux window resized down switches to the phone layout — and the phone drew no close / minimise / maximise at all, with no native title bar behind them to fall back on. macOS never reaches that branch (drawsWindowControls is false: its traffic lights are the system's). shell-chrome.test.tsx pins the rendered tree for both layouts — the cluster's class, the three buttons on the phone and at the shell's 720px minimum, their absence on macOS and in a browser, and a real click reaching window_close from the phone layout — because both bugs were a CALL SITE's omission, which a test reading the component would have passed.

  • The chrome row's density is ONE module, and the navbar's controls are spaced like the sidebar toolbar's — the phone header was measurably too airy (src/client/lib/ui/control-plate.ts: CONTROL_BOX, CONTROL_ROW_GAP, CONTROL_CLUSTER_GAP, CONTROL_GLYPH_PX). Both rows are the same kind of surface: a single line of icon-only controls at the top of a panel. They stated their own numbers. Measured on the running app — glyph centre to glyph centre — the desktop navbar was 32px against the sidebar action row's 30px, and the phone's was 48px against the drawer's 38px, because HeaderControls had a .tap-target 44px plate at space-x-1 (4px) while ActionRow's touch variant drew 36px at gap-0.5 (2px). The box is the bigger half of that: 44px around an 18px glyph is 13px of empty on each side before the gap is counted. The module now states a fixed SQUARE (w-7 h-7 desktop, w-9 h-9 phone — not padding, which makes the pitch depend on the glyph's own width), 2px between controls, 4px between clusters, and every row reads it: HeaderControls, ContextUsageButton, MoreMenu, HeaderPanelButtons, ServerControl's chip, PWAInstallButton, both navbars' own buttons and modern/ActionRow. .tap-target's 44px floor is NOT removed — it is scoped to controls that stand ALONE (the composer's attach/maximise, the session picker chip): a 44px box inside a 36px-density row IS the airiness, and overlapping hit areas to buy the floor back steal a neighbour's click. control-plate.test.ts pins the square, the two gaps and both pitches (30 / 38), and asserts the mobile box carries no tap-target; ContextRing keeps its own 18px because it is a dial, not a stroke glyph. A plugin header entry can be an ACTION (opensPanel), and a phone too narrow for it folds it into ⋯. app.headerPanel({ opensPanel: 'rightPanel' | 'panel' }) names a SLOT, never a column: the host resolves it to that panel's instance key (plugin:<id>:<slot>) and dispatches omp:open-panel, and EACH LAYOUT opens it where the USER placed it — the desktop resolves the column from the dock state (useOpenPanelRequest, so the left dock, the right column and the editor column all work and a user who moved the panel did not break the readout), and the phone resolves the DRAWER from phoneDrawerForPanel (a panel placed on the left with the rail on is the left drawer; the same placement with the rail off stays in the right drawer, because phoneRightPanels keeps it there — the left drawer draws no strip then; an editor-slot takeover has no drawer at all and the click does nothing rather than opening a screen that cannot show it). The phone's two tab slots are read through useSharedSessionState, not the private useSessionState: the click writes the tab and the drawer MOUNTS on that screen change, so a private copy would open on the view it read at mount. opensPanel cannot be combined with dropdown (one click opens one thing) and naming a panel the bundle never registered is refused at registration. The fold is measured, not guessed: a 73px CPU 18% / RAM 2.5G readout in a 390px row cut the session title to 48px of its 74px, so MOBILE_HEADER_ACTION_PX (430) is exactly the width where the title keeps all of it — below that an ACTION entry moves into the ⋯ menu as the same action (requestOpenPanel), while a dropdown (needs its trigger's anchor) or a static readout (has no action) never folds. A plugin owns its trigger's markup, so the phone caps one entry at MOBILE_HEADER_ENTRY_MAX_PX (96) rather than letting one readout take the row. The split is resolved ONCE per header (useHeaderEntries) because two surfaces draw it — the row and the menu — and asking twice would be two media queries deciding one row. Every header that can be the window's top strip is a title bar, and the phone's headers were not. A desktop shell window may be narrower than App's 768px layout breakpoint (macOS, Windows and Linux all allow a 720px window), so a narrowed shell window renders the PHONE layout — whose headers carried neither data-drag-region nor the shell's own left inset. On macOS that left the main screen with no draggable strip at all, and the drawer headers' wordmarks and hamburgers sat UNDER the 76px of traffic lights, because titlebarPaddingLeft reads env(titlebar-area-x), which a native WKWebView never defines; the shell's width has to come from titlebarInsetLeft. The right drawer was worse: it had no drag region at all, so it was a screen with nothing to move the window by. Adding the attribute to a header is only half the change — app-region INHERITS, so the controls inside must carry titlebar-no-drag or they become drag handles that swallow their own clicks on Windows. titlebar-css.test.ts now lists all five title-bar headers (both desktop ones and the three phone ones) instead of the desktop pair, which is exactly how the gap shipped.

  • The PWA window-control inset is stated ONCE, in src/shared/lib/ui/titlebar.ts, because four headers draw it and the formula was wrong on macOS. With display_override: ["window-controls-overlay"] the titlebar-area-* env variables describe the area the page may use — it runs from the frame edge to the innermost edge of the overlay housing the window controls — so the LEFT inset is titlebar-area-x and the RIGHT inset is what is left over AFTER the area ends: 100vw - titlebar-area-x - titlebar-area-width. The headers computed the right inset as 100vw - titlebar-area-width, which is the same number only when x is 0 (Windows/Linux, controls on the right). On macOS the traffic lights are on the LEFT (x ≈ 76px), so that form charged their width to the wrong edge: a measured 76px dead strip between the last navbar control and the window's right edge, which is the reported "kenapa ada jarak". titlebarPaddingLeft/titlebarPaddingRight take the base padding (and, on the phone, the notch insets) and every header uses them — the desktop navbar, the sidebar title, the phone header, the phone sessions drawer, the phone right drawer, the editor header and the full-screen diff — so a header added later cannot restate the arithmetic. titlebar.test.ts substitutes real macOS/Windows/tab geometries into the returned declarations and evaluates them (16 / 138 / 16 on the right, 76 / 16 / 16 on the left) rather than asserting the string, and shell.e2e.ts measures the last navbar control's gap to the window edge in a real browser; both fail with the old formula restored.

  • A dropdown that must paint over its siblings is PORTALLED, and a bigger z-index cannot fix it (src/client/components/common/anchored-menu/ + src/shared/lib/ui/menu-anchor.ts). A positioned or flex item carrying a z-index establishes a stacking context, so a z-50 child of it can never outrank another element in the PARENT's stacking layer — only the ancestor's number decides. Two reported menus failed exactly this way. The workspace ⋯ lives in the modern sidebar's sticky top-0 z-10 header, so its panel was painted UNDER the next workspace's sticky header: measured with elementFromPoint, y=200–216 inside the panel's own rectangle answered the following header's button (3 of 11 probe rows), which reads as "the menu appears, then the folder below eats it". The server panel hangs off the desktop navbar, a flex item at z-20, so anything at z-20+ in the chat column covered it (measured at 1100×460: the timeline's minimap sat on the panel's middle rows). Both also inherited the scroller's overflow, which clips an absolute menu at the sidebar's edge. The panel is therefore rendered by AnchoredMenu: fixed, in document.body, at z-[70] (above navbar z-20, panels z-50 and modals z-[60]; below toasts z-[200]), placed from the trigger's measured rect by placeMenu — below the trigger, kept below with maxHeight making it scroll when its natural height does not fit (at 390×844 a drawer row's action menu is 187px and the strip under a row near the bottom is smaller, so the menu used to open ABOVE the button that was pressed), flipped above only when less than 120px remain below, clamped inside both side edges. It re-measures on every render because the folder menu swaps its rows for the delete confirmation, and it is dismissed by its own full-viewport backdrop plus Escape — never by a useOnClickOutside rooted at the trigger, which would read every click INSIDE the portal as outside. The phone's popovers are the same panel with the SAME anchor: the context ring, the session picker and the server chip hang under the control that opened them. They used to be pinned to the title bar's inset (mobileOverlayStyle, since deleted), which put the context panel over the header at the screen's far edge — measured at 390×844 before: panel top 62 against the ring's bottom 71 and left 12 against the ring's right 302; after: top 75, right 0px off the ring's. Verified after the change: 0 of 11 probe rows covered in the modern sidebar, 0 across the nav panel at 1100×460 and the phone sheet at 390×640 and 700×380. menu-anchor.test.ts pins the flip, the clamp and the scroll cap without a layout engine.

  • The context-usage ring is ONE component on both headers, and it is a gauge, not a dot (src/client/components/common/context-usage-button/, ContextUsageButton). The phone had this control from the start and the desktop navbar did not, so the only way to see how close a run was to its model's window on a desktop was to open the Context panel in the right column. The ring fills CLOCKWISE with contextPercent, and the rotation is the SVG transform attribute (rotate(-90 9 9)) rather than a Tailwind -rotate-90: a CSS transform on an SVG child resolves its origin against transform-box, whose default differs between engines, and can pivot the arc around the viewBox corner. The stroke attributes are written KEBAB-CASE (stroke-dasharray) because Preact assigns a prop whose name exists as a DOM property and otherwise calls setAttribute — camelCase produced a strokeDasharray attribute no renderer reads (happy-dom exposed it; a test asserting getAttribute caught it). The bands are one table (CONTEXT_BAND_TONES + contextUsageBand, src/shared/lib/chat/context/usage.ts): under 50% success, 50–59.9% warning, 60% and up error, boundaries belonging to the worse band. Red begins well before omp's typical compaction point — compaction.thresholdPercent ships an 80% preset labelled "Typical threshold" — so the ring warns while there is still room to act. Verified in the browser on both layouts: 12/42% → text-success, 50/55% → text-warning, 60/72% → text-error, with the arc's computed stroke resolving to the band's colour. The source is useSessionContextTelemetry (src/client/hooks/chat/context/telemetry.ts): the session:<id>:telemetry topic first (so the ring moves during a run, on the same pushes the Context panel gets) with the HTTP route as the fallback for MOCK mode and in-memory sessions. The popover is the same markup on both layouts — pinned to the phone's header geometry, anchored under the trigger on the desktop — and a session with no turn says Session not started instead of printing zeros as if they were measurements. Pinned by context-usage-button/index.test.tsx (through a real realtime server) and usage.test.ts (the band table and the ring geometry).

  • Chat Timeline (center): the streaming agent conversation — thinking accordions, tool-call cards, rendered mermaid diagrams (click one to open the zoom/pan viewer in src/client/components/common/diagram-viewer/), queue panel, and the composer (src/client/components/workspace/chat-timeline/).

  • A diagram's natural size is its viewBox, never parseFloat(width) — mermaid writes width="100%" for every type except flowchart and sequence. useMaxWidth is off only for the two types mermaid.ts pins; class, state, ER, mindmap, timeline, gantt and pie keep it on and emit width="100%", no height, the real size in style="max-width: Npx" and the viewBox (measured: class 166.98×294, state 152×210, ER 132.06×470, timeline 895×476.6). Number.parseFloat('100%') is 100, so readDiagramBlock reported a 100 px-wide diagram: the viewer's canvas was 100 px, the SVG was letterboxed into it at 0.6× (timeline: 0.11×, text laid out at ~1.8 px and effectively invisible), and zooming magnified that tiny rendering — the reported "preview looks broken when zoomed". read-block.ts now accepts only a unitless/px number as a pixel size and falls back to the viewBox, then the rendered box.

  • A mermaid block carries its own Refresh button, and the button is markup BOTH states emit (src/shared/lib/markdown/mermaid-actions.ts). A diagram that renders blank is the one state the reader can repair, and the repair is a delegated click on data-mermaid-refresh — so the action set is shared by the marked placeholder (marked.ts) and the hydrated block (mermaid.ts), because applySvg REPLACES the placeholder innerHTML: a second copy of the markup is how the button would exist before the first render and vanish after it. refreshMermaidBlock drops the cached SVG first (a blank is usually a cached blank, so re-applying the cache reproduces it), resets the block to its placeholder so a failed retry shows the source in the error colour, and re-renders. The click is resolved BEFORE the diagram-viewer branch, or the same click opens a blank overlay instead of retrying. Testing gotcha: happy-dom's DOMPurify shim drops every <div> (sanitizeHtml('<div class="foo">hi</div>') returns hi), so a component test that mounts MarkdownRenderer finds no .mermaid-block; the click resolution is exported as refreshMermaidFromClick and tested against the raw renderMarkdown output instead.

  • The composer's three Enter bindings are SETTINGS, and they live in the kabmo_settings blob (resolveComposerKeybindings, src/shared/lib/chat/composer/keybindings.ts). Settings → Chats → Keybindings persists keybindingSend / keybindingNewLine / keybindingSteering through writeKabmoSettings, so they nest under kabmo_settings — NOT at the top level of appSettings, which is the raw app_settings row map. The handler used to read each one as appSettings?.keybindingSend, found nothing, and fell back to its default, so the panel showed a choice the composer ignored: measured in the browser, with "send" set to Ctrl+Enter a bare Enter still cleared the draft and started a turn. readKabmoSetting resolves the blob and top-level keys alike (the same helper the composer already used for goalDefaultBudget), and the file's own defaults mirror the settings editor's so an unset key reads as the binding the panel renders. Resolution happens per KEYPRESS, not per render, which is what makes a binding changed in Settings apply to the very next Enter with no event and no reload — the composer has nothing to re-render for the next keydown to observe it. keybindings.test.ts pins the blob as the source (including that the blob beats a stale top-level copy), and the defaults.

  • Every global chord resolves through ONE dispatcher and ONE command catalog (src/shared/lib/commands/, src/client/lib/commands/, src/client/components/common/command-palette/). The catalog (catalog.ts) is data — id, title, category, when, per-platform default chord — and the client registry binds the closure; the palette, the settings table, the cheatsheet and every tooltip read the same two. Rules resolve default → plugin → user, last exact match wins, and a user override keeps the command's own when (binding ⌘B to Toggle Sidebar must not make it fire while the editor has focus). Two-stroke chords enter a PENDING state and the first stroke is preventDefaulted, or it would type a character; the pending prefix is shown in the corner (ChordHint). The editor keeps its own keymap: CodeMirror needs run against the view, so the palette lists its 45 commands through editor.run and the panel publishes the focused pane's target on focusin — a split column mounts two panes, and "last mounted" is not the one being typed in. A modifier keydown is not a stroke: WebKit reports the Meta key as OS, so recording ⌘P stored osleft cmd+p, which failed to parse and silently unbound the command; isModifierKey checks both key and code, and setUserKeybindings drops an unparseable chord rather than removing the default. An override for an id this build no longer ships is kept in kabmo_settings but never applied — a stale ⌘B would otherwise shadow the live command that now owns it. The shortcut sheet is reachable from the footer button between Settings and About (desktop and phone) and from ⌘K ⌘S; the settings page is Settings → Keyboard, which also owns the composer's three Enter bindings (moved out of Chats, so "keybindings" means one thing in one place). A duplicated id THROWS, so a command that belongs to a surface mounted more than once must be registered by the runtime, never by the surface. editor.run was registered in useEditorPanelKeys, i.e. once per Editor — and a split column mounts two. Splitting the editor threw command "editor.run" is already registered, and Bun's dev overlay drew that error over the whole 1280x720 viewport, so the split spec's next click was reported as <bun-hmr> intercepts pointer events and timed out for 15s; reproduced locally by restoring the per-pane registration and running that one spec. The registration lives in use-command-runtime and calls through editorCommandTarget(), which the FOCUSED pane publishes — the same route workspace.saveFile already took.

  • The composer stretches from a control at the trailing edge of its top row, and "bigger" means two different things per layout (chat-input/expansion.ts is the decision table; the button is Maximize composer / Restore composer in AttachmentToolbar). A phone takes the whole viewport — the card becomes fixed inset-0 z-40, so every dialog stays above it (extension/ask z-50, goal and undo z-[60], plan review z-[70], toasts z-[200]; a stretched composer over a blocking dialog would make the agent's question unanswerable) and the soft keyboard is lifted by the card's OWN overlap with the visible area (useKeyboardInset(cardRef, expandable && expanded) — measured 336px of an 844px viewport with a stubbed visualViewport, which put the Send button's bottom at 500 against a visible bottom of 508). A desktop grows IN PLACE — min-h-[38vh] on the textarea (measured 342px at a 900px viewport) with the card still in the dock at its panel width, because a full-screen composer there would hide the transcript the prompt is written against. Three rules are load-bearing and each was a bug first. The card's POSITION is a field of its own, never a class in the base list: Tailwind orders its position utilities static, fixed, absolute, relative, sticky, so a relative in the base string WINS over a fixed added later whatever the order they are written in — measured, the phone card reported position: relative with fixed inset-0 z-40 sitting on it and stayed in the dock, which a unit test on the returned class cannot see (only a browser resolves which class wins). The popup flips over the draft on a stretched phone (ComposerPickerPlacement: up is the docked bottom-full mb-1, over is top-2 inside the textarea's own wrapper, which ComposerTextarea.wrapperClassName makes the flex member that owns the leftover height) — a full-height composer's top edge IS the screen's, so an upward list is drawn off the viewport with nothing to scroll back. A DISPATCHED send collapses the stretch on BOTH layouts, and Escape collapses either (a document keydown listener, so it works with the popup closed; with the popup OPEN the picker eats the first Escape and the second collapses). The collapse is driven by the send pipeline's onSent (useComposerPipeline), never by the click handler: it was if (isMobile) setExpanded(false) in handleSubmit, so a desktop kept a 38vh box over the conversation the prompt was written against, and on either layout a press that dispatched NOTHING (an empty draft, an attachment whose read produced no body) collapsed a box whose content had not been sent — a refusal that read as success. onSent runs after every guard and immediately before onSend, so the button, Enter, Cmd+Enter steering and a queued follow-up all collapse it and a refused send does not. The control is spelled Maximize, not Expand, because chat.e2e.ts collects every [aria-label^="Expand "] and requires each to name a TOOL — a second control spelled that way read as a tool card titled composer. expandable gates it: the chat composer and the pending-session composer have it, the New Chat modal (which maximizes its own card) and the BTW form (sized by the panel it sits in) do not. Pinned by expansion.test.ts and, for the class-order trap a unit test cannot see, tests/e2e/specs/composer-stretch.e2e.ts plus the stretch spec in mobile.e2e.ts.

  • The chat's content width is ONE variable and ONE class, chosen by data-chat-width on <html> — and the composer follows the transcript. compact 720px / wide 970px / full 100% of the chat PANEL, all three in the --chat-column-max table in src/client/tailwind.css; chat-column (width 100% + that max + margin-inline: auto) is what every column element carries. Before this the number was written out EIGHT times as max-w-[970px] — TimelineBody, ComposerDock, both SessionSkeleton columns, both SubagentView columns and EmptyWorkspacePrompt's two — which is eight chances for a mode to half-apply, and a grep for the literal is the check that it did not. The mode is not a layout: unlike editorViewMode (whose compact/full HIDE the chat), no width mode hides a panel or moves a control, so the two must not share a name. full widens the composer too, deliberately: the composer is a card in the same transcript (expansion.ts says so), and a "full" mode that stopped the input at 970 while the answer ran to 1400 would be a silent substitution — the cost is ComposerToolbar's justify-between stretching on an ultrawide, which is a toolbar problem to fix there, never by narrowing the card. The default is REMOVED from the attribute rather than written, so :root is the single statement of 970 and a document that never chose a mode is byte-identical to one that chose wide; the override selectors are :root[data-chat-width="…"] because a bare [data-chat-width] ties with :root on specificity and would win or lose on source order. The mode is GLOBAL (kabmo_settings.chatWidthMode), not per-session: a line length is a property of the person and the display, and a per-session value would reset every new chat. Applied at boot by initChatWidthMode() in main.tsx (right after primeKabmoSettings, so no frame at the wrong width) and on change from the settings modal, whose Chats › Chat Width control draws the three widths as bars. A phone is narrower than the smallest column, so all three modes render identically there and the control says so in words. Verified in a browser: at 1920 the transcript and the composer both measured 720 / 970 / 1048 with docOverflow 0, and a click on Compact survived a reload as data-chat-width="compact" at 720px.

  • The composer's action pair is ICON-ONLY, and its colour lives on the glyph (chat-input/Toolbar.tsx). Stop is text-error-text and Send text-info-text — the palette's SOLVED signal, at 4.5:1 against paper and canvas; the raw text-error / text-info measures 2.73:1 and 1.94:1 on the worst palettes, under the 3:1 graphic floor a 12px glyph needs. The class sits on the <svg>, not the button: the colour mode's paint rule is [data-icon-style="color"] :is(svg.lucide, …) { color: var(--icon-paint) } at (0,2,1), so a single utility on the button is overwritten with the mode's hashed hue, while authorColourRules keys on svg[class~="text-error-text"] and keeps the token. That table therefore carries the five solved spellings beside the five raw ones (text-error-text, -success-text, -warning-text, -info-text, -meta-text), which also fixes the toast marks and the context-usage arc — they had been repainted with a hue all along — and the -text rows are marked NOT slashable, because no call site writes text-error-text/70. Monochrome — the default — still paints both glyphs in var(--theme-ink): its ink pass is (0,5,1) and outranks the utility, which is exactly the contract "every icon in the palette ink". No plate, and no hover plate either: the pair used to be two FILLED signal buttons (bg-error-text / bg-info-text, with .composer-action repainting them var(--theme-ink) under monochrome and --color-{error,info}-text-hover solving their hover), and the rectangle is gone with them — hover is hover:opacity-70 on the button, a text-canvas glyph and shadow-xs are dropped, and the tokens those fills used were deleted from tailwind.css rather than left dead. Measured in the running console with the real bundle: Send's box is rgba(0,0,0,0) with box-shadow: none while its glyph computes rgb(65, 116, 159), and a disabled Send holds opacity 0.4 under the pointer because :hover matches a disabled button too (disabled:hover:opacity-40).

  • The composer's style is ONE table of ROW ORDER, and a style can never drop a control. Chats › Composer picks classic | calm | console | stage | glass (shared/lib/chat/composer/style.ts, persisted as composerStyle in the kabmo_settings blob, announced by omp:composer-style-changed). Every style renders the same five rows — attachments, notice, draft, voice, toolbar — and the table names their ORDER, never their presence; chat-input/ComposerRows.tsx builds all five unconditionally and ComposerFrame loops over rows. That is deliberate: the access-mode selector is a safety contract, so a style able to omit it would be a style able to send a write-capable turn from a card that said "read-only". calm and console move the draft above the attachment row; console adds a mono rail and an omp › glyph; stage differs only while the chat is EMPTY (hero), where the draft floor goes 68/80px → 132px. The style's pixels are plain CSS, not Tailwind classes, keyed by data-composer-style / data-composer-hero on the card (tailwind.css, .composer-draft / .composer-attach-row / .composer-toolbar-row): measured in a browser, rounded-md written beside the expansion frame's rounded-xl rendered 12px, because Tailwind resolves two utilities of one property by the order it EMITTED the rules, not by the order they appear in className — the same trap cardPositionClass already exists for. Verified in a browser at 1440×900 and 390×844: all four styles drew the paperclip, the stretch control, Plan, Goal, the access selector, the model and thinking pickers, voice and Send; the stretched phone card stayed fixed inset-0 z-40 390×844 in every style; a click on Console in the settings card re-attributed the live composer to console with a 6px radius without a reload, and the choice survived one. glass is a SURFACE, not an order — classic's rows, a frosted frame — and it is the only style that leaves the paper identity (DESIGN.md §4): 58% of --theme-paper with backdrop-filter: blur(16px) saturate(1.15) and an ink-only sheen, still token-based, still NO chroma (the source render's coloured glow was dropped; chroma is reserved for --theme-error), plus an opaque fallback under @supports not (backdrop-filter). Its blur has a subject only when the phone STRETCHES the card over the transcript; docked it reads as frosted paper and the code says so. Stretched, that surface must also WIN the overlap: at the docked 58% the transcript read through the draft — measured in Chromium at 390×844, a blank stretched card carried ghost message text, with the region's luminance deviation at 2.5 against 0.7 after — so [data-composer-style="glass"][data-composer-expanded="true"] raises the surface to 92% paper (docked stays 58%; mobile.e2e.ts asserts both alphas, polled because transition-colors paints the docked value on the first frame). A style's radius is plain CSS and therefore beat the expansion frame's rounded-none — measured: a stretched glass card kept 20px over a fixed inset-0 surface (and console kept 6px the same way), showing the canvas at the corners. The card now carries data-composer-expanded, and ONE rule after every style sets border-radius: 0 for it; re-measured: all five styles docked at 12/16/6/12/20px, all five stretched at 0px.

  • A composer draft belongs to the CHAT the URL names; the landing keeps its own in memory only (useComposerDraft, src/client/hooks/chat/composer/use-draft.ts). The landing has no ?sessionId=, so App mounts SessionStateProvider on its fallback id ('1') and the composer writes chat.draft there — but the landing composer is DISABLED until a workspace is picked, so nothing on that screen can send or clear it, and the slot is permanent. Measured: a [Konteks halaman browser] block appended from the browser panel while no chat was open (the panel's omp:browser-include-page event lands on whatever draft the composer has) was still in the box on every later launch, indistinguishable from text a new chat had inherited — session_ui_state held it under sessionId=1, and ?sessionId=1 is also a real mock chat, so opening that chat showed it too. The hook now reads ?sessionId= and, when it is absent, keeps the text and attachments in useState instead of useSessionState: the draft is still typeable and still receives panel inserts for the life of the page, it just never becomes a persisted blob. Both branches stay mounted (useSessionState is a hook) and the URL only picks which one is OBSERVED, so stepping into a chat and back destroys neither.

  • The sidebar's primary New Session opens the LANDING — a clean URL with no query at all — and only a WORKSPACE's own + mints a pending chat (SessionsView.handleNewSession, LayoutWrapper.handleNewSession). The primary action used to finish with ?sessionId=new-…&folderId=…: it inherited the open session's folder, grew a draft row in the sidebar, and named a chat in the URL before anything was chosen. Measured in the browser at /: the old click left ?sessionId=new-… and a new-… row; the fixed click leaves location.search === '' and no new-… row, with the landing's own workspace picker (and its disabled-until-picked composer) on screen. The folder +, New child and New Chat stay pending actions on purpose — each of them HAS a context at click time, which is exactly what the landing does not.

  • Plan and Goal are PER-SESSION modes living in the child, and setting a Goal ARMS it instead of starting it. The console never owns either mode: every transition is a /kabmo-mode <scope> <action> prompt dispatched to the live child (src/server/lib/omp/mode/request.ts), where the -e extensions/kabmo-modes copy reaches the real AgentSession, answers agentInvoked: false and writes no bubble. Plan can ride the spawn ENVIRONMENT (KABMO_MODES), so pressing Plan on a new-… chat waits in spawnSelectionRef and the first send hands it to ensure_session. A Goal uses the same seam for its own half: the modal records an intent (goalArm), the strip draws it as Armed … starts with your next message, and the record is created by the FENCE of the next prompt (executeSend → /kabmo-mode goal create with startTurn: false). Three reasons, all measured: nothing runs until the operator writes something (a goal spends tokens); that prompt IS the goal's first turn, so the transcript opens on the operator's own words; and the goal never exists with no turn to act on. The rejected alternative — a goal that spawns its session and opens its own hidden turn — was smoke-tested on omp 18.16.0 and produced a session with custom ×8, assistant ×3, toolResult ×2 and user ×0: an assistant answering a question nobody could see. The armed path was then smoke-tested on the same build: goal create with startTurn:false answered 200 and GET /api/sessions/:id/modes reported goal:true, goalLive:true, tokensUsed:0 (the record exists, nothing ran); the operator's prompt then wrote the file, the goal moved to complete at 10,773 tokens, and the transcript read {user:1, assistant:4, toolResult:3} with user first. On a pending chat the record is created by sendNewPrompt's beforePrompt hook — after the id exists, before the prompt is dispatched — so a fast turn cannot finish before its goal is recorded. A guided start is armed the same way, with one difference that decides the send: there is no objective yet (the model writes it at the end of the interview), so the operator's message is not "the goal's work" but the ANSWER that opens the conversation. executeSend therefore posts guided with message = their prompt and sends NOTHING afterwards — the extension renders its kickoff template with that text inside <rough-goal> and runs it as turn one. Measured on the same build: transcript {user:1, assistant:1}, the single user turn carried the operator's words and the assistant answered with one interview question. The smoke also found a real defect: renderPrompt ignored {{else}}, so BOTH branches of the interview's {{#if initial}}…{{else}}…{{/if}} landed in the prompt (the first run carried the literal {{else}} plus "No objective stated — ask what user wants" directly under the rough idea). prompts.test.ts pins the else branch now.

  • A phone dialog MUST keep clear of the device's own chrome, and it is ONE scroller. index.html ships viewport-fit=cover, so a fixed inset-0 frame reaches the physical edges and the top of the panel is painted UNDER the status bar: measured on the About sheet at 390x844, its box was [0,0,500,913] with no gutter and the wordmark plus the close button sat in the notch's band. src/shared/lib/ui/safe-area.ts states the four declarations once — max(0.75rem, env(safe-area-inset-*)), max() because the safe area and the gutter are alternatives, not a sum, and env() is 0 on a desktop so one rule serves both surfaces. The shared Modal shell and the About card both use it; a new dialog that writes p-6 on a fixed inset-0 backdrop is the bug again. The scroller is the dialog BODY (min-h-0 flex-1 overflow-y-auto), never a list inside it too — About capped its harness list at 46vh while the card below it was empty, and once the card got its own overflow-y-auto the inner list became a scroll trap: measured listScrolls: false, cardScrolls: true after the inner cap was removed. A position: fixed panel under a display: none or width: 0 parent is clipped entirely, which is why both shells portal to <body>.

  • A dialog rendered from the composer must PORTAL, because the composer card is a containing block for position: fixed. Measured in Chromium at 1440x900 by re-parenting the Goal dialog's real scrim into [data-composer-style]: the scrim went from 1440x900 at (0,0) — the viewport — to 710x164 at the card's box, and the dialog centred on the composer (dx -49, dy +38) instead of the screen. Any of three properties the composer can carry triggers it: backdrop-filter (the glass style's --glass-card-filter), a transform, or contain: layout; container-type alone did NOT, so an initial note blaming the @container was wrong. GoalModal therefore renders through createPortal(…, document.body), the same fix Toast, anchored-menu and diagram-viewer use, and GoalModal.test.ts pins that the scrim's parent is <body> and that it carries fixed inset-0. Verified after the fix on desktop and on a 390x844 phone: scrimFullViewport: true, dx = dy = 0 in both. The modal's two numeric fields also needed min-w-0 (min-width: auto on a flex item kept their intrinsic width and clipped the placeholders on a 358px card).

  • Toasts are ONE page-level queue with ONE host, and the delay is decided at push time from the tone and the message's own length. src/client/hooks/ui/toasts.ts owns module state (queue, pushToast, dismissToast, getToastsSnapshot); App mounts ToastStack exactly once, outside the layout switch, and every surface that raises a toast calls useToasts() for the push half only. Two properties were broken by the old shape and each one is visible: eleven ToastStack mounts (desktop layout, its left column, the chat timeline, the sessions view, the file explorer, the source-control panel, the provider pane, the projects pane, and three phone surfaces) each drew into its own fixed bottom-4 right-4 portal, so two surfaces toasting at the same moment printed two cards in the same rectangle — and the desktop alone has three of those hosts mounted at once. The 4000 ms clock restarted on every parent render: Toast's effect listed onDismiss in its deps while dismissToast was a fresh closure per useToasts render, and the chat timeline re-renders on every streamed frame, so a toast raised during a run could stay up for the whole run. The card now reads a duration fixed on the entry at push time and a stable module onDismiss, and it pauses on pointerenter/focus and resumes the exact remainder — a card that vanishes under the cursor cannot be read. The budget is a policy, not a constant (src/shared/lib/ui/toast-duration.ts): base 2500/4000 ms per tone plus 45/55 ms per character, floored at 3000/5000 and capped at 8000/12000, and a toast carrying an action waits for the decision. The lengths it is sized against are measured from this app's own call sites — 15 literal pushToast strings run 24 to 89 characters, median 54, which is 2.7 s of reading at ~20 characters a second before the reader has noticed the card. A push whose sentence and tone already sit in the queue REPLACES that entry (new id, timer restarted) instead of stacking a duplicate, and the list is bounded at three — the fourth failure in a loop falls off the top rather than covering the whole corner. Verified in Chromium at 1440x900 against a production build: one [data-toast-stack], cards 360px wide at x=1064, two cards stacked with an 8px gap and no overlap (y 793 and 843), a 62-character success card measured on screen for 5515 ms, hover held for 13 s without dismissing and the remainder running out after leaving, and keyboard focus on the close button doing the same. On a 390x844 emulated phone the same host is 358px at x=16 (the max-w-[calc(100vw-2rem)] clamp) and sits ABOVE the open session drawer (elementFromPoint answers the card). The card is role="alert" for an error and role="status" otherwise, so a failure is announced assertively instead of arriving under a check mark — and the tone owns the icon too: success is a green circle-check, warning an amber triangle-alert, error a red circle-alert, each tinted through its contrast-solved text-*-text token (TONES in Toast.tsx; the raw fill tokens drop under 2:1 on the light themes). warning exists because a partial outcome is neither a success nor a failure — a git operation that stopped on a conflict, a batch that archived 18 sessions and refused 2, a provider registered while its model list could not be read, an update the environment can only answer with a command to run (updateOutcomeTone). The tone is the caller's fact, and two calls had it wrong in opposite directions: the settings modal's every save was pushed with no tone and therefore rendered as an ERROR (the queue's default), while a failed worktree creation travelled the same success-only onWorktreeReport callback as a created one and drew a green check. The budget those tones pay is now 2500/3200/4000 ms plus 45/50/55 ms per character, floored at 3000/4000/5000 and capped at 8000/10000/12000. The two settings panes that used to draw their own absolute bottom-6/fixed bottom-6 right-6 chips now raise into this queue, which is also what stopped a save from being announced inside the dialog's own box.

  • A goal command RESOLVES, and the modal closes only on success. onGoalAction returns GoalActionResult ({ok, error?, armed?}) instead of firing and forgetting: the previous version called onSubmit then onClose unconditionally, so a refused goal closed the dialog and discarded the objective the user had just written — the refusal read as a dead button. Arming returns armed: true and the modal closes; a refusal keeps the form, its text and the reason on screen.

  • Settings → Chats is a master/detail category, and its groups are DATA (chat-settings/groups.ts → CHAT_SETTING_GROUPS, rendered by chat-settings/SidebarList.tsx and categories/ChatSettings.tsx). Seven sections used to be one scrolling column — a reader scrolled past five composer frames to reach a keyboard chord — so they are grouped Layout / Transcript / Sessions / Keyboard, and the detail pane renders exactly group.sections. Two totals keep it honest: SECTIONS in ChatSettings.tsx is a Record<ChatSectionId, …>, so a section id without a renderer is a build error, and groups.test.ts asserts every id is owned by exactly one group — a section missing from all groups is invisible in the product while its file and unit tests still pass, and one listed twice renders twice so an edit in the copy looks inert. The two panes come from the shared SettingsMasterDetail shell (as Usage, Providers, Projects do): both stay mounted at every width, and below md the phone shows the list, then the group, with a back bar — measured on 412×915, the group list is 398×53 per row, the detail 410×849 with a 26px back bar, and scrollWidth === clientWidth at every width (no horizontal overflow). chats therefore also belongs in the modal's p-0 category list, or the pane gets a p-6 frame it does not own.

  • The settings drawer's groups are ONE list (SETTINGS_SECTIONS, src/shared/lib/settings/sections.ts), imported by both the section type and the render loop. It used to be written twice — the union in Sidebar.tsx and an array beside the drawer — so a group added to one and forgotten in the other rendered NOTHING under it: no error, no empty state, and every category filed there missing from the settings drawer. HARNESSES is its own group rather than a member of OMP, because omp's group is one engine's config while that one holds other agents entirely (different transport, different config file). settings/groups.test.tsx asserts every category's group is drawn, the headings equal the declared order, and every declared label is reachable.

  • A turn is steered, never cancelled, and the binding governs which key does it. Ctrl/Cmd+Enter (or whichever keybindingSteering names) submits through steerOmpAgent → OmpAgentHandle.steerOmpRun → POST /api/agent/:id {type:'steer'}, which delivers INTO the running turn (omp answers one agent_start/agent_end pair; abort_and_prompt produces two and throws the watched answer away). Verified against the real spawn path with the scripted child: the frame reaching the child is {"type":"steer","message":"…"}, a steer while the session is idle is refused 400 session_idle, and followUpBehavior: 'steering' makes even a plain mid-run Enter steer instead of queueing.

  • A running subagent is steerable and stoppable, from the roster and from its transcript. cancel_subagent / steer_subagent are omp RPC verbs that act on ONE subagent without touching the parent turn, wired through sessions/subagent-control.ts (POST-only, id validated against the same grammar the transcript path derivation uses) and the PASSTHROUGH_COMMANDS set. The id is the ROSTER id the session file and get_subagents both report — measured on 18.8.3 it is a slug (Sleeper, ListOmpws), NOT a uuid, and the subagent_progress frame carries no id at all, so the roster is the only source. Both routes answer 409 session_not_running for a session this process does not manage, because a subagent is by definition something the session's own child runs — the spawn path must never boot a child to answer "stop that". The UI is SubagentControls (a steer box plus a stop button, rendered in place of the transcript's composer ONLY while the subagent runs) and a stop button on each roster row, which is a SIBLING of the row's own button rather than nested inside it (a button in a button is invalid and swallows the inner click).

  • The subagent badge is a streaming probe over the parent transcript, and its verdict is SAVED per file version. sessionHasSubagents (src/server/lib/omp/session/subagent-presence.ts) answers one bit for every sidebar row, and it used to answer it by materializing the whole transcript through extractSubagentHistory. Measured on this machine's agent directory (1 349 files, 2.0 GB): one cold sidebar load read and parsed 1 380 MB, and because Bun keeps the freed arena the process went RSS 233 MB → 1 148 MB after a single console load (physical footprint 62 MB, Bun.gc(true) returning nothing, so the sweep logged swept 1049 MB → 1050 MB for hours). The probe now reads the sibling artifacts directory first (one stat + one readdir), then streams the parent and stops at the first roster entry it would have upserted (subagent-presence-scan.ts, same admission rule as history/fold.ts — verified against extractSubagentHistory on 170 real files, 0 disagreements), and saves the answer in session_subagent_presence keyed by (path, lastEntryAt:siblingMtime). Re-measured: cold sidebar 17.6 MB read / 1.7 s, the same load after a restart 0 reads / 33 ms, console load after boot 388 MB (first boot) and 286 MB (restart, saved verdicts) against the old 1 148 MB. The probe never OPENS a database — it uses getDbSync() and treats a miss as "scan", so a unit test or a route that has not opened the store cannot create one. A sibling .jsonl is not a subagent transcript by extension. omp writes changes.jsonl (the tool-call log) into the same directory, so the extension check made every session that ran a tool claim a subagent — measured on 5 sessions in -projects-kabmo, each holding a changes.jsonl and no subagent transcript, all drawing a chevron whose branch was empty (the roster comes from the parent's task toolResults, and there are none). The probe now requires the file's session header to name a parentSession (siblingDirHasSubagentTranscript), and the saved verdict is keyed with a rule version (v2:) so a true written by the old rule is not read back after the fix.

  • The subagent transcript renders the chat's own footer, in whichever variant the chat is in. SubagentView passes isMobile down to RunFooter, so a phone gets the same compact row the main agent gets — provider • model • thinking inline, everything else (date, duration, tokens) behind the three-dot sheet — instead of the desktop row it used to draw. showActions={false} (and userActions={false} on its message rows) is the same rule the BTW panel follows: Retry / New-chat / Undo act on the CHAT, and this view owns no chat turn, so they would be dead buttons. The thinking level must come from the CHILD, never the parent session — a subagent routinely runs at a different level than the chat that spawned it. Two sources, because the two paths carry different data: a live child reports progress.resolvedThinkingLevel (omp's AgentProgress; parseSubagentProgress reads it), while an on-disk transcript records it as a thinking_level_change entry that convertMessages walks and stamps onto each non-user row (mirrors the server's loadSessionMessages). Note the frame shape: subagent_progress nests the AgentProgress under payload.progress and puts no id on the wrapper, so readSubagentProgressFrame unwraps it — reading the wrapper alone silently dropped every field the frame reports, including the resolved model. That reader is shared by the roster, the transcript hook and the server's liveness fold.

  • Editor Panel: opened-file tabs and code editing (src/client/components/workspace/editor/).

  • The document viewers are ONE grid, and the grid behaves like a spreadsheet, not a table (viewers/DataGrid.tsx, GridRow.tsx, client/hooks/editor/use-grid-selection.ts, shared/lib/fs/grid-selection.ts). CSV and workbooks share it, so the two cannot drift on the sticky header, the frozen row-number gutter, the truncation notice or the selection. Selection is ANCHOR + FOCUS, not one cell: a plain click collapses both, a drag or a shift-click moves only the focus, and the drawn range is the rectangle between them — the shape a single selected cell cannot express. Copy writes TSV with CRLF and quotes any field holding a tab, newline or quote, because that is what Excel, Numbers and Sheets paste as cells; a paste is REFUSED in words, because neither viewer has a writer and a silent no-op reads as a broken clipboard. Pointer events are delegated from the scroller and each row is memoised: a 2000×100 sheet is 200 000 cells, and per-cell handlers plus a full re-render per pointer move is what made dragging feel hung. .xls is read by SheetJS, the only maintained BIFF reader (read-excel-file reads OOXML only), installed from SheetJS's own 0.20.3 tarball because npm's xlsx is a stale 0.18.5 with published advisories; measured cost is +376 KB minified on a 13.8 MB client bundle. The sheet tab strip is drawn even for a one-sheet workbook: the sheet NAME is the one structural fact the grid cannot show, and a strip that appeared only at two sheets made the first sheet look like the whole file.

  • A cell is edited in place, and the two viewers save through different paths on purpose (viewers/use-cell-edit.ts, use-grid-interaction.ts, CsvGrid.tsx, SheetView.tsx, workbook.ts, client/lib/editor/workbook-drafts.ts, client/hooks/editor/save-bytes.ts). Double-click (or Enter, or typing a printable key) opens an input inside the cell; Enter/Tab commit and move, Escape cancels, a click elsewhere commits, and a commit that changed nothing is not reported — otherwise every glance at a workbook would mark it dirty. CSV edits are TEXT edits: the table is serialized (serializeCsv, minimal quoting, trailing empty fields dropped) and handed to the tab's ordinary onChange, so the dirty dot, autosave, conflict guard and toolbar Save are the same ones every text file has. Editing is refused when the parse was CAPPED, because writing the first 2000 rows back would drop the rest. Workbook edits are BYTES: the edit writes one cell into the reader's own SheetJS workbook (so untouched sheets, formulas and number formats survive), the edited workbook is kept in a draft keyed by path so a tab switch does not lose it, and Save serializes it back into its own container and posts it as a Blob through a new saveBytes action — a multipart TEXT field is UTF-8 and normalizes line endings, which corrupts a ZIP. The tab's dirty flag is setBinaryDirty (a workbook has no text buffer), so the close guard warns. The save is lossy in one direction and the strip says so while dirty: SheetJS writes values, formulas and number formats; styling, charts, images and pivot tables are not part of what it reads, so they do not survive a rewrite.

  • A .drawio file is drawn by @dskripchenko/drawio, and the adapter around it is the only part Kabmo owns (viewers/DrawioView.tsx + viewers/drawio-pages.ts). The library is MIT, has no runtime dependency and no DOM, and reads both page encodings — inline <mxGraphModel> and the base64+deflate one the desktop app saves by default — so the viewer is a pure string → SVG pass that runs unchanged under bun test. The safety argument lives there and is covered by its own tests: HTML labels become styled text runs, colours are validated, javascript: links are refused, external images are not loaded unless asked, and a compressed page is capped so it cannot expand without bound. The adapter adds the three decisions that are Kabmo's: every page is drawn (a five-page file must not silently show page one), each page gets its own id namespace (idPrefix, because the same file can be open in two tabs and a shared namespace makes the second SVG's url(#…) resolve to the first one's definitions), and the renderer's warnings are printed under the page — a vendor stencil is drawn as a labelled placeholder, and saying so is what keeps the picture from being read as the file's own content. The kind is drawio in document-kind.ts with RENDERED_VIEWERS.drawio = true — the file is editable XML, so the eye toggle switches source ⇄ diagram with no second fetch, and the phone's editor gets the same surface through the shared ViewerSurface dispatch. Measured: 47.6 KB minified / 17.9 KB gzip in the client bundle, against 1.2 MB / 200 KB for the GPL drawio2svg and 517 KB / 141 KB for a minimal @maxgraph/core viewer. Zoom, pan, fit and the footer controls come from common/zoom-pan-stage/ — the same surface an image gets, extracted when the drawio viewer needed it: a diagram and a picture are one interaction (fit once, wheel zoom, drag to pan, double-click toggles fit/100%, +/-/0 on a focused stage) and two copies of that arithmetic is how the two drift. Two behaviours the stage owns and a caller cannot: it re-fits when the STAGE resizes while the user has not zoomed (the editor column is 320px when a file opens and full-screen a click later — measured, the drawing sat at 12% in the wide one), and it re-arms that fit for new CONTENT of the same size, because two 632×252 diagrams in one session otherwise share the first one's zoom.

  • Both editors draw the same type, from one module (src/shared/lib/code/editor/typography.ts). The desktop editor and the phone's full-screen editor are the same surface on two layouts, so face and line box are shared while padding and gutter width stay per-layout. They were not: the stack was written out as a literal twice in the desktop editor and replaced by a bare monospace on the phone, which dropped Fira Code and put the phone's line numbers in a different face from the code beside them — the gutter was already font-mono. Two further drifts went with it: the phone used a px line-height (20px) that does not scale with the zoom control, so at 18px the rows were cramped and at 10px loose, and it pinned the gutter to text-[10px] and a fixed w-10 while the code scaled, clipping a 3-digit line number at the top of the range. The line box is a ratio (EDITOR_LINE_HEIGHT) applied to the editor and its gutter — with word wrap off the gutter rows carry no explicit height and take their spacing from their own line-height, so a gutter pinned to a different value drifts out of register with the lines it counts. The zoom bounds are shared too (8–24px), because a phone clamped to a narrower range is a different editor, not a smaller one. Verified in the browser on the CodeMirror surface: at 12px both layouts measure Fira Code / 12px / 18px on .cm-content, .cm-line, .cm-gutters and a gutter element, and zooming to 18px moves all four to 18px / 27px; the clamp stops at 8 and 24 on both. The type is INHERITED by the editor rather than restated in a CM6 theme: the host element carries family, size and line box, and .cm-editor inherits — a theme extension carrying a pixel size would have to be reconfigured on every zoom step, and a reconfigure re-creates the editor's plugins (including the tokenizer).

  • The editor surface IS CodeMirror 6, and Shiki stayed the tokenizer. code-surface/ (index.tsx + extensions.ts, handle.ts, shiki.ts, keymap.ts, theme.ts, documents.ts, marks.ts, fold.ts, bracket-guide.ts, stream-language.ts) replaced a transparent <textarea> over a Shiki-highlighted <pre> plus Kabmo's own windowing, wrap measurement, undo stack, multi-cursor replication, find matcher and gutter geometry — measured on a 4 800-line file, one keystroke cost 59.6 ms median before and 0.2 ms after, flat from 8 000 to 20 000 lines (the surface renders ~54 .cm-line nodes at 20 000). The palette is not CM6's: a lezer grammar build would cover 48 of the 59 ids shiki-langs knows and paint a second palette, while the chat timeline, diff panel, wiki reader and markdown preview all render through highlightCode — so a ViewPlugin tokenizes view.viewport (+40 context lines, 12 000-char line bail-out) and emits Decoration.mark carrying Shiki's --shiki-light/--shiki-dark pair, which makes a theme switch CSS-only. CodeSurfaceHandle is unchanged, which is what kept the find widget, outline jump, line jump and search reveal working without knowing about CM6. Three facts in that stack are load-bearing and each was a bug first. The per-tab EditorState cache (documents.ts, applied with view.setState) is what gives a tab its own caret and UNDO HISTORY — a single buffer meant ⌘Z after a tab switch undid an edit in the file the user was no longer looking at — and it is LRU-bounded at 12, because a history holds whole-document snapshots. languageData must return an object KEYED by the data name: languageDataAt looks the name up in each provider's result, so returning the tokens bare (() => [{ line: '//' }]) yields an empty list, toggleComment returns false, and ⌘/ silently does nothing — measured in TypeScript and YAML with no error anywhere. CM6's defaultKeymap is appended after the generated bindings: it is what makes Enter, Backspace, arrows, Home/End and word-wise movement work at all, and appending it is what keeps a chord the table claims from being shadowed. Read-only is BOTH facets (readOnly stops the commands, editable(false) stops typing); a viewer takes both. applyDocument must NOT be silenced as an external write: the writingRef guard exists so a write that came FROM the parent does not echo back through onValueChange, and a find-bar replace is a USER edit — suppressing it left the parent holding the pre-replace buffer, so the autosave never saw the change and the next render compared the stale value against the document and wrote the OLD text back (measured: replace-all, switch tab, come back → the original text, and nothing on disk).

  • The editor reads three config formats, bands conflict markers, and says when it is empty — all three are viewport work, not document work. code-surface/lint.ts + lint-parsers.ts install linter() + lintGutter() for json/yaml/toml only, and the parsers arrive through literal import() (yaml 32.3 KB gzip, jsonc-parser 6.8, smol-toml 6.9 — 46 KB the README tab must not pay, the same trade stream-modes.ts records); JSON is parsed STRICT (disallowComments), because a lint that blesses a comment in tsconfig accuses nothing and the toolchain refuses the file, and json5 is excluded outright since it accepts what JSON rejects. Two diagnostics at one offset are collapsed to one — measured: a trailing comma is reported as both PropertyNameExpected and ValueExpected at the same character. code-surface/conflict-markers.ts bands <<<<<<<, ||||||| and >>>>>>> with Decoration.line, deliberately NOT ======= (a Markdown setext underline and this repository's own comment headers would paint a conflict band in unconflicted files), and the walk is its own viewport loop rather than MatchDecorator — measured in a real browser, a Decoration.line returned from MatchDecorator's callback is placed over the MATCHED RANGE and rendered the marker lines as blank <br> rows while the document still held their text. Both editor status strips print ⚠ N conflicts from countConflicts, which counts a marker only at a line start ("a <<<<<<< b" is a string literal, not a conflict). An empty buffer draws placeholder() (This file is empty), and EditorView.exceptionSink reports a throwing plugin through reportEditorError (src/client/lib/editor-errors.ts, deduped per message over 5 s) into a toast — subscribed from useToasts, which every toast host already calls, so no shell can forget it; the event is CLAIMED by the first listener because several hosts are mounted at once and one report produced three toasts before that.

  • A stream language makes bracket matching token-aware, and the pair GUIDE draws the span the highlight cannot. stream-modes.ts maps 48 of the 59 Shiki ids to a @codemirror/legacy-modes mode, loaded lazily through literal import() specifiers and installed into a per-document languageCompartment. Lezer grammars were measured and rejected: javascriptLanguage alone is +39 KB gzip, the whole lang-* set covers 24 of 59 languages for +439 KB, and — the decisive fact — a lezer tree is LAZY, so bracket matching is WRONG until the parse catches up (3 wrong pairs at mount on a 176-line file, and 2 still wrong on a 337-line one after a full parse, Toolbar.tsx:97). A stream mode is ~1 KB, and its tree exists synchronously: the same 176-line file is 0 wrong pairs at mount. The loader must be a literal specifier, one import() per entry — a template literal (import(\…/mode/${name}`)) builds fine and then NEVER resolves at runtime in the dev server, which rewrites it to hmr.dynamicImport('@codemirror/legacy-modes/mode/${ref.module}')with the placeholder unsubstituted. Measured in the browser: the mode silently failed to load, the surface stayed textual, and no console error was logged. The pattern is the repo's ownLANG_LOADERS. **STREAM_MODE_EXPORTSis a second table because the export name is not derivable from the Shiki id** —scssissCSS, objective-cisobjectiveC, dockerfileisdockerFile, and javascript/clike/sqleach ship several modes from one module. **The compartment is installed BEFORE the manuallanguageDatatable**, becauselanguageDataAtreturns every provider's answer in order and the commands take the FIRST: measured, a wrong manual## entry won and commented a Rust line until the mode went first. **bracket-guide.ts draws the vertical rule from the caret's brace to its pair** (Decoration.lineper row,--bracket-guide-colcarrying the column of the pair's LEFTMOST brace — one straight line cannot meet two braces in different columns, andconst v = merge(base, {opens at 30 while its closer sits at 0, so taking the minimum is what makes the rule land on a brace rather than float above nothing. The column iscountColumncells, not code units, because CM6 writestab-size: state.tabSizeon.cm-content; and the CSS offset adds --surface-padback, because an absolutely-positioned::beforeresolves against the line's PADDING box while the glyph starts inside it — measured before that fix: the rule sat 16px left of the brace it named). Blank lines get no guide (the gap is the signal), a one-line pair gets none (nothing to connect), and a span pastMAX_GUIDE_LINES(400) is refused rather than drawn. It reads the samematchBracketscallbracketMatching()makes, so the line and the highlight cannot disagree. Verified in Chromium: on a 16-line nested file the guide covers 11 rows at column 37 with--theme-infoat 45%, and with the stringconst s = "}";inside the block the guide runs PAST it to the real closing brace; a caret placed exactly on that string brace paints **no** highlight and **no** guide, which is the token-aware answer the textual matcher cannot give. Pinned bybracket-guide.test.ts(the pair, the columns, the blank-line and cap rules, every mode loader resolving to a real mode object, and the two language sets covering all 59 ids) andstream-language.test.ts` (the compartment keeps the document and the undo history, and the mode's tokens come first).

  • Folding and bracket matching ship WITHOUT a grammar, and that choice is what makes them work in 59 languages instead of 19. code-surface/fold.ts registers a foldService that answers from INDENTATION (vim's foldmethod=indent): a line folds up to the last following line indented deeper than it, blank lines never end a block, and the opener stays visible because the range starts at line.to. foldGutter() — not codeFolding() — is the entry point, because the gutter brings the fold STATE field with it: a foldEffect dispatched into a state that has no foldState is discarded with no error (measured: no placeholder, no throw), which is the failure that would look like a working gutter that does nothing. bracketMatching() is the other half and it is TEXTUAL here, which is a trade stated rather than hidden: with no lezer tree it pairs by scanning, so const a = "{" and const c = "}" are paired 28 characters apart. A token-aware answer needs a grammar (115 KB gzip for lang-javascript alone) and matchBrackets costs 0.008–0.04 ms per caret move, so the wrong answer is cheap and confined to braces inside strings. The cap on the fold scan is a cost bound, and it REFUSES rather than truncates. The scan walks forward until the indentation dedents, so a generated JSON that is one 500 000-line block would be walked on every gutter line the reader scrolls past — measured 74.6 ms per call unbounded, 0.50 ms with MAX_FOLD_LINES (5 000). Past the cap the answer is null (no marker, no fold), because a range ending at an arbitrary line is a fold the reader never chose; a block that reaches the END of the document is not capped and still folds. Two theme facts were measured, and each fails silently. The bracket rules must spell the focused form &.cm-focused .cm-matchingBracket — the package's own is .ͼ1.cm-focused .cm-matchingBracket (specificity 0,2,0), so a bare .cm-matchingBracket here is (0,1,1) and loses, leaving CM6's hardcoded #328c8252 in a themed app. And border: 1px solid var(--x) is a shorthand style-mod tries to EXPAND and cannot parse — it emits border-width: var(--x); border-style: var(--x), which paints nothing — so cm-foldPlaceholder declares borderWidth/borderStyle/borderColor separately. Read-only viewers still fold (verified), folds survive a per-tab setState round trip and map through edits, and the four chords are CM6's own foldKeymap rows (⌥⌘[ / ⌥⌘] / Ctrl-Alt-[ / Ctrl-Alt-]), added to EDITOR_KEY_BINDINGS and PALETTE_ORDER so the palette cannot advertise a chord nothing binds. Verified in a real Chromium against an isolated MOCK server: the fold gutter renders 4 markers on a 16-line nested file, a click took 17 rendered lines to 5 with the … placeholder, clicking the placeholder restored all 17, ⌥⌘[ folded and ⌥⌘] unfolded (including the “ character macOS actually reports for Option+[), and the caret beside a { painted both { and } with the background resolving to --theme-info (rgb(2,132,199)) rather than CM6's hex. Pinned by fold.test.ts (the rule, including the cap and the per-language samples), fold-stack.test.ts (the mounted stack: the state field, CM6's foldable() agreeing, a real gutter marker, a read-only fold, and the bracket classes) and theme.test.ts (the focused-rule specificity and the longhand declarations).

  • useFileTabs closes the previous workspace's tabs on a root CHANGE, and on nothing else. The editor column's tab list is per session and restored from the blob, so the wipe exists for exactly one event: the user moved to another workspace, whose files must not stay open. Two other arrivals look like that event and are not, and each cost a measured bug. A null root is not a root — activeProjectPath is derived from the sidebar's folder list, which is empty for a beat on every load and again whenever the structure topic re-subscribes, so wiping on it closed the tabs the user had just opened (the reported "the file I clicked vanished and the editor says Select a file to open", and the rare outline.e2e.ts failure). The FIRST known root is not a change either — it is the workspace the page was already showing, so wiping on it discarded the tabs the session blob had just restored; that is why editor-scroll.e2e.ts had to gate every tree click on the /state response, and why a click that lost that race left the editor blank. file-tabs.test.ts pins both directions (a transient null keeps the tabs, a different root closes them).

  • A blob that arrives after a write made DURING its read must not discard that write. loadSession merges local keys over the response for two separate reasons and needs both: dirtySessions covers a write whose persist has not landed, while a write whose persist HAS landed clears that flag and would otherwise be adopted away by a response computed before it — measured as a file opened during the page's first /state read coming back with layout.openedFiles gone. The store therefore records a monotonic counter per (session, key) write and merges exactly the keys written after the read STARTED; a key the local side no longer holds was CLEARED in that window, so the response's copy is deleted rather than restored. store.test.ts pins the three shapes (written, untouched, cleared).

  • A dropped file OPENS; it is never inserted into the buffer — and that needed a capture-phase claim, because CodeMirror handles drop itself. handlers.drop in @codemirror/view reads each dropped file's TEXT and inserts it at the pointer, then calls preventDefault — so the panel's own onDrop saw defaultPrevented and stood down. Measured in the browser: dropping b.ts on an open a.ts put b.ts's text at the top of the buffer and the debounced autosave wrote it to disk, while the overlay had promised "Drop a file to open it". useEditorDrop therefore also returns captureDropProps (onDropCapture), spread on the same element as dropProps; it claims ONLY a drag over [data-code-surface] (the attribute CodeSurface sets on its host), so a drop on the composer stays the composer's and a text drag is still CodeMirror's to insert. use-editor-drop.test.ts pins all three directions (claimed on a surface, untouched elsewhere, a text/plain drag ignored).

  • A dropped file opens on a desktop shell too, and there the page has to ASK the shell for the path. Measured on macOS 27 by delivering a real Finder pasteboard into a WKWebView: types ["Files"], files [File], getData('text/uri-list') and getData('text/plain') both empty, File.path undefined, and DataTransferItem.getAsFileSystemHandle undefined. Both of useEditorDrop's routes are therefore dead there — WebKit implements no File System Access API (bug 257792), and it stopped adding local filenames as URLs to a file drag (changeset 222257), so /api/fs/scope is never asked either — and every Finder drop on the macOS shell was refused with "that drop carried no readable file" while the SAME drop attached fine in the composer, which only needs the bytes. That asymmetry is why it read as an editor bug rather than a missing capability. DropWebView (packages/macos/Sources/KabmoDesktop/DroppedPaths.swift) reads NSFilenamesPboardType (falling back to public.file-url) in performDragOperation before calling super, and the page asks for it with dropped_paths (client/lib/desktop/dropped-paths.ts); measured, the injection lands ahead of the DOM event so the handler sees the answer. Three rules are load-bearing. super is still called and its value is the return — the page needs the DOM event to know WHERE the drop landed (editor column, composer, code surface) and the composer attaches from the payload's bytes, so swallowing the drag would fix the editor by breaking the chat. The answer is CONSUMED once (and cleared by draggingExited): a drag released over no target leaves the record unread, and answering it to the NEXT drop reopens a file the user abandoned. The page age-checks it (SHELL_DROP_TTL_MS, 2s) because it asks in the drop's own turn, so anything older is a leftover. The other two shells do NOT need it and do not implement it — WebKitGTK preloads text/uri-list for a file-manager drag, and WebView2 is Chromium where the file-system handle exists — so the bridge read fails there and the drop's own payload decides. Pinned by use-editor-drop.shell.test.ts (the shell path opens the file, a handle still wins, an in-page drag is still reported, a stale answer is refused) and packages/macos/TestsWindow/DroppedPathsWindowTests.swift (a real drag into the real DropWebView: the DOM event still arrives with bytes and no URI list, the shell captured the path, the second ask answers nothing, and a drag that leaves clears it).

  • The find widget's count and the bytes Replace writes come from ONE regex compiler, and the flags are the reason. The scan runs through CodeMirror's RegExpCursor, which compiles the pattern source with gm (+ u), while buildFindRegex used a bare g/gi — so the two ends answered differently on ordinary queries. Measured before the fix: ^foo counted 2 matches on a three-line file and Replace All rewrote only the first (no m); \p{L}\d matched three times and replaced ZERO (without u a property escape is a literal p); \- was called invalid by the scan while Replace All edited the file with the non-unicode reading. BASE_FLAGS (gm + u where the engine has it) is now stated once in find-scan.ts and every path reads it, and a zero-width match is skipped by the write exactly as it is uncounted by the scan (^ under "No results" used to insert at every line start). find-replace.test.ts asserts the two ends together rather than one engine in isolation.

  • insertLineAbove keeps the line's indentation. CM6 has no command for it, so the surface implements it — and a bare newline above an indented line left the caret at column 0, putting the next typed character outside the block. The new line carries the current line's own leading whitespace and the caret lands after it, which is the rule the textarea surface applied and what CM6's own insertBlankLine derives from IndentContext for "below". keymap.test.ts drives it through runSurfaceCommand (the palette's own path in) against a {state, dispatch} stand-in.

  • Whitespace is drawn on the SELECTION, and nowhere else. code-surface/whitespace.ts marks a dot per space and an arrow per tab in the text a reader has selected — VS Code's editor.renderWhitespace: 'selection', its default — and a bare caret paints nothing at all. Both alternatives were built and rejected on sight: the package's highlightWhitespace() ('all') marks every space in the viewport, and a leading-run-only mark ('boundary') is a permanent dotted layer over every block, competing with the code it was meant to explain. Two bounds keep it cheap: an empty selection range is skipped (so thousands of ⌘D cursors cost nothing) and the walk is the selection INTERSECTED with the viewport (so ⌘A on a 20 MB file costs the rendered lines). The plugin rebuilds on docChanged || selectionSet || viewportChanged — the middle one is what makes the click that collapses a selection clear the marks instead of leaving the last painted set on screen. One mark per CHARACTER, not per run: a mark's box is what the CSS paints, and a single span over four spaces holds only one dot. Both marks restate var(--editor-fg, var(--theme-ink)) instead of the package's hardcoded #aaa/#888, because that grey is chroma the palette does not own and it disappears against a dark editor theme; the tab arrow is a CSS MASK rather than a background image, since an SVG inside url() is its own document and resolves currentColor to black. Per-level INDENT GUIDES were built and then deleted: the vertical rules read as structure the file does not have. The bracket pair guide is a different feature and stays — it draws one line between a brace and its match, driven by the caret.

  • Line blame is ONE whole-file read per tab, never one read per hover, and the cache key is the answer. lib/fs/git-blame.ts runs git blame --porcelain once for the file and the editor answers every line from that payload; blame-panel.ts draws the card and blame-hover.ts owns the trigger. Measured on this repository: one blamed line costs 10–20 ms warm but 39 ms average over 20 sequential calls — a reader hovers a dozen lines a minute — while the whole file costs 30–110 ms once (34 KB raw for a 336-line file, 10 KB after the parse drops the document text) and 0.4–0.5 s at 20 000 lines. --porcelain reports each commit's metadata a SINGLE time (295 content lines carried 5 author records), so the payload is already compressed; --line-porcelain is 3.1× larger for nothing. The key is (absolute path, mtime, HEAD sha) because all three change the answer: an autosave shifts every line number, and a commit the agent makes while the panel is open changes every author. runGit's default 1 MiB maxBuffer would TRUNCATE the answer silently — --porcelain measured 1.7 MB at 20 000 lines — so the read asks for 16 MiB and refuses a file over 8 MiB outright.

  • A dirty buffer shows NO labels, and the card says why. An unsaved edit shifts every line number, so a label naming the previous author is not stale, it is WRONG — and the panel's own isDirty is the flag that decides it, because the editor's document moves a render before the controller hears about it. The controller therefore refuses to read while dirty, the labels disappear on the first keystroke, and the card answers "Not committed yet / This line changed in the editor" for the gutter instead of naming a person. A re-read that returns the SAME payload object is a cache HIT and cannot describe the edit either, so the label field clears its stale flag on a new IDENTITY, not on any notification.

  • The hover target is the label AND the gutter's line number. The label only exists on a run's first line and never for an uncommitted line — precisely the line a reader asks about — so the gutter is the second target: it exists on every rendered line and is what VS Code anchors blame to. The listeners sit on view.scrollDOM, not contentDOM, because the gutters are SIBLINGS of the content inside the scroller: a listener on the content never sees a line number (measured — the first version's gutter hover did nothing).

  • The answer reaches the labels through a state FIELD fed by a bridge plugin, not by a plugin reading the controller. Replacing a plugin's decorations outside a transaction leaves the DOM showing the previous set — measured in the component test, a fresh payload produced no labels at all until an unrelated transaction ran. So blame.ts subscribes to the controller and dispatches the payload as an effect, and the field's create reads the controller directly so a document opened with a cached answer draws on the first paint (a plugin cannot dispatch during the view's construction: CM6 throws "Calls to EditorView.update are not allowed while an update is in progress").

  • log -L is a SECOND read, asked for only when the reader opens the line's history. It costs 22–78 ms against a blamed line's 10–20 and answers the different question ("who created it" rather than "who touched it last"), so it is not part of the payload — ?blameHistory=1&line=N fetches it on demand and the controller caches it per line.

  • The card is mounted on document.body with position: fixed, so the editor's scroller cannot clip it — and it does not follow the text. A card that moved under a pointer reading it would be worse than one the reader's own scroll dismisses; every close condition lives in blame-hover.ts (Escape, a press outside, a document change, a pointer that left both) because a card that outlived the line it describes is worse than no card. It is a dialog to a screen reader and it stops mousedown from reaching the document, which is what makes its text selectable.

  • The label is a Decoration.widget, never a Decoration.mark. A mark is part of the document: the caret can land in it, ⌘C copies it into a pasted snippet, and a replace-all would rewrite it. Decorations are built for the VIEWPORT plus 40 lines of context, because one widget per run on a 20 000-line file is 2 249 extra DOM nodes laid out on every scroll.

  • Six states, and only ONE is an error. A dirty buffer, a line past the end of HEAD, an untracked file and a folder that is not a repository are all ANSWERS ("nobody yet"); painting them red would make an ordinary state look like a failure and teach the reader to distrust the one case that is one. git's own sentences are what the panel prints (measured: fatal: no such path 'x' in HEAD for an untracked file, fatal: Needed a single revision for an unborn HEAD, fatal: not a git repository … outside one).

  • Two settings, and the label is OFF by default. editorBlame (the card and the read) defaults on; editorBlameInline defaults off because the label sits at the END of a run's first line and the editor panel's floor is 320px, where it turns a long line into two. Both reach an open editor through omp:editor-blame-changed, the same shape the font, theme, indent and typing settings use, and the toolbar's toggle writes the same blob key the Settings row does. The extension lives in a COMPARTMENT, so pressing the toggle reconfigures rather than re-mounts — a re-mount would cost the open tab its undo history for a reading aid.

  • The phone's editor is select-text. The full-screen sheet's root is select-none (it is a header-and-status layout), and the code surface is now a contenteditable whose selection and caret belong to the browser — an inherited user-select: none is the one thing that can take both away on a device. The desktop pane already carried the class; the phone's surface did not.

  • A text file's ceiling is 32 MiB, and it was measured rather than chosen. The old number was 5 MiB and its justification died with the <textarea> it was written for ("well below the size at which a textarea stops responding"). Re-measured on the assembled app — a generated source file, Files panel open, Chromium: 5 MB opens in 99 ms at 17 ms/keystroke, 10 MB 147/32, 20 MB 212/34, 30 MB 323/39, 40 MB 283/45, 50 MB 372/72 with a 1 078 MB JS heap for ONE tab, and 64 MB never finishes loading. The curve is flat to 40 and breaks at 50, so 32 MiB is the last size with a comfortable margin below the knee. EDITOR_MAX_BYTES_BY_EXT still overrides per extension and the two document ceilings are INDEPENDENT of it — the text one is now ABOVE the PDF one, which is fine because they answer different questions (a text buffer is held for the life of a tab and re-posted on every save; a PDF is streamed to Chrome's viewer and never buffered) rather than ranking a shared budget. A test that writes EDITOR_MAX_FILE_BYTES + 1 and expects the PDF branch must use a PDF-sized number instead: "past text, under PDF" stopped existing. editor.e2e.ts opens a real 6 MB file and saves an edit, so the constant and the route cannot drift.

  • Two costs had to come out before that ceiling was reachable, and both were linear-in-file-size work paid PER KEYSTROKE. (1) syncExternal compared the parent's value against doc.toString() on every render — a full stringify of the document, and the parent re-renders on every keystroke, so a large file paid it twice per character (measured in Bun: 7.2 ms at 20 MB, 13.7 ms at 30 MB). It now compares against lastValueRef, which the update listener and the function itself keep in step with what the DOCUMENT holds, so the usual case is one reference check; the browser showed the knee moving 67 → 39 ms at 30 MB and 83 → 45 ms at 40 MB. (2) The outline scanned AND rendered every declaration on every keystroke — see the bullet below.

  • The outline is bounded twice, because a large file's outline is not a long list, it is a DOM. Measured on a 10 MB source with 63 618 declarations: 446 308 DOM nodes, 415 MB of JS heap, and 953 ms per keystroke while the Files panel was on screen (the editor's own cost is 34 ms), with 2.7 s to expand the section. shared/lib/code/outline/rows.ts holds both bounds, and each answers a different question. MAX_OUTLINE_ROWS (500) caps the ROWS, with the count badge reading 500/63,618 and a line under the list naming what is not shown — an outline is a map you scan or jump from, so the window is the TOP of the file in source order, never a sample. MAX_OUTLINE_SCAN_CHARS (8 MiB) skips the SCAN, because it is one blocked stretch of main thread after each typing pause (38 ms at 1 MB, 160 at 5, 262 at 10, 519 at 20) and half a second per pause is not worth a list nobody reads; the panel says the file is too large to outline instead of showing an empty list, which would read as "no declarations here". The scan is also DEBOUNCED (useOutlineView, 300 ms): it walks the whole buffer and the buffer changes on every keystroke, so a live scan charged the walk to typing (704 ms/keystroke at 10 MB live against 34 ms without). A different DOCUMENT scans immediately — rows from the previous file point at lines of a document that is gone — and the timer is not armed at all past the scan ceiling, where the sentence never changes. Verified end to end: 10 MB with 63 618 symbols went from 953 ms/keystroke and 446 308 nodes to 33 ms and 4 495 nodes, and 20 MB from 519 ms of blocked main thread per pause to none.

  • A markdown preview turns the outline into a TABLE OF CONTENTS, and the mode is the document's own preview flag. The list is one component (OutlineSection) fed by one published document (EditorDocument.preview), and what a row DOES depends on which of the two views is on screen: in the SOURCE it is a symbol outline whose row publishes a LineRevealRequest (caret on the declaration, name selected); in a RENDERED markdown page it is a contents entry whose row publishes a HeadingRevealRequest and scrolls the page to that heading — the reader stays in the preview. The previous behaviour forced the source view open to satisfy a line request, which threw the reader out of the document they were reading (the reported "kenapa pindah ke edit"). Two stores, not one with a mode flag: the requests name different things and are served by different surfaces, and one editor holds both at once (a markdown tab toggles between them) — the same reason line-reveal is separate from search-reveal. The heading match is by NORMALIZED text plus OCCURRENCE (shared/lib/markdown/headings.ts): the row's name is the source's spelling (Hello **world**) and the rendered heading prints Hello world, so a raw comparison matches nothing; duplicate ## Notes headings are ordinary and a plain find always answers the first, so the nth row goes to the nth heading. The ordinal is the FALLBACK, never the first choice — inline markup that normalizes differently from what the renderer printed is one heading off rather than an inert click. findHeadingIndex is the single matcher, used by the desktop panel's jump (useHeadingJump) and the phone's sheet (MobileOutlineButton), because a second copy is how one of them lands on the first Notes forever. The scroll is a RECT delta, not offsetTop: the preview scroller is overflow-auto but not positioned, so a heading's offsetTop measures against whichever ancestor happens to be positioned. It also cancels the tab's pending scroll restore (cancelScrollRestore), or the replay that runs for ~600 ms after the document opens writes the remembered offset back over the jump. A request neither the surface nor the document can serve yet stays PENDING, never cleared: a source view answers line requests, and the preview's headings land a frame after its scroller, so clearing on "not now" loses a click that was about to be servable — the rule useLineJump already applies to a missing surface. The row's accessible name drops its line number in a preview (Heading Second Section, not … , line 9): a rendered document has none to name, and the number would describe a document the reader cannot see. Pinned by headings.test.ts (normalization, occurrence, ordinal fallback), use-heading-jump.test.ts (which heading was chosen, where scrollTop landed, the pending rules), use-editor-document.test.ts (only a MARKDOWN preview publishes the flag — a CSV grid and an SVG picture are rendered too but their rows are not headings), OutlineSection.test.tsx and OutlineButton.test.tsx (both surfaces, both modes), and outline.e2e.ts + mobile-editor.e2e.ts (a real scroll in a real preview, with the reader still in the preview afterwards).

  • An SVG preview needs a DEFINITE width above the picture, and a viewBox-only SVG is the shape that exposed it. SvgPreview renders the sanitized markup inside a wrapper, and that wrapper was a flex item, i.e. shrink-to-fit. An SVG with no width/height attributes — which is how most icon SVGs ship, viewBox alone — defaults to width:100% of its containing block, so the percentage resolved against a width that was itself waiting on the content: measured in Chromium, the sanitized <svg> was in the DOM, hasViewerSurface('svg') was true, viewers.test.ts was green, and the picture's box was 0 x 0, so the panel looked empty. w-full on the wrapper gives the row's width and the SVG fills it (273 x 273 for a square viewBox in a 321 px column); [&>svg]:mx-auto pays it back for an SVG that DOES declare its own size (a width="40" mark now centres instead of hugging the left edge, measured 117 px on each side). Only a browser can catch this class of bug — happy-dom has no layout engine, so every box there is 0x0 and the unit test passes either way; the claim is pinned by editor.e2e.ts's an SVG with only a viewBox is drawn at a real size, which measures the rendered box and requires it non-zero and square. A second viewer added later owes the same measurement, not a markup assertion. The preview also owns its SVG's IDs, because DOMPurify deletes the ones the page already has. The sanitizer's clobbering guard drops an id/name whose value is in document (SANITIZE_DOM, on by default) and leaves fill="url(#body)" behind — measured in Chromium on a real icon, the <linearGradient id="body"> lost its id while the two shapes it paints (body, head) came out rgb(9,77,61) — the background's green — instead of rgb(246,232,197), with nothing logged; a pixel diff against the rasterised reference went from 1003 to 4648 differing pixels, and came back to 1003 once the ids were prefixed. SANITIZE_NAMED_PROPS is NOT the fix: it prefixes the declaration and leaves url(#body) pointing at the old name. So shared/lib/ui/svg-scope.ts prefixes every id and rewrites every reference that can carry one (url(#…), a bare href/xlink:href fragment, a <style> block's SELECTOR half only — rewritten declarations would repaint fill:#abc — and ARIA idref lists), scoping each preview with a module counter rather than useId (measured: two Preact roots on one page both allocate P0-0). Same reason as the width rule above, this had to be measured in a browser: the sanitizer happy-dom ships does not perform the clobber check at all, so every unit test passed against the broken picture.

  • A failed read is reported, never substituted, and a file's ceiling is enforced at the route too. EDITOR_MAX_BYTES_BY_EXT is read by the classifier, by the refusal sentence AND by /api/fs/raw, so no entry point can bypass the limit and no two surfaces can name different numbers (unsupportedEditorMessage derives its number from the same table, and the tests derive their expectation from the constant rather than spelling "5.00 MB").

  • Every editor and diff scroll container remembers where it was left, per tab and per surface (src/shared/lib/workspace/scroll-positions.ts + src/client/hooks/editor/use-scroll-restore.ts). The code surface's scroller is CodeMirror's own (view.scrollDOM) and a diff's is the merge view's element, so neither is a node the panel renders — the hook takes the element as an OPTION (element) rather than reading a ref, and the surface reports it through onScroller on mount. The editor column still swaps ONE container's document on a tab switch, so the browser clamped the shared scroller to the height of whatever arrived next — measured: leaving a 400-line file at line ~40 and returning landed at line 1. The offsets live in the session's UI state (editor.scrollPositions, so they survive a reload), and the phone editor keeps its own slot (editor.mobileScrollPositions) because it is keyed by PATH while the desktop column is keyed by tab id — one map would let the desktop's prune drop the phone's entries. Three rules make it work, each a bug if dropped: the restore REPLAYS for ~600 ms, because a file's height is not final on the commit that opens it (the line geometry is measured in a layout effect and the panel animates its width) and a single write is clamped to the height that existed then; a reader's own scroll cancels the pending restore, since fighting the wheel is worse than a missed restore; and the offset is recorded from scroll EVENTS, never by reading the element in the effect's cleanup — a layout effect's cleanup runs after the DOM already holds the next tab's document, so reading element.scrollTop there stores the NEW file's offset under the OLD tab's key. A restore's own write is excluded by a writingRef flag, not by comparing scrollTop to the read-back value: a scroll event can be delivered SYNCHRONOUSLY from the assignment (measured in happy-dom, and a browser may deliver it before the next frame), when the read-back has not run yet and the delta looks like the reader's — that dropped the pending restore and left a growing document at its clamp. The container is armed even when nothing is stored, because "no entry" means the top and the shared container still carries the previous document's offset. Surfaces are separate offsets (code/rendered for a file tab, unified/split for a diff): a markdown preview and its source, and the two diff row shapes, share neither a line nor a height. A closed tab's offset is dropped WHERE THE TAB CLOSES (dropScrollPosition, called from useFileTabs' close / diff-conversion / workspace-wipe paths) — never from an effect watching layout.openedFiles, which sees that list at moments that are not user actions (before the session's blob has restored the tabs, mid workspace switch) and deleted every stored position on the way in: measured, the offset persisted and then came back as {} after a reload. The hook reads the session context OPTIONALLY: the shared diff views also draw a chat tool card, and a caller may mount one without the provider. The element is handed in, not read through a ref: the code surface's scroller is CodeMirror's (view.scrollDOM) and appears only once the view mounts, so the surface reports it through onScroller and the caller passes it as the hook's element option — which also re-arms the restore on the render it arrives in. tests/e2e/specs/editor-scroll.e2e.ts pins the round trip and the reload, and mobile-editor.e2e.ts the phone's (a real browser clamping a real container — happy-dom computes no layout, so the unit test's geometry is faked).

  • The face itself is a setting, and only one of the offered faces is bundled (EditorFontSection, EDITOR_FONT_CHOICES). editorFontStack puts the chosen family FIRST in the shared stack, so a face the device does not have falls through to the bundled Fira Code rather than replacing it — verified: an uninstalled family measures identically to Fira Code, not to a system serif. That property is why the picker can offer JetBrains Mono / SF Mono / Menlo / Consolas / Monaco / Courier New, none of which the app ships, and why the section marks Fira Code Bundled and previews each row in the face it names (an absent choice shows its own fallback before the user commits to it). A change has to reach an editor that is already open, which rules out reading appSettings — a boot-time prop the editor only sees again after a reload — so the picker broadcasts omp:editor-font-changed and useEditorFontStack subscribes, the same shape the theme uses; the event fires only when the value actually moved, or every unrelated settings toggle would churn every editor's stack. Verified live in the browser with no reload: the open editor's textarea, <pre> and gutter all moved from Menlo to Courier New in one step and stayed aligned, and the choice survived a full reload.

  • The editor's COLOUR theme is a second axis beside the app palette (EditorThemeSection, editorTheme in kabmo_settings, shared/lib/code/editor/themes.ts). auto is the default and means "the app palette" — nothing changes for an install that never opens the picker — while any other value is a Shiki theme id that paints the code surface's own background, ink, gutter, selection, caret, find bands and diff bands. The separation is the feature: a reader who works in Dracula or Nord keeps that inside the editor while the console around it stays on the app theme. The catalogue is GENERATED, and its gate is what keeps it honest. scripts/editor-themes.mjs writes themes.generated.ts from the installed @shikijs/themes (65 themes) — surface, ink, gutter, selection, cursor, find, border, the two diff bands and three syntax accents for the picker's swatch — so the grid draws every card without fetching a theme module (1.3 MB of TextMate JSON). bun run editor:themes:check is a CI gate, and themes.test.ts re-derives every row from the package, so a @shikijs/themes bump fails a test instead of shipping swatches the highlighter no longer has. A key a theme omits is a color-mix of its OWN ink and surface — 46 themes ship no editorGutter.background and 8 no editor.selectionBackground, and borrowing another theme's colour would make the swatch a lie. Two mechanisms, and confusing them is the bug. The CHROME is --editor-* custom properties written on the surface's host (editorThemeVars), with --theme-* as the fallback in every declaration — so auto is a no-op, and switching between two editor themes is a pure repaint with no transaction at all. The TOKENS are baked into the Shiki decoration plugin, because Shiki is handed theme NAMES at tokenize time: that one is a COMPARTMENT reconfigure (themeCompartment), which keeps the document, the selection and the undo history. An explicit theme names ITSELF in both Shiki slots, so --shiki-light and --shiki-dark hold the same value and the app's variant attribute is harmless; auto keeps the app's dual pair, which is why an app theme flip still recolours tokens with no re-tokenize. Verified in the browser: Dracula on a light app palette measured rgb(40,42,54) on .cm-editor, rgb(248,248,242) on .cm-content, the theme's own gutter ink, and identical --shiki-light/--shiki-dark per token; Auto returned the surface to transparent with rgb(20,19,16) ink; the choice survived a reload through POST /api/settings. The module is fetched on SELECTION, never at boot (theme-loader.ts, a globalThis-free per-process registry with in-flight dedupe). codeToTokens throws for a theme Shiki has not been given, so the decoration plugin subscribes to onEditorThemeReady and rebuilds once it lands — without that a freshly picked theme would leave the surface uncoloured until something else forced a rebuild. A theme that fails to load leaves the app palette, which is a wrong palette rather than a blank editor. The setting reaches an already-open editor through an EVENT, not a prop — omp:editor-theme-changed, dispatched by the modal only when the value actually moved, the same shape the editor FONT uses, because appSettings is a boot-time prop. useEditorTheme() returns {theme, vars, themes} in one hook rather than three subscriptions that could disagree for a frame. The two diff surfaces go through ThemedMergeDiffView (the panel's own file is at the size ceiling, and the chat's diff card is the same surface), so both wear the theme with no second subscription to keep in step. Both editors drop bg-paper from the surface's own class list — an explicit theme's background is opaque, so the panel colour under it would be a rectangle of the wrong shade at the edges; auto still shows the panel through background-color: transparent. Auto is a CARD, not a checkbox, and it is drawn under every light/dark filter — it is neither variant, and a user who filtered to Dark must still be able to get back to the app palette without first clearing the filter.

  • SettingsState holds only settings that do something. 16 of its 26 fields were dead — declared and defaulted in the modal, never rendered, never read (editorFont among them, along with tunnelEnabled, activeProvider, binaryPath, …). They arrived in the Remix migration and were never implemented, and because DEFAULT_SETTINGS is only merged for display — diffSettings persists just the keys an edit moved — their fake defaults never reached SQLite either, so nothing downstream could have depended on them. editorFont was wired to the picker above rather than deleted; the other 15 were removed, and a field that only ever appears in types/settings/state.ts and DEFAULT_SETTINGS is now the signal that it was never wired.

  • The editor column has two WIDTH modes beside its full SCREEN one, and the three glyphs are three different shapes (shared/lib/workspace/editor-view-mode.ts is the table, client/hooks/workspace/editor-view.ts reads it, common/editor-view-buttons/ draws it). Compact view collapses the CHAT and gives its width to the editor; Full view collapses the chat AND the session sidebar; neither touches the right panel, because the outline, the search hits and the diff list are what a wider document is read against. The existing fixed inset-0 control is a third, different thing — it covers the right panel too — so it keeps Maximize while compact draws a crossed-out message and full a closing panel edge: two spellings of one glyph is how a user learns to click the wrong one. The mode is SHARED state, not a private copy per toolbar (useSharedSessionState): the editor and the diff toolbar are the same surface on two tab kinds, so a mode entered from one must be the mode the other shows — a private copy left the diff reading normal after the editor entered compact. The chat stays MOUNTED and is sized to zero (Panel gained a collapsed-filler branch; the box is inert), because it owns the live run, the composer draft and the scroll position, and widening a document must not discard any of them. The mode only means anything while the editor column is open, and that is DERIVED rather than written back (editorOpen in the hook), so closing the column restores the chat and the sidebar and reopening returns to the width the user chose. The layout math has one option for it (chatHidden, panel-widths.ts): the chat floor and the pair's 70% share both exist to leave the conversation room, so with no conversation on screen the editor takes everything the right panel and the separators do not — its remembered fraction is left untouched, so leaving the mode restores it, and a drag made in the mode persists the RIGHT panel only (readPanelWidths skips the editor, whose width there is arithmetic rather than a choice). The sidebar toggle and ⌘B route through handleToggleLeftPanel, which steps full back to compact — flipping the raw showLeftPanel flag would change a value the layout is ignoring and the click would do nothing. Both toolbars are ONE row, and what does not fit goes into a ⋯ menu (common/toolbar-row/, the rule in shared/lib/ui/toolbar-overflow.ts). Wrapping was the first answer and it is the wrong one: the editor panel is 320px wide on a 1440px screen, ten-plus controls do not fit, and a wrapped strip made the bar 72px tall — the document moved down by a whole row and the second row read as a second toolbar. A horizontal scroll is worse (the diff toolbar already measured 361px of content in a 296px box with Stage entirely outside it and no scrollbar to say so). So the row is flex-nowrap, widths are MEASURED once per cluster set (a table of guessed pixels drifts with a label, an icon or a font), and the tail becomes menu rows NAMED IN WORDS. Pinning is not the visual order: Save is drawn first because that is where a reader looks, while the width modes sit last and are the reason the buttons exist — so pinned marks what a narrow panel must not bury (Save, the width modes and full screen on the editor; the change counts, the width modes, Stage and Edit File on the diff), and everything else is menu material. An unmeasured row draws everything (hiding before the width is known flashes a menu on every mount), and the pinned set is placed FIRST so an early unpinned control cannot consume the space a pinned one needs. The editor toolbar fits its row at the 320px floor with no trigger at all; the diff toolbar overflows there and shows ⋯ — both measured in the browser. Pinned by editor-view-mode.test.ts (the hide table and the toggle), toolbar-overflow.test.ts (the pinned rule), toolbar-row/index.test.tsx (a wide row draws everything, a narrow one keeps the pinned cluster and offers the rest as menu rows that run the same actions), editor-view-buttons/index.test.tsx (two toolbars mounted under one provider — they share the slot, each reports its own aria-pressed, the active mode returns to normal, a stored mode is restored) and editor-views.e2e.ts (real bounding boxes: compact zeroes the chat and keeps both other columns, full also zeroes the sidebar, the mode survives a reload, and the diff toolbar's buttons drive the same mode).

  • An open editor tab follows the disk by CONTENT HASH, and only when the bytes differ (use-disk-sync.ts + use-disk-digest.ts + GET /api/fs/digest). The tab polls its file every 3s (and immediately on window focus, on a workspace write, and on visibilitychange), compares the server's SHA-256 of the file against the hash the buffer was read at, and re-reads only on a mismatch. Two failures this replaces: an mtime-only watcher reloaded a tab (losing caret and scroll) when git checkout, a formatter or a touch moved the clock without changing a byte, and a clean buffer never noticed an external write at all because the old probe only ran for a DIRTY buffer. A clean buffer now takes the disk copy silently; a dirty one is never replaced — the panel shows the external-change strip and the user chooses. The digest route caches its hash against the raw mtime+size, so an unchanged file costs one stat per poll, and the save response returns the hash of the bytes it wrote so the watcher does not read the user's own save as an external change. The toolbar's Reload (formerly "Revert", now enabled for a clean buffer too) is the manual counterpart: it re-reads the active file, discards a dirty buffer, and cancels the debounced write that buffer had queued — otherwise the read path yields to the queued write and Reload appears to do nothing.

  • Editor & Diff toolbars: every action is an icon-only <button> carrying both a title and an aria-label (a bare <svg onClick> is unreachable by keyboard), and each reflects its own state — word wrap / preview / full screen are aria-pressed, Save shows saving → saved → error, and Copy flashes a check for 1.5s. Two rules the toolbars exist to enforce: a failed read is reported, never substituted (useFileEditor has no fallback; the mock sample it used to drop in was written straight over the real file by the next save), and a failed save says so (reportSaveError, since a silent failure left the user believing the file was written). A file whose read failed also has Save disabled — its buffer is empty, so writing it would blank the file on disk. The save status is reset when the active tab changes, because it describes the file that was written. Both toolbars are @containers, because the panel — not the viewport — is what runs out of room: the editor panel is 320px wide on a 1440px screen. The diff toolbar's action strip therefore wraps instead of scrolling: overflow-x-auto no-scrollbar clipped it invisibly (measured 361px of content in a 296px box, with Stage entirely outside it and no scrollbar to say so), and it now costs one extra row on a narrow panel and nothing on a wide one. The editor toolbar's path block is hidden below @[420px] for the same reason — the action strip is 273px of flex-shrink-0, which left the path a measured 23px of truncated fragment (the tab above already carries the name) — and its action strip carries ml-auto so it stays right-aligned once that block is gone.

  • The diff panel and the chat's diff card render CodeMirror's merge view, not a table. diff-panel/merge.ts owns the two shapes (unifiedMergeView for Unified, MergeView for Split) and MergeDiffView.tsx mounts one per shape; diff-panel/{UnifiedView,SplitView}.tsx and shared/lib/fs/diff-parser.ts are deleted. The panel compares DOCUMENTS now, so oldContent/newContent travel on the existing GET /api/fs/git?fileDiff=1 response and Diff Only ↔ Full Code is a client-side collapseUnchanged COMPARTMENT reconfigure (a re-mount would drop the reader's scroll) — the server's -U<n> probe existed only because a table renderer cannot collapse anything, and fullContext is gone. A changed token carries NO underline, and suppressing it is not a theme rule. @codemirror/merge marks the changed characters with .cm-changedText (a deleted chunk's with .cm-deletedText) and its own BASE THEME paints a 2px gradient along the bottom of each fragment. A word-level change is usually several fragments — 2 → 22 is one — so the reader saw a run of short coloured bars under the code that reads as a second, broken baseline rather than as emphasis; the row's band and the gutter marker are the signals that remain, and diff-panel.e2e.ts asserts both directions (the bar gone, the band still painted). Three facts about where the suppression can live, each measured. (1) It CANNOT go in the panel's EditorView.theme: that rejects the &light/&dark selectors the package's rules are spelled with (RangeError: Unsupported selector: &light), and the throw took the whole merge view down leaving an empty host. (2) A plain .cm-changedText { background: none } LOSES — the package's rule is .ͼ2.cm-merge-b .cm-changedText, i.e. (0,3,0), and CodeMirror mounts its style modules AFTER tailwind.css. (3) So tailwind.css owns it with three class-level parts of its own (.cm-editor + .cm-merge-a/.cm-merge-b + the span class), winning on specificity rather than by !important — which would also beat a future theme that legitimately wants a different treatment. Verified in both dev and the production bundle (the emitted rule reads background:0 0). The +n/-n counts come from Chunk.build(a, b), never from diff(): diff() is a CHARACTER diff, so changing line 5 into line 5 changed reports one insertion of " changed" and no deletion, and a badge built on it claimed +2 for two edited lines (measured: Chunk.build gives +2 -2 for that pair, +2 -0 for a new file, +1 -0 for an inserted line). The chat card has a PATCH and no documents, so shared/lib/fs/patch-sides.ts rebuilds the two sides from the hunks — padding each side to the line its @@ header names, or a mid-file change would be numbered from 1 — and collapses that padding with contentMode: 'diff'. The merge package's own colours are hardcoded hex; diffTheme() overrides them with the palette variables, or a diff would be the one surface that ignores the theme. A card's diff SCROLLS because the CodeMirror root fills its host by LAYOUT, not by a percentage. .cm-editor/.cm-mergeView carry height: 100%, and a percentage resolves against a DEFINITE containing block — the diff panel's host has one, but a chat card's diff is bounded only by max-h-72, and a box whose height comes from max-height is indefinite for that purpose. The root therefore computed to auto and grew to its content: measured on a real transcript, 1847px inside a 288px host, clipped by overflow-hidden with scrollHeight === clientHeight, so a 30-line edit card showed nine rows with no way to reach the rest — in BOTH shapes (unified 1847, split 1928). min-h-0 on the wrapper is necessary but NOT sufficient (it lets the item shrink; what the root needs is a height to shrink TO), and DiffView.test.ts used to claim it was. [data-code-surface] in tailwind.css is the other half: the host is a column flex container and the root a shrinking item (flex: 1 1 auto; min-height: 0), so the height arrives through layout whatever the host's own is — definite, capped, or automatic (an unconstrained max-h-none host still sizes to its content). The rule keys on the shared marker for that reason: both surfaces that draw a code surface restated this wrong once. css.test.ts gates the built rule and tests/e2e/specs/tool-diff-scroll.e2e.ts is the rendered proof (host 288 / root 288 / range > 200 / a scroll that moves, in both shapes; A/B'd — both cases fail with the rule removed), driven by the edit:<pairs> prompt directive the fake child gained (every row a CHANGE, or contentMode: 'diff' collapses the patch back under the ceiling and the range is 0).

  • The diff toolbar steps through changed hunks, and the count comes from the merge view's own chunks (diff-panel/chunks.ts, HunkStepper.tsx). getChunks is a FUNCTION on the state and answers null for a state with no merge extension (state.field(getChunks) throws "Field is not present in this state"), and the SIDE matters: a split view's B editor is the working file (side: 'b') and a unified view reports 'b' too, so reading fromA measures the other document. The package's own goToNextChunk/goToPreviousChunk move the SELECTION and return false when the caret is already inside the only chunk, so the handle's stepChunk re-centres the row after the move (a read-only editor does not scroll for a programmatic selection) and the toolbar hides the cluster when count is 0. The position is PUSHED from a updateListener on the one reporting side plus a seed at mount — a caller that recomputed it on its own render would print a number the view had already moved past. Measured in the browser: –/3 on mount, then 1/3, 2/3, 3/3, wrapping to 1/3, with the scroller following (0 → 35 → 476 px).

  • Diff Panel toolbar: Discard posts actionType: 'revert' — the server's own name for "restore this file from the index", and the one that handles the untracked case (removes the file). Sending discard, which no handler matched, returned {success: true} for doing nothing. Stage/unstage/discard await the response and surface a rejection in an inline error strip; the previous fire-and-forget submit flipped the badge optimistically and let a rejected action look successful. The Split/Unified segments each set their mode (toggling meant clicking the already-active segment flipped the view). The toolbar is an @container, so its labels collapse on a narrow panel rather than a narrow viewport — the editor panel is 320px wide on a 1440px screen, and sm: kept every label on, overflowing it. The +n/-n counts sit in the action strip rather than the identity block: the editor tab carries the file name but never the counts, and they are computed by countChanges from Chunk.build — the rows the merge view actually draws, not git's own tally (see the bullet above). A second segment pair beside Split/Unified chooses how much of the file is shown — Diff Only (default) or Full Code. It is a separate group because the two axes are orthogonal (Unified/Split is the shape of the rows, Full/Diff is how many there are), and each segment sets its own mode for the same reason the view pair does. The mode is a collapseUnchanged COMPARTMENT, so it reconfigures the live editor instead of re-mounting it — the documents are already both sides of the file, and the reader's scroll survives the toggle. diff.contentMode persists per session beside diff.viewMode. Word wrap is a third toolbar toggle, on by default (diff.wordWrap) — a long line that runs off a 320px panel hides the very change the diff was opened for. It is EditorView.lineWrapping in a compartment (measured: scrollWidth equals clientWidth wrapped, 4 525 against 320 unwrapped on a 600-char line), which is also why the old table-layout reasoning is gone with the tables.

  • Diff→editor conversion goes through useFileTabs().convertDiffToEditor, which replaces the tab immutably and reuses fileTabId (src/shared/lib/workspace/file-tab-id.ts). The panel used to assign activeFile.isDiff = false on the object inside layout.openedFiles: React saw no change (identical array identity), and because that array is what gets persisted the mutation reached the database — the "diff" tab came back as a file tab after a reload and its diff never returned. If the target file already has a tab the diff entry is dropped instead, or the two would share an id.

  • Both diff shapes fold, and detect the brace pair, through the same stack the editor uses. diff-panel/folding.ts composes bracketMatching() + bracketGuide (the open/close highlight and the vertical rule between a brace and its match), foldGutter() (the marker AND the fold state field — a foldEffect dispatched into a state with no foldState is discarded silently), foldKeymap, and TWO fold services in that order: braceFoldRange first, indentFoldService as the fallback. The brace rule folds a line that opens {/[/( to the line BEFORE its matching closer, so the closing brace stays on screen — the boundary a reader comparing two sides expects — and indentation is what still folds a block the brackets cannot describe (YAML, Python, a wrapped expression). The scan is textual (the same documented trade bracketMatching() makes: braces inside strings pair) and capped at MAX_FOLD_LINES, refusing rather than truncating. A pair that closes on the next line hides nothing, so it does not fold. The split shape registers the stack in EACH of its two editors, so the two halves fold independently. Read-only does not block any of it. surfaceTheme already styles the fold gutter, the placeholder and the bracket pair; its fold glyph and placeholder now read --editor-fg/--editor-bg first, because the diff is the one reader that can wear a dark editor theme (Dracula) inside a light console — app ink at 45% over that surface is a glyph nobody can see. Pinned by diff-panel/folding.test.ts (the rule, the cap, both mounted shapes, the guide) and diff-panel.e2e.ts's brace spec (a real gutter click folds and a placeholder click unfolds, and a real click beside a { paints both ends plus the guide — geometry happy-dom cannot produce).

  • handleOpenFile activates the id of the tab it MATCHED, never the id it computed. The same path reaches the editor under two ids: the explorer passes a row's own id (its relative path, so "notes.md"), while a search row, a chat link and a drop compute fileTabId(path) (a hash). The handler computed file.id ?? fileTabId(file.path) and then activated that — after the updater had already found the existing tab under the OTHER id. The active id named no tab, so Editor found no active file and drew "Select a tab to view content" over the file that was already open, with the tab strip still showing it (measured in the browser: layout.openedFiles[0].id = "notes.md" against layout.activeFileId = 1582000100). The resolution happens OUTSIDE the updater, against getSessionValue(...'layout.openedFiles'): a state updater may run more than once, and activating a tab is not idempotent. Reading the store rather than the hook's own value keeps the callback's identity stable, which matters because the search panel's memoized rows depend on it. Pinned by file-tabs.test.ts (all three directions: existing tab keeps its id, a new file gets the computed one, and the reverse order dedupes) and tests/e2e/specs/search-panel.e2e.ts (a real click on a hit for a file the explorer opened).

  • Right Panel + Activity Bar: switchable developer panels — context (Context & Telemetry), files, search, git (Source Control), wiki, terminal (Bun), user-browser, browser, usage, todo and plan (src/client/components/workspace/, src/client/components/layout/RightActivityBar.tsx).

  • The Files panel lists EVERY entry — there is no noise table. listDirectoryEntries (src/server/lib/fs/listing.ts, shared by /api/fs/dir and the realtime fs: topic so the two cannot disagree) used to drop a hardcoded set of names (node_modules, .git, dist, build) at every depth. That hid directories the user had no other way to reach: packages/android/dist holds the built APKs, and the reported symptom was the folder simply not existing in the panel. A name cannot tell a dependency tree from a folder of release artifacts, so the panel's only signal is now the ignored flag — one git check-ignore per listing (never one per entry), which DIMS a git-ignored row instead of deleting it. Cost is bounded by laziness, not by filtering: children are read one directory per request and only when expanded (measured on this repo: root listing 59 ms, node_modules 50 ms, .git 21 ms), and a row nobody expands is never read. A folder holding exactly ONE folder and nothing else is collapsed into a single row naming the chain (com/java/app/package), because a row per level spends four rows to reach the files inside and every editor folds that. folderChain walks it in the server listing — one readdir per folder entry, and only for the folders that have exactly one entry (measured 0.77 ms for the 18 folders at this repository's root) — while the chain's own levels are never listed, so the read the user would have paid on each expand is one that no longer happens. The row's identity is the DEEPEST directory (path/id), which is what an expand reads and what a rename, delete, drag or paste acts on; only its name carries the chain. The walk stops at the first level that holds a file, two entries or nothing, so a folder of files never folds. The client folds by the same rule in foldSingleChildFolders (shared/lib/fs/folder-chain.ts, applied by rehydrateTree in file-tree.ts — the one function that builds a rendered tree, so every read, every topic snapshot and every local edit goes through it) because a create or a rename inserts a chain the server has not listed yet; placeEntry descends into a chain row by its own path, and when an entry lands BESIDE one it UNFOLDS that row rather than drawing the folder twice. The reveal after a create or rename therefore expands drawnAncestors — the rows that exist — never the path's own segments, which would put lib and lib/deep in the expansion set when the single row is lib/deep, and the next refresh would read each of them for nothing. A collapsed row is asked about its deepest path in the one git check-ignore call, which is enough: a rule naming an outer level answers for the deeper one too (verified). A rename or a delete acts on that deepest path, so the delete dialog names it explicitly (this deletes <path> only) rather than letting the chain label promise four directories and perform one. Pinned by listing.test.ts, folder-chain.test.ts, file-tree.test.ts, the panel's index.test.ts and tests/e2e/specs/files-nested.e2e.ts (a real chain on a real disk, expanded, and a rename beside it that unfolds it). The remaining name table, SKIP_DIRS in routes/fs/read.ts, belongs to the FLAT recursive walk behind /api/fs/list (the composer's @ picker): that one is capped at MAX_FILES 3000, and descending into node_modules would spend the whole budget inside dependencies and leave the picker with no project file in it.

  • Every right-panel view is a PLUGIN, including the eleven Kabmo ships. One catalog (usePanelCatalog, src/client/components/workspace/plugin-panel/resolve.tsx) merges the built-in views and the installed plugins, and the activity bar, the desktop panel stack and the phone's tab strip all render from it — so a view cannot be a table in one layout and a fetch in the other. RIGHT_PANEL_TYPES (src/shared/lib/workspace/right-panels.ts) stays the single source of the ORDER (it is shared, with no client import, because the width map and the persisted-id guard read it too), and builtin.tsx (src/client/components/workspace/panels/) is the built-in half: id, title, label, icon, a lazy() component, sizing and requiresWorkspace. The lazy() wrapper is created at MODULE scope, which is what lazy-panels.tsx used to arrange: a view's code stays in its own chunk, and because the wrapper's identity is stable across renders a view stays MOUNTED (its tree expansion, search results and terminal buffer alive) while the layout hides it with CSS. requiresWorkspace and liveWhileHidden are DATA rather than conditions at a call site: a view that reads the working tree is inert without a folder while one that reads the SESSION (todo, plan, usage, both browsers) is not — gating those showed "No session selected" over a list that was right there — and only the terminal stays live while another view is on screen, because it owns a live PTY. panel-meta.tsx and lazy-panels.tsx are gone with it; there is no per-view branch left in any layout.

  • Enablement is ONE axis and one store, and the ID PREFIX is what keeps the two kinds apart. A built-in view is switched off by its BARE id (git, files, terminal) and a plugin by plugin:<pluginId> — the same key the client filters its catalog by and the same key the server tests before publishing a bundle. That prefix is load-bearing on the server too: registry.server.ts gates a plugin's bundle on pluginPanelKey(manifest.id), and testing the bare manifest id there made a disabled plugin still report enabled: true while its panel stayed hidden — two answers for one question. The server stores whatever ids it is given and never learns which are built-in; disabledPanels travels on GET /api/panels and the client resolves its own views against it. Absent means enabled, which is what makes a freshly installed plugin live immediately, what shows every built-in view on a fresh install, and what keeps a database written before this feature from switching everything off. Two surfaces write the same set through the same setEnabled(id, enabled): the activity bar's right-click menu (every panel, on or off, with its row kept while off — the only place it can be switched back on; nothing is pinned any more) and Settings → Panel Plugins' BuiltinList (all eleven with the switch a plugin card gets, and no Remove, because the code is in the bundle). The retired hiddenRightPanels list is folded into the disabled set ONCE, guarded by the old key's PRESENCE and deleting it as it goes, so the pass is idempotent and a view switched back on afterwards cannot be re-adopted (migrateHiddenPanels).

  • Every installed plugin card offers Update, and the source decides what it means (PluginCard, Toolbar, shared/lib/panels/update.ts, server/lib/panels/update.server.ts). One predicate answers "is there an update" for the card's button, the Installed header's count and the toolbar's Update all: a git clone is behind when its PROBE says the commit moved (a version pair cannot see a fix shipped without a bump), while a bundled install is behind on a strictly newer store version, and a local directory never. A clone's button sits in its freshness row beside the commit pair it would move; a bundled install's sits in the footer, because the store has no commit to show. The dispatch is by SOURCE, not by which button was pressed: update fetches-and-resets a clone and takes the store's copy for a bundled install — the latter under the sync's own edit gate, so a hand-edited tree is REFUSED and named rather than silently overwritten (the override stays the blocked notice's own, spelled-as-a-consequence button). update_all probes each clone first and moves only the ones behind, then runs one store pass. The server half is taken down before the files move and put back after, and only when it was loaded: a disabled plugin's routes must not come up behind the switch that says off.

  • A clone's "dirty" test must ignore UNTRACKED files, or Kabmo's own build makes every git plugin un-updatable (isDirty, server/lib/panels/git-update.server.ts). git status --porcelain reports ?? dist/ and ?? node_modules/ — written into the clone by the install's own build — so Update answered "has uncommitted changes, which an update would discard" forever on any plugin repository that does not gitignore them. Measured end to end on a fixture repository with no .gitignore: install → advance the remote one commit → POST {type:"update"} → 400, with the tree's only differences being Kabmo's build output. git reset --hard never touches an untracked file, so they are not what the refusal protects; --untracked-files=no keeps the refusal for a real edit and lets the update run.

  • Two browser panels, one toolbar, and only one of them may offer device presets. browser-panel/ mirrors the tab this session's omp agent drives in the project-shared Chromium (a read-only screencast: status, URL, zoom, include-in-chat, copy, reconnect); user-browser-panel/ is the user's own private iframe with real history and navigation. Both render browser-toolbar/, whose device cluster (BrowserViewportSelector + ViewportMode) is optional — the user panel passes it, the agent panel deliberately does not. A preset is genuine emulation only where the CSS box is the layout viewport (an iframe); on the agent panel it could just letterbox a fixed-resolution JPEG while claiming to emulate a device, and the cluster's 401px pushed the bar to scrollWidth 482 > clientWidth 373 on a 373px panel, crushing the read-only URL to 18px. Agent-side emulation belongs to the agent itself (tab.emulate() / browser.open({ viewport })). VIEWPORT_CLASSES (common/viewport.ts) is therefore user-panel-only.

  • The agent browser panel can CLOSE the session's tabs, and that is the one write it owns. omp opens a page per site it visits and never tidies up, while the viewer attaches to the NEWEST owned target — so a stale page keeps stealing the panel, and each one keeps a renderer alive in the project-shared daemon. The tab strip is the only map of those pages, which makes it the only place they can be closed, and it is drawn from ONE tab upward (a selector needs two; the close control needs the strip). shared/lib/browser/tab-close.ts owns both rules — only THIS session's tabs are closable (the daemon is project-shared), and the tab to select after a close is the neighbour to the CLOSED tab's right in registry/creation order, else its left. Measured on Chromium 1248 against a tab mid-screencast: Target.closeTarget answers {"success":true}, the browser socket stays open, the attached session dies on its own (Page.stopScreencast then answers "Session with given id not found" and Target.detachedFromTarget arrives browser-level), and the surviving tabs remain attachable — so the viewer needs no special teardown, only the 1s target poll it already runs. A second close of the same id answers "No target found" and is reported as alreadyClosed: true rather than an error: the caller asked for a tab to be gone, and it is.

  • Annotating the user browser panel sends GEOMETRY, never pixels, because a cross-origin iframe cannot be captured. Measured in Chromium 150 against a host page embedding 127.0.0.1:7002 from :7001: iframe.contentDocument is null, ctx.drawImage(iframeElement, …) throws TypeError (an HTMLIFrameElement is not a CanvasImageSource), and reading the inner document through contentWindow throws SecurityError. getDisplayMedia was offered as the escape hatch and does NOT survive measurement: InvalidStateError on headless, headed, --use-fake-ui-for-media-stream, --auto-select-desktop-capture-source and a real CDP-dispatched click. So user-browser-panel/AnnotateLayer.tsx draws marks as an SVG overlay INSIDE the wrapper that carries the zoom and VIEWPORT_CLASSES (inset: 0 measured 900×450 over a 900×450 iframe at zoom:150%), stores every point normalized 0..1 against the measured surface, and shared/lib/browser/annotate.ts turns each mark into a sentence — kotak kiri 10.0%, atas 20.0%, lebar 20.0%, tinggi 15.0% (205×115 px) — tombol mati — which page-context.ts appends to the draft with the panel box (laptop 1024×768 px @100%) and the line that the page is user-only. The pixel pair is why the panel box travels at all: a percentage alone does not tell the agent the button's real size. The AGENT panel does not offer the toggle (BrowserToolbarProps.annotate is optional, like viewportMode) — it is the agent's own live view, so a mark on its JPEG would be a claim about a page the user is not annotating. useAnnotate(frameKey) clears the marks when the page changes, because an iframe's internal navigation is invisible from this origin and only onLoad/frameKey reports it.

  • The user browser panel is an <iframe>, and every DESKTOP/MOBILE SHELL had to be told a subframe is not a departure. Reported as "a URL typed in Browser (Anda) opens the system browser instead of the panel": the panel's own code was correct — the SHELL's navigation policy cancelled the iframe's cross-origin load and handed it to NSWorkspace/xdg-open/Intent/Process.Start. Measured in a real WKWebView: an iframe navigating to another origin arrives at decidePolicyFor with targetFrame?.isMainFrame == false, so the origin test alone fired on it. Each shell's table now takes the frame (NavigationFrame in packages/macos/Sources/KabmoDesktop/NavigationPolicy.swift, packages/windows/src/KabmoDesktop/NavigationPolicy.cs, packages/linux/src/navigation.rs, packages/android/app/src/main/java/dev/kabmo/shell/NavigationPolicy.kt): a SUBFRAME and a popup stay INSIDE (the popup is the UI delegate's/create/onCreateWindow/NewWindowRequested job — opening it in both places launched two browsers per click, measured), and only a MAIN-FRAME cross-origin navigation leaves. Android's shouldOverrideUrlLoading is documented as also firing for subframes and now asks request.isForMainFrame first; WebView2's NavigationStarting is main-frame only, and NewWindowRequested was UNHANDLED there, which left window.open to a chromeless WebView2 popup. WebKitGTK cannot answer at all before 2.56 (probed on 2.52.6: frame_name NULL for a subframe load, no Sec-Fetch-Dest, byte-identical Referer), so Linux's decide_for takes Option<NavigationFrame> and treats "cannot tell" as inside-for-pages, external-for-mailto:-style schemes — safe because every external link the console draws is target="_blank"/window.open, which arrives at connect_create.

  • The editor's document cache is bounded by BYTES, not only by tab count. MAX_CACHED (12 states) bounds the number of tabs, and that is not a memory bound: a text file's ceiling is 32 MiB, so twelve of them is up to 384 MB of document text plus CodeMirror's rope and each tab's undo history, which holds whole-document snapshots. MAX_CACHED_CHARS (8 MiB) drops the least recently used document past the budget even while the count is under the tab bound, and the document being opened is never the one dropped — losing an OPEN tab's history is the exact failure the cache exists to prevent.

A picker over a long list is SEARCHABLE, and still a listbox

A native <select> is the right control for five options and the wrong one for two hundred. Measured: omp (ACP) publishes 97 models through /api/harness (221 on the vendor's own list), and the OS popup showed them as one scroll box with no filter — while the stored value (provider/model) is not what a reader should have to read back.

common/search-select/ is that control: a role="combobox" trigger, a portalled listbox (AnchoredMenu, so a settings card's scroller cannot clip it), and a filter row.

Four rules, each one a failure a hand-rolled listbox usually ships:

  • The trigger shows the LABEL, not the value. command-code/claude-sonnet-5 reads "Claude Sonnet 5"; the raw selector lives in the row's second line.
  • The empty value is a ROW. "Agent default", "omp default", "Session model" are real choices — how an override is removed — so they are the first row and stay in the list whatever the filter says.
  • A value the list no longer holds stays visible as (not listed) / (not in catalog), directly under the empty row. Dropping it made the control show a different value than the config held, and the next edit wrote that one over it.
  • Arrow keys walk the FILTERED rows, so Enter cannot commit a row the reader is no longer looking at. The handler lives on the panel, not the rows: focus is in the search input.

Where it is used: the harness card's provider/model/thinking/mode fields, the model-role rows, an agent's model override, the goal audit model. Short enumerations (scope, kind, keybinding) stay native <select>: a two-option list has nothing to search.

Pinned by common/search-select/search-select.test.tsx (filtering, keyboard, Escape/outside close, stale value) and omp-settings/role-picker.test-util.ts (the portalled listbox is not a descendant of the mounted container, so every role test drives it through one helper).

  • The two generated stylesheets are a linked, content-hashed asset, not inline <style>. themeStyleSheet (68.9 KB) and iconPaintStyleSheet (113.2 KB) are built from TS tables, so the bundler cannot carry them — but they are fixed for the life of a build, and the shell is no-store, so inlining them made every navigation carry 187,419 characters of HTML, 182,093 of them these two sheets. lib/assets/theme-css.server.ts serves them as /theme-<hash>.css with immutable; the shell links it at <!--app-head-->, before the bundle's own stylesheet, because the icon sheet declares Tailwind's full @layer order and must be parsed first. The client's repair path checks link[data-theme-css] before injecting an inline copy — without that half of the test a current document would get a second 182 KB injected. Measured after: GET / is 5,368 characters and 0.23 ms warm, against 187,419 characters and 6.19 ms.

Desktop shells — the file panel behind <input type="file">

  • A WKWebView with no uiDelegate cancels every file input. WebKit documents it: "If you do not implement this method on macOS, the web view will behave as if the user selected the Cancel button." The macOS shell implemented WKNavigationDelegate only, so the composer's attach button and Settings → Projects' Upload image did nothing in the packaged app while working in a browser tab — silent, unlogged, and invisible from every test that drives the page over HTTP. AppDelegate now conforms to WKUIDelegate, sets webView.uiDelegate = self, and answers runOpenPanelWithParameters with presentUploadPanel (packages/macos/Sources/KabmoDesktop/FilePanels.swift).

  • The panel's filter comes from the ELEMENT, and WebKit does not hand it over. WKOpenPanelParameters carries only allowsMultipleSelection and allowsDirectories (verified against the macOS 27 SDK — no accept). A document-start user script (uploadAcceptScript) records the clicked control's accept into UploadAcceptStore on a capture click, and runOpenPanel reads and CONSUMES it, so the next panel is not filtered by a control the user clicked earlier. One panel configuration for every input is wrong twice over: the composer's attach field is multiple and takes anything, the icon field is single and image-only.

  • The panel is a sheet on the window (NSOpenPanel.beginSheetModal): a free-standing dialog can end up behind the window while the page waits for an answer. Cancel answers nil, the documented dismissal.

  • Type resolution has a trap worth knowing. UTType(filenameExtension:) and UTType(mimeType:) return a DYNAMIC type (dyn.ah62…) for anything they do not recognise, and image/* is one of those — a dynamic type in allowedContentTypes filters the panel down to almost nothing. concreteType rejects dynamic answers, and a MIME wildcard resolves through a small family table (image → public.image).

  • The suite cannot press a system dialog, and cannot fake a click either. Posted NSEvents do not reach the DOM in this harness (a capture listener recorded nothing) and element.click() carries no user activation, which a file input requires. So TestsWindow/UploadPanelWindowTests.swift asserts the wiring that was missing — a uiDelegate exists, and the accept relay reaches the shell and is consumed — while the panel's own decisions are pure cases in Tests/FilePanelsTests.swift.

  • The other shells do not have this gap, and the reason is worth keeping straight. Windows' WebView2 and Linux's WebKitGTK open their own file dialog for <input type="file"> when the host installs no handler, so the two ports needed nothing. iOS's WKUIDelegate documents that an unimplemented runOpenPanel "matches the file upload behavior of Safari" — also fine. macOS is the only one where WebKit substitutes Cancel, which is why this was a one-platform bug in a three-platform feature. Android is the one shell that had to be TAUGHT the control's rules: onShowFileChooser was wired but dropped FileChooserParams, so every picker opened as "any file, several at once" — an image-only icon field offered a PDF and a single-file control returned several URIs. FileChooserSpec (JVM-tested) now maps accept to MIME types and the mode to multi-select.

  • The window suite drives the delegate the app actually installs. ShellUIDelegate lives in the library target precisely so the suite can click a real <input type="file"> and read the real NSOpenPanel back off window.attachedSheet — and so the same object's createWebViewWith (where a target="_blank"/window.open goes) is pressed rather than restated. The delegate being a stand-in would have let a near-miss Swift signature pass while the shipped shell kept cancelling uploads, and would have hidden that a web view with no createWebViewWith answers every external link with nothing at all.

  • The app's surfaces are TWO materials behind ONE attribute, and the plane owns the only blur (surfaceStyle: 'classic' | 'glass', shared/lib/theme/surface-style.ts, src/client/glass.css, Settings → Appearance → Layout → Surfaces). classic is the default and is the ABSENCE of the attribute (applySurfaceStyle removes it), so an upgrade restyles nothing and a document served without data-surface is the shipped look. glass paints ONE plane under the window ([data-surface="glass"] .app-window::before) plus a specular sheen on ::after; every panel above it is a flat tint (--glass-panel). The plane does NOT filter — the aura's gradient stops carry the softness, and the cost of a window-sized backdrop root is the bullet below. Three things were measured into place: the plane and the sheen sit at z-index: -1 with isolation: isolate on the window — forcing direct children to position: relative (the first attempt) turns the first fixed inset-0 modal into a page-scrolled one, and a z-order fix must never change positioning; the tint is background-color and the gradients are background-image — a color-mix() inside a background-image layer made the browser drop the whole layer, measured as an untinted plane that read background-image: ..., none; and bg-canvas wells go transparent while bg-paper surfaces stay opaque (.app-window .bg-canvas:not(.app-window)) — canvas is the GROUND (chat well, editor pane), paper is a SURFACE with content on it, so 470 bg-paper call sites keep their own fill and opt in by class (.glass-card) instead. The plane's colour comes from the palette (--theme-paper at 50% light / 62% dark, rim white 60% → 7%, aura from --theme-info / --theme-meta / --theme-success), so all 45 palettes move it and there is no second palette to maintain. Both layouts carry the plane (desktop-layout/index.tsx and mobile/LayoutWrapper.tsx, same .app-window + <WindowAura />), so a phone is not stuck on the opaque look. Verified in the running console: glass adds chroma over classic (mean frame chroma 8.9 light / 16.4 dark against 11.5 for classic on the same dark palette), ink contrast stays ≥11:1 on sampled surfaces, and prefers-reduced-transparency / a browser without backdrop-filter fall back to opaque.

  • A backdrop root costs a buffer the size of its surface, so the two WINDOW-sized ones were removed — the plane and the dialog (src/client/glass.css; contract in src/client/glass.test.ts). Measured on this machine in Chromium at 1280x860 @2x, one page, filters toggled in place: the full-window plane alone +211 MB in the GPU process, a 1280x810 dialog alone +209 MB, a 400x300 popover +48 MB, the whole set +325 MB (598 MB total against 265 MB with every filter off), and dropping the plane's and the dialog's filters brought it to 306 MB. The plane's only backdrop is the static aura, and the dialog tier is 96% tint — 4% of a blur — so both were paying a window-sized buffer for something invisible: with the filters restored, the rendered frame differs by a mean of 2.58/255 (plane) and 0.97/255 (dialog), with 0.01% / 0.10% of pixels off by more than 8. The aura's softness now lives in its gradient stops (45% / 88%), and .glass-popover is the ONE surface that keeps --glass-overlay-filter, because it is small and sits over live content. A WKWebView harness on the same page measured ZERO delta for the same CSS — a non-bundled binary never took the accelerated path, so it is not a valid probe for this; Chromium is. The same measurement is why --glass-filter, --glass-blur, --glass-sat and --glass-bright are gone rather than merely unused: a token nobody reads is the next edit's invitation to re-add the filter.

  • A sticky header paints NOTHING at rest, and a surface only while PINNED — and "pinned" needs the scroll offset, not just the geometry (.glass-sticky, .glass-sticky[data-stuck], --glass-stuck in glass.css; client/hooks/ui/stuck-header.ts; modern/WorkspaceHeader.tsx). The modern sidebar's workspace header is sticky top-0, so it shipped an opaque bg-paper/bg-canvas to separate its label from the rows sliding under it; under [data-surface="glass"] that is a horizontal band across a sidebar that is otherwise one translucent surface ("belang"). Every paint was measured and removed: opaque rgb(255,255,254) over rows at rgb(243,241,237); paper at 74%; and blur(24px) saturate(150%) — the dialog tier's filter, whose saturate amplified the aura into the band (chroma +4.8 against its neighbours) and whose blur still read as a patch. The rule is now state-driven: at rest the header is transparent with no filter (its pixels are literally the sidebar's), and the fill appears only while data-stuck. Two details make that state honest. The scroll offset is part of the test: an element that starts at the container's top edge satisfies the geometric comparison at scrollTop: 0, so geometry alone painted the surface before anything overlapped it — the band, restored by the fix meant to remove it; useStuckHeader requires scrollTop > 0 as well, and stops painting a header whose section has scrolled entirely past it (rect.bottom > containerTop) — verified across offsets 0/240/900: no header painted at 0, exactly the pinned one at 240, and at 900 only the section actually under the top edge. The stuck fill is the column's own composite, not paper and not transparent: transparent paper darkens whatever it lands on ("hitam banget"), and plain paper is not the column either — the sidebar is chrome over the plane (paper 34% over paper 50% over canvas ≈ 67% paper + 33% canvas, 76/24 on dark), plus a few percent of --theme-info for the aura's cast, which is what makes it read neutral-but-cool like its surroundings. Measured: fill (42,50,61) against the sidebar's empty area (40,48,60) — Δ(2,2,1) — with no sheen and no blur, because an opaque fill has nothing left to sample and the white sheen lightened the strip into a band of its own. Classic keeps its opaque bg-paper/bg-canvas (measured rgb(40,44,52), no filter). Two things then broke it on the PHONE only, and both were silent. (1) The scrollport was found by overflow, not by overflow-y: scrollParent() required scrollHeight > clientHeight, which reads 0/0 for a subtree mounted hidden — and the phone drawer IS mounted hidden (SessionSidebar is a sibling screen carrying hidden, kept mounted so expansion and scroll survive a panel look). The hook fell through to window.scrollY, which never moves for an inner scroller, so measured at 412x900 with the drawer open and 420px scrolled the folder header sat PINNED at the container's top edge with no data-stuck — an active sticky header painting nothing, while the desktop column (mounted visible) worked. Per spec a sticky element is bound to its nearest scroll container whether or not it overflows this instant, so overflow-y alone is the correct test (computed style does not depend on an ancestor's display); showing the drawer re-measures through a ResizeObserver on the header and the container, because the box resizes from 0x0. (2) The canvas well rule outranked the stuck fill: the touch header paints bg-canvas, so [data-surface="glass"] .app-window .bg-canvas:not(.app-window) (0,4,0) matched it and beat .glass-sticky[data-stuck] (0,3,0) — measured with data-stuck forced on: computed background-color: rgba(0,0,0,0). The well selector now excludes .glass-sticky (:not(.app-window):not(.glass-sticky)), because a sticky header is never a well — its own state decides. Verified after: pinned header color(srgb .92 .95 .98), at-rest header still rgba(0,0,0,0), desktop unchanged.

  • Dialogs and popovers ARE part of the glass material, and the veil had to be fixed before they could be (src/client/glass.css: --glass-overlay, --glass-popover; .modal-scrim in tailwind.css). Three measured facts decided the numbers. The veil was inverted: every dialog sat behind bg-ink/40, and ink is the FOREGROUND — dark on a light theme, LIGHT on a dark one — so on one-dark-pro-soft every dialog sat in a rgb(127,136,149) field, lit from behind, which is what made a paper dialog read as a dark hole ("modal changelog kok kayak gelap"). .modal-scrim states it once: ink 40% on light, black 42% on dark (58% was tried first and put the panel at 1.01:1 against its own veil — the panel vanished instead). A dialog's tint is a contrast budget, not a taste: the veil behind it is much darker than the paper, so every point of transparency darkens the panel — 88% measured rgb(233,230,225) against #faf8f3 on light, 94% still read 10 points low; 96% lands within 4 points of its paper in BOTH variants, and the material reads where glass is actually legible: the specular sheen at the top edge (linear-gradient(#fff 7%, transparent 42%), measured +11 on a dark panel), the rim (--glass-edge) and the blur at the edges — not in the middle of a paragraph. Popovers take their own tier (92% paper, same blur) because they float over live content with NO veil, so the blur is the only thing separating them from what they cover; session-actions-menu, PanelVisibilityMenu, model-dropdown/Panel and SpecsTooltip are the four. 18 dialog panels now carry .glass-overlay — the shared Modal, settings, About/changelog, folder picker, new-workspace, scheduler, goal, new-chat, plan-review, undo/save-deleted, provider delete/logout, MCP import, git commit + dialogs, the extension dialog, and the file-explorer dialogs — and the inner panes that repeated the panel's own bg-paper (settings' detail pane and header, new-chat's header, the search-results body and its rows) were made transparent in the same change, because a pane painting paper over the material is a dialog that looks classic in one column and glass in another. Menu catchers (ContextMenu, RootMenu) and the near-opaque viewers (bg-ink/80, /85) deliberately keep their own veil: a right-click catcher must not dim the app.

  • Tool cards take the material through ONE scoped rule, not 70 files of bg-paper (--glass-card + [data-tool-row] in glass.css). Every tool renderer — five card styles and ~70 panels — writes bg-paper for its frame, its code blocks, its result lists and its notices, so a per-file change would have been 70 edits and 70 chances to miss one. The tool rows carry data-tool-row already (all five styles), so one rule reaches every surface inside them: [data-surface="glass"] [data-tool-row].bg-paper, [data-surface="glass"] [data-tool-row] .bg-paper { background-color: var(--glass-card) }. The scope IS the safety argument: an assistant's message bubble, a dropdown and a dialog are reading surfaces that stay opaque, and they are outside a tool row — verified, .bg-paper outside a row still computes rgb(40,44,52). Tint only, no backdrop-filter: a transcript can hold a hundred cards, and a blur each is a pass each. The alpha is nearly free and was chosen for looks: measured across 55-92% the composited card stays within a few points of paper and text-ink holds 17.2-17.5:1 on light and 6.3-6.8:1 on dark — the plane under it is already half paper — so 66% (light) / 70% (dark) is used, the lowest that still reads as a card, which lets the aura show through instead of covering it. One trap: the ROW ITSELF carries both the marker and bg-paper, so the descendant selector alone left the card opaque; the compound [data-tool-row].bg-paper is what fixes the frame. The transcript's other raised surfaces (thinking block, system notice, goal notice, queue rows) are outside a tool row and stay opaque — a separate decision, not an oversight.

  • The composer's glass style is the material at CARD scale — and a card has to carry its own light, because nothing is behind it ([data-composer-style="glass"] in tailwind.css; --glass-card, --glass-bloom, --glass-sheen, --glass-card-edge in glass.css; contract in src/client/glass.test.ts). The docked composer sits BELOW the transcript in normal flow, so its backdrop-filter had only the plane's flat wash to sample: measured with getComputedStyle plus pixel samples, the card was --glass-panel (50%) + blur(16px) saturate(115%) + an INK sheen and composited 1.03:1 (light) / 1.04:1 (dark) against the surface beside it — a card you could not see, which is "composer type style glass sepertinya kurang glass". Four things changed, each measured. The fill is the CARD tier (66% light / 70% dark), not the plane's 50/62 — the same --glass-card the tool rows use. The rim is --glass-edge, the window's own inset highlight plus the deep --glass-shadow stack: the edge now reads 1.15:1 (light) / 1.82:1 (dark) against the surface, and an edge that measures at all is what an edge is for. The sheen is a HIGHLIGHT (#fff 26% from the top-left, 118deg) instead of an ink shade — ink 5% → transparent darkens the face and reads as a shadow printed INSIDE the card. --glass-bloom is the light that came through the pane: two palette radials pinned off the corners (--theme-info at 2% -10%, --theme-meta at 102% 112%), which is why the CENTRE stays paper — measured unchanged at (36,48,55) dark / (241,248,236) light while the corners light up to (121,141,160)/(62,75,107) and (199,223,231)/(191,202,237), interior chroma 19.2 → 20.9 (dark) and 10.6 → 11.5 (light). The card's own blur budget went blur(16px) saturate(115%) → blur(24px) saturate(160%). Then it was dialled back, because material that reads is not the same as material that shouts ("composernya jelek, gk perlu silau gitu"). Three measured reversals. The sheen is ONE soft top highlight (white 12% light / 7% dark, fading by 32%) instead of a 118deg #fff 26% sweep plus a second gradient plus an ink shade: along the card's top margin that sweep ramped luminance 0.054 → 0.278, a bright diagonal streak across 620px; the single highlight measures a 0.012 spread. The rim is --glass-card-edge, not the window's --glass-edge: the window's includes inset 0 1.5px 0 #fff 95%, right for a 1400px frame and glare across a card — a hairline plus a 45% top light keeps the edge at 1.06:1 instead. The bloom is ONE hue in the DARK variant and NOTHING in light: --theme-info is darker than paper, so on a light theme a corner wash does not read as light, it reads as a smudge — measured at every alpha tried the top-left box came out BELOW the card body ((230,232,233) against (241,247,236) at 14%) with a corner chroma of 3 against the body's own 11, while on a dark theme the same token is brighter than ink and lifts the corner. And two hues in dark were the actual glare: a blue corner and a violet corner measured 3.76:1 and 2.59:1 above the card body with chroma 46; one wash at 12% measures 1.31:1 with chroma 20. Net effect on the docked card — top-left chroma 46 → 20 (dark) and 29 → 5 (light), corner-to-body 1.98 → 1.31 (dark) and 1.23 → 1.07 (light), while the card still separates from the surface beside it at 1.09:1 in both and keeps its drop shadow. The same rule applies to --glass-popover-bloom (light: none — a dropdown's blur has real content to sample there; dark: one 16% wash), which is the lesson stated once: a palette hue mixed over paper darkens it; only over ink does it light anything.

  • A dropdown is a POPOVER tier, and a dropdown that carries only a tint reads as a lifted box (.glass-popover in glass.css; --glass-popover and --glass-popover-bloom). Measured on the session-actions menu in dark: corner (56,61,71) over a body of (41,44,52) on a sidebar of (51,58,67) — 1.09:1 against what it covers, no light anywhere ("dropdown juga belum glass"). A popover now paints the same four layers as the composer card, in a tighter geometry: the shared .glass-overlay, .glass-popover block keeps the sheen + rim, a popover-only rule adds --glass-overlay-filter (the dialog tier does NOT filter — see the backdrop-cost bullet) and --glass-popover-bloom, peak pinned off the panel at 0% -18% so the gradient never lands inside a 176px menu. Later reduced to a single 16% wash in the dark variant and NOTHING in light, for the same reason as the composer card: a palette hue darkens paper instead of lighting it. Measured after the reduction: dark top-left (57,63,75) chroma 18, corner-to-body 1.30, panel-to-surroundings 1.20; light corner chroma 8, corner-to-body 1.09. The tint is 84% light / 92% dark, and that split is a contrast budget: light paper is within 3 points of white so worst-case menu text over a white backdrop (a screenshot under a dropdown) measures 4.93:1 at 84% against 4.89:1 at 92% — the transparency is free there; on dark the same text drops to 2.88:1 at 78% while 92% holds 4.59:1, because bright code behind a menu is what a dark theme actually has under it. The tier is stamped by the PRIMITIVE: AnchoredMenu adds glass-popover itself, because every menu it renders is an anchored floating panel and a caller that forgets the class is the only way a dropdown stays opaque. 28 more call sites were converted in the same pass (composer pickers, access/thinking/waiting dropdowns, workspace + worktree pickers, model dropdown, project selector, git branch menus, file/tab context menus, search + token-usage + usage-provider menus, context-usage and cost popovers). The rule is [data-surface="glass"] .glass-popover, so every one of those is inert in the classic look.

  • A popover nested in another frosted surface has NO working blur, so it is OPAQUE — raising the tint was not enough (--glass-popover-nested and [data-surface="glass"] [data-composer-style="glass"] .glass-popover in glass.css). backdrop-filter makes its host a backdrop root: a descendant's filter samples that host's painted output, not the page. The composer card is [data-composer-style="glass"], whose own backdrop-filter: var(--glass-card-filter) IS its material — so the model dropdown, the thinking pill, the access panel, the ComposerPicker list and the specs card all ran a blur(24px) that sampled nothing, and the 84% tint became a straight alpha over the transcript. Reproduced by painting 6px black/white stripes behind the panel and reading the pixels through it: nested in the card min/max 0/255, variance 16216 (stripes perfectly crisp); the same panel portalled to <body> 221/224, variance 0.7. The reported symptom — the composer's model dropdown being "terlalu transparan sehingga teks tidak terlihat ketika di belakannya ada teks juga" — measured 1.47:1 of ghost contrast at 84%. A stronger tint does not fix it: 92% measured 1.21:1 and 96% 1.10:1, and ghost text was still plainly readable in the screenshot at both. So the nested tier takes this file's own answer for a surface that is READ — the palette's opaque paper — while the sheen, rim and bloom still paint at full strength, so it reads as glass at its edges. Scope is the composer card ONLY: a menu in <body> (AnchoredMenu, every settings menu) keeps 84% because there the blur is live and measured free. A dialog is NOT the same case — .glass-overlay's 96% tint and the veil already flatten what it covers, so a dropdown inside settings measured clean at 84% under the same stripe probe. The token is repeated in both the @supports and prefers-reduced-transparency blocks (CSS cannot OR them), asserted by glass.test.ts. Verified on the / (commands and skills) and @ (files and agents) lists too: both render inside the composer card, so the same rule makes them opaque, and reverting the token to 84% for an A/B put the ghost text straight back through the rows. The thinking pill and the access panel share it. Scope guards, measured rather than assumed: the Target Workspace picker sits in the CHAT COLUMN, above the card, so its blur is alive and it stays at 84%; a classic/calm/console composer has no backdrop-filter at all, so its pickers keep 84% with a live blur. Only [data-composer-style="glass"] scopes the rule, which is exactly the surface that cannot blur.

  • The two fallback blocks were dead on EVERY dark palette, because specificity beat them (@supports not (backdrop-filter), @media (prefers-reduced-transparency) in glass.css). Both blocks declared their opaque tokens on [data-surface="glass"] — (0,1,0) — while the dark palette's tokens live on [data-surface="glass"][data-theme-variant="dark"] — (0,2,0). Specificity beats source order, so on all 21 dark palettes the fallback LOST: measured with the block's own declarations applied, --glass-panel stayed color-mix(… 62%, transparent) and .glass-chrome stayed alpha 0.38 — a translucent plane with no blur behind it, which is precisely the state those blocks exist to prevent, and it was invisible in light because the light tokens have no competitor. (--glass-card was unaffected only by accident: it lives in the untagged [data-theme-variant="dark"] block, same (0,1,0) as the fallback, so later order won.) The fix is one pseudo-class: :root[data-surface="glass"] is (0,2,0), TIES the dark block, and — being later in the file — wins. Verified through the REAL media query (CDP Emulation.setEmulatedMedia with prefers-reduced-transparency: reduce, which Puppeteer's own emulateMediaFeatures refuses as an unsupported feature name): both variants now go opaque — light rgb(250,248,243), dark rgb(40,44,52) — the aura hides, the sheen drops to 0, and --glass-panel resolves to plain paper. @supports shares the block verbatim, so the same tie fixes it; a Chromium that lacks backdrop-filter cannot be emulated at runtime, which is why the reduced-transparency path is the one proven end-to-end. Pinned in glass.test.ts by asserting the selector carries :root in BOTH blocks, with a negative control (downgrading either one fails the test).

  • Every tier was then swept in both variants, and the material holds. Tiers and their alphas — plane 50/62, chrome 34/38, card 66/70, popover 84/92, overlay 96/96, composer card 66/70, panel-column root transparent — resolve identically across 18 representative palettes driven live in the browser (paper, solarized-light, mono-light, gruvbox-light, kanagawa-light, nord-light, flexoki-light, tokyonight-light, one-dark-pro-soft, solarized-dark, mono-dark, nord-dark, gruvbox-dark, kanagawa-dark, flexoki-dark, dracula-dark, carbonfox-dark, vesper-dark): no tier is opaque under glass and none is transparent where it should not be. Measured as rendered pixels on the hardest palettes — solarized-light chrome 5.52:1, mono-light 16.57, solarized-dark 6.71, mono-dark 15.55 on the chrome tier; cards and the composer read higher. Modelled across all 63 palettes, full-strength text-ink never falls below 4.85:1 on any tier in either variant (worst: solarized-light's chrome at 4.89; glass.test.ts re-derives the alphas from glass.css and sweeps every palette, so a newly ported one cannot land without clearing the 4.5:1 floor), and glass is never worse than the classic surface by more than 0.10 at any ink weight — so the material costs no legibility anywhere. The phone layout carries the same tiers (composer 0.66/0.70 docked, 0.92 stretched in both variants) and the first frame carries data-surface from SSR, so a reload never flashes classic.

  • The right panel is a COLUMN of chrome, and its views' own bg-paper root has to step aside (glass-chrome + data-panel-chrome on the slot in WorkspacePanels.tsx and LeftDock.tsx; [data-surface="glass"] [data-panel-chrome] > .bg-paper in glass.css). Every workspace view — file tree, search, source control, terminal, usage, todos, plan, wiki, and every plugin panel — opens with its own <div class="… bg-paper">, which is correct in the classic look. Under the glass surface it meant the 293px column composited to the palette's SOLID paper rgb(40,44,52) while the sidebar beside it was the plane's chrome paper 38% over the plane: two materials in one window, and the column read as a slab ("right panel juga belum glass banget"). The marker is stamped on the SLOT, never on each view — ten built-in roots plus every plugin would be a dozen chances to forget it, and data-panel-chrome is also what the rule keys on, so a view added later inherits both halves for free. The selector is the direct child only: the toolbars, rows and cards a view draws INSIDE its column keep their opaque paper, because those are read. Measured after: the column is chrome in both variants, and the plane's aura moves through it — luminance spread across the column 0.19 in light / 0.025 in dark, versus a flat single value before; text-ink on the composite holds 4.89:1 (light) / 5.96:1 (dark) worst case over all 43 palettes, i.e. exactly the sidebar's own numbers. In the classic look the slot is transparent and every view keeps its paper — verified with getComputedStyle: slot rgba(0,0,0,0), root rgb(40,44,52).

  • A PLUGIN panel needs a SECOND selector, because it renders inside a scope span (same rule, > [data-plugin-surface] > .bg-paper). A plugin's component is wrapped in <span data-plugin-surface="<id>" style="display: contents"> — the scope the server wraps its stylesheet in — and that span has a BOX in the DOM even though it paints none, so the direct-child combinator stops at it. Measured on the three bundled marketplace plugins in dark: Stats, Runner and Forge all painted rgb(40,44,52) over the column while the built-in views beside them were chrome ("right panel plugins marketplace sudah support glass juga?"). The cause is upstream of the host: every one of them opens with the kit's Panel, whose root is flex flex-col h-full w-full bg-paper text-ink (packages/kabmo-ui/src/components.tsx:35) — a plugin ships its own opinion about its frame, and the host is what has to overrule it, because the kit component is also correct in the editor column and in the classic look. Verified after the selector: all three roots compute rgba(0,0,0,0) under glass and rgb(40,44,52) under classic, while their own internal toolbars and group headers keep the fills they drew (rgb(40,44,52), paper 95%) — the column root is the only thing the host overrules. The LEFT dock carries the same marker (LeftDock.tsx), so a plugin the user places on the left is not a second, forgotten case; verified in the live document by building the plugin DOM shape inside the left slot — glass rgba(0,0,0,0), classic rgb(40,44,52). The phone's drawer is deliberately NOT in this rule: it is a full-screen surface covering the app, not a column beside it, so it stays opaque — the same split the composer uses for its docked and stretched states.

  • A dialog is a panel with chrome strips, and the strips were painting over its material ([data-surface="glass"] .glass-overlay > .bg-paper in glass.css; --glass-dialog-bloom; [data-surface='glass'] .modal-scrim in tailwind.css). Three measured facts, in the order they were found. One: the dialog's own HEADER is opaque. The git commit history modal's 1198x109 header writes bg-paper, which under the glass surface is the palette's SOLID paper rgb(40,44,52) — across the top edge of a 1200x792 panel, i.e. exactly where the material is legible. The panel's highlight and its top-left bloom never rendered and the face read as one flat value ("git history commit modal juga belum glass"), corner-to-middle 1.08:1. The rule is a direct child of .glass-overlay and nothing else — the same scope as [data-panel-chrome] — so a dialog's BODY keeps every card, row and notice it draws (those are read), and no dialog in the tree has a direct child that paints a surface except through a component header, which is the case this exists for. Two: with the strip transparent the bloom was suddenly far too hot. Its alphas had been tuned while the header covered them, so a 1200px panel showed nothing; uncovered, the old 24/20 measured 2.08:1 at the corner — the "silau" failure again. Final values are 3% sheen + info 7% + meta 14%, measured 1.34:1 (dark) / 1.12:1 (light) with the panel's children hidden, corner chroma 12 and 24 — sampling the assembled dialog is not usable here, because its own header text sits in the corner and drags any mean-based sample with it. Three: the veil is frosted (backdrop-filter: blur(20px) saturate(120%) on .modal-scrim, glass only). The dialog's own 96% tint hands the material over to the margin AROUND the panel, and there a flat wash reads as "the app is off" while a blurred one reads as a pane: mean adjacent-pixel luminance delta across that margin drops 4.30 → 0.62 (left) and 2.16 → 0.11 (top) in dark, 2.05 → 0.84 in light, while its average colour is untouched ((39,44,50) → (39,44,51), (143,144,140) both). The interior stays 96% and that is deliberate — a dialog carries prose, and every point of transparency costs it contrast against a veil darker than paper (88% measured rgb(233,230,225) against #faf8f3). Glass is legible at a panel's edge, not in the middle of a paragraph, so all three changes are edge changes. Both the bloom and the frost are dropped by the two fallback blocks (@supports not (backdrop-filter), prefers-reduced-transparency): a blurred backdrop behind a dialog with no blur of its own is decoration with no subject. Notes: light's bloom is WHITE-only (a palette hue is darker than paper and darkens the panel — (212,215,212) against (220,219,215) measured), light's alphas 16/26/12 against dark's 3/7/14; palette extremes checked — solarized-light's weak nav contrast is that palette's own ink/paper pair (2.78 with the bloom, 2.74 without), mono-dark gets a neutral (43,43,44) corner at 8.39:1; and the classic look is byte-identical (bg: rgb(250,248,243), image: none, filter: none, scrim keeps its pre-existing blur(2px) utility).

  • The glass material is engine-level, and the app NAMES the two ways it silently fails (src/shared/lib/theme/glass-support.ts, client/hooks/ui/glass-support.ts, notice in SurfaceStyleSection.tsx). The style is pure CSS rendered by the same page in every shell, so nothing is per-platform: Android's WebView, iOS/macOS WKWebView, Windows' WebView2 and Linux's WebKitGTK 4.1 all draw the same plane. What IS per-platform are the two conditions that switch it off — and glass.css handles both SILENTLY, which makes a window whose setting reads glass and whose material reads classic indistinguishable from a broken setting. So the settings control asks the platform and reports. backdrop-filter is probed in BOTH spellings (CSS.supports('backdrop-filter', …) || CSS.supports('-webkit-backdrop-filter', …)): Chromium shipped the unprefixed property only in 76 while -webkit-backdrop-filter has been there since 47, and the Android shell's floor is minSdk 24 where the WebView is an independently-updated component — an old one needs the prefix, and the stylesheets always write the pair (glass.css 6 pairs, tailwind.css 3). Measured in the local Chromium: unprefixed true, prefixed false, so testing one spelling alone would mis-report one of the two. prefers-reduced-transparency is subscribed, not read once (macOS/iOS "Reduce Transparency" can be toggled while the window is open). glassLimits orders no-backdrop-filter BEFORE reduced-transparency: with no blur the media query has nothing to switch off, so naming the preference first sends the reader to a system setting that changes nothing. Verified in the browser by overriding matchMedia and remounting: the notice renders 926x40 under the two cards with the reduced-transparency sentence; with the platform answering "supported" it renders nothing (correct in Chromium); the four cases — supported, no-blur, reduced, and classic (never shown) — are pinned in SurfaceStyleSection.test.tsx. Bounded blur cost, with one platform caveat: the live stack under a dialog is THREE nested backdrop-filter layers (the .app-window::before plane, .modal-scrim, .glass-overlay) and at most four when a dialog holds a popover (settings/ProjectSelectorDropdown.tsx). That is deliberate — one blur per ROLE, never per row — but WebKitGTK composited nested backdrop-filters at 2^n until bug 327701 was fixed in the 2.54 series (Oct 2026), so a pre-2.54 Linux box pays up to 16 passes for that stack while Chromium and WebKit pay 4. Nothing in this repo can fix a distribution's WebKitGTK; knowing the depth is what keeps the number from growing.

  • A marketplace plugin declares its own mark colour in its manifest, and the host falls back to the hashed hue only when it does not (color in PanelPluginManifest, validated in server/lib/panels/manifest.ts, carried on PanelRegistryEntry/PanelPluginStatus/PanelCatalogEntry → ResolvedPanel.color). Only the plugin knows its brand; a hue hashed from its NAME is stable but arbitrary, and an author who ships a logo should not have it tinted by a hash. Three details are load-bearing. The value is a #RRGGBB hex and nothing else — it reaches an inline custom property, so red, rgb(…), url(…), var(--x) and red; background: … are all REFUSALS with a named reason, not values the host has to escape (the same rule the project accent follows). It is clamped per variant, not trusted: a brand hex is picked for the brand's own background, so #34d399 is 1.9:1 on white paper — legiblePair derives --panel-color-light/--panel-color-dark and the stylesheet picks by data-theme-variant. It is still gated on the colour mode: the rail rule reads var(--panel-color-light, hsl(var(--panel-hue, …))), so monochrome paints the palette ink and the declared brand colour appears only under [data-icon-style="color"] — measured, the Stats mark paints rgb(34,137,99) (clamped) on light, rgb(52,211,153) (declared) on dark, and the palette ink in monochrome. The same hook reaches the mobile chips, the editor rail and the Panel Plugins cards (--plugin-declared-light/-dark on PluginMark), so one manifest field colours every surface a plugin appears on. The four bundled plugins declare theirs (stats #34d399, command-runner #f59e0b, git-forge #a855f7, session-info #38bdf8); a plugin with no color keeps the assigned hue, verified by removing the field from an installed copy and watching the rail fall back to hsl(230 60% 30%).

  • A switch KNOB is a shape, so the canvas-well rule must EXCLUDE it — not be overridden by a second rule (glass.css, the :not([role="switch"] *) on the well selector). The knob is bg-canvas on bg-ink/70: an opaque contrasting disc is the only thing that makes the control read as a toggle, and the well rule makes every bg-canvas inside .app-window transparent. The exemption was first written as its own rule ("…except a knob on a switch"), and it never applied once, because [data-surface="glass"] .app-window [role="switch"] .bg-canvas is (0,4,0) while the well selector is (0,5,0). Measured on the plugin switches: the 12px disc computed rgba(0,0,0,0) and the control was a plain pill with no "on" position — on BOTH layouts, since the race has nothing to do with width. A same-property override is a specificity race; an :not() in the ONE rule that causes the problem is not. The mark is the switch ROLE rather than a class name, so any control that declares itself a switch owns its knob whatever it paints it with. Verified after the fix: knob rgb(245,246,248) on every switch at 430px and 1440px, in both checked states; the sticky header's data-stuck fill still arrives (color(srgb 0.925 0.951 0.976)).

  • A PANEL has one hue, and it is keyed by the PANEL ID — not by the glyph (shared/lib/workspace/panel-hues.ts, client/components/common/panel-mark). Three surfaces draw a panel's mark — the right rail, the phone's chip strip, Settings → Panel Plugins → Built-in — and each answered "what colour is this?" for itself. The rail hashed the panel id (files → 0°); the two lists rendered the bare glyph and therefore took the glyph's hue (lucide-files → 320°). Measured on one-dark-pro-soft, the same Files mark was rgb(228,129,129) in one place and rgb(228,129,195) in the other, and Wiki's BookOpen fell through to the info signal entirely (rgb(97,175,239)) because a glyph that MEANS something takes a signal colour — true of the glyph, meaningless for the panel. Two further defects fell out of the same split: the rail built its map from the panels it was DRAWING (assignPanelHues(catalogIds)), so switching a view off or dragging it recoloured its neighbours, and the Settings list — which also draws the switched-off views — could never have agreed with it. The rule now: the hue map is computed once over the whole built-in universe (SESSIONS_VIEW_ID + RIGHT_PANEL_TYPES, enabled or not), collisions resolved over that same set, and every surface stamps it as --panel-hue through one component. A PLUGIN panel is excluded on purpose — its colour is the plugin's own mark colour (the manifest's color, else the hue of its name), the same one its marketplace card draws; keying that by the slot id would give one plugin two colours, the defect being removed. A caller's weight class (text-ink/70, text-ink/30) no longer decides a panel's colour: [data-panel-mark] rules carry :root so they out-specify inkWeightRules (0,3,1 light / 0,4,1 dark) instead of relying on source order, and the off state is data-idle — luminance in the colour mode, the ink weight in monochrome. Verified: all 11 built-in views report identical computed color on the rail and in the Built-in list in both variants, and the three bundled plugin marks report identical backgroundColor in all three surfaces.

  • A plugin's declared colour is the SAME in both places, so the rail must not dim it (data-declared stamped in ActivityBar.tsx; :not([data-declared]) in railRules). The two views resolve their colour the same way — --plugin-declared-light/-dark from legiblePair(plugin.color) — so the values already matched; what differed was the RAIL's idle state, which applies filter: brightness(0.75) saturate(1.4) (dark) / brightness(1.02) saturate(1.1) (light) to a non-active button. A declared brand colour went through that filter and arrived visibly darker and less saturated than the same mark in Settings → Panel Plugins ("warna icon plugins di setting modal dan di activity bar beda"). Measured: #f59e0b was rgb(245,158,11) in the card and filtered on the rail. The exemption is a DATA attribute (panel.color ? '[data-declared]' : undefined), not a class-name or inline-style guess, so it cannot drift when the mark changes how it carries its own colour — and it is scoped to :not([data-declared]) on the FILTER rather than overriding the filter afterwards, so a later rule with equal specificity cannot resurrect it. Built-ins keep the idle dimming (their hue is OURS to mute); a declared brand is the author's and is drawn at full strength in both views. The rail's idle state still reads for those buttons because it is carried by the BUTTON itself (background and active border), which no filter touches. Verified: all three bundled plugins now report filter: none on the rail and identical backgroundColor to their Settings card in both variants.

  • A switch KNOB is a shape, not a well, and its TRACK states the same two facts as a checkbox ([data-surface="glass"] .app-window [role="switch"] .bg-canvas and [data-icon-style="color"] [role="switch"][aria-checked=…] in the CSS). Two separate defects, both measured. The knob disappeared under the glass surface: the canvas-well rule turns bg-canvas transparent — correct for a chat well, fatal for a knob, because bg-canvas on bg-ink/70 is the only thing making a toggle read as a toggle. Measured on the plugin switches in dark, the 12px knob composited to rgba(0,0,0,0), so all 15 of 15 switches on that page rendered as plain pills with no "on" position. The exemption is keyed on the ROLE, not a class — a control that declares itself a switch owns its knob whatever it paints it with — and it must come AFTER the well rule, since at equal specificity source order decides. The track stayed ink while the checkbox turned green/red: the first pass coloured .kabmo-checkbox and left six switch call sites painting bg-ink, bg-ink/70, bg-ink/20 and bg-ink/15 — five utilities for one fact, which is why the answer is [role="switch"][aria-checked="true"|"false"] and not a seventh class. Same alphas as the checkbox and the same budget: success 55% clears 3.60:1 and error 75% 3.46:1 against the panel, and the canvas knob clears 3.72:1 / 3.87:1 against those tracks (measured in place: green track 10.0:1 vs panel, red 7.13:1, knob-vs-track 9.23 / 6.38). [aria-checked="false"] rather than :not([aria-checked="true"]) on purpose — a switch that forgot the attribute is a bug in the control, and painting it red would hide that behind a plausible state. The notification switch is unaffected throughout because its knob paints bg-paper, which was never transparent — which is also why the bug read as "some switches are fine".

  • The activity bar's idle state moves LUMINANCE, never alpha (railRules in icon-paint-css.ts). [data-idle] used to be opacity: 0.45, and alpha composites the hue with the rail's near-neutral chrome — which throws most of the chroma away. Measured on a 64px glyph, hsl(170 65% 70%) renders at chroma 95 when active and 62 when idle in dark, and the light-theme idle was worse still at 44 against an active 105: washed-out pastels, which is the report "warna icon di activity panel kanan / kiri kok agak kusem". brightness() moves luminance without mixing the colour with anything, and the saturate() beside it pays back what the multiply costs. Dark: brightness(0.75) saturate(1.4) — measured after the tones were solved per hue, 0.62 read 2.86:1 mean with 20 of 36 hues below the 3:1 floor, while 0.75 reads 4.00 mean with none — idle chroma 62 → 88 at contrast 3.69 (was 2.94), i.e. the same quietness with the colour restored. Light: brightness(1.08) saturate(1.1) — re-tuned once the light tone became a solved hex sitting AT the contrast floor (next bullet): the old 1.25 was a factor for a paint with 6.11:1 of headroom and walked every idle mark down to 2.23:1 on the new tones. Re-measured over the 36 shipped tones, 1.08/1.1 reads 2.79:1 mean against the active 3.30:1 and holds chroma at 111% of the active mark, so it is still a visible step down that reads quiet rather than dim. The two variants shift in OPPOSITE directions because "recede" does: idle is darker on ink and lighter on paper. Brighter steps were measured and rejected — 1.5 walks the icon up the chroma curve and out of the rail's range (2.22:1 against 3.82:1 active, glare). The rule stays gated on [data-icon-style="color"], so monochrome is untouched (filter: none, ink at the caller's weight), and both rails share it because ActivityBar renders one mark class for side="left" and side="right". Pinned in icon-paint-css.test.ts, including not.toContain('.panel-rail-mark[data-idle] { opacity') — an opacity left behind would desaturate exactly what the filter restored.

  • The light side is solved per PAPER BUCKET, brightest-first, and that is what "light mode kusam" needed (icon-tone.ts: PAPER_BUCKETS, paperBucketOf, solveIconTone; ICON_TONES keyed by bucket; data-icon-paper). Three facts, each measured over the 32 light palettes, weighted by how many palettes each paper serves:

    • One table is solved against the DARKEST light paper, so every brighter palette painted an icon at lightness it did not need. On the default palette that was mean L 0.582 where the paper allows 0.640, against dark's 0.782 — a 0.20 gap that reads as "light kusam, dark cerah".
    • Splitting fixed most of it. Six buckets lift the weighted mean L 0.6198 → 0.6260; three buckets reach 0.6222, and a table per palette (30 x 36) tops out at 0.6335 — so six buckets buy 78% of the headroom for 216 generated rows instead of 1080. The edges are midway between consecutive papers in the catalog, which is why they look arbitrary: they are derived, and the suite re-derives them.
    • The ORDER the solver prefers was wrong for this report. It took the most chroma first and lightness second, so it spent brightness buying chroma the hue could not use. Light now prefers the BRIGHTEST legal candidate, then chroma; dark keeps chroma-first, because dark was never reported as dull and its band (0.74-0.82) is already the whole point.

    The hard ceiling is worth stating so nobody re-opens this: at 3.15:1 on #f1f1f0, the brightest legal OKLCH lightness for ANY hue averages 0.632. A light glyph cannot be as bright as a dark one — L 0.78 on that paper is 1.96:1, i.e. invisible. The gap is a property of the medium, not a setting.

  • Chroma cap 0.19 → 0.22, and it is a different change from the brightness one (ICON_TONE_CHROMA_CAP). It does NOT brighten a dull hue — teal/cyan sit at the sRGB gamut boundary, so a bigger cap does nothing there — but it does make the table more alive: mean chroma 0.1672 → 0.1789, with the worst painted contrast unchanged at 3.15:1 and 0/1152 rows below the floor.

  • A small glyph is drawn with a heavier stroke, because its colour cannot get brighter (smallGlyphStrokeRules in icon-paint-ink.ts). 10-14px glyphs take stroke-width: 2.25; every larger size keeps the library's 2. Measured constraint that shaped the selector: Lucide writes stroke-width="2" for a default AND stroke-width="1.8" for an explicit prop, so :not([stroke-width]) never matches and a rule built on it is dead code that reads like a working opt-out. The four bundled explicit weights (1.6-2.4) all sit within a step of 2.25, so the intent survives.

  • A mute now darkens slightly as it removes chroma (WEIGHT_LIGHTNESS_SINK in icon-paint-weight.ts). Scaling chroma alone is not contrast-neutral: the tone sits AT the floor, and a less chromatic colour at the same lightness measures worse. Measured after the tone was brightened, text-ink/50 on a 13px folder glyph read 2.96:1 — under the floor, on the sidebar's own marks. calc(l - 0.08 * (1 - scale)) takes the quietest weight from min 3.02 → 3.48 and /40 from 3.06 → 3.41, while the FULL-strength tone keeps the brightness it was solved for.

  • A light-mode hue is SOLVED per hue, not stated as one pair — one pair spends the whole legibility budget on the worst hue (shared/lib/icons/icon-tone.ts, ICON_TONES in tint-hues.generated.ts, --icon-tone in icon-paint-css.ts). The report: "warna icon di mode full color ketika light mode kelihatan kusem", while the same icons look bright in dark. Not a rendering difference — a budget difference, and it is measurable. color mode painted light with one hsl(H 60% 30%) for all 36 hues, and that pair is pinned to the 3:1 non-text floor, so its saturation is whatever the WORST hue tolerates. Chroma is not evenly spread on the wheel: over the 36 generated hues the pair spans OKLCH chroma 0.075 (hue 190, #1f6b7a) to 0.164 (hue 300), mean 0.121; dark's hsl(H 65% 70%) reaches 0.126 with 4.07:1 of contrast headroom left unspent. Light spent everything and still had less colour than dark, which never had to spend. One pair cannot fix this — measured, 85% drops the worst hue to 2.66:1 and 100% to 2.32:1, both under the floor; gamut binds differently at every hue, so the tone is solved per hue. The rule: keep the hue, take the most chroma sRGB can show at that lightness (capped at 0.19; uncapped, magenta lands on C 0.25 = #f00580, a neon sign beside a toolbar glyph), keep only lightnesses where the painted byte clears 3.15 on EVERY shipped light palette, prefer the most chroma then the lighter candidate. Result over the same 36 hues: mean chroma 0.121 → 0.162 (×1.34), the muddiest row (hue 190) 0.075 → 0.102, hue 200 0.078 → 0.121, EVERY hue improves, and the worst painted contrast stays at 3.15 — i.e. +34% colour with the floor intact. The answer ships as a generated TABLE, not a call: the solve needs THEMES and ~11k contrast checks, which the client must not pay to colour a toolbar glyph, so scripts/icon-tints.mjs runs the solver at build time and icons:tints:check fails when the table and the solver disagree. Light reads var(--icon-tone, hsl(…old pair…)); dark is deliberately untouched — it already reads bright, and raising its chroma would only invert the complaint. iconTone() snaps an off-wheel hue to the nearest step, because every producer is a hashHue result (36 steps of 10°) or a table row; PanelMark and PluginMark stamp --icon-tone for their RUNTIME hues, which no generated CSS row can carry — without that stamp a plugin falls back to the dated pair and is the one dull mark in a bright rail. Pinned in tint.test.ts (per-palette floor, mean chroma > 1.3x the old pair, EVERY hue improves, hue preserved within 12°, wheel snapping) and panel-mark/index.test.tsx. Measured in the running console (dev server, theme paper, data-icon-style=color): the sheet is 49 978 bytes with 210 --icon-tone rows, a glyph reads rgb(0,134,134) from --icon-tone: #008686 in light and rgb(129,228,228) in dark, a signal glyph (lucide-info) carries no tone and stays on var(--theme-info) in both, and all 14 rail marks stamp --panel-hue with the matching --panel-tone (hue 190 → #00899f). The gzip cost of the table is +275 bytes, because 36 hexes beside 210 rows compress flat.

  • A project's accent is the ONE colour the user picked, and an ink WEIGHT must not out-specify it (projectAccentRules + :not(.project-accent-mark) in inkWeightRules, icon-paint-css.ts). Both sidebar headers set the accent as a custom property (--project-accent) and also write text-ink/70, so the two rules compete. The dark weight selector is [data-icon-style="color"][data-theme-variant="dark"] svg.lucide[class*="text-ink/70"] = (0,4,1) — four class-level selectors plus the svg element — and :root[data-icon-style="color"] .project-accent-mark is (0,4,0), one ELEMENT below it. So on every dark theme all ten folder marks came out the SAME hue (color(srgb 0.782 0.563 0.851) for #fbbf24, #3b82f6, #94a3b8, #2dd4bf alike), which is "icon folder di sidebar jadi sama warnanya"; light looked correct the whole time because its weight selector is (0,3,1), and that asymmetry is why nothing caught it. The fix is not to escalate the accent — a tie is a bug waiting for the next attribute — but to state the rule where it belongs: an ink weight does not apply to a mark painted in the user's own colour, so inkWeightRules excludes .project-accent-mark in all 30 weight selectors. Verified after: ten marks, seven distinct computed colours, each equal to its own --project-accent in both variants; under monochrome all four sampled marks resolve to the same ink at 70%, i.e. the accent is still off, as designed (the accent rule is gated on data-icon-style="color"). Legibility is a separate question and is NOT changed here: measured against the sidebar's own surface, the raw hexes range from 1.60:1 (#fbbf24 on light paper) and 2.39:1 (#3b82f6 on dark) up to 5.26:1 — the accent is painted exactly as chosen, which is right for fidelity and below the 3:1 graphic floor in both variants.

  • text-ink/60 is a WEIGHT, not a colour — and a weight means LESS COLOUR, not a darker colour (inkWeightRules in icon-paint-css.ts). The settings sidebar, the composer toolbar and several hundred other call sites mute an icon with text-ink/40-/90. That is "the ink, quieter": the caller chose a weight, not a colour. A utility class is (0,1,0) and the hue rules are :where() (0,0,0), so the mute won — every muted icon stayed ink in the colour mode, which is what "icon di setting modal kenapa gk full color" was. The first answer mixed the hue toward var(--theme-ink), and that is the wrong lever: it desaturates AND darkens, and darkening is the opposite of a mute. Measured on the settings sidebar (hue 250, #736aec on paper's #faf8f3): the pure tone reads 3.96:1, text-ink/60 monochrome reads 4.74:1, and the old rule painted 7.48:1 — a muted icon DARKER than the active one beside it and darker than the monochrome ink it replaced, which is the "icon di modal setting masih kusam di light mode" report. Over all 36 hues × 32 light palettes the old rule moved mean contrast 4.37 → 9.46 as the weight got quieter, while monochrome moved 9.17 → 1.60. The weight now multiplies CHROMA and leaves LIGHTNESS alone (oklch(from var(--icon-color) l calc(c * N) h)), so 60% is the same hue, quieter, at the legibility the tone was solved for: contrast holds at 3.87 mean / 3.07 min from /90 down to /25 while chroma falls 0.146 → 0.040 (dark: 3.83 mean, 3.02 min). Two more facts are load-bearing. The paint is stated ONCE, against a --icon-color source variable (--icon-paint: var(--icon-color); color: var(--icon-paint)), so a weight transforms whatever produced the colour instead of racing each source on specificity. Three facts about that one rule, each measured. (a) It is NOT :where(): the subject is color, which the call sites also set, so zero specificity lost the mode entirely and color kept resolving to oklab(… / 0.6) in the running settings modal. (b) It covers all THREE families — :is(svg.lucide, svg[data-provider], svg[data-file-brand]) — because a provider or file-type mark is its own <svg> with no lucide class, so a .lucide-only rule left every brand mark inheriting its row's muted ink (measured: a brand svg computed oklab(0.523 -0.022 -0.018 / 0.8) while its --icon-color held the brand hex; after the fix 38 of 38 painted brands apply, and the other 38 have no colour row by design). (c) The weight selector uses [class~=…], never [class*=…], because a substring match also fires on the VARIANT token: text-ink/50 group-hover:text-ink/80 matched both, so the resting icon was painted at its hover weight (measured on the composer's target picker, Folder computed c * 0.8 while not hovered). The variants are re-stated in their own right — hover: as svg:hover, group-hover: as .group:hover placed AFTER the [data-icon-style] gate, since the group is an ancestor and written before it the selector matched nothing at all. A signal glyph now survives the weight: Bell under text-ink/60 used to paint rgb(26,53,80) — the warning orange replaced by the hashed-hue path — and now paints warning at 60% chroma. oklch(from …) is relative colour syntax (Chromium 119+, Safari 16.4+, WebKitGTK 2.42+); an engine without it ignores the declaration and keeps the full-strength paint, so the failure is an unmuted icon, never a missing one.

  • Monochrome means INK, and a tool card is ink in BOTH modes (monochromeRules / toolCardRules in icon-paint-css.ts; project-accent-mark in both sidebar headers). The setting shipped as "the absence of a hue", which only stopped the generator from ADDING colour — it did not take away what an author had written, so a Check with text-success in a tool card stayed green with monochrome selected ("di setting monochrome kenapa iconnya berwarna?"), and the same icon turned into a hue under color, which read as the mode half-applied. Three rules, each with a measured reason. var(--theme-ink), not currentColor: a check inside a green status chip INHERITS the chip's green, and currentColor left two icons coloured through a whole monochrome pass (lucide-info in an info chip, a loader in a warning one); the selector also excludes [class*="text-ink"] (that IS the ink, at the weight the caller chose) and .bg-ink * (an inverted surface keeps its canvas foreground — verified, the primary button's icon stays rgb(244,241,234) on rgb(20,19,16)). A tool card forces ink in BOTH modes: one turn can hold twenty cards, each with a status chip, a file mark and a chevron, and a hue per icon turns the densest part of the app into confetti — the codebase already said so for file-type marks (languageBrandIcon passes monochrome for exactly this surface) but never covered the Lucide glyphs. The project ACCENT belongs to the colour mode: it is a per-project colour the user picked, and it was an inline color that no stylesheet could answer, so it now rides as --project-accent and .project-accent-mark reads it only under [data-icon-style="color"] — measured, the folder mark is rgb(251,191,36) in colour mode and the palette ink at 70% in monochrome, while the accent DOT beside it stays coloured as the project's identity. Verified end to end: 0 coloured icons in monochrome (was 13), 122 in colour mode with 0 of them inside a tool card.

  • Dark is SOLVED per hue inside a pinned lightness band, because one hsl(H 65% 70%) made the wheel uneven (icon-tone.ts: solveIconTone(hue, variant), DARK_LIGHTNESS_LADDER; ICON_TONES_DARK in tint-hues.generated.ts; --icon-tone-dark per row). Light was solved first and dark was left alone on the argument that "it reads bright already". Measured, that argument was wrong in one direction and silent in the other: the single pair spreads OKLCH lightness over 0.25 (L 0.65 at hue 240 against 0.90 at hue 60), so a blue icon is visibly heavier than the yellow beside it, and its muddiest row carries chroma 0.082 against the vividest row's 0.172 — a 2.1x gap, which is the same "kusam" complaint one variant later. Solving dark per hue with NO bound does not fix it: the solver spends every point of lightness the dark palettes would allow chasing chroma and still spreads 0.20. Pinned to a 0.74-0.82 band it cannot, and the measurements are why the band is the fix rather than a prettier ladder: spread falls to 0.08, mean chroma RISES 0.126 -> 0.170, the muddiest row goes 0.082 -> 0.133, and every row still clears 3.15:1 on all 31 dark papers (worst 5.47). Light-to-dark hue drift stays under 8 degrees, so a glyph is the same colour on either theme.

  • A MUTE keeps a chroma floor, because "quieter" is not "greyer" (WEIGHT_CHROMA_FLOOR in icon-paint-weight.ts). The weight rule multiplied chroma by the step — right in KIND and wrong in DEGREE: measured over the shipped tones, text-ink/40 (the most common icon mute in the app, 84 call sites) painted chroma 0.065 where the tone is 0.163, and 169 of 1139 coloured glyphs landed under chroma 0.08, i.e. indistinguishable from ink. That is the report this reopens: "iconnya kelihatan abu-abu, bukan warnanya redup". The curve is now FLOOR + (1 - FLOOR) * step with FLOOR = 0.45, so /40 paints 0.67 of the tone (chroma 0.110 instead of 0.065) and /20 0.56 — while the ORDER the ramp exists for survives (/90 is 0.945, still 1.4x the chroma of /40). Contrast is untouched by construction: only chroma moves, and the tone's solved lightness is what the floor is measured against.

  • An AUTHOR's signal class is authority, not a default to overwrite (authorColourRules in icon-paint-css.ts). The mode paints by hue, and a hue is only ever the answer to "this icon said nothing". Twenty-two call sites say something — a LogOut on a destructive provider action is text-error, a Play on a successful eval is text-success, an Info about a reconnect is text-info — and every one was silently repainted with its hashed hue the moment the setting was turned on, so the mode DISCARDED the only colour information the call site had. The rules set --icon-color (not color) for text-error/success/warning/info/meta and for their slashed forms (text-error/60 — 29 live sites), so the value flows through the same paint and weight rules as every other source. [class~=...], never [class*=...]: a substring match also fires on the VARIANT token, so group-hover:text-error would paint the resting glyph red.

  • A solid signal fill owns its icon's foreground (solidSignalFillRules in icon-paint-css.ts). bg-error text-canvas is a filled destructive button — Delete, Close, the mobile save-and-recreate — and the colour mode painted the glyph in the SAME red as the fill it sits on. Measured in the running console: Trash2 computed rgb(200, 50, 30) on rgb(200, 50, 30), 1.00:1, a blank square where a bin should be. The rule takes currentColor for [class~="bg-error"] / bg-success / bg-warning / bg-info, which is the surface's own declared foreground — the same argument invertedSurfaceRules makes for bg-ink. [class~="bg-error"] matches the SOLID token only (Tailwind spells a tinted chip bg-error/10, a different token), so a chip that merely borrows the signal as a wash keeps its hue.

  • A project accent is CLAMPED for the glyph and exact for the swatch (projectAccentStyle in shared/lib/workspace/project-accent.ts; --project-accent / --project-accent-dark in projectAccentRules). The ten presets are chosen to look good as SWATCHES, where the hex is its own background and any value reads. As a GLYPH on paper, measured over the 32 light palettes, nine of the ten fall under the 3:1 floor: #a3e635 1.15:1, #fbbf24 1.27:1, #2dd4bf 1.42:1, #84cc16 1.51:1, #38bdf8 1.63:1. So the mark takes the legiblePair of the user's colour — the same rule every brand mark obeys — and the swatch keeps the exact hex the user picked. A colour already legal on both variants is kept unchanged (#7c3aed is).

  • No icon is painted by a Tailwind palette rung (src/client/palette-class.test.ts). DESIGN.md says every colour goes through a var(--theme-*) token, and icons were where it kept being broken because a rung does not look wrong on the developer's own theme. Measured over the 32 light palettes: text-amber-500 1.64:1, text-sky-400 1.63:1, text-emerald-500 1.93:1, text-emerald-600 2.87:1 — all under the 3:1 non-text floor, each on an icon whose colour WAS the message (a save in progress, a favourite star, a connected check). The replacements are the signal tokens, which signalTextColor solved to 4.50:1 minimum on every palette of both variants. A source scan enforces it over the <Icon className> elements of every file that imports lucide-preact, and deliberately ignores categorical chart series and decorative dots/gradients, which are not icons.

  • An INVERTED surface (bg-ink) takes the icon's colour from its own foreground, not from the hue table (icon-paint-css.ts: invertedSurfaceRules). The palette's ink is the FOREGROUND, so bg-ink is dark on a light theme and light on a dark one — the opposite of paper in both — which made the colour mode's hue wrong on it in both directions. Measured on the primary New Session button: rgb(129,179,228) on rgb(171,178,191) (1.6:1, "icon + tidak terlihat di dark mode") and rgb(31,77,122) on rgb(20,19,16) (1.9:1). Swapping the variant's hue was tried and rejected on measurement: the ink is a MID-TONE in several palettes (solarized-light #586e75, solarized-dark #93a1a1), so no hue at any lightness clears 3:1 on every palette's inverted surface — worst case 1.59. What does clear it is the pair the palette already guarantees: every bg-ink surface declares text-canvas/text-paper (verified: all four in the sidebar do), so the icon inherits it with color: currentColor (and a plugin mark's --plugin-color likewise). Measured after: 7.22:1 on one-dark-pro-soft, 16.47:1 on paper. The rule is stated last in the sheet because it shares zero specificity with the base hue rules — document order is what lets it win.

  • The activity bar and every plugin mark get their own colour, and the rail needed BOTH a hue per panel and a specificity exception (shared/lib/icons/tint.ts: hashHue, assignPanelHues; .panel-rail-mark + [data-plugin-mark] in icon-paint-css.ts). Three defects, all reported as "icon panel right harus punya warna sendiri, termasuk yang marketplace". First, the rail expresses a panel's state as a TEXT COLOUR (text-ink/40 → text-ink), and a colour class beats a zero-specificity :where() rule — so the right rail stayed monochrome while every glyph in the panels behind it was tinted. The mark is now wrapped in .panel-rail-mark, whose rules carry a real selector (specificity 0,2,0) and whose STATE is [data-idle] { opacity: .45 } — read only under the colour mode, so monochrome still dims exactly as it did. Second, a plugin's name arrives at RUNTIME (the manifest is read from disk, and a marketplace install adds rows no build could see), so it cannot be a generated row: PluginMark sets --icon-hue inline from hashHue(name) — the SAME FNV-1a/36-step function the generator uses, asserted equal in tint.test.ts — and the stylesheet turns it into --plugin-color, which the mask paints with (var(--plugin-color, currentColor)) and the initials fallback reads as its text colour. Monochrome leaves --plugin-color undefined, so both fall back to the ink they always used. Third, a bare hash collides: fourteen buttons on a 36-slot wheel collide about nine times in ten (birthday bound), and three right-rail icons landed on the same blue — assignPanelHues sorts the ids and probes forward 10° until the slot is free, so every button gets its own hue and reordering a rail never recolours it. Measured after: 14 buttons, 14 distinct colours, and the marketplace cards' four masks each carry their own --plugin-color.- EVERY icon is TWO paints behind ONE attribute, and the paint is a DEFAULT that must sit in Tailwind's utilities LAYER — :where() alone is not enough (iconStyle: 'monochrome' | 'color', shared/lib/theme/icon-style.ts, shared/lib/icons/, generated sheet from icon-paint-css.ts). Three families answer one switch: functional Lucide glyphs, provider/model marks, and file-type marks. monochrome is the default and the absence of the attribute, and it is what every icon shipped as: currentColor. Two mechanisms make color safe over 346 files that never agreed to it, and both are required: every selector is :where()-wrapped (zero specificity) AND the whole sheet is inside @layer utilities. A cascade layer outranks specificity, so an unlayered zero-specificity rule still beat text-ink/75 — measured in the running console, a muted folder icon painted its generated purple instead of the muted ink; wrapped in the utilities layer, the caller's class (0,1,0) wins and the mode only fills in what nobody coloured. Functional glyphs cannot be "brand coloured" — there is no second artwork — so color tints each glyph with its OWN hue from a generated table (bun run icons:tints, 210 rows, a 36-step wheel, stable FNV hash of the name), and the glyphs whose meaning IS a signal keep the palette token instead (--theme-error for a trash can, -success for a check, -warning for a clock, -info for an info dot). The hue's lightness is a legibility budget, not taste: measured across every palette, 60% 30% keeps the worst light hue at 3.46:1 on tokyonight-light's #dee0ee paper and 65% 70% keeps the worst dark hue at 4.07:1, while the "prettier" 34% drops two hues under the 3:1 floor. Brand art keeps two values per brand, derived rather than typed: claude's #D97757 is 2.38:1 on tokyonight-light and 4.42:1 on jetbrains-dark, so legiblePair mixes toward black/white until every palette of that variant clears the floor, and a near-monochrome brand gets dark: null (the ink) instead of a #737373 that pretends to be a brand colour — the same answer the reference gives with filter: invert(). Coverage is honest: 35 of 73 provider glyphs publish a colour; the rest keep the ink in both modes, and the settings copy says so. The four file-type icons that carried hardcoded hexes (#22c55e, #f97316, #c084fc, #eab308) now take a tint role, which is the first time monochrome reaches them.

Clone this wiki locally