A complete example
Jot is a small note-taking web app: its details, two capabilities, three flows, three sequences, and the shared records they use. Every record is below.
Checked, the records report:
39 records: 2 capability, 3 flow, 7 step, 3 sequence, 2 entity, 1 data_group, 4 interface, 6 trigger, 4 rule, 1 actor, 3 system, 2 constant, 1 term0 errors, 0 warningsThe product and its capabilities
Section titled “The product and its capabilities”The product is a prototype for a few writers testing whether short notes are useful, so its agent rigor is lightweight (DCL 3); writing notes sets DCL 4, because a lost save loses the writer’s words.
The product’s details
Section titled “The product’s details”{ "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.", "boundary": { "includes": ["Writing, listing, and archiving notes in a web app"], "excludes": ["Sharing notes with other people"] }, "measures": ["Notes written per active writer each week"]}Write notes
Section titled “Write notes”kind: capabilityid: writedisplay_id: CAP-WRITEname: Write notessummary: 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: 1dcl: 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.Keep a library
Section titled “Keep a library”kind: capabilityid: librarydisplay_id: CAP-LIBRARYname: Keep a librarysummary: 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: 2Actor and systems
Section titled “Actor and systems”Writer
Section titled “Writer”kind: actorid: actor.writerdisplay_id: ACTOR-WRITERname: Writerside: persongoal: Keep short notes and find them again later.Web app
Section titled “Web app”kind: systemid: system.webdisplay_id: SYS-WEBname: Web appsystem_kind: appcode: apps/webrole: The editor and the notes list in the browserconnections: - { to: system.api, label: JSON over HTTPS }kind: systemid: system.apidisplay_id: SYS-APIname: APIsystem_kind: servicecode: apps/apirole: Saves, lists, and archives notesconnections: - { to: system.db, label: SQL }units: - { name: nightly-cleanup, unit_kind: schedule, schedule: Every night at 03:00 UTC, }Database
Section titled “Database”kind: systemid: system.dbdisplay_id: SYS-DBname: Databasesystem_kind: databaserole: Writers and their notesWrite a note
Section titled “Write a note”A journey. Save runs Save a note; its two outcomes lead to two steps.
kind: flowid: write.write-notedisplay_id: FLOW-WRITEcapability: writetitle: Write a notesummary: The writer types a note and saves it, or is told it is too long.subject: actor.writersteps: - write.write-note.type - write.write-note.too-long - write.write-note.savedentries: - label: New note from: library.browse.list to: write.write-note.type trigger: library.new-noteType the note
Section titled “Type the note”kind: stepid: write.write-note.typeflow: write.write-notetitle: Type the notestep_kind: screeninterface: interface.editorcopy: title: New note actions: [Cancel]does: - Type the note and save itedges: - 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: trueNote too long
Section titled “Note too long”kind: stepid: write.write-note.too-longflow: write.write-notetitle: Note too longstep_kind: errorinterface: interface.editorcopy: body: ['Notes can be up to {limit} characters.']sees: - The text stays in the editor with the limit beside itedges: - to: write.write-note.type trigger: write.edit-againNote saved
Section titled “Note saved”kind: stepid: write.write-note.savedflow: write.write-notetitle: Note savedstep_kind: outcomeinterface: interface.editorpresentation: toastcopy: title: Saveddata: - { entity: data.notes, access: write, state: write.note.active }kind: triggerid: write.savedisplay_id: TRIG-SAVEcapability: writetrigger_kind: actionname: Saveactor: actor.writerinterface: interface.editorCancel
Section titled “Cancel”kind: triggerid: write.cancelcapability: writetrigger_kind: actionname: Cancelactor: actor.writerinterface: interface.editorShorten the note
Section titled “Shorten the note”kind: triggerid: write.edit-againcapability: writetrigger_kind: actionname: Shorten the noteactor: actor.writerinterface: interface.editorkind: sequenceid: write.save-notedisplay_id: SEQ-SAVEcapability: writetitle: Save a notesummary: 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 }], }decision
Section titled “decision”kind: ruleid: write.lengthdisplay_id: RULE-NOTE-LENGTHcapability: writerule_kind: decisiontitle: A note stays within the length limitsummary: Decides whether a note is short enough to save.when: The note is longer than the limitthen: Saving is refused and the editor shows the limitotherwise: The note is savedconstants: [constant.max-note-length]constant
Section titled “constant”kind: constantid: constant.max-note-lengthdisplay_id: CONST-MAX-NOTE-LENGTHname: MAX_NOTE_LENGTHvalue: '10000'unit: charactersdescription: The most characters one note may hold.quality
Section titled “quality”kind: ruleid: write.save-fastdisplay_id: RULE-SAVE-FASTcapability: writerule_kind: qualitytitle: Saving feels instantsummary: 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 savestarget: Under one second for 95 in 100 savesThe note’s lifecycle
Section titled “The note’s lifecycle”A lifecycle. Note saved names its
active state, so Write a note moves it.
kind: flowid: write.notedisplay_id: FLOW-NOTEcapability: writetitle: Notesummary: A note is active from the moment it is saved until its writer archives it.subject: data.notessteps: - write.note.active - write.note.archivedActive
Section titled “Active”kind: stepid: write.note.activeflow: write.notetitle: Activestep_kind: stateinitial: truedescription: The note shows in its writer's list.field: archived_atvalue: emptyedges: - to: write.note.archived trigger: trigger.archive-noteArchived
Section titled “Archived”kind: stepid: write.note.archivedflow: write.notetitle: Archivedstep_kind: statefinal: truedescription: The note leaves the list and is deleted after the retention period.field: archived_atvalue: setArchive trigger (shared)
Section titled “Archive trigger (shared)”kind: triggerid: trigger.archive-notedisplay_id: TRIG-ARCHIVEtrigger_kind: actionname: Archiveactor: actor.writerinterface: interface.notes-listThe library
Section titled “The library”Write a note is entered from this list, so Browse notes leads to it.
kind: flowid: library.browsedisplay_id: FLOW-LIBRARYcapability: librarytitle: Browse notessummary: The writer reads their active notes, newest first, and archives the ones they no longer need.subject: actor.writersteps: - library.browse.list - library.browse.archivedYour notes
Section titled “Your notes”kind: stepid: library.browse.listflow: library.browsetitle: Your notesstep_kind: screeninterface: interface.notes-listcopy: title: Your notessees: - Every active note, newest firstdata: - { entity: data.notes, access: read, state: write.note.active }edges: - to: library.browse.archived trigger: trigger.archive-note sequence: library.archive-note outcome: archivedNote archived
Section titled “Note archived”kind: stepid: library.browse.archivedflow: library.browsetitle: Note archivedstep_kind: outcomeinterface: interface.notes-listpresentation: toastcopy: title: Archiveddata: - { entity: data.notes, access: write, state: write.note.archived }New note trigger
Section titled “New note trigger”kind: triggerid: library.new-notecapability: librarytrigger_kind: actionname: New noteactor: actor.writerinterface: interface.notes-listkind: sequenceid: library.archive-notedisplay_id: SEQ-ARCHIVEcapability: librarytitle: Archive a notesummary: 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:
sequence
Section titled “sequence”kind: sequenceid: library.purge-archiveddisplay_id: SEQ-PURGEcapability: librarytitle: Delete old archived notessummary: Each night the API deletes notes archived longer than the retention period.trigger: library.nightlyparticipants: - { 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, }trigger
Section titled “trigger”kind: triggerid: library.nightlydisplay_id: TRIG-NIGHTLYcapability: librarytrigger_kind: schedulename: The nightly cleanupschedule: Every night at 03:00 UTCpolicy
Section titled “policy”kind: ruleid: library.retentiondisplay_id: RULE-PURGE-ARCHIVEDcapability: libraryrule_kind: policytitle: Archived notes are deleted after the retention periodsummary: A note archived longer than the retention period is deleted for good.whenever: A note has been archived for longer than the retention periodthen: The note is deleted and cannot be restoredsequence: library.purge-archivedconstants: [constant.archive-retention]constant
Section titled “constant”kind: constantid: constant.archive-retentiondisplay_id: CONST-ARCHIVE-RETENTIONname: ARCHIVE_RETENTIONvalue: '30'unit: daysdescription: How long an archived note is kept before it is deleted.Interfaces
Section titled “Interfaces”Note editor
Section titled “Note editor”kind: interfaceid: interface.editordisplay_id: IF-EDITORinterface_kind: surfacesurface_kind: screenname: Note editorsummary: Where a writer types a new note and saves it.system: system.webaudience: [actor.writer]route: /notes/newelements: - { name: Text area, states: [empty, typing, over the limit] } - { name: Save button, states: [enabled, disabled while saving], copy: Save }states: [saving, saved, save failed]Notes list
Section titled “Notes list”kind: interfaceid: interface.notes-listdisplay_id: IF-NOTESinterface_kind: surfacesurface_kind: pagename: Notes listsummary: A writer's active notes, newest first, each with an Archive action.system: system.webaudience: [actor.writer]route: /noteselements: - { 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]Save a note
Section titled “Save a note”kind: interfaceid: interface.save-notedisplay_id: IF-SAVE-NOTEinterface_kind: operationoperation_kind: endpointname: Save a notesummary: Stores a new note for the signed-in writer, or refuses one over the limit.system: system.apicode: apps/api/src/notes/save.tshttp: { method: POST, path: /api/notes }auth: The writer's sessionparams: - { name: text, type: string, source: The editor }returns: The new note's iderrors: - { code: note_too_long, status: 400, when: The note is over the limit, copy: 'Notes can be up to {limit} characters.', }Archive a note
Section titled “Archive a note”kind: interfaceid: interface.archive-notedisplay_id: IF-ARCHIVE-NOTEinterface_kind: operationoperation_kind: endpointname: Archive a notesummary: Marks one of the signed-in writer's notes archived.system: system.apihttp: { method: POST, path: '/api/notes/{note_id}/archive' }auth: The writer's sessionparams: - { name: note_id, type: string, source: The note row }returns: Nothingkind: entityid: data.notesdisplay_id: DATA-NOTEentity_kind: tabletable: notename: Notesummary: 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 activeindexes: - 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 themWriter
Section titled “Writer”kind: entityid: data.writersdisplay_id: DATA-WRITERentity_kind: tabletable: writername: Writersummary: One person who signed in to Jot.columns: - { name: writer_id, type: TEXT, keys: [PK] } - { name: email, type: TEXT, keys: [UK], nullable: false }Note data
Section titled “Note data”kind: data_groupid: data.note-datadisplay_id: DATA-NOTEStitle: Note datasummary: 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.invariant
Section titled “invariant”kind: ruleid: rule.own-notesdisplay_id: RULE-OWN-NOTESrule_kind: invarianttitle: A writer reaches only their own notessummary: 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 toscope: [data.notes]Vocabulary
Section titled “Vocabulary”kind: termid: term.archivedisplay_id: TERM-ARCHIVEname: Archivedefinition: 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