writeonce/docs/examples/skill-catalog
shoney.arickathil 296efb52ed docs(db2-ephemeral): databasev2 2 closes — task 6a contract, forks 1–7, the README sweep
- story 02: `status: done`, `review_pending` (forks 1–7 auto-approved for
  autonomy); progress rows 6a ✅, 6b ➡ databasev2 5 Phase A, 7 `a310496`;
  5c/5d rows cite the `dev` hashes (the pre-merge ones were unreachable);
  task 6a's Given/When/Then met; Info records the seven forks (sentinel over
  `:memory:`, its rules, the refusal contract, startup-only, the budget
  leaves for 5, library-owned tables bind consumers, the v8 table bit);
  History keeps the first cut that refused every class-bearing program
- database/src/CODE-LOGIC.md: "Startup refusal + WO_EPHEMERAL" — contract,
  hatch, table bit, measured blast radius, deferred items, proof; the
  dispatcher paragraph no longer says a failed commit un-applies the row
  (fatal since databasev2 4 part A; WO_T_IO unreachable from a write path)
- residency spec + plan: task 6 items annotated with the 2026-09-09
  decisions; the byte budget marked moved to databasev2 5
- README, seven example READMEs and four guides carry the one-line rule
  (durable default refuses without WO_DATA; WO_EPHEMERAL=1; durable:
  false); shop's RAM-only command sets the sentinel

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 2c3531998124042fe736388e8b926abda3841194)
2026-09-15 01:16:24 +02:00
..
justfile feat(query-corpus): iteration 9g corpus #1 — skillhost needs no new query grammar 2026-09-15 01:15:30 +02:00
main.wo feat(query-corpus): iteration 9g corpus #1 — skillhost needs no new query grammar 2026-09-15 01:15:30 +02:00
README.md docs(db2-ephemeral): databasev2 2 closes — task 6a contract, forks 1–7, the README sweep 2026-09-15 01:16:24 +02:00
types.wo feat(query-corpus): iteration 9g corpus #1 — skillhost needs no new query grammar 2026-09-15 01:15:30 +02:00
wo.toml feat(query-corpus): iteration 9g corpus #1 — skillhost needs no new query grammar 2026-09-15 01:15:30 +02:00

skill-catalog — the query grammar corpus (iteration 9g)

Corpus #1 for the query-grammar method (story 09g): take a real application backed by an embedded SQL database, translate its every statement to the writeonce query surface, and add only the grammar it forces. The application is ~/projects/skillhost (a C++ MCP host whose in-memory SQLite holds its skill catalog).

Result: skillhost forced no new grammar. Its entire SQL footprint — one table, a single-row INSERT, and four SELECTs (whose only non-trivial features are COUNT(*) and a correlated NOT EXISTS) — is expressible on the surface iteration 9b already shipped. The five statements, translated:

skillhost SQL (src/catalog/catalog.cpp) writeonce mode
INSERT INTO skills (…) VALUES (?,…) + SQLITE_CONSTRAINT dup check insert Skill { … } + try…catch on the @unique trap seed
SELECT … WHERE name = ? from x in Skill where x.name == n take 1 select x get <name>
SELECT … ORDER BY name from x in Skill order by x.name select x list
SELECT COUNT(*) FROM skills count(from x in Skill select x) count
SELECT … WHERE NOT EXISTS (SELECT 1 FROM skills c WHERE c.parent = s.name) ORDER BY name from x in Skill where len(x.children) == 0 order by x.name select x roots

The one translation choice: skillhost's correlated NOT EXISTS (skills that are nobody's parent) becomes a backlink emptiness — Skill.children is the inverse of parent, and len(x.children) == 0 is the childless test. No subquery construct is needed; the general exists/not exists is deferred until a corpus uses a correlation a backlink cannot express.

skill-catalog seed | list | roots | count | get <name>, WAL-durable under WO_DATA. A program with any durable table (the default) refuses to start without WO_DATA; WO_EPHEMERAL=1 opts into a RAM-only run, @table(durable: false) opts a table out. Acceptance: scripts/skill-catalog-accept.sh.