Architecture — Interactive Explorer¶
Eight views of the same system, no contradictions allowed. Each tab embeds the deterministic render of a canonical Mermaid source; the source files are the single source of truth (this page never restates them inline), and every panel links to its source and to the docs that explain the subsystem.
The tabs are plain radio buttons: use Tab to reach the tab row and ←/→ to switch views — no JavaScript required. Every panel also carries a text summary, so the content reads correctly with images off, with JavaScript off, and in dark mode (diagrams render on a light card by design; the palette is documented in the design system).
System architecture
Six layers: users and agents → four interfaces → application-services core → the eight-stage durable pipeline engine → infrastructure → three deployment profiles. Every interface drives the same core.
- Interfaces:
knovarynCLI, MCP server,knovaryn serverREST + web console, Python SDK. - Pipeline stages are checkpointed — validate is the fail-closed gate.
- Infrastructure: SQLite/PostgreSQL metadata, content-addressed artifacts, model gateway.
Pipeline flow
Two rows: prepare (intake → parse → split & chunk → plan) and produce (generate → validate → review → version & export). Validation failures quarantine with reason codes and are never exported.
- Intake preflights hash, size, license, and privacy class on untrusted documents.
- Chunks carry
source_span_idsand recorded location precision. - Exporters re-resolve every citation; publish is dry-run by default.
Durable jobs
Three lanes: normal execution (atomic claim, checkpoint, heartbeat), crash and recovery (lease expiry → re-lease → resume from checkpoint), and cancellation or budget stop (polled between stages, never mid-write, with a cost audit).
- Atomic claim via
SKIP LOCKED— one winner among N workers. - Resume continues from the last checkpoint artifact; paid work is not repeated.
- Budget caps pause the job before the limit is crossed.
Provenance chain
Every exported example chains back to source bytes: candidate → chunk → source span (page, section path, offsets, bounding box, quoted text with its own SHA-256) → parsed document → source document (file hash, license, privacy class). A provenance minimum is enforced.
knovaryn_lineage walks this chain for any example.- Spans quote their text and hash it — grounding is checkable, not asserted.
- Parser configuration is hashed, so re-parses are comparable.
- License and privacy classification happen at intake, before parsing.
MCP session
Four phases — setup, estimate & generate, inspect & review,
version & release — using the real tool names. The estimate step loops
against the budget before start_pipeline;
knovaryn_doctor is usable at any time.
- Dry-run cost estimate precedes every real generation run.
- Review uses immutable revisions with evidence.
- Publish is dry-run first, then confirmed.
Security boundaries
Regions colored by trust: untrusted input boundary, local trust default, opt-in remote access, secrets handling, artifact integrity, publication authorization, and the release attestation chain.
- URL ingest is off by default; archives are verified before extraction.
- Scopes are least-privilege per principal; tenants see only their projects.
- Secrets come from the environment and are redacted at the display boundary.
Deployment topology
One running system — access layer, core, worker pool, state — plus the external model providers (worker outbound calls only) and the scale decision: local, compose, or Kubernetes. Configuration, not a fork.
- Compose ships api, workers, PostgreSQL, MinIO, and a proxy.
- Kubernetes base includes a migration Job, NetworkPolicies, and PDBs.
- Providers are reached only by worker outbound calls.
Release supply chain
Tag push → four gates on the exact release SHA → build → artifacts
(detached checksums, CycloneDX SBOM, notes, prerelease enforcement) →
OIDC publish to PyPI → clean-environment verification → your own
knovaryn verify-release.
- Deployment E2E runs the published tag through the compose stack.
- Publishing uses OIDC trusted publishing — no long-lived tokens.
- 0.x tags are enforced as pre-releases.
Where these renders come from¶
python scripts/render_diagrams.py # sources in docs/assets/diagrams/ → PNG
The gallery page lists all renders with commentary; the diagram sources are plain Mermaid text you can diff and reuse.