Skip to content

sim schema (v0.4)

The models/sim.json file is validated by the normative JSON Schema published at its canonical URL:

PropertyTypeRequiredDescription
kind"sim-file"yes
schemaVersionSimSchemaVersionyes
contextsSimSystemContext[]yes
edgesSimDependencyEdge[]yes
contractsSimContract[]yes
invariantsSimCrossCuttingInvariant[]yes
notesModelNote[]noNode notes (see parser/model-note.ts).
VisualisationSetupVisualisationSetupno

Type: "critical" | "standard" | "internal"

PropertyTypeRequiredDescription
kind"model-note"yes
idstringyesStable id ("note-" + 12 hex chars); survives JSON round-trips.
audienceModelNoteAudienceyesWho the note is for. Drives delivery: only "agent" reaches agent payloads.
textstringyesMarkdown body.
authorstringno
createdAtstringnoISO 8601 timestamps.
updatedAtstringno
resolvedbooleannoLifecycle flag — resolved ≠ deleted.
fieldstringnoOptional sub-node scope: a member/property name of the anchored node.

Type: "user" | "agent"

Type: "ddd_aggregate" | "ddd_value_object" | "ddd_domain_event" | "usm_story" | "usm_persona" | "cbrl_requirement" | "scm_screen" | "dsm_table" | "dsm_schema"

PropertyTypeRequiredDescription
kind"context-component"yes
idstringyes
systemContextIdstringyes
componentTypeSimComponentTypeyes
componentIdstringyes
componentNamestringyes

Type: "service" | "bounded-context" | "serverless-function" | "module"

PropertyTypeRequiredDescription
kind"contract"yes
idstringyes
namestringyes
contractTypeSimContractTypeyes
schemaRecord<string, unknown>yes
versionstringyes
statusSimContractStatusyes
versioningStrategySimContractVersioningStrategynoVersioning semantics for the version field. Defaults to "semver".
edgeSourceIdstringno
edgeTargetIdstringno
edgeTypeSimEdgeTypeno
notesModelNote[]noNode notes (see parser/model-note.ts).

Type: "draft" | "active" | "deprecated" | "retired"

Type: "api" | "event" | "database"

How a contract’s version field is interpreted and bumped. - semver (default): MAJOR.MINOR.PATCH semantic versioning. - calver: Calendar-based (YYYY.MM.DD or similar) — diffs still emit contract_version_bump records but the level is inferred from string change rather than semver rules. - immutable: Contract version never changes; any version diff is a breaking major-level signal (the contract was replaced in place).

Type: "semver" | "calver" | "immutable"

Type: "low" | "medium" | "high" | "critical"

PropertyTypeRequiredDescription
kind"cross-cutting-invariant"yes
idstringyes
namestringyes
expressionstringyes
involvedContextsstring[]yes
severitySimInvariantSeverityyes
categorySimInvariantCategoryyes
notesModelNote[]noNode notes (see parser/model-note.ts).
PropertyTypeRequiredDescription
kind"dependency-edge"yes
idstringyes
sourceContextIdstringyes
targetContextIdstringyes
edgeTypeSimEdgeTypeyes
contractIdstringno
descriptionstringno
criticalitySimCriticalityyes
criticalityTierCriticalityIdnoPlatform criticality canon tier (0.3.0 — C19-A), overriding the legacy severity→tier mapping. Optional and OMITTED when unset, so pre-0.3.0 models produce byte-identical files. Read paths must use effectiveCriticality (criticalityTier ?? simSeverityToCriticality).
notesModelNote[]noNode notes (see parser/model-note.ts).

Type: "synchronous" | "asynchronous" | "shared-database" | "event-driven"

Type: "consistency" | "performance" | "security" | "compliance"

Type: "warning" | "error" | "critical"

Declared monthly running cost of a service (0.2.0 — M25 cost overlays; the Vantage/CloudZero “$/service” lens). Optional and OMITTED when unknown, so cost-free models produce byte-identical files. Observed costs arrive separately via the M4 live-state collector convention — this is the declared, authored number.

PropertyTypeRequiredDescription
amountnumberyesMonthly amount in currency (e.g. 420, 1240.5).
currencystringyesISO 4217 code (e.g. "USD", "EUR").
sourcestringnoWhere the number came from (e.g. "aws-cost-explorer", "estimate").

Type: "0.1.0" | "0.2.0" | "0.3.0" | "0.4.0"

PropertyTypeRequiredDescription
kind"system-context"yes
idstringyes
namestringyes
contextKindSimContextKindyes
descriptionstringno
ownedAggregatesstring[]no
ownedScreensstring[]no
ownedTablesstring[]no
tagsstring[]no
componentsSimContextComponent[]noThe authoritative cross-model reference list (typed, per T14).
positionobjectno
aspectsRecord<string, Record&lt;string, unknown&gt;>no
monthlyCostSimMonthlyCostnoDeclared monthly running cost (0.2.0 — M25 cost overlays).
notesModelNote[]noNode notes (see parser/model-note.ts).

INTERNAL: Context Studio canvas state only; never emitted to coding agents.

PropertyTypeRequiredDescription
nodePositionsRecord<string, object>yes
zoomLevelnumberyes
viewportobjectno
updatedAtstringno

Representative models/sim.json files committed under samples/sim/. Each demo shows four views — pick the one you want: Canvas (rendered through the same SvelteFlow component the IDE uses), Mermaid (a static-flowchart fallback), Interactive (the live artifact ctx diagram <file> compiles — pan, zoom, click-to-trace, guided stories, exports), or Raw JSON. All assets are locally served; no GitHub redirect.

↓ download

Live artifact compiled by ctx diagram — pan & zoom,/ to find a node, click one to trace reach, T theme, P guided story, ? for all shortcuts.

demo-01-single-context.json — Context Studio canvas view

Demo 1 — minimal SIM file: a single context, no edges. The smallest viable SIM shape.

demo-01-single-context.json — Demo 1 — minimal SIM file: a single context, no edges. The smallest viable SIM shape. (expand for full JSON)
demo-01-single-context.json
{
"kind": "sim-file",
"schemaVersion": "0.1.0",
"contexts": [
{
"kind": "system-context",
"id": "ctx-app",
"name": "Application",
"contextKind": "service",
"description": "Single-context demo.",
"ownedAggregates": ["Order"],
"ownedTables": ["orders"]
}
],
"edges": [],
"contracts": [],
"invariants": []
}
↓ download

Live artifact compiled by ctx diagram — pan & zoom,/ to find a node, click one to trace reach, T theme, P guided story, ? for all shortcuts.

demo-02-orders-billing.json — Context Studio canvas view

Demo 2 — SIM with two contexts and a synchronous dependency edge tagged critical. The canonical 'realistic' example.

demo-02-orders-billing.json — Demo 2 — SIM with two contexts and a synchronous dependency edge tagged critical. The canonical ‘realistic’ example. (expand for full JSON)
demo-02-orders-billing.json
{
"kind": "sim-file",
"schemaVersion": "0.3.0",
"contexts": [
{
"kind": "system-context",
"id": "ctx-orders",
"name": "Orders",
"contextKind": "service",
"description": "Owns the order lifecycle.",
"ownedAggregates": ["Order"],
"ownedTables": ["orders", "order_lines"]
},
{
"kind": "system-context",
"id": "ctx-billing",
"name": "Billing",
"contextKind": "module",
"description": "Owns invoicing and payments.",
"ownedAggregates": ["Invoice", "Payment"],
"ownedTables": ["invoices", "payments"]
}
],
"edges": [
{
"kind": "dependency-edge",
"id": "edge-orders-billing",
"sourceContextId": "ctx-orders",
"targetContextId": "ctx-billing",
"edgeType": "synchronous",
"criticality": "critical",
"criticalityTier": "critical",
"contractId": "contract-billing-api",
"description": "Orders calls Billing to issue invoices."
}
],
"contracts": [
{
"kind": "contract",
"id": "contract-billing-api",
"name": "Billing API",
"contractType": "api",
"schema": {},
"version": "1.0.0",
"status": "active"
}
],
"invariants": []
}
↓ download

Live artifact compiled by ctx diagram — pan & zoom,/ to find a node, click one to trace reach, T theme, P guided story, ? for all shortcuts.

demo-03-multi-context-chain.json — Context Studio canvas view

Demo 3 — SIM with four contexts in a chain (Frontend → API → Orders → Warehouse) mixing synchronous and asynchronous edges.

demo-03-multi-context-chain.json — Demo 3 — SIM with four contexts in a chain (Frontend → API → Orders → Warehouse) mixing synchronous and asynchronous edges. (expand for full JSON)
demo-03-multi-context-chain.json
{
"kind": "sim-file",
"schemaVersion": "0.3.0",
"contexts": [
{
"kind": "system-context",
"id": "ctx-frontend",
"name": "Frontend",
"contextKind": "module",
"description": "Web SPA.",
"ownedAggregates": [],
"ownedTables": []
},
{
"kind": "system-context",
"id": "ctx-api",
"name": "API",
"contextKind": "service",
"description": "Backend API gateway.",
"ownedAggregates": [],
"ownedTables": []
},
{
"kind": "system-context",
"id": "ctx-orders",
"name": "Orders",
"contextKind": "service",
"ownedAggregates": ["Order"],
"ownedTables": ["orders"]
},
{
"kind": "system-context",
"id": "ctx-warehouse",
"name": "Warehouse",
"contextKind": "module",
"ownedAggregates": ["Shipment"],
"ownedTables": ["shipments"]
}
],
"edges": [
{
"kind": "dependency-edge",
"id": "edge-frontend-api",
"sourceContextId": "ctx-frontend",
"targetContextId": "ctx-api",
"edgeType": "synchronous",
"criticality": "critical",
"criticalityTier": "critical",
"contractId": "contract-public-api"
},
{
"kind": "dependency-edge",
"id": "edge-api-orders",
"sourceContextId": "ctx-api",
"targetContextId": "ctx-orders",
"edgeType": "synchronous",
"criticality": "high",
"criticalityTier": "standard",
"contractId": "contract-orders-internal-api"
},
{
"kind": "dependency-edge",
"id": "edge-orders-warehouse",
"sourceContextId": "ctx-orders",
"targetContextId": "ctx-warehouse",
"edgeType": "asynchronous",
"criticality": "medium",
"criticalityTier": "internal",
"contractId": "contract-shipment-events",
"description": "Orders publishes ShipmentRequested events."
}
],
"contracts": [
{
"kind": "contract",
"id": "contract-orders-internal-api",
"name": "Orders Internal API",
"contractType": "api",
"schema": {},
"version": "1.0.0",
"status": "active"
},
{
"kind": "contract",
"id": "contract-public-api",
"name": "Public API",
"contractType": "api",
"schema": {},
"version": "1.0.0",
"status": "active"
},
{
"kind": "contract",
"id": "contract-shipment-events",
"name": "Shipment Events",
"contractType": "event",
"schema": {},
"version": "1.0.0",
"status": "active"
}
],
"invariants": []
}
↓ download

Live artifact compiled by ctx diagram — pan & zoom,/ to find a node, click one to trace reach, T theme, P guided story, ? for all shortcuts.

demo-04-fan-out-events.json — Context Studio canvas view

Demo 4 — SIM with one source context fanning out to two consumers via asynchronous event contracts. Exercises the event-bus topology.

demo-04-fan-out-events.json — Demo 4 — SIM with one source context fanning out to two consumers via asynchronous event contracts. Exercises the event-bus topology. (expand for full JSON)
demo-04-fan-out-events.json
{
"kind": "sim-file",
"schemaVersion": "0.1.0",
"contexts": [
{
"kind": "system-context",
"id": "ctx-orders",
"name": "Orders",
"contextKind": "service",
"ownedAggregates": ["Order"],
"ownedTables": ["orders"]
},
{
"kind": "system-context",
"id": "ctx-billing",
"name": "Billing",
"contextKind": "service",
"ownedAggregates": ["Invoice"],
"ownedTables": ["invoices"]
},
{
"kind": "system-context",
"id": "ctx-notifications",
"name": "Notifications",
"contextKind": "service",
"ownedAggregates": [],
"ownedTables": ["notifications"]
}
],
"edges": [
{
"kind": "dependency-edge",
"id": "edge-orders-billing-sync",
"sourceContextId": "ctx-orders",
"targetContextId": "ctx-billing",
"edgeType": "synchronous",
"criticality": "critical",
"contractId": "contract-billing-sync"
},
{
"kind": "dependency-edge",
"id": "edge-orders-notifications-async",
"sourceContextId": "ctx-orders",
"targetContextId": "ctx-notifications",
"edgeType": "asynchronous",
"criticality": "low",
"contractId": "contract-order-events"
},
{
"kind": "dependency-edge",
"id": "edge-billing-notifications-async",
"sourceContextId": "ctx-billing",
"targetContextId": "ctx-notifications",
"edgeType": "asynchronous",
"criticality": "medium",
"contractId": "contract-invoice-events"
}
],
"contracts": [
{
"kind": "contract",
"id": "contract-billing-sync",
"name": "Billing Sync",
"contractType": "event",
"schema": {},
"version": "1.0.0",
"status": "active"
},
{
"kind": "contract",
"id": "contract-invoice-events",
"name": "Invoice Events",
"contractType": "event",
"schema": {},
"version": "1.0.0",
"status": "active"
},
{
"kind": "contract",
"id": "contract-order-events",
"name": "Order Events",
"contractType": "event",
"schema": {},
"version": "1.0.0",
"status": "active"
}
],
"invariants": []
}

The sim model is one of the richly-curated records — every downstream surface (CLI, MCP, docs, tests) reads from one record. The pasteable snippet below is the Door 1 anchor a downstream agent should see before touching this model.

paste into AGENTS.md / CLAUDE.md
- **SIM v0.4.0** — `models/sim.json`.
Produces: Topology tests + contract tests over the context dependency graph.
Oracle: topology + contract tests must pass — propagation paths in code may not contradict the authored graph.
Downstream: `ctxbrew semantics sim` · `ctxbrew://semantics/sim/v0.4.0` — read the record first.

The full record (every door — anchor template, tool description hint, response annotations, behavior tripwire, and the complete produced-surface list) is served as JSON at:

  • CLI — ctxbrew semantics sim --schema-version 0.4.0
  • MCP — ctxbrew://semantics/sim/v0.4.0
  • HTTP — https://contextbrew.dev/schemas/sim/v0.4/semantics.json

See the schemas overview for the versioning policy and how these files are generated and kept in sync.