# mt ls

`mt ls` lists your tasks. Give it a [filter](https://mlavrinenko.github.io/mindtape/filters/index.md), a sort and a limit, or an `@name` [view](https://mlavrinenko.github.io/mindtape/named-sets/index.md) that sets all three. A bare `mt ls` uses the first matching `[[ls.rules]]` entry, described below, or else the default view. `mt ls ''` lists every task.

`mt ls` lists task sources, so a file in a template directory, under a reserved `.mindtape` or `.git` component, or at a symlink is not in the listing. A tracked file stays listed when an ignore rule matches it, and an untracked ignored file does not. [Which files count as tasks](https://mlavrinenko.github.io/mindtape/concepts/index.md#which-files-count-as-tasks) defines the set.

`--sort` also takes a scalar `derived.<name>` a project’s [collector](https://mlavrinenko.github.io/mindtape/config/index.md#derived-fields) computes. `mt ls` refuses a derived field that is a list or a record.

Filter, sort and columns are the three facets of a listing. An `[[ls.rules]]` entry, a view and a command-line argument each set only the facets they name.

- A filter argument replaces the filter and keeps the sort and columns of the rule or view underneath.
- `--sort` replaces the sort.
- `--columns` replaces the columns.
- A bare `@view` argument replaces each facet that view sets.
- `@default` stands for the default view’s facets.

The default view’s facets are empty unless your project changes that view, so `--columns @default --sort @default` gets you the built-in columns and sort:

```
$ mt ls 'has_tag("billing")' --columns @default --sort @default
SLUG#  STATUS    READY       PRIORITY  DUE         TITLE
zpz    proposed  ▶ ready     🔴 red    2026-10-02  Index the orders by customer
ygv    proposed  ▶ ready     🟡 amber  2026-10-03  Document the webhook retry policy
9ds    proposed  🔒 blocked  🟡 amber              Verify webhooks with the acme-pay SDK

3 of 14 tasks · your filter
```

List tasks, optionally filtered

Runs on every project of a [set](https://mlavrinenko.github.io/mindtape/read-many-projects/index.md) too. `mt @work ls` prints one table for the set, a `PROJECT` column first.

- `[FILTER]`: Which tasks to list: a filter expression, or `@view` for a saved view
  Without it, you get your project's default listing. `''` lists every task.
- `--format <FORMAT>`: Output format
  - `table`: An aligned table
  - `json`: A JSON object with the tasks and how mt picked them
  - `csv`: Comma-separated values with a header row
  - `path`: One task file path per line, to hand to another program, as in `rg TODO $(mt ls ready --format path)`
  - `path0`: Paths as for `path`, each ending in a NUL byte, for `xargs -0` and paths with spaces`default: table`
- `--json`: Same as `--format json`
- `-n, --limit <LIMIT>`: Show at most N tasks, after filtering and sorting
  A table says how many it left out.
- `--skip <SKIP>`: Skip the first N rows after sorting
  For page two of `-n 20`, use `--skip 20`. When `--limit` cuts the table off, its footer shows the `--skip` for the next page.
- `--sort <SORT>…`: Sort by a field, such as `--sort due:asc`
  Repeat it to break ties, or pass `@view` to sort as that view does.
  `repeatable`
  ```sh
  mt ls --sort due:asc --sort priority:desc   # composed, repeatable
  mt ls --sort @this-week                      # splice a view's sort chain
  ```
- `--columns <COLS>`: The columns to show, comma-separated, or `@view` for a view's columns
  ```sh
  mt ls --columns status,title    # one-off override of [ls] columns-order
  ```
- `-i, --interactive`: Pick a task from the table and open it in your editor
  Type a task's hash to highlight it, and press Enter to open it. Needs a terminal.
- `--hyperlinks <WHEN>`: When to make the `slug#` and `file` columns clickable links
  Defaults to `[ls] hyperlinks`, which is `never` unless your project changes it.
  - `auto`: Links when the output is a terminal and `TERM` isn't `dumb`. Some terminals show the link codes as garbage
  - `always`: Always print links
  - `never`: Never print links

```sh
mt ls ''                        # empty filter: lists everything
mt ls 'has_tag("auth")'         # filter expression
mt ls ready -n 3                # predicate and limit; a table says what it cut
mt ls '' -n 5 --skip 5          # page two; the footer names the next --skip
mt ls @stuck                    # named view: filter, sort and columns
mt ls --json                    # shorthand for --format json
mt ls --format csv              # table (default), json, csv, path or path0
mt ls --columns slug#,title,file --hyperlinks always   # clickable slug# and file
mt ls ready --format path       # bare paths, one per line, for another program
mt ls 'has(due)' --format path0 | xargs -0 wc -l   # NUL-delimited
```

```
$ mt ls
SLUG#  STATUS    READY       PRIORITY  DUE         TITLE
zpz    proposed  ▶ ready     🔴 red    2026-10-02  Index the orders by customer
qre    wip       ▶ ready     🟡 amber              Reject expired sessions on token refresh
05c    proposed  ▶ ready     🟡 amber  2026-10-05  Rotate the JWT signing key
ygv    proposed  ▶ ready     🟡 amber  2026-10-03  Document the webhook retry policy
re8    proposed  ▶ ready     🟡 amber              Add a Redis client to the app state
8f7    wip       ▶ ready     🟡 amber              Harden session tokens
4ze    proposed  ▶ ready     🟢 green  2026-10-20  Replace the deprecated search client
9ds    proposed  🔒 blocked  🟡 amber              Verify webhooks with the acme-pay SDK
2q0    proposed  🔒 blocked  🟢 green              Throttle failed logins per IP

9 of 14 tasks · default view (!terminal && (miss(start) || start <= now()))
```

## Paging

`-n` cuts the list after the sort, and `--skip` drops rows before `-n` cuts. So `mt ls -n 20 --skip 20` is the second page of 20. A cut table says how many rows it hid and prints the command for the next page, with your filter and flags kept and `--skip` advanced. It also keeps how you picked the project, an `@name` or a `-w` path, so you can paste it from any directory:

```
$ mt ls '' -n 5
SLUG#  STATUS    PRIORITY  DUE         TITLE
zpz    proposed  🔴 red    2026-10-02  Index the orders by customer
qre    wip       🟡 amber              Reject expired sessions on token refresh
05c    proposed  🟡 amber  2026-10-05  Rotate the JWT signing key
ygv    proposed  🟡 amber  2026-10-03  Document the webhook retry policy
re8    proposed  🟡 amber              Add a Redis client to the app state

5 of 14 tasks · your filter
9 more not shown · next page: mt ls '' -n 5 --skip 5
```

`--json` reports the same facts in `truncated`: `shown`, `total` and `next_skip`, or `null` for a complete listing. [Schema](https://mlavrinenko.github.io/mindtape/schema/index.md) describes the JSON, and [For AI agents](https://mlavrinenko.github.io/mindtape/agents/index.md) shows how to page through it.

## Columns

Each column shows when its `[ls.columns.<name>] when` expression holds. The expression uses the condition language described under Conditional rules below, and `mt` evaluates it against the rows it’s about to print. A column with no `when` never shows. A [config layer](https://mlavrinenko.github.io/mindtape/config/index.md#layers) replaces a `when` whole, so `when = 'false'` hides a column.

The built-in expressions: `slug#` and `title` are `true`. `status`, `priority` and `due` are `nonempty()`. `assignee` is `contested()`, so it shows when the rows have different assignees. `ready` is `blocked()`. Naming the `assignee` column doesn’t show it. Set `[ls.columns.assignee] when = 'true'` for that.

`why`, `children` and `progress` are `named()`, so they show only when you ask for them. `why` lists the unfinished blocking targets each task waits on, with their status. `mt ls blocked --columns title,why` tells you what to unblock without reading any links, and `--json` includes `why` on every task. `children` counts a task’s `parent` children, and `progress` shows the finished count, as `3/5`. See [Parents and progress](https://mlavrinenko.github.io/mindtape/links/index.md).

The `slug#` column is the task’s stem hash. It’s the shortest prefix, at least three characters long, of a hash of the [filename stem](https://mlavrinenko.github.io/mindtape/concepts/index.md#identity) that no other task’s hash shares. `mt` hashes every task the project loads, closed ones included, so a task has the same stem hash in every listing, filtered or not. The hash changes when `mt mv` gives the task a new stem. It grows a character when a new task’s hash shares its prefix, so `mt` refuses an old hash rather than pick another task. A hash also grows past any stem or filter word it would spell, so neither can capture it.

Every command that takes a `<task>` accepts a stem hash, and so does each `mt link` target. A path or an exact stem wins, and `mt` tries the input as a stem hash only when no stem matches. `mt rm` also takes filters, so it reads a filter word such as `ready`, a field, a view or a status as a filter before it tries a stem hash. `mt` refuses a stem hash that more than one task shares, and the refusal gives each task’s stem and hash.

`file` is the task’s path, relative to the working directory and in your platform’s [separator](https://mlavrinenko.github.io/mindtape/cli/index.md#paths). Its cell is never empty, so `nonempty()` can’t hide it. It shows when stdout isn’t a terminal, because a saved stem hash could become ambiguous once a new task’s hash shares its prefix. On a terminal it shows when you name it, as in `--columns slug#,title,file`:

```
$ mt config show --defaults | grep -A1 '^\[ls.columns.file\]'
[ls.columns.file]
when = 'named() || (!tty() && format() == "table")'
```

`file` is for display, and a filter can’t read it. The [`path`](https://mlavrinenko.github.io/mindtape/filters/index.md) field gives the path from the project root. `--format path` prints the same cell as `file`, and [Schema](https://mlavrinenko.github.io/mindtape/schema/index.md) describes what the JSON and CSV formats contain.

`--hyperlinks always`, or `[ls] hyperlinks`, turns the `slug#` column, and `file` when shown, into OSC 8 links to `[ls] hyperlink-target` (default `file://{abs}`). Each link is a URI, so it uses `/` and percent-encodes a space, whatever `--path-separator` says. On Windows the default reads `file:///C:/proj/tasks/a.typ`, and a UNC path sets its server as the host. `--hyperlinks auto` turns them on for a terminal whose `TERM` isn’t `dumb`. The default is `never`, because a terminal without OSC 8 support can print the link as garbage.

`mt ls -i` keeps the table open and reads keys. Type a stem hash to highlight the tasks whose hash starts with it. `Enter` opens the first highlighted task with `mt go`, and `Ctrl+Enter` opens every listed task. `Space` reloads, and `Esc` or `Ctrl+C` quits. It needs a terminal and the table format. `mt find TERM…` is `mt ls` with each term turned into a `contains()` filter.

## Conditional rules

With `[[ls.rules]]`, a bare `mt ls` picks its listing from where it runs: the git branch, whether stdout is a terminal, an environment variable or the day. `mt ls` uses the first entry whose `condition` holds or that has no `condition`. It applies the entry’s `import-views` from left to right, each view replacing the facets it sets, and then the entry’s own `filter`, `sort` and `columns`. A matched entry ignores the default view.

| Key | Default | Purpose |
| --- | --- | --- |
| `columns` | `[]` | Manual column list. It has the highest precedence for the columns facet. An entry may reference a view’s columns with `@view`. |
| `condition` |  | Condition expression over environment predicates such as `on_branch`, `env`, `weekday`, and `now`. Absent means the rule always matches. |
| `filter` |  | Manual filter override. It has the highest precedence for the filter facet. Same grammar as `[views]`, and may use `@view` / `in_view`. |
| `import-views` | `[]` | Ordered list of views to import facets from, composed left-to-right (later entries win on conflict). Each entry is a view name (`"view"`, importing its filter, sort, and columns) or a scoped form (`"view(filter, sort)"`) naming just the facets to import. |
| `name` |  | Shown in the trailer and the JSON envelope’s `applied.rule`. Falls back to the condition text when unset. |
| `sort` | `[]` | Manual sort override. It has the highest precedence for the sort facet. Same spec grammar as `--sort`, and an entry may splice `@view`. |

`mt` checks each entry when it loads the config. `condition` must parse and may use only the functions below, so a task field there is an error. Each `import-views` entry must refer to a declared view, and each override must be valid.

A `condition` and a column’s `when` share one condition language. It has the operators of the [filter language](https://mlavrinenko.github.io/mindtape/filters/index.md), but it reads facts about the run instead of task fields:

| Function | Value |
| --- | --- |
| `on_branch("glob")` | Whether the current git branch matches the glob. `false` outside a git repository or on a detached `HEAD`. |
| `tty()` | Whether stdout is a terminal. |
| `env("NAME")` | The environment variable, or `""` when it’s unset. |
| `weekday()` | Today’s ISO weekday, from `1` (Monday) to `7` (Sunday). |
| `now()` | Today’s ISO date, the same date the filter language reads. |
| `format()` | The `--format` value (`table`, `json`, `csv`, `path` or `path0`), or `""` outside a listing. |
| `nonempty()` | Whether any cell in this column has text. |
| `contested()` | Whether the rows have different values in this column. A blank cell counts as a value, and one row is never contested. |
| `named()` | Whether the caller named this column in `--columns`, a view’s `columns` or an `[[ls.rules]]` override. |
| `blocked()` | Whether the listing contains a blocked task. The filter field `blocked` is about one task. |
| `true`, `false` | Constants. |

`nonempty()`, `contested()`, `named()` and `blocked()` describe the column `mt` is deciding. In an `[[ls.rules]]` condition `mt` isn’t deciding a column, so they’re `false` there, and a rule can’t pick its columns from `named()`.

`on_branch()`, `tty()`, the four column functions, `true` and `false` are booleans, written bare (`!tty()`). `env()`, `weekday()`, `now()` and `format()` are values, so they go in a comparison. Either side of a comparison may be a value or a literal, as in `weekday() >= 6` or `"review" == env("MODE")`. You can’t compare `true` or `false`.

The line under a table leads with how many of the project’s tasks it shows, then says where the rows came from. A view or a narrowing `[[ls.rules]]` entry names the filter it applied, as in `3 of 12 tasks · default view (!terminal && (miss(start) || start <= now()))`. The footer shows a view’s `description` in place of the filter, as in `3 of 12 tasks · agent view (Open tasks an agent can take)`. When a rule sets the sort, its name follows, as in `3 of 12 tasks · inbox view · release sort`. A filter you typed reads `1 of 4 tasks · your filter`, and `mt ls --json` says where each facet came from. The line wraps at the terminal width, and the count stays on the line the table ends on. An empty listing adds a `hint:` line. It names `mt ls ''` for every task and `mt config show --resolved` for a saved view. In `examples/api-service` no rule matches, so a bare `mt ls` applies the default view:

```
$ mt ls
SLUG#  STATUS    READY       PRIORITY  DUE         TITLE
zpz    proposed  ▶ ready     🔴 red    2026-10-02  Index the orders by customer
qre    wip       ▶ ready     🟡 amber              Reject expired sessions on token refresh
05c    proposed  ▶ ready     🟡 amber  2026-10-05  Rotate the JWT signing key
ygv    proposed  ▶ ready     🟡 amber  2026-10-03  Document the webhook retry policy
re8    proposed  ▶ ready     🟡 amber              Add a Redis client to the app state
8f7    wip       ▶ ready     🟡 amber              Harden session tokens
4ze    proposed  ▶ ready     🟢 green  2026-10-20  Replace the deprecated search client
9ds    proposed  🔒 blocked  🟡 amber              Verify webhooks with the acme-pay SDK
2q0    proposed  🔒 blocked  🟢 green              Throttle failed logins per IP

9 of 14 tasks · default view (!terminal && (miss(start) || start <= now()))
```

A task file that fails to load gets a warning naming it, and the line under the table counts it last, as in `1 of 2 tasks · your filter · 1 broken`. `mt ls` still lists the rest and exits 0. `mt check` fails on a broken file. A Typst warning repeated in the same message prints once, with its count and files. `-v` lists every site.

Every command also takes the [global flags](https://mlavrinenko.github.io/mindtape/cli/index.md#global-flags).
