Karyo
Documentation/ Architecture

Decision records

Karyo 2.1.1rendered at build time
On this page

The architecture decisions Karyo embodies today. Each record states a decision the code implements now, why it was taken, what it costs, and what was considered instead. Where the reason for something is not recorded anywhere, the record says so rather than guessing. Every record cites the files that embody it, so a reader can check it against the code instead of trusting it.

The records

Record Decision Area
0001 Karyo is one deployable modular monolith Structure
0002 The backend is Kotlin on Quarkus Structure
0003 The build is Gradle with the Kotlin DSL, a version catalog and convention plugins Structure
0004 One PostgreSQL database and one karyo schema serve every module Persistence
0005 Flyway migrates the schema at boot, in per-module version bands, out of order Persistence
0006 -api modules hold contracts, -core modules hold implementations, and no core depends on another Structure
0007 Modules refer to each other's rows by id, never by foreign key Persistence
0008 Synchronous REST at the edge, synchronous CDI events inside, each observer in a chosen transaction phase Integration
0009 State changes leave the process through a transactional outbox Integration
0010 Stock is stored as current state with an immutable journal, not event-sourced Persistence (authentication audience superseded by ADR 0049)
0011 Reporting reads the operational database directly Persistence
0012 An in-process Caffeine cache holds reference data only; stock is never cached Persistence
0013 Keycloak is the mandatory OpenID Connect provider Identity (superseded by ADR 0037)
0014 One Company per installation; positive clients are Phase 1 Business Units Identity (superseded in part by ADR 0051)
0015 principal_kind preserves Phase 1 scope independently of roles Identity (superseded in part by ADR 0051)
0016 Two front ends, served from the API's own origin: the console at /, the floor PWA at /m/ Front end (superseded in part by ADR 0031)
0017 The external API is versioned REST under /api/v1, with an RFC 7807 error body Integration
0018 Tunable behaviour is strategy-driven, through a family of patterns rather than one rule Configuration
0019 Extensions are compiled into the build; nothing is uploaded into a running image Extension
0020 The free and commercial boundary is drawn per Gradle module Commercial boundary (superseded)
0021 Entitlement is an Ed25519-signed token, resolved once at startup Commercial boundary (superseded)
0022 Compose with four containers is the supported deployment Delivery (superseded in part by ADR 0037)
0023 Container images are built reproducibly Delivery (superseded in part by ADR 0057)
0024 Commits follow Conventional Commits, and releases follow Semantic Versioning Delivery
0025 Metrics are exposed and no collector ships; tracing is present and off Observability
0026 Logs are structured JSON on standard output Observability
0027 An optional AI copilot works through tool calls, not retrieval AI (superseded by ADR 0041; the deterministic-code rule superseded by ADR 0064)
0028 Quarkus Dev Services supply local and test infrastructure Development (superseded in part by ADR 0037)
0029 Karyo is one Apache-2.0 product; revenue is the managed service Distribution (superseded in part by ADR 0031 and ADR 0032)
0030 No licence withholds anything; the licence interfaces remain as a compatibility bridge Distribution (superseded in part by ADR 0031)
0031 The console has no locked state, and Loci is the slotting engine behind Karyo's facts and constraints Distribution (superseded in part by ADR 0033, ADR 0034 and ADR 0052)
0032 The canonical repository is private with invited access; Apache-2.0 rights follow every copy Access
0033 Slotting advice requires Loci; Karyo keeps its facts and constraints but no analysis of its own Distribution
0034 Karyo authenticates to Loci with a client-credentials token from Loci's OIDC provider Identity
0035 Warehouse setup identifies an aisle by (zone, rack); extending or retyping it preserves stored runs and continues stored positions Persistence
0036 Warehouse setup reads labels on the server and creates them in one owner-targeted, idempotent transaction Configuration (superseded in part by ADR 0040)
0037 Karyo owns stable principals over exact external OIDC bindings Identity (superseded in part by ADR 0048)
0038 Operational scope comes from Karyo principal grants Identity (superseded in part by ADRs 0040 and 0048)
0039 Scope is declared per endpoint, and raw ambient scope is a registered opt-in Identity
0040 The Facility is the third tier, and the Business Unit stays a key until its consumers convert Identity (superseded in part by ADRs 0042, 0043, 0044, 0045, 0046, 0050 and 0051)
0041 Outside agents act through the user's login; read implementation and two mirror choices are superseded by ADR 0047, and the proposal boundary is implemented by ADR 0054; "Karyo calls no model" superseded in part by ADR 0064 AI
0042 The layout and transport orders work in a Facility, products in a Business Unit, and unconverted callers use the default Facility Identity
0043 Stock works in a Facility, and the stock owner is the Business Unit of that Facility Identity
0044 Orders and counts work in a Facility Identity
0045 The fulfilment flow and webhooks work in a Facility, and the webhook envelope is version 2 Identity
0046 Monitors, reporting, the demand readers and the document archive work in a Facility Identity
0047 Agents sign in to twelve read-only mirrored tools with explicit approval and client attribution Agents (superseded in part by ADR 0048 and ADR 0054)
0048 Karyo authorizes every call from its own grants; provider roles grant nothing and claims only confirm or narrow Identity
0049 Sign-in events belong to the Company, never a Facility Identity
0050 Operational rows have one ownership key: their Facility Persistence, isolation
0051 Business Unit names in storage, claims and the public API; Company configuration key 0 without SYS Persistence, identity, API
0052 An installation runs the Core or the Extended profile, and the profile decides which capabilities the console shows Distribution, front end
0053 A fresh installation signs in once as System, a console-only setup account that disables itself Identity
0054 Agent writes are proposals the person approves on a Karyo page, rechecked at approval and run through the mirrored operation Agents
0055 Karyo has no document AI and no semantic search Scope
0056 A release publishes only from a pushed tag, after the images are proved identical and scanned Delivery
0057 A pull request proves that Karyo builds and starts; the suites run every night Delivery
0058 The warehouse flow model is deterministic code in its own module Structure
0059 Location Class names the usage role; Area is reserved for the future physical hierarchy Layout, API
0060 The physical hierarchy Area > Zone > Aisle > Bay > Level > Position, with one distance service in layout Layout, API
0061 Proximity putaway is a storage strategy sort key, enabled by a Facility setting Layout, API
0062 Proximity pick routes opt in through order strategies Fulfillment, layout, flow, API
0063 Task interleaving is a dispatch strategy, selected per Facility, gated by the proximity setting Work, flow, floor app, API
0064 Warehouse decisions follow tiered autonomy, and a judgment engine joins Karyo behind an opt-in seam AI
0065 The floor is drawn from the layout: the building, dock doors and rooms are layout rows, the rest is derived Layout, API
0066 The floor view is an SVG drawing of the layout, with racks inside each aisle's cell and bays drawn only up close Console, Layout
0067 The floor view shows what Karyo knows now, and draws nothing it cannot back with a row Console, Layout, Work, Authorization

How a record is written

Every record has the same six sections, so the set reads as one collection:

  1. Context - the forces: what problem the decision answers and which constraints bind it.
  2. Decision - what Karyo does, as a rule a reader can check against the code.
  3. Consequences - the benefits, the costs, and any known defect that sits on the decision, stated as current behaviour.
  4. Alternatives considered - each option not taken and why. Where the reason is not recorded, the record says "not recorded".
  5. Evidence - the files that embody the decision, cited by path with stable symbols or configuration keys.
  6. Related - the records and documents a reader needs next.

The title line is # ADR NNNN: <the decision as a short sentence>, and the status is Accepted by default. Records are kept as superseded history rather than deleted or rewritten: ADR 0020 and ADR 0021 were replaced by ADR 0029, with the runtime gate ADR 0021 describes retired by ADR 0030; ADR 0031 then superseded the parts of 0029 and 0030 that described the console's locked states and the slotting advisor positioning, and the parts of ADR 0016 that described the console's page-level add-on gate and the floor app's licence-free menu - the record's own decision, two front ends on one origin, stays current. ADR 0033 then superseded the part of 0031 that kept a built-in reference advisor for installations without Loci. ADR 0034 supersedes the part of 0031 that sent the advice call with no credentials. ADR 0052 supersedes the parts of 0031 that let navigation read the caller's permissions and nothing else and showed the engines on every installation; the console still has no locked state and no licence awareness. ADR 0037 supersedes ADR 0013's mandatory-Keycloak and provider-owned identity decision; Keycloak remains the optional managed administration adapter. ADR 0032 supersedes the parts of ADR 0029 that described the repository as public and its reader as anyone; the one Apache-2.0 distribution itself stays current. ADR 0041 supersedes ADR 0027 whole: the Copilot and its three model providers are retired, and ADR 0027 stays as history. ADR 0064 supersedes the rule of ADR 0027 that every warehouse decision is made by deterministic code, and the part of ADR 0041 that says Karyo calls no model: a judgment engine may be connected, off by default and behind an installation opt-in. ADR 0041's retirement of the chat panel and its agent surface stay current. ADR 0055 supersedes ADR-017 and ADR-018, the parked pre-1.0 pgvector and retrieval designs that were never built and never in this set. Where a superseded record linked to a document that has since moved, only the link target was updated. Everything else in this directory is a current decision.

How the set is kept true

  • A record describes what the code does now. When a change contradicts a record, the record is rewritten in the same pull request as the code, or superseded as the next rule says. The reasoning that led away from the old decision belongs in the new record's Alternatives considered, if it still explains anything.
  • A decision that no longer holds is superseded, never silently kept. A new record replaces it, and the old record's Status line and its row in the index name that record and, where only part is replaced, which parts; its body stays as history, apart from link targets. A record's number is not reused; a new decision takes the next number.
  • Never invent a reason. A rationale written down becomes indistinguishable from a real one. If nothing records why something is the way it is, say so.
  • A record whose evidence has moved is wrong. Re-check the citations when the files they point at change, and fix the record rather than the reader's expectations.

Maintaining this repository covers the same rules for every other document.