feat(v2): elevate KitchenSpeak to a physically-grounded DSL + reference toolchain - #1
Merged
Merged
Conversation
…ce toolchain
Make typing the safety superpower: materials carry thermal/mechanical/chemical
envelopes, appliances carry capability envelopes, and an action type-checks only
inside their intersection — so curdle-the-milk, bake-the-spatula, and
over-torque-the-arm are COMPILE errors, not firmware run-time faults.
Heal the two-copy split first: re-home the proofs, ROADMAP, and ADRs 0002-0004
from the nextgen-languages monorepo copy into this canonical standalone repo, and
correct the STATE.a2ml identity (was still "rsr-template-repo") plus root-allow.
Design blueprint (docs/):
- design/0001-v2-constitution.adoc binding contract: data model, the physical-
safety judgement (§5), the AST shape, proof obligations.
- spec/{0001-lexical,0002-concrete-grammar,0003-type-system}.adoc close
grammar.ebnf open items O1/O2/O3 with normative grammar + typing rules.
- design/{0002-semantics,0003-hal-and-hardware,0004-stdlib-ontology,
0000-blueprint-index}.adoc. Lexical/grammar/type-system/semantics drafted by a
multi-agent workflow; HAL/ontology/index hand-authored after the run hit a
spend cap, grounded in the compiler so docs and code agree.
Reference compiler (src/compiler/, dependency-free OCaml, ~1240 LOC):
- lexer -> parser -> typed AST -> physical-safety checker -> HAL lowering.
- ksc check | lower (matter|mqtt|ros2) | parse.
- corpus tests/run-corpus.sh: 15/15 (5 accept, 10 reject-with-expected-code,
incl. CURDLE/MELT_TOOL/OVER_TORQUE/OVER_REACH/DOUBLE_USE/UNWITNESSED_SYNC).
Proofs:
- proofs/agda/NoCurdle.agda v2 flagship, machine-checked (exit 0, 0 unsolved
goals): a bounded controller keeps milk below its curdle envelope and the milk
phase never becomes CURDLED. Wired into proofs/Makefile alongside the re-homed
Dough/PoachedEgg/EchoBridge.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tions Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Elevates KitchenSpeak from a v1.0 teaching DSL into a production orchestration
language whose superpower is physics in the types: materials carry
thermal/mechanical/chemical safety envelopes, appliances carry capability
envelopes, and an action type-checks only inside their intersection — so a
program that could curdle the milk, scorch the egg, bake the silicone spatula,
or over-torque the robot arm fails to compile, never reaching the hardware. The
same types lower to machine-checked Agda proofs and to a HAL over Matter / MQTT
/ ROS 2.
Heals the two-copy split first
Re-homes the design substance lost in the original excavation from the
nextgen-languagesmonorepo:proofs/agda/{Dough,PoachedEgg,EchoBridge},proofs/Makefile, ADRs 0002–0004,ROADMAP.adoc. CorrectsSTATE.a2ml(wasstill
project "rsr-template-repo") and the root allowlist.What's included
docs/):design/0001-v2-constitution.adoc(bindingcontract) +
spec/{lexical,concrete-grammar,type-system}(close grammar.ebnfO1/O2/O3) +
design/{semantics,hal-and-hardware,stdlib-ontology,blueprint-index}.src/compiler/, dependency-free OCaml ~1240 LOC):lexer → parser → typed AST → physical-safety checker → HAL lowering.
ksc check | lower (matter|mqtt|ros2) | parse.examples/v2/+tests/run-corpus.sh): 15/15 — 5 accept,10 reject-with-expected-code (CURDLE, MELT_TOOL, OVER_TORQUE, OVER_REACH,
DOUBLE_USE, UNWITNESSED_SYNC, DIM_MISMATCH, NO_CAPABILITY, MISSING_ONFAIL).
proofs/agda/NoCurdle.agda): v2 flagship, machine-checked(exit 0, 0 unsolved goals) — milk never reaches its curdle envelope; phase
never becomes CURDLED. Wired into
proofs/Makefile.Verified
cd src/compiler && dune build— clean.bash tests/run-corpus.sh— 15/15.make -C proofs nocurdle(+ Dough/PoachedEgg) — machine-check, exit 0.Deferred (tracked in ROADMAP.adoc)
yet enforced by the checker.
Emulsion/Searproofs; QTT-Agda linearity port; Lean 4 port.the 4 workflow-generated docs are drafts pending that review.
🤖 Generated with Claude Code