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"
component api
  Ready
end
component api shape:server style:#warning icon:check,#success
text style:#7c3aed: Label
api -> db: query
edge from:api to:db "Query users"
api: Ready
state api: Thinking
api:
  pairs:
    status: ok
group "Backend"
  component api
end
# stage: Send request
# note: Explain next action
# overlay pause: Five minutes later
api -> user: issue %token
text "Callout"
circle "Label"
tree "Routing" shape:decision
  - Valid?
    ? yes
      - Route
end
--wait 1s
repeat 3
  api -> db
end
parallel
  api -> db
  api -> cache
end
block healthcheck
  api -> db
end
*repeat
  monitor -> api
end
$state.count++
Backend
  - api

Components

Declare topology nodes when you need a label, shape, icon, tier, tags, hierarchy, or an initial visible body. Edges and state updates still create undeclared components automatically.

Syntax

component key "Display Name" shape:shape,many style:tier,title-hidden,#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,manyStructural shape and multiplicity.
shape:server,many
Shapesdefault, circle, database, hexagon, diamond, note, actor, icon, cloud, external, browser, server, funnel, code.
shape:cloud
style:tier,title-hidden,#colorPresentation tier, icon title visibility, and outline color.
style:lg,title-hidden,#info
manyRender one logical component as a stacked or repeated visual.
shape:server,many
#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:lg icon:server,badge [backend]
component db "Database" shape:database icon:database,badge

api -> db: query
Loading preview

Colors

Color modifiers are visual metadata used across components, groups, tags, edges, notes, overlays, artifacts, text, and shapes. Named colors adapt to the active diagram theme; hex colors keep the authored value.

Syntax

#success
#error
#warning
#info
#red #blue #green #yellow #purple #gray #orange #pink #cyan #primary #secondary
#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.
#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

Edges

Bare arrows are replay sends. Use edge to declare a static edge and optional default label without emitting a particle. Labels are plain text; rich data belongs in component or artifact state.

Syntax

source -> target: label
edge from:source to:target "label"
edge from:source to:target
  label
end
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

Examples

Basic Edges

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

State

State is replay-only content on a component. Put starting visible content on an explicit component ... end body instead. Plain text works for simple status; structured or Markdown state shows useful internal detail.

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

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.
progress:
api: Deployment
  progress:
    current: provision
    steps:
      validate: Validate input
      provision: Provision deployment
      verify: Verify health
Ordered progress list. The writable current_index reference path selects a step by zero-based position.
progress:segmented:
text:
  progress:segmented:
    current: provision
    steps:
      validate: Validate input
      provision: Provision deployment
      verify: Verify health
Equal-width adjacent progress cells; current is bold, and current_index can be driven by a counter.
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

Groups

Groups draw visual boundaries around related components, text, trees, or nested 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

Stages

Stages are independently playable chapters. A chapter starts at its marker and stops before the next stage; description lines immediately after the marker become stage context.

Syntax

# stage: Title
# Description line

Examples

Stage

FractalForm script
# Stages create bounded, directly playable chapters.
# stage: Title
# Description line

client -> api: POST /orders
api -> db: insert
Loading preview

Notes

Notes attach explanation to the next timeline command. Put the note directly above the state or edge it explains.

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 are canvas-level messages for scenario transitions, time skips, or major status changes.

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

Artifacts

Artifacts are data objects with identity. They can travel with edges, receive state, and 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

Text

Text creates static canvas annotations. It can stand alone or attach to an element or group with side markers.

Syntax

text "Display Text"
text "Display Text" style:xl
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

Shapes

Shapes add primitive canvas geometry independent of topology nodes.

Syntax

circle "Label"
rect id style: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: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

Trees

Trees add supporting canvas detail for decisions, nested ideas, or ordered logic.

Syntax

tree "Title" shape:spine
  - branch
end
tree "Title" shape:spine style:arrows
  - step
end
tree "Title" shape:mindmap
  - topic
end
tree "Title" shape:decision
  - State
    ? event
      - Next
end

Details

FormUse ForExample
shape:spineOrdered paths, routes, steps, or escalation logic.
tree "Routing" shape:spine
style:arrowsDraw directional connectors between tree items.
shape:spine style:arrows
shape:mindmapRelated capabilities, concerns, or design areas.
tree "Platform" shape:mindmap
shape:decisionNamed choices, state machines, or policy transitions.
tree "Breaker" shape:decision
- labelA branch.
- auth check
? labelA decision/event branch in decision trees.
? failure
-> id "Label"Reference another tree node.
-> closed "Closed"

Examples

Routing Detail

FractalForm script
# Spine trees show ordered supporting detail.
tree "Routing" shape:spine
  - incoming request
  - auth check
end
Loading preview

Playback Directives

Playback directives control visibility, clearing, timing, and numbering. Visibility directives apply from their position in the timeline forward.

Syntax

--dim target
--show target
--hide target
--outline target
--clear target
--wait 1s
--travel 1s
--dwell 1s
--gap 200ms
--speed 5
--autonumber

Details

DirectiveEffect
--dimDim components.
--showRestore hidden, dimmed, or outlined components.
--hideRemove components from the canvas.
--outlineShow a ghost outline.
--clearClear state or artifacts.
--waitInsert a delay.
--travelSet edge particle travel 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 group commands for reuse, repetition, concurrency, and detached background work.

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 are illustration helpers for diagrams that need a value to change over time. Use them for small counters, statuses, or repeated values that make a concept easier to follow; they are not a general-purpose programming model.

Syntax

$name: value
$name:
  Markdown body
$name:
  pairs:
    status: ok
$name.field: value
$name.field++
$name.field--
text label:
  $name
rect status:
  $name.progress
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.progressMaterialize 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 concise, indentation-based way to sketch components, groups, and flows. Regular FractalForm constructs also work directly, including artifacts, variables, marked edges, and playback directives such as --dim, --wait, and --speed.

Syntax

// Groups are bare labels; indentation creates nesting
Platform (platform) ~#blue [production]
  Services
    [server,cloud] API (api) -badge [backend]
// Component marker families
[] Service (service)
[[cpu,server]] Workers (workers)
(postgresql) Database (db)
<shield> Gateway (gateway)
{bot} Agent (agent)
{{bot}} Agents (agents)
// 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 ~lg,#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
// Quick tree starts
?tree "Request path" =spine ~arrows
  - Receive
  - Validate

?tree "Platform" =mindmap
  - Services

?tree "Retry policy" =decision
  - Closed
    ? failure
      - 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,many icon:cpu
(postgresql) DBcomponent db "DB" shape:database icon:postgresql
<shield> Gatewaycomponent gateway "Gateway" shape:hexagon icon:shield
{bot} Agentcomponent agent "Agent" shape:icon icon:bot
[[cloud,server] ] API (api) ~lg,#info -#warningcomponent api "API" shape:server,many style:lg,#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 "Title" =spine / =mindmap / =decisiontree block

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