worktree

worktree is a command for coding agents from AleksandarBisevac/claude-plugins. It costs 64 tokens per session (751 once invoked), scanned A, original, MIT.

A command that creates or removes a Git worktree for an audit phase. A Git worktree is a separate working directory connected to the same repository, allowing work on another branch at the same time.

In plain words
What is it for?
It is for running code-audit phases in parallel, especially when each phase writes to its own part of a shared audit plan.
Why use it?
It lets audit phases run in separate sessions without changing the main working directory, while their branch changes can later be merged.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the audit plugin — 2 skills, 20 commands, 4 agents, 4 hooks shipped together

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/aleksandarbisevac/claude-plugins/worktree
Clone the repo
git clone --depth 1 https://github.com/AleksandarBisevac/claude-plugins

Or install audit, the plugin that ships this one along with the rest of its 2 skills, 20 commands, 4 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for worktree

README.md
[![agentmods](https://agentmods.dev/badge/commands/aleksandarbisevac/claude-plugins/worktree.svg)](https://agentmods.dev/commands/aleksandarbisevac/claude-plugins/worktree)
Your own site
<a href="https://agentmods.dev/commands/aleksandarbisevac/claude-plugins/worktree"><img src="https://agentmods.dev/badge/commands/aleksandarbisevac/claude-plugins/worktree.svg" alt="Measured on agentmods" height="20"></a>
Per session 64 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 751 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.00064 $0.00751
Opus 5 $0.00032 $0.00376
Sonnet 5 $0.00013 $0.00150
Haiku 4.5 $0.00006 $0.00075

Measured 4d ago against content hash a034a73e39c1, 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 4d 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.

plugins/audit/commands/worktree.md · 56 lines

What it actually says

/audit:worktree — a git worktree for a phase (parallel runs)

Read ${CLAUDE_PLUGIN_ROOT}/reference/orchestrator.md and ${CLAUDE_PLUGIN_ROOT}/reference/manifest-conventions.md first.

Sets up an isolated git worktree so a phase can run in its own Claude session, in parallel with other phases (best on a sharded manifest — run /audit:layout sharded first — where phase runs write only their own shard and merge back without conflict). This only touches git worktrees/branches — it never edits the manifest.

Resolve first (read-only): manifestPath + gitRoot from .claude/audit.config.json. If phase.branch is already set (the phase was started), use it. Otherwise ask — do NOT compose the name here, because meta.branch.template has cases prose gets wrong:

python3 "${CLAUDE_PLUGIN_ROOT}/scripts/manifest/resolve-branch.py" <manifestPath> --phase <phaseId>

It prints the branch name AND <parent> — the phase's resolved parent branch, phase.parentBranch ?? meta.developmentBranch — which is what the worktree must be cut from and merged back into. Exit 1 means the composed name is not a legal git ref; stop and report. Worktree path: ../<repo>-<phaseId> (repo = the git-root directory's basename).

Create (default):

git -C <gitRoot> worktree add "../<repo>-<phaseId>" -b <branch> <parent>

(If <branch> already exists — the phase was started — drop -b: git -C <gitRoot> worktree add "../<repo>-<phaseId>" <branch>.) Then print the next step for the user, e.g.:

Worktree ready at ../<repo>-<phaseId> on branch <branch>.
Open a session there and run the phase:
    cd ../<repo>-<phaseId> && claude
    /audit:phase <phaseId>

Remind them: run each phase in its own session/worktree; when done, merge the branch back into <parent> (ff, else --no-ff) and remove the worktree (below). When <parent> is not the development branch, say so — the work has not reached the development branch until that parent is itself merged, and resolve-branch.py prints that sentence for you.

Remove (--remove):

git -C <gitRoot> worktree remove "../<repo>-<phaseId>"

(Use --force only if they confirm discarding uncommitted work; offer git branch -d <branch> after a merged phase.)

Preflight: verify the git root is a repo and <phaseId> exists; if the target path already exists, say so and stop (don't clobber). Never run a phase yourself — this command only prepares the worktree.

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. 4d ago First seen · 56 lines · 64 tokens per session scan A a034a73e39c1

Subscribe to this mod's changes

worktree is a command published in the GitHub repository AleksandarBisevac/claude-plugins (4 stars, last pushed 3d ago), licensed MIT. It adds 64 tokens to every session and 751 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-31.