session-loop-multi-wt

session-loop-multi-wt is a command for Claude Code from alphaelements/handoff-mcp. It costs 24 tokens per session (4,588 once invoked), scanned A, original, MIT.

Instructions for running session-loop tasks across multiple worktrees, which are separate working copies of one Git repository. They apply only when automatic worktree assignment is enabled.

In plain words
What is it for?
They help group related tasks, assign them to worktrees, launch parallel workflows, and combine their results.
Why use it?
They prevent dependent or overlapping tasks from being split across incompatible working copies and define how results are coordinated.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is EnterWorktree({ branch: "feat/auth", path: "../project-wt2" }).

Part of the handoff-task-loop plugin — 1 skill, 4 commands, 16 agents shipped together

Good fit They help group related tasks, assign them to worktrees, launch parallel workflows, and combine their results.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/alphaelements/handoff-mcp
agentmods
npx agentmods add commands/alphaelements/handoff-mcp/session-loop-multi-wt

Made for: Claude Code.

Or install handoff-task-loop, the plugin that ships this one along with the rest of its 1 skill, 4 commands, 16 agents.

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 session-loop-multi-wt

README.md
[![agentmods](https://agentmods.dev/badge/commands/alphaelements/handoff-mcp/session-loop-multi-wt/github.svg)](https://agentmods.dev/commands/alphaelements/handoff-mcp/session-loop-multi-wt)
Your own site
<a href="https://agentmods.dev/commands/alphaelements/handoff-mcp/session-loop-multi-wt"><img src="https://agentmods.dev/badge/commands/alphaelements/handoff-mcp/session-loop-multi-wt/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for session-loop-multi-wt

Your own site · 80×15
<a href="https://agentmods.dev/commands/alphaelements/handoff-mcp/session-loop-multi-wt"><img src="https://agentmods.dev/badge/commands/alphaelements/handoff-mcp/session-loop-multi-wt.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,588 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00024 $0.04588
Opus 5.5 $0.00010 $0.01835
Sonnet 5.5 $0.00005 $0.00918
Haiku 4.5 $0.00002 $0.00459

Measured 1mo ago against content hash 67c55f9b2854, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

session-loop-multi-wt scanned grade A with 0 findings 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin-task-loop/commands/session-loop-multi-wt.md · 406 lines

How it starts

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

Multi-WT Session Loop Extension

This file contains the multi-worktree steps referenced by session-loop.md. Read this only when auto_assign = true in config.toml. When auto_assign is false (default) or absent, these steps do not apply.

These steps interleave with the main session-loop procedure:

  • Steps 1b–1d run between Step 1 (fetch tasks) and Step 2 (plan implementation)
  • Step 5-wt replaces the conventional Step 5 (launch Workflow)
  • Step 6 multi-WT replaces the conventional Step 6 (process results)
  • Steps 9–10 run after Step 8 (next session), before session close

Step 1b. Functional grouping + WT assignment plan

Gate check:

handoff_get_config

Read worktree.session_loop.auto_assign. If it is absent or false, skip Steps 1b/1c/1d and continue at Step 2 with the todo tasks fetched in Step 1. Only proceed with the rest of this step when it is explicitly true.

Grouping logic (applied to the todo tasks fetched in Step 1):

  1. Dependency chains: tasks connected by dependencies belong to the same group — a WT boundary must never split a dependency edge.
  2. File scope overlap: fetch each task's scope_paths via handoff_get_task. Tasks whose scope_paths overlap (same file/dir, or a prefix relationship) belong to the same group. When scope_paths is empty for a task, estimate its file footprint from notes/title instead of leaving it ungrouped.
  3. Functional proximity: tasks that clearly belong to the same feature or subsystem (e.g. all "auth", all "api") are grouped together even without a direct dependency or scope overlap — this is a manager (LLM) judgment call, not a mechanical rule.
  4. Single-group fallback: if grouping produces a single group, or the total task count is <= MAX_TASKS_PER_SESSION, do not use WTs — fall back to the conventional single-session flow (Step 2 onward) exactly as if auto_assign were false. Multi-WT execution only makes sense when there are genuinely independent, parallelizable groups.

Read the full file on GitHub · 406 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. 1mo ago First seen · 406 lines · 24 tokens per session scan A 67c55f9b2854

Subscribe to this mod's changes

session-loop-multi-wt is a command published in the GitHub repository alphaelements/handoff-mcp (0 stars, last pushed 2d ago), licensed MIT. It adds 24 tokens to every session and 4,588 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.