git-worktrees

A helper for managing Git worktrees, which are separate working folders linked to the same Git repository. It is designed around the Gru project's layout for isolated Minion workspaces.

In plain words
What is it for?
Use it to manage Gru Minion workspaces, locate their checkouts and metadata, and work with the project's shared bare repositories and branch naming.
Why use it?
It helps developers keep multiple tasks or branches separate without mixing files or changes. It also makes the project's repository, metadata, checkout, and branch locations easier to work with.

Skill for Claude CodeCodex

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 skills/fotoetienne/gru/git-worktrees
Any agent
npx skills add fotoetienne/gru --skill git-worktrees
Clone the repo
git clone --depth 1 https://github.com/fotoetienne/gru

Made for: Claude Code, Codex.

Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,181 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.00026 $0.02181
Opus 5 $0.00013 $0.01091
Sonnet 5 $0.00005 $0.00436
Haiku 4.5 $0.00003 $0.00218

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

Security

Grade C, and why

git-worktrees 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 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.

Recursive force deletehighDestructive command

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

rm -rf ~/.gru/work/owner/repo/minion/issue-42-M042/checkout
.claude/skills/git-worktrees/SKILL.md · 319 lines

How it starts

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

You are a git worktree management assistant for the Gru project. You help users work with git worktrees in the context of Gru's filesystem structure.

Understanding Gru's Filesystem Structure

Gru uses git worktrees to isolate work for each Minion. The structure is:

~/.gru/
├── repos/                           # Bare repository mirrors
│   └── owner/
│       └── repo.git/                # Bare clone (shared)
├── work/                            # Active Minion workspaces
│   └── owner/
│       └── repo/
│           └── minion/
│               ├── issue-42-M042/           # Minion M042's workspace
│               │   ├── events.jsonl         # Stream events log
│               │   └── checkout/            # Git worktree (repo files)
│               │       ├── .git
│               │       └── <repo files>
│               └── issue-43-M043/           # Minion M043's workspace

Key concepts:

  • Bare repo: Shared git repository at ~/.gru/repos/owner/repo.git/
  • Minion dir: Metadata directory at ~/.gru/work/owner/repo/minion/issue-<number>-<minion-id>/
  • Checkout path: Actual git worktree at minion_dir/checkout/
  • Branch naming: minion/issue-<number>-<minion-id> (e.g., minion/issue-42-M042)
  • One worktree per Minion: Each Minion gets its own isolated workspace
  • Shared object store: All worktrees share the same git objects (efficient!)

Common Tasks

1. List All Worktrees

To see all worktrees for a repository:

cd ~/.gru/repos/owner/repo.git
git worktree list

This shows:

  • The bare repo location
  • All active worktrees
  • Which branch each worktree is on
  • Whether the worktree is locked or prunable

2. Create a Worktree for a New Minion

When creating a new Minion workspace:

# From the bare repo
cd ~/.gru/repos/owner/repo.git

# Create worktree for Minion M042 working on issue 42
git worktree add ~/.gru/work/owner/repo/minion/issue-42-M042/checkout -b minion/issue-42-M042

Important:

  • Worktree path: ~/.gru/work/owner/repo/minion/issue-<number>-<minion-id>/checkout/
  • Branch naming: minion/issue-<number>-<minion-id>
  • Create from the bare repo directory

Read the full file on GitHub · 319 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 319 lines · 26 tokens per session scan C 5fb5809b7068

Subscribe to this mod's changes

git-worktrees is a skill published in the GitHub repository fotoetienne/gru (11 stars, last pushed 25d ago), licensed Apache-2.0. It adds 26 tokens to every session and 2,181 once invoked, about $0.0001 per session on Opus 5. 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-30.

Related

Other skills, from other repositories