session-loop-multi-wt

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

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 commands/alphaelements/handoff-mcp/session-loop-multi-wt
Clone the repo
git clone --depth 1 https://github.com/alphaelements/handoff-mcp
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. 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.00024 $0.04588
Opus 5 $0.00012 $0.02294
Sonnet 5 $0.00005 $0.00918
Haiku 4.5 $0.00002 $0.00459

Measured yesterday against content hash 67c55f9b2854, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 yesterday.

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. yesterday 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 3d ago), licensed MIT. It adds 24 tokens to every session and 4,588 once invoked, about $0.0001 per session on Opus 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.