diff --git a/kb/AGENTS.md b/kb/AGENTS.md new file mode 100644 index 0000000..f992ed0 --- /dev/null +++ b/kb/AGENTS.md @@ -0,0 +1,26 @@ +# Wiki conventions (schema layer) + +This directory is a Karpathy-pattern wiki: raw sources, wiki pages, and this schema file. + +## Layout +- `raw/` — immutable sources copied from the repository. Never edited here. +- `index.md` — the catalog, grouped by category. Every page appears exactly once. +- `log.md` — chronological record of what was added, and why. +- `.md` — one page per concept. File name is the link target. + +## Categories +- Pipeline +- Data and storage +- Security and credentials +- Interface +- Verification +- Operations +- Decisions + +## Page rules +1. Start with `# `, then 120 to 250 words of prose. +2. Cross-reference with `[[Page Name]]`. Every page links 3 to 6 others, and every link must resolve. +3. State measured facts (numbers, timings, error strings) instead of adjectives. Note the measurement when it + came from a specific artifact. +4. A page about a decision says: what the old behaviour was, what it cost, what replaced it, what it broke. +5. No code blocks longer than 5 lines. Long code belongs in `raw/`. diff --git a/kb/Analysis row lifecycle.md b/kb/Analysis row lifecycle.md new file mode 100644 index 0000000..98bc930 --- /dev/null +++ b/kb/Analysis row lifecycle.md @@ -0,0 +1,13 @@ +# Analysis row lifecycle + +A row is created before the plan is validated, so every attempt is visible in the rail. Status moves through +`running` → `done` | `failed` | `partial` | `abandoned`. + +`partial` means some stages produced output before the run stopped. `abandoned` means the browser went away +mid-run. Both surface as pills in the history rail rather than being hidden, and `/app/[id]` renders whatever +exists with a "this run was interrupted before it finished" note. + +`/app/[id]` never redirects a `running` row. An earlier version did, which turned a row orphaned by a crashed +process into an infinite self-redirect. + +Related: [[SSE stream]], [[SQLite schema]], [[History rail]]. diff --git a/kb/Analyst model.md b/kb/Analyst model.md new file mode 100644 index 0000000..632d183 --- /dev/null +++ b/kb/Analyst model.md @@ -0,0 +1,20 @@ +# Analyst model + +`lib/analyst.ts` talks to any OpenAI-compatible endpoint the user pastes in settings. Two calls, two jobs. + +`proposeCandidates` asks for 2 to 4 genuinely different remediation options and validates them against a zod +schema: `key`, `title`, `diagnosis`, 1-4 `actions`, `option_type`, `sql_to_run`, `expected`. Fewer than two options is +an error, because [[Jev scoring]] cannot rank a single option. + +`streamReport` writes the final answer as OpenUI Lang, streamed token by token into [[OpenUI report language]]. +Its system prompt carries hard requirements: every option with `sql_to_run` gets a SqlBlock containing exactly that +T-SQL, and every option gets a ScoreBar. + +Both calls spread the user's extra JSON parameters *after* `max_tokens`, which is how the output ceiling is raised +from the settings screen without a rebuild. `extractJson` recovers an object from prose or fenced output and, when +the response was cut off, names the character count instead of blaming the model. + +The local QA endpoint is `http://192.168.88.131:8888/v1` running `qwen3.8-flash-next`; it streams reasoning +instead of content unless extra params include `{"chat_template_kwargs":{"enable_thinking":false}}`. + +Related: [[Jev scoring]], [[Option type and sql to run]], [[Placeholder SQL is dropped]], [[Output token ceiling]]. diff --git a/kb/Console runner.md b/kb/Console runner.md new file mode 100644 index 0000000..dc2a53f --- /dev/null +++ b/kb/Console runner.md @@ -0,0 +1,13 @@ +# Console runner + +`components/runner.tsx` is the whole console: file drop with encoding-aware decode, the paste box, stage pills, +SSE reading, the live report, a cancel button, and the error line. + +The Analyse button is disabled while a stage is active and re-enabled only on the `done` frame — which is what the +end-to-end test waits on before asserting report contents. + +Design follows the [[Design tokens]] contract: dark workbench, JetBrains Mono for plan data, IBM Plex Sans for +prose, one phosphor accent. The layout holds at 320 px without horizontal scroll, and every settings field has a +real `