Home/Docs/Architecture Decision Records/ADR-0002: Manifest-First Architecture

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:

LayerAuthorityCanonical inputsScope
C0Deployment/operatorService config such as router.yml, environment, credential providers, operator rollout and security policyService instance or deployment
C1ProjectTyped domains in contextunity.project.yaml, for example router.config.*Registered project
C2GraphTyped router.graph.<id>.config domainsCompiled graph
C3NodeTyped node config or an explicitly declared node overrideCompiled 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:

PolicyEffective rule
override/inheritThe most specific present value wins; an omitted C3/C2/C1 value inherits from the next broader layer. C0 constraints still apply.
hard-denyA C0 disable/deny cannot be re-enabled by C1–C3. Lower layers may narrow or disable the feature.
intersectionThe 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/minThe 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-onlyThe 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:

  1. a closed schema and compiled typed projection;
  2. an explicit C-layer and field-level merge policy;
  3. a domain-owned resolver that reads every applicable source;
  4. a production runtime caller that consumes the resolved value;
  5. 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.runtime a public extension mechanism for new config domains.
  • Defining concrete path-inventory rows or claiming that a schema-only target is implemented.