AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Agent Worktree

skill-lil-lon-claude-agent-worktree · by lil-lon

Spawn an isolated Claude Code sub-task in a fresh git worktree, split into a new tmux pane next to the caller, then clean up when done. Use this whenever the user wants to delegate a small, self-contained side task without disturbing the current session — e.g. they say "do this in a worktree", "spawn a sub-agent", "start a side task", "run this in the background", or ask for parallel work like "f…

No reviews yet
0 installs
2 views
0.0% view→install

Install

$ agentstack add skill-lil-lon-claude-agent-worktree

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-lil-lon-claude-agent-worktree)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Agent Worktree? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

agent-worktree

Dispatch a side task to a separate git worktree running its own Claude Code instance in a new tmux pane next to the caller, then tear everything down when the task finishes.

When to use

Trigger this skill when the user wants to fork off work into a parallel, isolated workspace. Common phrasings:

  • "spawn a worktree for X"
  • "do X in a side branch / sub-agent / background"
  • "start a parallel task"
  • "/agent-worktree ..." or similar slash-style invocation
  • The user describes a task that is clearly independent from what the current session is doing

Do not use this skill when:

  • The task touches the same files the current session is actively editing (merge conflicts will follow).
  • The task needs live context from the current session that hasn't been written down.
  • The user just wants a quick edit in-place.

Prerequisites

  • tmux on PATH
  • The caller must be running inside a tmux session ($TMUX_PANE set). The script will refuse to spawn otherwise.
  • git 2.5+
  • claude CLI on PATH
  • Current working directory is inside a git repository

Workflow

1. Pick a Conventional Commit type and a name

From the user's request, pick:

  • type: one of feat, fix, chore, docs, refactor, test, perf, build, ci, style, revert (Conventional Commits).
  • name: short kebab-case description.

Examples:

| User request | type | name | |-----------------------------------------------|------------|------------------| | "Fix the typo in README" | docs | readme-typo | | "Add a unit test for the parser" | test | parser | | "Bump the lodash version" | chore | bump-lodash | | "Refactor the auth module into smaller files" | refactor | auth-split | | "Add a new login endpoint" | feat | login-endpoint |

The resulting branch will be / (e.g. docs/readme-typo), matching Conventional Commits convention.

Briefly confirm the type, name, and prompt with the user before spawning, unless they have explicitly said "just do it".

2. Spawn the sub-agent

The script is invoked directly via its shebang (same pattern as bin/validate_bash.py):

$CLAUDE_CONFIG_DIR/skills/agent-worktree/agent_worktree.py spawn   ""

The `` should be self-contained — include any file paths, requirements, and acceptance criteria explicitly. The sub-agent cannot see the current session's context.

The script prints JSON with the new pane's pane_id (e.g. %47) and a focus hint. The pane is opened to the right of the caller's pane with focus left on the caller. Tell the user they can switch to it with Ctrl-b o (cycle panes) or Ctrl-b → (focus right).

3. Monitor (optional)

$CLAUDE_CONFIG_DIR/skills/agent-worktree/agent_worktree.py status 

Reports whether the agent's tmux pane is still alive, the last commit on the branch, and whether the working tree is dirty.

4. Clean up

$CLAUDE_CONFIG_DIR/skills/agent-worktree/agent_worktree.py cleanup 

Kills the agent's tmux pane, removes the worktree, and deletes the / branch.

The script refuses to clean up when the worktree is dirty or the branch has commits that are neither merged into main nor pushed — it prints what would be lost and exits non-zero. Merge or push first, then re-run. Pass --force only when you genuinely want to discard the work.

What the script does under the hood

For spawn docs readme-typo "..." (called from a tmux pane):

  • Branch: docs/readme-typo (forked from main)
  • Worktree: /.worktrees//readme-typo
  • tmux pane: tmux split-window -h -d from the caller's $TMUX_PANE — new pane to the right, focus stays on the caller
  • Prompt saved to ~/.agent-worktree/prompts/.md (outside the worktree so it stays clean) and piped into claude via stdin in the new pane
  • State tracked in ~/.agent-worktree/state.json (records include pane_id; legacy records from before the split-window migration carry session and are still handled by status/cleanup)

Caveats

  • Conflict avoidance is the caller's responsibility. This skill does not check whether the side task touches files the main session is editing.
  • Prompt is fire-and-forget. Once spawned, the sub-agent can't see the main session's context.
  • Cleanup deletes the branch. Merge or push anything you want to keep before cleaning up.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.