ADR 0064: Warehouse decisions follow tiered autonomy, and a judgment engine joins Karyo behind an opt-in seam
Status: Accepted. Supersedes in part ADR 0041 ("Karyo calls no model") and the rule of ADR 0027 that every warehouse decision is made by deterministic code. This record builds the seam only. It builds no decision, no candidate builder, no shadow mode and no autonomy gate.
Context
ADR 0027 kept every warehouse decision in deterministic code, and ADR 0041 went further when it retired the copilot: Karyo calls no model and holds no model key. Both were right for what existed. The warehouse flow model (ADR 0058) now computes what a candidate action does downstream, and the product owner wants the decisions that need a judgment, such as whether a note asks for a hold, to be made without a person reading every one. The only bottleneck left in such a decision is the person who has to make it.
A model that answers with probabilities fits that need and is not a chat model. TypeSafe documents one:
Jev, a model behind POST /v1/systemone that answers three kinds of question (Choice, Score and
Noul) about a state, returns a probability for every option, and cannot converse, call tools or choose its
own next action. It does no arithmetic reliably and reads dates as text, so code must compute every number and date
before it asks. TypeSafe's documentation describes a hosted API only. It states that customer requests are not
used for training, offers a Data Processing Agreement and offers zero data retention to enterprise customers on
request. It publishes no JVM client.
Decision
- Warehouse decisions follow tiered autonomy. Code projects, a judgment engine chooses among the projected candidates and judges what code cannot, and a tier decides who acts: act, confirm or escalate. A decision class climbs only on measured evidence: it runs first in shadow mode, where Karyo logs the engine's choice beside the rule's choice and acts on neither, then at confirm, then at act where its levers are reversible and inside limits a manager sets. Deterministic code still computes every number, still owns every write, and stays the default. This record states the principle. Each decision class, its thresholds, its limits and its undo come with their own record and carry their own evidence.
- A judgment engine is a second kind of AI dependency, separate from agents.
karyo.ai.judgment.providerisnone, the default, ortypesafe. It is not a value of any chat or agent setting. Outside agents still reach Karyo only through the MCP endpoint under the user's login, and every agent write is still a proposal that the person approves (ADR 0054). ADR 0041 stays true of that surface: Karyo has no in-app assistant, hosts no conversational model and holds no chat-model key. The engine cannot converse, call a tool or write. - The seam is one SPI.
JudgmentEngineinkaryo-ai-apitakes a state and a map of questions and returns a typed answer per question id, with the model that answered and the token usage. Its question and answer types mirror the documented API one to one.karyo-ai-coreimplementsTypeSafeJudgmentEngineoverjava.net.http, asLociClientdoes for Loci. A consumer injectsInstance<JudgmentEngine>: the bean is registered for lookup only while the provider istypesafe, andisAvailable()is false until the installation opts in. Absence is a fact the consumer handles, never an error and never a substitute that wears the engine's label. The seam has no consumer yet. - The connection is deployment configuration.
KARYO_AI_JUDGMENT_PROVIDER,TYPESAFE_API_KEY,KARYO_AI_TYPESAFE_MODEL,KARYO_AI_TYPESAFE_BASE_URLandKARYO_AI_TYPESAFE_TIMEOUTare read once at startup, so the four that are not secret are catalogue entries that only display (environmentOnly), and the key is environment-only and, as with the Loci credential (ADR 0034), never a catalogue key. A provider oftypesafewith no key stops startup with the reason. A key with the providernoneis inert. - The model is pinned to
jev-1.13.0, not an alias. TypeSafe advises pinning a versioned id when thresholds are tuned against it, and a decision class records its thresholds beside the id.jev-1.14.0exists and is the current alias target. The pin moves only in a change that re-tunes what depends on it. - The data boundary is two gates and a statement. Nothing leaves while the provider is
none. Withtypesafe, nothing leaves until an administrator opts the whole installation in withkaryo.ai.judgment.opt-in, which is read at Company key 0, is operator-controlled and defaults to off. The console shows the opt-in beside a versioned data statement, served byGET /api/v1/judgment, that names what leaves, to whom and under which terms. The statement is the one home of those words. One sentence names the configured address and whether it is encrypted in transit, and the served version is the base version plus that scheme and address, so a recorded opt-in always identifies the words it was made under. When the served version differs from the recorded one the console says so and offers to opt in again; the opt-in itself is not revoked and no call is refused. A later feature that asks the engine a question adds the fields it sends to the statement first, and may send no field the statement does not name. - The error contract is problem+json. An engine that is not switched on is
503judgment-engine-not-configured. A configured engine that does not answer, rejects Karyo's key, stays rate-limited past the retries or answers with something that breaks the contract is502judgment-engine-unavailable. An engine that refuses the request itself is502judgment-request-rejected. A malformed answer is a read failure, never filled in. - Requests are reproducible and answers are checked. The request builder is a pure function pinned by
golden files, so a wording change is a reviewed diff of what leaves the installation. The parser refuses
a missing answer, an answer of another kind, an option that is not in the criteria and a probability outside
0 to 1. Karyo retries only
429and529, twice, and never a timeout. It follows no redirects and never logs the state, the answers, the key or the address.
Consequences
- With the provider
noneand the opt-in off, which is every installation as shipped, Karyo behaves as it did in 2.0.0. The statements "Karyo calls no model" in the README, the vision and the agent guide now read "unless an installation connects a judgment engine and opts in". - Connecting the engine and opting in sends nothing today, because no feature asks it a question. The statement says so.
- An installation that must keep every byte inside its network cannot use the engine while TypeSafe documents
only a hosted API. It leaves the provider at
none. - The live check against api.typesafe.ai (
./gradlew :services:karyo-app:judgmentLiveCheck) ran on 2026-10-26 with the pinnedjev-1.13.0: a real answer parsed into the typed shape, the pinned model answered all three repeats, and the repeats agreed. The result is in release evidence. The check skips without the key, and no workflow runs it. - The docs describe the engine's documented limits and prices as TypeSafe states them; Karyo cannot check them.
- A decision class that acts needs its own record for its levers, limits and undo, a dedicated principal with scoped roles, and a decision log. None exists. This record gives such a record the principle to cite and the seam to build on, and nothing else.
Alternatives considered
- Add
typesafeas a fourth value of the retired chat-provider switch. Rejected before ADR 0041 and now moot: the engine cannot converse or call tools, so it is a different kind of dependency, and one switch would have made an installation choose between a chat model and a judgment model. - An opt-in per Business Unit. Rejected: the key, the egress and TypeSafe's agreement are the installation's, so one administrator at the Company decides once. A Business Unit row for the opt-in is never read.
- No opt-in, only the operator's key. Rejected: a key in the environment says an operator wants the engine, not that the administrator who answers for the warehouse's data has read what leaves.
- A catalogue key for the API key. Rejected for the reason ADR 0034 gives for the Loci credential: a server-side credential is environment-only.
- The alias
jev-latest. Rejected: an alias moves when TypeSafe releases a model, which would change answers and shift every confidence threshold without a change to Karyo. - A TypeSafe SDK. TypeSafe publishes Python and JavaScript SDKs only. A hand-written client over
java.net.httpis what Karyo already does for Loci, and the API is one endpoint. - Let the engine decide in code without a tier. Rejected: a model's calibration holds across groups of predictions and guarantees nothing about one answer, so autonomy is granted per decision class on measured accuracy, never per answer or per installation switch.
Evidence
services/ai-service/karyo-ai-api/src/main/kotlin/com/karyo/ai/spi/JudgmentEngine.kt,JudgmentEngine- the SPI;.../ai/model/JudgmentQuestion.ktandJudgmentAnswer.kt- the question and answer types;.../ai/exception/JudgmentException.kt,JudgmentException- the three failuresservices/ai-service/karyo-ai-core/src/main/kotlin/com/karyo/ai/engine/TypeSafeJudgmentEngine.kt,TypeSafeJudgmentEngine- the client, its retries and its registration only for providertypesafe;TypeSafeRequest.ktandTypeSafeResponse.kt- the pure request builder and the answer parserservices/ai-service/karyo-ai-core/src/main/kotlin/com/karyo/ai/config/JudgmentConfig.kt,JudgmentConfig- startup validation;JudgmentOptIn.kt,JudgmentOptIn- the opt-in at Company key 0services/ai-service/karyo-ai-core/src/main/kotlin/com/karyo/ai/exception/JudgmentExceptionMapper.kt,JudgmentExceptionMapper- the problem+json mappingservices/ai-service/karyo-ai-core/src/main/kotlin/com/karyo/ai/service/JudgmentDataStatements.kt,JudgmentDataStatements.forBaseUrl- the data statement and its version;.../ai/api/v1/JudgmentResource.kt,JudgmentResource-GET /api/v1/judgmentservices/auth-service/karyo-auth-core/src/main/kotlin/com/karyo/auth/config/SystemPropertyCatalog.kt, thekaryo.ai.*entries - the four display-only deployment entries and the opt-inservices/karyo-app/src/main/resources/application.yaml,karyo.ai- the provider defaultnoneand the pinned modelservices/karyo-app/src/test/kotlin/com/karyo/ai/- the golden-file request test, the response parser test, the engine test against a local stand-in,StubJudgmentEngine, the seam tests with and without an engine, andTypeSafeLiveCheck;services/karyo-app/src/test/resources/judgment/- the golden and recorded filesservices/karyo-app/build.gradle.kts,judgmentLiveCheck- the task that runs the live check- TypeSafe documentation: the System One API, the models page (
jev-1.13.0andjev-1.14.0, aliases), confidence, and the request rules and errors page, read on 2026-10-26
Related
- ADR 0027 and ADR 0041 - the records this one amends
- ADR 0054 - the agent proposal boundary, unchanged
- ADR 0058 - the model that computes the numbers a judgment is asked about
- ADR 0034 and ADR 0033 - the precedent for an external engine, its credential and its error contract
- ADR 0017 - the RFC 7807 error body