How Facet writes
Views and agents change files through the same set of edits. Each edit touches only the lines it must, keeps the file’s line breaks, and is refused with a reason when the result would not read back as intended. So a change made in a view looks like a change a careful person would make by hand, and the git diff stays small.
For example, setting owner to @jun on the task below adds one inline
property and changes nothing else:
- [ ] Order docks [due:: 2027-03-01]- [ ] Order docks [due:: 2027-03-01] [owner:: @jun]Properties
Section titled “Properties”- Changing a property rewrites its value where it is. If the new value is too long to stay inline (see below), the property moves below the item.
- A new property goes:
- below the item, if the item already has a property block;
- else inline at the end of the title line, while the line has fewer than 3 inline properties and the value is short (at most 30 characters, no square brackets);
- else on a new line right below the title, indented to the item’s text.
- On a heading, a new block line goes right below the heading.
needson a requirement is always writtenNeeds:, below.- Setting a key that appears twice keeps the first and removes the others. Removing a key removes every occurrence.
- Values are checked the way lint checks them: an invalid date, duration or other value is refused. A value must be one line without surrounding spaces.
- A file without a
#heading cannot hold properties, so setting one there is refused.
States
Section titled “States”- Setting a state rewrites the checkbox character. A plain item gets a checkbox and becomes a task.
- Headings and requirements have no checkbox; setting their state is refused.
Ticking a repeating task
Section titled “Ticking a repeating task”Ticking a repeating task keeps it
[ ], writes last:: <today> and moves its due::, if it has one:
- a
when donerule: to today plus the interval; - a schedule-based rule: to its first occurrence after today or after the old due date, whichever is later.
- [ ] Pay the electricity bill [repeat:: every month on the 1st] due:: 2027-04-01Ticked on 2 April 2027, this becomes:
- [ ] Pay the electricity bill [repeat:: every month on the 1st] due:: 2027-05-01 last:: 2027-04-02- A rule that has ended (
UNTILpassed, orCOUNTused up) is ticked[x]instead. - Ticking a
COUNTrule that has nostart::also writesstart::(the old due date), so the count keeps its first occurrence. - Rules follow RFC 5545: a monthly rule on the 31st skips months without
one. Write
every month when done, orFREQ=MONTHLY;BYMONTHDAY=-1for the last day of each month.
Titles
Section titled “Titles”Renaming replaces the title only: the checkbox, the req~name: prefix and
the properties stay. A file without a # heading gets one, after the
frontmatter. A title that would read back differently (it starts with a
checkbox, or ends with [key:: value]) is refused.
Descriptions
Section titled “Descriptions”Writing a description replaces the node’s paragraphs, quotes, tables and code blocks, from the first to the last.
- On a file with a
#title, only the blocks below the title are replaced; blocks above it (a lint header, an introduction) stay. - A file without a
#heading gets its description at the top, after the frontmatter. - A new description goes after the property block (or the title) after a blank line, with a blank line before what follows.
- An item’s description is indented to the item’s text.
- Removing a description deletes its blocks and the blank lines before them.
A description is refused when it contains a list item, a heading or a
key:: value line (outside code blocks), and on a requirement when it
contains a Needs: line. A description that starts on the item’s own line,
or that has some of the node’s children between its blocks, is not
rewritten.
New nodes
Section titled “New nodes”- A new item gets its properties inline when there are at most 3 short ones, otherwise all of them below the title.
- A new heading’s properties always go below it.
- Where a node goes, and the way it is indented, follow the rules for moves below.
Add, move and delete
Section titled “Add, move and delete”A node moves with its properties, description and children; deleting a node removes everything below it too.
- An item stays an item. Under another item it is indented to that item’s text; under a heading or a file it starts at column 0. It takes the marker of the list it joins.
- A heading stays a heading. Under a file it becomes
##, under a heading one level deeper, and its sub-headings shift with it. A level past 6 is refused. - A setext heading (
Titleover---) that moves is rewritten with#. - A heading cannot go under an item, and among a parent’s children items come before sub-headings.
- Moving across files keeps links valid, since
!idreferences work from any file. - Files and folders are never created, moved or deleted by edits.
Dragging in the Gantt
Section titled “Dragging in the Gantt”Computed dates are never written back. Dragging a bar in the Gantt, in whole days, writes fixed dates in the form the node already uses:
- Moving a bar shifts its written
start::andend::, or addsstart::when neither is written. Anafter::stays, but no longer drives the start. - Dragging the end rewrites
end::; elseduration::(N days, orN weekswhen whole weeks); else addsend::. - Dragging the start keeps the end. When the start comes from
end::minusduration::, it rewritesduration::. Otherwise it rewrites or addsstart::, then rewritesduration::if there is noend::, or addsend::when neither is written. - Roll-up bars, repeating tasks and milestones placed by
due::alone cannot be dragged. Other milestones can only be moved.
How each view turns a gesture into one of these edits (adding from the
board, ticking in Today, dragging in the mindmap) is described with the
views, for example the Board and
Today. Agents use the same edits through
facet edit.