Ord semantics
Version 0.7.0-draft, 2026-11-22. A companion spec to Ord specification, of the same version. The Spec's conventions (S1 to S6) and versioning (S10) apply here, and rule IDs that start with C, L, D, T or F refer to the Spec. This spec's rules start with M.
The Spec says how text becomes a tree of nodes and fields. This spec says what that tree means across a workspace: which node a reference points to, what types and states a node has, who owns whom, and what formulas and queries written in files stand for.
1. Scope and the line
- M1. This spec covers what files mean. Two tools that conform to it give a workspace the same graph: the same nodes, owners, types, IDs, states, field values and references, and the same diagnostics from section 10.
- M2. A rule belongs here when it is about something written in a file that a tool interprets, or something a tool writes into a file. Anything that exists only in a tool, such as an index, a view, completion or a heuristic whose result isn't written, is implementation and outside this spec.
- M3. These are explicitly implementation-defined, so tools may differ:
- how value types are inferred, and outlier warnings; only value forms (L21 to L27, L35) are normative
- diagnostics beyond section 10, which use codes outside this spec's letters, e.g.
ord/outlier - how and when a graph is stored, cached or rebuilt
- completion, hover, inlay hints, views, CodeLens and results documents
- fold state and other view state, which is never written into the files: a tool keeps it apart, finding a folded node again by its ID or its place in the tree, and a node it can't find stays open
- merging and sync
- M86. Files, and what they define. A workspace has three layers:
- The files are the source of truth: a node has what is written on it (M37). A tool changes a file only to help the person writing it: it writes a one-time formula's result in its place (M85), a type's fields, template and checkbox on a node given the type (M37, M51, M66), and a change to a type's fields on its nodes (M84), and makes the edits the person asks for, such as renaming a node or a field along with what refers to it.
- What the files define: searches (M60), mirrors (M48) and formulas (M39, M87). They are written in the files and evaluated over the graph, and their results are virtual: an editor shows them where they are defined, and a tool never writes them into a file. They are one layer because they read each other: a query can match a calculated field (
=(total > 42)), a mirror stands for its source in formulas (M49), and a formula can run a query (M76). - What is computed from a search's results: its
footersetting (M64). It is shown with the results, and nothing else reads it.
- M4. A graph builder reads a workspace (Spec F4) with label syntax (Spec Part 2) and builds the graph as this spec says, and passes the tests with the
graphoption (Appendix A).
2. The graph
- M5. The workspace is every Ord and CSV file in it, its workspace file included (Spec F1, F3, F5; CSV mapping). Files are taken in code point order of their paths relative to the workspace folder.
- M6. Every node in every file is a graph node: each file's root (C14), each node and anonymous node (C13), and each row of a CSV file. A graph node has a file and a position, and:
- a label: the L19 label for a node Part 2 reads, the Core label for any other node, and none for anonymous nodes
- fields: a list of (key, value) pairs, from field lines, inline fields and triggers (section 3)
- an owner, section 4
- M7. A field value is a text item, a node item (whose node is a graph node), or a value trigger read from an item (L20).
3. Fields
- M8. A node's fields come from every form a field can take: its field lines (C11), the fields Part 2 reads from its label (D12,
inlineandembeddedalike), and its CSV cells. Each form adds its values under its key, in the order: label forms first, as written, then field lines in file order. - M10.
_label,_id,_stateand_mirrorare single-valued: a node has at most one value for each, from any form. A second one is the errorM10. Every other field holds every value it is given, from every form. - M11. The system fields are
_label,_name,_types,_id,_state,_tags,_link,_mirror,_result,_url,_parent,_children,_fileand_json. They are defined by system field definitions, field definition nodes (M55) built into every workspace (M53), and their meaning is fixed by this spec. They can't be defined again: a field definition node for one of them is the errorM55.2. A type lists them as it lists any field definition node (M58)._resultis the formulas in the label, each an item of a computed field (M39): read in a formula, it is their results, one item each, asR. Their results aren't fields of the node: with the label=({"a": 1}),R.ais 1 andais nothing. Every other key that starts with_is reserved (M92)._nameis the node's label without the tags at its end, its name (M23), read from the label: a node with the labelSend proof #mail #teamshas the nameSend proof, andCall #anna about budget #projectXthe nameCall #anna about budget. A formula in the label (L12) is replaced in the name by its result, written as text: a list as its items joined by;, an object in one line (M39), and nothing as nothing, with runs of spaces and tabs made one space. SoParent =("bad")has the nameParent bad; a formula that fails gives nothing. While a node's own label formulas are evaluated, its name is read as written, without their results, so a label formula that reads its own name, alone or among its siblings' as=(P.C[N = "Status"]), isn't a cycle (M44). A node without a label has no name. It can't be written: a_namevalue on a node, in any form, is the errorM11.1, and is ignored._fileis the path of the node's file, relative to the workspace folder, with/between folders, asnotes/projects.ord. It can't be written either: a_filevalue on a node is the errorM11.2, and is ignored._json, as a file's only line, is the JSON value the file is in the JSON mapping (J19), as_json:: 5; nothing in this spec reads it, and in the graph it is a field like any other. - M12. The settings of a node of a system type (M53), a type definition, tag definition, field definition node or search node, configure it; they are not data, and their child lines aren't graph data either, except a field definition node written under a
fieldssetting (M58).
4. Ownership
- M13. A graph node's owner is the node it is indented under (C9), or, for a node item, the node that has the field (C13). A file's root has no owner.
- M14. In CSV, a
_parentcell names the owner of the row, and a_childrencell names the rows it owns, in order. Both hold references (section 6). Only a file's top-level node can be re-owned this way; a node that has an owner by indentation keeps it, with the warningM14.1. A_parentcell and a_childrencell that give one node different owners is the warningM14.2; the first one read wins. - M15. Ownership never loops. Nodes in a
_parentor_childrenloop get the errorM15and have no owner. - M16. A node's
_childrenare the nodes it owns: by indentation in file order, then by_childrencells in the order written, then by_parentcells in file order.
5. Types and IDs
M17. A node with the type
_type(M53) is a type definition. It defines the type named by itsnamevalue, a name (L3):Task +_type name:: taskA type definition without a
nameis the warningM17.3and defines nothing. A value that isn't a name is the errorM17.1, and two definitions of one name are the errorM17.2.M18. A node's types are its
_typesvalues, in order, without repeats. A type without a definition is allowed.M20. A node's ID is its
_idvalue. It must be a name (L3), with the errorM20.3, and IDs match ignoring letter case. Two nodes with one ID is the errorM20.1; both keep it, and references resolve to the first in file order (M5).M19. A type definition's settings are those of
_type(M53).coloris how editors show the type, e.g. as a pill: a color name (red,orange,yellow,green,teal,blue,purple,pink,brown,gray,black,white) or#rrggbb; or the name of a field, as incolor:: project, so a node's type shows in the color of its value there: thecolorof the node the value refers to, else a color the editor picks by that node's label, or for a value that refers to no node, by its text. A node without the value shows the type as it would without the setting. A color name is never read as a field's name.M59. A node with the type
_tag(M53) is a tag definition for the tags itsnamevalues name, without#, ignoring letter case, asUrgent +_tagwith the field linesname:: urgentandcolor:: redunder it. Each value is a tag as L13 or L29 reads it: it starts with a letter and holds no]. A value that isn't is the errorM17.1, and two tag definitions for one tag are the errorM17.2. Its settings are those of_tag:color, a color name or#rrggbbthat the tag is shown in, andiconanddescription(M52).M66.
checkbox:: true(L27) gives the type's nodes a checkbox: when an editor or a tool gives a node line the type and the node has no state, it adds the trigger[ ](L11) before the line's text, after any list marker (L16), soBuy milk +todobecomes[ ] Buy milk +todo. A node that has a state keeps it, and a node without one is not an error: a reader doesn't add the trigger, and taking it away again is allowed.M51. A type's
nodessetting is a content template: its node children (C13), with their child lines. When an editor or a tool gives a node the type, on a new node or an existing one, it writes a copy of them under the node, in order, after its other children, with their_idfields left out, so each node gets its own content. When a node is given several types at once, their templates follow each other in type order (M18). Field lines undernodes::aren't part of the template; a type's fields are written from itsfieldssetting (M37). Only adding the type writes the template: a reader never adds it, and a node that already has the type doesn't get it again.Meeting +_type name:: meeting nodes:: Agenda Notes Action itemsCreating
Weekly sync +meeting, or adding+meetingto an existingWeekly sync, writesAgenda,NotesandAction itemsunder it.M52. The
iconsetting of a type, a tag definition, a field definition (M56) or a search node (M60) is an emoji, as inicon:: 📅, and itsdescriptionsetting is text about it, quoted (C21) when it holds;. Both are informative: this spec gives them no meaning, and tools don't check them. An editor may show the icon with the type, tag, field or search, and the description where it is chosen.
Built-in types (informative)
A workspace usually starts with this definition in its workspace file. It is an ordinary type definition, so its fields and settings can be changed like on any type.
Task +_type
name:: task
fields::
due::
Journal nodes, where tools put things for a date, are ordinary nodes found by their ID: journal- and the date, such as Monday 12, 2026 ^journal-2026-10-12 and October, 2026 ^journal-2026-10. They have no type. Tools create them when something goes to a date.
5a. System types and fields
M92. Reserved names. What this spec builds in is named with a leading
_: the system fields (M11) and the system types (M53), other thansearch. A name (L3) or key that starts with_is reserved for them, wherever it is written, and one that names nothing built in is the errorM92: a field's key, as_due::or[_due:: …], a type, as+_task, a tag or any part of a nested tag, as#_draft, an ID, as^_x1, a custom state (M27), a type or tag definition'snameand a field definition node'skey. The form is read as written, with the error. Defining a built-in name again is an error of its own: a system type isM17.2and a system fieldM55.2. Later versions of this spec may build in more names that start with_, so a workspace never uses them for its own.M53.
_type,_tag,_field,_workspaceandsearchare system types, built into every workspace. This spec defines them, as if these definitions were in the workspace file, and a file that defines one of them is the errorM17.2. Their color iswhite, so editors show them apart from a workspace's own types. Their settings are local field definitions (M36), and are settings only on their own nodes: on any other node,name::,key::,color::and the others are ordinary fields, and a node that has them without the system type defines nothing. The system field definitions (M11) are built in the same way.Type definition +_type name:: _type color:: white fields:: name:: description:: The name of the type it defines. fields:: description:: The fields of the type's nodes, as field lines or field definition nodes. state:: description:: The type's custom states, each a name with an optional marker and base. color:: description:: A color name, a hex color, or the name of a field whose value gives the color. checkbox:: options:: true; false description:: Whether the type's nodes get a checkbox. nodes:: description:: Nodes copied under a node when it is given the type. icon:: description:: An emoji shown with it. description:: description:: Text about it. Tag definition +_type name:: _tag color:: white fields:: name:: description:: The names of the tags it defines. color:: description:: A color name or a hex color. icon:: description:: An emoji shown with it. description:: description:: Text about it. Field definition +_type name:: _field color:: white fields:: key:: description:: The key of the field it defines. value:: description:: What is written on the nodes of the types that list it: a formula, a one-time formula, or text. valid:: description:: A formula that each value of the field must make true. options:: description:: The values the field is meant to hold, and the types of the nodes it refers to. tags:: options:: true; false description:: Whether the field's options can be written as tags. icon:: description:: An emoji shown with it. description:: description:: Text about it. Workspace +_type name:: _workspace color:: white fields:: name:: description:: The workspace's name. icon:: description:: An emoji shown with it. description:: description:: Text about it. Search +_type name:: search color:: white fields:: query:: description:: The query, written after `?` (L28): terms joined by spaces for and, and by a bar for or. view:: description:: How the results are shown. fields:: description:: The fields shown for each result. sort:: description:: The order of the results. group:: description:: The field the results are grouped by. footer:: description:: What is shown under the results. icon:: description:: An emoji shown with it. description:: description:: Text about it. Label +_field key:: _label description:: The node's label, its line without the forms that are not part of it. Name +_field key:: _name description:: The node's label without the tags at its end (M23), read from the label; it can't be written. Types +_field key:: _types description:: The node's types. ID +_field key:: _id description:: The node's ID, a name that references can use. State +_field key:: _state description:: The node's state, a built-in state or a custom state of its types. Tags +_field key:: _tags description:: The node's tags. Link +_field key:: _link description:: A reference to a node, by its label, its ID or both. Mirror +_field key:: _mirror description:: The node that this node is a mirror of, its source. Result +_field key:: _result description:: The formulas in a label, evaluated where they are written; read in a formula, their results. A formula in a field's value is a formula item of that field (M39). URL +_field key:: _url description:: A URL or a path. Parent +_field key:: _parent description:: The node's owner: the node it is indented under, or the node a CSV cell names. Children +_field key:: _children description:: The nodes it owns, in order: by indentation, then by CSV cells. File +_field key:: _file description:: The path of the node's file, relative to the workspace folder; it can't be written. JSON +_field key:: _json description:: As a file's only line, the JSON value the file is in the JSON mapping (J19); nothing else reads it.M88. A node with the type
_workspace(M53) in the workspace file (Spec F5) is the workspace node. Itsnamevalue is the workspace's name, which an editor shows for the workspace in place of its folder's name, asNotes +_workspacewithname:: Pontus's notesunder it. Its settings are those of_workspace:name, andiconanddescription(M52). Only the first one in the workspace file counts; a second one, and one in any other file, is the warningM88.1and names nothing. A workspace without one has no name, and an editor shows its folder's.M89. Workspace properties. A
pinned filesorpinned nodesfield line in the workspace file, at any depth, under a node or not, lists what an editor shows first, as pinned. Their values are written as child lines under the field line, one value each (C13), as inpinned files::withnotes/projects.ordandjournal.ordunder it. Apinned filesvalue is a file's path, relative to the workspace folder, with/between folders; apinned nodesvalue is a reference (M21), as[[^apollo]]or[[Project Apollo]]. The values of every such field in the file count, in file order, and one given twice counts once. They are not settings: they configure nothing else, and the node they are written on keeps them as ordinary fields. A value that names no file or no node is left out, without a diagnostic. A value's node item is no query result (Queries and Views) and no suggestion for a reference or a mirror: it only says what is pinned. In any other file,pinned filesandpinned nodesare ordinary fields.
6. References
- M21. A reference points from a field value to a graph node. These values are references:
- a link (L10), in any field
- a plain text value of the
_linkfield - a plain text value of the
_mirrorfield, read as inside[[and]](L10), and a mirror value (L31) - a plain text value of a reference field (M24), quoted or not in a field line, and unquoted in an inline field (L5)
- a
_parentor_childrencell (M14)
- M22. A reference names a node by ID, by label, or both, as in L10. A plain text value that is a reference (M21), in a field line, an inline field or a cell, is read as inside
[[and]], as a_mirrorvalue is:follows:: Send proof^p1names the node by ID and label, as[[Send proof^p1]]does, andfollows:: ^p1by ID alone.$node()(M74) reads its text so too. It resolves:- by ID alone (
^x1, or ID and label): the node with that ID. If none has it, the errorM22.1. The label is never a fallback; when it no longer matches the node (M23), the warningM22.2. - by label alone (
"Anna Smith", or a quoted link): the node with that label, as in M23. - by text that could be either (
[[anna]],client:: acme): the node with that ID, or else the node with that label. When it is one node's ID and another node's label, the ID wins, with the warningM22.3.
- by ID alone (
- M23. A label matches a node when their names are equal, ignoring spaces and tabs at either end and letter case. A label's name is the label without its formatting (Ord specification L34), so
[[Ship v2]]namesShip **v2**, and without the tags (L13) at its end: each tag followed only by spaces, tabs and other tags is removed, with the spaces and tabs before it. Tags elsewhere are part of the name, and a label that is only tags is its own name. SoBuy milk #urgentis namedBuy milk, and[[Buy milk]],[[Buy milk #urgent]]and[[Buy milk^x1]]name it;Call #anna about budget #projectXis namedCall #anna about budget, which[[Call about budget]]doesn't match. A label with formulas (L12) matches by its name as written and by its name with each formula's result in its place (M11):Parent =("bad")matches both[[Parent =("bad")]]and[[Parent bad]]. The results are those of the last evaluation; when they change a name, references are resolved again and the formulas evaluated again, at most twice, so a name that depends on the references it resolves settles. An editor that writes a reference to a node writes its name. Letter case is compared by mapping both to lowercase with Unicode's default case mapping (not locale-specific); there is no other normalization, soéwritten as one character or aseand a combining accent are different labels. In a reference field (M24), only nodes of its types match. No match is the warningM23.1; several matches is the warningM23.2, and the reference doesn't resolve. - M24. A field is a reference field when its field definition, a type's (M36) or a field definition node (M55), has an
optionssetting (M46) that names one or more types, each as an item+name, as inoptions:: +personoroptions:: +person; +company. A plain value of a reference field is then a reference to a node of those types, unless it equals one of the setting's other options, ignoring letter case, which stays text: withoptions:: nobody; +person,owner:: nobodyis text andowner:: Annaa reference. Any other field's plain values are text, even when they name a node; a tool may suggest addingoptions:: +name, but doesn't resolve them. - M25. References may form cycles. They are links, not ownership or dependencies.
6a. Mirrors
- M48. A node with a
_mirrorfield, from a mirror line@ Label(Ord specification L30), an inline field or a field line, is a mirror of the node its reference resolves to (M22), its source. A mirror adds nothing to its source: the source keeps its one owner (M13), its fields and its children. The mirror is a graph node of its own, owned where it is written, with an empty label. A mirror whose reference doesn't resolve has that reference's diagnostic and no source. A mirror can't itself be a source, since it has no label or ID to be named by. A reference that ends in an Ord or CSV file's extension,.ord,.txtor.csv, ignoring letter case, is a path instead: the mirror's source is that file's root node (M13), so it shows the whole file, its top-level nodes as the source's children. The path is resolved as a path link is (L14), relative to the folder of the file the mirror is in, so@ plan.ordis a file beside it,@ notes/plan.ordone in a folder under it and@ ../plan.ordone in the folder above; the extension is required. A path that names no file of the workspace is the warningM48.1, and the mirror has no source. A file mirrored in itself, at any depth, is under its own source (M50.1). An editor shows the file's name in the mirror's place, and edits through it change the file's lines; it suggests the workspace's other files, by their paths, when@is typed. - M49. A mirror stands for its source. A mirror that is a field's node item (C13) is a reference (M21) from the field's node to the source, so
attendees::with@ Anna Smithunder it means whatattendees:: @Anna Smithandattendees:: [[Anna Smith]]do, and a reference field's options (M24, M46) check the source. A mirror that is a child stands for its source in its owner's_children(M16), in formulas (M41) too: a project's$sum(_children.hours)counts the tasks it mirrors. A source mirrored more than once under one owner is one child, at its first place. - M50. A mirror under its own source, at any depth, is the warning
M50.1. It stands for nothing in_children, and an editor shows the source's line but doesn't unfold it. Lines under a mirror are the warningM50.2, since a mirror's children are its source's. They are kept as the mirror's own, and an editor may offer to move them into the source.
7. States
- M26. A node's state is its single
_statevalue (M10), from its trigger (L11) or a field. It is a built-in state,new,in-progress,waitingordone, or a custom state (M27): one that a custom marker stands for (M29), or else the last in type order (M18) of the node's types that defines it. A value that is none of these is the warningM26, and the node keeps it as its state, with no base. - M27. A type's
statesetting defines its custom states:|-separated parts, each a name (L3), an optional marker in brackets, and an optional>and base, a built-in state, as intriage [t] > new | review [r] > in-progress | shipped > done | someday. Spaces and tabs around the parts don't count. A part in another form, with a base that isn't a built-in state, or with the name of a built-in state or of a custom state the type already has, is the warningM27.1, and the part is left out. - M28. A custom state's marker is one character. It can't be a built-in marker (
,-,?,x), with the warningM28.1, and a marker can belong to only one custom state across all types, with the warningM28.2on each later one. Such a custom state has no marker. - M29. A custom marker stands for the custom state it belongs to, on any node:
[r] Fix loginhas the statereview. A marker no custom state has (L11) gives the node no state. - M30. A node's base is its state's base. A built-in state is its own base. A custom state without a base, and a state that is the warning
M26, give the node no base. - M31.
doneis true for a node exactly when its base isdone.
8. Field definitions and formulas
Tests in Appendix A cover each rule of this section. The rules run from definitions, through what tools write, options and tags, and formulas, to the function library and one-time formulas.
M36. A type definition's
fieldssetting holds field definitions: local field definitions, its field lines under its anonymous node (C13), and field definition nodes (M55, M58). The two are one thing written two ways, with the same settings (M56), and differ only in scope: a local definition applies on the type's nodes, a field definition node on every node (M57). A local definition's key is the field it defines, what is written after it on its line is itsvaluesetting, and its child field lines are its other settings. A formula must start on the key's line (M87). A child field line whose key isn't a setting (M56) is a nested field definition: it defines a field written under that field, as a field line of its anonymous node (C13), and has the same settings and nested field definitions of its own, at any depth. When several of a node's types define the same key, the last of them in type order (M18) wins: its definition applies, whole, with its settings, and the others' don't, none of their settings merged in. So with+task +bug, where both definepriority,+bug'soptionsandvalueapply. A field definition node applies only where none of the node's types defines the key (M57). The same holds wherever a node's types disagree: the last type's custom state (M26), calculated field (M87) and tag field (M47).M55. A node with the type
_field(M53) is a field definition node. It defines the field whose key is itskeyvalue, for the whole workspace:Priority +_field key:: priority options:: high; medium; low tags:: trueA field definition node without a
keyis the warningM55.3and defines nothing. Where this spec matches a field to its definition, keys match ignoring letter case, as labels do (M23); the Core keeps keys as written, soDueanddueon one node are still two fields. Two field definition nodes for one key are the errorM55.1, and one for a system field (M11) the errorM55.2.M56. A field definition's settings, local or a node, are
value,valid,optionsandtags, as in M37 to M47 and, for a calculated field, M87, andiconanddescription, as in M52. A field definition node has them as field lines, besides itskey.M57. A field definition node applies on every node (M36), so with the definition above,
Crash #highhaspriority:: highwhatever its types. Only itsvalue(M37) is limited: it is written on the nodes of the types that list it (M58), or for a formula calculated on them (M87), since only they are meant to have the field.M58. A type lists a field definition node in its
fieldssetting in either of two ways:- a field line with its key and no value or child lines. A value or child lines there are the error
M58.1and are left out, since a type can't change a field definition node. The exception is a~exprvalue for_id(M37). So a type can't calculate a system field:_label:: =(…)underfields::is this error too. - the field definition node itself, written under
fields::as a node item (C13). It is read there although it is under a setting (M12), and defines its field for the whole workspace, as it would anywhere else.
For a key that no field definition node defines, a type defines its own field (M36).
Task +_type name:: task fields:: Owner +_field key:: owner options:: +person priority:: due::Here
ownerandpriorityare defined for the whole workspace, anddueonly fortask.- a field line with its key and no value or child lines. A value or child lines there are the error
M37. A type's fields are written on its nodes. When an editor or a tool gives a node a type, on a new node or an existing one, it writes a field line for each of the type's field definitions (M36, M58), other than calculated fields (M87), whose key the node doesn't have, where C48 puts a new field, in definition order. When a node has several types, each type's fields follow in type order (M18), and a key that several of them define is written once, where the first of them puts it, from the definition that applies (M36), the last type's. The line holds the definition's
valueas written:~expras a one-time formula, which is then replaced with its result (M85), any other value as text, and no value askey::. Nested field definitions (M36) are written as field lines under their field, the same way._idisn't written as a field line: a~exprfor it gives each node of the type without an ID one, once: the result, when it is a name (L3) that no other node has as its ID, else an ID the tool makes up. A reader never gives a node a field or a value from its types, except a calculated field (M87): a node has what is written on it, and a type'svalueis what tools write.Invoice +_type name:: invoice fields:: amount:: vat:: =(amount * 0.25) status:: openGiven the type,
March +invoicebecomes the lines below.vatisn't written: it is calculated (M87).March +invoice amount:: status:: openM84. A type definition edits its nodes. A change to a type's field definitions is a change to its nodes, as an edit through a mirror is a change to its source (M48), except that it is written into each node's file. When a type gains a field definition, nested ones included, tools write it on each node of the type that doesn't have its key, as M37 does. When a field definition's
valuechanges, tools rewrite the field on each node whose value is still the old one as written, ignoring spaces and tabs at either end, and leave it where the node writes another value: that node has changed it. A field definition renamed in place, its key changed and nothing else in the type's fields, renames the field on each node that has it, keeping the node's value. A field definition that is removed leaves its fields on the nodes as they are. A change reaches only the nodes the definition applies to (M36): on a node with a later type that defines the same key, the field is that type's, and stays as it is. A calculated field (M87) isn't written, so a change to its formula changes no file. When avaluebecomes a formula, tools remove the field from each node whose value is still the old one as written; a node that writes another value has the errorM87.1until it is removed. When a formula becomes a plain value or none, tools write the field on each node as M37 does. Tools write these edits once the change to the type definition is done, not while it is being typed, as one edit of all the files, so one undo takes them back.M46. An
optionssetting lists the values a field is meant to hold, as its items or as the labels of its node items without child lines (C13), in order. An item+namenames a type instead, whose nodes the field refers to (M24); it is not an option. A value written for the field, other than a formula, on a node the definition applies to (M36), or the result of a calculated field (M87), that equals none of the options of the definition that applies (M36), ignoring letter case, is the warningM46, and the value stays. On a reference field such a value is a reference instead, and not the warning. Options say how a field is meant to be used, not its value type, and tools offer them first when a value is typed.M47. A
tagssetting oftrue(L27) lets the field's options (M46) be written as tags. On a node the definition applies to (M36), a tag that equals one of the options, ignoring letter case, is a value of that field instead, spelled as the option is, and the node doesn't have that tag: withoptions:: bug; featureandtags:: trueon theissue typefield,Crash +issue #bughasissue type:: bug. On other nodes the tag is a tag. An option is matched as written:tech-debtby#tech-debt, andTech Debtby[#Tech Debt](L29), never by#tech-debt. On a reference field (M24), a tag also names a node of its types, the value then referring to that node: first by its label as written, then by its name (M23), and last by its ID. Withoptions:: +projectandtags:: true,#ord-noteson a task refers toOrd-notes +project ^abc123,#ordtoOrd #new +project, before a node whose ID isord, and[#Ord Notes](L29) toOrd Notes +project. A tag is matched only against what is written, never against a slug:#ord-notesdoesn't nameOrd Notes +project. When fields of two of a node's types take one tag, the last type's field has it (M36). The text stays as written.M39. A formula (L12) can be written wherever a field's value goes, and is then a formula item: on a field line, alone or among other items (
total:: =(a + b),tags:: draft; =(project._tags)), in an inline field ([total:: =(a + b)]), or as a child line of a field line that holds only the formula and has no child lines of its own, which is the same item as the formula written on the field line:total:: =(a + b)means what
total:: =(a + b)does. On an ordinary node, a formula item stands for its result: one item, one item per element when the result is a list, and none when it is empty. A field with formula items is a computed field, written on the node, unlike a calculated field (M87): its value is its items in order, each formula item replaced by its result, so formulas and plain values can be mixed, and a field can have several formulas. A result with objects is the field the JSON mapping reads it as (J9, J10, J20), each object fields, never a node (J26), and each member a field: plain elements are items, one object is the field's anonymous node (C13), ascontact::withprimary:: annaunder it reads as{"primary": "anna"}(M41), and several, or an array withnullor a nested array, are index fields,0::,1::and so on, each with its members under it (J20), not a field line each as J10 writes records, since the result is one field's, and{}is{}; formulas read them back as the same array (M41). An editor shows each formula item's result after the formula, where it is written, the items joined by;. A result with objects it shows under the formula's line instead, as it shows calculated fields (M87): a row for each field,key = items, a field whose value is an object askey::with its fields on the rows under it, one level in, and first a row= itemsfor the items that aren't objects, so=({"a": 1, "b": {"c": 2}})showsa = 1, thenb::withc = 2under it. Each object of several shows on a row of its own, its first plain field, with its other fields on the rows under it. Where a result is text in one line, as in a name (M11), an object is its fields askey:: items, separated by,:a:: 1, b.c:: 2. A=exprvalue of a setting of a node of a system type (M12), other than a field definition node'svalueandvalidand a search node'sfooter(M64), is the errorM39; the formula isn't evaluated.M87. Calculated fields. A field definition (M36, M55) whose
valueis a formula,=expr(L12), defines a calculated field. Every node the definition's value applies to (M37, M57) has the field, with the formula's result as its value, evaluated on the node (M41) as a formula item is (M39), so a list gives one item per element and nothing gives none. The field is never written on the nodes, and a file read as plain text doesn't hold it (M86). On a local field definition, the formula is written after the key on its line and must start there; one over several lines (C52) continues under it:Expense +_type name:: expense fields:: line_a:: line_b:: total:: =(line_a + line_b) valid:: =($value >= 0)An editor shows a calculated field first under the node line, before what is written under the node, as its key,
=and its result, separated by;when there are several:by a boat +expense, withline_a:: 2000andline_b:: 50under it, showstotal = 2050above them. It is drawn apart from field lines, and can't be edited there; an evaluation error shows in its place (M44). Formulas, queries and mirrors read it as they read any field (M86). Its other settings apply to its result:validchecks it (M40),options(M46) says what it is meant to hold,tags(M47) lets a query match its value by a tag, though a tag on a node never sets it, andiconanddescriptionare as in M52. A diagnostic about a calculated field's result is on the node's line. A node that has a calculated field from several types has the last type's (M36). A nested field definition (M36) with a formula is calculated the same way, on the field's anonymous node (C13) but evaluated on the node (M41), and shown first under that field's line. A field line with nothing on it or under it, asparts::, counts as having an anonymous node with no lines, so its nested calculated fields are there too: withparts::anddouble:: =(line_a * 2)under it on the type, a node withline_a:: 10and an emptyparts::hasparts.double, 20, shown under itsparts::line.A node can't write a field it calculates: a value for that key on the node, in any form, is the error
M87.1, and is ignored. A child field line under a calculated field's definition whose key isn't a setting (M56) is the errorM87.2, since a calculated field has no nested fields, and so is a formula alone on a child line of a local field definition, which isn't its value; both are left out.M40. A
validsetting holds=expr, a check. Each value written for the field on a node the definition applies to (M36), other than a formula, is checked on its own: the expression is evaluated on the node (M41), with$valuebound to that value and$valuesto all the node's written values for the field, as a list. A calculated field's (M87) result is checked once,$valueand$valuesboth its value. A check whose result isn't true is the errorM40, on the value, or on the node's line for a calculated field, and the value stays. A check that fails to evaluate is the errorM44.3, on the definition.M41. Formula language. A formula's expression is JSONata 2.x, written
=(…)so that$is allowed (L12). The current node is$, the graph root$root, and a node is an object with its fields as members, system fields included:_parentis its owner (M13) and_childrenthe nodes it owns (M16). A reference field's value is the node it refers to, and a field with field children (C13) is an object of them, or, when they are index fields,0::,1::and so on in order with unquoted keys (JSON mapping J20), an array of their values: withr::and0:: a,1::and2:: b; cunder it,ris["a", null, ["b", "c"]]. A quoted key,"0"::, keeps an object. A field's value is its item when it has one and an array when it has several, and always an array when it is a list (C16): withx:: a;or[x:: a;],$type(x)isarray, and withx:: ;,$count(x)is 0. A formula in a field line under another field, at any depth, is evaluated on the node that owns the outermost field, not on the anonymous node it is written in: withfirst:: =(sublevel.second & _tags)andsublevel::withsecond:: =(_label)under it on the nodeTest #tag,$,_label,_parent,_children,_idand the other fields are the same in both formulas, andsecondisTest #tag. A node is true wherever a value is tested for truth, as ina ?: b,a ? b : c,and,or, a predicate[…],$booleanand$not, whatever fields it has:_parent ?: "none"gives the owner even when it has no fields of its own. Nine system fields also have one-letter aliases:Lis_label,N_name,P_parent,C_children,S_state,G_tags,Y_types,I_idandR_result. A node's own field with the same key as an alias comes before it. A formula's result can be a function,function($x){ $x * 2 }, alone or as a member of an object, and other formulas call it where they read the field: withdouble:: =(function($x){ $x * 2 })onLib,$node("Lib").double(21)is 42. A function reads the nodes and variables where it is written, so in its body$and bare names are its node's, not the caller's: pass the caller's node in, as$node("Lib").label($$), where$$is the node the formula runs on and$, inside the path, would beLib. An editor shows a function asƒand its parameters,ƒ($x). A function can't be written in a file: a one-time formula (M85) whose result holds one is an evaluation error (M44.3). Workspace formulas. Aformulas::field line in the workspace file (Spec F5), at any depth, under a node or not, holds fields that every formula in the workspace reads as$names: withformulas::anddouble:: =(function($x){ $x * 2 })andrate:: 0.25under it, any formula can write$double(21)and100 * $rate. They are evaluated on the workspace, wherever they are written:$in them is$root, sofiles:: =($count($.C))counts the files. They can read each other, and their dependencies and cycles are those of fields (M44). A binding in a formula comes before them: in($double := 3; $double),$doubleis 3. A key that can't be written after$(a letter or_, then letters, digits and_), or that is the name of a JSONata or Ord function, such assumornode, is the errorM41.1and binds nothing; a key that anotherformulas::field already gave, in file order, is the errorM41.2, and the first counts.formulas::in any other file is an ordinary field.M43. Formulas are pure, except
$today(),$now(),$date()with a date name (M78) such as"tomorrow"and$days()with one argument, whose results follow the clock. One-time formulas (M85) may also use the generators (M93), whose results differ on each call; elsewhere they are an evaluation error (M44.3).M44. Dependencies are per node and field, calculated fields (M87) included. Fields in a cycle are empty, with the error
M44.1naming the whole path; fields that depend on a cycle are empty, with the errorM44.2. An evaluation error leaves its formula item without a result, with the errorM44.3; the field's other items stay.M42. The function library adds
$node(text),$nodes(under?),$query(text, under?),$ancestors(node?),$today(),$now(),$date(text, days?),$days(a, b?),$format(x, picture),$slug(text?),$first(x)and$last(x), which M74 to M83 and M91 define, and, in one-time formulas only, the generators$seq(n),$uuid(),$id()and$sid(), which M93 defines. Dates are ISO text.M74.
$node(text)gives the node thattextnames, as a link does: the node whose ID (M20) istext, ignoring letter case and spaces and tabs at either end, else the node whose label matches it (M23). Text that starts with^names a node by its ID only:$node("^i42"), andLabel^idby its ID, as in a link (M22). Text that is one node's ID and another node's label gives the ID's node, with a warning. Text that names no node, or a label that matches several, gives nothing, with a warning. Unlike a reference field (M24), it matches nodes of any type. A number is read as its text, and a list gives the nodes its items name, leaving out those that name none; any other value gives nothing. Any text works, so$node("journal-" & $today())is today's journal node.M75.
$nodes()gives every node in the workspace, other than each file's root node (M13), field items (C13) and mirrors (M48): depth first, each node before the nodes it owns, in file order. Archived nodes (M63) are included.$nodes(under)gives only the nodesunderowns, at any depth, in the same order;underis a node, or text naming one as$node()does, with its warnings, or a list of them, giving each node once. When it names no node, or the node owns none, the result is empty. The result is a list of nodes, filtered with JSONata on any field, system fields included:$nodes()["task" in _types and _state != "done"].M76.
$query(text, under?)gives the nodes the querytextmatches, by the query rules (M61 to M63, M65), in file order:$query("+task #project [ ]"). Withunder, as in M75, only thoseunderowns, or that a mirror it owns stands for (M65). A query that doesn't parse, or that holds a formula, is an evaluation error (M44.3); a formula's result is filtered instead:$query("+task")[due < $today()]. A formula that uses$query()depends on every node's types, tags, states and fields.M91.
$ancestors(node?)gives the node's ancestors, the nearest first: its owner (M13), its owner's owner, and so on, its file's root (C14) last, each once. Withoutnodeit is the formula's node (M41);nodeis a node, or text naming one as$node()does (M74). Mirrors (M48) are never ancestors, so the places a node is mirrored to don't count. A filter picks the nearest that matches:$ancestors()["project" in _types][0]is the nearest project, and$ancestors()[client][0].clientthe nearest ancestor's client. As a field'svalue(M37), a one-time formula over it lets a field start with a value from the node's ancestors: withproject:: ~($ancestors()["project" in _types][0])andoptions:: +projecton the typetask,[ ] Send mapping draft +taskunderApollo +projectgetsproject:: Apollo. A formula that uses$ancestors()depends on the ownership of the nodes above its node.M77.
$today()gives today's date in local time, as a date (L23):2026-10-22.$now()gives the local date and time, as a datetime (L24) with seconds and without an offset:2026-10-22T14:30:05. Local time is the time zone of the tool that evaluates the formula.M78. A date name is one of these, in any letter case:
today,tomorrow,yesterday(oryday) andnow; a weekday,mondaytosunday, which is the next one, today included; andthis-,next-orlast-followed by a weekday, which is that day in this, the next or the last week, or byweek,monthoryear, which is that period (M79). Weeks start on Monday (L25).nowis a datetime, the periods are lists of dates, and the others are dates.M79.
$date(text, days?)readstextwithout spaces and tabs at either end. A date (L23) or a datetime (L24) gives itself. A week or a month (L25), or a year written as four digits, gives a period: the list of its dates, in order, sodue in $date("2026-W42")works. A date name (M78) gives what it names. A number is read as its text, so$date(2026)is that year. Anything else, a week that doesn't exist included, gives nothing, with a warning. Withdays, a number, each date is shifted by that many whole days, the number truncated toward zero, and a datetime keeps its time and offset:$date("2026-10-22T09:00", 7)gives2026-10-29T09:00. Adaysthat isn't a number is ignored.M80.
$days(a, b)gives the whole days from the date ofato the date ofb, negative whenbis earlier, ignoring the times of datetimes:$days("2026-10-20", "2026-10-22")is2.$days(a)counts from today toa.aandbare dates or datetimes; anything else, a date name or a period included, gives nothing.M81.
$format(x, picture)writes a number or a date with a JSONata picture. A number is written as JSONata's$formatNumberdoes:$format(1234.5, "#,##0.00")gives1,234.50. A date or a datetime is written as$fromMillisdoes:$format("2026-10-22", "[D1] [MNn] [Y]")gives22 October 2026. A date is read as its midnight, a datetime without an offset at its time as written, and one with an offset is written in UTC. Any other value, or apicturethat isn't text, gives the value as text, and nothing gives nothing.M82.
$slug(text)gives the slug of the text (M45):$slug("Åsa Öberg!")givesasa-oberg. A number is read as its text, and a list gives the slug of each item; any other value gives nothing. A slug can be empty:$slug("2026")gives"".$slug(), with no argument, gives the slug of the formula's node's name (M23): onÅsa Öberg! #team,asa-oberg, and nothing on a node without a label. An argument that is nothing, as a field the node doesn't have, still gives nothing:$slug(missing)isn't$slug().M45. A slug is the text in lowercase, accents removed, each run of characters other than letters and digits turned into one
-, with leading digits and-and trailing-removed.M83.
$first(x)and$last(x)give the first and the last item of a list, and nothing for an empty list. Any other value gives itself, so a field with one value or several reads the same way:$first(owner).M85. One-time formulas. A one-time formula,
~(…)or~expr(L32), on an ordinary node, in a label or as a field's item, is evaluated as a=formula there would be (M39, M41), and a tool writes its result in its place, so the file holds the value, not the formula: in a field, the result written as the field the JSON mapping reads it as (J9, J10, M39), by the writer that writes every field (C16, C26), except that a string is written bare even when it reads as a number or a boolean, socode:: ~$seq(1)givescode:: 1:due:: ~$today()becomesdue:: 2026-11-06,~(["a", "b"])givesa; b,~(["a"])givesa;, and text with a;or a line break is quoted, as"x\ny"; in a label, the result's text, a list's items joined by;and a line break written as a space. A node in a field's result is written as a reference to it (M21): its name (M23), orLabel^idwhen the name alone doesn't name it (M22), the tool giving it an ID when it has none. Objects in the result (M39) are written as their field's lines under the field's line, one level deeper, after its other lines:x:: ~({"a": 1, "b": {"c": [2, 3]}})becomesx::witha:: 1andb::under it, andc:: 2; 3underb::, andx:: ~([{"a": 1}, {"a": 2}])becomesx::with the index fields0::and1::under it,a:: 1under the first anda:: 2under the second (M39); the formula goes from the line with the;next to it. Objects can't be written in a label, an inline field or a formula alone on a child line, nor one object when the field already has field lines under it, since a field has one anonymous node (C13): the formula stays, with that error. A tool does this once the formula is no longer being edited, in a file it edits or shows. An editor that knows its cursor writes it once the cursor is neither in it nor right before or after it, as after a space, a line break or a tap elsewhere, and until then shows its result, as for a=formula (M39). When a character typed right after it turns it into another formula that fails, or into text, as~$today()x, the result it showed takes its place and the character stays after it. A tool without a cursor writes a formula that ends where the person is typing once a space or a line break follows it, and one elsewhere once edits pause. A result that is an error, or nothing, isn't written: the formula stays, and an editor shows the error after it, as for a=formula (M39). Until a tool replaces it, a one-time formula has no value: as a field's item, it adds no item. Avalueofauto expr, the form this replaces, is the warningM85.1, and isn't evaluated: write~(expr).M93. Generators. A one-time formula (M85) can use four functions that make a new value each time:
$seq(n)gives the next number, written with at leastndigits, leading zeros added: one more than the largest number at the end of a value of the field (of the ID, for_id) on the nodes of a type, ignoring formulas, and 1 when there is none. The type is the one whose definition of the field applies to the node (M36), else the node's last type, and with no types every node counts. One tool run gives each call the next number, so several nodes written at once get 7, 8, 9: with_id:: ~("BE" & $seq(3))onbug, and bugs up to^BE006, a new bug gets^BE007.nis truncated toward zero, and one that isn't a number above 0 means no padding.$uuid()gives a random UUID, as6f1c2a4e-9b0d-4c1e-8f3a-2d7b5e9c1a40.$id()gives six random characters, a lowercase letter, then lowercase letters and digits, ask3x9pq.$sid()gives the slug of the node's name (M23, M45),-and three random lowercase letters and digits, assend-proof-k3x, or, for a name with no slug, what$id()gives.
A tool that writes an ID from a type's formula (M37) tries again, a few times, while the result is no name (L3) or another node's ID, and then makes one up.
9. Queries
Tests in Appendix A cover each rule of this section.
- M60. A node with the type
search(M53) is a search node. It is written only as an inline search,? query(Ord specification L28): its query is what follows the?, on one line, and its other settings, the view settings (M64), are its field lines. A filter too long for the line is better a calculated field on a type (M87), queried as=(late).searchwritten as a type any other way, as+search,[_types:: search]or a_types::line, is the errorM60.1, and the node gets no typesearch; so is aqueryfield line under a search node, which is not read. On any other node,query::is an ordinary field. A search has no label of its own (L28): where a name is needed, such as its results document, it is named by its query. - M61. A query is terms, joined by spaces for and,
|for or, and grouped by parentheses;!before a term or group negates it. A term is+type,#tag, a state trigger, a link, a mirror term@and a reference (M65), a field[key:: value], or[key::]with no value, which is the formula=($exists(key)), a formula=(…), or a word, which matches a node's text (M62). - M62. A node matches
+typewhen it has the type,#tagwhen it has the tag or a tag nested under it, ignoring letter case (#projectmatches#project/apollo), or, when a field of one of its types withtags:: true(M47) would take the tag, when that field's value is what the tag would give it (withtags:: trueandoptions:: +projectonproject,#LUmatches a task withproject:: LUas well as one written#LU),[x]and the other triggers when its state or its base is that state, a link when one of its fields refers to the node it resolves to,[key:: value]when one of itskeyvalues equals the text, ignoring letter case, or, when the text is a value form (L21) other thantext(L35), is a value of the same form with the same value: numbers as numbers, so[n:: 1.5]matchesn:: 1.50, and datetimes as the same time, so[at:: 2026-10-15T14:30]matchesat:: 2026-10-15 14:30(a datetime with an offset matches one with the same moment, one without an offset only one without), a computed field's (M39) and a calculated field's (M87) values included, as the text their results are written as (a node by its ID or name), a formula when its result is true, and a word when its label contains it, ignoring letter case, or else its ID, one of its types, one of its tags, or one of its fields' keys or values as written does, system fields other than_tagsleft out:be086matchesMentions be086,Event ^BE086and a node withref:: BE086. A word written with*, outside quotes, is a pattern that one of these texts must match whole, each*standing for any characters, none too, ignoring letter case:jour*matches a label, ID, type, tag, key or value that starts withjour,*notesone that ends withnotes, and a label also matches when its name (M23) does. A word written^wordmatches a node's ID only, and^journal*the nodes whose IDs start withjournal;^alone is a word. A quoted word is literal:"jo*"holds a*. An editor that lists a search's results without asortsetting lists the nodes whose labels hold its words (not its^words) first, then the others, each in file order. - M63. Nodes tagged
archivedmatch only queries that name#archived. - M64. A search node's view settings are
view,fields,sort,groupandfooter. What they show, and how, is implementation; what they hold is specified here. Aviewholds how the results are shown, such aslist,table,boardorcalendar. Afieldssetting holds the columns, one field line each under it, on its anonymous node (C13), in order:key::with no value is the fieldkeyof each result, a system field (M11) included, as_label::or_state::, andkey:: =expris a template column namedkey, the formula's result evaluated on each result (M41), shown and never written. A column's child lines are the implementation's own, and nothing in this spec reads them. Withoutfields, an editor chooses the columns, such as the label and the fields of the results' types. Asortholds conditions as items (C15), applied in turn, each a field key, then optionallyascordescand then optionallynumber(ornum),textordate; the defaults areascandtext. Text compares as people read it, ignoring letter case and with each run of digits as a number, so30comes before120, andItem 9beforeItem 10. Agroupholds a field key; the results are grouped by its value. Afooterholds=expr, evaluated with the list of the results' nodes as$, and is shown with the results, and with each group's; nothing else reads it, and it is never written into a file (M86). - M65. A query matches a node in its own place, never a mirror (M48), so a node mirrored in three places is one result. The term
@and a reference, written as in a mirror line (L30) but with no space after@, matches the node the reference resolves to. A query is scoped by$query(text, under)(M76) to the nodesunderowns, at any depth, and a node is in the scope when it or one of its mirrors is: a mirror owned byunder, or by a node in the scope, puts its source in, so$query("@anna", "Team")findsAnnawhenTeamholds@ Anna. A query has no terms of its own for a scope. A search node (M60) never matches a query: it is a query, not a result.
10. Diagnostics
Codes, severities and positions work as in the Spec (C35 to C37). Positions are in the file the diagnostic is about.
- M90. Paths are not checked for portability. A path in a file, a path link (L14), a mirror's path (M48) or a
pinned filesvalue (M89), gets no diagnostic for being one that may not work on another machine: an absolute path (/Users/anna/plan.ord,C:\notes), one starting with~/, one with\between folders, one that leads outside the workspace, or one whose letter case differs from the file's name on a file system that ignores case. Whether a path names a file is decided where the workspace is read, as it is: a mirror's path that names no file there is stillM48.1, and nothing else is given. An editor may offer to rewrite a path, but not as a problem.
| Code | Severity | Given when | Position |
|---|---|---|---|
M10 |
error | A node has a second _label, _id, _state or _mirror value |
the second value |
M11.1 |
error | A node writes a _name value |
the value |
M11.2 |
error | A node writes a _file value |
the value |
M14.1 |
warning | A _parent or _children cell names a node owned by indentation |
the cell |
M14.2 |
warning | _parent and _children cells give a node different owners |
the later cell |
M15 |
error | A node is in an ownership loop | the node |
M17.1 |
error | A type definition's name isn't a name, or a tag definition's isn't a tag |
the value |
M17.2 |
error | A type or a tag is defined twice, or a system type in a file | the second name field |
M17.3 |
warning | A type definition has no name |
the +_type trigger |
M20.1 |
error | Two nodes have one ID | each ID after the first, in file order (M5) |
M20.3 |
error | An ID isn't a name | the ID |
M22.1 |
error | A reference's ID matches no node | the reference |
M22.2 |
warning | A reference's label no longer matches the node its ID names | the reference |
M22.3 |
warning | A reference is one node's ID and another node's label | the reference |
M23.1 |
warning | A label matches no node | the reference |
M23.2 |
warning | A label matches several nodes | the reference |
M26 |
warning | A _state value is neither a built-in state nor a custom state of the node's types |
the value |
M27.1 |
warning | A custom state isn't name [m] > base with a built-in base and a new name |
the state setting |
M28.1 |
warning | A custom state uses a built-in marker | the state setting |
M28.2 |
warning | A marker belongs to a custom state already | the state setting |
M39 |
error | A formula on a setting of a node of a system type, other than a field definition node's value and valid and a search node's footer |
the value |
M40 |
error | A valid formula isn't true |
the value, or the node's line for a calculated field (M87) |
M41.1 |
error | A workspace formula's key can't be written after $, or names a JSONata or Ord function |
the field |
M41.2 |
error | A workspace formula's key is given by another formulas:: field already |
the field |
M44.1 |
error | A computed field is in a cycle | the formula |
M44.2 |
error | A computed field depends on a cycle | the formula |
M44.3 |
error | A formula fails to evaluate | the formula |
M46 |
warning | A value is none of the field's options |
the value, or the node's line for a calculated field (M87) |
M48.1 |
warning | A mirror's path names no file of the workspace | the mirror's _mirror value |
M50.1 |
warning | A mirror is under its own source | the mirror's _mirror value |
M50.2 |
warning | A line is under a mirror | the line |
M55.1 |
error | A field is defined by two field definition nodes | the second key field |
M55.2 |
error | A system field (M11) is defined again | the key value |
M55.3 |
warning | A field definition node has no key |
the +_field trigger |
M58.1 |
error | A type gives a field definition node's key a value or child lines | the field line |
M60.1 |
error | search written as a type, not as ? query, or a query field line under a search node |
the type, or the field line's key |
M87.1 |
error | A node writes a field that one of its types calculates | the value |
M87.2 |
error | A calculated field's definition has a nested field, or a local field definition has a formula alone on a child line | the line |
M85.1 |
warning | A field definition's value is auto expr, now written ~(expr) |
the value |
M88.1 |
warning | A second _workspace node in the workspace file, or one in another file |
the type |
M92 |
error | A name or key that starts with _ names no system field or system type |
the type, tag or ID, the field's key, or the name or key value |
Appendix A: Graph dump and tests
Tests work as in the Test format, part B, with one more option.
- M70. With the
graphoption, the input is a workspace and the expected output is its graph dump. The input holds one or more files, each starting with a line---and the file's path, e.g.--- tasks.ord. A path ending in.csvis a CSV file. Formulas see 2026-10-15T14:30 as the date and time now (M77), or 14:30 on the date of a test optiontoday:YYYY-MM-DD. - M71. The graph dump lists each file, in the order of M5, as
fileand its path, and under it, indented two spaces per level, its nodes by ownership (M16), starting with the root's children. A node isnodeand its label as a string (D8), ornodealone when it has none, then@and its line when it has one, as@path:linewhen it is in another file than the one listed, and for a node item (C13),inand the field's key, e.g.node "Erik" @12 in "contacts". - M72. Under a node, before its children, come only the facts this spec decides, in this order, each when present:
id,type(one line per type),state,basewhen it differs from the state,reflines:ref, the key,->, and the target's file and line aspath:line, e.g.ref "client" -> a.ord:1, andcalclines, one for each of its calculated (M87) and computed (M39) fields, sorted by key:calc, the key, and each item of its value as a string, as an editor shows it (M39), e.g.calc "total" "2050"; a field with no items, or whose formula fails, is its key alone. A nested calculated field's key is its path, asparts.double. A label's formulas (_result, M11) aren't listed. A search node (M60) has, after them, aresultline for each of its results, in the order an editor lists them (M62, M64):result, its group as a string with agroupsetting,->and the node's file and line, e.g.result "travel" -> a.ord:4; and with afooter,footerand its value, then for each group, in the order of its first result,footer, the group's value,inand the group, e.g.footer "150" in "travel". A query that doesn't parse has noresultlines. - M73. Diagnostics follow, one per line, sorted by file, line, column and code:
!, the code, andpath:line:column. - M94. With the
changeoption, the input is a workspace, as forgraph(M70), and then the files a person's edit changed, each starting with a line===and its path, as the file is after the edit. The expected output is every file, in the order of the input, each starting with a line---and its path, after the edits tools make once the person's edits have settled, in this order: on each node line the edit gave a type, a checkbox (M19), the content template (M51) and the types' fields (M37); a change to types' field definitions, written on their nodes (M84); and one-time formulas written over and IDs given (M85, M93), pass after pass until a pass writes nothing. Formulas see the date and time as in M70. Generators whose results are random (M93) aren't tested.
--- a.ord
Acme Corp +company ^acme
Anna +person
Call [[Anna]] about [[Acme Corp]]
client:: acme
.
file "a.ord"
node "Acme Corp" @1
id "acme"
type "company"
node "Anna" @2
type "person"
node "Call [[Anna]] about [[Acme Corp]]" @3
ref "_link" -> a.ord:2
ref "_link" -> a.ord:1
--- types.ord
Bug +_type
name:: bug
state:: triage [t] > new | review [r] > in-progress | shipped > done | someday
--- work.ord
[r] Fix login +bug
Ship it +bug
_state:: shipped
Later +bug
_state:: someday
[x] Twice +bug
_state:: shipped
[q] Unknown
Odd
_state:: shipped
.
file "types.ord"
node "Bug" @1
type "_type"
file "work.ord"
node "Fix login" @1
type "bug"
state "review"
base "in-progress"
node "Ship it" @2
type "bug"
state "shipped"
base "done"
node "Later" @4
type "bug"
state "someday"
node "Twice" @6
type "bug"
state "done"
node "Unknown" @8
node "Odd" @9
state "shipped"
! M10 work.ord:7:11
! L11 work.ord:8:1
! M26 work.ord:10:11
--- Ord.workspace
Types
+task
Task +_type
name:: task
--- a.ord
Write +task
+task
Task +_type
name:: task
.
file "Ord.workspace"
node "Types" @1
node "" @2
type "task"
node "Task" @3
type "_type"
file "a.ord"
node "Write" @1
type "task"
node "" @2
type "task"
node "Task" @3
type "_type"
! M17.2 a.ord:4:2
Names that start with _ are reserved (M92): only the system fields and system types use them.
--- a.ord
Draft +_task #_draft ^_x1
_due:: 2026-12-01
Bug +_type
name:: _bug
.
file "a.ord"
node "Draft #_draft" @1
id "_x1"
type "_task"
node "Bug" @3
type "_type"
! M92 a.ord:1:7
! M92 a.ord:1:14
! M92 a.ord:1:22
! M92 a.ord:2:2
! M92 a.ord:4:9
--- a.ord
Invoice 42 ^i42
Anna +person ^anna
Erik ^anna
Now ^today
Task +_type
name:: task
fields::
owner::
options:: +person
Fix +task
owner:: "Anna"
contacts::
Erik
--- lines.csv
_id,_label,_parent
l1,Workshop,i42
l2,Review,l3
l3,Loop,l2
.
file "a.ord"
node "Invoice 42" @1
id "i42"
node "Workshop" @lines.csv:2
id "l1"
ref "_parent" -> a.ord:1
node "Anna" @2
id "anna"
type "person"
node "Erik" @3
id "anna"
node "Now" @4
id "today"
node "Task" @5
type "_type"
node "Fix" @10
type "task"
ref "owner" -> a.ord:2
node "Erik" @13 in "contacts"
file "lines.csv"
node "Review" @3
id "l2"
ref "_parent" -> lines.csv:4
node "Loop" @4
id "l3"
ref "_parent" -> lines.csv:3
! M20.1 a.ord:3:6
! M15 lines.csv:3:1
! M15 lines.csv:4:1
--- a.ord
Buy milk #urgent
Anna #friend
See [[Buy milk]], [[buy milk #urgent]] and [[anna]]
.
file "a.ord"
node "Buy milk #urgent" @1
node "Anna #friend" @2
node "See [[Buy milk]], [[buy milk #urgent]] and [[anna]]" @3
ref "_link" -> a.ord:1
ref "_link" -> a.ord:1
ref "_link" -> a.ord:2
--- a.ord
Ship **v2** now
Plan _the_ ==launch==
See [[Ship v2 now]], [[ship *v2* now]] and [[Plan the launch]]
.
file "a.ord"
node "Ship **v2** now" @1
node "Plan _the_ ==launch==" @2
node "See [[Ship v2 now]], [[ship *v2* now]] and [[Plan the launch]]" @3
ref "_link" -> a.ord:1
ref "_link" -> a.ord:1
ref "_link" -> a.ord:2
--- a.ord
Monday ^journal
Standup
@ Send mapping draft^t9x1
Kickoff
attendees::
@ Anna Smith
with:: @Anna Smith; @Nobody
Anna Smith +person
Apollo +project
[-] Send mapping draft +task ^t9x1
Ask Erik
@ ^gone
.
file "a.ord"
node "Monday" @1
id "journal"
node "Standup" @2
node "" @3
ref "_mirror" -> a.ord:10
node "Kickoff" @4
ref "attendees" -> a.ord:8
ref "with" -> a.ord:8
node "" @6 in "attendees"
ref "_mirror" -> a.ord:8
node "Anna Smith" @8
type "person"
node "Apollo" @9
type "project"
node "Send mapping draft" @10
id "t9x1"
type "task"
state "in-progress"
node "Ask Erik" @11
node "" @12
! M23.1 a.ord:7:22
! M22.1 a.ord:12:2
--- a.ord
Apollo +project
Tasks
@ Apollo
@ Tasks
Stray note
.
file "a.ord"
node "Apollo" @1
type "project"
node "Tasks" @2
node "" @3
ref "_mirror" -> a.ord:1
node "" @4
ref "_mirror" -> a.ord:2
node "Stray note" @5
! M50.1 a.ord:3:3
! M50.2 a.ord:5:3
A search is written ? query (M60); +search and a query:: line under a search are errors.
--- a.ord
Open +search
query:: +task
? +task
query:: #urgent
sort:: due
.
file "a.ord"
node "Open" @1
node "" @3
type "search"
! M60.1 a.ord:1:6
! M60.1 a.ord:4:2
A mirror of a file (M48): its source is the file's root, its path resolved from the mirror's folder.
--- a.ord
Today
@ notes/plan.ord
@ missing.ord
--- notes/plan.ord
Top
.
file "a.ord"
node "Today" @1
node "" @2
ref "_mirror" -> notes/plan.ord
node "" @3
file "notes/plan.ord"
node "Top" @1
! M48.1 a.ord:3:2
--- a.ord
Task +_type
name:: task
fields::
priority::
options:: low; high
score:: =(1)
Bug +_type
name:: bug
fields::
priority::
options:: p1; p2
score:: =(2)
Note +_field
key:: note
options:: ok
A +task +bug
priority:: p1
note:: ok
B +bug +task
priority:: p1
note:: bad
.
file "a.ord"
node "Task" @1
type "_type"
node "Bug" @7
type "_type"
node "Note" @13
type "_field"
node "A" @16
type "task"
type "bug"
calc "score" "2"
node "B" @19
type "bug"
type "task"
calc "score" "1"
! M46 a.ord:20:13
! M46 a.ord:21:9
--- a.ord
Expense +_type
name:: expense
fields::
line_a::
line_b::
total:: =(line_a + line_b)
valid:: =($value >= 0)
parts::
double:: =(line_a * 2)
By boat +expense
line_a:: 2000
line_b:: 50
parts::
Refund +expense
line_a:: -100
line_b:: 20
total:: 5
.
file "a.ord"
node "Expense" @1
type "_type"
node "By boat" @10
type "expense"
calc "parts.double" "4000"
calc "total" "2050"
node "Refund" @14
type "expense"
calc "total" "-80"
! M40 a.ord:14:1
! M87.1 a.ord:17:10
--- a.ord
Sums
a:: 2
b:: =(a * 3); 7; =([1, 2])
c:: =(d)
d:: =(c)
e:: =(c + 1)
f:: =($undefinedFn(1))
.
file "a.ord"
node "Sums" @1
calc "b" "6" "7" "1" "2"
calc "c"
calc "d"
calc "e"
calc "f"
! M44.1 a.ord:4:6
! M44.1 a.ord:5:6
! M44.2 a.ord:6:6
! M44.3 a.ord:7:6
--- a.ord
Issue +_type
name:: issue
fields::
kind::
options:: bug; feature
tags:: true
project::
options:: +project
tags:: true
label:: =(_tags)
Ord-notes +project ^on1
Ord Notes +project
Crash +issue #bug #ord-notes #other
Wish +issue [#Ord Notes]
Elsewhere #bug
label:: =(_tags)
.
file "a.ord"
node "Issue" @1
type "_type"
node "Ord-notes" @11
id "on1"
type "project"
node "Ord Notes" @12
type "project"
node "Crash #bug #ord-notes #other" @13
type "issue"
ref "project" -> a.ord:11
calc "label" "other"
node "Wish" @14
type "issue"
ref "project" -> a.ord:12
calc "label"
node "Elsewhere #bug" @15
calc "label" "bug"
--- a.ord
Item +_type
name:: item
fields::
qty::
valid:: =($value > 0 and $count($values) <= 2)
Good +item
qty:: 3
Bad +item
qty:: 0; 2; 5
.
file "a.ord"
node "Item" @1
type "_type"
node "Good" @6
type "item"
node "Bad" @8
type "item"
! M40 a.ord:9:8
! M40 a.ord:9:11
! M40 a.ord:9:14
--- a.ord
Åsa Öberg! #team ^asa
s:: =($slug())
t:: =($slug("Hej då"))
m:: =($slug(missing))
n:: =($node("^asa")._label)
f:: =($first([3, 4]))
l:: =($last(9))
k:: =(N)
.
file "a.ord"
node "Åsa Öberg! #team" @1
id "asa"
calc "f" "3"
calc "k" "Åsa Öberg!"
calc "l" "9"
calc "m"
calc "n" "Åsa Öberg! #team"
calc "s" "asa-oberg"
calc "t" "hej-da"
--- a.ord
Person +_type
name:: person
Task +_type
name:: task
fields::
Owner +_field
key:: owner
options:: +person
description:: Who does it.
due::
description:: When it is due.
size:: small
valid:: =($value in ["small", "large"])
priority::
Priority +_field
key:: priority
options:: low; high
Anna +person
Apollo
Draft +task
owner:: Anna
size:: huge
priority:: urgent
up:: =($ancestors()[0]._label)
all:: =($count($nodes("Apollo")))
tasks:: =($count($query("+task")))
slug:: =($slug("Åsa Öberg!"))
g:: =($uuid())
.
file "a.ord"
node "Person" @1
type "_type"
node "Task" @3
type "_type"
node "Owner" @6 in "fields"
type "_field"
node "Priority" @15
type "_field"
node "Anna" @18
type "person"
node "Apollo" @19
node "Draft" @20
type "task"
ref "owner" -> a.ord:18
calc "all" "1"
calc "g"
calc "slug" "asa-oberg"
calc "tasks" "1"
calc "up" "Apollo"
! M40 a.ord:22:10
! M46 a.ord:23:14
! M44.3 a.ord:28:7
--- a.ord
Dates
num:: =($format(1234.5, "#,##0.00"))
day:: =($format("2026-10-22", "[D1] [MNn] [Y]"))
week:: =($count($date("2026-W43")))
month:: =($first($date("2026-02")) & " " & $last($date("2026-02")))
shift:: =($date("2026-10-22T09:00", 7))
between:: =($days("2026-10-20", "2026-10-22"))
back:: =($days("2026-10-22T23:00", "2026-10-20T01:00"))
.
file "a.ord"
node "Dates" @1
calc "back" "-2"
calc "between" "2"
calc "day" "22 October 2026"
calc "month" "2026-02-01 2026-02-28"
calc "num" "1,234.50"
calc "shift" "2026-10-29T09:00"
calc "week" "7"
--- a.ord
Clock
today:: =($today())
now:: =($now())
tomorrow:: =($date("tomorrow"))
yday:: =($date("YDAY"))
friday:: =($date("friday"))
thursday:: =($date("thursday"))
next:: =($date("next-friday"))
last:: =($date("last-monday"))
week:: =($first($date("this-week")) & " " & $last($date("this-week")))
left:: =($days("2026-10-20"))
name:: =($days("tomorrow"))
.
file "a.ord"
node "Clock" @1
calc "friday" "2026-10-16"
calc "last" "2026-10-05"
calc "left" "5"
calc "name"
calc "next" "2026-10-23"
calc "now" "2026-10-15T14:30:00"
calc "thursday" "2026-10-15"
calc "today" "2026-10-15"
calc "tomorrow" "2026-10-16"
calc "week" "2026-10-12 2026-10-18"
calc "yday" "2026-10-14"
--- t.ord
Todo +_type
name:: todo
checkbox:: true
fields::
client::
options:: ACME; Initech
tags:: true
due::
vat:: =(1 + 1)
nodes::
Notes
Invoice +_type
name:: invoice
fields::
due:: 30 days
amount::
--- a.ord
Call Anna
Pay
amount:: 100
=== a.ord
Call Anna +todo #ACME
Pay +todo +invoice
amount:: 100
.
--- t.ord
Todo +_type
name:: todo
checkbox:: true
fields::
client::
options:: ACME; Initech
tags:: true
due::
vat:: =(1 + 1)
nodes::
Notes
Invoice +_type
name:: invoice
fields::
due:: 30 days
amount::
--- a.ord
[ ] Call Anna +todo #ACME
due::
Notes
[ ] Pay +todo +invoice
amount:: 100
client::
due:: 30 days
Notes
--- t.ord
Invoice +_type
name:: invoice
fields::
vat:: 0.25
status:: open
total:: 0
Local +_type
name:: local
fields::
vat:: 0.25
--- a.ord
March +invoice
vat:: 0.25
status:: open
total:: 0
April +invoice
vat:: 0.06
status:: open
total:: 5
May +invoice +local
vat:: 0.25
status:: open
total:: 0
=== t.ord
Invoice +_type
name:: invoice
fields::
vat:: 0.12
state:: open
total:: =(1 + 1)
paid::
Local +_type
name:: local
fields::
vat:: 0.25
.
--- t.ord
Invoice +_type
name:: invoice
fields::
vat:: 0.12
state:: open
total:: =(1 + 1)
paid::
Local +_type
name:: local
fields::
vat:: 0.25
--- a.ord
March +invoice
vat:: 0.12
state:: open
paid::
April +invoice
vat:: 0.06
state:: open
total:: 5
paid::
May +invoice +local
vat:: 0.25
state:: open
paid::
--- t.ord
Bug +_type
name:: bug
fields::
_id:: ~("BE" & $seq(3))
code:: ~("C-" & $seq(2))
--- a.ord
Old +bug ^BE006
code:: C-09
=== a.ord
Old +bug ^BE006
code:: C-09
New +bug
Newer +bug
Plan
due:: ~$date("tomorrow")
x:: ~([{"a": 1}, {"a": 2}])
n:: ~(1 + 1); ~("6"); keep
bad:: ~$uuid(
Ship ~$today()
.
--- t.ord
Bug +_type
name:: bug
fields::
_id:: ~("BE" & $seq(3))
code:: ~("C-" & $seq(2))
--- a.ord
Old +bug ^BE006
code:: C-09
New +bug ^BE007
code:: C-10
Newer +bug ^BE008
code:: C-11
Plan
due:: 2026-10-16
x::
0::
a:: 1
1::
a:: 2
n:: 2; 6; keep
bad:: ~$uuid(
Ship 2026-10-15
--- a.ord
Task +_type
name:: task
fields::
project::
options:: +project
tags:: true
LU +project
[x] Write journal notes +task #area/home
due:: 2026-10-20
n:: 1.50
[ ] Mentions be086 +task #LU
Event ^BE086
Old journal +task #archived
Journal day ^journal-2026-10-15
ref:: journal
? +task
? journal
? #area
? #LU
? [n:: 1.5] | [due::]
? ![x] +task
? ^journal*
? jour*
? #archived journal
Bad +search
query:: +task
.
file "a.ord"
node "Task" @1
type "_type"
node "LU" @7
type "project"
node "Write journal notes #area/home" @8
type "task"
state "done"
node "Mentions be086 #LU" @11
type "task"
state "new"
ref "project" -> a.ord:7
node "Event" @12
id "BE086"
node "Old journal #archived" @13
type "task"
node "Journal day" @14
id "journal-2026-10-15"
node "" @16
type "search"
result -> a.ord:8
result -> a.ord:11
node "" @17
type "search"
result -> a.ord:8
result -> a.ord:14
node "" @18
type "search"
result -> a.ord:8
node "" @19
type "search"
result -> a.ord:11
node "" @20
type "search"
result -> a.ord:8
node "" @21
type "search"
result -> a.ord:11
node "" @22
type "search"
result -> a.ord:14
node "" @23
type "search"
result -> a.ord:14
node "" @24
type "search"
result -> a.ord:13
node "Bad" @25
! M60.1 a.ord:25:5
--- a.ord
Taxi +expense
amount:: 30
kind:: travel
Hotel +expense
amount:: 120
kind:: travel
Lunch +expense
amount:: 15
kind:: food
? +expense
sort:: amount desc number
group:: kind
footer:: =($sum(amount))
? +expense
sort:: kind; amount
.
file "a.ord"
node "Taxi" @1
type "expense"
node "Hotel" @4
type "expense"
node "Lunch" @7
type "expense"
node "" @10
type "search"
result "travel" -> a.ord:4
result "travel" -> a.ord:1
result "food" -> a.ord:7
footer "165"
footer "150" in "travel"
footer "15" in "food"
node "" @14
type "search"
result -> a.ord:7
result -> a.ord:1
result -> a.ord:4
--- a.ord
Anna ^anna
Team
@ Anna^anna
in team:: =($query("@anna", "Team")._label)
Elsewhere
in elsewhere:: =($count($query("@anna", "Elsewhere")))
? @anna
.
file "a.ord"
node "Anna" @1
id "anna"
node "Team" @2
calc "in team" "Anna"
node "" @3
ref "_mirror" -> a.ord:1
node "Elsewhere" @5
calc "in elsewhere" "0"
node "" @7
type "search"
result -> a.ord:1
Source: Semantics.md in ordlang/ord, licensed under CC BY 4.0.