Skip to content

A complete example

Jot is a small note-taking web app: two capabilities, three flows, three sequences, and the shared records they use. Every record is below.

Your agent sends these 39 records to the room, with the room’s details beside them, and Ready Room checks them together: 0 errors, 0 warnings.

The room’s depth is lightweight, so its capabilities default to DCL 3; writing notes is DCL 4, because a lost save loses the writer’s words.

{
"name": "Jot",
"summary": "A web app where people keep short notes and find them again.",
"outcome": "People keep short notes they can find again on any device.",
"domain": "personal",
"depth": "lightweight"
}
{
"ready": 3,
"kind": "capability",
"id": "write",
"display_id": "CAP-WRITE",
"name": "Write notes",
"summary": "A writer types a short note and saves it within the length limit.",
"outcome": "Every note a writer saves is kept exactly as typed, and a note over the limit is refused before anything is stored.",
"actors": ["actor.writer"],
"order": 1,
"dcl": {
"level": 4,
"basis": "A lost save loses the writer's words, so a failed save stays visible and the text stays in the editor until it is saved."
}
}
{
"ready": 3,
"kind": "capability",
"id": "library",
"display_id": "CAP-LIBRARY",
"name": "Keep a library",
"summary": "A writer lists their notes and archives the ones they no longer need.",
"outcome": "A writer finds any active note in one list, and archived notes leave the list without being lost at once.",
"actors": ["actor.writer"],
"order": 2
}
{
"ready": 3,
"kind": "actor",
"id": "actor.writer",
"display_id": "ACTOR-WRITER",
"name": "Writer",
"side": "person",
"goal": "Keep short notes and find them again later."
}
{
"ready": 3,
"kind": "system",
"id": "system.web",
"display_id": "SYS-WEB",
"name": "Web app",
"system_kind": "app",
"code": "apps/web",
"role": "The editor and the notes list in the browser",
"connections": [{ "to": "system.api", "label": "JSON over HTTPS" }]
}
{
"ready": 3,
"kind": "system",
"id": "system.api",
"display_id": "SYS-API",
"name": "API",
"system_kind": "service",
"code": "apps/api",
"role": "Saves, lists, and archives notes",
"connections": [{ "to": "system.db", "label": "SQL" }],
"units": [
{
"name": "nightly-cleanup",
"unit_kind": "schedule",
"schedule": "Every night at 03:00 UTC"
}
]
}
{
"ready": 3,
"kind": "system",
"id": "system.db",
"display_id": "SYS-DB",
"name": "Database",
"system_kind": "database",
"role": "Writers and their notes"
}

A journey. Save runs Save a note; its two outcomes lead to two steps.

{
"ready": 3,
"kind": "flow",
"id": "write.write-note",
"display_id": "FLOW-WRITE",
"capability": "write",
"title": "Write a note",
"summary": "The writer types a note and saves it, or is told it is too long.",
"subject": "actor.writer",
"steps": [
"write.write-note.type",
"write.write-note.too-long",
"write.write-note.saved"
],
"entries": [
{
"label": "New note",
"from": "library.browse.list",
"to": "write.write-note.type",
"trigger": "library.new-note"
}
]
}
{
"ready": 3,
"kind": "step",
"id": "write.write-note.type",
"flow": "write.write-note",
"title": "Type the note",
"step_kind": "screen",
"interface": "interface.editor",
"copy": { "title": "New note", "actions": ["Cancel"] },
"does": ["Type the note and save it"],
"edges": [
{
"to": "write.write-note.saved",
"trigger": "write.save",
"sequence": "write.save-note",
"outcome": "saved"
},
{
"to": "write.write-note.too-long",
"trigger": "write.save",
"sequence": "write.save-note",
"outcome": "refused",
"secondary": true
},
{ "to": "$return", "trigger": "write.cancel", "secondary": true }
]
}
{
"ready": 3,
"kind": "step",
"id": "write.write-note.too-long",
"flow": "write.write-note",
"title": "Note too long",
"step_kind": "error",
"interface": "interface.editor",
"copy": { "body": ["Notes can be up to {limit} characters."] },
"sees": ["The text stays in the editor with the limit beside it"],
"edges": [{ "to": "write.write-note.type", "trigger": "write.edit-again" }]
}
{
"ready": 3,
"kind": "step",
"id": "write.write-note.saved",
"flow": "write.write-note",
"title": "Note saved",
"step_kind": "outcome",
"interface": "interface.editor",
"presentation": "toast",
"copy": { "title": "Saved" },
"data": [
{ "entity": "data.notes", "access": "write", "state": "write.note.active" }
]
}
{
"ready": 3,
"kind": "trigger",
"id": "write.save",
"display_id": "TRIG-SAVE",
"capability": "write",
"trigger_kind": "action",
"name": "Save",
"actor": "actor.writer",
"interface": "interface.editor"
}
{
"ready": 3,
"kind": "trigger",
"id": "write.cancel",
"capability": "write",
"trigger_kind": "action",
"name": "Cancel",
"actor": "actor.writer",
"interface": "interface.editor"
}
{
"ready": 3,
"kind": "trigger",
"id": "write.edit-again",
"capability": "write",
"trigger_kind": "action",
"name": "Shorten the note",
"actor": "actor.writer",
"interface": "interface.editor"
}
{
"ready": 3,
"kind": "sequence",
"id": "write.save-note",
"display_id": "SEQ-SAVE",
"capability": "write",
"title": "Save a note",
"summary": "The API checks the note's length, stores it, and tells the editor whether it was saved.",
"participants": [
{ "id": "Web", "is": ["system.web"], "label": "Web app" },
{ "id": "API", "is": ["system.api"], "label": "API" },
{ "id": "DB", "is": ["system.db"], "label": "Database" }
],
"outcomes": [
{ "id": "saved", "label": "Saved" },
{ "id": "refused", "label": "Too long" }
],
"items": [
{
"msg": {
"from": "Web",
"to": "API",
"text": "Save the note",
"interface": "interface.save-note",
"http": { "method": "POST", "path": "/api/notes" },
"inputs": [
{ "name": "text", "source": "The editor", "source_kind": "surface" }
]
}
},
{
"msg": {
"from": "API",
"to": "API",
"text": "Check the note's length",
"rules": ["write.length"]
}
},
{
"alt": {
"branches": [
{
"when": "The note is over the limit",
"outcome": "refused",
"items": [
{
"msg": {
"from": "API",
"to": "Web",
"text": "Refused with the limit",
"reply": true,
"results": [
{
"status": 400,
"code": "note_too_long",
"copy": "Notes can be up to {limit} characters."
}
]
}
}
]
},
{
"when": "The note is within the limit",
"outcome": "saved",
"items": [
{
"msg": {
"from": "API",
"to": "DB",
"text": "Store the note",
"ops": [
{
"op": "insert",
"entity": "data.notes",
"set": ["writer_id", "text", "created_at"]
}
]
}
},
{
"msg": {
"from": "API",
"to": "Web",
"text": "Saved",
"reply": true,
"results": [{ "status": 201 }]
}
}
]
}
]
}
}
]
}
{
"ready": 3,
"kind": "rule",
"id": "write.length",
"display_id": "RULE-NOTE-LENGTH",
"capability": "write",
"rule_kind": "decision",
"title": "A note stays within the length limit",
"summary": "Decides whether a note is short enough to save.",
"when": "The note is longer than the limit",
"then": "Saving is refused and the editor shows the limit",
"otherwise": "The note is saved",
"constants": ["constant.max-note-length"]
}
{
"ready": 3,
"kind": "constant",
"id": "constant.max-note-length",
"display_id": "CONST-MAX-NOTE-LENGTH",
"name": "MAX_NOTE_LENGTH",
"value": "10000",
"unit": "characters",
"description": "The most characters one note may hold."
}
{
"ready": 3,
"kind": "rule",
"id": "write.save-fast",
"display_id": "RULE-SAVE-FAST",
"capability": "write",
"rule_kind": "quality",
"title": "Saving feels instant",
"summary": "A writer sees a save confirmed within a second.",
"applies_to": ["write.save-note"],
"measure": "Time from pressing Save to the confirmation, over a week of saves",
"target": "Under one second for 95 in 100 saves"
}

A lifecycle. Note saved names its active state, so Write a note moves it.

{
"ready": 3,
"kind": "flow",
"id": "write.note",
"display_id": "FLOW-NOTE",
"capability": "write",
"title": "Note",
"summary": "A note is active from the moment it is saved until its writer archives it.",
"subject": "data.notes",
"steps": ["write.note.active", "write.note.archived"]
}
{
"ready": 3,
"kind": "step",
"id": "write.note.active",
"flow": "write.note",
"title": "Active",
"step_kind": "state",
"initial": true,
"description": "The note shows in its writer's list.",
"field": "archived_at",
"value": "empty",
"edges": [{ "to": "write.note.archived", "trigger": "trigger.archive-note" }]
}
{
"ready": 3,
"kind": "step",
"id": "write.note.archived",
"flow": "write.note",
"title": "Archived",
"step_kind": "state",
"final": true,
"description": "The note leaves the list and is deleted after the retention period.",
"field": "archived_at",
"value": "set"
}
{
"ready": 3,
"kind": "trigger",
"id": "trigger.archive-note",
"display_id": "TRIG-ARCHIVE",
"trigger_kind": "action",
"name": "Archive",
"actor": "actor.writer",
"interface": "interface.notes-list"
}

Write a note is entered from this list, so Browse notes leads to it.

{
"ready": 3,
"kind": "flow",
"id": "library.browse",
"display_id": "FLOW-LIBRARY",
"capability": "library",
"title": "Browse notes",
"summary": "The writer reads their active notes, newest first, and archives the ones they no longer need.",
"subject": "actor.writer",
"steps": ["library.browse.list", "library.browse.archived"]
}
{
"ready": 3,
"kind": "step",
"id": "library.browse.list",
"flow": "library.browse",
"title": "Your notes",
"step_kind": "screen",
"interface": "interface.notes-list",
"copy": { "title": "Your notes" },
"sees": ["Every active note, newest first"],
"data": [
{ "entity": "data.notes", "access": "read", "state": "write.note.active" }
],
"edges": [
{
"to": "library.browse.archived",
"trigger": "trigger.archive-note",
"sequence": "library.archive-note",
"outcome": "archived"
}
]
}
{
"ready": 3,
"kind": "step",
"id": "library.browse.archived",
"flow": "library.browse",
"title": "Note archived",
"step_kind": "outcome",
"interface": "interface.notes-list",
"presentation": "toast",
"copy": { "title": "Archived" },
"data": [
{
"entity": "data.notes",
"access": "write",
"state": "write.note.archived"
}
]
}
{
"ready": 3,
"kind": "trigger",
"id": "library.new-note",
"capability": "library",
"trigger_kind": "action",
"name": "New note",
"actor": "actor.writer",
"interface": "interface.notes-list"
}
{
"ready": 3,
"kind": "sequence",
"id": "library.archive-note",
"display_id": "SEQ-ARCHIVE",
"capability": "library",
"title": "Archive a note",
"summary": "The API marks the writer's note archived, so it leaves the list.",
"participants": [
{ "id": "Web", "is": ["system.web"], "label": "Web app" },
{ "id": "API", "is": ["system.api"], "label": "API" },
{ "id": "DB", "is": ["system.db"], "label": "Database" }
],
"outcomes": [{ "id": "archived", "label": "Archived" }],
"items": [
{
"msg": {
"from": "Web",
"to": "API",
"text": "Archive the note",
"interface": "interface.archive-note",
"http": { "method": "POST", "path": "/api/notes/{note_id}/archive" }
}
},
{
"msg": {
"from": "API",
"to": "DB",
"text": "Mark the writer's note archived",
"ops": [
{
"op": "update",
"entity": "data.notes",
"by": ["note_id", "writer_id"],
"set": ["archived_at = now"]
}
]
}
},
{
"msg": {
"from": "API",
"to": "Web",
"text": "Archived",
"reply": true,
"results": [{ "status": 204 }]
}
}
]
}

Deleting old notes runs on a schedule, so the sequence names its own trigger:

{
"ready": 3,
"kind": "sequence",
"id": "library.purge-archived",
"display_id": "SEQ-PURGE",
"capability": "library",
"title": "Delete old archived notes",
"summary": "Each night the API deletes notes archived longer than the retention period.",
"trigger": "library.nightly",
"participants": [
{ "id": "API", "is": ["system.api"], "label": "API" },
{ "id": "DB", "is": ["system.db"], "label": "Database" }
],
"outcomes": [],
"items": [
{
"msg": {
"from": "API",
"to": "DB",
"text": "Delete notes archived before the retention period",
"constants": ["constant.archive-retention"],
"ops": [
{
"op": "delete",
"entity": "data.notes",
"index": "I2",
"where": "archived longer than the retention period"
}
]
}
}
]
}
{
"ready": 3,
"kind": "trigger",
"id": "library.nightly",
"display_id": "TRIG-NIGHTLY",
"capability": "library",
"trigger_kind": "schedule",
"name": "The nightly cleanup",
"schedule": "Every night at 03:00 UTC"
}
{
"ready": 3,
"kind": "rule",
"id": "library.retention",
"display_id": "RULE-PURGE-ARCHIVED",
"capability": "library",
"rule_kind": "policy",
"title": "Archived notes are deleted after the retention period",
"summary": "A note archived longer than the retention period is deleted for good.",
"whenever": "A note has been archived for longer than the retention period",
"then": "The note is deleted and cannot be restored",
"sequence": "library.purge-archived",
"constants": ["constant.archive-retention"]
}
{
"ready": 3,
"kind": "constant",
"id": "constant.archive-retention",
"display_id": "CONST-ARCHIVE-RETENTION",
"name": "ARCHIVE_RETENTION",
"value": "30",
"unit": "days",
"description": "How long an archived note is kept before it is deleted."
}
{
"ready": 3,
"kind": "interface",
"id": "interface.editor",
"display_id": "IF-EDITOR",
"interface_kind": "surface",
"surface_kind": "screen",
"name": "Note editor",
"summary": "Where a writer types a new note and saves it.",
"system": "system.web",
"audience": ["actor.writer"],
"route": "/notes/new",
"elements": [
{ "name": "Text area", "states": ["empty", "typing", "over the limit"] },
{
"name": "Save button",
"states": ["enabled", "disabled while saving"],
"copy": "Save"
}
],
"states": ["saving", "saved", "save failed"]
}
{
"ready": 3,
"kind": "interface",
"id": "interface.notes-list",
"display_id": "IF-NOTES",
"interface_kind": "surface",
"surface_kind": "page",
"name": "Notes list",
"summary": "A writer's active notes, newest first, each with an Archive action.",
"system": "system.web",
"audience": ["actor.writer"],
"route": "/notes",
"elements": [
{ "name": "New note", "copy": "New note" },
{
"name": "Note row",
"description": "The first line of the note and when it was saved"
},
{ "name": "Archive", "copy": "Archive" }
],
"states": ["loading", "empty", "notes"]
}
{
"ready": 3,
"kind": "interface",
"id": "interface.save-note",
"display_id": "IF-SAVE-NOTE",
"interface_kind": "operation",
"operation_kind": "endpoint",
"name": "Save a note",
"summary": "Stores a new note for the signed-in writer, or refuses one over the limit.",
"system": "system.api",
"code": "apps/api/src/notes/save.ts",
"http": { "method": "POST", "path": "/api/notes" },
"auth": "The writer's session",
"params": [{ "name": "text", "type": "string", "source": "The editor" }],
"returns": "The new note's id",
"errors": [
{
"code": "note_too_long",
"status": 400,
"when": "The note is over the limit",
"copy": "Notes can be up to {limit} characters."
}
]
}
{
"ready": 3,
"kind": "interface",
"id": "interface.archive-note",
"display_id": "IF-ARCHIVE-NOTE",
"interface_kind": "operation",
"operation_kind": "endpoint",
"name": "Archive a note",
"summary": "Marks one of the signed-in writer's notes archived.",
"system": "system.api",
"http": { "method": "POST", "path": "/api/notes/{note_id}/archive" },
"auth": "The writer's session",
"params": [{ "name": "note_id", "type": "string", "source": "The note row" }],
"returns": "Nothing"
}
{
"ready": 3,
"kind": "entity",
"id": "data.notes",
"display_id": "DATA-NOTE",
"entity_kind": "table",
"table": "note",
"name": "Note",
"summary": "One note a writer saved.",
"columns": [
{ "name": "note_id", "type": "TEXT", "keys": ["PK"] },
{
"name": "writer_id",
"type": "TEXT",
"keys": ["FK"],
"fk": {
"entity": "data.writers",
"column": "writer_id",
"on_delete": "cascade"
},
"nullable": false,
"indexes": ["I1·1"]
},
{
"name": "text",
"type": "TEXT",
"nullable": false,
"check": "length(text) <= 10000",
"constants": ["constant.max-note-length"],
"rule": "At most the length limit"
},
{
"name": "created_at",
"type": "TEXT",
"nullable": false,
"indexes": ["I1·2"]
},
{
"name": "archived_at",
"type": "TEXT",
"nullable": true,
"indexes": ["I1·where", "I2·1"],
"rule": "Set when the writer archives the note; empty while it is active"
}
],
"indexes": [
{
"id": "I1",
"name": "note_writer_active_idx",
"columns": ["writer_id", "created_at DESC"],
"where": "archived_at IS NULL",
"purpose": "Lists a writer's active notes newest first"
},
{
"id": "I2",
"name": "note_archived_idx",
"columns": ["archived_at"],
"where": "archived_at IS NOT NULL",
"purpose": "Finds archived notes past the retention period",
"serves": ["library.purge-archived"]
}
],
"relationships": [
{
"to": "data.writers",
"on": [{ "from": "writer_id", "to": "writer_id" }],
"from_card": "0..many",
"to_card": "1",
"link": "fk",
"on_delete": "cascade",
"label": "A writer has many notes; deleting the writer deletes them"
}
]
}
{
"ready": 3,
"kind": "entity",
"id": "data.writers",
"display_id": "DATA-WRITER",
"entity_kind": "table",
"table": "writer",
"name": "Writer",
"summary": "One person who signed in to Jot.",
"columns": [
{ "name": "writer_id", "type": "TEXT", "keys": ["PK"] },
{ "name": "email", "type": "TEXT", "keys": ["UK"], "nullable": false }
]
}
{
"ready": 3,
"kind": "data_group",
"id": "data.note-data",
"display_id": "DATA-NOTES",
"title": "Note data",
"summary": "Writers and the notes they keep.",
"entities": ["data.writers", "data.notes"],
"rationale": "Every note belongs to exactly one writer, so deleting a writer deletes their notes and nothing is left without an owner."
}
{
"ready": 3,
"kind": "rule",
"id": "rule.own-notes",
"display_id": "RULE-OWN-NOTES",
"rule_kind": "invariant",
"title": "A writer reaches only their own notes",
"summary": "Every read and change of a note is limited to the writer who saved it.",
"holds": "Every note is read, listed, archived, and deleted only for the writer it belongs to",
"scope": ["data.notes"]
}
{
"ready": 3,
"kind": "term",
"id": "term.archive",
"display_id": "TERM-ARCHIVE",
"name": "Archive",
"definition": "To take a note out of the list without deleting it at once; Jot deletes it after the retention period.",
"synonyms": ["hide"],
"copy_word": "archive"
}