-
Notifications
You must be signed in to change notification settings - Fork 0
Design/contract lock #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,349 @@ | ||||||
| # ADR-0006: Contract Lock — Architectural Invariants Frozen | ||||||
|
|
||||||
| ## Status | ||||||
| Accepted | ||||||
|
|
||||||
| ## Date | ||||||
| 2026-02-11 | ||||||
|
|
||||||
| ## Context | ||||||
|
|
||||||
| The RAGfish / Noema ecosystem has matured through several architectural decision records: | ||||||
|
|
||||||
| - **ADR-0001**: Established RAGpack ZIP format and removed tokenizer dependencies | ||||||
| - **ADR-0004**: Introduced the Architecture Constitution defining three-layer architecture | ||||||
| - **ADR-0005**: Established client-side routing as a first-class architectural principle | ||||||
|
|
||||||
| These ADRs collectively define a stable architectural foundation. However, the critical contracts that bind these layers together—the invocation boundary, API schema, constraint model, and authority distribution—have existed only as implicit agreements or scattered across documentation. | ||||||
|
|
||||||
| As implementations of this architecture begin (Noesis Noema client, noema-agent execution service), the need for **explicit, immutable contract specifications** has become critical. | ||||||
|
|
||||||
| ### Problem | ||||||
|
|
||||||
| Without formalized contracts: | ||||||
| - Implementations may drift from architectural intent | ||||||
| - Boundary violations may go undetected until deployment | ||||||
| - Authority distribution may become ambiguous | ||||||
| - Constraint enforcement may become inconsistent | ||||||
| - Human accountability may erode through convenience-driven compromises | ||||||
|
|
||||||
| The risk of implicit contracts is that they encourage "pragmatic" shortcuts that incrementally violate core principles without triggering architectural review. | ||||||
|
|
||||||
| ### Need for Immutability | ||||||
|
|
||||||
| Early-stage architectural flexibility is valuable, but RAGfish has now reached a point where core contracts must stabilize to enable: | ||||||
| - Parallel implementation across multiple components | ||||||
| - Automated compliance testing | ||||||
| - Long-term architectural governance | ||||||
| - Human accountability preservation | ||||||
|
|
||||||
| Treating contracts as mutable invites gradual erosion. Treating them as immutable forces deliberate, reviewed changes. | ||||||
|
|
||||||
| ## Decision | ||||||
|
|
||||||
| We establish a **Contract Lock** on the architectural invariants of the RAGfish / Noema system. | ||||||
|
|
||||||
| Specifically, we freeze the following as **canonical specifications** at version 1.0.0: | ||||||
|
|
||||||
| ### 1. Invocation Boundary Specification | ||||||
|
|
||||||
| The boundary between client and execution layers is formally defined and locked. | ||||||
|
|
||||||
| **Document**: `docs/contracts/invocation-boundary.md` | ||||||
|
|
||||||
| **Invariants**: | ||||||
| - Client constructs RoutingDecision | ||||||
| - noema-agent executes only given ExecutionContext | ||||||
| - RAGpack returns KnowledgeReference only | ||||||
| - No upward or lateral decision authority | ||||||
|
|
||||||
| **Enforcement**: These invariants must be preserved in all implementations. Any violation is an architectural failure requiring immediate remediation. | ||||||
|
|
||||||
| ### 2. API Schema Specification | ||||||
|
|
||||||
| The conceptual data structures that cross layer boundaries are formally defined and locked. | ||||||
|
|
||||||
| **Document**: `docs/contracts/api-schema.md` | ||||||
|
|
||||||
| **Structures**: | ||||||
| - InvocationRequest | ||||||
| - InvocationResponse | ||||||
| - RoutingDecision | ||||||
| - ExecutionContext | ||||||
| - ExecutionResult / ExecutionError | ||||||
| - ExecutionMetadata | ||||||
| - KnowledgeReference | ||||||
|
|
||||||
| **Version**: 1.1.0 | ||||||
|
|
||||||
| **Immutability**: The schema is immutable. Any change to required fields or field semantics constitutes a breaking change requiring a new ADR. | ||||||
|
|
||||||
| ### 3. Constraint Contract Specification | ||||||
|
|
||||||
| The rules governing constraint creation, propagation, and enforcement are formally defined and locked. | ||||||
|
|
||||||
| **Document**: `docs/contracts/constraint-contract.md` | ||||||
|
|
||||||
| **Rules**: | ||||||
| - Constraints flow downward only | ||||||
| - Execution layer must not mutate constraints | ||||||
| - Routing decision must originate from client layer | ||||||
| - Stateless execution is mandatory | ||||||
| - Evidence attachment required | ||||||
|
|
||||||
| **Enforcement**: Constraint violations must abort execution immediately and generate incident reports. | ||||||
|
||||||
| **Enforcement**: Constraint violations must abort execution immediately and generate incident reports. | |
| **Enforcement**: Constraint violations must abort execution immediately by returning an `ExecutionError`; any incident reporting is handled by higher-level operational policy, not by this contract. |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ADR claims the API schema has extension points like optional “additionalData” maps, but docs/contracts/api-schema.md does not define any additionalData field. Either add the described extension point to the schema or remove/adjust this claim to keep the ADR accurate.
| 2. **Extension Points**: API schema includes optional fields and "additionalData" maps that allow extension without breaking changes. | |
| 2. **Extension Points**: API schema evolution should prefer optional fields and explicit, documented extension points to enable non-breaking changes, and any such extension points must be defined in `docs/contracts/api-schema.md`. |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Design-time verification says “All four documents present in docs/contracts/”, but this ADR also lists (and locks) docs/contracts/README.md, making at least five documents in that directory. Clarify whether the README is included in the verification checklist to avoid ambiguity.
| - All four documents present in `docs/contracts/` | |
| - All five locked contract documents present in `docs/contracts/` (including `README.md`) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||
| # Contract Specifications | ||||||
|
|
||||||
| This directory defines the immutable contract layer of Noema Agent. | ||||||
|
|
||||||
| Documents: | ||||||
|
|
||||||
| - invocation-boundary.md | ||||||
| - api-schema.md | ||||||
| - constraint-contract.md | ||||||
| - authority-model.md | ||||||
|
|
||||||
| These contracts define the invariant execution structure. | ||||||
|
|
||||||
| No runtime logic may violate these contracts. | ||||||
|
|
||||||
| Status: Locked (v1.0.0) | ||||||
|
||||||
| Status: Locked (v1.0.0) | |
| Status: Locked (v1.1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section says all canonical specifications are frozen at version
1.0.0, but later the ADR lists the API Schema contract as version1.1.0. Please adjust the wording to avoid a versioning contradiction (e.g., freeze each contract at its own current version).