# Domains — two sides of one relation A **domain** is an ontoref extension (ADR-012). Every domain has two sides, and they live in different places: | Side | Where | Owns | |---|---|---| | **Authority** | `code/domains//` (here) | the contract: `domain.ncl`, `commands.nu`, `repo_kinds.txt`, and either a co-located `ontology/` (e.g. `framework/`) or a `schema_cmd` that resolves schemas from an external project (e.g. `rustelo/`) | | **Consumer** | `.domains-ontoref//` in the consuming project | the project's **bond** to the domain, plus its optional implementation spine | The authority declares what the domain *is*; the consumer declares *this project's relation to it*. A bond resolves against the authority (its definitions, states, capabilities), never on the consumer edge (`glossary::bond`). ## Consumer side — `.domains-ontoref//` One container directory, one subfolder per bonded domain. Multi-domain membership is just multiple subfolders — it is **not** derived from the manifest's scalar `repo_kind` (carrier-only, decided 2026-07-17; `formalization-vs-adoption`: cardinality is uncapped and orthogonal to whether ontoref manages the project). ``` / .domains-ontoref/ rustelo/ bonds.ncl # REQUIRED — : BondSet (schema: code/ontology/schemas/bond.ncl) ontology/schemas/*.ncl # OPTIONAL — implementation spine (federated domain schemas) reflection/modes/*.ncl # OPTIONAL — runnable modes for this implementation web/ bonds.ncl # a second, dependency-axis bond (a plane) ``` ### What every bonded project carries - `bonds.ncl` — a `BondSet` (`{ domain, bonds }`), importing the `bond.ncl` schema (the carrier is named `bondS.ncl` precisely so `import "bond.ncl"` resolves the schema and does not self-recurse). Each `Bond` names an `axis` (`Governance` → the project is an ontoref-node in the domain's DAG / `Dependency` → it inhabits an ontoref-plane), a `state` (`None|Linked|Node|Managed`), and — by axis — a `resolution` (`Delegate|Override|Compose`) or a DDD `dep_kind` (+ `mutual`, `plane`). This is the ONLY required file: a project may bond **without** being managed by ontoref (no `.ontoref/` spine needed). ### What a *managed / implementing* project additionally carries The optional implementation spine — relocated here from the deprecated flat `.{domain}.ontoref/` marker. Its shape is domain-specific (inventoried 2026-07-17): - an app/impl declaration (`app.ncl`) validated against the domain's `schema_cmd` schema (e.g. `website-htmx-rustelo`); - federated `ontology/schemas/*.ncl` when the domain authors its schema in the consumer (e.g. `DD7pasos/.librosys.ontoref/ontology/schemas/`); - `reflection/modes/*.ncl` discovered by the mode runner (e.g. `jpl/rustelo-website`). ## Detection `domain.nu :: project-domains` recognizes membership four ways: | kind | signal | |---|---| | `config_flag` | `domain_ = true` in `.ontoref/config.ncl` | | `domain_origin` | `domain_origin` record in `manifest.ncl` | | `impl_dir` | **deprecated** flat marker `.{domain}.ontoref/` | | `bonded_dir` | `.domains-ontoref//` subfolder (the current layout) | `impl_dir` and `bonded_dir` are detected **simultaneously** during the migration window (0047); a project carrying both forms for the same id is de-duplicated (the flat form wins until removed). New projects use `.domains-ontoref//` only. ## Migration The three precedent projects still on the flat form live in **independent external repos** and are relocated by their maintainers, not by an in-place edit from this constellation (migration 0047 documents the consumer-run step): - `DD7pasos/.librosys.ontoref/` → `.domains-ontoref/librosys/` - `website-htmx-rustelo/.rustelo.ontoref/` → `.domains-ontoref/rustelo/` - `jpl/rustelo-website/.rustelo.ontoref/` → `.domains-ontoref/rustelo/` ## References - `code/ontology/schemas/bond.ncl` — the `Bond` / `BondSet` contract - `.ontoref/ontology/glossary.ncl` — `bond`, `ontoref-node`, `ontoref-plane` - `.ontoref/reflection/modules/domain.nu` — `project-domains` detection - ADR-012 (domain extension), ADR-018/045 (level hierarchy, co-tenancy)