Issue #921: Relocate the compiler’s Nikaia from crates/nikaia-std/src/tools to crates/nikaia-compiler (ADR-294 D21)

Open and answer this issue on GitHub.

ready · opened 2026-10-28 · updated 2026-11-03 · 0 comments


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

The full brief, with exact steps, locations and the specification text, is tracked as docs/briefs/r0-compiler-crate.md; this issue is its record.

Facts

Owner, 2026-10-28: the compiler’s Nikaia (242 .nika, described.contracts, lowered.rs, lowered/) sits in crates/nikaia-std/src/tools behind std’s compiler feature (#723). From outside it reads as part of the standard library or a helper tool. It should stand where one recognises it as the compiler, apart from std, with the thin Rust adapter crates/nikaia beside it.

The generated files already name std as nikaia_std::..., so they compile unchanged in another crate. The sysroot finds the package through sysroot_tools_dir (sysroot_cache.nika:79).

Target layout (decided by the architect)

crates/nikaia-compiler/   package `nikaia-compiler`, lib `nikaia_compiler`
  src/lib.rs              the hand-written Rust of the old `mod tools` (crate root)
  src/*.nika, src/described.contracts, src/lowered.rs, src/lowered/
  tests/rust_signatures.rs
crates/nikaia/            the `nikaia` binary, the Rust adapter
crates/nikaia-std/        std only; no `compiler` feature

nikaia_std::tools::X becomes nikaia_compiler::X. Specification: ADR-294 D18/D19 paths, new D21, and the Part III sentence (std ships as sources). One version raise (supervisor).

To build (one mechanical commit, at a quiet moment: no other lane running)

  1. Precondition: C1 clean under crates/ and scripts/, fast-forwarded to origin/develop.
  2. sysroot_tools_dir -> root/nikaia-compiler/src, lowered once with the old binary in the old place.
  3. git mv the directory and rust_signatures.rs.
  4. New Cargo.toml; workspace member; crates/nikaia depends on both, without the feature.
  5. src/lib.rs from nikaia-std/src/lib.rs:228-~619, crate:: -> nikaia_std::; drop the compiler feature.
  6. nikaia_std::tools:: -> nikaia_compiler:: in crates/nikaia/{src,tests}.
  7. Paths in scripts (self_hosting.py, where.nika, tokenspeed.nika, test_bump.sh), CLAUDE.md, builder.md, builder-facts.md, plan docs; not history or old briefs.
  8. Build, cold lower-std twice: no diff the second time (fixpoint); cargo build -p nikaia-std alone builds.
  9. ADR-294 D18/D19/D21, Part III line.
  10. Gate: whole it binary, nikaia-compiler tests, guards, clippy, pre-push.
  11. One commit Fixes this issue, push fast-forward.

Report

The report form of docs/architect.md, Briefs and reports (in the brief).


Generated by Claude Code

Back to Open Issues