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::Host provenance.

Amended 2026-11-12 — Boundaries return data. Every registered boundary’s declared result constrains every type variable to data and 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. Thus from-json and env have ∀α:data. Returns α, and from-jsonl and from-csv have ∀α:data. Returns [α]. The same constraint holds for from-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::Boundary result 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-use exception below. use links 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 meet Map(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-transcript and _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 and within; 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 a let mode or call split or open holes. Thus let d = echo 5 | from-json; return [umask: $d] checks but refuses at the decode, naming the umask: use. The one equation for rc and manifest handlers: against Map(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 by use or load::evaluate_source, is readmitted before its first phrase. run_phrases takes the whole checked unit and checks Toplevel.admits against its supplied Env, not necessarily shell.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; a use retains its loader context.

Perimeter correction. detach has the concrete scheme String → 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 α and from-csv : ∀α. F [α] are checked boundaries; their text values are admitted as records or maps according to use, never converted. The closed set is from-json, from-jsonl, from-json-at, from-csv, env, use, exarch-agents, exarch-pins, exarch-transcript and _ed-state. This replaces the exclusions below; each call is its own door.

Amended 2026-10-21: worker <id> and Site::admit_handled are deleted; a worker handle is a capability held only in the bindings that received it from spawn or watch, so its type is known at birth and no worker boundary exists in BOUNDARY_BUILTINS.

Amended 2026-10-19 by await-is-the-block-run-here: in the closed set, service-handle is replaced by core’s worker <id>, which re-acquires the handle of any worker by its id and admits the value it settles with at the await site.

Amended 2026-10-13. Fixings is 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 new from-json-at), use, service-handle, every tag of exarch-agents, exarch-pins and exarch-transcript, and _ed-state, whose cell persists across sessions. A BuiltinEntry marks itself with BuiltinEntry::boundary, and its body is a BuiltinBody::Boundary, which is handed the site. from-csv decides its shape ([Map String]) and is not one; nor is detach, whose receipt has one shape; nor $ENV, typed Map String.
  • The site is on the call. Exec carries site: Option<Arc<Site>>, filled by annotate for a boundary head. There is no Check frame: the door already knows the value, and a frame sees it only after the door has let it go. serial.rs ships 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 Site is 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::admit walks the value and the graph together. Its rules:
    • a ground scalar position needs that scalar’s head, and a JSON 3 is an Int and 2.5 a Float at a ground site as under a variable: a door never reads 3 as 3.0, and float at 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 comparable variable, 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_module holds a use export to its scheme in one scratch unifier over the whole record.
  • 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-json becomes { 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 tokens walks 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/quit has a variable only its result mentions, and no stored Define scheme 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.