Skip to content

Ontology (Future)

Joe Curlee (w4ffl35) edited this page Jan 30, 2026 · 2 revisions

Universal Type Ontology (Future)

This document defines a concrete proposal for a cross-agent, shared type ontology.

Goal: when two agents exchange Curlee artifacts (bundles, proofs, datasets), they can agree on the meaning of types without guesswork.

Status: design-only (post-MVP). No implementation is implied by this page.

Scope

The ontology is a shared, machine-checkable type definition layer used for:

  • naming shared types across agents/toolchains
  • deterministic layout/encoding so type IDs are stable
  • compatibility checking (can agent B consume artifacts from agent A?)
  • pinning in bundles for reproducible execution and verification

The ontology is explicitly not a general schema language.

In particular, it is out of scope here to define:

  • distributed registries or package discovery
  • type-driven code generation
  • non-deterministic resolution rules
  • a general-purpose theorem language (refinements remain in the Curlee verification fragment)

Core model

Ontology package

An ontology is published as a package with:

  • name: stable identifier (e.g. curlee.core, curlee.std, acme.ml)
  • version: semantic version MAJOR.MINOR.PATCH
  • types: a set of type declarations

Agents never resolve ontology packages from the network during checking/execution. Any ontology material must be provided explicitly (pinned by hash) in the consuming environment.

Type identifiers

Every type has two identifiers:

  • Type name: a human-facing qualified name within a package, e.g. curlee.core.String.
  • Type ID: a stable content-derived ID used for interchange.

Proposed Type ID:

  • type_id = blake3(canonical_type_encoding) (hex)

The canonical encoding must include:

  • ontology package name
  • ontology package version
  • the full canonical declaration of the type (including field order, element types, etc)

Including the package version makes the Type ID unambiguous and eliminates “same name, different meaning” collisions.

Canonical encoding

Canonical encoding must be:

  • deterministic (no map iteration nondeterminism)
  • self-contained (no ambient lookup)
  • stable under whitespace/reformatting

Recommendation: a restricted, canonical JSON format (or S-expression) with:

  • sorted keys
  • explicit arrays for ordered lists
  • UTF-8 only

The exact canonicalization algorithm is part of the ontology spec version.

Supported type forms (initial core)

Start with a small, decidable set sufficient for bundle interchange:

  • primitives: Unit, Bool, Int, String
  • records: named products with ordered fields
  • enums: tagged unions with named variants
  • vectors/tensors: Vector<T, N> and/or Tensor<T, Shape> (shape restricted to small literal tuples)
  • capability tokens: opaque cap <name> types (no user constructors)

Versioning and compatibility

Package versions

Use semantic versioning for ontology packages.

  • MAJOR: incompatible meaning/layout changes.
  • MINOR: backward-compatible additions.
  • PATCH: clarifications/bugfixes that do not change any Type IDs.

Rule: if a change would alter a Type ID for an existing type, it MUST bump MAJOR (or publish a new type name).

Compatibility rules (deterministic)

When consuming an artifact produced against ontology package P@V_req, a consumer may accept it if:

  • it has exactly P@V_req available and pinned (strict mode), OR
  • it has a declared compatibility rule allowing P@V_have to substitute for P@V_req (compat mode)

Compat mode is opt-in and must be decidable and explicit.

Initial compatibility policy proposal:

  • Default is strict: require exact package name@version matches.
  • Optionally allow MAJOR match with MINOR/PATCH >= required, but only if:
    • all referenced Type IDs are present unchanged, AND
    • any added fields/variants are provably irrelevant to the consuming interface, OR
    • an explicit adapter is provided.

This keeps interoperability safe without silently accepting mismatches.

Bundles referencing ontology

Bundles must be able to declare which ontology packages and exact versions they were built against, and (optionally) pin them by content hash.

Proposed bundle extension (future bundle schema, e.g. v2):

ontologies=<pkg>@<ver>:<blake3-hex>,<pkg>@<ver>:<blake3-hex>,...
types=<type_id>,<type_id>,...

Rules:

  • ontologies entries are authoritative inputs like imports pins.
  • types is optional but useful for fast compatibility checks (e.g., “this bundle uses these 12 ontology types”).
  • If an ontology required by the bundle is missing or hash-mismatched, loading fails.

Note: this is intentionally parallel to imports=<path>:<hash> in the current bundle manifest.

Worked example: cross-agent interop constraint

Scenario:

  • Agent A produces a bundle exposing a function that accepts a shared record type.
  • Agent B wants to call it from another environment.

Ontology package acme.chat@1.2.0 defines:

  • acme.chat.Message = { text: curlee.core.String, author: curlee.core.String }

Agent A builds bundle chat_summarize.curlee.bundle and includes:

  • ontologies=acme.chat@1.2.0:<hash>,curlee.core@1.0.0:<hash>
  • types=<type_id(acme.chat.Message)>,<type_id(curlee.core.String)>,...

Agent B environment:

  1. If B has acme.chat@1.2.0 pinned to the same hash, the call boundary is well-defined.
  2. If B only has acme.chat@1.3.0 where Message added a non-optional field timestamp: Int, then:
    • strict mode rejects (different package version; different Type ID)
    • compat mode also rejects unless B supplies an explicit adapter that constructs the v1.2.0 shape (or the producer published a new compatible type name)

This prevents silent drift where one agent assumes a field exists (or not) and the other disagrees.

Desired properties

  • Shared semantics: types mean the same thing across toolchains and agents.
  • Stable identifiers: a canonical ID or hash for each type definition.
  • Versioning: forward-compatible evolution without ambiguity.
  • Deterministic layout: machine-checkable representation with reproducible hashing.
  • Capability awareness: types can express or require capabilities where needed.
  • Proof-friendly: encodings are amenable to SMT reasoning in the MVP fragment.
  • Composability: can reference or embed domain ontologies without conflicts.
  • Minimal surface: start with a small core (primitives, records, enums, vectors).

Open questions

  • Do we standardize on canonical JSON or S-expressions for type encoding?
  • What is the minimal shape language for tensor types that remains decidable and useful?
  • What is the minimal core needed for bundle interchange?
  • How are refinements and contracts attached to shared types?
  • How are capability requirements represented in the ontology?
  • How do we express ownership/linearity and resource constraints?
  • What is the expected trust model for third-party ontologies?
  • How do we prevent ontology drift across agents and tools?

Clone this wiki locally