# mt add

`mt add` writes a task source. It refuses a destination the loader would not read back. Those include a template directory, a reserved `.mindtape` or `.git` path, a destination that is itself a symlink, and a new file under a Git ignore rule. It doesn’t leave a file behind. [Which files count as tasks](https://mlavrinenko.github.io/mindtape/concepts/index.md#which-files-count-as-tasks) defines the paths that qualify.

`--set` names a template slot or a core field `mt set` writes. `mt add` inserts a field the template has no slot for after fill, and `mt add --set due=2026-12-01` works on any template. `--dir <path>` sets one destination: a relative path resolves from the project root, and `mt add` takes an absolute one as-is. `mt add` refuses the removed `--into` and `--to` with that hint.

`--priority`, `--difficulty`, `--kind`, `--assignee`, `--due` and `--start` are direct aliases for `--set` on those scalar fields. `mt add` runs the project’s [`[[on.add]]`](https://mlavrinenko.github.io/mindtape/hooks/index.md#add-hooks) hooks after it collects the values, and a hook can fill a field or choose the destination. An explicit `=` value (a `--set`, a positional title or an `--edit` change) or an explicit `--dir` wins. An explicit `+=` appends and does not block a hook `set`, and `--no-hooks` skips the hook list.

File a new task from a template

`mt add` fills a template, names the file and checks the task, so you don’t copy and edit a task file by hand. The title’s words come first. Fill the template’s other slots with `key=value`, `key+=value` and `key@path` tokens, after `--set` or bare after `--`. A YAML or JSON file given to `-f` fills them too, and so does the editor. [Templates & slots](https://mlavrinenko.github.io/mindtape/templates/index.md) describes all three. `--dedup` decides what happens when a task with the same [stem](https://mlavrinenko.github.io/mindtape/concepts/index.md#identity) exists. `fail` stops before writing, `skip` exits 0 without writing, and `add-suffix` adds `-2`, `-3` and so on. Your project sets the default in [`[tasks.naming] dedup`](https://mlavrinenko.github.io/mindtape/config/index.md). If it doesn’t, the default is `add-suffix` when you set a `stem` template and `fail` otherwise. `--format` prints the result as `text`, `path`, `path0` or `json`, and `--json` is the shorthand for `--format json` and wins when you give both. The JSON says whether `mt` wrote, skipped or suffixed the task, and opens with the URL of its schema. A `text` report ends on `next: mt eval <slug>`, the command that reads the task it named. The other formats contain no prose. `mt` checks the task before it writes. A refused add doesn’t write a file. `--no-verify` skips the check, and `--verify` demands it, whatever [`[add] verify-when`](https://mlavrinenko.github.io/mindtape/templates/index.md#when-mt-add-verifies) says.

Runs on one project and refuses a [set](https://mlavrinenko.github.io/mindtape/read-many-projects/index.md).

- `[TITLE]…`: The task's title
  mt joins the words with spaces.
  `repeatable`
- `-t, --template <TEMPLATE>`: The template to fill
  Defaults to your project's default template. `mt templates` lists them.
- `-f, --values <PATH>…`: Read slot values from a JSON or YAML file, or `-` for stdin
  Repeat it to merge more than one file, and a later file wins on a shared key.
  `repeatable`
- `--set <KEY=VALUE>…`: Set a slot or a core field, as `key=value`, `key+=value` or `key@path`
  `key+=value` adds to a list, and `key@path` reads the value from a file. These apply after `--values`, so a `key=value` wins on a shared key and a `key+=value` appends to the merged list.
  `repeatable`
- `[KEY=VALUE]…`: Slots or core fields to set after `--`, written as for `--set`
  One line looks like `mt add "Fix login" -- tags+=auth summary@notes.txt`. They apply after `--set`.
  `repeatable`
- `--dir <DIR>`: The directory to write the task in
  A relative path resolves from the project root, and an absolute one stays as-is. Without it, an `[[on.add]]` hook may choose the directory, else mt writes to the first configured root.
- `--into <DIR>`: Removed. Use `--dir`
- `--to <SUBDIR>`: Removed. Use `--dir`
- `--priority <VALUE>`: The priority, as a number
- `--difficulty <VALUE>`: The difficulty, as a number
- `--kind <VALUE>`: The kind of work, such as `feat` or `fix`
- `--assignee <NAME>`: Who is working on the task
- `--due <DATE>`: The due date, as YYYY-MM-DD
- `--start <DATE>`: The start date, as YYYY-MM-DD
- `--name <STEM>`: The file name, without `.typ`
  Defaults to a slug of the title.
- `--status <NAME>`: The status to file the task with
  Defaults to the template's status, else your project's first status that doesn't close a task.
- `--edit`: Fill the template's slots in your editor
  Needs a terminal.
- `--describe <FORMAT>`: Print the template's slots and the project's add hooks instead of filing a task
  `--describe=json` prints the same list, hooks included, as JSON.
- `--print`: Print the filled task instead of writing it
- `--verify`: Check the new task against your project's rules
  Whatever `[add] verify-when` says.
- `--no-verify`: Don't check the new task against your project's rules
  Whatever `[add] verify-when` says.
- `--no-hooks`: Don't run the project's `[[on.add]]` hooks
- `--dedup <MODE>`: What to do when a task with that file name exists
  Without it, mt follows your project's `[tasks.naming]` settings.
  - `fail`: Stop without writing anything
  - `skip`: Don't write a file. Print the existing task's path and exit 0
  - `add-suffix`: Add `-2`, `-3` and so on to the name until it's free
- `--format <FORMAT>`: How to report what `mt add` did
  - `text`: A sentence such as `wrote <path> (<slug hash>)`
  - `path`: Just the task's path
  - `path0`: The path, ending in a NUL byte instead of a newline
  - `json`: A JSON object with `$schema`, then `outcome` (`wrote`, `skipped` or `suffixed`), `path` and `slug``default: text`
- `--json`: Same as `--format json`

```
$ mt add fix the login bug
wrote tasks/fix-the-login-bug.typ (sd8)
next: mt eval sd8
$ mt add --describe
title  string  required  # Task title
    e.g. Write the first task
$ mt add ship-it --format json
{
  "$schema": "https://raw.githubusercontent.com/mlavrinenko/mindtape/main/schema/output/add/1.schema.json",
  "outcome": "wrote",
  "path": "tasks/ship-it.typ",
  "slug": "g43"
}
$ mt add ship-it --dedup skip
skipped, already exists at tasks/ship-it.typ (g43)
next: mt eval g43
$ mt add ship-it --dedup add-suffix
suffixed, wrote tasks/ship-it-2.typ (fw7)
next: mt eval fw7
```

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