ADR-006
Adapter Architecture
Section titled “Adapter Architecture”Status: Accepted
Date: 2026-07-15
Decision Type: Architectural Boundary
1. Context
Section titled “1. Context”The CKS ecosystem consists of multiple external integration points:
- MCP adapters;
- CLI interfaces;
- Python APIs;
- HTTP APIs;
- future transport mechanisms.
Without an explicit architectural boundary, adapters may gradually introduce semantic logic and duplicate responsibilities already owned by CKS Core and CKS Runtime.
This ADR defines the architectural role, ownership and limitations of Adapters within the CKS ecosystem.
2. Decision
Section titled “2. Decision”Adapters are translation boundaries between external systems and CKS Runtime.
Adapters expose Runtime capabilities through external protocols while preserving:
- the semantic authority of CKS Core;
- the operational authority of CKS Runtime.
The dependency direction is:
Applications
↓
Adapters
↓
Runtime API
↓
CKS Runtime
↓
CKS CoreThe reference implementation realises this architecture through the Runtime façade, which exposes the canonical Runtime API. The CksCoreAdapter (from cks-runtime-core) ensures that all semantic calls flow through the public cks-core API, strictly enforcing the dependency direction defined here.
Reverse dependencies are prohibited.
3. Architectural Roles
Section titled “3. Architectural Roles”The CKS ecosystem assigns explicit authority boundaries.
CKS Core
Semantic Authority
CKS Runtime
Operational Authority
Adapters
Exposure BoundaryEach layer owns a distinct responsibility.
No layer shall assume responsibilities belonging to another layer.
4. Adapter Responsibilities
Section titled “4. Adapter Responsibilities”Adapters are responsible for:
- translating external requests into Runtime API operations;
- translating Runtime API responses into external representations;
- managing protocol-specific concerns;
- handling transport-specific failures;
- exposing Runtime capabilities through external interfaces.
Adapters perform representation translation only.
Adapters do not own execution lifecycle.
5. Allowed Translation
Section titled “5. Allowed Translation”Adapters may perform protocol and representation translation.
Examples:
HTTP Request
↓
Runtime API RequestCLI Arguments
↓
Runtime API OperationMCP Tool Call
↓
Runtime API InvocationSuch translation changes representation but preserves meaning.
6. Forbidden Semantic Translation
Section titled “6. Forbidden Semantic Translation”Adapters shall never introduce alternative semantic models.
Adapters shall never transform:
External Representation
↓
New Knowledge ModelAdapters shall never:
- define knowledge semantics;
- reinterpret canonical objects;
- replace Core validation;
- introduce alternative constraints;
- modify canonical identities.
Semantic authority remains exclusively with CKS Core.
7. Runtime API Boundary
Section titled “7. Runtime API Boundary”The Runtime API is the only supported interaction boundary between Adapters and Runtime.
Adapters shall:
- invoke Runtime API operations;
- preserve Runtime operation meaning;
- preserve Runtime responses;
- preserve Runtime diagnostics.
Adapters shall never access internal Runtime components directly.
The cks-mcp server is the first conformant adapter. It communicates with Runtime exclusively through the Runtime class and never imports internal Runtime modules. This pattern will be replicated for all future adapters (CLI, HTTP, etc.).
The following is prohibited:
Adapter
↓
Internal Runtime ComponentThe canonical model is:
Adapter
↓
Runtime API
↓
Runtime Components8. Adapter Ownership Rules
Section titled “8. Adapter Ownership Rules”Adapters do not own Runtime lifecycle.
Adapters may request:
- Session creation;
- Runtime operations;
- Transaction execution;
- diagnostics retrieval.
Adapters shall not:
- own Sessions;
- manage Transaction lifecycle;
- persist Runtime state;
- maintain Version History.
Operational ownership remains with CKS Runtime.
9. Forbidden Adapter Responsibilities
Section titled “9. Forbidden Adapter Responsibilities”Adapters shall never:
- define knowledge semantics;
- implement validation rules;
- modify canonical diagnostics;
- implement transaction semantics;
- manage Runtime Sessions directly;
- bypass Runtime APIs;
- introduce alternative knowledge representations;
- redefine Runtime behavior.
10. Adapter Independence
Section titled “10. Adapter Independence”Each Adapter is independent from other Adapters.
Examples include:
MCP Adapter
│
Runtime API
│
CLI Adapter
│
Runtime API
│
HTTP AdapterMultiple Adapters may expose identical Runtime capabilities without sharing implementation details.
11. Transport Independence
Section titled “11. Transport Independence”Runtime behavior shall remain identical regardless of Adapter type.
The following are equivalent when translated into the same Runtime API operation:
MCP Request
CLI Command
HTTP Request
Python API CallA validation request issued via cks-mcp (MCP tool call) and the same request issued via cks-cli produce identical Runtime API calls and therefore identical Transaction outcomes, Version History entries, and diagnostics.
Transport differences shall not affect:
- Runtime semantics;
- Transaction outcomes;
- diagnostics meaning;
- Version History behavior.
12. Error and Diagnostic Boundaries
Section titled “12. Error and Diagnostic Boundaries”The ecosystem distinguishes three categories of information.
Adapter Errors
Section titled “Adapter Errors”Describe transport and protocol failures.
Examples:
- malformed HTTP request;
- invalid CLI arguments;
- unavailable external transport.
Runtime Errors
Section titled “Runtime Errors”Describe operational failures.
Examples:
- unavailable storage;
- invalid Session state;
- failed Runtime operation.
Core Diagnostics
Section titled “Core Diagnostics”Describe semantic validity.
Examples:
- validation failures;
- constraint violations;
- semantic inconsistencies.
These categories shall remain distinguishable.
Adapters shall not merge or reinterpret them.
13. Semantic Preservation
Section titled “13. Semantic Preservation”Adapters shall preserve:
- Runtime operation meaning;
- Runtime diagnostics;
- Core validation results;
- canonical identities;
- transaction outcomes.
Adapters may transform representation.
Adapters shall never transform meaning.
14. Extension Model
Section titled “14. Extension Model”New Adapters may be introduced without modifying:
- CKS Core;
- Runtime specifications;
- existing Adapters.
Adding a new Adapter is an ecosystem extension rather than a semantic extension.
The planned cks-http and cks-cli adapters will follow this model, each wrapping the same Runtime façade in a transport‑specific layer without duplicating any operational or semantic logic.
15. Consequences
Section titled “15. Consequences”Positive
Section titled “Positive”- clear architectural boundaries;
- multiple interchangeable interfaces;
- stable Runtime evolution;
- prevention of semantic duplication;
- transport-independent ecosystem growth.
Negative
Section titled “Negative”- Adapters require Runtime availability;
- direct Core integration is intentionally prohibited;
- additional translation layers are introduced.
These trade-offs are considered acceptable.
16. Alternatives Considered
Section titled “16. Alternatives Considered”Alternative A — Each Adapter Implements Core Logic
Section titled “Alternative A — Each Adapter Implements Core Logic”Rejected.
This creates semantic duplication and inconsistent behavior.
Alternative B — Runtime Contains Transport Implementations
Section titled “Alternative B — Runtime Contains Transport Implementations”Rejected.
Runtime must remain transport-independent.
Alternative C — Adapters Communicate Directly With Core
Section titled “Alternative C — Adapters Communicate Directly With Core”Rejected.
This bypasses Runtime lifecycle management and breaks architectural layering.
17. Final Decision
Section titled “17. Final Decision”Adapters are external translation layers above CKS Runtime.
Runtime remains the canonical operational boundary.
CKS Core remains the canonical semantic authority.
The Adapter layer exists only to expose Runtime capabilities without changing their meaning.
Every conformant Adapter implementation shall preserve the separation between:
- external representation;
- Runtime operations;
- Core semantics.