Skip to content

supernovae-st/nika

Nika 💎

Inference as Code — a single Rust binary that reads a YAML file and runs AI workflows. No Python, no Docker, no vendor lock-in.

License Rust edition Version Branch Tests Clippy

# workflow.nika.yaml
schema: "nika/workflow@0.12"
tasks:
  - id: fetch
    fetch: { url: "https://example.com/article", extract: article }
  - id: summarize
    with: { text: $fetch }
    infer: "Summarize in 3 bullets: {{with.text}}"

Contents

What is Nika

Nika is a workflow engine for AI: five verbs (infer, exec, fetch, invoke, agent) wired through a typed YAML schema, a taint-tracking template engine, and a layered kernel of side effects. Workflows are human-authored, machine-executable, and reproducible across providers.

The engine ships as a single static binary. Drop .nika.yaml files into a project, run nika run, get deterministic output.

The Diamond rewrite

main is an orphan branch (production · renamed 2026-05-06 from nika-diamond) — no shared history with brouillon (renamed 2026-05-06 from main legacy). The brouillon branch (138,724 LOC engine monolith, v0.79.3) stays intact as a read-only reference while Nika is rebuilt as 40-42 clean crates, each ≤15,000 LOC, every file ≤1,500 LOC, every function ≤100 lines, and every crate gated through a 12-point admission checklist before joining the workspace.

Why rewrite? Every crate must fit in an AI assistant's context window with its tests and kernel traits visible. 15k LOC per crate ≈ 7% of a 1M-token context — enough headroom that automated refactors stop hallucinating. The full argument lives in docs/architecture/ai-velocity.md.

Grounding decisions:

Origin story: docs/MANIFESTO.md.

Current state

Diamond is v0.80.x. The canonical status block is regenerated by bash scripts/refresh-status.sh and parity-checked in CI.

Field Value
Branch main (production · renamed 2026-05-06 from nika-diamond)
Workspace version v0.80.0
Crates admitted 7 / 40-42 (run bash scripts/refresh-status.sh for live count)
Crates WIP 1 (nika-schema)
Layer distribution L0: 5 · L0.5: 2 · L4: 1
Lib tests 1031 passing, 0 failed (grows per crate admission)
Clippy warnings 0
.unwrap() in src/ 0 (CI-enforced)
Providers 32 (TOML-driven catalog)
Capability rules 49
Hygiene vectors 31 deployed (28 green / 3 yellow / 0 red)
ADRs 35 (30 Accepted + 5 Proposed)

Admitted crates:

  • nika-types — L0, 23 foundational value types (cost, trust, budget, baggage…).
  • nika-error — L0, NIKA-XXX error codes + NikaErrorCode trait + miette diagnostics.
  • nika-catalog — L0, compile-time phf tables: 32 LLM providers, 105 MCP servers, 63 builtins, 65 transforms, 13 embeddings, 49 capability rules.
  • nika-kernel — L0.5, sealed trait contracts for every side effect.
  • nika-kernel-mock — L0.5, deterministic mocks for every kernel trait.
  • nika-catalog-verify — L4 binary, nightly registry drift probe.

WIP: nika-schema — workflow AST + parser (Phase D, scaffolded).

10-year horizon

For the canonical 10-year architectural horizon (2026 → 2036) with 42-crate target · 5-verb stress test · per-crate detail · best-enemies SOTA differentiation · 11/10 amplifiers · anti-Palantir guardian framing · see docs/architecture/BLUEPRINT_2036.md (v1.3 · proposal-grade · annual decennial review 2027-04+).

Architecture

L5   nika                         binary, <500 LOC composition root
L4   cli · lsp · serve · init · lints · pck · catalog-verify
L3   runtime · daemon
L2   verb-{exec,fetch,invoke,infer,agent} ·
     provider-{rig,native,mock} ·
     builtin · builtin-{github,cloud,workspace} · mcp · display ·
     media-{cas,image,pdf,document,provenance} ·
     pck-{manifest,registry,store}
L1   shield · event · clock · fs · http · blob · process ·
     extract · security · git · vault
L0.5 kernel · kernel-mock
L0   types · error · catalog · catalog-verify · schema · binding · pck-manifest

Strict downward-only dependencies. Axes (fs / net / process / time…) are declared per-crate in [workspace.metadata.diamond.axes] and enforced by hygiene vectors. Full layer map: docs/architecture/crate-layer-registry.md.

Admission: 12 gates per crate

A crate enters Cargo.toml members = [...] only when all 12 gates are green in the same commit:

  1. Specdocs/crate-specs/<name>.md exists
  2. TDD — tests written before implementation
  3. Impl — compiles, tests pass, no temporary code
  4. Clippy 0cargo clippy --workspace --all-targets -- -D warnings
  5. Mutation ≥ 90%cargo mutants -p <name>
  6. Propertyproptest on sensitive surfaces (parsers, encoding)
  7. Benchmarksbenches/ on hot paths (exempt otherwise)
  8. Docscargo doc --no-deps zero warnings
  9. Canary E2Etests/canary-<name>.nika.yaml passes (exempt L0)
  10. Legacy parity — golden test vs git show brouillon:... output
  11. Review swarm — three agents in parallel; P0/P1 fixed same session
  12. Atomic commit — one admission, one commit

See ADR-003 for the full spec.

Hygiene: 31 CI vectors

scripts/hygiene/check-all.sh + scripts/ci/ + .github/workflows/ enforce Diamond invariants on every push. Selected vectors:

Check Rule
check-loc-limits.sh file ≤ 1,500 LOC
check-crate-size.sh crate ≤ 15,000 LOC
check-fn-length.sh fn ≤ 100 lines
check-unwrap.sh 0 .unwrap() in src/
check-expect.sh 0 .expect( in src/
check-dead-code.sh 0 #[allow(dead_code)]
check-layer-deps.sh per-layer banned deps (L0 rejects tokio, reqwest, rayon…)
check-cancel-safety.sh every async fn annotated with // CANCEL SAFETY:
check-owned-strings.sh catalog public API stays &'static str
check-unsafe-count.sh unsafe token counter vs frozen baseline (currently 0)
check-status-claims-sync.sh README/ROADMAP status blocks match refresh-status.sh
forward-compat.yml cargo-public-api + cargo-semver-checks on every PR
hygiene-nightly.yml nightly drift issue on RED

P0/P1 vectors run pre-commit; P2/P3 run pre-push.

Getting started

Nika is pre-launch. The public nika binary ships at v0.90 once all 40-42 crates are admitted and the seven pre-launch shadow zones are green. In the meantime, the Diamond workspace is developed in the open.

To work on the engine locally:

git clone https://github.com/supernovae-st/nika.git
cd nika
git checkout main      # production Diamond branch (renamed 2026-05-06)

cargo test --workspace --lib          # 1031+ lib tests (grows per crate admission)
cargo clippy --all-targets -- -D warnings
cargo fmt --check
bash scripts/hygiene/check-all.sh      # 31 drift vectors

End-user installation paths (Homebrew tap, cargo install nika, curl | sh installer) will be documented at docs.nika.sh/getting-started/installation when v0.90 tags.

Documentation

Why the choices we made

Why Rust

Single static binary, no runtime install. No garbage collector — ownership gives workflow determinism. Strong type system catches integration errors at compile time. Mature async ecosystem (tokio, rig, rmcp). Cross-platform via cargo-dist with signed releases.

Why AGPL-3.0-or-later

AGPL closes the SaaS loophole that MIT leaves open. If you modify Nika and run it as a hosted service, users of that service get the source. A commercial license is available for organizations that cannot accept AGPL's network clause (Grafana model). Contact: contact@supernovae.studio.

Why forever v0.x

We do not ship half-features behind "coming in v2". Every release is diamond-grade for its declared scope. SQLite stayed on 3.x for 20 years while adding WAL, FTS, JSON1, window functions — each release complete at that release. That is the model. See ADR-002.

Roadmap

See ROADMAP.md for the full forever-v0.x plan across v0.81 (forward-compat seams) → v0.90 (Diamond foundation, 40-42 crates) → v0.95 (Cortex + agent-v2) → v0.100 (WASM plugins + observability + LSP) → v0.110+ (ecosystem, hosted runner, enterprise).

Post-diamond highlights:

  • nika-memory / Cortex (v0.95) — persistent agent memory via Oxigraph + FSRS-6 + OWL 2 (9-10 satellite crates).
  • Agent v2 (v0.95) — parallel tool calls, ReWOO planning, reflection, resume, context compression, four guardrail types.
  • WASM plugins (v0.100) — wasmtime + extism sandbox for third-party builtins.
  • Observability (v0.100) — OpenTelemetry, trace replay, metrics.
  • nika-pck full (v0.95) — sigstore keyless signing, PubGrub resolver, nine first-class content types.

Nika Cloud and Nika Enterprise are deferred to v0.110+ on demand. Self-hosting remains the primary target.

Contributing

External contributions are welcome once the first post-diamond release (v0.90) ships. Until then, Nika is being crafted in public and every crate passes a 12-gate admission swarm. If you want to follow along, watch the main branch (Diamond production · renamed 2026-05-06) and docs.nika.sh/changelog.

Security reports: security@supernovae.studio.

License

AGPL-3.0-or-later — see LICENSE.

Commercial licensing (Grafana model) available for enterprise consumers. Contact: contact@supernovae.studio.

© 2024-2026 SuperNovae Studio

🦋 Nika — the butterfly on the SuperNovae flag.

About

Inference as Code | 5 YAML verbs to orchestrate any AI, Rust engine, 9 providers, Single binary, AGPL-3.0, 🦋

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors