Home / Projects / Orchestrata Ultimate / Decisions / ADR index / ADR-0112

ADR-0112: Tools reaches Redis and embeddings through contracts protocols, not kernel imports

field value
Status Accepted — Accepted (ruling, Mohamed, 2026-10-19, verbatim: "all" — ratifying recommendation R2 option B of reports/project-analysis-2026-10-19.md)
Date 2026-10-19
Register factory (docs/adr, 4-digit ids)
Source docs/adr/0112-tools-reaches-redis-and-embeddings-through-contracts-protocols-not-kernel-imports.md — permalink at 80c7135f0 (unchanged on master since that commit)
Wiki register entry ADR-0112 (wiki status: Accepted)

← ADR-0111 · ADR-0113 →

The record

Status: Accepted (ruling, Mohamed, 2026-10-19, verbatim: "all" — ratifying recommendation R2 option B of reports/project-analysis-2026-10-19.md) · Date: 2026-10-19

Context

The component DAG (packages/tools/design/boundaries.json) draws tools depending on contracts, knowledge_graph, governance — that row describes the codetools release (package: codetools). The landed packages/tools/pyproject.toml also declares orchestrata-kernel, and two modules import kernel at module level (MEASURED):

Both are retarget artifacts, not design: D-T2's map rewrote the frozen core.redis_factory → orchestrata_kernel.core.redis_factory and memory.embedding → orchestrata_kernel.memory.embedding_service; D-T3 flagged the edge as exceeding the drawn DAG and parked it "as a boundaries.json data follow-up, not silently absorbed". This ADR is that follow-up (report finding F4, recommendation R2 option B).

Decision (Mohamed, verbatim: "all" — R2 option B)

The two call sites stop importing kernel and go through contracts protocols:

  1. orchestrata_contracts.protocols.redis_factory.RedisFactory — a structural Protocol whose call returns redis.asyncio.Redis for an explicit (host, port, db) triple. Redis types are TYPE_CHECKING-only imports (from __future__ import annotations), so contracts gains no runtime third-party dependency and boundaries.json needs no edit.
  2. orchestrata_contracts.protocols.embedding_port.EmbeddingPort — the compute_embedding(text) -> list[float] / cosine_similarity(a, b) -> float / search(query, candidates, limit, min_similarity) -> list[tuple[str, float]] surface, pure-Python types, no dependencies.

Tools keeps the drawn DAG and stays bootable standalone:

Alternatives rejected

Consequences

boundaries.json's drawn DAG and the landed package agree again: tools imports only contracts, knowledge_graph, governance. The boundary checker passes with no tools → kernel edge; the tools parity suite passes with kernel removed from _ALLOWED_ROOTS. Kernel's implementation is injected at boot by integration (ADR-0113's composition root), never imported by tools.

Provenance

Mohamed's in-session ruling 2026-10-19 ("all") on recommendation R2 of reports/project-analysis-2026-10-19.md (finding F4). Retarget history: D-T2/D-T3, packages/tools/design/decisions.md. Implementation: a sonnet dispatch brief under the RUL-037 M3 routing, fence packages/tools/** + packages/contracts/protocols/*.

Rulings cited

Specs cited

None (or no spec page exists for the ones named).