## Canonical vocabulary

This document defines the rules governing vocabulary across Dryv.

It does not create a second semantic authority.

The **Canonical Runtime IR remains the only semantic authority**.

This document defines how concepts are named, reused, projected and extended consistently across:

```text
Authoring
    ↓
Authoring Protocol
    ↓
Canonical Runtime IR
    ↓
Engine inspection and context
    ↓
Template packs
    ↓
Generated implementations
```

The purpose of the vocabulary is simple:

> The same meaning should have the same name everywhere in Dryv.

Vocabulary consistency is a fundamental part of Dryv's portability, explainability and learnability.

---

## 1. Core principle

Dryv describes **meaning**, not programming syntax.

Its vocabulary must be:

| Property               | Requirement                                                                                                                             |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Language-neutral       | No concept depends on TypeScript, Python, Rust, Java, Go, Dart, C#, or another programming language.                                    |
| Framework-neutral      | No canonical concept depends on NestJS, React, Django, FastAPI, Spring, Flutter, TypeORM, PyTorch, Unity, or another framework/library. |
| Renderer-neutral       | Jinja, Handlebars, Liquid, Mustache and future renderers receive the same semantic vocabulary.                                          |
| Implementation-neutral | Meaning must survive replacing one implementation technology with another.                                                              |
| Domain-extensible      | Dryv is not limited to CRUD, web applications, databases, or today's packs.                                                             |
| Meaning-preserving     | Vocabulary names actual concepts rather than convenient code-generation tricks.                                                         |
| Deterministic          | A canonical term must have one defined meaning.                                                                                         |
| Explainable            | Humans and AI agents should be able to follow the same term through every layer.                                                        |
| Conservative           | New vocabulary is added only when real use proves it is necessary and sufficiently portable.                                            |

Dryv is therefore **implementation-agnostic and domain-extensible**, but it is not meaning-agnostic.

Meaning is exactly what Runtime IR exists to preserve.

---

## 2. Runtime IR owns canonical semantic words

Runtime IR is the only semantic authority.

If Runtime IR defines:

```text
schema
projection
field
relation
operation
workflow
event
policy
surface
view
```

those are the canonical semantic terms.

Other tiers must not silently rename them.

For example:

```text
Runtime IR
schema.projection

Context
schema.projection
```

is preferred over:

```text
Runtime IR
schema.projection

Context
schema.source
```

unless Dryv explicitly decides that `source` is the better canonical concept and changes the Runtime IR accordingly.

Context is not allowed to correct or redesign Runtime IR vocabulary independently.

Authoring is not allowed to create a competing semantic vocabulary.

Packs are not allowed to create semantic aliases for canonical concepts.

---

## 3. Vocabulary classes

Not every word visible to a template is canonical software meaning.

Dryv vocabulary belongs to distinct classes.

| Class                            | Examples                                                                                     | Authority                |
| -------------------------------- | -------------------------------------------------------------------------------------------- | ------------------------ |
| Semantic vocabulary              | `schema`, `field`, `operation`, `relation`, `workflow`, `event`, `policy`, `view`, `surface` | Runtime IR               |
| Semantic qualifiers              | `role`, `kind`, `purpose`, `cardinality`, `optional`, `nullable`, `sensitive`                | Runtime IR               |
| Interface/facet vocabulary       | `http`, `websocket`, `schedule`, `storage`, `representation`                                 | Runtime IR               |
| Derived semantic vocabulary      | `is.boolean`, `has_min`, effective storage facts                                             | Engine                   |
| Structural projection vocabulary | `NameContext`, resolved links, map→array normalization                                       | Engine                   |
| Planning vocabulary              | `file`, `unit`, `symbol`, `dependency`, `import`, `export`, `generated`                      | Planner                  |
| Pack vocabulary                  | `selection`, `template`, `provides`, `needs`, `layout`, `actions`                            | Pack contract            |
| Usage vocabulary                 | `sources`, `packs`, `destinations`, `bindings`                                               | Usage contract           |
| Authoring convenience            | host-language builders, helpers and syntactic sugar                                          | Authoring implementation |

These classes must not be confused.

For example:

```text
value.generated.schema_validation
```

does not mean that `schema_validation` has become part of software meaning.

It means:

```text
semantic value
    +
current generation plan
    ↓
representation generated through schema.validation
```

The semantic concept remains the value.

The generated representation belongs to planning.

---

## 4. Semantic vocabulary must survive implementation replacement

A candidate canonical concept should survive substantial implementation changes.

For example:

```text
operation
```

remains meaningful when implemented by:

```text
NestJS
FastAPI
Spring
Gin
Axum
ASP.NET
```

Therefore `operation` is a strong canonical concept.

Similarly:

```text
relation
```

can be represented through:

```text
TypeORM
SQLAlchemy
Hibernate
EF Core
GORM
SeaORM
```

The semantic relation survives the technology choice.

By contrast:

```text
controller
component
decorator
hook
class
interface
ORM entity
React state
Django serializer
```

are implementation concepts.

They belong in packs.

They are not Runtime IR vocabulary.

---

## 5. Programming syntax is not software meaning

Dryv must not gradually become an abstract programming language.

Canonical Runtime IR should not model imperative programming primitives merely because generated languages contain them.

The following are not sufficient reasons for canonical vocabulary:

```text
if
else
for
while
loop
switch
class
interface
method
variable
statement
return statement
import statement
```

A template may generate those constructs.

A pack may reason about how target code should represent Dryv meaning.

But Runtime IR should model the meaning that caused those constructs to exist.

For example:

```text
policy
condition
invariant
transition
relation
selection
constraint
expression
```

may legitimately result in generated `if`, `match`, `switch`, guards, decorators or predicates.

The canonical concept is still the semantic rule, not the programming statement.

---

## 6. Declarative logic and mathematics are allowed

Avoiding programming primitives does **not** mean Dryv cannot represent logic or mathematics.

Logical and mathematical concepts may be genuine semantic meaning.

Existing examples include:

```text
comparison
arithmetic
range
duration
constraint
expression
invariant
```

Future requirements could justify concepts such as:

```text
quantity
unit
dimension
vector
matrix
tensor
equation
distribution
probability
coordinate
transform
```

but none of these are automatically approved.

They must pass the vocabulary admission rules in this document.

An equation is semantic meaning.

A `for` loop used to calculate it is an implementation decision.

---

## 7. Context must project vocabulary, not redesign it

Template context exists to make canonical meaning usable by renderers.

Context may safely perform structural normalization such as:

```text
map
→ deterministic named array

reference
→ bounded resolved semantic link

canonical value
→ JSON literal projection

semantic classification
→ is.*

optional bound
→ has_*

planned representation
→ generated.*
```

These transformations improve usability without creating new software meaning.

However, semantic names must remain canonical.

This is acceptable:

```text
relation.cardinality
relation.is.many_to_one
```

because `is.many_to_one` is an explicitly derived classification of the canonical cardinality.

This is not acceptable without a canonical vocabulary change:

```text
Runtime IR: projection
Context: source
```

because the same semantic concept has acquired two names.

---

## 8. Derived vocabulary must identify itself as derived

Derived context must never masquerade as authored canonical meaning.

Current conventions are good examples:

```text
is.*
has_*
*_json
generated.*
dependency_groups.*
name.camel
name.pascal
name.snake
name.kebab
```

These are clearly projections or conveniences.

When possible, new derived vocabulary should follow equally recognizable conventions.

A template author should be able to distinguish:

```text
what the software means
```

from:

```text
what the Engine calculated to make that meaning easier to use
```

---

## 9. Canonical naming rules

| Concept              | Rule                                                                                                                                             |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `kind`               | Structural variant of one concept.                                                                                                               |
| `role`               | What a semantic declaration does in the larger system.                                                                                           |
| `purpose`            | Why a concept is being used in a particular relationship or derivation.                                                                          |
| `facet`              | Optional semantic concern/interface attached to another concept.                                                                                 |
| `source`             | Provenance/origin of a value or relationship, not a synonym for another concept.                                                                 |
| `target`             | Explicit destination of a relationship/binding.                                                                                                  |
| `value`              | Semantic information carried by a field, port, payload or similar carrier.                                                                       |
| `input` / `output`   | Direction across a semantic boundary.                                                                                                            |
| `binding`            | Explicit connection between two known semantic endpoints.                                                                                        |
| `relation`           | Semantic association between values/entities, not generated dependency wiring.                                                                   |
| `dependency`         | Artifact/generation dependency unless specifically qualified otherwise.                                                                          |
| `provides` / `needs` | Pack capability composition.                                                                                                                     |
| `projection`         | Derived semantic shape produced from another semantic shape.                                                                                     |
| `context`            | Must normally be qualified because Dryv has semantic context, policy context, view context, evaluation context and template context.             |
| `action`             | Avoid as a generic top-level term because Pack Actions already have generation meaning and `operation.role=action` already has semantic meaning. |
| `model`              | Avoid unqualified canonical use because it is overloaded across databases, UI, mathematics and machine learning.                                 |

Casing may adapt to the host language:

```text
rate_limit
rateLimit
```

but the words may not change:

```text
projection
source
```

are not casing variants.

They are different vocabulary.

---

## 10. Authoring vocabulary

Authoring implementations may provide ergonomic syntax, but they must preserve canonical terminology.

Allowed adaptation:

```text
Runtime IR        Authoring TypeScript
rate_limit   →    rateLimit
on_delete    →    onDelete
primary_key  →    primaryKey
```

This is casing adaptation.

Semantic aliases should be avoided:

```text
canonical: projection
author API: derivedFrom

canonical: relation
author API: association

canonical: operation
author API: endpoint
```

unless those words describe genuinely different concepts.

Authoring sugar may introduce temporary construction concepts such as:

```text
pick
omit
rename
```

when the compiler completely resolves them into canonical Runtime IR.

Such construction vocabulary must not accidentally become another semantic model.

---

## 11. Packs must speak canonical Dryv vocabulary

Pack manifests should select canonical concepts:

```text
schema
operation
view
workflow
property.enum
```

They may map those concepts into target terminology:

```text
schema
→ TypeORM Entity

schema
→ Pydantic Model

operation
→ NestJS controller method

operation
→ FastAPI route

view
→ React page
```

The right-hand concepts belong to the pack.

They must not leak backwards into Runtime IR.

Folders, framework names and template filenames also carry no semantic authority.

---

## 12. Dryv is not limited to conventional application software

The current vocabulary contains many concepts common to application development:

```text
schema
operation
event
workflow
policy
view
surface
storage
HTTP
```

These are the vocabulary Dryv currently needs.

They are not a declaration that Dryv can only describe web/business applications.

Dryv may eventually describe other complex systems if real use requires it.

Potential domains include:

| Domain           | Possible semantic concepts — not approved merely by appearing here             |
| ---------------- | ------------------------------------------------------------------------------ |
| Mathematics      | quantities, units, vectors, matrices, equations, distributions                 |
| Graphics / 3D    | geometry, transform, coordinate space, scene, material, camera, light          |
| Machine learning | dataset, observation, label, prediction, inference, training, embedding        |
| AI systems       | model interaction, tool, observation, prediction, evaluation                   |
| NLP              | document, utterance, language, tokenization intent, classification, extraction |
| Computer use     | environment, observation, action intent, target, state                         |
| Simulation       | state, transition, actor, environment, timestep                                |
| Optimization     | objective, variable, constraint, solution                                      |
| Robotics         | sensor, actuator, pose, trajectory, observation                                |

This table is exploratory, not a roadmap.

Dryv does not add vocabulary simply because something could theoretically be represented.

---

## 13. Vocabulary expansion is optional

There is no goal to make Runtime IR describe every possible domain.

The preferred state is always:

```text
current vocabulary is enough
```

until a real requirement proves otherwise.

A new concept must pass all of these tests before becoming canonical:

| Test                     | Question                                                                                                         |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| Real-use test            | Is an actual project or pack blocked without this concept?                                                       |
| Meaning test             | Does it describe enduring meaning rather than generated syntax?                                                  |
| Neutrality test          | Is it independent of a specific framework, language, vendor or library?                                          |
| Portability test         | Can at least substantially different implementations represent it?                                               |
| Replacement test         | Would the concept remain valid if today's implementation were replaced?                                          |
| Reuse test               | Is this meaning useful beyond one template or one generated file?                                                |
| Existing-vocabulary test | Can current concepts already express it cleanly?                                                                 |
| Determinism test         | Can its meaning and validation be made precise?                                                                  |
| Composition test         | Can it interact with existing semantic concepts without hidden rules?                                            |
| Naming test              | Does it have a clear term that does not conflict with existing vocabulary?                                       |
| Boundary test            | Does it belong in Runtime IR rather than Authoring sugar, Context derivation, Pack logic or Usage configuration? |

Failure of any major test is a reason not to add the concept yet.

---

## 14. Portability must be demonstrated

A proposed semantic concept should not be accepted merely because its name sounds generic.

For example, an ML concept is not automatically neutral simply because multiple ML frameworks use the same word.

A proposal should demonstrate mappings conceptually such as:

```text
canonical concept
       │
       ├── implementation A
       ├── implementation B
       └── implementation C
```

without requiring target-specific fields in the canonical concept.

For example, a future `prediction` concept may be promising if the same canonical meaning can map independently into different ML runtimes or generated APIs.

A concept requiring fields such as:

```text
pytorch_module
tensorflow_layer
sklearn_estimator
```

has failed the neutrality test.

Those belong in packs.

---

## 15. Natural language does not become Runtime IR syntax

Dryv may eventually support rich natural-language authoring.

For example, a user might describe:

```text
The total must never exceed the account limit.
```

or:

```text
Predict crop disease probability from these observations.
```

Natural-language authoring may interpret that intent.

The compiler must still produce explicit canonical Runtime IR.

Runtime IR should not store arbitrary natural-language parse trees as the semantic contract merely because natural language produced the declaration.

The same rule applies to AI-assisted authoring:

```text
AI interprets
    ↓
authoring declaration
    ↓
canonical meaning
```

AI does not become another semantic authority.

---

## 16. Domain namespaces require proof

Some domains reuse words Dryv already owns.

For example, machine learning uses the word:

```text
feature
```

but Dryv already has:

```text
feature
```

as a software-composition concept.

Do not overload the existing canonical word with a second incompatible meaning.

If a future domain genuinely requires such a concept, its vocabulary design must explicitly solve the collision.

Possible namespacing or a better neutral concept may be considered at that time.

Do not reserve speculative namespaces today.

---

## 17. Vocabulary should be small

A smaller, composable vocabulary is better than a large ontology.

Prefer:

```text
existing concepts + composition
```

over:

```text
new special-case concept
```

A vocabulary becomes powerful when a few stable concepts combine to describe many systems.

Expansion should therefore normally happen because Dryv discovers a missing **primitive of meaning**, not because a framework has another abstraction that could be copied.

---

## 18. Current vocabulary families

The current canonical vocabulary broadly covers:

| Family                  | Concepts                                                                                   |
| ----------------------- | ------------------------------------------------------------------------------------------ |
| Composition             | application, group, feature                                                                |
| Values                  | property, schema, field, literal, enum, composite, union, record, tuple, generic, temporal |
| Constraints             | range, length, pattern, invariant                                                          |
| Relationships           | relation, related, reference, binding                                                      |
| Behavior                | operation, input, output, failure, event                                                   |
| Rules                   | policy, expression                                                                         |
| Orchestration           | workflow, step, transition                                                                 |
| Interaction             | view, part, presentation                                                                   |
| Delivery                | surface                                                                                    |
| Interfaces              | facet, HTTP, WebSocket, schedule, representation                                           |
| Data semantics          | storage, projection, query                                                                 |
| Cross-cutting semantics | role, kind, purpose, access, execution, lifecycle                                          |

This is an inventory, not a closed universe.

---

## 19. Known vocabulary drift to audit

The current repository already contains several cases that should be reviewed.

| Current state                                                                                                                      | Concern                                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Context docs say Runtime IR is “evidence, not authority”                                                                           | Contradicts the architecture. Runtime IR is the semantic authority.                                                                          |
| Runtime IR `schema.projection` → context `schema.source`                                                                           | Same semantic concept has been renamed between layers. Prefer one canonical term.                                                            |
| Runtime mutation vocabulary has `create-only`, `system`, `context`, `transition`, while `context/schema.md` documents fewer values | Documentation/context vocabulary has drifted from the canonical contract.                                                                    |
| Context expression nodes normalize several Runtime IR expression forms into `function`                                             | May be valid projection, but must be explicitly documented as derived structural normalization rather than canonical vocabulary replacement. |
| Authoring uses names such as `primitiveKind`, `genericKind`, `surfaceKind` in some internal state contracts                        | Audit whether these are implementation-only collision avoidance or user-visible competing vocabulary.                                        |
| Context has `generated.*`, `file.*`, dependency groups and naming variants                                                         | Valid planning/derived vocabulary, but they must stay explicitly outside semantic vocabulary.                                                |

The goal of the audit is not to force identical object shapes across all tiers.

The goal is:

> identical semantic concept → identical canonical word.

---

## 20. Vocabulary change procedure

Any proposed vocabulary change should record:

| Question                                          | Required answer                                                    |
| ------------------------------------------------- | ------------------------------------------------------------------ |
| What concept is missing or incorrectly named?     | Concrete semantic need                                             |
| Where was the need discovered?                    | Real project, authoring requirement or pack                        |
| What existing vocabulary was considered?          | Reuse before expansion                                             |
| Why is the concept implementation-neutral?        | Neutrality argument                                                |
| Which different implementations can represent it? | Portability evidence                                               |
| Which tier owns it?                               | Authoring / Runtime IR / derived context / planning / pack / usage |
| Does it collide with an existing word?            | Collision analysis                                                 |
| Does it rename an existing concept?               | Migration/alignment impact                                         |
| Which layers must change?                         | Authoring, protocol, IR, context, docs, packs                      |
| Does it weaken determinism?                       | Must be no                                                         |

A semantic vocabulary change is incomplete until all affected layers agree again.

---

## 21. Drift is a defect

Vocabulary drift is not merely a documentation issue.

It makes Dryv harder for:

```text
humans
AI agents
pack authors
authoring implementations
template authors
engine maintainers
```

to reason about.

If one concept becomes:

```text
projection
source
derived schema
mapped schema
```

depending on the layer, Dryv begins requiring translation knowledge.

That defeats one of its strongest properties.

The desired experience is:

```text
learn the Dryv concept once
        ↓
recognize it in Authoring
        ↓
recognize it in Runtime IR
        ↓
recognize it in Context
        ↓
use it in Packs
```

Vocabulary is therefore part of Dryv's architecture, not merely naming style.

---

## 22. Final rule

Before adding a new word to Dryv, ask:

> Does Dryv need to understand this meaning, or does only an implementation need to know how to represent it?

If only an implementation needs it:

```text
put it in the pack.
```

If only an authoring language needs it for convenience:

```text
keep it in authoring and compile it away.
```

If only templates need a deterministic convenience over existing meaning:

```text
make it explicitly derived context.
```

If it describes durable, portable meaning that Dryv itself must understand:

```text
consider it for Canonical Runtime IR.
```

And if the current vocabulary already expresses it:

```text
add nothing.
```
