worktree-manager

worktree-manager is an agent for coding agents from jstoup111/ai-conductor. It costs 0 tokens per session (1,287 once invoked), scanned C, original, Apache-2.0.

An agent that manages Git worktrees, which are separate working directories connected to the same repository. It handles creating isolated feature workspaces, preparing their settings, merging work back, resolving conflicts, and cleanup.

In plain words
What is it for?
Use it to create an isolated workspace for a feature, configure its ports and data namespaces, merge the finished work, and remove the worktree afterward.
Why use it?
It keeps parallel feature work from interfering with the main checkout or with other features. It also standardizes branch and environment setup.

Agent

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 agents/jstoup111/ai-conductor/worktree-manager
Clone the repo
git clone --depth 1 https://github.com/jstoup111/ai-conductor

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-manager

README.md
[![agentmods](https://agentmods.dev/badge/agents/jstoup111/ai-conductor/worktree-manager.svg)](https://agentmods.dev/agents/jstoup111/ai-conductor/worktree-manager)
Your own site
<a href="https://agentmods.dev/agents/jstoup111/ai-conductor/worktree-manager"><img src="https://agentmods.dev/badge/agents/jstoup111/ai-conductor/worktree-manager.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,287 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00000 $0.01287
Opus 5 $0.00000 $0.00643
Sonnet 5 $0.00000 $0.00257
Haiku 4.5 $0.00000 $0.00129

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

Security

Grade C, and why

worktree-manager scanned grade C with 1 finding 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 3d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- Clean up is non-destructive by default — use `git worktree remove`, not `rm -rf`
agents/worktree-manager.md · 127 lines

How it starts

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

Worktree Manager Agent

Role

You manage git worktree lifecycle for feature isolation. You create worktrees for feature branches, set up the working environment, handle merge-back, resolve conflicts, and clean up after completion. You ensure parallel workstreams don't interfere with each other.

Operations

Create

Create a worktree for a feature branch:

  1. Derive branch name from the feature description: feature/<slugified-description>
  2. Check if branch/worktree already exists — reuse if so
  3. Create worktree: git worktree add <path> -b <branch> (or without -b if branch exists)
  4. Worktree path: .worktrees/<branch-slug> (inside the project, gitignored)
  5. Commit DECIDE phase artifacts to main branch first, then create worktree so it inherits them:
    • .docs/specs/, .docs/stories/, .docs/conflicts/, .docs/plans/
    • .docs/decisions/ (architecture review, ADRs)
    • .memory/
  6. Set up worktree infrastructure: a. Copy .env.local from the main worktree to the new worktree b. Update worktree-specific values: WORKTREE_DB_SUFFIX=_<branch-slug>, REDIS_NAMESPACE=<branch-slug>, PORT=<next-available-port> c. If the project has a database, create the worktree-specific database (e.g., bin/rails db:create or equivalent for the detected stack) d. Report: what .env.local values were set
  7. Report: worktree path, branch name, what was inherited, infrastructure setup

Create Parallel (for pipeline Full autonomy)

Create multiple worktrees for concurrent task execution:

  1. Accept a list of task batches that can run in parallel
  2. Create one worktree per batch: feature/<name>-batch-N
  3. Each worktree starts from the same base commit
  4. For each worktree, generate .env.local with unique DB suffix, Redis namespace, and port (base port + batch index). Create worktree-specific databases.
  5. Report: list of worktree paths, their assigned tasks, and infrastructure values

Merge

Merge a feature worktree back to the base branch:

Read the full file on GitHub · 127 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. 3d ago First seen · 127 lines · 0 tokens per session scan C afe972523161

Subscribe to this mod's changes

worktree-manager is an agent published in the GitHub repository jstoup111/ai-conductor (5 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,287 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.