Skip to content

Schemas Overview

Every file format ContextBrew produces has a normative JSON Schema, generated from the same TypeScript definitions the platform itself runs on. If a field exists in a model file, the schema describes it — and if the schema changes, it changed because the source code changed, in the same commit.

That makes structural validity a guarantee of construction, not an observation: schemas carry additionalProperties: false on every object shape and are generated from the shipped, tested types, so a ContextBrew model file cannot contain an unvalidated field. What the contents mean — whether they are true of your code — is a different instrument: that is what the oracle (tests brewed to fail first) and the drift checks are for.

Format File Latest version Schema
DDD model models/ddd.json 0.2.0 ddd schema
USM (user story map) models/usm.json 0.5.0 usm schema
SCM (screens) models/scm.json 0.5.0 scm schema
DSM (data storage) models/dsm.json 0.2.0 dsm schema
SIM (system integration) models/sim.json 0.4.0 sim schema
CBRL requirements *.cbrl serialized 0.3.0 cbrl schema
ABSL (agent behavior) models/absl.json 0.3.0 absl schema
C4 (architecture) models/c4.json 0.5.0 c4 schema
Context map (DDD strategic) models/context-map.json 0.1.0 context-map schema
ESDM (event-sourced DDD) models/esdm.json 0.2.0 esdm schema
Decisions models/decision.json 0.1.0 decision schema
ACM (access connectivity) models/acm.json 0.1.0 acm schema
Evals (evaluation suites) models/evals.json 0.1.0 evals schema
Archive manifest manifest.json 1.3.0 ctxbrew-manifest schema
History log history/log.json 1.3.0 history-log schema
Recipe manifest .contextbrew/recipes/<id>.json 0.4.0 recipe-manifest schema
Recipe lock recipe.lock 1.0.0 recipe-lock schema
Dispatch envelope .contextbrew/dispatches/<id>/envelope.json 0.4.0 dispatch-envelope schema

Per-format version history lives on each schema page and in Versioning & Compatibility. The two newest formats:

  • Evals — tiered evaluation suites (generation / understanding / behavior) that recipe manifests reference by id; the eval_suite_pass release gate enforces them at a 0.7 pass-rate threshold.
  • Dispatch envelope — the captured agent-session transcript every dispatch writes: messages, tool calls, verdict, metrics, plan coverage, and the pour vintage and canon hash it ran against.

The model files plus the manifest and history log are the contents of a .ctxbrew archive — produced and consumed by Context Studio’s export/import and the format tooling. The CLI has no pack/unpack pair.

Each schema has a stable $id URL on contextbrew.dev and is served at exactly that URL with Content-Type: application/schema+json:

https://contextbrew.dev/schemas/<format>/v<major.minor>/schema.json

For example: https://contextbrew.dev/schemas/ddd/v0.2/schema.json. The URLs are permanent: a format change ships as a new version directory, never as an edit to an existing one — the same immutability contract as the AAS canonical URIs.

  • Format versions are semver strings stamped into each file (schemaVersion: "0.1.0").
  • Schema directories use v<major.minor>; patch releases ride within the same directory.
  • Evolution is additive: new fields are optional, old readers tolerate unknown fields. Breaking changes bump the major version and add a new directory alongside the old one — old version directories are never edited or removed, so files written against an older version keep validating forever.
  • The generator asserts that each schema directory’s version matches the version literal in the TypeScript source — the two cannot silently diverge.

To check a concrete before/after model pair against a versioning policy from the CLI, run ctxbrew evolution check <before> <after> (policies: semver, calver, immutable) — the same check backs the schema_evolution_safe release gate. See Release Gates for the policy semantics.

Any JSON Schema (draft-07) validator works. With ajv:

import Ajv from "ajv";
import AjvFormats from "ajv-formats";
import fs from "node:fs";
const ajv = new Ajv({ strict: false });
AjvFormats(ajv);
const schema = JSON.parse(
fs.readFileSync("schemas/ddd/v0.2/schema.json", "utf8"),
);
const validate = ajv.compile(schema);
const model = JSON.parse(fs.readFileSync("models/ddd.json", "utf8"));
if (!validate(model)) {
console.error(validate.errors);
}

Or with the CLI, which prints any schema from anywhere:

Terminal window
ctxbrew schema # list all formats
ctxbrew schema ddd # print the ddd schema JSON
ctxbrew schema ddd -o ddd.schema.json

The schemas, these reference pages, and the served files are all generated by one script from the TypeScript source of truth. When a model type changes, the regeneration happens automatically in the same commit (a pre-commit hook), and CI fails on any drift. In other words: these pages cannot go stale — they are not documentation about the code, they are rendered from it.

Two doctrine rules apply to everything on these pages: a file is judged against the schema version it declares, never the newest one; and the tooling refuses rather than warns — drift fails the build, it is never a warning in the logs. For the development methodology behind that posture, see The ContextBrew SDLC.

Each format version ships with a machine-readable conformance bundle in the repository under schemas/conformance/<format>/<version>/: one valid document (valid/model.json) that must validate against the schema, and deterministic invalid mutations (invalid/*.json — unknown property, wrong discriminator, wrong version, missing required field) that must be rejected. The valid documents come from the real parsers or the same committed samples our CI validates, and the invalid cases are generated from the schemas themselves, so the bundle cannot silently rot.

This means you can verify any draft-07 validator against ContextBrew’s formats — or verify your own tooling’s output — without installing ContextBrew:

Terminal window
npx ajv-cli -s schemas/ddd/v0.2/schema.json \
-d schemas/conformance/ddd/v0.2/valid/model.json # must pass
npx ajv-cli -s schemas/ddd/v0.2/schema.json \
-d schemas/conformance/ddd/v0.2/invalid/ -R # must fail

See schemas/conformance/README.md in the repository for the full case catalog. The bundle is repository content: it is not served at the schema $id URLs.