Aa 0.14.1

The language

A diagram is stored as words, a line each for a group, a box or a line between them, and laid out on the grid from them.

Groups and boxes

A title, a group named over its boxes, and a lone box in brackets, each placed with @.

What it stores

Nobody has to write the language by hand: the board writes it as things are drawn. It is plain enough for a person or an agent to write, and for a server to read.

# A titleKitchen @ 0 3  Kettle  - Toaster[Pantry] @ 6 3
WrittenWhat it is
# wordsThe title, on the first row. # to ####, before any group
Name at the left edgeA group, named on the row over its boxes
A line indented under it, or - BoxOne of its boxes, a row each, stacked edge to edge
[Box]A group that is one box, with no name over it
@ x yPlaces a group, in squares from the top left. @ 6, 3 reads the same
@ x y aloneA stack with no name over it
// wordsLeft out

Blank lines say nothing. Each box is an item cell, four squares across and one down.

Groups with no place

Without @ each group takes the next column along, and the row starts again under the tallest.

What it stores

A group with no @ takes the next place along a row, two squares free after the last. When the next would take the row past twelve squares, it starts again at the left, two rows under the row’s tallest group. Under a title, the first of these rows is the fourth.

Lines and arrows

Two dashes join, -> ends in an arrow and <-> in two.

What it stores

WrittenWhat it draws
A -- BA line
A -> BA line ending in an arrow at B
A <- BA line ending in an arrow at A
A <-> BAn arrow at each end
A -> B -> CA line from each to the next

A line reaches a group by its name, or a box by its words, so a line can leave from the middle of a stack. Names are matched whatever their case. Where two groups hold boxes of the same name, Group.Box names one of them.

One box among two of a name

Group.Box names one box where two groups hold boxes called the same; <- points back.

What it stores

Two groups side by side are joined straight across the middle of the rows they share. Otherwise a line leaves the middle of one group’s lower or upper edge and comes into the other from above or below: straight down the columns they share, or turning on the grid line halfway between them. A line down into a group’s name meets the middle of the name, to the nearest half square, and the other lines down out of the same group leave from that point, so they share one stem.

Every group a line reaches stands on an even square across, so two groups side by side stand two squares apart and the line between them is two squares long. A group no line reaches keeps the square it names, so chips in a row can stand a square apart, as a legend’s do; so does a group placed on a post-it. A line that names nothing in the diagram is left out.

Colours

A colour after a name fills a group’s boxes; one as a box’s last word fills that box alone.

What it stores

The pale accents are light-green, light-blue, pink, yellow, orange, red and white, the plainest: white in the dark and the paper’s pale grey in the light.

WrittenWhat it colours
Name pink, [Box] pink, @ 0 4 pinkEvery box of the group
Box light-greenThat box alone, over its group’s colour
{Post-it} yellowThe post-it

A colour is read after a name or a place, never as one: a group called Pink stays Pink, and a box that is only a colour’s name keeps it as its words. Boxes that touch share the edge between them, as a board’s cells do, so a stack reads as one block and a row of groups coloured box by box reads as a table of states.

Widths

A box is an item, four squares across; w8 makes it two items and w12 three.

What it stores

w8 on a group’s line makes its boxes two items across, and w12 three. A width between whole items keeps the one under it, so w6 is still one item; the widest is w40, ten items.

A post-it

Braces make a post-it, twelve squares a side, holding the groups placed on it.

What it stores

{Name} is a post-it: a square frame holding whatever groups are placed on it, its name one square in from its top left corner. It is twelve squares a side unless w8 makes it eight (h8 says the same), always a whole number of columns of four, and square whichever side is written. Its place across is taken to the nearest column. A colour fills it as it fills boxes. Boxes written under a post-it are left out: groups are placed on it with @.

A month

A day a square from Monday, its days named on a row of their own, and the days that wear a colour.

What it stores

(2026-10) is a month: a day a square, seven across from Monday as a calendar has them, its weeks one under the other. The words before it are its name, on the row over it.

Under a monthWhat it does
pink 1 5 8 12The days that wear the colour
yellow 19-23A run of days
Seven wordsThe days’ names, Monday first, on a row of their own over the weeks

Coloured days that touch share their edges, so a run of them reads as one band. A later line colours over an earlier one. A month that is none, such as (2026-13), is part of a name like any other words.

A grid of squares

Five columns of three rows, the columns named over them and the lines named down the side.

What it stores

(30x8) is a grid of squares, thirty across and eight down, for whatever is counted a square at a time; at most sixty a side. Its name is on the row over it, as a month’s is.

Under a gridWhat it does
pink 3The whole third column
pink 3-5Three columns
light-green 8:1-2The first two squares of the eighth column
As many words as columnsNames the columns, over the squares, each in a box of its own
As many words as rowsNames the rows, in a column before the squares, in the condensed face
One word more than rowsNames the lines instead, each from the squares’ top edge to their foot, as the hours of a day stand on theirs

Columns and rows count from one, a later line colours over an earlier one, and a span past the grid’s edge stops there. A column whose squares wear nothing is named faintly, as a day with nothing on it is. In a grid as tall as it is wide, the first line of names names the columns and the next the rows.

Long column names

A column’s name longer than three letters slants up and to the right, so its column stays one square wide.

What it stores

A column’s name longer than three letters slants up and to the right from its square, so a grid of states (a platform a column, a feature a row) keeps its columns one square wide whatever they are called.

A line chart

The names along its foot, the values ruled across it, then one line a colour, a value a point.

What it stores

(chart 12x6) is a line chart, its plot twelve squares across and six down, drawn as if with a marker on the paper.

Under a chartWhat it does
The first line of wordsNames the points along its foot, the first under the left edge and the last under the right
The next line of numbersThe values ruled across the plot, from the foot up
A colour and numbers, orange 3.4 3.8 6 11 17.9One line, a value a point from left to right, its last value written at its end

Without values written, the chart runs from nought to its highest value, rounded up to a step. The values’ names stand in a column before the plot and the last values in two after it, moved apart where their lines end close together. The whole stands on a card a square wider all round, its name inside its top corner.

Squares in marker

marker inside the brackets colours the squares in with a felt tip rather than as chips.

What it stores

marker inside a grid’s or a month’s brackets, (30x8 marker) or (2026-10 marker), colours its squares in with a marker, a few short strokes laid over one another, rather than as chips.

@0001-labs/aa/diagram-language is the language alone, with nothing of the page, for a page or a server that only reads diagrams.

import { diagramFences, layoutDiagram } from '@0001-labs/aa/diagram-language'const lines = markdown.split('\n')for (const { start, end } of diagramFences(markdown)) {  const diagram = layoutDiagram(lines.slice(start + 1, end).join('\n'))  console.log(diagram.columns, diagram.rows, diagram.unread)}

layoutDiagram(source, measure?, options?) reads a diagram’s words, without their fences, and sets everything on the grid, in squares from the top left. measure gives a name’s width in squares, so a line into a name meets its middle; without it a line meets the group’s middle. { room } is the squares across it may take: a wider diagram is laid out again in strips that fit.

FieldWhat it holds
columns, rowsSquares across and down
labelsThe title and the groups’ names, each with its place and width
boxesEvery box, with its place, width, colour and the edges it shares
postItsEvery post-it
daysA month’s days and a grid’s coloured squares and names
chartsEvery chart: its plot, its card, its names and its lines’ points
linesEvery line, as straight runs between points, and whether it ends in an arrow
groupsEvery group as written: its kind, the source lines it stands on, its name, boxes, place and size
joinsWhere each of lines is written, by the same place in the list
unreadThe source lines that said nothing it understood, by number from one
FunctionWhat it does
diagramFences(text)Where the closed diagram fences in a text start and end, by line from nought, both fence lines included. An open fence with no close is not a diagram yet
isDiagramBlock(text)Whether a block of writing is a diagram, fenced from its first line to its last
diagramSource(block)The words inside a fenced diagram, without its fences
diagramWraps(fence)Whether a fence says wrap
diagramFenceWrapped(fence, wrap)The fence’s first line with wrap put on or taken off
diagramBlockRows(block)How many rows a fenced diagram takes
writingLineRows(text)How many rows a text holds at the least, each diagram counted as the rows it is drawn on
diagramListColumns(text)How many columns of four squares the widest diagram in a text needs

The functions that change a diagram as the board does are in @0001-labs/aa/diagram: see What is written.

Diagrams · Drawing on the board · Asking AI