From 8b42a0931c5f1ccd726bd83b2a9d3aad43c15930 Mon Sep 17 00:00:00 2001 From: ahmed mohammed Date: Tue, 22 Sep 2026 12:13:57 +0300 Subject: [PATCH] docs: karpathy-pattern wiki built from the spec, plan, design contract and decisions ledger kb/ is its own wiki root: 34 pages across 7 categories, index.md catalog, log.md, AGENTS.md schema layer, and raw/ holding copies of README, the spec, the 13-task plan, the design master and the SDD ledger. Every page cross-references 3 to 6 others and all 107 wikilinks resolve except two [["list"]] artefacts inside JSON snippets in the copied plan. Kept separate from the repository root on purpose: its generated graph lands in kb/.ua/ instead of overwriting the code graph. Co-Authored-By: Claude Opus 4.7 --- kb/AGENTS.md | 26 + kb/Analysis row lifecycle.md | 13 + kb/Analyst model.md | 20 + kb/Console runner.md | 13 + kb/Container plan.md | 12 + kb/Credential vault.md | 13 + kb/Design contract.md | 9 + kb/Design tokens.md | 13 + kb/Email collision check.md | 13 + kb/Environment variables.md | 11 + kb/Export and print.md | 9 + kb/First-run gate.md | 14 + kb/Gitea remote.md | 10 + kb/History rail.md | 10 + kb/Jev goal gate.md | 13 + kb/Jev scoring.md | 18 + kb/Lazy database open.md | 13 + kb/Max nested tags for real plans.md | 13 + kb/OpenUI report language.md | 16 + kb/Option type and sql to run.md | 15 + kb/Output token ceiling.md | 12 + kb/Placeholder SQL is dropped.md | 14 + kb/Plan file encoding.md | 15 + kb/Playwright projects.md | 15 + kb/Running locally.md | 16 + kb/SQLite schema.md | 16 + kb/SSE stream.md | 13 + kb/Session cookie rules.md | 12 + kb/Settings form.md | 17 + kb/ShowPlan digest.md | 19 + kb/Smoke script.md | 10 + kb/Table names live on Object.md | 13 + kb/Unit suites.md | 15 + kb/WebKit in QA.md | 11 + kb/Wiki conventions.md | 15 + kb/index.md | 85 + kb/log.md | 7 + kb/raw/2026-09-21-sql-server-qai-plan.md | 2412 ++++++++++++++++++++++ kb/raw/2026-09-21-sql-server-qai-spec.md | 114 + kb/raw/README.md | 112 + kb/raw/design-master.md | 233 +++ kb/raw/sdd-progress.md | 84 + 42 files changed, 3534 insertions(+) create mode 100644 kb/AGENTS.md create mode 100644 kb/Analysis row lifecycle.md create mode 100644 kb/Analyst model.md create mode 100644 kb/Console runner.md create mode 100644 kb/Container plan.md create mode 100644 kb/Credential vault.md create mode 100644 kb/Design contract.md create mode 100644 kb/Design tokens.md create mode 100644 kb/Email collision check.md create mode 100644 kb/Environment variables.md create mode 100644 kb/Export and print.md create mode 100644 kb/First-run gate.md create mode 100644 kb/Gitea remote.md create mode 100644 kb/History rail.md create mode 100644 kb/Jev goal gate.md create mode 100644 kb/Jev scoring.md create mode 100644 kb/Lazy database open.md create mode 100644 kb/Max nested tags for real plans.md create mode 100644 kb/OpenUI report language.md create mode 100644 kb/Option type and sql to run.md create mode 100644 kb/Output token ceiling.md create mode 100644 kb/Placeholder SQL is dropped.md create mode 100644 kb/Plan file encoding.md create mode 100644 kb/Playwright projects.md create mode 100644 kb/Running locally.md create mode 100644 kb/SQLite schema.md create mode 100644 kb/SSE stream.md create mode 100644 kb/Session cookie rules.md create mode 100644 kb/Settings form.md create mode 100644 kb/ShowPlan digest.md create mode 100644 kb/Smoke script.md create mode 100644 kb/Table names live on Object.md create mode 100644 kb/Unit suites.md create mode 100644 kb/WebKit in QA.md create mode 100644 kb/Wiki conventions.md create mode 100644 kb/index.md create mode 100644 kb/log.md create mode 100644 kb/raw/2026-09-21-sql-server-qai-plan.md create mode 100644 kb/raw/2026-09-21-sql-server-qai-spec.md create mode 100644 kb/raw/README.md create mode 100644 kb/raw/design-master.md create mode 100644 kb/raw/sdd-progress.md 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 `