scm schema (v0.5)
The models/scm.json file is validated by the normative JSON Schema published at its canonical URL:
- $id: https://contextbrew.dev/schemas/scm/v0.5/schema.json
- Format version:
0.5.0 - Schema dialect: draft-07
- Validate with:
ctx schema scmor any JSON Schema validator (ajv, VS Code, …)
Root object: ScmFile
Section titled “Root object: ScmFile”| Property | Type | Required | Description |
|---|---|---|---|
kind | "scm-file" | yes | |
schemaVersion | "0.5.0" | "0.4.0" | "0.3.0" | "0.2.0" | "0.1.0" | yes | Current SCM schema version. Accepts 0.1.0 (legacy), 0.2.0 (nav types), 0.3.0 (screen layers), 0.4.0 (notes), and 0.5.0 (explicit public/protected accessibility). |
screens | ScmScreen[] | yes | |
navigations | ScmNavigation[] | yes | |
flows | ScmFlow[] | yes | |
notes | ModelNote[] | no | Node notes (see parser/model-note.ts). |
VisualisationSetup | VisualisationSetup | no |
Definitions
Section titled “Definitions”ModelNote
Section titled “ModelNote”| Property | Type | Required | Description |
|---|---|---|---|
kind | "model-note" | yes | |
id | string | yes | Stable id ("note-" + 12 hex chars); survives JSON round-trips. |
audience | ModelNoteAudience | yes | Who the note is for. Drives delivery: only "agent" reaches agent payloads. |
text | string | yes | Markdown body. |
author | string | no | |
createdAt | string | no | ISO 8601 timestamps. |
updatedAt | string | no | |
resolved | boolean | no | Lifecycle flag — resolved ≠ deleted. |
field | string | no | Optional sub-node scope: a member/property name of the anchored node. |
ModelNoteAudience
Section titled “ModelNoteAudience”Type: "user" | "agent"
ScmFlow
Section titled “ScmFlow”| Property | Type | Required | Description |
|---|---|---|---|
kind | "flow" | yes | |
id | string | yes | |
name | string | yes | |
description | string | no | |
steps | ScmFlowStep[] | yes | |
covers | object | no | TS-core-127: explicit COVERS section from the DSL — the story the flow belongs to plus the aggregates/requirements it touches. The link-index scanner emits covers links from it (createdBy "user"). |
notes | ModelNote[] | no | Node notes (see parser/model-note.ts). |
ScmFlowStep
Section titled “ScmFlowStep”| Property | Type | Required | Description |
|---|---|---|---|
screen | string | yes | |
action | string | no | |
via | string | no | |
guard | string | no |
ScmNavType
Section titled “ScmNavType”Type: "push" | "modal" | "redirect" | "drawer" | "tab" | "deep-link"
ScmNavigation
Section titled “ScmNavigation”| Property | Type | Required | Description |
|---|---|---|---|
kind | "navigation" | yes | |
id | string | yes | |
source | string | yes | |
target | string | yes | |
sourceTrigger | string | no | Trigger on the FROM (source) side of the navigation. |
trigger | string | no | Trigger on the TO (target) side of the navigation. |
navType | ScmNavType | yes | |
guard | string | no | |
story | string | no | |
animation | string | no | |
notes | ModelNote[] | no | Node notes (see parser/model-note.ts). |
ScmScreen
Section titled “ScmScreen”| Property | Type | Required | Description |
|---|---|---|---|
kind | "screen" | yes | |
id | string | yes | |
name | string | yes | |
route | string | no | |
screenType | ScmScreenType | yes | |
purpose | string | no | |
icon | string | no | |
aggregate | string | no | |
stories | | no | |
requirements | | no | |
zones | | no | |
sections | ScmSection[] | no | |
position | object | no | |
aspects | Record<string, Record<string, unknown>> | no | |
children | | no | |
layer | ScmScreenLayer | no | Architectural tier this screen lives on (SCM-COPY-03). Default "presentation" when absent — the historical assumption. Screens on the "business" or "data" layer typically need an explicit access rule (ACM gap analysis surfaces a warning when they don't). |
accessibility | ScmScreenAccessibility | no | Explicit exposure of this screen (ACM completion gate). ABSENT means "protected" — the only default. Publicness is never inferred: not from the screen name, not from a /login-shaped route, not from screenType: "auth", not from a guest/public/anonymous role, and not from the absence of ACM rules. An author must say accessibility: public (JSON) or ACCESSIBILITY: public (DSL) to make a screen public. |
notes | ModelNote[] | no | Node notes (see parser/model-note.ts). |
ScmScreenAccessibility
Section titled “ScmScreenAccessibility”Screen exposure. “public” is opt-in and explicit; every other screen (including one whose accessibility key is absent) is “protected”.
Type: "public" | "protected"
ScmScreenLayer
Section titled “ScmScreenLayer”Type: "presentation" | "business" | "data"
ScmScreenType
Section titled “ScmScreenType”Type: "form" | "list" | "detail" | "dashboard" | "auth" | "modal"
ScmSection
Section titled “ScmSection”| Property | Type | Required | Description |
|---|---|---|---|
name | string | yes | |
source | string | no |
VisualisationSetup
Section titled “VisualisationSetup”INTERNAL: Context Studio canvas state only; never emitted to coding agents.
| Property | Type | Required | Description |
|---|---|---|---|
nodePositions | Record<string, object> | yes | |
zoomLevel | number | yes | |
viewport | object | no | |
updatedAt | string | no |
Sample documents
Section titled “Sample documents”Representative models/scm.json files committed under samples/scm/. 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.
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.
Open the raw JSON in a new tab(demo-01-single-screen.json). The full source is also expanded in the <details> below this preview.
Demo 1 — minimal SCM file: a single screen on the Public zone. The smallest viable SCM shape.
demo-01-single-screen.json — Demo 1 — minimal SCM file: a single screen on the Public zone. The smallest viable SCM shape. (expand for full JSON)
{ "kind": "scm-file", "schemaVersion": "0.1.0", "screens": [ { "kind": "screen", "id": "home", "name": "Home", "route": "/", "screenType": "dashboard", "zones": ["Public"] } ], "navigations": [], "flows": []}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.
Open the raw JSON in a new tab(demo-02-travel-booking-screens.json). The full source is also expanded in the <details> below this preview.
Demo 2 — multi-screen SCM with aggregate/story/requirement linkage, sections, and zone classification. The canonical 'realistic' example.
demo-02-travel-booking-screens.json — Demo 2 — multi-screen SCM with aggregate/story/requirement linkage, sections, and zone classification. The canonical ‘realistic’ example. (expand for full JSON)
{ "kind": "scm-file", "schemaVersion": "0.1.0", "screens": [ { "kind": "screen", "id": "search", "name": "Search", "route": "/search", "screenType": "form", "icon": "search", "purpose": "Search for flights by route and date.", "aggregate": "Flight", "stories": ["US-001"], "requirements": ["SEARCH-001"], "zones": ["Public"] }, { "kind": "screen", "id": "results", "name": "Search Results", "route": "/flights/search", "screenType": "list", "icon": "list", "purpose": "Show available flights.", "aggregate": "Flight", "stories": ["US-001"], "requirements": ["SEARCH-001"], "sections": [ { "name": "Flight List", "source": "Flight.route/departureTime/price" }, { "name": "Filters", "source": "Flight.origin/destination/price" } ], "zones": ["Search"] }, { "kind": "screen", "id": "booking-detail", "name": "Booking Detail", "route": "/bookings/:id", "screenType": "detail", "icon": "ticket", "purpose": "View a booking, cancel or modify.", "aggregate": "Booking", "stories": ["US-002"], "requirements": ["BOOK-001"], "zones": ["Authenticated"] } ], "navigations": [], "flows": []}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.
Open the raw JSON in a new tab(demo-03-admin-zones.json). The full source is also expanded in the <details> below this preview.
Demo 3 — SCM with role-gated Admin zone (accessRoles), exercising the cross-model access-control integration with ACM.
demo-03-admin-zones.json — Demo 3 — SCM with role-gated Admin zone (accessRoles), exercising the cross-model access-control integration with ACM. (expand for full JSON)
{ "kind": "scm-file", "schemaVersion": "0.1.0", "screens": [ { "kind": "screen", "id": "admin-users", "name": "Admin Users", "route": "/admin/users", "screenType": "list", "icon": "users", "purpose": "Manage users (admin-only).", "aggregate": "User", "stories": [], "requirements": ["ADMIN-001"], "zones": ["Admin"] }, { "kind": "screen", "id": "admin-audit", "name": "Audit Log", "route": "/admin/audit", "screenType": "list", "icon": "shield", "purpose": "View audit log entries.", "aggregate": "AuditEntry", "stories": [], "requirements": ["ADMIN-007"], "zones": ["Admin"] } ], "navigations": [], "flows": []}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.
Open the raw JSON in a new tab(demo-04-checkout-flows.json). The full source is also expanded in the <details> below this preview.
Demo 4 — SCM with explicit flows array (multi-screen checkout flow). Exercises the flow-level abstraction over screen-level navigations.
demo-04-checkout-flows.json — Demo 4 — SCM with explicit flows array (multi-screen checkout flow). Exercises the flow-level abstraction over screen-level navigations. (expand for full JSON)
{ "kind": "scm-file", "schemaVersion": "0.1.0", "screens": [ { "kind": "screen", "id": "checkout-cart", "name": "Cart", "route": "/cart", "screenType": "detail", "icon": "cart", "purpose": "Review items in the cart.", "aggregate": "Cart", "stories": ["US-CART-01"], "requirements": ["CART-001"], "zones": ["Authenticated"] }, { "kind": "screen", "id": "checkout-payment", "name": "Payment", "route": "/checkout/payment", "screenType": "form", "icon": "credit-card", "purpose": "Enter payment details.", "aggregate": "Order", "stories": ["US-PAY-01"], "requirements": ["PAY-001"], "zones": ["Checkout"] }, { "kind": "screen", "id": "checkout-confirm", "name": "Confirmation", "route": "/checkout/confirm", "screenType": "detail", "icon": "check", "purpose": "Order confirmation.", "aggregate": "Order", "stories": ["US-CONFIRM-01"], "requirements": ["CONFIRM-001"], "zones": ["Checkout"] } ], "flows": [ { "kind": "flow", "id": "checkout-flow", "name": "Checkout", "description": "Standard checkout flow.", "steps": [ { "screen": "checkout-cart" }, { "screen": "checkout-payment" }, { "screen": "checkout-confirm" } ] } ], "navigations": []}What this model produces
Section titled “What this model produces”The scm 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.
- **SCM v0.5.0** — `models/scm.json`. Produces: Screen docs, route guards, navigation/route/guard test suites, per-screen block tests. Oracle: navigation and route tests must pass against the implemented router; every screen needs its block tests. Downstream: `ctxbrew semantics scm` · `ctxbrew://semantics/scm/v0.5.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 scm --schema-version 0.5.0 - MCP —
ctxbrew://semantics/scm/v0.5.0 - HTTP —
https://contextbrew.dev/schemas/scm/v0.5/semantics.json
See the schemas overview for the versioning policy and how these files are generated and kept in sync.








