Files
loki/docs/development
GandClaude 736fc7865b Rebuild the phone experience, and make the numbers on it mean something (#393)
* feat(public): rebuild the marketing site for the phone it is read on

The public surface was designed at desktop width and shipped to phones
unchanged. On a 390px screen the header alone was 220px — a quarter of the
viewport — with "PERSONAL SYSTEMS" wrapped onto two lines and the primary CTA
clipped off the right edge on every page. Everything below it inherited desktop
floors: a 52px headline min that broke "Run your fleet. From anywhere." into
three lines with a wrecked rag, 20px body copy six lines deep, 200px card
floors, and 96px section padding that read as the page having ended.

Header. Sticky at every width, 56px on a phone: compact brand lockup, one
always-visible CTA that cannot wrap, one menu button. Theme cycle and Sign in
move into the drawer — four controls do not fit a 390px row, and the CTA was
the one that lost. The drawer is now a real sheet: conversion actions first,
56px rows with descriptions, appearance in the footer. It is mounted by
PublicHeaderActions rather than PublicSurface, because the shell is pulled into
client bundles by AuthShell and cannot call auth().

Type and rhythm. Display sizes are viewport-relative with phone-sized floors
and unchanged desktop ceilings. New ui-public-section / -section-gap /
-container* primitives replace ad-hoc py-24 + max-w-* px-6 across every page.
The homepage is 4,564px instead of 5,466; releases 10,338 instead of 12,255.

Content. "Download runner" is a dead end on a phone — Fleet Runner is a .deb /
.dmg / .exe. The hero offers the tour instead below sm, and /download leads
with a handoff panel (open the web app, copy the install link) with the desktop
flow one deliberate tap away. That detection also fixes a real bug: an Android
UA contains "linux" and an iPhone UA contains "Mac", so phones were being
offered an 80 MB Debian package or an Apple Silicon disk image.

Fixed along the way, all confirmed in a headless browser at 320 and 390:

- The footer used text-white/* after the surface became theme-aware — every
  heading and the copyright line were invisible on the Light theme.
- Bare GitHub URLs on the legal pages overflowed a 320px viewport, and
  .ui-public-surface clips, so the tail was gone rather than scrollable.
- Auth inputs were 14px, which makes Safari zoom the page on focus.
- Standalone links ignored the pointer:coarse floor: min-height does nothing
  to an inline box, so "Forgot password?" measured 16px tall.
- The hero fleet console truncated every project to "Life OS + AI agent …".

Zero horizontal overflow and zero sub-44px standalone targets across 22 public
routes at both widths; prose links stay inline per WCAG 2.5.5.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbuhKUVJRFzLufKyPLjHKN

* fix(app): make the accent tokens visible, and the shell usable on a phone

Two findings from driving the authenticated app through a real headless
browser at 320 and 390 CSS px.

**`text-accent` was invisible in both themes.** `--accent` /
`--accent-foreground` are shadcn's accent SURFACE pair: `--accent` is a
background tone, oklch(0.14) in dark and oklch(0.96) in light — one step from
the page background either way. Thirty-one call sites used it as ink.
Measured contrast: 1.0 in dark, 1.03 in light. What that hid was not
decoration but the first screen a new user sees — the Control onboarding CTAs
"No install needed →", "Download for your OS →", "Start →" and "Import →" were
painted the same colour as their own cards. `border-accent` failed identically
as a card hover highlight (four places), and `bg-accent` as the selected-repo
checkbox fill, so a ticked box looked unticked.

Now `text-accent-text` / `border-accent-primary` / `bg-accent-warm +
text-on-accent`, measured back at 9.3:1 in dark and 20.6:1 in light.
`check:design` gains an eighth check so the bare token cannot return, and
docs/branding-design.md names the trap: a token that reads like a colour may
be half of a surface pair — check its lightness against what it will sit on.

**Shell fixes at phone width:**

- The email-verification banner packed a sentence, two buttons and a dismiss
  into one 358px row, so the message truncated to "Verify your email for …" —
  losing the word ("optional") that decides whether to care. Message and
  actions now stack below `sm`. It renders on every authenticated route.
- Settings gave the username field a 26-character host prefix, leaving ~120px
  for the part being edited and overflowing its own border. The phone gets
  `/u/` alone, and the input is 16px so Safari stops zooming on focus.
- A bech32 wallet address on /money has no break opportunity and ran off a
  320px viewport.
- `ui-link-muted` is inline-flex, so the pointer:coarse floor can reach it —
  min-height does nothing to an inline box, which is why card-header actions
  like "View details →" measured 16px tall.

Verified across 17 authenticated routes at 320 and 390: no horizontal
overflow, and every remaining sub-44px target is a link inside a sentence,
exempt under WCAG 2.5.5.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbuhKUVJRFzLufKyPLjHKN

* fix(shell): flow-page headers, 16px inputs, and phone-only palette chrome

Third pass over the phone experience, from the same headless-browser sweep.

**Flow pages said everything twice and put the exit in the wrong place.**
/control/new-from-scratch rendered an h1 "Start a new project", then a
stranded "← Back to Control" row, then a card whose h2 read "Start a new
project" and repeated the same intro paragraph — three headings deep before
the first field, on the viewport with the least room for any of them.
PageLayout gains a `back` slot that renders above the title, where a back
affordance is looked for; the three Control flow pages use it and the
duplicated heading is gone.

**Inputs under 16px make Safari zoom the page.** Every field a phone user
types into is now `text-base sm:text-sm`: the app's shared `ui-input` and
`ui-input-compact` (search boxes, every inline edit), the command palette
input (which autofocuses the moment the panel opens, so the zoom was
unavoidable), the terminal's phone composer — the one field an operator sends
agent input through, where the zoom pushed the terminal out from under the key
deck — and the settings username field. Desktop density is unchanged from
`sm` up.

**Smaller things:** the command palette's keyboard-hint footer ("↑ ↓ navigate,
⏎ open, ⌘K toggle") is `hidden md:flex` — three shortcuts nobody can press,
costing a line of the list the panel exists to show; and the reset-password
"Request a new one" link is a real 44px target rather than a 16px inline one.

Re-measured after the change: 22 public routes and 17 authenticated routes at
320 and 390 CSS px, no horizontal overflow anywhere, and every remaining
sub-44px target is a link inside a sentence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbuhKUVJRFzLufKyPLjHKN

* polish(public): lead the phone with the entry point it can actually take

Two last passes over the marketing surface at phone width.

"Run locally" is the first of the three GET STARTED cards, which is right on a
desktop — the visitor is plausibly sitting at the machine that would run the
agents. On a phone it is the one entry point they cannot take, so the list
opened on a dead end. It is `order-last` below `md` and the hosted control
plane leads there; the grid restores config order at `md`.

The footer's link columns paired an 8px gap with the 44px rows the
pointer:coarse floor gives every link, so each column read as a list with
holes punched in it. The gap is desktop-only now, and the links use
`ui-public-link-standalone` so the floor actually reaches them — as an
`inline` box, `ui-public-link` was ignoring the min-height it was granted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbuhKUVJRFzLufKyPLjHKN

* fix(brand): drop the public wordmark below 360px instead of overlapping it

At 320 CSS px — the narrowest width this app claims to support — the header's
"FleetCrown" wordmark, the "Get started" pill and the menu button do not fit on
one row, and the pill was drawn over the word rather than pushing it aside
(the CTA is shrink-0, the wordmark had nothing telling it to yield).

Below 360px the wordmark is hidden and the spiral carries the brand alone; it
also truncates now, so no future label can overlap its neighbour. Measured
across 320 / 360 / 375 / 390 / 414 / 430: a 65px header at every width, no
overlap and no overflow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbuhKUVJRFzLufKyPLjHKN

* fix(people): show people on the people page

/people is a contact list on which you could not see a contact. Measured at
390 x 844 with five people in the book, the first person card started 980px
down — 1.16 screens — and everything above it was chrome:

    164px  search / sort / Add, three stacked full-width rows
    482px  PeopleBookPanel: a four-product glossary, three import
           recipes, three action buttons
     96px  health filter chips, wrapped onto two rows

The book panel is the bulk of it, and it rendered unconditionally — a user
with three hundred contacts scrolled past "FleetCrown is the book. Loki talks
to it. OpenClaw is the WhatsApp/Telegram workspace… Hermes is a task CLI"
on every single visit. Two of its three import recipes are desktop export
flows (contacts.google.com → Export → Google CSV; File → Export vCard) that a
phone cannot perform, presented as instructions the reader is apparently
failing to follow.

It is now a collapsed disclosure below the list, expanded by default only when
the book is empty — the one moment when filling it IS the page rather than
setup you already did. On a phone it also says which of the recipes need a
computer. The control row is one row instead of three (Sort keeps its label
from sm up and drops to its icon below it), and the health chips are a single
scrolling row like every other filter row in the app.

First contact: 980px → 308px. Four people now fit on the first screen.

Also on /prompts, found by measuring every control label in the app for a
wrapped line: "New prompt" was the only genuinely wrapped button in the
product. Its header was `flex items-center justify-between` with no gap and a
shrinkable button, so on a 358px row the label broke across two lines inside a
92px pill pressed against the sentence beside it — the same defect as the
public header CTA. Now gap-3, shrink-0 and whitespace-nowrap.

And UserPromptsSection.tsx carried a literal NUL byte, used as a separator in
a dedup key. It made the file read as binary to grep, diff and editors —
including to ripgrep, which is what check:design runs on, so the file was
silently excluded from the gate. Writing it as a unicode escape instead
(byte-identical at runtime) immediately surfaced a real hover:border-accent
violation the gate had never been able to see. Fixed too.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbuhKUVJRFzLufKyPLjHKN

* fix(mobile): quickstart's device split, empty stat rows, one tier of project actions

The last three findings from the phone sweep.

**Quickstart tells you which steps your device can do.** The homepage sends
phone visitors here ("See how it works"), and the page opens with "1. Decide:
web or desktop?" then spends steps 3–5 on installing a binary, an agent CLI
and a project path — terminal work, on a page reached from a phone. The steps
are a genuine sequence so the numbering stays; what was missing is that three
of them need a computer and four do not. A device map at the top now says so
and anchors into each step, and the three desktop steps carry the marker on
their own headings. A reader on a phone can now do 1–2 and know exactly what
is waiting at their machine.

**A row of zeros summarises nothing.** /habits and /goals opened with three
stat cards reading 0 / 0 / — above an empty panel that said the same thing
again, under a header that already offered "New Habit". Four statements of
"you have none", filling the phone fold. The stat row is hidden until there
is something to summarise, so the empty state is the single answer.

StatRow also left an orphan: three cards in a two-column phone grid put the
third half-width beside a gap. `:last-child:nth-child(odd)` spans the odd card
out across the row — correct for three (2 + 1-wide) and for four (2 + 2), with
no per-page rule. It fixes /money and /memory at the same time.

**The project header claimed one visual tier and rendered four.** Its own
comment says "everything here is a quiet ghost link", but LiveUrlField drew a
bordered secondary button, OrangeCatPublishButton an unlabelled cat icon, and
ProjectSharePanel a second bordered button — so on a phone, where the row
wraps to two lines, it read as four unrelated controls rather than one set,
with the sole bordered button reading as the page's primary action (it is
not; that is Kickoff, further down). All five are ghost links with labels
now, and the cat glyph has a word next to it.

Re-measured: 22 public and 17 authenticated routes at 320 and 390, no
horizontal overflow; every remaining sub-44px target is a link inside a
sentence. tsc, eslint, check:design (8 checks) and 106 unit tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbuhKUVJRFzLufKyPLjHKN

* fix(clarity): give the numbers and the glyphs a noun

A score with no unit, a chip with no noun and a control whose only
explanation is a hover tooltip all read as magic on a phone, so people
learn to ignore them. Six fixes, all in that class.

- Health chip: was ten unlabelled ticks and a bare "6/10", explainable
  only by hovering a `title` that a touch screen never renders. Now reads
  "Health ●●●●●● 6/10 · 4 to do" and taps open the ten named checks — a
  bottom sheet below sm, an anchored popover above it. The failing rows
  carry the action that earns the point, so they are no longer truncated.
- "Status" vs "Stage": one field, two words, sitting two chips apart —
  the editor said "+ status", the health check said "Stage declared".
  The app already spends "status" on CI, run and agent status. Unified on
  "Stage"; the bare value chip now carries the noun ("Stage Production").
  The attr key is untouched — this is vocabulary, not schema.
- Health signals: "No broken" / "No open broken recorded." was built by
  lowercasing a badge label, producing a sentence with the noun missing.
  Written per signal now (clearLabel) instead of derived.
- Prompt stats: "82% · 12 runs" made the reader guess the numerator.
  Now "82% success · 12 runs".
- Notifications pill: rendered a button that could only fail when the
  deployment has no VAPID key, and its hover text named the environment
  variable to a person who cannot set it. Hidden in that state, like an
  unsupported browser.
- Icon-only buttons: the shared delete trigger (nine call sites, one of
  them "Forget this entity") and the Loki dispatch arrow had `title` as
  their only accessible name. Both now carry aria-label.

Verified: tsc, eslint, design-system (8 checks), and the touch sweep —
hover-only meanings 69 → 52, of which 34 are the two conventional
top-bar icons repeated once per route.

* fix(clarity): stop pages explaining themselves in the schema's words

Second pass of the same sweep, on the three pages that read most like
internal state printed to a screen.

/money
- The three summary tiles rendered with zero subscriptions: "— / 0 active
  subscriptions", "0 / all confirmed", "— / other currencies". A third of
  a phone screen spent saying "nothing here", above an empty list with no
  way in. The summary now appears only once there is something to
  summarise, and the empty list carries a real empty state that says what
  the page will do for you, plus the Add button.
- "Non-CHF /mo" printed the very same USD/EUR/GBP figures the burn tile
  already joins — the same money twice, under a label that reads like a
  different number. Replaced with "Next charge", the date and name of the
  soonest one due, which is the reason to open a money page.
- The footnote explaining the row arrow and the unverified chip showed
  with no rows and no chips on screen. Now conditional, like the header
  Add button, which was duplicating the empty state's.
- The founder-only OrangeCat note named the database table the relation
  lives in and then printed a bech32 address with no label.

/memory
- "Entities 11 / Relations 0 / Types 2" was the schema's vocabulary in
  three full icon-header cards. Now compact tiles that say what they
  count: things remembered, connections, kinds.
- "Fleet knowledge (RAG)" told a user to set EMBEDDINGS_BASE_URL on the
  server, or to run a script on the box — instructions for whoever
  deploys this, shown to whoever uses it. Retitled "Context from your
  other projects" and rewritten to the one fact a user needs: on or off,
  and what that means for a dispatch.
- Entity distribution printed the type badge and the type name next to
  each other: "person person".
- "Forget everything" is irreversible and was a 14px-tall inline link
  (min-height is inert on an inline box); its confirm named the knowledge
  graph and the RAG index for one thing the reader knows as what Loki
  remembers.

/system
- Gateway and Uptime were two full cards with icon headers carrying one
  short fact each — two screenfuls before the first reading with any
  detail. Both answer "how is the host doing", so they are two rows of
  one card now.

Verified: tsc, eslint, design-system (8 checks), and the authenticated
390px sweep — 17 routes, zero horizontal overflow. The four remaining
sub-44px targets are inline prose links (WCAG 2.5.5 exempt).

* feat(health): make the score a worklist you can drive to 10/10

The last pass made the number explainable. It still was not useful.
"Mission stated ✗ — state the mission in Context" leaves you to find the
tab, find the field and type; that is most of the work, and a number you
cannot move is a number you learn to skip.

So the panel performs the write.

- Every check now carries the write that earns it (ProjectHealthFix in
  the SSOT: an attr, the description column, the live_url column, or
  clearing a signal flag). The panel opens the right field in place and
  saves through the API that owns it — no navigation, no hunting.
- Every check states its exact rule next to it. Including the one rule
  nobody could guess: definition of done must name something an agent can
  run and report, so it now prints the keyword list it is tested against.
  The list is the SSOT and the regex is built from it, so the rule shown
  and the rule applied cannot drift.
- The score moves as you go, optimistically, then reconciles on refresh.
  A score that only moves after a round trip reads as nothing happening.
- Outstanding checks lead; earned ones fold away behind a count.

Two bugs this surfaced, both the same shape — `useState(prop)` reads its
argument once, on mount, so a value written from anywhere else landed in
the database, came back down on router.refresh(), and was ignored:

- The stage chip went on offering "+ stage" for a stage already set.
- Live URL was worse than cosmetic: the check reads the production_url
  attr OR the live_url column, so writing the attr earned the point while
  the page's own field, which reads only the column, still said "Add live
  URL". The fix now writes the column, and the field re-seeds. A point you
  can earn while the page disagrees is worse than one you cannot earn.

Verified by driving it in a real browser at 390px: a project went 5 → 6 →
7 → 8 → 9 → 10 from the panel alone, one check at a time, and the header
followed each write (stage chip reads "Stage development", the quick link
flipped from "Add live URL" to "Live"). Panel geometry clean at 390 and
320, fix buttons 310×44. tsc, eslint, design-system (8 checks), and the
17-route authenticated sweep at 390 and 320: zero horizontal overflow.

* feat(health): let the model draft the gaps, without overwriting your work

The worklist made every point earnable by hand. This adds the fast path I
held back last time, once the thing that made it unsafe was fixed.

The blocker was applyProjectProfile: it always overwrote. Pointing a
"fill the gaps" button at it would have silently replaced a mission and a
next step someone had written with the model's version — a worse outcome
than leaving the point unearned.

- applyProjectProfile takes { onlyMissing }, off by default, so kickoff
  is unchanged: there the user has just edited the brief and means for
  the profile to be rewritten from it. With it on, a field that already
  holds an answer is skipped.
- "Already answered" is hasAnswer(), the same predicate
  computeProjectHealth uses. Any other test and a fill could overwrite a
  field the score had already counted, or skip one it had not.
- POST .../brief accepts onlyMissing and says so when there is nothing
  left to fill, rather than reporting the generic extraction failure.

In the panel, above the manual list:

- The button names its work before it runs — "Draft 3 from the brief" —
  and the note names the three fields and the guarantee. The checks the
  brief cannot answer (where the code lives, where it is deployed,
  whether a flagged problem is really fixed) are facts only the person
  has; AI_FILLABLE_CHECKS lists them rather than inferring, so the
  button can never quietly do less than it implied.
- No brief, or nothing fillable outstanding, and the button is absent —
  there is nothing to fill from.

Verified: the overwrite protection is tested directly against the
database — a field holding "MINE — do not touch" survives a fill that
targets it, an empty field beside it is written, and a default call still
overwrites so kickoff is untouched. In the browser at 390px the button
renders "Draft 3 from the brief" at 310x44, the note reads correctly, the
definition-of-done rule prints its full keyword list, and with no model
key configured the failure surfaces in the panel and re-enables the
button instead of hanging. tsc, eslint, design-system (8 checks), 150
home/ tests, and the 17-route sweep: zero horizontal overflow.

* chore: commit the AGENTS.md block next dev regenerates

Not hand-written: `next dev` appends this marked block on every start
(node_modules/next/dist/server/lib/generate-agent-files.js), and
next.config does not set `agentRules: false`. Left uncommitted it dirties
the tree for every contributor the first time they run the dev server, so
it belongs in the repo like any other generated file. Turn it off in
next.config if the fleet would rather not carry it.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-27 05:17:03 +00:00
..