agent: builder model: opus max_turns: 120 budget_usd: 25 —

Brief: L2-2, the contracts/{order,locks,sharing,maps,throws,touch}.rs crossings into Nikaia (lane 2, Part #125)

Score: the bootstrap (docs/bootstrap.md), lane 2: the crossings of contracts/ after L2-1 (dsl.rs, bounds_report.rs). S=2, C~4-6 M (comparable: P4b). Target: about -370 Rust code lines (self_hosting.py counts code lines): locks.rs and throws.rs deleted, the other four shrink to the forwards their callers in lane 1 and in crates/nikaia/tests/it/ need.

Cut: crates/nikaia/src/contracts/locks.rs:85-145 Cut: crates/nikaia/src/contracts/touch.rs:32-41 Cut: crates/nikaia/src/contracts/touch.rs:170-232 Cut: crates/nikaia/src/contracts/throws.rs:37-248 Cut: crates/nikaia/src/contracts/sharing.rs:170-189 Cut: crates/nikaia/src/contracts/maps.rs:52-113 Cut: crates/nikaia/src/contracts/maps.rs:137-144 Cut: crates/nikaia/src/contracts/order.rs:161-203 Convert: –profile check-free –prefix ledger_infer_

The driver converts these (ranges at acf4f08) before you start and names the draft (.draft.nika, .notes, .rs) in your prompt: start from it, do not cut or convert again. The architect’s trial run of the same cut (479 Rust lines in, 304 out, 2 TODOs): by cut, code lines Rust to draft: locks 55 to 25, touch key 4 to 5, touch infer 45 to 15, throws 186 to 97 (2 TODOs), sharing 8 to 8, maps shape 42 to 28, maps infer 7 to 7, order 26 to 4. Wrong in the draft, fix by hand: every &Parsed typed ref CheckWorld (use the host shape below); the five infers keep the name infer (R245 prefixed only function_key): name them ledger_infer_locks, ledger_infer_touches, ledger_infer_throws, ledger_infer_sharing, ledger_infer_maps, every helper ledger_infer_; order_of came out as a call to emit_order; contribution gained a wrong let given = reach ?? return (null, []) that shadows given; from_given’s params chain ends in .unwrap_or_default(); function_key is dead (#[allow(dead_code)]): drop it; reached is not in Nikaia (see Facts).

If crates/nikaia-compiler/src exists, R0 (#921) has run: read every crates/nikaia-std/src/tools below as crates/nikaia-compiler/src, and nikaia_std::tools:: as nikaia_compiler::.

Owns: crates/nikaia/src/contracts/{order,locks,sharing,maps,throws,touch}.rs (locks.rs, throws.rs deleted), contracts/mod.rs (only the pub mod lines :30-38 and the five calls in infer_package :690, :695, :737, :741, :744, plus one helper there that builds the units’ shape), contracts/send.rs (only :146), check/host.rs (only free_calls :214-216), emit/host.rs (only :196-202 and seeds_shape :262-271), emit/seeds.rs, new crates/nikaia-std/src/tools/ledger_infer.nika, tools/maps.nika (only MpShape’s two counts), tools/order.nika (only overlap_report’s overlaps_in parameter, :680), the generated tools/lowered/*. Not yours: lane 1’s project.rs, modules.rs, comptime_run.rs, build_time.rs (their calls order::overlap_report :1692, sharing::report :1707, maps::keyed_functions modules.rs :859, touch::Touch build_time.rs :19, :385 keep compiling through a one-line Rust forward or re-export with the same signature, bootstrap.md section 6); L2-1’s dsl.rs, bounds_report.rs, check/mod.rs, emit/mod.rs, lib.rs, bounds_report.nika, dsl.nika; contracts/sync.rs, ty.rs and the rest of contracts/mod.rs (later slices).

Facts

To build

  1. locks, touch, throws into ledger_infer.nika (the three infers over CheckMethodCalls), locks.rs and throws.rs deleted, touch.rs keeps what Facts says; callers as above. lower-std: ledger_infer.rs is new, the index lowered.rs gains it. Commit contracts: the lock, touch and throws inference into Nikaia (L2-2), Part: #125.
  2. sharing, maps, order as above (ledger_infer_sharing, ledger_infer_maps, MpShape in Seeds, the overlap walk in order.nika). Commit contracts: the sharing, maps and order crossings shrink to forwards (L2-2), Part: #125. Report the self-hosting % (python3 scripts/self_hosting.py | tail -3, after adding ledger_infer.nika to COMPILER_NIKA locally and not committing that edit: name the row under Body:).

A lowering defect met is fixed in the compiler as its own commit with a test (Fix, do not work around); if it is more than one step, stop and report it under Needs:.

Done when

nikaia test --project tests/compiler once, no --both-settings (no check_*/emit_* .nika changes, bootstrap L4c); cargo test --profile fast -p nikaia --lib contracts:: passes; it tests filtered on touch sharing word_locks overlap locks throws fails_with maps seeds send foreign_runtime plus the guard set of .claude/agents/builder.md, once, at the end, beside clippy; clippy clean; lower-std fixpoint in the worktree after the rebase. Changelog: none (a move).

Stop and report if

An open design choice beyond the ones above; a ledger, .stderr, .stdout or report text that would change by one byte; a missing std call; an edit needed in a lane-1 file or in L2-1’s; an error in another lane’s file (docs/bootstrap.md, File ownership).

Read docs/builder-facts.md.

Rules (CLAUDE.md; worktree lane, docs/bootstrap.md section 3)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/lane2-l22-contracts-crossings.md.report.md)

Fields of docs/architect.md, Briefs and reports: Result: done|noop|partial|blocked (the bare word alone on that line: Result: done, never a summary after it, which cuts the batch, b869a 2026-10-27; Owner: is a question for the owner or none, never a role), Files, Commit, Body (optional, one paragraph for the commit message), Fixes, Pushed, Tests, Gate (green|red), Deviation, Found, Needs, Changelog, Owner, Disk freed, and for a move Rs2nika: (the kept N of M lines of rs2nika --score, then the three costliest hand edits; none for a task that moves no Rust). none where nothing, and then the bare word: Deviation: none (a note) cuts the batch (batch.nika compares exactly); a note goes into the commit message. Found: is only for a defect outside your change (it cuts the batch); a converter draft that came out wrong is no Found:, it is one of the costliest edits under Rs2nika:, which the converter lane reads (e12-4b 2026-10-27); how you solved your own step goes into the commit message. Deviation: is only a step of the brief built otherwise than written or not built (a choice the brief left to you, such as keep what X needs and say so, is no deviation: it goes into the commit message; nor is building two steps in one commit when every step is built, e12-3a 2026-10-27, nor a step another commit on develop already built, shown by your test failing with that commit’s change reverted, b889 2026-10-27: name the commit in Body:); how you verified (e.g. a test not run against the unfixed compiler) goes under Tests:. A noop says why under Tests: (what was probed), not under Deviation:. Final answer, one line: done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).

Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01GFeMqxRbtUMiGVyDMxsvEq

This site is open source. Improve this page.