Skip to content

Core spec: document root cannot carry ai_context or custom_extensions #322

Description

@eisber

Problem

The document root is the only node in the core spec with no ai_context and no custom_extensions.

Both keys appear on SemanticModel, Dataset, Field, Metric and Relationship. The root is closed (additionalProperties: false) with only version and semantic_model.

Because semantic_model is a list, a document can hold several models — but guidance that governs all of them has nowhere to live.

Concretely: we generate Ossie from an agent that federates several data sources, emitting one semantic_model per source. The agent's instructions apply to the whole document. Today the only way to express that is to copy them into every model's ai_context, which means:

  • shared instruction is duplicated N times, and drifts;
  • a consumer cannot distinguish "this was document-wide" from "this is genuinely specific to this model";
  • there is no place at all for document-scoped vendor metadata.

Precedent inside Ossie

This is not a new concept for the project. An ontology document already carries ai_context on its root, and it $refs this specification's AIContext definition:

"ai_context": { "$ref": "../core-spec/osi-schema.json#/$defs/AIContext" }

So the core spec already defines document-wide AI context — the core document root was simply the only root that never consumed it.

Proposal

Add two optional keys to the core document root:

  • ai_context$ref: #/$defs/AIContext (the existing definition, unchanged)
  • custom_extensions — array of the existing #/$defs/CustomExtension

Semantics: document-level context applies to every semantic model in the document; model-level ai_context adds to it and takes precedence where the two conflict.

required and additionalProperties: false are unchanged, both keys are optional, and existing documents validate exactly as before. No new $defs, no breaking change.

Notes / interaction with other work

Happy to raise this on dev@ if that is preferred before any code review. I have a branch ready if there is appetite for the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions