worktree

A command for creating an isolated Git worktree, which is a separate working folder linked to its own branch.

In plain words
What is it for?
Use it to start a task with its own branch, folder, and planning files while leaving the main directory unchanged.
Why use it?
It lets several tasks be developed in parallel without changing files in the main working folder.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/taoidle/plan-cascade/worktree
Clone the repo
git clone --depth 1 https://github.com/Taoidle/plan-cascade
Per session 65 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,852 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00065 $0.02852
Opus 5 $0.00032 $0.01426
Sonnet 5 $0.00013 $0.00570
Haiku 4.5 $0.00006 $0.00285

Measured 2d ago against content hash 6c63815e522b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

worktree scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/worktree.md · 361 lines

How it starts

The opening of the file, as written. The whole thing — 361 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Planning with Files - Git Worktree Mode

You are now starting a task in Git Worktree Mode. This creates an isolated environment for your task with its own branch and directory, enabling parallel multi-task development.

Path Storage Modes

Plan Cascade supports two path storage modes for runtime files:

New Mode (Default)

Runtime files are stored in a user directory, keeping the project root clean:

  • Windows: %APPDATA%/plan-cascade/<project-id>/.worktree/
  • Unix/macOS: ~/.plan-cascade/<project-id>/.worktree/

Where <project-id> is a unique identifier based on the project name and path hash (e.g., my-project-a1b2c3d4).

Legacy Mode

Files are stored in the project root for backward compatibility:

  • Worktrees: <project-root>/.worktree/

To check which mode is active, use:

uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; r=PathResolver(Path.cwd()); print('Mode:', 'legacy' if r.is_legacy_mode() else 'new'); print('Worktree dir:', r.get_worktree_dir())"

Note: User-visible files like findings.md and progress.md remain in the worktree directory itself, not in the user data directory.

What is Git Worktree Mode?

Git worktree allows you to have multiple working trees attached to the same repository, each on a different branch. This means:

  • Multiple tasks, no conflicts: Each task works in its own directory
  • No branch switching: Stay on your main branch while working on feature branches
  • Isolated environments: Each task has its own files and planning documents
  • Easy cleanup: When done, merge and remove the worktree

Step 1: Determine Configuration

First, check for existing worktrees:

git worktree list

If there are existing worktrees, show them to the user and ask if they want to create another one.

Step 2: Parse Parameters

Parse the user's command arguments:

  • Task name: {{args}} - First argument (or use task-YYYY-MM-DD-HHMM format for uniqueness)
  • Target branch: Second argument (or auto-detect main/master)

Read the full file on GitHub · 361 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 361 lines · 65 tokens per session scan A 6c63815e522b

Subscribe to this mod's changes

worktree is a command published in the GitHub repository Taoidle/plan-cascade (124 stars, last pushed 5mo ago), licensed MIT. It adds 65 tokens to every session and 2,852 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.