Language Reference

FractalForm diagrams are plain-text scripts for animated system diagrams.

client -> api: GET /users

Basic request

Loading preview

Edges and state updates create components automatically. Add stages, notes, overlays, artifacts, playback directives, and control blocks only when the diagram needs them.

Quick Reference

Minimal syntax for each FractalForm construct.

Construct
Minimal form
Details
component api "API"
api -> db
api: Ready
group "Backend"
  component api
end
api -> user: issue %token
component api
  pairs:
    status: ok
  list:
    - validates input
    - returns response
end
component api shape:database style:#warning icon:check,#success
text style:#7c3aed: Label
circle "Label"
text "Callout"
icon check
tree "Routing" shape:decision style:separate-edges
  - Request
  - Valid?
    -- yes
      - Route
    -- no
      - Reject
end
# stage: Send request
client -> api

# stage: Store result
api -> db
# note: Explain next action
api -> db
# overlay pause: Five minutes later
api -> db
component api
callout @api "Public endpoint"
api: Status: OPEN
emphasis @api shape:circle match:"OPEN"
--speed 5
api -> db

--wait 1s
db -> api
block refresh
  api -> cache
end
@refresh
@refresh
@refresh
repeat 3
  api -> db
end
parallel
  api -> db
  api -> cache
end
$count: 0
$count++
api: $count
Backend
  - api

Components

Components represent the parts of a system, such as services, databases, people, or external tools. They can be labeled, styled, tagged, and organized into groups. Components also appear automatically when used in a connection or state update.

Syntax

component key "Display Name" shape:shape multi:stack style::tierN,utilities,#color icon:name,badge [tags]
component key "Display Name"
  Initial body
end

Details

ParameterDescriptionExample
keyAddressable identifier.
component api
"Display Name"Quoted label.
component api "API"
shape:shape multi:stackStructural shape and multiplicity.
shape:server multi:stack
Shapesdefault, circle, database, hexagon, diamond, note, actor, icon, cloud, external, browser, server, funnel, code.
shape:cloud
style::tierN,utilities,#colorComponent preset, direct style overrides, icon title visibility, and outline color.
style::tier1,title-hidden,#info
manyRender one logical component as a stacked or repeated visual.
shape:server multi:stack
#colorTheme color token or hex color for visual emphasis.
style:#warning
icon:name,badgeIcon or badge metadata.
icon:server,badge
[tags]Short visual metadata; tags can carry colors.
[backend, public #info]
Initial bodyIndented body under component ... end. Plain text becomes markdown; decorator bodies become structured content. Last declaration wins.
component api
  Ready
end

Examples

Component Declaration

FractalForm script
# Declarations set labels, shapes, icons, and tags.
component api "API" shape:server style::tier1 icon:server,badge [backend]
component db "Database" shape:database icon:database,badge

api -> db: query
Loading preview

Edges

Edges show relationships and movement between parts of a system. Arrow edges play as activity in the timeline, while static edges remain visible without playing. Branches connect one source to several destinations, and paths are visual guides only.

Syntax

source -> target: label
edge from:source to:target "label"
edge from:source to:target
  label
end
branch routes from:source to:[left,right] marker:arrow
path guide "Guide" from:source to:target style:stroke-dashed
source -> middle -> target: label
source -> [target-a, target-b]: label
source -> target mark:dropped,#error: label

Details

ArrowMeaning
->Synchronous call
->>Async fire-and-forget
~>Streaming
-->Optional or conditional
-->>Async optional or conditional
..>Inferred or weak
..>>Async inferred or weak
<->Bidirectional
<~>Bidirectional streaming
<-->Bidirectional optional or conditional
<..>Bidirectional inferred or weak
branchStatic shared stem with addressable source and destinations.
pathVisual-only path; does not create replay events or topology edges.

Examples

Basic Edges

FractalForm script
# Plain edges create components if needed.
client -> api: request
api -> db: query
Loading preview

State

State is the information a component displays as the diagram plays. It can be simple text, Markdown, or structured content, and each update replaces what the component currently shows. A component body defines what appears before playback.

Syntax

component: content
state component: content
state component
  Markdown body
end
component:
  Markdown body
component:
  pairs:
    status: ok
component mark:destroyed: content
component <mark:destroyed>: content

Details

FormDescriptionExample
TextSimple replay status.
api: Processing
Keyword stateExplicit replay alternative to inline key:.
state api: Thinking
StructuredDecorated state body.
api:
  pairs:
    status: ok
Markdown bodyIndented Markdown after a state opener.
api:
Timeline markTransient node treatment.
session mark:destroyed: removed

Examples

Component State

FractalForm script
# Inline state updates change what a component displays during replay.
api: Processing request

api:
  pairs:
    status: ok
    count: 3

api:
  Handles *requests*.
  - validates input
Loading preview

Groups

Groups organize related parts of a diagram inside a shared visual boundary. They can contain components, text, trees, and other groups.

Syntax

group key "Display Name" shape:shape style:stroke,radius-12px,title-hidden,#color icon:name [tags]
  component key
end
group "Display Name"
  existing-key
end

Details

PartDescriptionExample
keyOptional addressable identifier; quoted-only groups get an internal key.
group backend "Backend"
"Display Name"Visible group label.
group "Infrastructure"
shapeBorder geometry: rect, circle, diamond, hex, or ellipse.
shape:ellipse
strokeBorder stroke: solid, dashed, or dotted.
style:stroke-dotted
radiusBoundary corner radius in pixels.
style:radius-12px
title-hiddenHide the title bar without removing the group label or identity.
style:title-hidden
#colorTheme color token for the border.
style:#warning
icon:nameOptional group icon and color.
icon:cloud,#info

Examples

Group Block

FractalForm script
# Group related components under one boundary.
group backend "Backend"
  component api "API" shape:server
  component db "Database" shape:database
end

api -> db: query
Loading preview

Artifacts

Artifacts represent data that moves through a system, such as a file, token, request, or result. They have their own identity and state, can travel along edges, and can be cleared independently.

Syntax

artifact key "Name" icon:name
source -> target: label %artifact
%artifact:
  Markdown body
%artifact:
  pairs:
    status: ok
%artifact#copy

Details

FeatureSyntax
Declareartifact token "Token" icon:key-round
No declarationclient -> api: upload %file
Attach to edgeauth -> user: issue %token
Instance copy%item#copy
Multipleapi -> client: done %order %receipt
Markdown state%token: Token issued
State%token: pairs: sub: user123
Clear--clear %token

Examples

Declared Artifact

FractalForm script
# Artifacts are data objects with identity.
artifact token "Token" icon:key-round
auth -> user: issue %token

%token:
  pairs:
    sub: user123
    exp: 15m

user -> api: GET /profile %token
Loading preview

Content Rendering

Indented bodies can render as Markdown or as decorated content. The same body forms work in component state, artifact state, attached or standalone text, and shape bodies. Decorated bodies use a small YAML-like syntax.

Markdown Bodies

A body with plain indented text renders as Markdown. Use this for prose, lists, headings, emphasis, code spans, and inline icons.

WhereStructureBody
Component state
api:
  Handles **requests**.
  - validates input
Markdown rendered in the component body.
Artifact state
%token:
  Signed **JWT**.
  - expires in 15m
Markdown rendered on the artifact.
Standalone text
text:
  Release **notes**.
  - watch latency
Markdown rendered as free canvas text.
Attached text
text @api |
  Handles **requests**.
  - validates input
Markdown rendered beside the target.
Shape body
diamond decision:
  Policy **check**.
  - allow
  - deny
Markdown rendered inside the shape.

Decorator Bodies

A body whose first content line is a decorator uses that decorator to choose the rendered shape. Decorators can be combined in the same body.

DecoratorStructureBody
text:
api:
  text: Ready
Plain text content.
pairs:
api: Ready
  pairs:
    status: ok
    count: 3
    latency: [42, ms]
Mapping rendered as labeled rows.
list:
api: Checks
  list:
    - auth
    - quota
Sequence rendered as bullets.
list:ordered:
api: Steps
  list:ordered:
    - authorize
    - capture
Sequence rendered as numbered steps.
list:segmented:
text:
  list:segmented:
    - First item
    - Second item
Sequence rendered as adjacent cells on one unwrapped row.
group:panel:
api: Details
  group:panel: metadata
    pairs:
      region: us-east-1
Panel groups contain decorated blocks in a collapsible section.
table:
api: Services
  table:
    - service: auth
      status: ok
    - service: payment
      status: <icon:check>
Sequence of mappings rendered as table rows.
table:grid:
text service-status style:#rose:
  table:grid:
    - service: auth
      status: ready
    - service: worker
      status: running
Sequence of mappings rendered with an outer border and row and column dividers.
error:
api: Failed
  error:
    code: 503
    message: Unavailable
Mapping rendered with error styling.
group:
api: Cache
  group: stats
    pairs:
      hits: 12
      misses: 3
A group contains other decorated content blocks.
markdown:
api:
  text: Deployment note
  markdown:
    Rollout is **healthy**.
    - canary checks passed
Markdown body inside decorated content.
json:
api:
  json:
    {
      "status": "ok"
    }
JSON code body after a state opener.

Examples

Text

The text decorator renders plain component content.

FractalForm script
component api "Text"

api:
  text: Ready
Loading preview

Colors

Colors help distinguish status, meaning, and related parts of a diagram. Named colors adjust to the current theme, while hex colors stay exactly as written.

Syntax

#success
#error
#warning
#info
#red #blue #green #yellow #purple #gray #orange #pink #cyan #primary #secondary
#gray-50 #gray-100 #gray-200 ... #gray-900 #gray-950
#abc #7c3aed #7c3aedff

Details

TokenVisualUse
#successGreenSuccessful, healthy, complete, accepted.
#errorRedFailed, blocked, rejected, unavailable.
#warningAmber or orangeRisk, degraded, retry, needs attention.
#infoBlueNeutral status, context, informational callout.
#primaryTheme accentPrimary emphasis aligned with the active theme.
#secondaryMutedSubtle metadata or secondary visual weight.
#red, #blue, ...Named palette colorNon-semantic grouping.
#gray-50 … #gray-950Neutral gray scaleTheme-independent neutral contrast.
#abc, #7c3aed, #7c3aedffExact hex colorOne-off brand or diagram-specific accents.

Examples

Semantic Color Tokens

FractalForm script
# Semantic colors carry meaning and follow the active theme.
component api "API" shape:server style:#info icon:server,#info [public #info]
component worker "Worker" shape:hexagon style:#warning icon:cpu,#warning [retry #warning]
component db "Database" shape:database style:#success icon:database,#success [healthy #success]

api -> worker: retry <icon:alert-triangle #warning>
worker -> db mark:#success: write <icon:check #success>
worker -> api mark:dropped,#error: timeout <icon:x #error>
# note pause #warning: Retry is safe, but it needs attention.
api -> worker: retry again
Loading preview

Shapes

Shapes add simple visual elements such as circles, rectangles, and diamonds to the canvas. They can be labeled, styled, and attached to other elements, but they are canvas elements rather than system components.

Syntax

circle "Label"
rect id style:stroke-dashed,#color
ellipse id @target style:#warning "Label"
diamond id:
  Markdown body
diamond id:
  pairs:
    status: ok

Details

PartDescriptionExample
primitivePrimitive element command.
circle
PrimitiveCanvas geometry: rect, circle, diamond, ellipse, hex, or line.
circle
idOptional stable identifier; omitted shapes get generated ids.
rect boundary
@targetOptional attachment target for relative placement.
circle halo @api
style modifiersStroke, direction, size, and color metadata.
style:stroke-dashed,#info
Label/bodyQuoted inline label or indented body after a colon.
diamond gate "Policy"
Decorated bodyShape body rendered with a content decorator.
diamond gate:
  pairs:
    status: ok

Examples

Circle Shape

FractalForm script
circle "Label"
Loading preview

Text

Text adds explanations and labels to the canvas. It can stand on its own or attach to a component, group, or other element.

Syntax

text "Display Text"
text display-text "Display Text"
view
  text:display-text: text-style:font-size-24px,weight-700
end
text @target |
  Markdown body
text @target marker:|
  Markdown body
text @target |
  pairs:
    status: ok
text @target style:#info ->
  Markdown body

Details

FormDescriptionExample
StandaloneFree-floating annotation.
text "Request Flow"
AttachedSidecar beside a target.
text @api "Handles ingress"
:Plain markdown body.
text @api:
Decorated bodyBody rendered with a content decorator.
text @api:
  pairs:
    status: ok
|Guide bar beside the text.
text @api |
]Bracket marker.
text @api ]
}Brace marker.
text @api }
-> / <-Arrow connector direction.
text @api ->
-o / o-Step connector direction.
text @api -o
marker:Property form for the same marker options.
text @api marker:|
StyleStandalone size/opacity, or attached description presentation metadata.
text @api style:#info |

Examples

Standalone Text

FractalForm script
text "Request Flow"
Loading preview

Icons

Icons add standalone symbols to the canvas. Like shapes, they are visual elements rather than system components; a component can also be displayed as an icon.

Syntax

icon check
icon check status
icon server api "API"
icon check @target status style:#success
icon sparkles swarm multi:swarm style:#info
icon motion-clock job-clock @worker
icon motion-progress ingest-progress

Details

PartDescriptionExample
icon nameCreate a standalone canvas icon.
icon check
idOptional stable identifier for addressing or view metadata.
icon check status
"title"Optional single-line title rendered below the icon.
icon server api "API"
@targetAttach the icon relative to another element.
icon check @api status
multi:swarmRender the icon as a repeated visual.
icon sparkles swarm multi:swarm
motion-*Use a registered replay-clock animation on a standalone icon primitive.
icon motion-clock job-clock
{icon}Quick Notation icon primitive.
{check} @api (status)
{{icon}}Quick Notation repeated icon primitive.
{{sparkles}} (swarm)
shape:iconCreate a topology component rendered as an icon.
component agent shape:icon icon:bot

Examples

Icon Primitive

FractalForm script
component api "API" shape:server

icon check @api status "Healthy" style:#success
icon sparkles swarm multi:swarm style:#info
Loading preview

Trees

Trees show branching structures such as decisions, states, and outcomes. They can remain purely visual or have an ID so their branches and scenarios can be referenced elsewhere in the diagram.

Syntax

tree flow "Title" shape:decision style:separate-edges
  - State (state)
    -- event
      - Next (next)
end
tree flow "Title" shape:decision style:separate-edges
  - Decision? (decision)
    -- yes
      - Continue (next)
end
tree mytree "Title" shape:decision style:separate-edges
  - State (state)
    -- event
      - Next (next)
  scenario advance: state -> next
end
@mytree advance

Details

FormUse ForExample
tree [id] ["Title"] shape:decision style:separate-edgesDeclare a decision tree; ID and title are optional.
tree shape:decision style:separate-edges
shape:decision style:separate-edgesUse diamond decisions with independent left/right exits.
tree routing "Routing" shape:decision style:separate-edges
- labelA visible node or branch.
- Authenticated?
-- outcomeA connector label directly below a decision node.
-- no
-> id "Label"Reference another tree node.
-> closed "Closed"
tree.branchAddress a generated branch endpoint from other constructs.
state routing.reject: Blocked
scenario name: a -> bA validated route inside an addressable decision tree.
scenario recover: open -> closed
@tree scenarioReplay a named route as ordinary sends.
@mytree recover

Examples

Flowchart Decision

FractalForm script
# Flowchart outcomes alternate across native left/right exits.
tree routing "Request routing" shape:decision style:separate-edges
  - Authenticated? (auth)
    -- yes
      - Route request (route)
    -- no
      - Reject request (reject)
end
Loading preview

Stages

Stages divide a diagram into chapters that can be played separately. Each stage appears as a clickable link on the canvas and includes the events after its heading up to the next stage. A stage can also include a short description.

Syntax

# stage: Title
# Description line

Examples

Stage

FractalForm script
# stage: Send request
client -> api

# stage: Store result
api -> db
Loading preview

Notes

Notes add context to a specific moment in the timeline. They appear before the next event and can pause playback, dismiss automatically, or show an action number.

Syntax

# note: Text
# note pause: Text
# note n 5s #warning: Text

Details

ModifierEffect
pauseManual advance required.
3sAuto-dismiss after duration.
nNext action number.
#warningAccent color.

Examples

Basic Note

FractalForm script
# Notes explain the next event.
# note: Client sends the request.
client -> api: request
Loading preview

Overlays

Overlays display a message across the canvas during playback. They mark transitions, time jumps, and changes that affect the whole scene.

Syntax

# overlay: Text
# overlay pause: Text
# overlay 10s: Text

Details

ModifierEffect
pauseManual advance required.
10sAuto-dismiss after duration.
<icon:name #color>Optional icon and accent.

Examples

Basic Overlay

FractalForm script
# Overlays narrate scene changes.
# overlay: Explain the next scene.
client -> api: start
Loading preview

Callouts & Emphasis

Callouts place lasting explanatory text on the canvas. Emphasis draws attention to a component, part of a component, or matching text.

Syntax

callout @target "Text"
callout explanation @api style:#warning:
  Text
--play explanation
emphasis @target match:"Text" style:#warning
emphasis @api shape:circle match:"Text"
--clear api:emphasis

Details

FormEffect
callout [id] [@target]Add persistent explanatory text, optionally anchored to a target.
--play callout-id [Nx]Replay an addressable callout’s text, underline, and pointer without changing visibility; an optional multiplier changes draw speed.
emphasis @targetMark the target or matching rendered content.
shape:highlightHighlight matching content; this is the default.
shape:circleCircle matching content.
shape:underlineUnderline matching content.
match:"Text"Limit emphasis to exact case-insensitive matches.
--clear target:emphasisRemove emphasis from the target.

Examples

Canvas Callout

FractalForm script
component api "API" shape:server

callout @api style:#info:
  Public entry point for client requests.
Loading preview

Playback Directives

Playback directives control how a diagram changes over time. They can change visibility or activity, clear elements, adjust timing and speed, and number actions.

Syntax

--dim target
--show target
--hide target
--outline target
--play target 2x
--pause target
--clear target
--clear target:emphasis
--wait 1s
--travel 1s
--dwell 1s
--gap 200ms
--speed 5
--autonumber

Details

DirectiveEffect
--dimDim elements; motion icons freeze on the current frame.
--showRestore elements; playing motion resumes, while paused motion remains frozen.
--hideRemove elements; motion icons reset to phase zero without changing activity intent.
--outlineShow a ghost outline; motion icons freeze.
--playStart or resume an animated icon, which is paused by default. Add a positive multiplier such as 2x or 0.5x to set its speed; omit targets to play all animated icons.
--pausePause an animated icon; omit targets to pause all animated icons.
--clearClear targets broadly, or use target:emphasis to clear emphasis only.
--waitInsert a delay.
--travelSet edge traversal duration.
--dwellSet readable dwell for state and artifacts.
--gapSet rest after each event.
--speedSet or reset playback speed.
--autonumberAdd action badges.

Examples

Dim

FractalForm script
component api "API" shape:server
api: ready
--dim api
Loading preview

Control Blocks

Control blocks organize sequences of events that repeat, run together, or are reused. They can also represent background activity that continues while the main timeline plays.

Syntax

repeat 3
  ...
end
parallel
  ...
end
block name
  ...
end
@name
*repeat name
  ...
end
--detach @name
--attach @name

Details

BlockEffect
repeatLoop a command sequence.
parallelRun commands concurrently.
blockDefine a reusable command group.
@nameInvoke a block.
*block / *repeatStart a detached block or repeating background lane.
--detach / --attachRun a block in the background or wait for it.
* @name / ^nameShorthand detach and attach forms.

Examples

Repeat

FractalForm script
# Repeat loops the body.
repeat 3
  client -> api: poll
end
Loading preview

Variables

Variables hold values that change as a diagram plays, such as a counter or status. Their values can appear in component state, text, and shapes. They are designed for illustration, not general-purpose programming.

Syntax

$name: value
$name:
  Markdown body
$name:
  pairs:
    status: ok
$name.field: value
$name.field++
$name.field--
text label:
  $name
rect status:
  $name.pairs
component:
  pairs:
    field: $name.field

Details

FormEffect
$breaker: valueSet a variable.
$breaker.field: valueSet a field.
$breaker.field++Increment a field.
$breaker.field--Decrement a field.
$count++ / $count--Increment or decrement a scalar variable.
text label: $summaryMaterialize a variable as standalone text content.
rect status: $summary.pairsMaterialize a decorated variable path as primitive content.
$summary: pairs: status: okSet a variable with a decorated body.
component: pairs: field: $breaker.fieldRender a variable read in a decorated body.

Examples

Declare Variable

FractalForm script
# Variables help illustrate values that change over time.
$breaker: {
  status: closed,
  failures: 0
}
Loading preview

Quick Notation

Quick Notation is a shorter, indentation-based way to describe a FractalForm diagram. It covers common components, groups, and flows while allowing regular FractalForm syntax for more advanced behavior.

Syntax

// Groups are bare labels; indentation creates nesting
Platform (platform) ~#blue [production]
  Services
    [server,cloud] API (api) -badge [backend]
// Component and icon primitive marker families
[] Service (service)
[[cpu,server]] Workers (workers)
(postgresql) Database (db)
<shield> Gateway (gateway)
{check} @service (status)
{{sparkles}} (swarm)
[bot,icon] Agent (agent)
// Child and related components
[] Parent (parent)
  - Child
  -- {sheet} Related
[,server] fractalform.io
  -- [,text] /share
// > is the Quick Notation replay shorthand
client > api > db: query
edge from:api to:db "static label"
// Initial content and attached descriptions
[] API (api)
  : Ready
  / Handles requests
  | Public endpoint
// Canvas text, primitive shapes, and paths
/ Request flow ~#info
[.] Boundary (boundary) ~opacity-75
(.) Cache
<.> Region
<<.>> Decision
((.)) Pool
path divider "Divider" ~#gray
// Stages, notes, and overlays
/// Request flow
  Follow the request from ingress to storage.
## Validate input ..
### Five minutes later 5s..
// Indentation closes blocks; do not write end
repeat 3
  client > api: retry

parallel
  api > db
  api > cache
// Named and detached blocks also close on dedent
block healthcheck
  api > db: ping

*repeat heartbeat
  monitor > api: GET /health
// Addressable decision tree
?tree retry-policy "Retry policy" =decision ~separate-edges
  - Closed (closed)
    -- failure
      - Open (open)

Details

Quick FormConverts To
Labelgroup "Label"
Label (id)group id "Label"
- apicomponent api
[] API (api)component api "API"
[,browser] Webcomponent web "Web" shape:browser
[,text] /sharecomponent share "/share" shape:text
[globe,browser] Webcomponent web "Web" shape:browser icon:globe
[[cpu,server] ] Workerscomponent workers "Workers" shape:server multi:stack icon:cpu
(postgresql) DBcomponent db "DB" shape:database icon:postgresql
<shield> Gatewaycomponent gateway "Gateway" shape:hexagon icon:shield
{check} @api (status)icon check @api status
{{check} } (statuses)icon check statuses multi:swarm
[bot,icon] Agentcomponent agent "Agent" shape:icon icon:bot
[[cloud,server] ] API (api) ~:tier1,#info -#warningcomponent api "API" shape:server multi:stack style::tier1,#info icon:cloud,#warning
Platform =circle ~stroke-dashed,radius-12px,title-hiddengroup "Platform" shape:circle style:stroke-dashed,radius-12px,title-hidden
[] API -icon:server,badge,#warningcomponent api "API" icon:server,badge,#warning
- Child / -- Relatedcomponent parent.child / parent..related
A>B>C: callA -> B -> C: call
edge from:A to:B "static"edge from:A to:B "static"
: Ready under [] APIinitial component body
/ or | under [] APIattached text description
[.] Label (id) ~opacity-75named styled primitive
(.) / <.> / <<.>> / ((.))circle / hex / diamond / ellipse primitive
/// Stage# stage: Stage
## n. Note# note n: Note
### Overlay 10s..# overlay 10s: Overlay
repeat / parallel + indentationblock closed by dedent
block / *repeat + indentationnamed / detached block closed by dedent
?tree [routing] ["Title"] =decision ~separate-edgesdecision tree; add an ID only for targeting or scenarios

Examples

Outline

Quick input
Backend
  - api
  - worker
  (postgresql) DB
Generated script
group "Backend"
  component api
  component worker
  component db "DB" shape:database icon:postgresql
end
Loading preview