Skip to content
Edit this page

Bootstrap a Taskfile project

This guide explains how init-project and update-project set up and maintain a project, how the AGENTS.md and .gitignore templates are structured, and what survives an update.

Initialize a project

Run init-project in an empty directory:

task init-project

Or use the short alias:

task inp

The command runs git init and creates the missing files. Existing files are never overwritten.

File Source
tmp/ Created as directory.
.gitignore Rendered from templates/gitignore.
task Rendered from task.template.
AGENTS.md Rendered from templates/AGENTS.md.
CHANGELOG.md Copied from templates/CHANGELOG.md.
README.md Created empty.
LICENSE Copied from the selected templates/LICENSE.*.

Created files are reported at the end:

Created: tmp/ .gitignore task AGENTS.md CHANGELOG.md README.md LICENSE

Interactive selection

When fzf is installed, init-project asks which parts to include:

  • Select task parts - the command groups in task (Task, Files, Git, SOPS, ...).
  • Select gitignore options - the optional blocks in .gitignore.
  • Select AGENTS.md tooling options - the sections under ## Environment & tooling.
  • Select license - LICENSE.AGPL-3.0 or LICENSE.MIT.

Use Tab to multi-select and Enter to confirm. Without fzf, or when the command runs without a terminal, the full template is copied and the default license is used.

Licenses

Two license templates are available:

Template License
templates/LICENSE.AGPL-3.0 GNU Affero General Public License v3. Default.
templates/LICENSE.MIT MIT License.

Replace the <year> and <copyright holders> placeholders in the MIT license after creation.

Update a project

Run update-project to refresh a project from the templates:

task update-project

Or use the short alias:

task up

The command accepts a path and the names of the files to update:

task update-project [task] [AGENTS.md] [.gitignore] [path]
Argument Effect
path Target directory. Defaults to the current directory.
task Update the task file. It is updated anyway, the argument is accepted for symmetry.
AGENTS.md Also update AGENTS.md (via template-project-agents).
.gitignore Also update .gitignore (via template-project-gitignore).

The task file is always updated (via update-project-task). AGENTS.md and .gitignore are updated when their name is passed, and are created from the templates when they are missing. The helpers can also be run on their own:

task update-project-task [path]
task update-project-agents [path]
task update-project-gitignore [path]

update-project-task merges the template into the existing task file and keeps the project specific help rows and functions. A missing task file is created from the template.

Missing files are created instead of causing an error. update-project creates task, AGENTS.md, .gitignore, CHANGELOG.md and LICENSE when they are absent, and reports each one:

Created files: task AGENTS.md .gitignore CHANGELOG.md LICENSE

Existing files are merged, never replaced. This makes the command safe to run in a project where files were deleted by mistake.

Template structure

AGENTS.md

templates/AGENTS.md is a composition file. Lines starting with @templates/ are replaced by the referenced file. Blocks between <!-- opts --> and <!-- /opts --> are selectable options.

templates/AGENTS.md
├── ## General                       always included
├── ## Project                       user-owned
├── ## Environment
│   └── AGENTS.md.*                  selectable
└── ## Conventions                   user-owned

The tooling parts are referenced by name:

Part Meaning
AGENTS.md.taskfile Selectable under ## Environment & tooling.
AGENTS.md.jupyter Selectable under ## Environment & tooling.
AGENTS.md.prompt-wip Selectable under ## Environment & tooling.
AGENTS.md.secrets Selectable under ## Environment & tooling.
AGENTS.md.session-info Selectable under ## Environment & tooling.
AGENTS.md.temporary-files Selectable under ## Environment & tooling.

To add a new optional section, create templates/AGENTS.md.<name> and reference it inside the <!-- opts --> block.

## Conventions is not a template part. It holds project specific conventions that you write yourself.

.gitignore

templates/gitignore follows the same pattern:

templates/gitignore
├── gitignore.taskfile                always included
├── <!-- opts -->
│   ├── gitignore.hugo
│   ├── gitignore.jupyter
│   ├── gitignore.pnpm
│   ├── gitignore.obsidian
│   ├── gitignore.python
│   └── gitignore.zensical
└── # Project                         user-owned

The # Taskfile block is always present. The # Project block is reserved for project-specific entries.

Selecting no options

Every option prompt lists a none (skip optional parts) entry. Select it, or confirm without selecting anything, to keep only the always-included parts. For .gitignore this results in the # Taskfile block without any language or tool sections.

What is preserved on update

update-project never replaces a whole file. It merges the template into the target.

task

Preserved Replaced
Your help-table() rows. Everything before help-table().
Your custom functions and static vars. help().
Your dispatch block. The dispatch block at the end.

The command locates help-table(), help() and the dispatch block in both files and splices the template header and dispatch around your code. If any of these blocks is missing, the update aborts without writing.

AGENTS.md

Preserved Replaced
Content of ## Project. ## General.
Content of ### Tasks when present. All selected AGENTS.md.* tooling parts.
Content of ## Conventions.

### Tasks is optional and belongs to you. It is not rendered by default; when your AGENTS.md contains it, it is preserved as a subsection of ## Project.

Changes to the parts in templates/ are applied on the next update. Edits you make directly to a template-owned section are lost.

.gitignore

Preserved Replaced
Entries under # Project. The # Taskfile block.
All selected option blocks.

What is not preserved

  • Template-owned sections. ## General agent guidance, ## Environment & tooling and their parts are regenerated from templates/.
  • task help rows for removed commands. Rows are kept as-is; update-project does not prune them.
  • Unselected options. Parts you did not select are not added. Selecting them later requires another run. Choosing none adds no optional parts at all.
  • CHANGELOG.md and README.md. update-project does not touch these files.
  • An existing LICENSE. It is never overwritten. The license dialog only appears when the file is missing, so a license is never switched by an update.

Keep templates in sync

When you change a part in templates/, run the update in the projects that use it:

task update-project AGENTS.md .gitignore

Review the diff before committing. The merge is line-based, so a manual edit inside a template-owned section is silently discarded.