Recipes and templates

Guide

How to write a short list of steps that burl runs for you, such as filing yesterday's tasks or making today's journal note from a template. For people who repeat the same tidying in a notebook.

Write a recipe

A recipe is a note whose lines are steps. Set a note's format to recipe (right-click it in the tree > Format), start it with Recipe: <name>, and write one step per line:

Recipe: Start the day
Doc: Makes today's journal note and moves the home tasks into it.
Make note "{today}" under [[Journal]] from template [[Day template]] as today_note
Move open tasks of "home" from [[Inbox]] to today_note

A Doc: line under Recipe: says what the recipe does. It is not a step: burl does not mark it or run it. It goes before the first step, with the recipe's schedule lines if it has any (see Run a recipe on a schedule).

burl has seven built-in steps. In each pattern, a braced slot such as {id: note} is a value you fill in, and the word after the colon is the kind of value it takes. The last column is what a name after as holds when the step ends with one.

Step What it does as holds
Rename {id: note} to {title: text} Gives a note a new title. the note
Archive {id: note} Archives a note and every note under it. the note
Move open tasks of {project: text} from {from: note} to {to: note} Moves the open tasks tagged with a project from one note to another. nothing
Rename attachment {file: attachment} of {note: note} to {name: text} Renames a file attached to a note. the attachment
Move attachment {file: attachment} of {note: note} to {to: note} Moves a file attached to one note onto another. the attachment
Make note {title: text} under {parent: note} from template {template: note} Makes a note from a template (see Use a note as a template). the new note
Clear all {list: text} Marks everything a list shows as new as seen, on this computer only: "changes" for notes changed since you looked, "remarks" for remarks new to you, or "both". No note's text changes. nothing

A value is one of three things. A [[link]] names a note. A "quoted" value is text, a file name, a date such as "{today}", or a note's path such as "Journal > {today}". A bare name, such as today_note, is a name an earlier step gave its result, by ending with as today_note. Inside a quoted value, {today} and {yesterday} are typed as written, braces included, and burl fills in the date.

A step may start with Given, When, Then or And; burl reads the step after the word, so Then Archive [[Old]] does what Archive [[Old]] does. The word is optional and changes nothing.

While you type, burl marks every line that would not run, with its reason: a name no earlier step set, a value of the wrong kind, or a line that matches no step. It also offers the steps that fit what you have typed.

A ```recipe fence in a markdown note holds steps too. burl marks its lines the same way, but only a recipe note has the run bar.

A notebook can add steps of its own, written as verb notes (next section).

Write your own step (a verb note)

A step that tidies a folder note, written once and used by any recipe in the notebook, is a recipe note that starts with Verb: instead of Recipe::

Verb: Tidy {folder: note} for {project: text}
Doc: Files the folder's open tasks of a project into the Inbox, then archives the folder.
folder: the note to tidy
project: the project whose tasks move
Move open tasks of project from folder to [[Inbox]]
Archive folder

A recipe then uses it like a built-in step: Tidy [[Old projects]] for "home".

burl marks the Verb: line of a verb note that breaks a rule:

The verb note The mark
has no Doc line A verb note needs a "Doc:" line under its Verb: line, saying what it does.
has a slot with no line saying what it means {folder} needs a line under the Doc: line saying what it means: "folder: ...".
takes a built-in's pattern A verb may not take a built-in's name: Archive {id: note} is burl's own (note.archive). Rename this verb.
reads the same as another verb note The verb note "Sweep" reads the same (Sweep {folder: note}), so a step could not tell them apart.

It also marks a step that calls a verb note when the call cannot run:

The call The mark
closes a loop of verbs Cycle: Tidy calls Sweep (here), and Sweep calls Tidy (Sweep, line 2). A verb may not reach itself.
calls a verb that reaches a loop Tidy reaches a cycle (Tidy -> Sweep -> Tidy), so this step cannot run.
nests more than 16 verbs deep Verbs nest 17 deep from here (...); the limit is 16.
calls a verb note that has marks of its own Tidy has 1 problem, so this step cannot run.

In a recipe note, and in a recipe fence while you edit it, a step that calls a verb note draws the verb's own words, such as Tidy and for in Tidy [[Inbox]] for "home", in their own color with a dotted underline. Built-in steps keep the usual color. To open the verb note, click those words in the reading view, or put the caret on them while editing and press Ctrl/Cmd+Enter. Alt+Left comes back.

The context pane lists the calls under TASKS. CALLS lists the verb notes a note calls, then the built-in steps it uses, dimmed and marked (built-in). USED BY lists the recipes and verb notes that call the open note. Click a row to open that note. In a markdown note, CALLS - this fence lists the steps and links of the recipe fence the caret is in while you edit. A step that would not run is in no list; its mark says why.

Run a recipe

A note whose format is recipe has a run bar under it.

A run that fails stops at the failing line and keeps what it wrote. undo this run takes the whole run back in one step. It refuses if a note the run wrote has changed since, or if you have done something else after the run.

Run a recipe on a schedule

A recipe that runs every weekday at 07:00 has this line under its Recipe: line, before its steps:

Recipe: Start the day
Schedule: every weekday at 07:00
Make note "{today}" under [[Journal]] from template [[Day template]] as today_note

The line takes Schedule: a day starts, Schedule: every <day> with an optional at HH:MM (the day is day, weekday or a day's name, as in Schedule: every monday at 07:00), and Schedule: cron "0 7 * * 1-5" for anything else. Add Skip if missed on a line of its own when a run that comes late is worse than none.

A schedule written as a When line, such as When every day at 07:30, schedules nothing. burl marks it with the line to write instead: Write this schedule as "Schedule: every day at 07:30".

burl runs the recipe by itself, with one condition: you have accepted it on this computer. burl-ui looks when it opens and once a minute, and runs each occurrence that is due and not yet recorded. An occurrence that was missed runs once, late, unless the recipe says Skip if missed. burl-ui never runs one while an editor is open or in a notebook it cannot write, and nothing runs a recipe while burl is closed. From a terminal, burl-backend recipes due PATH lists what is due and writes nothing, and burl-backend recipes run-due PATH runs it.

The run bar's right-hand side says where the schedule stands: next Wed 07:00 - not run yet, due 07:00 - not run yet, ran 07:00 - next Thu 07:00, ran 09:12, due 07:00 - next Thu 07:00 for a run more than five minutes late, missed 07:00, skipped - next Thu 07:00, or failed 07:00 - see history. Click it to open the schedule panel, which shows the Schedule: line and every run, newest first. Each run is a record in the notebook, so when two computers ran the same occurrence the panel lists both.

A todo.txt line can be a schedule too. An unticked line with a due: date that links a recipe you have accepted runs that recipe when the date comes, then ticks the line. If the line also has rec:, burl adds the next line. A line that links a recipe you have not accepted gets a mark saying the recipe "is not accepted on this machine, so this line will not run".

Use a note as a template

Any note is a template. Making a note from one copies it, its children and its attachments, and fills in {today}, {yesterday} and {title} everywhere except inside code. Links among the template's children point at the copies. In a recipe run, {today} is the day the run started, even if it finishes after midnight.

The Make note ... from template ... step is how a recipe uses a template. An assistant can make a note from a template too, and has tools for every other step except Clear all, which only you or a recipe can run, so an assistant cannot clear what is new to you.

Questions this page answers