Amended 2026-11-12 — Sessions: undecided delayed shapes stay in their unit. This supersedes the delayed half of the original Sessions clause below; the pre-execution readmission rule of the 2026-11-11 amendment stands. A stored name is statically unusable in a later unit if its scheme reaches a weak type, computation or row residual beneath a thunk or handle. This includes function arguments as well as results and handle payloads. The rule follows reachable μ-equations in both data and delayed contexts; a shared recursive root must be judged in both. Unreachable equations do not affect this use rule.
Existing first-order data is readmitted against the later unit’s solved type before its first phrase. A decided function beside undecided data is allowed; a universal parameter is not a weak residual. No delayed value is forced or handle consumed at import, and no runtime wrapper postpones admission to its use. Define and use a decoder helper in one unit, or return text and decode it where the shape is used. Boundaries still return data, and modules still export only decided schemes, as amended below. Hook and persistent-handler installation still infer closures; captured block locals without schemes retain
WeakSource::Hostprovenance.
Amended 2026-11-12 — Boundaries return data. Every registered boundary’s declared result constrains every type variable to
dataand every row variable to be deep: all fields and payloads it may acquire must also be data. Functions and handles are excluded at every depth. Thusfrom-jsonandenvhave∀α:data. Returns α, andfrom-jsonlandfrom-csvhave∀α:data. Returns [α]. The same constraint holds forfrom-json-at, exarch’s boundary answers and_ed-state.Using a boundary result as a function or handle is a kind error at the use, before execution, not an admission refusal at decoding or readmission. Weakness (one type per unit) and admission against the solved data shape still stand. Each host’s acceptance test walks its whole manifest—core, ral’s REPL and batch surfaces, and exarch—and checks every
BuiltinBody::Boundaryresult for data type variables and deep row variables, without a hand-written boundary list. This amends the unconstrained result variables below; the linked-module amendment and session admission rules are unchanged.
Amended 2026-11-12 — Linked modules are not boundaries. This amendment supersedes every module-admission clause and handlers-through-
useexception below.uselinks a closed module at check time, checked and run under Σ. Its public schemes contain no weak variables; the importer instantiates those schemes rather than admitting an export record at a boundary site. An undecided public type, data included, is a static refusal of the module after successful solver closure and before readback. Imported handler maps therefore meetMap(U([String] → Command))statically like any bound map. Persistent handlers are still vetted against that same constant type at installation.The closed boundary set is
from-json,from-jsonl,from-json-at,from-csv,env,exarch-agents,exarch-pins,exarch-transcriptand_ed-state. Boundary and session admission otherwise stand. See cacheless module loader.
Amended 2026-11-11 — Written host options. Host-file fields are ordinary uses during generation (SPEC §15.3), not equations held after settling. This supersedes the “Return contracts” amendment immediately below, including its phase restriction and single-equation treatment of written handler maps. Each written
handlers:arm is checked in its own region in the rc, manifest andwithin; bound or computed maps use one equation. These uses reach decoder admission sites before unit closure and readback freeze them. Persistent installation still vets handlers, and imported handlers retain their module’s sites. The boundary, module and session admission rules stand.
Amended 2026-11-11 — Return contracts. A contract is a use of the returned value. After all elaboration settles, its field and factory equations run live on
Settled, before gates and nested checks close the unit and readback freezes sites. It cannot select aletmode or call split or open holes. Thuslet d = echo 5 | from-json; return [umask: $d]checks but refuses at the decode, naming theumask:use. The one equation for rc and manifesthandlers:againstMap(U([String] → Command))likewise reaches decoder sites inside locally checked handlers. Imported handlers retain their module’s sites. Persistent installation still vets each handler;within’s total static check needs no runtime vet.
Amended 2026-11-11 — Sessions. Every checked
Toplevel, including a file loaded byuseorload::evaluate_source, is readmitted before its first phrase.run_phrasestakes the whole checked unit and checksToplevel.admitsagainst its suppliedEnv, not necessarilyshell.env, in every mode. A refusal preserves that environment, defines nothing and runs no phrase; it names the use that imposed the type. A loaded file’s refusal points into that file; auseretains its loader context.Perimeter correction.
detachhas the concrete schemeString → String → [String] → F [pid: Int, desc: String](core/src/typecheck/builtins.rs,scheme::detach), not a result-only∀α; it is no exception to the perimeter rule.
Amended 2026-11-02 by a written key is a name:
env : ∀α. F αandfrom-csv : ∀α. F [α]are checked boundaries; their text values are admitted as records or maps according to use, never converted. The closed set isfrom-json,from-jsonl,from-json-at,from-csv,env,use,exarch-agents,exarch-pins,exarch-transcriptand_ed-state. This replaces the exclusions below; each call is its own door.
Amended 2026-10-21:
worker <id>andSite::admit_handledare deleted; a worker handle is a capability held only in the bindings that received it fromspawnorwatch, so its type is known at birth and no worker boundary exists inBOUNDARY_BUILTINS.Amended 2026-10-19 by await-is-the-block-run-here: in the closed set,
service-handleis replaced by core’sworker <id>, which re-acquires the handle of any worker by its id and admits the value it settles with at theawaitsite.
Amended 2026-10-13.
Fixingsis session state, not one per unit: one table per session keyed by(UnitId, var), shared by the session’s threads and snapshotted into a fork, so a unit’s sites still share their fixings (ty).
A boundary is checked against its solved type
A door through which a value of a shape the program did not decide enters typed code admits that value against the type the checker solved at its call. It admits; it never converts. What fails is the decode, naming the field and the line that needed it.
What was decided
- The set is closed. The decoders of undecided shape (
from-json,from-jsonl, and the newfrom-json-at),use,service-handle, every tag ofexarch-agents,exarch-pinsandexarch-transcript, and_ed-state, whose cell persists across sessions. ABuiltinEntrymarks itself withBuiltinEntry::boundary, and its body is aBuiltinBody::Boundary, which is handed the site.from-csvdecides its shape ([Map String]) and is not one; nor isdetach, whose receipt has one shape; nor$ENV, typedMap String. - The site is on the call.
Execcarriessite: Option<Arc<Site>>, filled byannotatefor a boundary head. There is noCheckframe: the door already knows the value, and a frame sees it only after the door has let it go.serial.rsships the site with the IR, so an engine child admits too. The checker builds the site (typecheck/site.rs); the runtime walks it (types/admit.rs). - A
Siteis the solved type frozen as a graph, one node per variable root, so cycles close and sharing survives; it keeps the span that imposed each structure and each free variable’s kind.Site::admitwalks the value and the graph together. Its rules:- a ground scalar position needs that scalar’s head, and a JSON
3is anIntand2.5aFloatat a ground site as under a variable: a door never reads3as3.0, andfloatat the use is the one word that accepts both; - a free variable is checked against its kind alone, at every occurrence; the
one exception is a
comparablevariable, fixed at its first scalar to numbers or to text, because ordering a number against text is the one operation that fails on two admissible values of different types (Fixings, one per unit, shared by all its sites); - an open row checks the fields it names and its tail’s deep bit the rest; a closed row requires the exact field set, so a decoded value joined with a closed record literal refuses an extra field rather than dropping it;
- a variant needs a tag of its row, and a decoder produces none;
- a block position needs a closure, and
Site::admit_moduleholds auseexport to its scheme in one scratch unifier over the whole record.
- a ground scalar position needs that scalar’s head, and a JSON
- The report is the pointer. A mismatch names an RFC 6901 pointer into the value, what was found, what the script uses it as, and the line of the use that imposed it, with a secondary caret on that use.
- A boundary used as a value is η-expanded.
$from-jsonbecomes{ from-json }, so the block holds a saturated call that carries a site; so does an under-applied call, wherever it stands, a block tail included. - Sessions. A residual weak variable stays weak across units. A data
binding that enters a unit with residuals is admitted again, against the
type the unit solved, before the unit runs (
Toplevel.admits); a thunk’s results do not exist yet and are admitted by the sites in its own IR. from-json-at tokenswalks reference tokens (an object member by exact key, an array element by canonical decimal), so a path needs no escaping and a miss names the pointer prefix and the keys or the length.- The perimeter is a test. No builtin outside the boundary set and the
divergent
fail/exit/quithas a variable only its result mentions, and no storedDefinescheme quantifies what a boundary decides.
Why
HM cannot know a decoded value, but the checker does know what the program
will do with it. Checking at the door turns “fails later, elsewhere” into
“fails here, naming the field and the line that needed it”. For exarch that
matters most: $r[reply][verdict] on a child’s reply fails at the `read,
saying /reply/verdict is missing.
Rejected
Declaring the casts, which leaves them unsound. A JSON sum type, which is
verbose and is the reason from-json-at exists. A Check frame wrapping the
call: the door knows what the frame has to be told. Reading a JSON integer as a
Float where the type says so: a decoder that converts by type is a second
decoder. Fixing every free variable at its first scalar: it refused
for $xs { |x| echo $x } over [1, "a"], which is parametric.
Builds on a-let-generalises-what-is-not-weak, whose weak variables are what make the type recorded at a call the one every use of the value fixes; uses kinds for the free-variable check.