okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
2b36e8a02
main
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
↑/↓,Enterto run,Escto close, focus returned to the trigger on close.
Where it falls short
Matching is prefix-based on the label.Fixed.src/lib/fuzzy.tsadds 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 —mtxcannot match Monitor, which has nox— and was replaced withmtr.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.- No recent or frequent section. The first row is always
Chat, whether or not that is where anyone goes. Results do not show what they will do.Fixed. Entries carry adangerflag; 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.No hint of the shortcut.Fixed. Akeysfield renders real<kbd>chips, starting with⌘ /on Keyboard shortcuts.- 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.
- Empty state is a single line with no suggestion of what can be typed.
The plan
Substance
- Fuzzy matching with match highlighting — subsequence matching with the
matched characters emphasised, so
mtxfinds Monitor and shows why. - Scoped prefixes:
>for commands,#for conversations,@for workspaces. Three prefixes cover everything the palette can reach. - A Recents group at the top, from actual navigation history, collapsed once the user starts typing.
- Destructive commands are marked with the danger tone and their effect
stated (
Restart engine — reloads the model, about 20 s). - Show the shortcut on the right of every entry that has one, so the palette teaches the keyboard rather than replacing it.
Search conversations.Fixed. Sessions and workspaces are palette entries, reached with#and@.
Hierarchy
- Selection uses the neutral raised surface, not the accent. Accent stays for the primary action on a screen.
Motion
| Interaction | Spec |
|---|---|
| Open/close | st-enter / reverse, --st-t-local — built and interruptible |
| Filtering | Rows fade, --st-t-control; results do not animate position |
| Selection moving | Background only, --st-t-micro. ↑/↓ must not animate |
| Scoped prefix entered | Group 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 fourteenTabpresses, then checksmtr→ Monitor with the match highlighted,tune→ Engine tuning by alias,>unloadscoped, and@→ the workspace. - Three of the original items were also fixed beyond the plan: aliases
(
tune,api,statsfind 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 15close, 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 20subsequence matching with a score that rewards consecutive characters and word 21starts, returning the matched indices so hits can be explained. Verified: 22`mtr` → **Monitor**, `wsp` → **Workspace**, `dl` → **Models**, each with the 23matched characters highlighted. The plan's own example was wrong — `mtx` 24cannot 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. 27Verified: `>unload` → *Unload model*, `@` → the workspace. 283. **No recent or frequent section.** The first row is always `Chat`, whether or 29not that is where anyone goes. 304. ~~Results do not show what they will do.~~ **Fixed.** Entries carry a `danger` 31flag; restart, unload and re-run-setup render with a danger-toned icon and a 32distinct label weight, so an action that changes something does not read as 33navigation. 345. ~~No hint of the shortcut.~~ **Fixed.** A `keys` field renders real `<kbd>` 35chips, starting with `⌘ /` on Keyboard shortcuts. 366. **The accent colour is used for the selected row**, which conflicts with the 37rule that accent marks the primary action — in a list, selection is not 38primary 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 45matched characters emphasised, so `mtx` finds *Monitor* and shows why. 462. **Scoped prefixes**: `>` for commands, `#` for conversations, `@` for 47workspaces. Three prefixes cover everything the palette can reach. 483. **A Recents group at the top**, from actual navigation history, collapsed once 49the user starts typing. 504. **Destructive commands are marked** with the danger tone and their effect 51stated (`Restart engine — reloads the model, about 20 s`). 525. **Show the shortcut** on the right of every entry that has one, so the palette 53teaches the keyboard rather than replacing it. 546. ~~Search conversations.~~ **Fixed.** Sessions and workspaces are palette 55entries, reached with `#` and `@`. 56 57### Hierarchy 587. **Selection uses the neutral raised surface**, not the accent. Accent stays 59for 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 76stays inside after fourteen `Tab` presses, then checks `mtr` → *Monitor* with 77the 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 81the 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.