The story language

A story is a list of actors and a list of steps. Each step plays messages between actors and carries the words that explain them. One statement per line; indentation is free and only there for the reader.

story What happens when you place an order
subtitle One click on Buy, followed hop by hop.

%% actors
you(laptop)[You]
api(server)[Orders API]
db(database)[Orders DB]

step Save the order
  you -> api: POST /orders
  api -> db: INSERT order
  db --> api: ok
  say The API checks the cart and writes the order.
  idea Until this write succeeds, nothing has happened.
  note db: 1 row
  set Database = 18 ms
Orders APIYouOrders DBPOST /ordersINSERT orderok1 row
Open in the live editor
Statement Meaning
story <title> Required, first. It is also how Tritone recognises a story
subtitle <text> One line under the title
%% text A comment, on its own line or after a statement

Quotes around a title, a subtitle or a metric name are optional and are removed.

Actors

id(kind)[Label] at col,row
Part Required Meaning
id yes Letters, digits, _ and -. Used in messages and notes
(kind) one of the two The shape. Defaults to service
[Label] one of the two The name shown under the shape. Defaults to the id
at col,row no A floor cell, instead of the automatic place

An actor must be declared before a message or a note mentions it.

Kinds

Kind Shape Also written as
service A cube api, app, any unknown kind
server A tall rack
database A cylinder with rings db
cache A low disc
queue A stack of slabs
laptop An open laptop client, browser
user A figure person
cloud A globe on a stand cdn, internet

A kind nobody registered is drawn as a service, so a typo never breaks a diagram. More kinds come from plugins.

Where actors stand

Without at, actors climb a staircase in the order they are declared: the second goes to the upper right of the first, the third to the lower right of the second, and so on. On screen the story reads left to right, and neighbours are joined by one straight line along the floor grid.

With at col,row you place an actor yourself. col grows towards the lower right of the screen, row towards the lower left; 0,0 is where the first automatic actor stands. Automatic actors skip no cells for placed ones, so either place all of them or check the result.

In the live editor you can drag an actor to another cell instead: the editor writes at col,row for you, on every actor, for that reason.

Steps

step <title> starts a step. Every statement after it belongs to that step, until the next step.

Statement Meaning
a -> b: label A request from a to b. ->> is the same
a --> b: label A response. -->> is the same
a <-> b: label A handshake: the route gets an arrow at both ends
say <text> A paragraph of narration. Repeat it for more paragraphs
idea <text> The one thing to remember. One per step; the last one wins
note <actor>: <text> A label pinned above an actor while this step is on screen
set <name> = <value> A metric shown above the scene

The label of a message is optional.

How a story plays

  • The messages of a step play one after the other, in the order written, 1.3 seconds each.
  • An actor appears at the first step that mentions it in a message or a note. An actor no step mentions is there from the start.
  • A route stays on the floor once a message has used it; the routes of the current step are drawn stronger.
  • A metric keeps its value until a later step sets it again. Before its first set it shows a dash.
  • Statements written before any step open an untitled step. A story with actors and no statements is a still picture.
  • With reduced motion, each step is shown as it ends: every label, no moving packet.

As an image (how), the story plays every step in turn and starts again, with the step number and title as a caption. Narration, ideas and metrics are part of the player, not of the image.

Mistakes

Every error names its line:

Tritone: line 9: "ap" is not declared. Declare it first, like ap(server)[Label]
Tritone: line 4: "api" is declared twice
Tritone: line 12: cannot read "api => db"

Limits

  • Labels are clipped: 36 characters on messages and notes, 24 on actor names. Text is plain: no Markdown.
  • Label boxes are sized for a monospace font with single-width characters; wide scripts and emoji overflow them.
  • Labels of several messages on short routes can overlap each other or an actor’s name.
  • There are no groups or zones yet, and the camera is fixed.