Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Crate map

The workspace has 22 member crates plus the deliberately excluded fuzz/ crate (root Cargo.toml: exclude = ["fuzz"]). Arrows below mean “depends on” (normal [dependencies] only — dev-dependencies are covered separately).

Two legibility omissions, disclosed: nibli-types edges are not drawn — most crates depend on it directly, and every crate except nibli-lexicon and lexigen at least transitively (nibli-store, nibli, nibli-auth-py, auth-axum, and fuzz reach it only through their deps) — and surfaces that wrap nibli-session also depend directly on the stage crates (nibli-kr / nibli-semantics / nibli-reason) for types and helpers — those direct edges are omitted where the session edge already implies the chain. Each crate’s Cargo.toml is the full truth.

flowchart TD
  subgraph foundations ["Foundations (dep-free)"]
    types["nibli-types<br/><i>canonical shared types</i>"]
    lexicon["nibli-lexicon<br/><i>committed English corpus</i>"]
  end

  subgraph chain ["Compile-and-reason chain"]
    kr["nibli-kr<br/><i>KR front-end (pest)</i>"]
    semantics["nibli-semantics<br/><i>AST → FOL LogicBuffer</i>"]
    reason["nibli-reason<br/><i>backward-chaining engine</i>"]
    session["nibli-session<br/><i>CoreSession — the ONE chain</i>"]
  end

  subgraph services ["Shared services"]
    protocol["nibli-protocol<br/><i>proof-trace wire format</i>"]
    render["nibli-render<br/><i>English rendering</i>"]
    store["nibli-store<br/><i>redb persistence</i>"]
  end

  subgraph runtimes ["Runtime surfaces"]
    engine["nibli-engine<br/><i>native embedding</i>"]
    pipeline["nibli-pipeline<br/><i>the WASM component</i>"]
    host["nibli-host<br/><i>Wasmtime host + REPL</i>"]
    wasm["nibli-wasm<br/><i>wasm-bindgen wrapper</i>"]
    ui["nibli-ui<br/><i>Dioxus playground</i>"]
  end

  subgraph tooling ["Tools, bins, extensions"]
    nibli["nibli<br/><i>6 dev bins incl. nibli-pin</i>"]
    import["nibli-import<br/><i>RDF/OWL import</i>"]
    formalize["nibli-formalize<br/><i>LLM English→KR gates</i>"]
    auth["nibli-auth<br/><i>logical authorization</i>"]
    authpy["nibli-auth-py<br/><i>PyO3 bindings</i>"]
    authaxum["auth-axum<br/><i>demo</i>"]
    verify["nibli-verify<br/><i>differential gates</i>"]
    lexigen["lexigen<br/><i>corpus refresh (report-only)</i>"]
    fuzz["nibli-fuzz<br/><i>3 libFuzzer targets</i>"]
  end

  kr --> lexicon
  semantics --> lexicon
  reason --> lexicon
  render --> protocol
  render --> lexicon
  session --> kr
  session --> semantics
  session --> reason
  store --> reason
  engine --> session
  engine --> store
  engine --> render
  engine --> protocol
  pipeline --> session
  pipeline --> auth
  host -. "loads nibli.wasm at runtime" .-> pipeline
  host --> kr
  host --> protocol
  host --> render
  host --> store
  wasm --> session
  wasm --> render
  wasm --> lexicon
  wasm --> protocol
  ui --> session
  ui --> formalize
  ui --> render
  ui --> lexicon
  ui --> protocol
  formalize --> kr
  formalize --> semantics
  formalize --> render
  formalize --> lexicon
  import --> engine
  nibli --> engine
  nibli --> import
  nibli --> render
  nibli --> kr
  auth --> session
  auth --> protocol
  authpy --> auth
  authaxum --> auth
  verify --> engine
  verify --> session
  verify --> lexicon
  lexigen --> lexicon
  fuzz --> engine
  fuzz --> kr
  fuzz --> semantics

The dashed edge is the one non-Cargo relationship in the graph: nibli-host does not link nibli-pipeline as a crate — it loads the built nibli.wasm component at runtime via Wasmtime (NIBLI_WASM_PATH).

Crate roster

Roles are taken from each crate’s own top-of-file doc comment. Tier is the crates.io publishing decision of record (RELEASING.md): Tier A is published to crates.io, in dependency order — see the API index for the live docs.rs links; Tier Z ships via GitHub Release / site / repo only.

CrateKindRoleTier
nibli-typeslibCanonical type definitions for the pipeline — one copy shared by every crate (LogicBuffer, AstBuffer, NibliError, shared arithmetic)A
nibli-lexiconlibThe committed English corpus: the dictionary is Rust source, const-validated, zero dependenciesA
nibli-protocollibProof-trace wire format (native serializes, browser deserializes); off-by-default compute-client feature holds the TCP client so wasm32 never pulls std::netA
nibli-krlibThe nibli KR surface-syntax front-end; the pest grammar file is the executable, normative grammarA
nibli-semanticslibFlat AST buffer → FOL LogicBuffer (an internal pipeline stage, not a standalone component)A
nibli-reasonlibThe inference engine: demand-driven backward chaining over an indexed fact store, proof tracesA
nibli-renderlibThe one place engine output becomes English; rendering is pure — never mutates a verdictA
nibli-sessionlibCoreSession: the single compile/assert/query chain every surface wraps — native↔WASM agreement by constructionA
nibli-storelib (+ a v2-fixture seed bin)Persistent redb store: ACID, postcard-serialized, tombstone retractionA (parenthesized)
nibli-enginelibNative in-process embedding — no WASM, full stack traces; the anchor of the publish orderA
nibli-formalizelibThe agentic English→KR formalizer engine (LLM behind real compile gates); UI shell lives in nibli-uiA (optional)
nibli-importlibRDF Turtle / OWL import + fact export (the nibli-import binary lives in the nibli crate)A (optional)
niblibin ×6Dev tooling: native REPL, nibli-validate, nibli-import CLI, nibli-pin, two bench binsA (optional)
nibli-pipelinecdylib+libThe WASM component: chains kr → semantics → reason as internal crate deps; the only crate with WIT bindingsZ
nibli-hostbinNative Wasmtime WASI P2 host + REPL; provides the compute-backend importZ
nibli-uibinThe Dioxus Transparency Triad playground; engine compiled into the bundle, reasons fully in-browserZ
nibli-wasmcdylib+rlibwasm-bindgen wrapper powering the live demo; mirrors nibli-engine’s no-store pathZ
nibli-verifylib+binThe differential soundness gates (Vampire / clingo oracles, seam gate, corpus differentials)Z
nibli-authlibBuilt-in authorization over a warm session core; publish = false today
nibli-auth-pycdylibPyO3 extension nibli_auth_native (maturin); publish = false
examples/auth-axumbinMinimal axum demo for nibli-auth; publish = false
tools/lexigenlib+binCorpus refresh tool (just regen-lexicon) — report-only, never rewrites entries, never a build-depZ
fuzz/ (nibli-fuzz)3 fuzz binslibFuzzer targets fuzz_assert / fuzz_query / fuzz_nibli_kr; excluded from the workspaceZ

Dev-dependency discipline

Several crates use the front-end as dev-dependencies only, keeping the release graph a strict DAG while letting tests build buffers the shipped way:

  • nibli-kr dev-depends on nibli-semantics (golden tests: every emitted buffer must be accepted by the semantic compiler).
  • nibli-reason dev-depends on nibli-kr + nibli-semantics (tests build event-decomposed LogicBuffers through the real front-end; the release build never links them).
  • nibli-render dev-depends on nibli-kr + nibli-semantics for the same reason.

Where the boundaries are

  • The one WASM boundary is host ↔ nibli-pipeline. Everything inside the component (nibli-krnibli-semanticsnibli-reason) is plain Rust function calls — see Pipeline & IR.
  • Foundations are dependency-free by design: nibli-lexicon has zero dependencies; nibli-types only an optional serde.
  • nibli-lexicon is the single arity sourcenibli-semantics delegates to it instead of keeping a parallel arity map, and lexigen pins against the compiled corpus rather than parsing source.