Use ordinary field lowering and declared field types for nominal receivers while preserving array and slice lengths. Make array field type hints available to chained access. Missing struct len now reports E7002 instead of the builtin-length E7005. Add 15 source regressions and imported generic CLI checks. Unit tests, all 1201 conformance cases, per-instruction collection for new cases, formatter corpus and original public check/lower compatibility pass.
32 KiB
Phase 6 — Source language
Non-normative. Part of the implementation plan.
Goal: .aji source that lowers deterministically and explicitly to AIR, with diagnostics mapped back to source spans.
Phase 6A (brought forward, owner decision 2026-10-05). First a minimal frontend for the frozen semantics of Phases 0–3, with no new semantics. Its principle: .aji removes mechanical work but never hides a semantically significant action.
| Removed | SSA values, block parameters, the hand-written CFG, the features [...] header (inferred), intermediate values, boilerplate |
| Kept explicit | move, borrow and mutable borrow, allocation, resource ownership, capabilities, effects, task spawn and join, channel ownership transfer, locking, cancellation, fallible I/O |
Targets and the evaluation order are in README.md. Phase 6A is specified by RFC 0013. Generics, contracts, modules and the formatter (P6-4, P6-6, P6-8) stay for the full Phase 6.
Exit criterion: all reference programs and examples/ are authored primarily as .aji and pass the conformance corpus through the frontend.
Spec inputs: spec 01, 02, 03 §4, 06 §3–4, 13 §1–2; reference/grammar.ebnf.
Rule: a source feature is acceptable only if its lowering to AIR is deterministic, explicit and mechanically verifiable (spec 01 §8). The frontend is outside the TCB; the verifier still checks its output.
Phase 6A tasks (RFC 0013, spec 15)
| ID | Status | Task | Depends | Output | Done when |
|---|---|---|---|---|---|
| P6A-1 | done | Spec 15, grammar, E7xxx, E3101 suggested_effects, E0006 canonical_header, Quick Reference |
— | spec 15, reference/grammar.ebnf, docs/agent/quick-reference.md |
RFC 0013 accepted |
| P6A-2 | done | Lexer and parser with spans (full 6A grammar; one precise E7001, no recovery) |
P6A-1 | src/frontend/{lex,parse}.zig |
every spec 15 example parses; syntax errors are E7001 |
| P6A-3 | doing | Names and source types: variables, functions, types, built-in operations, outcome arms | P6A-2 | src/frontend/check.zig |
E7002–E7007 accept/reject tests |
| P6A-4 | doing | Lowering: control flow, variables → SSA/block parameters, frame storage, lexical borrow ends, outcome matches, block forms (scope, shield, lock), select, byte literals, feature closure |
P6A-3 | src/frontend/lower.zig |
lowered AIR verifies; lowering is a pure function |
| P6A-5 | done | Source spans on lowered AIR; verifier diagnostics and trap records carry source_location and air_location |
P6A-4 | src/frontend/spans.zig, src/diag.zig |
every diagnostic of a .aji file points at source |
| P6A-6 | done | CLI: aji check/run/lower file.aji |
P6A-4 | src/main.zig |
same flags and run record as for .air |
| P6A-7 | doing | .aji twins for the Phase 0–3 conformance tests (same outcome or code) and the reference programs |
P6A-5 | tests/conformance/source/ |
for the freeze (owner decision): the three reference programs (programs/parallel_map, channel_transfer, tcp_echo_tasks) pass with AIR equivalence on every schedule seed, and every source construct has a run/accept and, where it rejects, a reject test (tools/source_coverage.py, 56/56). Further twins are added gradually |
| P6A-8 | done | Source Reference Bundle (directory, QUICK.md front door, AIR reference only under air/), harness profile aji_source with per-group documentation metrics, Quick Reference examples checked against conformance programs, raw and normalized size metrics |
P6A-6 | docs/agent/source-bundle.txt, tools/eval/languages/aji_source.json |
bundle measured; every Quick Reference example is an excerpt of a checked program |
| P6A-9 | done | Dev regression on tasks M and C: Aji/AIR vs Aji/source, all three native agents, both conditions run again on p6a-candidate (12 cells) |
P6A-8 | results note | criteria below reported |
| P6A-10 | done | Phase 6A exit review | all | plan status | targets reported (exit review below) |
| P6A-12 | done | Source type-check completeness: errors fully determined by the source type system are reported by the frontend as E7xxx at the source construct, never left to the verifier on the lowered AIR (checkpoint 2: E1001 ×4 in a source run). Not a layer 7 blocker; to be closed before the Phase 6A freeze |
P6A-4 | src/frontend/lower.zig |
for each verifier type rule reachable from source, a source test expecting the E7xxx |
| P6A-11 | done | Malformed generated AIR is a compiler bug: when a .aji module passed the frontend but its AIR fails to parse or is structurally invalid, report an internal compiler diagnostic (with the source construct), not the AIR parse error mapped back (found by the M checkpoint: void fall-through lowered to ret %) |
P6A-4 | src/check.zig, error registry |
a test that injects malformed lowering gets the internal diagnostic |
P6A-9 criteria (owner decision, fixed before the runs)
Compared per agent with the frozen Aji/AIR run of the same task:
| Measure | Criterion |
|---|---|
IR-form diagnostics (E0001–E0006, E5001, E5002; ajieval profile) |
decrease ≥ 80 % |
| agent output tokens | decrease ≥ 50 % |
| tool calls | decrease materially |
| Aji semantic guarantees | unchanged (same verifier, same evaluator gates) |
| VSR | no regression |
| uncached provider input (strong agents) | substantial decrease |
| weakest agent (GLM) | an earlier Aji/AIR failure becomes a PASS, or repair cycles drop sharply |
Also reported:
- wall time;
unique_docs_readand reading per group (quick_reference,source_docs,air_docs);- diagnostic classes;
- source bytes, lowered AIR bytes (raw and normalized);
- type mismatches (
E1001+E7005), counted apart from the IR-form classes so that relabeling cannot improve them.
Order (owner decision, after P6A-8):
- M checkpoint (diagnostic, not P6A-9). Task M only,
Aji/source, the three native agents, run from the frozen commit taggedp6a-m-checkpoint. The Quick Reference and the Source Reference Bundle stay unchanged until this run is done, so the comparison stays clean. Bundle hash at the tag:sha256 24cca814c7be1826ea797a1cc9759d0e0dd996bc6561f7b46f0ad1f4e77a2843, oversha256sumof the files ofzig-out/agent/source/, sorted. - Compare with the frozen
Aji/AIRruns and classify the effect. Nothing changes automatically on the strength of M. - Task C waits for layers 7–8.
- Layer 7, then layer 8; the concurrency programs of the Quick Reference (
tests/conformance/source/quickref/) leave PENDING and pass. - Freeze one Phase 6A commit and run M + C × 3 agents: this is the official P6A-9.
- Phase 6A review (P6A-10); only then any decision about further frontend changes.
Type mismatches (E1001, E7005) stay a separate category from the IR-form diagnostics.
Status (2026-10-05). Steps 1–2 are done in two checkpoints (results). Checkpoint 1 found two toolchain defects, fixed in 222c0c8. Checkpoint 2 gave AIR 2/3 and source 3/3, with IR-form diagnostics at 0 in source. The owner closed the IR-tax diagnosis at the engineering level: layer 7 GO. Remaining order:
- layer 7 (tasks, channels);
- layer 8 (
lock,select, cancellation); - every concurrency example of the Quick Reference passes;
- Phase 6A candidate freeze;
- official P6A-9: M + C × 3 agents.
The cost hypothesis stays open: it needs repetitions.
Lowering layers (P6A-3/4), each with accepted (golden AIR), rejected (E7xxx) and verifier-caught tests in tests/conformance/source/:
| Layer | Content | Status |
|---|---|---|
| 1 | scalars, expressions, functions, control flow, variables carried across joins, short-circuit and/or, casts |
done |
| 2 | structs (named construction, declaration-order lowering), enums (Enum::Variant), exhaustive match over enums (no _) and integers (_ required), match as an expression; outcome matches and or trap move to layer 5 with the fallible operations |
done |
| 3–4 | addressable values (frame storage chosen by lowering), lexical borrows (ref r = …;/mut r = …;), places and writes, arrays, slices, split_at, slice.copy, byte strings, proven indexing for the verifier's fact form; move comes with linear values in layer 5 |
done |
| 5 | explicit move for linear values (E7003 with the move x hint), own/own_array, regions with an explicit region borrow, outcome matches (match kind decided by the parser), or trap, built-in error enums, cap<mem.alloc> and cap.narrow.budget; linear aggregates stay rejected (E0006); aji lower --stats reports mechanical_air_eliminated |
done |
| 6 | intrinsics as plain calls (outcome match / or trap), resources by name with a per-operation borrow, explicit closes and data borrows, cap.narrow.prefix, byte-string paths, unsafe operations under effects [unsafe], trusted rejected, preserved parameter names; source/AIR run-record equivalence (equivalent:) for hello, file copy, TCP echo, prefix narrowing, random |
done |
| 7 | scope blocks, task.spawn/join/cancel/cancelled, task<T>/sender<T>/receiver<T>, channels (make, dup, send, recv, close_sender, close_receiver), endpoint operands by name, rebinding of variables on outcome edges, joins carry live variables only; source/AIR equivalence with the Phase 3 task and channel programs |
done |
| 8 | lock blocks over mutex<T> (guard never a source value; unlock at every exit), mutex.make/take, select (one borrow per endpoint, unsent values bound back on every edge), shield, task.check_cancel, task.join_cancel; linear values never in frame storage; source/AIR equivalence with the Phase 3 mutex, select and cancellation programs; every Quick Reference example passes |
done |
Phase 6A exit review (2026-10-05, owner decision: PASS)
Delivered:
- the
.aji0.1 frontend, layers 1–8, over the frozen semantics of Phases 0–3; - one canonical spelling per construct, deterministic and canonical lowering, a source map for every diagnostic and trap;
- internal compiler errors for malformed lowering (P6A-11);
- source-level type errors (P6A-12);
- the Source Reference Bundle with a checked Quick Reference (P6A-8);
- the three reference programs in source with AIR equivalence, and source construct coverage 56/56 (P6A-7, freeze criterion).
Defects found by the experiments and fixed:
- interpreter memory grew with the number of executed steps (
222c0c8); - void fall-through lowered to malformed AIR (
222c0c8).
P6A-9 (results):
| Measure | Result |
|---|---|
| IR-form diagnostics | 9 → 0 |
| VSR | 4/6 → 5/6 |
| program size | 17–26 KB → 7–11 KB |
| documentation read | 6–36k AIR tokens → Quick Reference + 0.4–8.6k |
| N3 on M | AIR FAIL → source PASS, the second time |
| output-token criterion (≥ 50 %) | not met: −36 % for N1+N2, model-dependent |
Earlier Phase 6A targets (size ≤ 1.5× Rust, output ≤ 2× Rust) were not measured against Rust in P6A-9. Rust/Zig against Aji/source belongs to the next held-out benchmark.
Open, not blocking:
- P6A-7 twins of the remaining conformance tests, added gradually;
- Q-023;
- harness: documentation accounting for partial reads; where the status fields are recorded.
Tasks (full Phase 6)
| ID | Status | Task | Depends | Output | Done when |
|---|---|---|---|---|---|
| P6-1 | todo | Complete the source grammar: expressions, match, borrow blocks, task.scope, select, defer, ?, generics, lifetimes, contracts, attributes |
— (may start after P2) | reference/grammar.ebnf, spec 01 |
every construct in examples/ is covered; grammar is LL(k) or otherwise documented as unambiguous |
| P6-2 | todo | Lexer and parser with spans | P6-1 | src/frontend/{lex,parse}.zig |
all examples/ parse; syntax errors are registered diagnostics |
| P6-3 | done (RFC 0021 Implemented) | Explicit package modules, direct imports and qualified nominal types | P6-2 | src/frontend/modules.zig, spec 15 §14 |
deterministic graph/name resolution; source/AIR and CLI tests |
| P6-4 | done (RFC 0022 Implemented) | Type checking and monomorphized generics with structural constraints (Copy, Send, Share, Freeze, Local) |
P6-3 | src/frontend/generics.zig, spec 15 §15 |
generic code instantiates deterministically; constraint violations diagnosed |
| P6-5 | todo | Lowering to AIR: control flow, ?, defer cleanup edges, borrow blocks, task scopes |
P6-4 | src/frontend/lower.zig |
lowered AIR verifies; lowering is a pure function (same input ⇒ same AIR bytes) |
| P6-6 | todo | Contracts: requires/ensures/invariants → contract table; status classification |
P6-5 | frontend + verifier | each contract reported as PROVEN_STATICALLY / CHECKED_AT_RUNTIME / ASSUMED_UNSAFE / UNPROVEN |
| P6-7 | todo | Source spans in diagnostics for verifier errors on lowered AIR | P6-5 | src/diag.zig, lowering |
every conformance reject test has a source-level twin with the same code |
| P6-8 | done | Formatter for implemented source syntax | P6-2 | aji fmt, spec 15 §11 |
token/comment/declaration preservation; idempotence, identical AIR and CLI write/check tests |
| P6-9 | done | Port reference programs and examples to .aji |
P6-5 | tests/conformance/source/programs/, examples/ |
all five source/AIR reference pairs and every example source/package pass |
| P6-11 | done (implementation; RFC 0036 Proposed) | Source functions/calls returning borrows with explicit from origin; Q-034 |
P6-3/4 | spec 15, binding/call/return lowering, Quick Reference and source/AIR conformance | origin/lifetime and temporary-end rules specified; valid/rejected returned views use existing verifier/interpreter semantics |
| P6-10 | todo | Phase exit review | all | plan status | exit criterion passes |
The standard-library track implements nineteen compiler-pinned modules and qualified standard enum names. STD-3/RFC 0021 completes P6-3 with explicit manifest source mapping, acyclic linking, direct qualified names, imported struct literals and task workers. Dependency fetching/resolution is separate package work; STD-4/RFC 0022 completes explicit generics and structural constraints. STD-5/RFC 0023 adds whole-value linear structs/enums/fixed arrays, complete unpack/match, explicit exchange and ownership-preserving allocation failure through all layers (spec 15 §16). STD-6a/b/RFC 0024 resolves Q-036 with initialized buffer and safe std.vec, explicit growth, returned failure ownership and draining (spec 15 §17). STD-6c/RFC 0025 adds safe owning Deque with existing source primitives. STD-6d.1/RFC 0026 adds pure std.hash; STD-6d.2/RFC 0028 adds safe owning U64Map after the explicit error_values prerequisite (RFC 0027). STD-6d.3/RFC 0029 adds explicit static function parameters for general hash/equality/order operations with existing AIR calls/workers. STD-6d.4/RFC 0030 implements the general owning-key std.hashmap contract; its full GC/stress validation passes and Q-037 is resolved. STD-6d.5/RFC 0031 implements general owning std.hashset with duplicate input return; its conformance, GC/schedule, CLI and documentation checks pass. STD-6d.6/RFC 0032 implements safe owning std.heap with explicit order; conformance, GC/schedule, CLI and documentation checks pass. STD-7a/RFC 0033 implements bounded std.io composition with explicit progress, resource loans and exact effects; conformance, GC/schedule, CLI and documentation checks pass. STD-7b/RFC 0034 implements safe owning buffered file adapters with explicit finish/discard and first-error/no-retry behavior; conformance, GC/schedule, CLI and documentation checks pass. STD-7c/RFC 0035 adds pure caller-buffer lexical paths and Copy component ranges; conformance, GC/schedule, CLI and documentation checks pass. The owner adopts STD-0..7 as an intermediate foundation and resumes language work (2026-10-07); remaining std system/service milestones stay in the backlog. P6-11 implements explicit borrowed returns over the existing AIR; RFC 0036 remains Proposed pending owner adoption (Q-034). These increments do not complete Phase 6.
P6-11 implementation review (2026-10-07)
RFC 0036 remains Proposed for owner adoption; its spec integration and implementation are prepared together. Borrow functions preserve explicit origins through ordinary/generic/package calls; exact-mode ref/mut bindings retain a named parent. Named returns transfer only their owned ancestor chain, and ordinary verifier/interpreter semantics decide provenance, aliasing, task loans and traps. Static function parameter borrow contracts and borrow joins stay outside this task.
Validation: full conformance 1,135/1,135 with no failures or pending tests; 56 focused conformance cases including a frozen Phase 1 AIR twin and four canonical AIR goldens; per-step collection and 200 schedule seeds across four quanta for the concurrent fixture; 61 generic regression cases; unit tests, format and bundle/example checks; CLI integration 133 checks, generic/module integration 20/36 checks, hosted smoke. Independent read-only review by Claude found a misleading feature diagnostic when spawning a borrow-returning function and missing array bounds in unused generic signatures. Both were fixed and independently rechecked. Added cases cover those failures, valid generic bounds, normal scope/shield/lock returns, an unjoined task and lock-guard escape. Source construct coverage is 119/119. Quick Reference/source budget is recorded in RFC 0036 and docs/agent/README.md. P6-8 is implemented below; larger syntax/contracts work still needs its separate spec gate.
P6-8 formatter (2026-10-07)
aji fmt formats one source file without linking, specializing, verifying or running it; --check emits a JSON status, and explicit --write atomically replaces a regular file while preserving permissions. Libraries and semantically rejected programs remain formattable. Original token spellings, comments and declaration order are retained; output is re-tokenized before exposure, and layout traversal is iterative. No syntax, AIR feature, verifier/runtime state or diagnostic code is added. Invalid syntax reports the existing E7001. The CLI contract and layout are spec 15 §11; the public-corpus/CLI script runs in CI.
Validation: unit tests and Zig formatting pass, including 10,000-term expressions, comments/CRLF, continuation indentation and statement groups. The formatter CLI suite passes 3,146 checks over 853 public files: 844 parse and format idempotently, nine existing syntax-error fixtures report E7001, and 548 successful lowerings retain byte-identical AIR. The suite also checks explicit writes, unchanged inode/mtime, permissions, symbolic/hard links, FIFO rejection, JSON/exit codes and a source run. Full conformance remains 1,135/1,135. Independent read-only review by Claude identified layout/comment handling defects; fixes were independently rechecked and covered by unit cases. Original source files are not rewritten. Documentation budgets are recorded in docs/agent/README.md. Review found the separate existing block-statement ambiguity Q-040; resolving its syntax belongs to P6-1/P6-2 and is not inferred by the formatter. This increment does not complete Phase 6.
P6-1/P6-2 block boundary increment (2026-10-07)
Q-040 is resolved in spec 15 §4 and the grammar (DD-016): leading bare if, match and {…} finish before outer expression operations in statement/tail position. The enclosing } selects a tail, ; an explicit discard, otherwise a block statement must yield void or diverge. This E7006 guard prevents silent reinterpretation of former expressions such as {2i64} -3i64; parenthesized continuations and nested expression contexts remain available. The parser marks block statements, ordinary/generic lowering checks the guard, and the formatter derives line boundaries from statement spans. No AIR feature, diagnostic code or verifier/runtime state is added. P6-1/P6-2 remain open for the rest of their grammar work.
Validation: full conformance passes 1,154/1,154 with no failures or pending tests, including 19 focused source cases covering stores, other unary starts, tails, explicit contexts/discards, generic bodies, mixed diverging/value branches and lexical borrow ends. Unit tests, Zig formatting, bundle/example checks and 120/120 construct coverage pass. The formatter/CLI suite passes 3,267 checks over 872 public files: 860 parse idempotently, 12 syntax-error fixtures reject with E7001, and 557 successful lowerings preserve byte-identical AIR. A before/after comparison over the original 853 public files finds no exit-code changes and identical AIR for all 548 successful lowerings. Independent read-only review by Claude found the silent value-discard risk in the initial design; the guard fixes it, and final review found no remaining issues. Budgets are recorded in docs/agent/README.md; frozen evaluation inputs are unchanged.
P6-7 E7006 reason increment (2026-10-07)
DD-017/spec 15 §10 registers 28 stable E7006 categories, explicitly selected at all 130 frontend rejection sites. Borrowed and non-materializable moves cannot be counted as move_copy; permitted generic Copy transfers remain accepted. The compiler rejects future unclassified E7006 emissions at compilation. The JSON field follows existing code-specific fields, retaining their values, positions and messages. No code, rejection rule, language/AIR syntax or verifier/runtime state changes. P6-7 remains open for its source-span/twin requirements.
ajieval summary adds occurrences and affected runs by (code, reason), with log availability; profile/checkpoint expose per-run counts. Code totals and the historical compact-code extraction stay intact. Whole JSON records provide reasons; historical, malformed or unparsed records remain unknown and missing logs remain unavailable. These are observed outputs over the entire transcript, without a pre-acceptance cutoff; they do not establish repair cost or justify implementing RFC 0038. New cohort timing, strata and missing-data policy remain evaluation decisions. Frozen evaluation inputs and historical records are unchanged.
Validation: full conformance passes 1,154/1,154; CLI passes 130 checks including 72 public E7006 fixtures, generic/package cases, deterministic serialization and non-E7006 preservation. A comparison over 872 public files finds no changes beyond the new reason: all 557 accepted AIR outputs and every original diagnostic payload remain identical. The 26 ajieval self-tests pass (one environment skip), including historical uncertainty, unknown future reasons, native transcripts, code-total conservation, run incidence and checkpoint JSON. Independent read-only review by Claude found no defects in the extension; its registry-scope suggestion was incorporated. Bundle growth is recorded in docs/agent/README.md. This completes the independent instrumentation prerequisite, not RFC 0038 or Phase 6.
P6-7 related-position increment (2026-10-07)
RFC 0037/DD-018 prepares spec integration and implementation of one factual related_locations record on identified E2101/E2104 conflicts and E4302 tasks. Existing definition positions identify selected borrows; each task loan carries constant-sized spawn metadata through cancelled-join handle replacement. Typed JSON appends the array after the old envelope. Each related position maps independently, including imports and specializations; absent mappings omit source coordinates while retaining AIR coordinates. Primary fields, first-conflict selection and source duplicate suppression are unchanged; no block/repair inference, code, syntax, feature, transfer rule or runtime change is introduced. RFC 0037 remains Proposed for owner adoption; P6-7 remains open for the remaining span/twin work.
Validation: unit tests and full conformance pass, 1,160/1,160 with no failures or pending tests, including six new source/AIR positive/rejected counterparts and repeated cancelled joins. CLI passes 267 checks/161 context records, covering public rejects, function parameters, second split results, call-result definitions, exact source mapping from public annotations, generics and packages. Unit tests cover typed/key-ordered JSON, missing mappings, two cancelled-handle replacements and deduplication retaining the first conflict. Cancellation conformance passes with collection before every instruction and 200 schedule seeds under multiple quanta. Across 1,199 original public AIR/source/std/example files, removal of only the appended metadata recovers byte-identical outputs and exit codes, including all 701 successful check/lower outputs. Source construct coverage remains 120/120. Independent read-only review by Claude found no implementation issues. Bundle measurements are recorded in docs/agent/README.md; frozen evaluation inputs remain untouched. No repair-cost experiment or RFC 0038 implementation is included.
P6-7 diagnostic-envelope correction (2026-10-07)
DD-019/spec 10 §2 fixes three legacy duplicate-field emissions discovered during compatibility review: E3202 unsupported narrowing and E7002 unknown source capability kinds use capability_kind, preserving the stable envelope kind; E2102 unlock with a live child borrow reports borrow and guard separately. Consumers previously reading a capability payload from the duplicate kind must use capability_kind; former last-key-wins readers retain the selected E2102 borrow identity. Codes, rejection/transfer rules, primary positions, messages, guard/loan state and deterministic execution are unchanged. No new syntax, feature or repair is introduced; P6-7 remains open.
Validation: the new pipeline test reproduces a failure before correction and passes afterwards; unit tests and full conformance pass, 1,162/1,162 with no failures or pending tests, including a source unknown/known capability pair. All final source/AIR diagnostics are checked for noncolliding fields and parsed as JSON with duplicate members forbidden, after frontend fields and source mapping. CLI passes 271 checks/161 context records with a strict JSON reader and targeted checks for all three corrected forms. Across the 1,199-file compatibility baseline, only the two known legacy AIR collision records change beyond the earlier related metadata; all successful outputs and exit codes remain identical. Independent read-only review by Claude found no missed emission or implementation defect; its recommendation to validate final mapped records is implemented in conformance. Budgets are recorded in docs/agent/README.md; frozen evaluation inputs and historical reports are unchanged.
P6-2 source scope-name increment (2026-10-07)
Q-041 is resolved in spec 15 §7 (DD-020): source scope names are lexical identifiers, used only as the named first operand of task.spawn. Ordinary plain/moved value use rejects E7006 invalid_expression, with name and type: scope, before any misleading E7003 transfer hint. Borrowing and assignment retain their existing reasons; non-name/wrong-type spawn operands retain E7005. Ordinary shadowing, saved completion identity, live-child/loan checks and function-local AIR scope flow are unchanged. Formerly accepted aliases and scope-valued expressions now reject. No new source syntax, diagnostic code/reason, feature or verifier/runtime state is introduced. P6-2 remains open for its remaining block forms.
Validation: unit tests and full conformance pass, 1,186/1,186 with no failures or pending tests, including 24 new source fixtures (four runs, twenty rejects). New cases cover aliases, block/branch/scope yields, aggregates, arguments, specialized bodies, shadowing, outer/nested scope lookup and unjoined children. Scope tests pass with 200 schedule seeds and collection before every instruction; the strengthened return case joins a task holding a ref loan, while break/continue cases join mutable loans. CLI diagnostics pass 206 checks over 88 public E7006 fixtures, including exact imported generic locations, unchanged alternate reasons and deterministic/hosted runs at three quanta. Formatter checks pass 3,359 assertions over 900 public files, with 888 parsed files, 12 syntax-error fixtures and 565 identical successful AIR outputs. Coverage remains 120/120. Across 1,208 original public source/AIR/std/example files, all 2,084 check/lower outputs and exit codes are byte-identical, including 560 successful source lowerings. Independent read-only Claude review found no accepted bypass or cleanup regression; its immutable-assignment spec clarification is included. Bundle growth is recorded in docs/agent/README.md; frozen evaluation inputs remain unchanged. This completes Q-041, not Phase 6.
P6-9 executable examples (2026-10-07)
Four legacy examples now use implemented source syntax: disjoint parallel map, Island channel transfer, atomic publication and a bounded journal. The hello package now enters through .aji, retaining its AIR counterpart. All 27 example source files are checked through 24 standalone entry points and two explicit packages, including the module helper. Five larger source/AIR reference pairs already live in tests/conformance/source/programs/; their stress validation completes this task. P6-10 remains open.
No language/spec, AIR, diagnostic, verifier or interpreter rule changes. Existing ownership, borrow, effect, capability and task rules enforce explicit joins, resource consumption and release/acquire ordering; existing source rejects such as layer9/reject/use_after_send.aji retain E2001. Previously unparsable examples become executable. The journal creates a fresh file, checks length/offset before writing, documents its payload-only CRC and blocks further appends after partial I/O failure; explicit close remains required. This is an application example, not a durable-log contract or an implementation of source requires/ensures.
Validation: unit tests and full conformance pass, 1,186/1,186. All five reference pairs pass with 200 schedule seeds and collection before every instruction. New CI checks pass 3,662 CLI calls: every example/package, independent journal encoding/CRC/offset checks, overflow without writes, partial hosted writes, and concurrent source/AIR record equality at 200 seeds across three quanta. Linux raises the failed file's quota before retry to verify poisoning; the branch without prlimit also passes, retaining the original quota. Independent Claude review found the old-file offset error and two integration issues; these are corrected. A separate formatter correction preserves spaces in unpack/grouped range forms, with a failing-before/passing-after unit test and CLI AIR-fidelity test. Source Bundle hashes are unchanged for all 16 files; Quick Reference, AIR and token budgets do not grow. Frozen evaluation inputs remain unchanged.
P6-5 fields named len (2026-10-07)
The implementation follow-up from P6-9 is resolved: nominal values and ref/mut receivers dispatch .len through ordinary field access, using the declared field type. Array field types are also available to inference for chained access such as header.len.len. Arrays and slices, including slices of structs, retain their built-in length behavior. Spec 15 §5 already defines these rules; no spec, bundle, AIR, verifier or interpreter change is required.
Existing borrow/load/end and whole-value ownership rules remain authoritative: reading a Copy field succeeds, conflicting borrows reject E2101, and projecting a linear field rejects E1001. Missing struct fields now produce E7002 with type and field, replacing the misleading array/slice E7005. Enum field access and type mismatches retain E7005. A struct length field does not prove slice bounds: the out-of-bounds regression still traps T0008. This restores specified source behavior without changing accepted AIR semantics or runtime state.
Validation: full conformance passes 1,201/1,201, including all 15 new cases; the new cases also pass with collection before every instruction. Unit tests, generic CLI integration (32 checks), formatting checks and coverage (120/120) pass. The formatter passes 3,437 checks over 916 public files, with 582 identical successful AIR outputs. Imported generic fields preserve declared types, source locations and source/AIR run-record parity. Across 1,233 original public files, all 2,134 check/lower results agree after normalizing absolute versus relative diagnostic file paths; all 570 successful source lowerings are byte-identical. Independent read-only Claude review found no remaining issues. P6-5 remains open for its other source-layer work.