writeonce/docs/examples/skill-catalog/README.md
shoney.arickathil f3215c2f43 docs(status): master-only follow-ups to the 2026-09-15 cherry-pick
- the agent rename database-developer → codd (and its guide) happened inside
  lang-18's `aab4878` on dev, which stays there; the `docs(agents)` pick
  brought codd.md in beside the old file — remove the old name and its guide
- docs/stories/porch/09-idempotent-replay.md: added on dev by `79e6da4`, whose
  earlier pick onto master (`refactor(porch-store)`) landed without it — the
  board, porch 1 and porch 4 link to it
- docs/stories/porch/10-memory-features-over-table.md: the refine stub
  language 18's docs commit created on dev; the board and porch 00-story link
  to it, the code it waits on is not on master
- docs/examples/skill-catalog/README.md: the story link fix from `b3d8c40` that its
  earlier pick (`8311330`) dropped in conflict resolution — dev's version taken
- `just linkcheck` on master: every remaining broken link is a wmux story or
  spec (track not picked) or a developer-local `.dev/reference` symlink

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 01:24:36 +02:00

2.1 KiB

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

Corpus #1 for the query-grammar method (story databasev2 8): 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.