ADR-0002: Manifest-First Architectureπ
Statusπ
Accepted.
Contextπ
As the ecosystem scales with multiple projects and tools, wiring them together through ad-hoc Python code leads to brittle connections, scattered configuration, and opaque system behavior. We need a deterministic, declarative way to define how projects connect to the platform without making a tenant-controlled file authoritative for deployment security or service operation.
Configuration authority needs distinct vocabulary and explicit resolution rules because the data/type boundaries describe a different concern.
Decisionπ
We adopt a Manifest-First Architecture for project-owned integration. A project's capabilities, graphs, tools, typed configuration, policy bindings, and requested tenant bindings enter the platform through contextunity.project.yaml and its compiler.
The effective runtime configuration resolves four distinct scopes:
| Layer | Authority | Canonical inputs | Scope |
|---|---|---|---|
| C0 | Deployment/operator | Service config such as router.yml, environment, credential providers, operator rollout and security policy | Service instance or deployment |
| C1 | Project | Typed domains in contextunity.project.yaml, for example router.config.* | Registered project |
| C2 | Graph | Typed router.graph.<id>.config domains | Compiled graph |
| C3 | Node | Typed node config or an explicitly declared node override | Compiled node |
The C prefix means configuration authority. It is independent from the data/type-boundary L0βL4 model in type-boundaries.md. A C1 manifest is parsed and validated through several L-layers; the two models answer different questions and must not be substituted for each other.
The project manifest is not authoritative for C0-only service settings, runtime state, credentials, authorization grants, or signed artifact manifests such as backups and ContextSeeds.
Resolution is domain-owned, not one global mergeπ
There is no universal recursive merge from C0 through C3. Every typed config domain must declare an owning service, a resolver, and a merge policy for each field. That resolver produces one effective typed value for its runtime caller. Unrelated domains do not merge each other's state.
Core's load_service_config and _deep_merge resolve sources inside C0 (built-in defaults, service file, dotenv/environment and credential inputs). That source precedence is not a C0βC1βC2βC3 resolver and does not authorize a generic deep merge of manifest, graph, or node dictionaries.
Allowed cross-layer policies are:
| Policy | Effective rule |
|---|---|
override/inherit | The most specific present value wins; an omitted C3/C2/C1 value inherits from the next broader layer. C0 constraints still apply. |
hard-deny | A C0 disable/deny cannot be re-enabled by C1βC3. Lower layers may narrow or disable the feature. |
intersection | The effective allowlist, scope, or capability set is the intersection of every applicable authority; no lower layer can add a member absent from a broader grant. |
cap/min | The effective resource or numeric ceiling is the minimum applicable value. The domain contract must state whether an excessive request is rejected or explicitly capped; silent, accidental clamping is forbidden. |
C0-only | The field is operator-owned and absent from C1βC3 schemas. Examples include listener/bind configuration, credential backend selection, and platform-wide security or egress controls. |
"Inside the C0 envelope" is shorthand for these field-level rules, not a rule that every C0 value blindly overrides a project value. Ordinary project, graph, and node choices may use override/inherit; security ceilings, authorization, and resource bounds use the stricter policy declared for that field.
Tenant bindings are requests, not grantsπ
project.allowed_tenants is a C1 request for the tenant bindings under which a project expects to run. Omitting it may compile to the project's own identifier as the requested default. Neither spelling creates an authorization grant.
The effective tenant set is an intersection with the authenticated project identity, operator assignment, Shield policy and token/session capabilities applicable to the execution path. A manifest cannot self-authorize a tenant, expand a token, or override a Shield/operator denial. Registration and execution must reject a requested tenant that lacks grant evidence. The manifest supplies configuration; token and operator grants supply authority.
Typed config and the opaque runtime bagπ
Typed config domains at C1βC3 are closed schemas. Unknown keys fail closed at manifest validation or compilation; they must not be preserved in an extras dictionary and discovered later by a runtime consumer.
router.graph.<id>.runtime is the one explicit opaque template/executor-specific bag. It is outside the C0βC3 typed configuration model and is not a stable public config domain. The selected executor may read it only through its bounded, validated runtime seam. It cannot carry secrets, permissions, tenant grants, service policy, or aliases for rejected typed keys, and it cannot bypass payload size, JSON-shape, or security checks.
A config contract requires a runtime sliceπ
A schema field or manifest example alone is not an implemented configuration feature. Each accepted field requires:
- a closed schema and compiled typed projection;
- an explicit C-layer and field-level merge policy;
- a domain-owned resolver that reads every applicable source;
- a production runtime caller that consumes the resolved value;
- gate-off, reject, missing-evidence, and precedence tests, including relevant security boundaries.
Dead config keys and schema-only placeholders that avoid the real caller are forbidden. This ADR defines runtime ownership and resolution semantics.
Alternatives consideredπ
- Programmatic Python wiring or DSLs in code. Rejected: difficult to statically analyze, harder for agents to modify safely, and prone to hidden side effects.
- Environment variables or separate JSON configs as the project-integration authority. Rejected: too fragmented to provide one statically compiled graph/capability contract. They remain valid C0 inputs where the operator is the authority.
- One recursive C0βC3 deep merge. Rejected: field semantics differ, opaque dictionaries can bypass closed contracts, and generic precedence cannot express hard denials, intersections, or caps safely.
- Project manifest as authorization authority. Rejected: a tenant-controlled declaration cannot grant itself tenants, capabilities, secrets, or egress.
Consequencesπ
- Project-owned graph behavior, tool registration, capability bindings, and typed configuration enter the system through the manifest compiler.
- Operator-owned service configuration continues to resolve through C0 loaders; C0 internal source precedence stays separate from cross-layer domain resolution.
- Each configurable runtime behavior has one domain owner and one explicit resolver; ad-hoc Python wiring that bypasses either authority is forbidden.
- The manifest compiler and config resolvers are critical components enforcing closed schemas, layer policy, tenant boundaries, and deterministic output.
- The former numeric configuration labels are retired. Configuration documentation uses C0βC3; L0βL4 is reserved for data/type boundaries.
Non-goalsπ
- Replacing all runtime logic with YAML; business logic still resides in code.
- Forcing dynamic runtime state into static files.
- Making
graph.runtimea public extension mechanism for new config domains. - Defining concrete path-inventory rows or claiming that a schema-only target is implemented.