Skip to content

scm schema (v0.5)

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

PropertyTypeRequiredDescription
kind"scm-file"yes
schemaVersion"0.5.0" | "0.4.0" | "0.3.0" | "0.2.0" | "0.1.0"yesCurrent 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).
screensScmScreen[]yes
navigationsScmNavigation[]yes
flowsScmFlow[]yes
notesModelNote[]noNode notes (see parser/model-note.ts).
VisualisationSetupVisualisationSetupno
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"

PropertyTypeRequiredDescription
kind"flow"yes
idstringyes
namestringyes
descriptionstringno
stepsScmFlowStep[]yes
coversobjectnoTS-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").
notesModelNote[]noNode notes (see parser/model-note.ts).
PropertyTypeRequiredDescription
screenstringyes
actionstringno
viastringno
guardstringno

Type: "push" | "modal" | "redirect" | "drawer" | "tab" | "deep-link"

PropertyTypeRequiredDescription
kind"navigation"yes
idstringyes
sourcestringyes
targetstringyes
sourceTriggerstringnoTrigger on the FROM (source) side of the navigation.
triggerstringnoTrigger on the TO (target) side of the navigation.
navTypeScmNavTypeyes
guardstringno
storystringno
animationstringno
notesModelNote[]noNode notes (see parser/model-note.ts).
PropertyTypeRequiredDescription
kind"screen"yes
idstringyes
namestringyes
routestringno
screenTypeScmScreenTypeyes
purposestringno
iconstringno
aggregatestringno
storiesstring[]no
requirementsstring[]no
zonesstring[]no
sectionsScmSection[]no
positionobjectno
aspectsRecord<string, Record&lt;string, unknown&gt;>no
childrenstring[]no
layerScmScreenLayernoArchitectural 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).
accessibilityScmScreenAccessibilitynoExplicit 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.
notesModelNote[]noNode notes (see parser/model-note.ts).

Screen exposure. “public” is opt-in and explicit; every other screen (including one whose accessibility key is absent) is “protected”.

Type: "public" | "protected"

Type: "presentation" | "business" | "data"

Type: "form" | "list" | "detail" | "dashboard" | "auth" | "modal"

PropertyTypeRequiredDescription
namestringyes
sourcestringno

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

PropertyTypeRequiredDescription
nodePositionsRecord<string, object>yes
zoomLevelnumberyes
viewportobjectno
updatedAtstringno

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.

↓ 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-screen.json — Context Studio canvas view

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)
demo-01-single-screen.json
{
"kind": "scm-file",
"schemaVersion": "0.1.0",
"screens": [
{
"kind": "screen",
"id": "home",
"name": "Home",
"route": "/",
"screenType": "dashboard",
"zones": ["Public"]
}
],
"navigations": [],
"flows": []
}
↓ 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-travel-booking-screens.json — Context Studio canvas view

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)
demo-02-travel-booking-screens.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": []
}
↓ 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-admin-zones.json — Context Studio canvas view

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)
demo-03-admin-zones.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": []
}
↓ 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-checkout-flows.json — Context Studio canvas view

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)
demo-04-checkout-flows.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": []
}

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.

paste into AGENTS.md / CLAUDE.md
- **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.