worktree-task-plugin
CLAUDE.md39 starsChanged 12 months agoMITView on GitHub
A Claude Code plugin that enables spawning autonomous agent sessions in separate git worktrees via tmux. Manages large coding tasks that would otherwise overflow context by delegating phases to subagents. The plugin supports multiple agent backends via launch.py: Hooks are defined in hooks/hooks.json and triggered by Claude Code events: Hook handlers receive JSON on stdin and output JSON with optional systemMessage.
In this repositoryOne other file it gives its agents.
- worktree-taskSkill
The file
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
A Claude Code plugin that enables spawning autonomous agent sessions in separate git worktrees via tmux. Manages large coding tasks that would otherwise overflow context by delegating phases to subagents.
Architecture
├── .claude-plugin/plugin.json # Plugin manifest (name, version, repo)
├── skills/worktree-task/SKILL.md # Auto-trigger skill definition
├── commands/*.md # Slash command definitions (/worktree-task:*)
├── hooks/
│ ├── hooks.json # Hook registrations (SessionStart, Stop, SessionEnd)
│ └── handlers/*.py # Hook implementations
├── scripts/*.py # Core Python scripts for task management
└── references/*.md # Prompt templates for spawned agentsCore Flow
- launch.py - Creates worktree + tmux session, launches agent (Claude Code or Codex), sends task prompt
- status.py - Captures tmux pane output, shows git info from worktree
- resume.py - Detects error type (rate_limit, api_error, timeout), sends recovery message
- cleanup.py - Kills tmux session, optionally removes worktree
- merge.py / rebase.py - Spawns Claude in tmux to auto-resolve git conflicts
Key Design Patterns
- tmux as state: Sessions track running tasks, pane capture provides status
- Worktrees for isolation: Each task gets its own working directory
- Template substitution:
$TASK_DESCRIPTION,$WORKTREE_DIRinreferences/*.md - Hook-based updates:
on-session-start.pychecks GitHub Releases API for updates (24h cache)
Common Commands
# Test a script directly
python3 scripts/launch.py feature/test "Test task description"
python3 scripts/status.py # List all sessions
python3 scripts/status.py <session-name> # Detailed session status
python3 scripts/resume.py <session> --check # Check without sending message
python3 scripts/cleanup.py <session> --remove-worktree
# Manual tmux operations
tmux list-sessions
tmux attach -t <session>
tmux kill-session -t <session>
# Git worktree operations
git worktree list
git worktree remove <path>Agent Command Options
The plugin supports multiple agent backends via launch.py:
| Flag | Command |
| (default) | claude --dangerously-skip-permissions |
--codex | codex --yolo -m gpt-5.1-codex-max -c model_reasoning_effort="high" |
--agent-cmd "<cmd>" | Custom command |
--env KEY=VALUE | Add environment variables |
Conventions
- Session names:
<project>-<branch>with/and.replaced by- - Worktree paths:
../<project>-<branch-safe>(parent directory) - Temp files:
/tmp/claude_task_prompt.txt,/tmp/claude_merge_prompt.txt - Cache:
~/.claude/plugins/.worktree-task-update-cache.json
Hook System
Hooks are defined in hooks/hooks.json and triggered by Claude Code events:
- SessionStart (startup): Checks for plugin updates via GitHub API
- Stop: Task completion notification (macOS
osascript) - SessionEnd: Session end handler
Hook handlers receive JSON on stdin and output JSON with optional systemMessage.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

