okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-clean-3 (321794636): docs and history (cleanup step 3, items 3.0-3.10); release manifest and capability table with checks, history/ with pointers, link check, tools/ split, bench index; owner OK'd the wording 11-082b36e8a02

main
4.2 KiB83 linesraw

11 · Command palette

Shortcut ⌘K · File src/app/CommandPalette.tsx (222 lines)

The keyboard path to everything. For a power user it replaces the sidebar entirely; for a beginner it is the fastest way to discover what exists.

What it is today

  • A modal with a bare search field (.st-input--bare) and grouped results.
  • Groups — Go to, Engine, Model, plus command entries.
  • Always mounted and driven by data-open, so it animates both ways.
  • Portal-free — it renders inside .app, and the modal is opaque.
  • Fuzzy-ish matching, cursor movement with ↑/↓, Enter to run, Esc to close, focus returned to the trigger on close.

Where it falls short

  1. Matching is prefix-based on the label. Fixed. src/lib/fuzzy.ts adds subsequence matching with a score that rewards consecutive characters and word starts, returning the matched indices so hits can be explained. Verified: mtr → Monitor, wsp → Workspace, dl → Models, each with the matched characters highlighted. The plan's own example was wrong — mtx cannot match Monitor, which has no x — and was replaced with mtr.
  2. Commands and destinations are mixed. Fixed. > scopes to commands, # to conversations, @ to workspaces, and the empty state names all three. Verified: >unload → Unload model, @ → the workspace.
  3. No recent or frequent section. The first row is always Chat, whether or not that is where anyone goes.
  4. Results do not show what they will do. Fixed. Entries carry a danger flag; restart, unload and re-run-setup render with a danger-toned icon and a distinct label weight, so an action that changes something does not read as navigation.
  5. No hint of the shortcut. Fixed. A keys field renders real <kbd> chips, starting with ⌘ / on Keyboard shortcuts.
  6. The accent colour is used for the selected row, which conflicts with the rule that accent marks the primary action — in a list, selection is not primary action.
  7. Empty state is a single line with no suggestion of what can be typed.

The plan

Substance

  1. Fuzzy matching with match highlighting — subsequence matching with the matched characters emphasised, so mtx finds Monitor and shows why.
  2. Scoped prefixes: > for commands, # for conversations, @ for workspaces. Three prefixes cover everything the palette can reach.
  3. A Recents group at the top, from actual navigation history, collapsed once the user starts typing.
  4. Destructive commands are marked with the danger tone and their effect stated (Restart engine — reloads the model, about 20 s).
  5. Show the shortcut on the right of every entry that has one, so the palette teaches the keyboard rather than replacing it.
  6. Search conversations. Fixed. Sessions and workspaces are palette entries, reached with # and @.

Hierarchy

  1. Selection uses the neutral raised surface, not the accent. Accent stays for the primary action on a screen.

Motion

InteractionSpec
Open/closest-enter / reverse, --st-t-local — built and interruptible
FilteringRows fade, --st-t-control; results do not animate position
Selection movingBackground only, --st-t-micro. ↑/↓ must not animate
Scoped prefix enteredGroup headers collapse, --st-t-control

Selection deliberately does not move smoothly: at keyboard repeat rates an animated highlight lags the key and feels broken.

Verification

  • Shipped as npm run flow palette. It asserts focus lands inside on open and stays inside after fourteen Tab presses, then checks mtr → Monitor with the match highlighted, tune → Engine tuning by alias, >unload scoped, and @ → the workspace.
  • Three of the original items were also fixed beyond the plan: aliases (tune, api, stats find entries whose labels do not contain them), which the plan had not anticipated but which the alias test immediately exposed.
  • Assert destructive entries render a danger marker.
  • Assert the palette is fully operable by keyboard with no pointer.
1# 11 · Command palette
2
3**Shortcut** `⌘K` · **File** `src/app/CommandPalette.tsx` (222 lines)
4
5The keyboard path to everything. For a power user it replaces the sidebar
6entirely; for a beginner it is the fastest way to discover what exists.
7
8## What it is today
9
10- **A modal with a bare search field** (`.st-input--bare`) and grouped results.
11- **Groups** — Go to, Engine, Model, plus command entries.
12- **Always mounted** and driven by `data-open`, so it animates both ways.
13- **Portal-free** — it renders inside `.app`, and the modal is opaque.
14- **Fuzzy-ish matching**, cursor movement with `↑`/`↓`, `Enter` to run, `Esc` to
15  close, focus returned to the trigger on close.
16
17## Where it falls short
18
191. ~~Matching is prefix-based on the label.~~ **Fixed.** `src/lib/fuzzy.ts` adds
20   subsequence matching with a score that rewards consecutive characters and word
21   starts, returning the matched indices so hits can be explained. Verified:
22   `mtr` → **Monitor**, `wsp` → **Workspace**, `dl` → **Models**, each with the
23   matched characters highlighted. The plan's own example was wrong — `mtx`
24   cannot match *Monitor*, which has no `x` — and was replaced with `mtr`.
252. ~~Commands and destinations are mixed.~~ **Fixed.** `>` scopes to commands,
26   `#` to conversations, `@` to workspaces, and the empty state names all three.
27   Verified: `>unload` → *Unload model*, `@` → the workspace.
283. **No recent or frequent section.** The first row is always `Chat`, whether or
29   not that is where anyone goes.
304. ~~Results do not show what they will do.~~ **Fixed.** Entries carry a `danger`
31   flag; restart, unload and re-run-setup render with a danger-toned icon and a
32   distinct label weight, so an action that changes something does not read as
33   navigation.
345. ~~No hint of the shortcut.~~ **Fixed.** A `keys` field renders real `<kbd>`
35   chips, starting with `⌘ /` on Keyboard shortcuts.
366. **The accent colour is used for the selected row**, which conflicts with the
37   rule that accent marks the primary action — in a list, selection is not
38   primary action.
397. **Empty state is a single line** with no suggestion of what can be typed.
40
41## The plan
42
43### Substance
441. **Fuzzy matching with match highlighting** — subsequence matching with the
45   matched characters emphasised, so `mtx` finds *Monitor* and shows why.
462. **Scoped prefixes**: `>` for commands, `#` for conversations, `@` for
47   workspaces. Three prefixes cover everything the palette can reach.
483. **A Recents group at the top**, from actual navigation history, collapsed once
49   the user starts typing.
504. **Destructive commands are marked** with the danger tone and their effect
51   stated (`Restart engine — reloads the model, about 20 s`).
525. **Show the shortcut** on the right of every entry that has one, so the palette
53   teaches the keyboard rather than replacing it.
546. ~~Search conversations.~~ **Fixed.** Sessions and workspaces are palette
55   entries, reached with `#` and `@`.
56
57### Hierarchy
587. **Selection uses the neutral raised surface**, not the accent. Accent stays
59   for the primary action on a screen.
60
61## Motion
62
63| Interaction | Spec |
64|---|---|
65| Open/close | `st-enter` / reverse, `--st-t-local` — built and interruptible |
66| Filtering | Rows fade, `--st-t-control`; results do not animate position |
67| Selection moving | Background only, `--st-t-micro`. `↑`/`↓` must not animate |
68| Scoped prefix entered | Group headers collapse, `--st-t-control` |
69
70Selection deliberately does **not** move smoothly: at keyboard repeat rates an
71animated highlight lags the key and feels broken.
72
73## Verification
74
75- Shipped as `npm run flow palette`. It asserts focus lands inside on open and
76  stays inside after fourteen `Tab` presses, then checks `mtr` → *Monitor* with
77  the match highlighted, `tune` → *Engine tuning* by alias, `>unload` scoped, and
78  `@` → the workspace.
79- **Three of the original items were also fixed beyond the plan:** aliases
80  (`tune`, `api`, `stats` find entries whose labels do not contain them), which
81  the plan had not anticipated but which the alias test immediately exposed.
82- Assert destructive entries render a danger marker.
83- Assert the palette is fully operable by keyboard with no pointer.