okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
2b36e8a02
main
Strata
Local AI, with one model by default and multiple native instances in Expert mode. The React UI connects to the official Strata installer and engine, checks the hardware, prepares supported models, serves compatible APIs and shows measured engine activity. See native integration handover.
This is the web-first iteration of the app. It is built to become a standalone desktop app later — the browser shell and the engine host are already separate processes talking over HTTP, which is the same seam Electron would need.
┌────────────────────────────┐ ┌──────────────────────────────────────┐ │ web shell (Vite/React) │ /api │ engine host (node, zero deps) │ │ :5199 in dev │ ─────▶ │ :8791 │ │ │ SSE │ hardware · models · engine · │ │ Chat Monitor Serving │ ◀───── │ serving · metrics · inference │ │ Models Tuning Workspace │ │ │ └────────────────────────────┘ └──────────────────────────────────────┘
Run it
npm installnpm run dev# host on :8791 + web on :5199, one command
Open http://localhost:5199. On a clean machine Strata opens the first-run Welcome flow: hardware check → choose version → optionally read pictures → download/load → chat. Advanced settings remain collapsed.
Single-port mode (what the desktop build will use):
npm run buildnpm run serve# everything on http://127.0.0.1:8791
Other scripts: npm run typecheck, npm run sync:kit (re-import the design
kit), npm run shot -- out.png <url> and npm run flow -- chat|expert|setup|light
(scripted screenshots used to verify the UI).
What is real, and what is not
Try the Time-skip sidebar
Send /time-skip Make a small website for my plant shop in any chat. Any prompt
text works; no model needs to be loaded. This is a 28-second UI demo, with
simulated checkpoints and checks, rather than a connection to the OMP harness.
It saves A, builds and checks B, chooses B, then rejects a weaker revision.
Click either stream or the saved first draft to inspect its example evidence.
The run continues when hidden, survives reloads, and can be replayed when done.
The sidebar shares the preview tab bar and respects reduced-motion preferences.
Implementation status
| Area | Status |
|---|---|
| Hardware detection | Real. system_profiler / sysctl / vm_stat on macOS, nvidia-smi / /proc on Linux, os module fallbacks everywhere. |
| Native model catalog | Read from the installed Strata source. Families, real download sizes and hardware compatibility come from its official MCP catalog. |
| Model files | Native installer or real GGUF adapter. Native preparation reuses/resumes shards and companion files. The older design adapter remains simulated unless STRATA_REAL_ENGINE=1. |
| Engine tuning | Native config and measured operations. Validated parameters/JSON, config backups, per-model GPU placement, measured benchmark and supported NVIDIA calibration. |
| Serving API | Native gateway. Chat Completions, Anthropic and supported Responses protocols route by exact model ID. Existing key/network controls and request cancellation remain. |
| Inference | Native managed processes or a selected API/local adapter. Native vision sends actual image content, and explicitly enabled MCP calls appear in chat. Design demonstrations remain labelled. |
| Monitor metrics | Reported native readings. Per-model TPS/prompt TPS, context and cache; shared host RAM and GPU measurements. Missing readings remain unavailable. Simulated mode is labelled. |
Conversations stay in browser storage. Selected API providers receive their conversation and skill instructions; enabled MCP servers access their configured resources. Downloads and update checks contact the official upstream services. No usage telemetry is sent. The UI request log stores timing/token metadata, and native API monitoring can retain request content in memory when explicitly enabled.
Layout
strata/ ├── index.html single entry, dark by default ├── src/ │ ├── app/ shell: App, Sidebar, CommandPalette (⌘K) │ ├── components/ primitives (ui.tsx), charts, screen chrome │ ├── screens/ Launch · Setup · Chat · Models · Tuning · │ │ Serving · Monitor · Workspace · Skills · Settings │ ├── lib/ types, api client, event stream, store, router, format │ └── styles/ │ ├── kit/ tokens.css + components.css, synced from ../ui │ └── app.css app shell and screen styles ├── server/ │ ├── index.mjs HTTP surface, SSE hub, static hosting │ ├── hardware.mjs real probes and the compatibility verdict │ ├── catalog.mjs the model ladder + every expert parameter │ ├── models.mjs install/load state machine, disk accounting │ ├── engine.mjs beginner goals → expert params, predictions, validation │ ├── monitor.mjs live phase + throughput + thermals │ ├── serving.mjs API keys, access policy, request log │ ├── inference.mjs backend detection (llama.cpp/Ollama/LM Studio) + proxy │ └── store.mjs JSON state under $STRATA_HOME (~/.strata) └── scripts/ dev runner, design-kit sync, screenshot harness
State lives in ~/.strata (models/, data/state.json). If the home directory
is not writable — sandboxes, locked-down accounts — the host falls back to
./.strata. Override with STRATA_HOME, STRATA_WORKSPACE, STRATA_PORT.
Design
The interface is the Strata UI kit in ../ui, not a lookalike.
- Light is the default.
:rootholds the light palette;data-theme="dark"swaps the same token names. Both themes are laid out from one stylesheet. - Kit classes are the components. Every component the kit defines is in use:
.st-header(screen headers),.st-card(55 call sites),.st-btn,.st-pilland.st-badge(status lines vs. table cells),.st-progress,.st-tabs,.st-table,.st-metric(every number tile in the app),.st-input/.st-toggle/.st-slider/.st-field/.st-label,.st-collapse(model thinking),.st-code(code blocks),.st-gauge(GPU load, context fill),.st-drawer,.st-composer,.st-msg/.st-bubble,.st-toast.src/components/ui.tsxis a thin binding layer over them;src/styles/app.cssonly adds layout plus a short list of documented extensions at the top. - No gradients anywhere. Surfaces are flat; depth comes from the kit's three
shadows (
--st-sh-card,--st-sh-bar,--st-sh-pop). - Kit geometry. Radius 8 / 14 / 20 / 24, 4pt spacing, 14px controls, 20px cards, 24px panels, 64px header, 1160px content column.
- Icons are the Anron duotone set, rebuilt into one sprite at
public/icons/sprite.svgbynpm run sync:kit. The script strips the kit's C2PA metadata and carries the sourcefill="none"onto each<symbol>— without it every stroked path inherits the default black fill and the icons render as blobs.
What comes from DSH rather than the kit is the shape of the product: sidebar sessions, a status line that reports what the engine is doing, ⌘K palette, slash commands, per-tool approvals, and a sampling drawer one click from the composer.
API surface
| Method | Path | Purpose |
|---|---|---|
| GET | /api/health | host status, detected backend |
| GET | /api/setup · POST /api/setup/step · POST /api/setup/complete | first-run state |
| GET | /api/hardware?reprobe=1 | probes, checks, verdict, recommendation |
| GET | /api/models | library with per-variant state and progress |
| POST | /api/models/:id/install · /cancel · /load | library actions |
| DELETE | /api/models/:id · POST /api/models/unload | reclaim disk / VRAM |
| GET/PATCH | /api/engine | beginner + expert configuration |
| POST | /api/engine/restart · /reset · /validate · GET /export | engine lifecycle |
| GET/PATCH | /api/serving | access policy, API key, request log |
| GET | /api/monitor | live snapshot (also pushed over SSE) |
| GET | /api/events | SSE: monitor, models, engine, serving, setup, log |
| POST | /api/chat/stream | NDJSON token stream for the chat UI |
| GET | /v1/models, POST /v1/chat/completions, POST /v1/messages | public, OpenAI/Anthropic compatible |
Next
- Engine supervisor: detect a
llama-serverbinary, spawn it with the tuned flags, parse its logs into the Monitor instead of synthesising them. - Real downloads: resolve GGUF files from Hugging Face, verify hashes, resume interrupted installs.
- Desktop shell: wrap the built web app and the host in Electron/Tauri using
the same
{ url }handshake the host already exposes. - Tool use and approvals in chat (read/write inside the workspace, shell with an explicit grant), following the permission-preset pattern.
1# Strata 2 3Local AI, with one model by default and multiple native instances in Expert mode. 4The React UI connects to the official Strata installer and engine, checks the 5hardware, prepares supported models, serves compatible APIs and shows measured 6engine activity. See [native integration handover](docs/native-engine-handover.md). 7 8This is the web-first iteration of the app. It is built to become a standalone 9desktop app later — the browser shell and the engine host are already separate 10processes talking over HTTP, which is the same seam Electron would need. 11 12``` 13┌────────────────────────────┐ ┌──────────────────────────────────────┐ 14│ web shell (Vite/React) │ /api │ engine host (node, zero deps) │ 15│ :5199 in dev │ ─────▶ │ :8791 │ 16│ │ SSE │ hardware · models · engine · │ 17│ Chat Monitor Serving │ ◀───── │ serving · metrics · inference │ 18│ Models Tuning Workspace │ │ │ 19└────────────────────────────┘ └──────────────────────────────────────┘ 20``` 21 22## Run it 23 24``` bash 25npm install 26npm run dev # host on :8791 + web on :5199, one command 27``` 28 29Open <http://localhost:5199>. On a clean machine Strata opens the first-run 30Welcome flow: hardware check → choose version → optionally read pictures → download/load → chat. Advanced settings remain collapsed. 31 32Single-port mode (what the desktop build will use): 33 34``` bash 35npm run build 36npm run serve # everything on http://127.0.0.1:8791 37``` 38 39Other scripts: `npm run typecheck`, `npm run sync:kit` (re-import the design 40kit), `npm run shot -- out.png <url>` and `npm run flow -- chat|expert|setup|light` 41(scripted screenshots used to verify the UI). 42 43## What is real, and what is not 44 45### Try the Time-skip sidebar 46 47Send `/time-skip Make a small website for my plant shop` in any chat. Any prompt 48text works; no model needs to be loaded. This is a **28-second UI demo**, with 49simulated checkpoints and checks, rather than a connection to the OMP harness. 50It saves A, builds and checks B, chooses B, then rejects a weaker revision. 51Click either stream or the saved first draft to inspect its example evidence. 52The run continues when hidden, survives reloads, and can be replayed when done. 53The sidebar shares the preview tab bar and respects reduced-motion preferences. 54 55### Implementation status 56 57| Area | Status | 58| --- | --- | 59| Hardware detection | **Real.** `system_profiler` / `sysctl` / `vm_stat` on macOS, `nvidia-smi` / `/proc` on Linux, `os` module fallbacks everywhere. | 60| Native model catalog | **Read from the installed Strata source.** Families, real download sizes and hardware compatibility come from its official MCP catalog. | 61| Model files | **Native installer or real GGUF adapter.** Native preparation reuses/resumes shards and companion files. The older design adapter remains simulated unless `STRATA_REAL_ENGINE=1`. | 62| Engine tuning | **Native config and measured operations.** Validated parameters/JSON, config backups, per-model GPU placement, measured benchmark and supported NVIDIA calibration. | 63| Serving API | **Native gateway.** Chat Completions, Anthropic and supported Responses protocols route by exact model ID. Existing key/network controls and request cancellation remain. | 64| Inference | **Native managed processes or a selected API/local adapter.** Native vision sends actual image content, and explicitly enabled MCP calls appear in chat. Design demonstrations remain labelled. | 65| Monitor metrics | **Reported native readings.** Per-model TPS/prompt TPS, context and cache; shared host RAM and GPU measurements. Missing readings remain unavailable. Simulated mode is labelled. | 66 67Conversations stay in browser storage. Selected API providers receive their 68conversation and skill instructions; enabled MCP servers access their configured 69resources. Downloads and update checks contact the official upstream services. 70No usage telemetry is sent. The UI request log stores timing/token metadata, and 71native API monitoring can retain request content in memory when explicitly enabled. 72 73## Layout 74 75``` 76strata/ 77├── index.html single entry, dark by default 78├── src/ 79│ ├── app/ shell: App, Sidebar, CommandPalette (⌘K) 80│ ├── components/ primitives (ui.tsx), charts, screen chrome 81│ ├── screens/ Launch · Setup · Chat · Models · Tuning · 82│ │ Serving · Monitor · Workspace · Skills · Settings 83│ ├── lib/ types, api client, event stream, store, router, format 84│ └── styles/ 85│ ├── kit/ tokens.css + components.css, synced from ../ui 86│ └── app.css app shell and screen styles 87├── server/ 88│ ├── index.mjs HTTP surface, SSE hub, static hosting 89│ ├── hardware.mjs real probes and the compatibility verdict 90│ ├── catalog.mjs the model ladder + every expert parameter 91│ ├── models.mjs install/load state machine, disk accounting 92│ ├── engine.mjs beginner goals → expert params, predictions, validation 93│ ├── monitor.mjs live phase + throughput + thermals 94│ ├── serving.mjs API keys, access policy, request log 95│ ├── inference.mjs backend detection (llama.cpp/Ollama/LM Studio) + proxy 96│ └── store.mjs JSON state under $STRATA_HOME (~/.strata) 97└── scripts/ dev runner, design-kit sync, screenshot harness 98``` 99 100State lives in `~/.strata` (`models/`, `data/state.json`). If the home directory 101is not writable — sandboxes, locked-down accounts — the host falls back to 102`./.strata`. Override with `STRATA_HOME`, `STRATA_WORKSPACE`, `STRATA_PORT`. 103 104## Design 105 106The interface **is** the Strata UI kit in `../ui`, not a lookalike. 107 108- **Light is the default.** `:root` holds the light palette; `data-theme="dark"` 109swaps the same token names. Both themes are laid out from one stylesheet. 110- **Kit classes are the components.** Every component the kit defines is in use: 111`.st-header` (screen headers), `.st-card` (55 call sites), `.st-btn`, 112`.st-pill` and `.st-badge` (status lines vs. table cells), `.st-progress`, 113`.st-tabs`, `.st-table`, `.st-metric` (every number tile in the app), 114`.st-input` / `.st-toggle` / `.st-slider` / `.st-field` / `.st-label`, 115`.st-collapse` (model thinking), `.st-code` (code blocks), 116`.st-gauge` (GPU load, context fill), `.st-drawer`, `.st-composer`, 117`.st-msg` / `.st-bubble`, `.st-toast`. 118`src/components/ui.tsx` is a thin binding layer over them; `src/styles/app.css` 119only adds layout plus a short list of documented extensions at the top. 120- **No gradients anywhere.** Surfaces are flat; depth comes from the kit's three 121shadows (`--st-sh-card`, `--st-sh-bar`, `--st-sh-pop`). 122- **Kit geometry.** Radius 8 / 14 / 20 / 24, 4pt spacing, 14px controls, 20px 123cards, 24px panels, 64px header, 1160px content column. 124- **Icons** are the Anron duotone set, rebuilt into one sprite at 125`public/icons/sprite.svg` by `npm run sync:kit`. The script strips the kit's 126C2PA metadata and carries the source `fill="none"` onto each `<symbol>` — without 127it every stroked path inherits the default black fill and the icons render as 128blobs. 129 130What comes from DSH rather than the kit is the *shape of the product*: sidebar 131sessions, a status line that reports what the engine is doing, ⌘K palette, 132slash commands, per-tool approvals, and a sampling drawer one click from the 133composer. 134 135## API surface 136 137| Method | Path | Purpose | 138| --- | --- | --- | 139| GET | `/api/health` | host status, detected backend | 140| GET | `/api/setup` · POST `/api/setup/step` · POST `/api/setup/complete` | first-run state | 141| GET | `/api/hardware?reprobe=1` | probes, checks, verdict, recommendation | 142| GET | `/api/models` | library with per-variant state and progress | 143| POST | `/api/models/:id/install` · `/cancel` · `/load` | library actions | 144| DELETE | `/api/models/:id` · POST `/api/models/unload` | reclaim disk / VRAM | 145| GET/PATCH | `/api/engine` | beginner + expert configuration | 146| POST | `/api/engine/restart` · `/reset` · `/validate` · GET `/export` | engine lifecycle | 147| GET/PATCH | `/api/serving` | access policy, API key, request log | 148| GET | `/api/monitor` | live snapshot (also pushed over SSE) | 149| GET | `/api/events` | SSE: `monitor`, `models`, `engine`, `serving`, `setup`, `log` | 150| POST | `/api/chat/stream` | NDJSON token stream for the chat UI | 151| GET | `/v1/models`, POST `/v1/chat/completions`, POST `/v1/messages` | public, OpenAI/Anthropic compatible | 152 153## Next 154 1551. Engine supervisor: detect a `llama-server` binary, spawn it with the tuned 156flags, parse its logs into the Monitor instead of synthesising them. 1572. Real downloads: resolve GGUF files from Hugging Face, verify hashes, resume 158interrupted installs. 1593. Desktop shell: wrap the built web app and the host in Electron/Tauri using 160the same `{ url }` handshake the host already exposes. 1614. Tool use and approvals in chat (read/write inside the workspace, shell with 162an explicit grant), following the permission-preset pattern.