feat(cognitive): add local provider registry and discovery

This commit is contained in:
m
2026-08-17 09:28:33 +03:00
parent 9e99a04c76
commit a25a57ab69
38 changed files with 2344 additions and 116 deletions
@@ -0,0 +1,60 @@
# ADR-0008 — Cognitive evaluation ownership and evidence boundary
Status: Accepted
Date: 2026-08-17
Accepted under: DEV-000056 user-directed architecture amendment
## Problem
Provider/model discovery, binding qualification and deterministic routing need benchmark evidence without making Cognitive Workers canonical owners, putting provider DTOs into Core, or redefining general observations and artifacts as Capability state.
## Evidence
- The Architecture Registry assigns `Capability`, `CapabilityBinding` and `CapabilityHealth` to the Capability module.
- The Core Semantic Model assigns artifact metadata/lineage to Artifact and general observations/claims/provenance to Epistemics.
- Routing needs an owner-local, revision-bound evaluation decision and cannot parse arbitrary benchmark files on each request.
## Alternatives considered
1. Store provider benchmark JSON directly in routing code — rejected because it is untyped, non-canonical and not revision-bound.
2. Make Cognitive Worker own evaluation state — rejected because Cognitive Workers have no canonical ownership.
3. Add a new Model Registry service/owner — rejected as unnecessary topology and ownership expansion.
4. Let Capability own a normalized qualification assessment that references an immutable Artifact — accepted.
## Decision
1. Capability owns provider/model/binding registry revisions, lifecycle, health, routing eligibility, `EvaluatedCapability`, normalized `PerformanceEvidence` used for routing, and cognitive usage observations.
2. An imported performance record must reference an immutable `ArtifactID` and record benchmark version, binding/model revisions, observation time and which measurements were actually observed. Missing measurements remain explicitly unobserved and are never treated as zero.
3. Artifact owns benchmark payload metadata and lineage. The Capability record is a typed owner-local assessment/reference, not a replacement for the source artifact.
4. Epistemics remains owner of generalized observations, claims, beliefs and provenance. This ADR does not move those semantics into Capability.
5. Provider discovery may append `DISCOVERED` and `INACTIVE` revisions and current operational health. It cannot validate, activate, promote, download or delete models.
6. Deterministic routing selects binding revisions, not model names. Only explicitly eligible `ACTIVE` or allowed `CANARY` bindings participate.
7. Provider-specific discovery and invocation DTOs remain in adapters. Core receives only typed provider-neutral registration records.
## Rationale
This keeps canonical routing eligibility with the existing Capability owner, preserves immutable external evidence through Artifact references, and avoids both cross-owner database joins and a new generic Model Manager.
## Consequences
- No new canonical owner, database role, privileged capability or runtime service is introduced.
- Capability may normalize only measurements needed for qualification/routing and must retain the source `ArtifactID`.
- Import is an explicit registration action; Router never reads arbitrary files during a request.
- A new model digest or provider/model revision receives no inherited qualification or activation.
## Validity conditions
- Artifact references resolve to immutable/versioned content outside request-time routing.
- Missing evidence is represented explicitly.
- Discovery and health changes remain independent from qualification and activation.
- Model output never receives Authority or a canonical mutation path.
## Migration and rollback
New evaluation records are additive. Rollback disables their use in routing; bindings remain governed by explicit lifecycle and health. No Authority or Commit state requires repair.
## Revisit triggers
- Evaluation becomes a generalized epistemic workflow rather than Capability qualification evidence.
- Benchmark artifacts require signed attestations or an external evidence service.
- Adaptive/self-learning routing is proposed.