# Task files

The Typst a task file uses, line by line, and what `mt check` prints for each mistake that syntax invites.

A task is one Typst file, placed where `mt` looks for one: [Which files count as tasks](https://mlavrinenko.github.io/mindtape/concepts/index.md#which-files-count-as-tasks). Here is a complete task file. The sections below explain each part, then the mistakes the syntax invites and what `mt check` prints for each.

```typ
#import "@local/mindtape:0.4.0": *

#show: task.with(
  title: "Fix the login redirect",
  assignee: "ada",
  status: wip(2026, 7, 1)[reproduced on staging],
  estimate: (days: 1, hours: 2),
  tags: ("backend",),
  links: depends-on("add-a-session-store.typ")
    + related("log-failed-logins.typ")[same handler],
)

= AS-IS

After login, the app sends every user to `/home`, even one who asked for
`/settings`.

+ Open `/settings` while logged out.
+ Log in.
+ The app shows `/home`.

= TO-BE

Keep the requested path in the session and redirect to it after login.
Ask in \#backend before you change the session cookie.
```

## The import

The first line imports `@local/mindtape:0.5.0`, the Mindtape prelude. The `: *` brings in every name the prelude defines: `task`, the status functions such as `wip`, and the link functions such as `depends-on`.

`@local` means the Typst packages installed on this machine. This `mt` reads the prelude at `0.2.0`, `0.3.0`, `0.4.0` and `0.5.0`, and it embeds a copy of each. A task file loads anywhere. `mt install` puts all four there for your editor and `typst`, as the [Quickstart](https://mlavrinenko.github.io/mindtape/quickstart/index.md) shows. An import at any other version fails once per version, naming the file, the version and the set. The error gives a rewrite hint for an older version and an upgrade hint for a newer one. `mt fix` rewrites an older unsupported pin in your task roots and template dirs. `mt fix --all --check` exits 1 while one remains, so CI can gate it. `mt` keeps a supported older pin. To point the import at a prelude in the project’s own tree instead, see [Configuration](https://mlavrinenko.github.io/mindtape/config/index.md).

## The show rule

In Typst markup, `#` starts code, and the code runs to the end of the expression. `#show: task.with(...)` applies `task` to the rest of the file: the named arguments become the task’s fields, and the remaining content becomes its body. `task` records the fields for `mt` to read, and lays the task out as a card when Typst compiles the file.

Each field is `name: value`, with a comma before the next one. A value is a string in double quotes, a number, a function call such as `wip(...)`, an array or a dictionary. [Task DSL](https://mlavrinenko.github.io/mindtape/dsl/index.md) lists every field and the values it takes.

## The body

Everything below the show rule is the body, in Typst markup. `=` starts a heading, `+` a numbered list item, `-` a bullet item, and backticks mark code. Typst’s [syntax reference](https://typst.app/docs/reference/syntax/) lists the rest of the markup.

## Mistakes and what `mt check` prints

Each block below shows lines from the file above, then the same lines broken. `mt check` reads every task file, reports each file that fails and the line at fault, and exits 1. Every other command warns about a file that fails and leaves its task out.

### Separate fields with commas

Without the comma, Typst can’t tell where the title ends:

```typ
// tasks/fix-the-login-redirect.typ: works
  title: "Fix the login redirect",
  assignee: "ada",

// invalid/missing-comma.typ: fails
  title: "Fix the login redirect"
  assignee: "ada",
```

```
$ mt check
error: tasks/missing-comma.typ:5:34: expected comma
error: 1 problem in 1 task
```

### Write a dictionary in parentheses

A dictionary is `(key: value, ...)`, in parentheses like an array. Braces open a code block, so a dictionary in braces fails:

```typ
// tasks/fix-the-login-redirect.typ: works
  estimate: (days: 1, hours: 2),

// invalid/dictionary-in-braces.typ: fails
  estimate: {days: 1, hours: 2},
```

```
$ mt check
error: tasks/dictionary-in-braces.typ:7:18: unexpected colon; unexpected comma; unexpected colon
error: 1 problem in 1 task
```

### End a one-item array with a comma

Parentheses around one value only group it, so `("backend")` is the string `"backend"`. Add a trailing comma to make it an array of one item:

```typ
// tasks/fix-the-login-redirect.typ: works
  tags: ("backend",),

// invalid/one-tag-without-a-comma.typ: fails
  tags: ("backend"),
```

```
$ mt check
error: tasks/one-tag-without-a-comma.typ:7: tags: expected an array, found a string
error: 1 problem in 1 task
```

### Write a note in square brackets

A status function takes the year, month and day, then an optional note in square brackets after the call. Square brackets hold content, which is Typst markup. A note passed as a string fails:

```typ
// tasks/fix-the-login-redirect.typ: works
  status: wip(2026, 7, 1)[reproduced on staging],

// invalid/note-as-a-string.typ: fails
  status: wip(2026, 7, 1, "reproduced on staging"),
```

```
$ mt check
error: tasks/note-as-a-string.typ:6:11: assertion failed: `wip()` note must be a content block, e.g. `wip(2026, 6, 14)[note]`, got string
error: 1 problem in 1 task
```

### Join links with `+`

Each link function returns an array of links, and `+` joins two arrays into one. A comma ends the `links` field instead. The second call then turns into an unnamed argument of `task`:

```typ
// tasks/fix-the-login-redirect.typ: works
  links: depends-on("add-a-session-store.typ")
    + related("log-failed-logins.typ")[same handler],

// invalid/links-joined-with-a-comma.typ: fails
  links: depends-on("add-a-session-store.typ"),
    related("log-failed-logins.typ")[same handler],
```

```
$ mt check
error: tasks/links-joined-with-a-comma.typ:3: assertion failed: task takes no positional args besides its body
error: 1 problem in 1 task
```

### Escape `#` in the body

The body is markup, where `#` starts code. So `#backend` is code, and Typst looks for a variable named `backend`:

```typ
// tasks/fix-the-login-redirect.typ: works
Ask in \#backend before you change the session cookie.

// invalid/hash-in-the-body.typ: fails
Ask in #backend before you change the session cookie.
```

```
$ mt check
error: tasks/hash-in-the-body.typ:9:9: unknown variable: backend
hint: a literal # in a task body opens a Typst expression: write \# or put the prose in a code block
error: 1 problem in 1 task
```

## The rest of Typst

A task file only needs the syntax above. For the rest, see the Typst docs: [scripting](https://typst.app/docs/reference/scripting/) for variables, functions and imports, [arrays](https://typst.app/docs/reference/foundations/array/), [dictionaries](https://typst.app/docs/reference/foundations/dictionary/), [content](https://typst.app/docs/reference/foundations/content/) and [show rules](https://typst.app/docs/reference/styling/).
