# Admit a workflow as a durable job — by served name, or as immutable snapshot bytes Source: https://docs.nika.sh/api-reference/admit-a-workflow-as-a-durable-job-—-by-served-name-or-as-immutable-snapshot-bytes /api-reference/openapi.json post /v1/jobs Two forms, one admission (ADR-131). `{"workflow": ""}` names a workflow the served registry lists: the resident captures its world through ExecutionService, exactly as a schedule does. Optional `access` on that form is CLI `--access` for this job only. A snapshot body is the world `nika check --json --sdk-snapshot` prints, decoded and readmitted through the same ExecutionService; its digests are optional caller-supplied integrity digests (a content assertion, never a signature). Snapshot jobs inherit the resident's unpinned plan. The server never interprets a caller filesystem path. Idempotency binds to the exact request bytes. # Author a candidate workflow without running it (stateless · source-only) Source: https://docs.nika.sh/api-reference/author-a-candidate-workflow-without-running-it-stateless-·-source-only /api-reference/openapi.json post /v1/compile The HTTP transport of the same Compile core as `nika compile`. Foundation scope: CREATE resolves an exact embedded skeleton name (or `hello`), EDIT changes one existing constant, answers are explicit JSON literals; any other intent is answered `incomplete` with no substitute workflow. Creates no job, run, approval or trace, writes no file, contacts no provider: ambient keys are never consent. `check_preview` is a REVIEW of the source only, never admission: POST /v1/jobs judges a candidate again. Questions carry stable keys; answering is a new request, not a session. # Contained workflow names Source: https://docs.nika.sh/api-reference/contained-workflow-names /api-reference/openapi.json get /v1/workflows # Create or revision-conditionally update one resident schedule Source: https://docs.nika.sh/api-reference/create-or-revision-conditionally-update-one-resident-schedule /api-reference/openapi.json put /v1/schedules/{id} Create requires If-None-Match: *. Update requires the exact ETag in If-Match. Identical lost-response retries are unchanged and retain the revision. A refused precondition answers 412 with the schedule's current revision (null when none exists). A definition the planner or the schedule validator refuses answers 422 with its findings; a malformed body, refused inputs or a refused workflow answer 422 with the error envelope. # Job event SSE Source: https://docs.nika.sh/api-reference/job-event-sse /api-reference/openapi.json get /v1/jobs/{id}/events # Job identity and status Source: https://docs.nika.sh/api-reference/job-identity-and-status /api-reference/openapi.json get /v1/jobs/{id} # Judge a workflow without creating a job — by served name, or as immutable snapshot bytes Source: https://docs.nika.sh/api-reference/judge-a-workflow-without-creating-a-job-—-by-served-name-or-as-immutable-snapshot-bytes /api-reference/openapi.json post /v1/check Runs the same admission as POST /v1/jobs (ADR-131 · both forms) over the exact request body, and creates nothing. # Public process liveness Source: https://docs.nika.sh/api-reference/public-process-liveness /api-reference/openapi.json get /health # Read one declarative resident schedule Source: https://docs.nika.sh/api-reference/read-one-declarative-resident-schedule /api-reference/openapi.json get /v1/schedules/{id} # Request cancellation or replay an ended observation Source: https://docs.nika.sh/api-reference/request-cancellation-or-replay-an-ended-observation /api-reference/openapi.json post /v1/jobs/{id}/cancel A queued job cancels atomically before execution claims it. An active job receives the run-scoped cancellation signal and returns 202 until its execution owner settles: the result may be success, failure or cancellation. The grace is fixed at 5 seconds from the signal: a run that has not reached a wave boundary and settled by then is dropped and the job settles `interrupted`, never an invented cancellation. A task still inside one long step when the signal arrives (an agent turn, a long wait) typically outlasts the grace. A paused or final observation returns its existing result unchanged. # Status only; diagnosis lives on GET /v1/jobs/{id} and SSE Source: https://docs.nika.sh/api-reference/status-only;-diagnosis-lives-on-get-v1jobs-and-sse /api-reference/openapi.json get /v1/jobs/{id}/status # Stream one artifact's bytes, verified against its journaled SHA-256 Source: https://docs.nika.sh/api-reference/stream-one-artifacts-bytes-verified-against-its-journaled-sha-256 /api-reference/openapi.json get /v1/jobs/{id}/artifacts/{name} `{name}` is an entry's `name` from GET /v1/jobs/{id}/artifacts, never a filesystem path. Every name contains `/` (`file/out/report.pdf`, `agent_image/1.png`): send it with its `/` literal or percent-encoded (`%2F`), as one path parameter. The rest of the path is percent-decoded once and matched exactly against the manifest's names; an escape that is not two hexadecimal digits, bytes that are not UTF-8 or NUL match no entry. The server opens the recorded place below the project root it holds, refusing a symbolic link at any component, and reads every byte against the recorded size and SHA-256 before the response starts (409 `artifact_changed` on a mismatch), keeping the SHA-256 of each 256 KiB chunk. While the bytes stream, each chunk is read again and sent only if it hashes to the digest kept for it: every byte that leaves is a byte of the recorded file, and a file changed during the stream ends it before its `Content-Length`. A stream also ends short when the server stops or cannot read the file: retry a short body, and a file that really changed then answers 409 `artifact_changed`. The bound is `max_artifact_bytes`; a larger artifact stays listed and is refused 403. At most 4 journal verifications and pre-download hash passes run at once (`artifact_capacity` otherwise); a stream holds no slot once its bytes start, is bounded by the connection limit, and is not bounded by the request deadline. # The artifacts a settled job's sealed journal records Source: https://docs.nika.sh/api-reference/the-artifacts-a-settled-jobs-sealed-journal-records /api-reference/openapi.json get /v1/jobs/{id}/artifacts Answers only for a settled job (succeeded, failed, cancelled, interrupted); an interrupted run never sealed its journal, so its job answers 409 `artifact_journal_unavailable`. The manifest is read from the journal the job's receipt names, judged by the one verifier `nika trace verify` runs: the chain must be intact, the seal must verify against a run key that verifier weighs on the server, in the order the server signs (the public half of an explicit `NIKA_RUN_KEY_FILE` · `NIKA_RUN_PUB_FILE` pair, `~/.nika/keys/run-signing.pub`, the retired-key ledger), and the head must be the receipt's `chain_head`. Each entry is one journal event that records a written byte stream with its SHA-256: a file a builtin saved (`nika:chart`, `nika:image_generate`, `nika:tts_generate`, `nika:image_fx`, `nika:image_compose`) at a relative path inside the project and outside its `.nika` (refused by name in any ASCII case, and by device and inode under any other spelling the filesystem folds onto it), its last write winning, or an image an agent's harness sent, kept under `.nika/blobs`. `nika:write` and `nika:edit` journal no hash of what they wrote, so their files are not listed. Every size and digest is the journal's; the download route checks the bytes against them. No filesystem path of the server is exposed. # This document Source: https://docs.nika.sh/api-reference/this-document /api-reference/openapi.json get /v1/openapi.json # Verify the job's trace journal Source: https://docs.nika.sh/api-reference/verify-the-jobs-trace-journal /api-reference/openapi.json get /v1/jobs/{id}/trace/verify Locates the journal the resident wrote for this job under the project it serves (by the job's execution and trace identity) and verifies it through the same verifier `nika trace verify` runs; the vocabulary is the CLI's. `unavailable` is the honest refusal when no journal exists. The response never exposes a filesystem path. # Workflow metadata without source bytes Source: https://docs.nika.sh/api-reference/workflow-metadata-without-source-bytes /api-reference/openapi.json get /v1/workflows/{name} `{name}` is a served name exactly as GET /v1/workflows lists it: a project-relative path that usually contains `/` (`workflows/daily.nika`). Send its `/` separators literally, as path separators: GET /v1/workflows/workflows/daily.nika. A served name uses only ASCII letters, digits, `.`, `_`, `-` and `/`, so no segment needs percent-encoding; an encoded separator (`%2F`) or any other escape is not decoded and answers 404. # 12-gate admission Source: https://docs.nika.sh/architecture/admission The twelve gates a crate passes to be admitted to the engine workspace, and how pre-admission crates are tracked. > [!NOTE] > > This page is the engine's construction record. In the 0.124 line, work > stays focused on maintenance, security and the media capabilities > workflows need; no new crate admissions are planned, and contributions > focus on fixes > ([CONTRIBUTING](https://github.com/supernovae-st/nika/blob/main/CONTRIBUTING.md)). A crate is **admitted** when it passes all twelve gates, in one commit. No "we'll fix gate 5 later", no "the spec is obvious". Before that, a crate may live in the workspace as **pre-admission (WIP)**, listed in `Cargo.toml` under `[workspace.metadata.diamond] wip`, and some of those ship in the binary. > [!NOTE] > > **Canonical source:** [ADR-003](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-003-12-gate-admission.md), > the gate table in [CONTRIBUTING.md](https://github.com/supernovae-st/nika/blob/main/CONTRIBUTING.md), > and the checker `scripts/ci/check-crate-gates.sh`. > > **At v0.124.1:** 75 crates admitted · > pre-admission (nika-chart, nika-fx, nika-proof, nika-store, nika-harness, nika-execution, nika-service-execution, nika-serve, nika-session, nika-session-change, nika-session-agent, nika-session-host, nika-session-intelligence, nika-tui, nika-tui-view). ## The 12 gates **1. Gate 1: SPEC** A crate spec exists at `docs/crate-specs/.md`. It declares: purpose, layer (L0/L0.5/L1/L2/L3/L4), LOC budget, public API surface, security axes, tracked ADRs. No code before spec. **2. Gate 2: TDD** Tests written before implementation. The commit history shows **RED before GREEN**: failing tests on one commit, minimal implementation on the next. Reviewed in gate 11. **3. Gate 3: IMPL** Minimal implementation. Compiles with `cargo build --workspace`. Every test green with `cargo test --workspace --lib`. No `# TEMP` without a removal plan. No `#[allow(dead_code)]`. Size walls (ADR-154): 2,500 lines per file and 25,000 production lines per crate, with warnings at 1,500 and 15,000. **4. Gate 4: CLIPPY 0** `cargo clippy --workspace --all-targets -- -D warnings`: zero warnings. `unwrap_used = "deny"` enforced workspace-wide. Zero `.unwrap()` / `.expect(` in `src/` outside `#[cfg(test)]`. **5. Gate 5: MUTATION ≥ 90%** `cargo mutants -p `: at least 90% of mutants killed. Catches untested branches, "happy path only" tests, dead clauses. Data-heavy crates (e.g., `nika-catalog`) may use 85% with justification in spec. **6. Gate 6: PROPERTY** Property tests via `proptest` for any crate touching: security, parsers, encoding, taint propagation, capability resolution. Regression seeds checked into `proptest-regressions/`. **7. Gate 7: BENCHMARKS** `benches/` directory with `criterion` if the crate is on a hot path (parsers, catalog lookup, template resolution). Waivable for pure-types crates with justification in spec. **8. Gate 8: DOCS** `cargo doc --no-deps --document-private-items`: zero warnings. All public items documented. `#[doc(hidden)]` used sparingly and with reason. **9. Gate 9: CANARY E2E** A `.nika` canary workflow (`check-crate-gates.sh` looks for `tests/canary/.nika`) exercises the crate end-to-end against the rest of the workspace. The checker reports the gate as skipped when no canary exists; it is waivable for L0 foundation crates with no runtime surface. **10. Gate 10: PARITY LEGACY** Golden test comparing output against the legacy v0.79.3 implementation, read from the `brouillon` branch (`git show brouillon:`). Flags behavior drift from v0.79 for conscious review. **11. Gate 11: REVIEW SWARM** Three independent reviewers read the change in parallel. Every P0 and P1 finding must be fixed before merge. **12. Gate 12: ATOMIC COMMIT** Single commit. Message: ``` feat(): admit to workspace — all 12 gates passed Gate 1 SPEC ✅ docs/crate-specs/.md Gate 2 TDD ✅ RED before GREEN confirmed Gate 3 IMPL ✅ LOC, compiles, tests pass ... Co-Authored-By: Nika 🦋 ``` ## Why twelve > [!TIP] > > Each gate catches a failure mode seen in production Rust codebases at > scale. Dropping any one means accepting a known regression vector. | Gate | Failure mode caught | | - | - | | SPEC | Scope creep, missing layer contract, undeclared axes | | TDD | Tests that retrofit the implementation (always green from commit 1) | | IMPL | Oversized files, dead code, TEMP debt | | CLIPPY | Panic-prone patterns, hidden bugs flagged by lints | | MUTATION | "100% test coverage" with zero real assertions | | PROPERTY | Edge cases in parsers / taint / crypto that example-based tests miss | | BENCHMARKS | Silent perf regression on hot paths | | DOCS | Undocumented public API, broken intra-doc links | | CANARY | Integration breaks hidden by unit-test success | | PARITY | Silent behavior drift from the v0.79 baseline | | REVIEW | Single-reviewer blind spots | | ATOMIC | Merge-commit noise, non-bisectable history | ## Exemptions A gate is **genuinely not applicable** for some crate types: * `benches/` for a pure-types crate with no hot path. * Canary E2E for L0 foundation (nothing to execute end-to-end). * PARITY for crates with no v0.79 counterpart (Diamond-original code). **Exemptions are documented in `docs/crate-specs/.md` with a 1-paragraph justification.** They are not defaults. They are deliberate. ## Admission cadence During the Diamond rewrite, crates were admitted one at a time, one atomic, bisectable commit each, with per-admission alpha tags on the 0.8x train. That cadence is historical: public releases are tagged engine versions (today 0.124.1), not per-crate alphas. ## See also > **[Layer registry](/architecture/layers)** > > The layers and the mechanical sort test for a new crate. > **[Forward-compat invariants](/architecture/forward-compat-invariants)** > > The public-API contract every admitted crate honors. > **[L0 foundation decisions](/architecture/l0-decisions)** > > The early decisions that shaped L0, and what became of them. > **[Constellation](/reference/constellation)** > > The map of admitted and pre-admission crates. # ADR index Source: https://docs.nika.sh/architecture/adrs The Architecture Decision Record index: every significant engineering decision behind the Nika engine, versioned and auditable. Every significant engineering decision in Nika Diamond lives as an ADR, a short markdown file in [`docs/adr/`](https://github.com/supernovae-st/nika/tree/main/docs/adr) with status, date, context, decision, consequences. At v0.124.1: **114 records**: 93 accepted, 17 proposed, 3 superseded and 1 rejected. In the 0.124 line, work stays focused on maintenance, security and the media capabilities workflows need, and the proposed records stay as the record of open designs, not as a plan. > [!NOTE] > > **Canonical source:** [`docs/adr/index.json`](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/index.json) > (machine-readable) + [`docs/adr/README.md`](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/README.md) > (human index). One file per ADR. An accepted ADR changes only by an > amendment (a later ADR names it in its frontmatter `amends:` list) or by a > superseding ADR. ## At a glance > **Total** > > **114** decision records > **Accepted** > > **93** locked > **Proposed** > > **17** in review ## Foundation ADRs by theme (001–035) The first 35 records set the engine's foundations. The full list follows in [Every record](#every-record). > **Meta / Process (5)** > > How Nika runs itself as a project: version cadence, admission, ADRs-on-ADRs. > > | ID | Title | Status | > | - | - | - | > | [ADR-001](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-001-diamond-orphan-branch.md) | Diamond orphan branch rewrite instead of iterative refactor | ✅ Accepted | > | [ADR-002](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-002-forever-v0x.md) | Forever v0.x, no v1.0 target (amended on 2026-06-20 to real semver). 0.124 is the current release line. Work stays focused on maintenance, security and the media capabilities workflows need; native video is planned for 0.125. No 1.0 release is planned | ✅ Accepted | > | [ADR-003](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-003-12-gate-admission.md) | 12-gate crate admission protocol | ✅ Accepted | > | [ADR-009](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-009-adr-process.md) | ADR process and hook discipline | ✅ Accepted | > | [ADR-011](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-011-cargo-xtask.md) | cargo xtask as canonical automation surface | ✅ Accepted | > **Architecture / Layering (6)** > > The six-layer crate discipline + physical workspace layout. > > | ID | Title | Status | > | - | - | - | > | [ADR-004](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-004-context-window-sized-crates.md) | Context-window-sized crate architecture (size walls amended by ADR-154) | ✅ Accepted | > | [ADR-006](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-006-layered-kernel-isp-traits.md) | Layered architecture with kernel ISP atomic traits + `trait_variant` | ✅ Accepted | > | [ADR-022](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-022-foundation-crate-layout-v081.md) | Foundation crate layout v0.81: 14 crates, `publish = false` | ✅ Accepted | > | [ADR-023](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-023-file-modularity-discipline.md) | File modularity discipline; its limits are amended by ADR-154: 2,500 lines per file and 25,000 per crate, warnings at 1,500 and 15,000 | ✅ Accepted | > | [ADR-026](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-026-workspace-toml-ssot.md) | `workspace.toml` single source of truth + auto-generated `crate.md` | ✅ Accepted | > | [ADR-027](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-027-strict-l0-tiers-cargo-timings.md) | Strict L0 sublayer tiers + max 3 sibling deps | ✅ Accepted | > **Forward-compat (4)** > > How Nika stays additive across decades without breaking changes. > > | ID | Title | Status | > | - | - | - | > | [ADR-007](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-007-forward-compat-invariants.md) | Forward-compat invariants with `#[non_exhaustive]`, `new()`, pre-planted reservations | ✅ Accepted | > | [ADR-014](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-014-sealed-kernel-traits.md) | Sealed kernel traits with explicit adapter registration | ✅ Accepted | > | [ADR-025](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-025-per-crate-semver-release-plz.md) | Per-crate semver via `release-plz` (publishable crates only) | ✅ Accepted | > | [ADR-028](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-028-forward-compat-reservation-policy.md) | Forward-compat reservation policy: seams now, crates later | ✅ Accepted | > **Error handling + diagnostics (2)** > > How `NikaError` is shaped + how failures surface to users. > > | ID | Title | Status | > | - | - | - | > | [ADR-005](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-005-error-hierarchy.md) | Trait-based error hierarchy with `NikaErrorCode` + `Box` | ✅ Accepted | > | [ADR-010](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-010-miette-diagnostic-layer.md) | `miette` as the L4 diagnostic presentation layer | ✅ Accepted | > **Runtime + concurrency (5)** > > Cancellation, streaming, sync primitives, retry / timeout ownership. > > | ID | Title | Status | > | - | - | - | > | [ADR-012](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-012-typestate-runtime.md) | Typestate for `nika-runtime` workflow lifecycle | ✅ Accepted | > | [ADR-016](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-016-cancellation-model.md) | Cancellation model: future-drop primary + `CancelCtx` cooperative module | ✅ Accepted | > | [ADR-017](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-017-streaming-policy.md) | Streaming policy: bounded mpsc(32), `ReceiverStream` at kernel boundary | ✅ Accepted | > | [ADR-018](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-018-runtime-sync-primitives.md) | Runtime + sync primitives: single Tokio rt, `parking_lot` default | ✅ Accepted | > | [ADR-019](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-019-retry-timeout-ownership.md) | Retry + timeout ownership: stratified by layer | ✅ Accepted | > **Testing (2)** > > How the engine verifies itself beyond unit tests. > > | ID | Title | Status | > | - | - | - | > | [ADR-013](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-013-loom-concurrency-verification.md) | Loom-based concurrency verification for L0.5 + L3 | ✅ Accepted | > | [ADR-015](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-015-expect-test-inline-snapshots.md) | `expect-test` for inline snapshot assertions on rendered output | ✅ Accepted | > **Catalog + YAML (2)** > > The data-driven provider catalog and the workflow envelope convention. > > | ID | Title | Status | > | - | - | - | > | [ADR-008](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-008-toml-driven-catalog.md) | TOML-driven catalog with build-time codegen + perfect-hash lookup | ✅ Accepted | > | [ADR-021](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-021-yaml-envelope-convention.md) | YAML envelope: `apiVersion + kind + metadata + spec` | ♻️ Superseded (ADR-082 then ADR-113: identity is `nika: <kebab-id>`) | > **WASM + sandbox (1)** > > The v0.100 plugin boundary, pre-planted at v0.80. > > | ID | Title | Status | > | - | - | - | > | [ADR-020](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-020-wasm-plugin-boundary.md) | WASM plugin boundary + Sandbox: trait stubs now, dual timeout later | ✅ Accepted | > **SOTA Rust patterns (1)** > > Cross-cutting idiom adoption. > > | ID | Title | Status | > | - | - | - | > | [ADR-024](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-024-sota-rust-patterns.md) | Adopt SOTA Rust patterns: `bon` Builder, `Arc`, `camino`, sealed modules | ✅ Accepted | > **L0 foundational additions (2)** > > Late-added Accepted ADRs covering foundational types + kernel expansion. > > | ID | Title | Status | > | - | - | - | > | [ADR-033](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-033-l0-foundational-types.md) | L0 foundational types: Cost, UUIDv7, TrustLevel, TokenUsage evolution | ✅ Accepted | > | [ADR-034](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-034-l05-kernel-traits-expansion.md) | L0.5 kernel traits expansion: 6 new traits scoped to v0.81+ | ✅ Accepted | > **Reservations (5)** > > Seed-level type reservations made ahead of the crates that would use > them. > > | ID | Title | Status | > | - | - | - | > | [ADR-029](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-029-embedding-spec-reservation.md) | EmbeddingSpec value-type reservation (memory subsystem seed) | ✅ Accepted | > | [ADR-030](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-030-memory-frame-trust.md) | `MemoryFrameRef.trust` reservation | ✅ Accepted | > | [ADR-031](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-031-recall-query-tenant-keyspace.md) | `RecallQuery.tenant` reservation (keyspace seed) | ✅ Accepted | > | [ADR-032](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-032-wasm-plugin-context.md) | `WasmPluginError::OutOfFuel` + `Trap` + `PluginCallContext` reservation | ✅ Accepted | > | [ADR-035](https://github.com/supernovae-st/nika/blob/main/docs/adr/adr-035-telemetry-seams.md) | Telemetry seams: `SpanGuard.parent_span_id` + `SpanRef` (OTel-ready) | ✅ Accepted | ## Every record > **All records at v0.123.0, from docs/adr/index.json** > > | ID | Title | Status | > | - | - | - | > | [ADR-001](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-001-diamond-orphan-branch.md) | Diamond orphan branch rewrite instead of iterative refactor | ✅ Accepted | > | [ADR-002](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-002-forever-v0x.md) | Forever v0.x -- no v1.0 target | ✅ Accepted | > | [ADR-003](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-003-12-gate-admission.md) | 12-gate crate admission protocol | ✅ Accepted | > | [ADR-004](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-004-context-window-sized-crates.md) | Context-window-sized crate architecture | ✅ Accepted | > | [ADR-005](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-005-error-hierarchy.md) | Trait-based error hierarchy with NikaErrorCode and Box\ | ✅ Accepted | > | [ADR-006](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-006-layered-kernel-isp-traits.md) | Layered architecture with kernel ISP atomic traits and trait\_variant | ✅ Accepted | > | [ADR-007](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-007-forward-compat-invariants.md) | Forward-compat invariants with non\_exhaustive, new(), and pre-planted hooks | ✅ Accepted | > | [ADR-008](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-008-toml-driven-catalog.md) | TOML-driven catalog with build-time codegen and perfect-hash lookup | ✅ Accepted | > | [ADR-009](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-009-adr-process.md) | ADR process and hook discipline (meta) | ✅ Accepted | > | [ADR-010](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-010-miette-diagnostic-layer.md) | miette as the L4 diagnostic presentation layer | ✅ Accepted | > | [ADR-011](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-011-cargo-xtask.md) | cargo xtask as canonical automation surface | ✅ Accepted | > | [ADR-012](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-012-typestate-runtime.md) | Typestate for nika-runtime workflow lifecycle | ✅ Accepted | > | [ADR-013](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-013-loom-concurrency-verification.md) | Loom-based concurrency verification for L0.5 and L3 | ✅ Accepted | > | [ADR-014](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-014-sealed-kernel-traits.md) | Sealed kernel traits with explicit adapter registration | ✅ Accepted | > | [ADR-015](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-015-expect-test-inline-snapshots.md) | expect-test for inline snapshot assertions on rendered output | ✅ Accepted | > | [ADR-016](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-016-cancellation-model.md) | Cancellation model: future-drop primary, CancelCtx cooperative module | ✅ Accepted | > | [ADR-017](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-017-streaming-policy.md) | Streaming policy: bounded mpsc(32), ReceiverStream at kernel boundary | ✅ Accepted | > | [ADR-018](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-018-runtime-sync-primitives.md) | Runtime + sync primitives: single Tokio rt, parking\_lot default | ✅ Accepted | > | [ADR-019](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-019-retry-timeout-ownership.md) | Retry + timeout ownership: stratified by layer | ✅ Accepted | > | [ADR-020](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-020-wasm-plugin-boundary.md) | WASM plugin boundary + Sandbox: trait stubs now, dual timeout later | ✅ Accepted | > | [ADR-021](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-021-yaml-envelope-convention.md) | YAML envelope convention: apiVersion + kind + metadata + spec, multi-doc, 9 doc kinds | ♻️ Superseded by ADR-082 | > | [ADR-022](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-022-foundation-crate-layout-v081.md) | Foundation crate layout v0.81: 14 crates, publish = false, 5 renames + extracts | ✅ Accepted | > | [ADR-023](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-023-file-modularity-discipline.md) | File modularity discipline: 800 LOC warn / 1500 fail / 3000 fail-with-LOC-EXEMPT-allowlist | ✅ Accepted | > | [ADR-024](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-024-sota-rust-patterns.md) | Adopt SOTA Rust patterns: bon Builder, Arc\, camino, sealed module, strum, public-api | ✅ Accepted | > | [ADR-025](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-025-per-crate-semver-release-plz.md) | Per-crate semver via release-plz (publishable crates only) | ✅ Accepted | > | [ADR-026](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-026-workspace-toml-ssot.md) | workspace.toml single source of truth + auto-generated crate.md | ✅ Accepted | > | [ADR-027](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-027-strict-l0-tiers-cargo-timings.md) | Strict L0 sublayer tiers + max 3 sibling deps + cargo timings per-crate budget | ✅ Accepted | > | [ADR-028](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-028-forward-compat-reservation-policy.md) | Forward-compat API-type reservation (amended — feature scheduling dropped) | ✅ Accepted | > | [ADR-029](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-029-embedding-spec-reservation.md) | EmbeddingSpec value-type reservation (Cortex seed) | ✅ Accepted | > | [ADR-030](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-030-memory-frame-trust.md) | MemoryFrameRef.trust reservation (Shield gate seed) | ✅ Accepted | > | [ADR-031](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-031-recall-query-tenant-keyspace.md) | RecallQuery.tenant reservation (multi-tenant keyspace seed) | ✅ Accepted | > | [ADR-032](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-032-wasm-plugin-context.md) | WasmPluginError OutOfFuel + Trap + PluginCallContext reservation | ✅ Accepted | > | [ADR-033](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-033-l0-foundational-types.md) | L0 foundational types: Cost, UUIDv7, TrustLevel, TokenUsage evolution | ✅ Accepted | > | [ADR-034](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-034-l05-kernel-traits-expansion.md) | L0.5 kernel traits expansion: 6 new traits scoped to v0.81+ additions | ✅ Accepted | > | [ADR-035](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-035-telemetry-seams.md) | Telemetry seams: SpanGuard parent\_span\_id + SpanRef (OTel-ready) | ✅ Accepted | > | [ADR-036](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-036-msrv-policy-stub.md) | MSRV policy: rust-toolchain.toml SSOT + N-2 stable cadence (stub) | 🕒 Proposed | > | [ADR-037](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-037-bottom-up-diamond-progression.md) | Bottom-up diamond progression (no feature-milestone defer) | ✅ Accepted | > | [ADR-038](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-038-nika-bm25-admission.md) | Admit nika-bm25 as the first L1 memory satellite (CRAFT-from-scratch BM25 scorer) | ✅ Accepted | > | [ADR-039](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-039-streaming-memory-recall.md) | Streaming MemoryRecall for lazy fusion · recall\_stream() | 🕒 Proposed | > | [ADR-040](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-040-memory-cargo-feature-matrix.md) | Cargo feature matrix for nika-memory · zero-cost modularity | 🕒 Proposed | > | [ADR-041](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-041-type-state-memory-orchestrator.md) | Type-state lifecycle for nika-memory orchestrator | 🕒 Proposed | > | [ADR-042](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-042-autodesc-minimal-full-split.md) | Autodesc MINIMAL/FULL split · forcing-function moat at W4 | 🕒 Proposed | > | [ADR-078](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-078-memoryrecall-self-shape.md) | MemoryRecall \&self satellite contract + \&mut self orchestrator pool (Option D) | 🕒 Proposed | > | [ADR-079](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-079-capabilities-phantom-type.md) | Capabilities\ phantom-type kernel · compile-time effect refusal (Option C hybrid) | 🕒 Proposed | > | [ADR-080](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-080-mcp-stdio-cve-sandbox.md) | MCP STDIO transport vulnerability-class sandbox canon · 5-layer mitigation (post phantom-CVE audit) | 🕒 Proposed | > | [ADR-081](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-081-l1-effect-crate-guard-contract.md) | L1 effect-crate guard contract · 7 security guards as forever crate-admission criteria | 🕒 Proposed | > | [ADR-082](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-082-envelope-nika-v1-single-version-marker.md) | Workflow envelope: single version marker `nika: v1` (supersedes K8s apiVersion form) | ♻️ Superseded by ADR-113 | > | [ADR-083](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-083-l1-computer-use-cross-platform-doctrine.md) | L1 computer-use effect crates · cross-platform doctrine (macOS + Linux prio · Windows + all) | ✅ Accepted | > | [ADR-084](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-084-nika-catalog-spec-26-reconciliation.md) | nika-catalog builtin set · reconciliation to spec 26 (42→26 stdlib collapse + json\_merge cut) | ✅ Accepted | > | [ADR-085](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-085-spec-schema-oneof-bridge-to-schemars-codegen.md) | spec/workflow\.schema.json invoke.tool oneOf · interim hand-derived bridge to engine schemars codegen | ✅ Accepted | > | [ADR-086](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-086-builtin-rams-sweep-convert-universal-multi-format.md) | builtin Rams sweep · nika:csv\_to\_json → nika:convert universal multi-format · less but better | ✅ Accepted | > | [ADR-087](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-087-nika-wait-temporal-collapse.md) | nika:sleep + nika:wait\_until → nika:wait · temporal-control Rams collapse | ✅ Accepted | > | [ADR-088](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-088-nika-inspect-introspection-collapse.md) | nika:cost + records + dag\_info + threads → nika:inspect · introspection Rams collapse | ✅ Accepted | > | [ADR-089](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-089-json-diff-jq-subsume-rejected.md) | nika:json\_diff jq-subsume feasibility · REJECTED · keep RFC-6902 Patch as canonical output format | ⛔ Rejected | > | [ADR-090](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-090-structural-doctrine-enforcement.md) | Structural doctrine enforcement — gates project the SSOT | ✅ Accepted | > | [ADR-091](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-091-nika-infer-local-candle-sidecar.md) | Sovereign local inference · nika-infer-local · pure-Rust candle sidecar, OpenAI-compat reuse, no rig / no mistral.rs | ✅ Accepted | > | [ADR-092](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-092-nika-check-program-analysis-ladder.md) | Make nika check a verifier, not a linter — the static-analysis ladder on a unified flow IR | 🕒 Proposed | > | [ADR-093](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-093-infer-local-http-server-tiny-http.md) | nika-infer-local HTTP server · tiny\_http for the v1 sidecar endpoint | ✅ Accepted | > | [ADR-094](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-094-nika-pck-registry-architecture.md) | nika-pck · content-addressed sharing — identity decentralized, discovery a forkable index, trust in the artifact | ✅ Accepted | > | [ADR-095](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-095-exec-security-architecture.md) | exec verb security architecture · layered defense-in-depth (permits = declaration, 3 layers enforce) | ✅ Accepted | > | [ADR-096](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-096-agent-loop-intelligence.md) | The agent-loop intelligence layer — routing, stall guard, compose, telemetry | ✅ Accepted | > | [ADR-097](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-097-parallel-intra-turn-dispatch.md) | Parallel intra-turn tool dispatch — concurrent resolve, request-order fold | ✅ Accepted | > | [ADR-098](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-098-underspecified-schema-json-mode-fallback.md) | Underspecified schemas fall back to native JSON mode + local validation | 🕒 Proposed | > | [ADR-099](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-099-durable-lite-run-resume.md) | Durable-lite run resume — the trace IS the checkpoint | ✅ Accepted | > | [ADR-100](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-100-trace-retention.md) | Trace retention — bounded by default, never silently, never a pending gate | ✅ Accepted | > | [ADR-105](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-105-image-generate-builtin.md) | nika:image\_generate — the Media builtin rides a dedicated image plane | ✅ Accepted | > | [ADR-106](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-106-nika-add-registry-client.md) | nika add — the registry client verb (resolve · verify · install) | 🕒 Proposed | > | [ADR-107](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-107-nika-check-wasm-admission.md) | Admit nika-check-wasm — the static half of nika check, compiled to the browser | ✅ Accepted | > | [ADR-108](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-108-nika-proof-split.md) | Split the spec-15 proof primitives out of nika-runtime into nika-proof (L0) | ✅ Accepted | > | [ADR-109](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-109-composition-proof-receipt.md) | Publish the composition proof receipt — what this engine may claim on spec 14 | ✅ Accepted | > | [ADR-110](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-110-nika-cli-host-member-split.md) | nika-cli size-cap member split: the host plane descends to nika-cli-host | ✅ Accepted | > | [ADR-111](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-111-outbound-pause-delivery.md) | Deliver the pause event outward — operator-configured CloudEvents webhook | ✅ Accepted | > | [ADR-112](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-112-trace-as-dataset.md) | Trace-as-dataset — OTel GenAI semconv now, input-capture before the SFT export | 🕒 Proposed | > | [ADR-113](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-113-envelope-identity-on-nika.md) | The envelope's identity moves onto `nika:` — the version slot dies, losslessly | ✅ Accepted | > | [ADR-114](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-114-nika-cadence-admission.md) | `nika-cadence` — the pure arming domain, at L0 | ✅ Accepted | > | [ADR-115](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-115-nika-check-analyzer-member-split.md) | nika-check size-cap member split: the analysis substrate descends to nika-check-analyzer | ✅ Accepted | > | [ADR-116](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-116-nika-serve-resident-firer.md) | nika serve v0 was a local-only resident firer | ♻️ Superseded by ADR-117 | > | [ADR-117](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-117-nika-serve-network-boundary.md) | admit nika serve network access behind explicit authority | ✅ Accepted | > | [ADR-118](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-118-nika-arm-custody-library.md) | admit nika-arm as the shared ARM custody library | ✅ Accepted | > | [ADR-119](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-119-durable-remote-job-state.md) | make remote job admission durable before transport | ✅ Accepted | > | [ADR-120](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-120-service-execution-driver-split.md) | descend the shared service execution driver out of nika-runtime | ✅ Accepted | > | [ADR-121](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-121-nika-dataflow-member-split.md) | nika-runtime size-cap member split: the run's dataflow descends to nika-dataflow | ✅ Accepted | > | [ADR-122](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-122-execution-access-plan-authority.md) | One access plan is the execution authority: resolved once, executed as resolved | ✅ Accepted | > | [ADR-123](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-123-layered-check-verdicts.md) | check answers four questions: VALID · ACCESS READY · CAPACITY FIT · RUN READY, and run refuses what check refuses | ✅ Accepted | > | [ADR-124](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-124-one-oracle-facade.md) | one typed oracle facade: the CLI verb, the MCP tool and the session read the same audit | ✅ Accepted | > | [ADR-125](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-125-native-session-runtime.md) | the native session is a grounded host runtime over the installed engine, never a workflow | ✅ Accepted | > | [ADR-126](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-126-project-changes-from-the-session.md) | project changes from the session: one typed change set, preview == apply, consent outside the model | ✅ Accepted | > | [ADR-127](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-127-nika-runtime-laws-member-split.md) | nika-runtime size-cap member split: the run's laws descend to nika-runtime-laws | ✅ Accepted | > | [ADR-128](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-128-one-run-settlement.md) | The run's settlement is built once by the runtime and projected by every door | ✅ Accepted | > | [ADR-129](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-129-run-state-is-not-evidence-state.md) | Run state and evidence state are distinct: the writer's lease, the INCOMPLETE exit, the resident's interrupted | ✅ Accepted | > | [ADR-130](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-130-one-vocabulary-one-owner.md) | One vocabulary, one owner: the task-record twin dies, the resident's status projects the settlement, copied spellings are pinned | ✅ Accepted | > | [ADR-131](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-131-the-residents-job-door-is-public.md) | The resident's job door is public: admission by served name, digests as optional integrity assertions, the engine as the one producer | ✅ Accepted | > | [ADR-132](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-132-identity-idempotency-protocol.md) | Identity, idempotency and protocol: what a duplicate human action yields, and the resident's writer stamp | ✅ Accepted | > | [ADR-133](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-133-the-session-machine-is-portable.md) | The session machine is portable: typed outcomes, proposal and gate identities, hosts that judge by identity | ✅ Accepted | > | [ADR-134](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-134-trust-is-a-rung-never-a-word.md) | Trust is a rung, never a word: declared · discovered · observed on every access lane | ✅ Accepted | > | [ADR-135](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-135-the-public-executable-is-born-nika.md) | The public executable is born nika: one bin target with the public name, no packaging rename, no second executable | ✅ Accepted | > | [ADR-136](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-136-serve-inbound-event-binding.md) | A Serve inbound event binding is a schedule with a second credential on one route family, admitted through the same job door | 🕒 Proposed | > | [ADR-137](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-137-nika-onboard-member-split-nika-compile.md) | nika-onboard size-cap member split: the Compile core descends to nika-compile | ✅ Accepted | > | [ADR-138](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-138-nika-compile-member-split-nika-compile-reader.md) | nika-compile size-cap member split: the frozen reader descends to nika-compile-reader | ✅ Accepted | > | [ADR-139](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-139-terminal-renderer-inline-first-one-owner.md) | The terminal renderer: Ratatui, inline-first, one owner of the terminal | 🕒 Proposed | > | [ADR-140](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-140-nika-compile-cognition.md) | nika-compile size-cap member split: the seats' doors ascend to nika-compile-cognition | ✅ Accepted | > | [ADR-141](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-141-nika-compile-reader-member-split-nika-compile-fidelity.md) | nika-compile-reader size-cap member split: the candidate laws ascend to nika-compile-fidelity | ✅ Accepted | > | [ADR-142](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-142-nika-compile-member-split-nika-compile-trigger.md) | nika-compile size-cap member split: the trigger reading ascends to nika-compile-trigger | ✅ Accepted | > | [ADR-143](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-143-nika-tui-view-member-split.md) | nika-tui size-cap member split: the viewers of the object in view descend to nika-tui-view | ✅ Accepted | > | [ADR-144](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-144-nika-session-change-member-split.md) | nika-session size-cap member split: the change set, its review, its outcome and the consent record descend to nika-session-change | ✅ Accepted | > | [ADR-145](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-145-nika-compile-clauses-member-split.md) | nika-compile-clauses size-cap member: how one clause of a request reads ascends from the reader, the verifier and the core's surface | ✅ Accepted | > | [ADR-146](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-146-nika-compile-seats-member-split.md) | nika-compile-cognition size-cap member split: the decision seats and the rehearsal port descend to nika-compile-seats | ✅ Accepted | > | [ADR-147](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-147-nika-compile-seats-composer-and-document-operations.md) | Descend the candidate composer and the document operations to nika-compile-seats | 🕒 Proposed | > | [ADR-148](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-148-nika-session-host-session-over-a-wire.md) | The Session over a wire: nika-session-host keeps the actual runtime behind a native machine door and HTTP routes | 🕒 Proposed | > | [ADR-149](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-149-nika-compile-fidelity-member-split-nika-compile-behavior.md) | nika-compile-fidelity size-cap member split: the behavioural contract and its judge descend to nika-compile-behavior | ✅ Accepted | > | [ADR-150](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-150-nika-session-intelligence-member-split.md) | nika-session size-cap member split: the intelligence, its reasoners, the line router and the authoring door descend to nika-session-intelligence | ✅ Accepted | > | [ADR-152](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-152-nika-compile-seats-authority-descent.md) | nika-compile-cognition size cap: the authority over a seat's requests descends to nika-compile-seats | ✅ Accepted | > | [ADR-153](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-153-nika-session-agent.md) | nika-session-agent: the conversation the Session's selected intelligence leads | ✅ Accepted | > | [ADR-154](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/adr/adr-154-size-walls-25000-crate-2500-file.md) | Size walls: 25,000 production lines per crate and 2,500 lines per file, warnings at 15,000 and 1,500 | ✅ Accepted | ## How ADRs work **1. Propose** Any significant engineering decision starts as a Proposed ADR: a short markdown file in `docs/adr/adr-NNN-.md` with frontmatter: `id`, `title`, `status: Proposed`, `date`, `tags`, `related`. Writer describes the context, options considered, and recommended decision. **2. Review** Proposed ADRs are discussed in PRs. Others get `related:` / `supersedes:` / `requires:` links. Status can flip to Accepted or Rejected. The ADR index (`docs/adr/index.json`) is auto-regenerated. **3. Accept** Once accepted, an ADR changes only in two recorded ways: a later ADR **amends** it (listed in that ADR's `amends:`, with a banner in the amended file), or a new ADR **supersedes** it. `git log` tells you when and why a given rule came in. **4. Supersede** Rare, but when a decision proves wrong, a new Accepted ADR supersedes it. The superseded ADR stays in the tree with `status: superseded` and `superseded_by:`. Three supersessions exist: **ADR-021** (the K8s-style `apiVersion` envelope) by **ADR-082** (a single version marker), **ADR-082** by **ADR-113** (2026-08-13: the envelope's identity moves onto `nika:` itself, the version slot dies), and **ADR-116** (the first local-only `nika serve`) by **ADR-117**. One ADR is rejected outright (**ADR-089**) and kept in the tree as the record of a road not taken. ## Metadata fields Every ADR carries rich metadata in both its frontmatter and `index.json`: | Field | Purpose | | - | - | | `id` | `ADR-NNN` · assigned in ascending order, never reused. Not gap-free: ranges are reserved in blocks, so at v0.123.0 the tree runs `ADR-001`..`ADR-154` with 043-077, 101-104 and 151 unallocated | | `title` | One-line decision summary | | `status` | `Proposed` / `Accepted` / `Rejected` / `Superseded` | | `date` | ISO date of last status change | | `tags` | Free-form (e.g., `architecture`, `runtime`, `forward-compat`) | | `affects_crates` | List of crate names the decision constrains | | `affects_layers` | `L0`..`L5` · which layers feel the effect (L5 is reserved, not built) | | `supersedes` | IDs this ADR replaces | | `superseded_by` | ID that replaces this ADR | | `related` | Sibling ADRs in the same design arc | | `requires` | Prerequisite ADRs (this one makes no sense without them) | | `enables` | Downstream ADRs this one unlocks | | `amends` | Accepted ADRs this one amends in place, in the frontmatter only: `index.json` has no `amends` key (ADR-154 amends ADR-004, ADR-023 and ADR-143) | ## Gate 12 integration > [!TIP] > > Admission Gate 12 fails when a crate's commit changes a public API > surface without either (a) being purely additive under > `#[non_exhaustive]` rules, or (b) referencing an Accepted ADR that > authorizes the break. The ADR trail is how breaking changes earn the > right to exist. ## See also > **[Forward-compat invariants](/architecture/forward-compat-invariants)** > > The patterns that keep most ADRs additive. > **[L0 decisions](/architecture/l0-decisions)** > > The foundation decisions behind ADRs 033, 034 and others. > **[12-gate admission](/architecture/admission)** > > Gate 12 requires ADR alignment for breaking change. > **[ADR directory on GitHub](https://github.com/supernovae-st/nika/tree/main/docs/adr)** > > Browse the full ADR tree, index.json, and README. # Forward-compat invariants Source: https://docs.nika.sh/architecture/forward-compat-invariants The patterns and early decisions that protect the engine's public API against breaking change, and where 0.123.0 departs from them. Nika follows **real semver**. 0.124 is the current release line. Work stays focused on maintenance, security and the media capabilities workflows need; native video is planned for 0.125. These invariants are what keeps a later change, whoever makes it, from breaking the public API: any feature must fit **without breaking changes to the public API**. > [!NOTE] > > **Status: locked at v0.80, with later amendments noted inline.** Every crate > admitted to the workspace must comply before passing gate 12. Patterns > distilled from Rust, Tokio, Deno, Cargo, Serde, Axum/Tower and Bevy. > > **Canonical source:** [`docs/architecture/forward-compat-invariants.md`](https://github.com/supernovae-st/nika/blob/main/docs/architecture/forward-compat-invariants.md). ## The patterns > **FCI-001: Kernel traits upfront, implementations deferred** > > Define the kernel traits for a subsystem before its implementations exist, > so an implementation can plug in without changing the kernel. At v0.123.0, > memory is three small traits, `MemoryRemember`, `MemoryRecall` and > `MemoryForget`, with a blanket `MemoryStore` over them > (`crates/nika-kernel-ai/src/memory.rs`); `nika-store` provides a signed > implementation, still pre-admission. > > **Reserved traits:** `MemoryStore`, `EmbeddingProvider`, `ToolExecutor`, > `WasmPluginHost`, `MetricsExporter`, `TracerProvider`, `AuditSink`, > `BillingSink`, `Sandbox`. Several have no production implementation at > v0.123.0 (see [Events](/concepts/events#kernel-interfaces-for-engine-implementers)). > > **Impact:** a memory, metrics or audit implementation plugs into its > traits without changing the kernel. > **FCI-002: `#[non_exhaustive]` on every public struct, enum, error variant** > > Every public type carries `#[non_exhaustive]` so adding a field or variant > is always additive. `new()` constructors provide ergonomic construction > without exposing struct literal syntax. > > ```rust theme={"system"} > #[non_exhaustive] > pub struct InferRequest { > pub model: String, > pub messages: Vec, > // adding fields here never breaks downstream > } > > impl InferRequest { > pub fn new(model: impl Into, messages: Vec) -> Self { /* ... */ } > } > ``` > > Invariant #19: every `#[non_exhaustive]` struct ships a `new()` constructor. > **FCI-003: One mark per on-disk artifact** > > A workflow opens with **one header line** · `nika: ` (the > language name as key, the workflow's own identifier as value · the > nine-key envelope of 0.109 · supersedes the `nika: v1` + `workflow: { id }` form and the older K8s `apiVersion:` / `schema: > nika/workflow@X` forms). The document type is the `tasks:` key: present > \= a workflow · absent = the project file `nika.yaml`, whose `nika:` key is > the project's name (`nika: my-project`); its schema version is on the > editor's `$schema` line, and `nika: v1` is refused in both documents. > Parsers refuse the previous envelope with a clear error and > `nika check --fix` migrates it. > > ```yaml illustration · the envelope mark theme={"system"} > nika: my-flow > tasks: { ... } > ``` > > A grammar change ships with its migration and a refusal that names the > move (spec 00-overview, the stability contract). Non-workflow artifacts > carry their own marker: the project file's `$schema` line, a trace's > `trace_format`, a package manifest's version. > **FCI-004: Extension namespaces (`nika.*` core + `x-*` community)** > > Public schemas reserve two namespaces: **`nika.*`** for core additions > (authoritative, versioned) and **`x-*`** for community overlays (no > stability guarantee, no collision with core). **Scope note** · in the > workflow language both are RESERVED, not current: unknown top-level > fields are rejected at v0.1, and the tool namespace set is closed at > `nika:` / `mcp:` (engine-specific tools route through `mcp:`). The > live `x-*` surface today is the pck registry. > > ```yaml illustration · RESERVED future extension fields (rejected today) theme={"system"} > nika: my-flow > nika.cache: { ttl: 3600 } # nika.* core extension · a future additive minor > x-my-org-metric: 42 # x-* community overlay · reserved · NOT valid v0.1 > ``` > **FCI-005: Reserved error code ranges** > > Two error surfaces, one rule each. The WORKFLOW-VISIBLE surface is the > spec's `NIKA--` taxonomy (112 registered > codes across 25 namespaces · > [`reference/error-codes`](/reference/error-codes)). Namespaces own > `001-099` ranges, codes are never repurposed. The ENGINE-INTERNAL > registry (`nika_error::codes` · `NIKA-1000+` blocks per L1 effect > crate) is diagnostics machinery: reserved per crate, never > reassigned, and never leaked into workflow-visible errors. > **FCI-006: Sealed traits for core, open traits for extension** > > Core kernel traits (e.g., `Provider`, `EventSink`, `Sandbox`) are > **sealed** via a private supertrait: only Nika-owned crates can > implement them. The design kept extension traits open for community > crates; at v0.123.0 the memory traits (`MemoryRemember`, `MemoryRecall`, > `MemoryForget`) are sealed too, and the provider sub-traits > (`ProviderInfer`, `ProviderStream`, `ProviderMeta`) stay open while their > combination, `Provider`, is sealed. > > ```rust theme={"system"} > mod sealed { pub trait Sealed {} } > pub trait Provider: sealed::Sealed + Send + Sync { /* ... */ } > ``` > > Enforced by ADR-014. > **FCI-007: Feature flags with stable defaults** > > New capability = new `feature` flag, OFF by default. After 1-2 minor > cycles of stability, flips to default-ON. Never remove a default feature > (breaking change): deprecate and redirect. > > ```toml theme={"system"} > [features] > default = ["rustls-tls"] > rustls-tls = ["dep:rustls"] > native-tls = ["dep:native-tls"] # alternative, off by default > ``` > **FCI-008: Public API discipline via CI** > > Three tools on every CI run: > > * **`cargo public-api`**: detects API surface changes per crate. > * **`cargo semver-checks`**: verifies SemVer compatibility. > * **`cargo deny`**: enforces license + advisories + layer bans. > > Gate 12 fails on any unintentional public API drift. A `public-api.txt` > snapshot is checked in for each crate, and the `public-api.yml` and > `semver-checks.yml` CI workflows compare against it. ## The five early decisions (v0.80) | ID | Decision | At v0.123.0 | | - | - | - | | **FCI-009** | `EventKind` = scoped sub-enums, about 22 categories | **Superseded:** `nika_event::EventKind` is one flat `#[non_exhaustive]` enum of 35 kinds | | **FCI-010** | `InferRequest` fields reserved for memory, budget, baggage, trust and tracing | `memory`, `budget` and `baggage` are present fields; a memory implementation still needs no kernel change | | **FCI-011** | `schema:` field mandatory on every on-disk artifact | **Superseded by ADR-113:** a workflow file carries no version (a root `schema:` is refused, `NIKA-PARSE-005`); other artifacts carry their own marker (the project file's `$schema` line, a trace's `trace_format`) | | **FCI-012** | The `Provider` trait shape is frozen behind a sealed supertrait | `Provider` is the sealed combination of `ProviderInfer`, `ProviderStream` and `ProviderMeta` | | **FCI-013** | Telemetry = five sibling sinks (Event, Metrics, Trace, Audit, Billing) | The event journal ships; the other four are kernel interfaces with no production implementation. GenAI attributes ride `nika trace export` spans | ## The rules > [!TIP] > > Every crate admission answers "yes" to each. `cargo public-api` + > `cargo semver-checks` catch violations before merge. 1. All public types carry `#[non_exhaustive]`. 2. All public structs with `#[non_exhaustive]` ship a `new()` constructor. 3. All `async` trait methods use `trait_variant::make` for dynamic dispatch. 4. All core traits seal via private supertrait. 5. All error types expose a `NIKA-XXX` code via `NikaError::code()`. 6. Every on-disk artifact other than a workflow carries its own version marker (a workflow's identity is `nika: `, ADR-113). 7. All DTO fields reserve forward-compat extension slots (see FCI-010). 8. All feature flags default to a stable subset: new caps ship OFF. 9. All public API changes emit a `cargo public-api` diff in the PR. 10. All breaking changes require ADR Accepted before merge. ## See also > **[Layer registry](/architecture/layers)** > > The layers and the mechanical sort test. > **[L0 foundation decisions](/architecture/l0-decisions)** > > The early foundation decisions and what became of them. > **[12-gate admission](/architecture/admission)** > > How a crate earns a seat at the workspace: SPEC through ATOMIC commit. > **[ADR index](/architecture/adrs)** > > Every decision record at v0.123.0. # L0 foundation decisions Source: https://docs.nika.sh/architecture/l0-decisions Q1-Q13: the early architectural decisions that shaped the L0 and L0.5 layers, and what each became at v0.123.0. These are **engine-internal** decisions, not workflow-language rules. Thirteen questions, locked in April 2026 (revision 3), shaped the **L0 foundation** (22 crates at v0.124.1) and the **L0.5 kernel contract**. Some were executed as written, some differently, and some not at all: the index records what each became at v0.124.1, and the deep dives keep the original rationale as history. > [!NOTE] > > **Canonical source:** [`docs/architecture/l0-l05-architecture-decisions.md`](https://github.com/supernovae-st/nika/blob/main/docs/architecture/l0-l05-architecture-decisions.md). > Full rationale (3-4 agents per question) lives in the engine repo. ## Decision index | Q | Decision (April 2026) | At v0.123.0 | | - | - | - | | **Q1** | No proc macros in L0 · manual impl + `macro_rules!` | **Holds.** No crate in the workspace is a proc macro; the L2 `#[builtin_tool]` escape hatch was never built | | **Q2** | No `nika-stdx`; split `nika-error` → `nika-types` + `nika-error` | **Executed** | | **Q3** | Extract `nika-catalog-codegen` | **Executed** (`nika-catalog-codegen`, L0); the community overlay it was meant to serve was not built | | **Q4** | `nika-event`: L0 types + L1 store + L2 export | **Not executed as split.** `nika-event` holds the types; the journal is written by the runtime and exported by `nika trace export`; no `nika-event-store` or `nika-event-export` crate exists | | **Q5** | Admission order: schema → codegen → event → binding → pck-manifest | **Superseded.** No `nika-binding` crate: templates live in `nika-tmpl`, expressions in `nika-cel` | | **Q6** | `EventKind` = scoped sub-enums, about 22 categories | **Superseded.** One flat `#[non_exhaustive]` `EventKind` of 35 kinds | | **Q7** | `nika-kernel` prelude re-export hub | **Executed.** `nika-kernel` is a facade with a `prelude` over `nika-kernel-core`, `-ai`, `-runtime` and `-plugin` | | **Q8** | `nika-transform` as a standalone L0 crate | **Not executed.** No transform crate and no template filters: transformation is jq (`extract:`, `nika:jq`) | | **Q9** | `Timestamp` + `WallDuration` as a module in `nika-types` | **Executed** | | **Q10** | Canonical JSON (RFC 8785) as a module in `nika-types` | **Not executed** | | **Q11** | Token streaming: deltas, not one event per token | **Executed in a different shape.** `InferEvent::Delta { text }`, alongside `ToolUseStart`, `ToolUseDelta`, `Thinking`, `Usage` and `Done` | | **Q12** | Drop `ObservabilitySink`, add `AuditSink` (five sibling channels) | **Interface only.** `AuditSink` exists as a kernel trait with no production implementation | | **Q13** | Bridge OTel GenAI conventions via typed `GenAiAttrs` | **Executed.** `GenAiAttrs` lives in `nika-kernel-ai`; the attributes ride the spans of `nika trace export` | ## Why these decisions exist > [!WARNING] > > L0 is the foundation: a wrong choice there propagates through every crate > above it. These decisions were made before any L1 or L2 admission, to avoid > costly migrations, and each was reviewed independently several times. ## Deep dives The deep dives keep the April 2026 rationale as it was written. Where it names a crate or a filter that does not exist, the index above records what was built instead. > **Q1: No proc macros in L0** > > **Rationale.** Proc macros add compile-time dependency on `syn` + `quote` > > * `proc-macro2` (\~50 MLOC compile graph). L0 crates must compile in > seconds for CI parity testing. Manual `impl Trait for Struct` + > `macro_rules!` covers every pattern we've needed at L0. > > **Escape hatch.** Proc macros allowed at L2+ (e.g., `#[builtin_tool]` > attribute macro in `nika-verb-invoke`). L0 stays procmacro-free forever. > > **Impact.** `nika-types` compile time stays \< 2s; downstream crates > don't pay proc-macro cost transitively. > **Q2: nika-types is the foundation, not nika-stdx** > > **Rationale.** A generic `nika-stdx` crate devolves into a kitchen-sink > (anti-pattern #1 from layer-registry). Instead, foundation types live in > `nika-types` (splitable when cohesion demands), error infra in > `nika-error`, lookup tables in `nika-catalog`. Purpose-named, not > kitchen-sink. > > **Executed.** `nika-types` admitted as L0 foundation (no I/O, no async, > Cow-heavy). `nika-error` re-exports the subset it needs. > **Q3: Extract nika-catalog-codegen as standalone L0** > > **Rationale.** TOML → Rust codegen is testable logic that today lives > in `build.rs`. Extract it so: > > * `build.rs` remains \<50 LOC (delegates). > * Codegen gets its own unit tests + snapshot tests. > * Community overlays (`nika-catalog-cn`) reuse the same codegen. > > Targets admission Round 3 post-nika-schema. > **Q4: nika-event 3-layer split** > > **Rationale.** Event emission (L0 types + scoped sub-enums) is concept > separate from storage (L1 `nika-event-store` writes NDJSON / SQLite) > which is separate from export (L2 `nika-event-export` pushes OTel / > Datadog / Honeycomb). Each layer tested in isolation. > > **Mapping**: L0 `nika-event` (\~2.5k LOC) types + sub-enums · > L1 `nika-event-store` (\~3k LOC, future) · L2 `nika-event-export` (\~2k LOC, future). > **Q5: Admission order for L0** > > **Order.** schema → catalog-codegen → event → binding → pck-manifest. > > **Why this order.** > > * `nika-schema` unblocks the rest (it defines the AST). > * `catalog-codegen` independent (purely build-time). > * `nika-event` needs types (done) and schema (for correlation IDs). > * `nika-binding` needs event + transform. > * `nika-pck-manifest` is standalone and can run in parallel with any of the above. > **Q6: EventKind scoped sub-enums (not mega-enum)** > > **Rationale.** A single `EventKind` enum with 22 variants becomes a > merge-conflict magnet and bloats every consumer's match arm. Instead, > \~22 sub-enums grouped by emission site (`ExecEvent`, `InferEvent`, > `ProviderEvent`, etc.), unified under an `Event` sum type via the > `event_categories!` macro. > > **Impact.** Each verb crate emits its own sub-enum variants; consumers > match on the category they care about; rest are transparent. > **Q7: nika-kernel prelude re-export hub** > > **Rationale.** L2+ verb crates today `use nika_types::*; use nika_error::*; > use nika_kernel::traits::*;` (3 imports every file). Instead, > `nika-kernel` ships `pub mod prelude` that re-exports from `nika-types` > > * `nika-error` + its own traits. Verb crates: `use nika_kernel::prelude::*;`. > > **Cost.** 4 lines of code. Zero new deps (already transitive). > **Q8: nika-transform = standalone L0 crate (REVERTED rev.2)** > > **Original decision.** Inline `nika-transform` into `nika-binding` (single > consumer). > > **Reversion rationale.** Swarm audit found a **second consumer**: > `nika-builtin-*` crates need `nika-transform` filters (json, base64, > shell\_quote) for `invoke:builtin:` parameter processing. Inlining would > force `nika-binding` dependency on every builtin crate (wrong coupling). > > **Final.** `nika-transform` stays L0, 65 transforms in 7 sub-modules, > two consumers (binding + builtin-\*). > **Q9-Q10: Timestamp + canonical-JSON = modules in nika-types** > > **Rationale rev.2.** Both were initially planned as standalone L0 crates > (`nika-time`, `nika-canonical`). Audit found each has zero > non-foundation dependencies and tight coupling to core types. They > become modules inside `nika-types`: > > * `nika_types::timestamp`: `Timestamp` + `WallDuration` (monotonic + RFC3339) > * `nika_types::hash::canonical`: RFC 8785 canonical-JSON for hash stability > > **Impact.** `nika-types` gains \~300 LOC, stays well under 15k crate cap. > **Q11: Token-streaming delta-batching** > > **Rationale.** Emitting 1 `InferEvent::Token` per LLM token would flood > the event bus (2k tokens/s on fast providers). Instead, batch into > deltas: emit `InferEvent::Delta { text, token_count, duration }` every > 50ms or 32 tokens, whichever first. > > **Impact.** Event rate capped at \~20 Hz regardless of provider speed. > **Q12: 5 sibling sinks (not 1 ObservabilitySink)** > > **Rationale rev.3.** The original `ObservabilitySink` god-trait would have > forced every sink implementation to handle 5 concerns at once. Instead, > 5 sibling traits live alongside each other: > > * `EventSink`: structured events (NDJSON, OpenTelemetry) > * `MetricsExporter`: Prometheus / StatsD / OTel metrics > * `TracerProvider`: OTel traces (W3C TraceContext) > * `AuditSink`: compliance audit log (tamper-evident, separate from EventSink) > * `BillingSink`: cost accounting (\$ per provider call) > > **Impact.** Each sink tested independently. Implementations can mix-and-match > (e.g., Honeycomb for trace, Prometheus for metrics, local NDJSON for audit). > **Q13: OTel GenAI semconv via typed GenAiAttrs** > > **Rationale rev.3.** OpenTelemetry defines [GenAI semantic conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/) > for LLM attributes (`gen_ai.system`, `gen_ai.request.model`, etc.). > Rather than stuff strings into a `HashMap`, expose a > typed `GenAiAttrs` struct on `InferRequest` / `InferResponse`. > > **Impact.** Consumers get IDE completion + compile-time safety. > Non-breaking: `GenAiAttrs` is `#[non_exhaustive]`. New attrs are additive. ## See also > **[Layer registry](/architecture/layers)** > > How these L0 crates fit into the layers. > **[Forward-compat invariants](/architecture/forward-compat-invariants)** > > The patterns that make these decisions safe to evolve. > **[12-gate admission](/architecture/admission)** > > How each L0 crate earns its seat. > **[Constellation](/reference/constellation)** > > Which crates are admitted at v0.123.0. # Layer registry Source: https://docs.nika.sh/architecture/layers The engine's crate layers, from pure types to interfaces, with two half-layers for kernel traits and model wires. Upward dependencies fail CI. You run **one `nika` binary**. Internally, at v0.124.1, it is a workspace of 90 crates (75 admitted, pre-admission) organized in layers: **L0, L0.5, L1, L1.5, L2, L3 and L4**. Every workspace-local dependency points downward, and a CI script (`check-layering.sh`) fails the build on any upward import. Workflow authors do not pick a layer: this page is the engine's crate contract. > [!NOTE] > > **Canonical source:** [`docs/architecture/crate-layer-registry.md`](https://github.com/supernovae-st/nika/blob/v0.123.0/docs/architecture/crate-layer-registry.md) > and the `[workspace.metadata.diamond]` table of the engine's `Cargo.toml`. > This page curates the layer model for readers; the engine repository holds > the manifest next to the enforcement script. ## Mechanical sort test Every new crate answers these questions in order. First hit wins. **1. Does it expose a transport or UI surface (CLI, HTTP, MCP, LSP, DAP, terminal)?** → **L4** (interfaces). The `nika` binary itself is built from `nika-cli` here. **2. Does it orchestrate a whole workflow or enforce runtime law?** → **L3** (runtime and execution) **3. Does it implement a verb, or a client a verb calls?** → **L2** (verbs) **4. Is it a provider wire, a builtin tool, extraction or local inference?** → **L1.5** (provider and builtin effects) **5. Is it a primitive with I/O (fs, net, process, sandbox, clock)?** → **L1** (effects) **6. None of the above?** → **L0** (pure, sync, zero I/O). If it is trait-only and async is fine, → **L0.5**. ## The layers ```mermaid theme={"system"} %%{init: {'theme':'dark','themeVariables':{'background':'transparent','mainBkg':'transparent'}}}%% flowchart TB classDef layer0 fill:#1e3a8a,color:#fff,stroke:#3b82f6 classDef layer05 fill:#0e3a5c,color:#fff,stroke:#22d3ee classDef layer1 fill:#065f46,color:#fff,stroke:#10b981 classDef layer2 fill:#92400e,color:#fff,stroke:#f59e0b classDef layer3 fill:#9a3412,color:#fff,stroke:#f97316 classDef layer4 fill:#991b1b,color:#fff,stroke:#ef4444 L4["L4 — interfaces · cli (the binary) · serve · mcp · lsp · dap · session · tui"]:::layer4 L3["L3 — runtime · runtime laws · execution"]:::layer3 L2["L2 — the four verbs · registry client"]:::layer2 L15["L1.5 — provider wires · access · builtins · extraction · local inference"]:::layer1 L1["L1 — effects · fs · http · exec runner · sandboxes · clock · secrets"]:::layer1 L05["L0.5 — kernel traits + mocks (async OK, zero I/O)"]:::layer05 L0["L0 — pure types · parser · checker · CEL · catalog · zero I/O"]:::layer0 L4 --> L3 --> L2 --> L15 --> L1 --> L05 --> L0 ``` Arrows read "depends on". Upward arrows are forbidden: `check-layering.sh` fails on any workspace-local dependency that points up. ## Layer table Crate counts per layer at v0.124.1: L0 22 · L0.5 6 · L1 17 · L1.5 5 · L2 5 · L3 4 · L4 31. | Layer | Role | Allowed I/O | Allowed deps | Example crates at v0.123.0 | | - | - | - | - | - | | **L0** | Pure types, the parser and checker, lookup tables, sync-only APIs | none | (leaf) | `nika-types`, `nika-error`, `nika-event`, `nika-schema`, `nika-check`, `nika-cel`, `nika-tmpl`, `nika-catalog`, `nika-pck-manifest` | | **L0.5** | Kernel trait definitions and their mocks · async OK | none (traits only) | L0 | `nika-kernel` (facade), `nika-kernel-core`, `nika-kernel-ai`, `nika-kernel-runtime`, `nika-kernel-plugin`, `nika-kernel-mock` | | **L1** | Effect implementations | the effect the crate exists for | L0, L0.5 | `nika-fs`, `nika-http`, `nika-exec-runner`, `nika-sandbox-seatbelt`, `nika-sandbox-landlock`, `nika-clock`, `nika-secret` | | **L1.5** | Provider wires, access paths, builtins, extraction, local inference | through L1 | L0, L0.5, L1 | `nika-providers`, `nika-providers-access`, `nika-builtin`, `nika-extract`, `nika-infer-local` | | **L2** | The verbs · orchestrate effects behind kernel traits | through lower layers | L0 … L1.5 | `nika-verb-infer`, `nika-verb-exec`, `nika-verb-invoke`, `nika-verb-agent`, `nika-registry-client` | | **L3** | Runtime and execution · enforce execution contracts | through L2 | L0 … L2 | `nika-runtime`, `nika-runtime-laws`, `nika-execution`, `nika-service-execution` | | **L4** | Interfaces · transport and UI surfaces | through L3 | L0 … L3 | `nika-cli` (builds `nika`), `nika-serve`, `nika-mcp`, `nika-lsp`, `nika-dap`, `nika-trace`, `nika-session`, `nika-tui` | An **L5** composition root is reserved but not built: the public executable is born `nika` in `nika-cli` (ADR-135). The TypeScript SDK is not a crate: it is the npm package `@supernovae-st/nika`, in its own repository. > [!TIP] > > `nika-http` is the **L1 HTTP client** (used by `nika:fetch` and catalog > sync). The HTTP server of `nika serve --bind` lives inside `nika-serve` at > L4: there is no separate server crate. ## Enforcement * **`check-layering.sh`** (`scripts/ci/` and `scripts/hygiene/`, fails on violation) reads layer membership from `[workspace.metadata.diamond.layers]` and verifies every workspace-local dependency is at an equal or lower layer. * **`check-no-async-in-l0.sh`** (`scripts/hygiene/`) refuses `async fn` and `async {` in L0 source trees. * **`check-crate-gates.sh`** (`scripts/ci/`) runs the [admission gates](/architecture/admission) for a crate. > **Capability axes: a vocabulary, not enforced in 0.123.0** > > The engine's design gave each effect crate a list of capability axes > (`reads-env`, `reads-fs`, `rw-fs`, `exec-shell`, `net-egress`, > `net-ingress`, `spawns-thread`, `mutates-global`, `panics-allowed`, > `reads-secrets`, `time-mutation`, `allocator-sensitive`, > `thread-local-state`). No registry file declares them and no CI check > enforces them at v0.123.0. The runtime boundary a workflow meets is its > `permits:` block and the OS sandbox ([Security](/concepts/security)). ## Forward compatibility The layer model leaves room for additive crates without renumbering. In the 0.124 line, work stays focused on maintenance, security and the media capabilities workflows need, and none is planned. ## Anti-patterns > [!WARNING] > > Seven patterns that break the layer contract. If you catch yourself writing > one, stop and ask the mechanical sort test again. 1. **Kitchen-sink crate**: "I'll just add this utility to `nika-error`" leads to a bag of tricks every crate transitively pulls in. One caller = stays in the caller. 2. **Facade mega-crate**: "Re-export everything for convenience" collapses the layer contract and slows every build. 3. **Upward re-exports**: an L1 crate re-exporting an L2 API turns it into an L2 consumer and breaks mechanical sorting. 4. **`async` in L0**: forces a runtime choice on every consumer and makes the crate unusable in build scripts. 5. **`anyhow::Error` in library code**: binaries only. Libraries use the typed error hierarchy. 6. **`Box` in public API**: hygiene vector 19 bans it. Use the typed error hierarchy. 7. **Runtime imports in L0**: `tokio::spawn` in `nika-error` is a layer violation even if it compiles. ## See also * [Forward-compat invariants](/architecture/forward-compat-invariants): the patterns that protect the public API * [L0 foundation decisions](/architecture/l0-decisions): the early decisions and what became of them * [Admission](/architecture/admission): how a crate earns its seat * [Constellation](/reference/constellation): the map of admitted and pre-admission crates # Historical milestones Source: https://docs.nika.sh/changelog/history Original dated accounts of Nika's development, including release attempts that did not produce downloadable binaries. > [!WARNING] > > This is a historical archive, preserved as written. Statements such as “current”, > “ships” and “these docs teach” refer to the date of each entry. Some entries > describe tags whose release builds failed. They are not installation instructions. > Use the [published release index](/changelog/releases), > [current status](/reference/status) and [installation guide](/getting-started/installation) > for what you can use today. The [timeline guide](/reference/timeline) explains the eras and evidence classes. The accounts below predate the automated release inventory and are retained without rewriting their original claims. **v0.109.2** 2026-08-19 · the first published nine-key binary · Linux builders jail before the gates run **The second refusal, one layer down.** `v0.109.1` fixed the fossil envelope in the release gates and died on both Linux builders one leg later: `[consent-run] exit=3 want=4` — since 0.109.0 a workflow that declares `permits:` refuses to start on a host with no sandbox backend (`NIKA-1710`), and a GitHub Linux runner has no bubblewrap. The macOS builders, where seatbelt exists, passed both gates confined. No asset shipped under `v0.109.1` either; the binaries were fine both times. **This patch is the same tree plus the second fix and is the version consumers install.** * **The Linux release builders install bubblewrap before the gates run.** The Diamond CI tests-leg recipe (apt bubblewrap · detach ubuntu-24.04's AppArmor bwrap profile · keep unprivileged userns open) now runs on the two Linux builders, so the funnel e2e and the trust battery run confined there exactly as they do on macOS — never a waiver. A gate that spends an `exec` under `permits:` proves the jail as a side effect; a host that cannot jail says so (`NIKA-1710`) instead of being waved through. These docs teach 0.109.2 (measured 2026-08-19). A file written for 0.108 meets a refusal that names its replacement; `nika check --fix` moves the mechanical parts. **v0.109.1** 2026-08-19 · the first published nine-key binary · the release gates speak the live envelope **The release the release gate refused.** `v0.109.0` was tagged from `f58a17396` and its own pre-upload gates killed all four builders: the funnel e2e and the trust battery still authored their fixtures in the fourteen-key envelope (`nika: v1` + `workflow:`) the nine-key engine refuses at parse. No asset was published under that tag; the binaries were fine and the gate was the fossil, exactly as v0.106.0 died on 2026-07-27 when the battery spent an exec without a `permits:` block. `v0.109.0` stays a tag with no release; **this patch ships the same tree plus the gate fix and is the version consumers install.** The language change itself is the v0.109.0 entry below. * **The release gates speak the live envelope (funnel e2e · trust battery).** Four fixtures move from `nika: v1` + `workflow:` to `nika: `. Nothing else in the gates changes: the consent-dirty leg still expects `NIKA-SEC-014` at `guard` and `check`, the consent-pause leg still expects exit 4 with the resume line, the trust battery still runs its exec under `permits.exec`. * **Hygiene vector 50 · `check-release-gate-envelope`.** The two gates run only at tag time, so a language change on main could leave them teaching the previous envelope for weeks with nothing red on any push. The vector greps both scripts for the dead envelope forms on every push and is RED on any hit — proven by mutation (one restored fixture → red). These docs teach 0.109 (measured 2026-08-19). A file written for 0.108 meets a refusal that names its replacement; `nika check --fix` moves the mechanical parts, the table below names the hand moves. **v0.109.0** 2026-08-18 · the nine-key release — tagged, no binary shipped (install 0.109.1) **The nine-key release.** The envelope shrinks from fourteen keys to nine and a workflow written for 0.108.0 will not check on 0.109 · this is the flag-day the 0.106.0 front page announced as possible, and it lands whole. The identity moves onto `nika:` itself (`nika: ` · a kebab-case name · the `workflow:` block, its `id:` and its `description:` are gone), the value authorities are exactly three (`inputs` · `const` · `secrets` · `config:` died with the block), `types:` · `policy:` · `assert:` leave the envelope, and the task body loses its second grammars: cleanup is a real task on an `unwind` edge (`on_finally:` is dead · `graph_format: 3` carries the `finally` node), `output:` is spelled `extract:`, `declassify:` and `inert:` merge into one door (`lift:`), `fail_workflow` is gone (`on_error` is `recover` or `skip`), the two fan-out knobs live INSIDE `for_each:`, and `group:` arrives (fan-in · `NIKA-DAG-008`). Two P0 close at the surface users install: an expression sees only its INPUT (the ambient `env` leaves the jaq function set at the three seams, with a pinned inventory of natives that reddens if a future jaq adds one), and a third-party receipt can no longer write the operator's clipboard (every field rides `escape_tty`). The refusal a 0.108.0 file meets first now TEACHES where each retired key's role went, instead of `unknown field`. **Tagged 2026-08-18 · no binary shipped under this number.** The tag's own release gate refused the upload (its fixtures still spoke the fourteen-key envelope), so nothing was published as 0.109.0. The first published nine-key binary is **0.109.1**, the same tree plus the gate fix — that is the version to install. **① The envelope · fourteen keys become nine** (ADR-113). The live envelope is `nika` · `model` · `inputs` · `const` · `secrets` · `permits` · `run` · `tasks` · `outputs`. Every other top-level key refuses, and the refusal names the destination: | Dead form | Write instead | The teaching | | - | - | - | | `nika: v1` + `workflow: { id, description }` | `nika: ` (kebab-case) · the description as a `#` comment above it | the identity IS the envelope key · prose is demoted, never dropped | | top-level `description:` | a `#` comment above `nika:` | shipped twice (bare · inside `workflow:`) · both dead | | `config:` | an `inputs:` entry with `required: false` and a `default:` | a deployment-supplied value is an input with a default · authorities are exactly three | | `types:` (`NIKA-TYPE-002` retired) | the verb's `schema:` (structured output) · a task's `returns:` | a shape rides its consumer · the ten primitives stay lowercase (spec 09) | | `policy:` | `permits:` (`fs` · `net` · `exec` · `tools`) · `secrets:` · the unconditional laws (spec 10 · `NIKA-SEC-015` net-before-exec) | a vocabulary is not a policy · what survived is the boundary | | `assert:` | nothing in the file · `nika trace verify` (spec 15) | obligations are proven on the sealed trace | **② The task body · one grammar per thing.** | Dead form | Write instead | | - | - | | `on_finally:` mini-tasks | a task of its own · `after: { : unwind }` (a `finally` node · `graph_format: 3`) · every graph judge governs it because it walks the task map | | `output:` | `extract:` (same shape) | | `declassify:` list · `inert:` string | `lift:` (the law is a parameter of one door · spec 10 §the authored doors) | | `on_error: { fail_workflow: true }` | nothing · the default IS the failure · `on_error` is `recover` or `skip` | | task-level `max_parallel:` · `fail_fast:` | inside the block · `for_each: { items: …, max_parallel: N, fail_fast: false }` | | `depends_on:` | `with:` bindings (the binding IS the edge) · `after: { x: success }` for control (`NIKA-PARSE-024` · unchanged since W2) | | `graph_format: 2` pins (`*.graph.json` goldens) | regenerate · `nika inspect --format json` · never edit a projection by hand | **③ What `nika check --fix` migrates · and what it does not.** The rungs are idempotent and equivalence-or-stop · **r1-identity** (new · `nika: v1` + `workflow: {id, description}` · the block, the pre-W1 scalar `workflow: `, the one-line flow form, a bare top-level `description:` · become `nika: ` with the prose demoted to a `#` comment ABOVE it, never dropped · it STOPS, never guesses, when `nika:` already names something else, when the block carries a foreign key, when the id is not kebab-case, or when there is no id at all) · **w1-map** (a `tasks:` sequence becomes the map · atomic or nothing) · **w2-flow** (`depends_on` + body `tasks.*` reads become `with:` bindings and `after:` predicates) · **d1-split** (the pre-0.103 string `command:`) · **esplit** (`vars:` → `inputs:` / `const:` · classify-not-rename) · **predicates** (`succeeded` → `success`). One `--fix` runs them all in one loop, so a 0.108.0 file whose only sins are the identity and the tasks list heals to green in one command. Every round is a transaction: a repair whose text no longer parses is rolled back and reported, and the file is written once, from committed text only. **Still hand migrations in this release** · the `on_finally:` restructuring (cleanup becomes its own task on an unwind edge), `output:` → `extract:`, `declassify:`/`inert:` → `lift:`, `config:` → `inputs:` (a classification), and the `for_each` re-nesting · the refusal teaches each destination at the point of refusal and `--fix` leaves the file untouched rather than write a document its own checker would reject. Measured on the pack that ships inside this binary: 0.108.0 passes 0/40 of these examples · 0.109 passes 40/40 · every existing file outside this repo sits on the 0.108.0 side of that line until it is migrated. **④ Two P0, closed where users install.** An expression sees only its input (#959): a `nika:jq` expression could read the ambient environment (`env.PATH`) under an ABSENT permits block while `check` printed « the body is pure compute so nothing escapes »; the retained natives leave the jaq function set at the three seams from ONE list, and a pinned inventory of jaq natives reddens if a future jaq adds one. A third-party receipt wrote the operator's clipboard (#958): three fields of a proof receipt reached the terminal without `escape_tty` while the helper existed in the same file · a foreign evidence pack could emit OSC52; every receipt field rides the escape, proven by mutation before publication. **⑤ The two trains.** `stable` is the newest tag · what brew · the Registry · nika-action and the starters install. `next` is `main`, at `.0-dev` between tags · a real semver prerelease · `nika --version` and every trace say which one they are. Stable consumers move only when a tag they can install exists. **v0.108.0** 2026-08-05 · the access layer arrives · the check stops trusting what it cannot read **The access layer arrives; the check stops trusting what it cannot read.** Three steps of the access ratification land: `access` picks the path, `model:` picks the intelligence — a deterministic resolver with a strict sovereign order (`local < mock < harness < oauth < api`), an `--access ` pin on `run` and `try` judged at the launch gates (unsatisfied refuses with `NIKA-1800/1801/1802`, never substitutes), and the ACP harness class (`nika-acp` · ACP 2.0.0 = wire v1) with its mock agent in a quarantined workspace and the kernel's `AgentBackend` seam. The zero-authority scan now refuses every `exec` spelling, the shell form included. Fixed alongside: the doubled catalog-miss advisory, the taught surfaces that misdirected, two more sandbox tightenings, a resumed run that keeps its seat, and every pack skeleton passing its own golden lane. Proven red-first, like everything on this train. **v0.107.0** 2026-08-01 · the trust release — three doors, one honest machine An outside audit measured the **experience** instead of the feature list — five waves, seventy-two receipts, twenty-two P0s — and the arc closed every one. Consent means consent: a non-affirmative answer fires **zero effects** (`NIKA-SEC-014`, minted spec-first with its conformance fixtures). The hooks' judge moved into the binary (`nika guard`, fail-visible). Autonomy is graded before it is colored — the risk rung never renders green past Supervised. The data journey names sources, destinations and secrets **before** the run, and redaction works by provenance: a one-byte secret dies the same death as a long one. **The teaching grammar collapses to three doors.** `nika try [slug]` is the showroom — offline by default (the mock rehearsal · zero keys · zero flags), nothing written, nothing owned; bare `nika try` lists what there is to see. `nika new` takes ONE positional gesture: plain words route across the whole catalog, an example slug lands verbatim WITH its ingredients, a skeleton name instantiates (`nika new '?'` lists the set). `nika init` founds. The old doors die loudly: | Dead door | The 0.107 door | | - | - | | `nika examples` (the verb tree) | `nika try` to see · `nika new ` to take | | `nika new --from