From claude-session-orchestrator
Start, resume, finish, monitor, and orchestrate parallel git-worktree build sessions on Windows using psmux. Spawns Claude workers per worktree, polls them on /loop, reviews their PRs. Project-agnostic — driven by .claude/session-plugin.json. Triggers on "/session", "start a worktree", "dispatch workers", "orchestrate the build", "blast through these issues".
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-session-orchestrator:session [list|start|start-issues|resume|finish|pull|cleanup|monitor|server-start|server-check|server-stop|orchestrate] [name|issue-numbers][list|start|start-issues|resume|finish|pull|cleanup|monitor|server-start|server-check|server-stop|orchestrate] [name|issue-numbers]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Manage git worktrees for parallel feature development on Windows using **psmux**
Manage git worktrees for parallel feature development on Windows using psmux
(the Windows tmux port). Each worktree gets its own branch and its own psmux
window running an interactive Claude worker you can watch (capture-pane) and
steer (send-keys) without stealing focus.
This skill is project-agnostic. Every path, session name, repo, branch, and layout comes from the consuming project's config file. Nothing is hardcoded.
Before running ANY subcommand, read the project config:
Read <project-root>/.claude/session-plugin.json
If it's missing, tell the user to run /session-init to scaffold it. The fields
you'll use: projectName, repoPath, worktreesPath, psmuxSession,
githubRepo, defaultBranch, claudeCmdPath, layout, and optional teams.
Throughout this doc, substitute:
<repo> → repoPath<wt> → worktreesPath<sess> → psmuxSession<gh> → githubRepo<base> → defaultBranchThe PowerShell scripts read the same config themselves (via -Config or by
walking up from cwd), so you usually just pass -Config "<repo>/.claude/session-plugin.json"
or run them from the project dir and let them auto-resolve.
psmux SESSION (= config.psmuxSession) — persistent, survives terminal closing
└── WINDOW per worktree (e.g. f036-international) — shell cd'd into the worktree
└── PANE running claude.cmd --dangerously-skip-permissions (the worker)
psmux new -s <sess> -dpsmux-dispatch.ps1.capture-pane and steer with send-keys.| Use a worktree session for... | Do NOT use it for... |
|---|---|
| Big bulk scaffolding from a spec; blasting an issue backlog (N workers → N PRs) | Granular post-scaffold one-line fixes — those are one PR per issue on <base>-derived branches |
| Multiple independent big pieces with little file overlap | Global changes (routing, auth, layout shell) — do those serially on <base> |
| Command | What it does |
|---|---|
list | Show all worktrees + psmux windows + health |
start <name> | Create worktree, junction deps, dispatch a psmux worker, auto-start monitor loop |
start-issues <n> <n> ... | BULK. One worktree worker per GitHub issue. Branch/window fix/<n>-<slug> |
resume <name> | Health-check + repair worktree, re-dispatch its psmux window |
finish <name> | Commit → test → rebase → push → create PR (no merge, no cleanup) |
pull | PR dashboard, pull merged work into <base>, cleanup |
cleanup | Remove zombie worktree dirs + kill orphan windows |
monitor <name> | Single poll cycle: capture-pane → analyze → send-keys if needed |
server-start/check/stop | Manage a detached dev server for a worktree |
orchestrate [...] | Unified loop: dashboard / dispatch / poll / verify / pull / cleanup |
scripts/)Scripts are organized by function under scripts/. Invoke with the plugin root, e.g.:
powershell.exe -ExecutionPolicy Bypass -File "${CLAUDE_PLUGIN_ROOT}/scripts/dispatch/psmux-dispatch.ps1" -Name <name> -Task "<desc>" -Config "<repo>/.claude/session-plugin.json"
Script (path under scripts/) | Purpose |
|---|---|
dispatch/psmux-dispatch.ps1 | Primary dispatch. worktree + env copy + node_modules junction + psmux window + Claude launch (boot handshake) + bootstrap. -Name + one of -Task / -Bootstrap / -BootstrapFile. Auto-injects the project's agent-team rules when given -Task. |
dispatch/psmux-dispatch-issues.ps1 | Bulk dispatch. -Issues 510,511,512 (or positional). Fetches each issue, builds a brief, dispatches per issue. |
dispatch/start-orchestrator.ps1 | Spawn the dedicated orchestrator Claude in its own detached worktree + window with the no-auto-merge + batch-scoped brief, then /loop. -IntervalMin 5. |
dispatch/dispatch-worktree.ps1 | Headless one-shot claude -p (logs to file) — when you do NOT want an interactive pane |
teardown/close-worker.ps1 | Junction-first post-merge teardown. -Name <worker>. |
teardown/cleanup-worktrees.ps1 / nuke-worktrees.ps1 / kill-worktree-agents.ps1 | Cleanup helpers |
server/dev-server.ps1 | Start/stop/check a detached dev server. -Action start|stop|status -Dir <worktree> |
status/check-worktree-health.ps1 | Health (git, deps, env). -Name <n>|-All [-Json] |
status/install-worktree-hooks.sh | Install per-worktree status hooks (optional; psmux capture-pane is the primary channel) |
util/kill-port.ps1 / force-remove-dir.ps1 | Low-level helpers (no config) |
lib/_session-config.ps1 / _session-brief.ps1 | Shared loader + brief generator (dot-sourced; never invoked directly) |
wt new-tab, no SendKeys.claudeCmdPath in panes — psmux pwsh runs -NoProfile, so bare claude isn't found.--dangerously-skip-permissions (scoped to their own branch, you review the PR). The orchestrator/main session does NOT.capture-pane, auto-picks "2" on the accept screen, waits for the "bypass permissions on" footer before sending the brief.close-worker.ps1 detaches the node_modules junction(s) BEFORE git worktree remove. Never git worktree remove a worktree whose junctions are still attached.gh pr merge. Merges are user-authorized ("merge it")./loop is the cron. Never use Windows scheduled tasks or PowerShell Start-Sleep polling loops. The PS scripts' job ends after launching Claude.list, start, resume, finish — reference/commands-core.mdmonitor — reference/commands-monitor.mdserver-start/check/stop — reference/commands-server.md and reference/server-rules.mdpull — reference/commands-pull.mdcleanup — reference/commands-cleanup.mdorchestrate — reference/commands-orchestrate.mdlistgit -C <repo> worktree listpsmux list-windows -t <sess> (which worktrees have live workers)Use check-worktree-health.ps1 -All -Config <cfg> for the health column.
start <name>Create a worktree and dispatch an interactive psmux worker. $ARGUMENTS[1] is the name.
Short version (full steps in reference/commands-core.md):
gh pr list --repo <gh> for open/merged PRs on this branch + git -C <repo> worktree list. If a green PR exists, report and STOP (prevents duplicate work).<base> and healthy (typecheck/build/test gate from the project's layout.testCmds).-Task "<desc>" — the script will generate the brief and inject the project's teams rules.powershell.exe -ExecutionPolicy Bypass -File "${CLAUDE_PLUGIN_ROOT}/scripts/dispatch/psmux-dispatch.ps1" -Name "<name>" -Task "<description + spec ref>" -Config "<repo>/.claude/session-plugin.json"
<sess>:<name>), attach command (psmux attach -t <sess>)./loop 3m /session monitor <name>.Never cd into the worktree from the main session. Watch it with psmux capture-pane -t <sess>:<name> -p.
start-issues <n> <n> ...Bulk-dispatch one worktree worker per GitHub issue number.
powershell.exe -ExecutionPolicy Bypass -File "${CLAUDE_PLUGIN_ROOT}/scripts/dispatch/psmux-dispatch-issues.ps1" -Issues <n>,<n>,<n> -Config "<repo>/.claude/session-plugin.json"
Each issue: gh issue view (skip if not OPEN) → slug from title → branch/window
fix/<n>-<slug> → brief (issue body + project team rules + test/commit/PR
contract, with Closes #<n>) → psmux-dispatch.ps1. Workers run in parallel
once launched. Report the per-issue status table at the end.
When to use: post-scaffold issue-backlog blast (issues already have clear
acceptance criteria). NOT for greenfield scaffolds — those use start <name>.
resume <name>check-worktree-health.ps1 -Name <name>). Repair gaps. 3. If a psmux window exists, capture-pane to see state; else re-dispatch with -SkipDeps to re-add the window. 4. Report branch, last commits, repairs. See reference/commands-core.md.finish <name>Commit → test → rebase on origin/<base> → push → gh pr create --repo <gh> --base <base>. Does NOT merge or remove worktrees. See reference/commands-core.md.
monitor <name>Single poll cycle: psmux capture-pane -t <sess>:<name> -p → analyze (building / waiting / stuck / errored / done) → send-keys correction if needed → report. Stop when a PR exists or the user stops the loop. /session start auto-invokes via /loop 3m /session monitor <name>. See reference/commands-monitor.md.
server-start / server-check / server-stoppowershell.exe -ExecutionPolicy Bypass -File "${CLAUDE_PLUGIN_ROOT}/scripts/server/dev-server.ps1" -Action start|status|stop -Dir "<wt>/<name>" -Config "<repo>/.claude/session-plugin.json"
See reference/commands-server.md.
pullPR dashboard → pull merged work into <base> → cleanup landed worktrees. Run from the MAIN session. Principle: show everything, touch nothing, until the user says go. See reference/commands-pull.md.
cleanupRemove zombie worktree dirs + orphan psmux windows (ask before removing). See reference/commands-cleanup.md.
orchestrate [dashboard|dispatch|poll|pull|cleanup|verify <name>|verify-all]Unified loop, run from a dedicated orchestrator Claude spawned by
start-orchestrator.ps1 into <sess>:orchestrator (its own detached worktree,
NOT the main repo). poll is the main loop: read worker panes, nudge, flag green
PRs as READY FOR USER REVIEW (never merge), clean up after user-merged PRs,
self-terminate when no workers and no batch PRs remain. See
reference/commands-orchestrate.md — it bakes
in the no-auto-merge + batch-scoping contracts.
To launch the orchestrator:
powershell.exe -ExecutionPolicy Bypass -File "${CLAUDE_PLUGIN_ROOT}/scripts/dispatch/start-orchestrator.ps1" -IntervalMin 5 -Config "<repo>/.claude/session-plugin.json"
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub vanman2024/claude-crew --plugin claude-session-orchestrator