Skip to content
Development
Command

/team

Parallel implementation with Agent Teams - spawn teammates in isolated worktrees

From plugin
lets-workflow
1622 skills15 agents22 commands
Install
$ npx -y skills add restarter/lets-workflow --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/team

Context preview

What this command does when you run it.

Parallel implementation with Agent Teams - spawn teammates in isolated worktrees

Command definition

team.md
description: Parallel implementation with Agent Teams - spawn teammates in isolated worktrees
argument-hint: "[run|status|stop] [--tasks A,B,C]"

Team Execution

Spawn teammates in isolated worktrees for parallel implementation. Each teammate gets one task, works independently, and reports back.

**This is for parallel implementation of independent tasks.** For analysis (review, opinion, plan) - use their dedicated commands.

> **IMPORTANT:** If the spec below invokes any deferred tool (e.g. `AskUserQuestion`), you MUST load and call it as specified. Never skip the call, never substitute a default answer of your own — the tool invocation is part of the contract. This is critical.

Step 1: Determine Subcommand

**If argument provided** (e.g., `/lets:team run`), parse it:

  • `run` -> go to Run (pass remaining flags like `--tasks A,B,C` to Step R2)
  • `status` -> go to Status
  • `stop` -> go to Stop

**If no argument**, use **AskUserQuestion**:

AskUserQuestion(
  questions=[{
    question: "What do you want to do with the team?",
    header: "Team",
    options: [
      { label: "Run", description: "Launch teammates to implement tasks in parallel" },
      { label: "Status", description: "Show active team progress" },
      { label: "Stop", description: "Stop active team and preserve branches" }
    ],
    multiSelect: false
  }]
)

---

Run

Launch a parallel team. Select tasks, spawn teammates, monitor progress, merge results.

Step R1: Guards

# Guard 1: not in worktree
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
# If GIT_DIR contains "worktrees/" -> stop: "Teams must be created from the main repo, not a worktree."
# Guard 2: no active team
ls ~/.claude/teams/ 2>/dev/null | grep "lets-team"
# If any lets-team-* dirs exist -> stop: "Active team found. Use /lets:team status or /lets:team stop first."
# Guard 3: clean working directory
git status --short
# If dirty -> warn: "Uncommitted changes detected. Commit or stash before running a team."

Step R2: Get Tasks

Two input modes:

**1. Interactive (default):** Show ready tasks and let user pick.

ready limit=10

Present as multiSelect AskUserQuestion - user picks tasks.

**2. Manual (`--tasks A,B,C`):** Parse comma-separated task IDs from argument.

**Confirmation gate:** If more than 10 selected:

AskUserQuestion(
  questions=[{
    question: "{N} tasks selected for parallel work. That's a lot - confirm?",
    header: "Confirm",
    options: [
      { label: "Launch all", description: "{N} teammates in isolated worktrees" },
      { label: "Reduce", description: "Pick fewer tasks for this batch" }
    ],
    multiSelect: false
  }]
)

If fewer than 2 selected: > "Need at least 2 tasks for parallel work. For a single task, just work on it directly."

Step R3: Validate Independence

For each selected task:

show task=<task-id>

Check:

  • If any task is blocked by another selected task -> error: "**{task A}** (`id`) blocks **{task B}** (`id`). Remove one."
  • If task descriptions mention same directories -> warn: "Potential file overlap in `{dir}/`. Watch for conflicts."

Step R4: Gather Context

LETS_PROJECT_ROOT=$(git rev-parse --show-toplevel)
cat "$LETS_PROJECT_ROOT/CLAUDE.md" 2>/dev/null | head -200

For each task, read full description + all comments via the tracker:

show task=<task-id>
comment-list task=<task-id>
# Stack detection
ls package.json pyproject.toml Cargo.toml go.mod composer.json Gemfile 2>/dev/null

Step R5: Confirm Launch

Show team composition:

## Team Plan

| # | Task | Teammate | Scope |
|---|------|----------|-------|
| 1 | **Fix auth flow** (`proj-a1`) | fix-auth-1 | src/auth/ |
| 2 | **Add search API** (`proj-b2`) | add-search-2 | src/api/ |

Teammates: {N}
Isolation: worktree (auto-cleanup)
Plan approval: required (lead reviews each plan before implementation)
AskUserQuestion(
  questions=[{
    question: "Launch team with {N} teammates?",
    header: "Team",
    options: [
      { label: "Launch", description: "Spawn all teammates in parallel" },
      { label: "Adjust", description: "Change task selection" },
      { label: "Cancel", description: "Don't launch" }
    ],
    multiSelect: false
  }]
)

**Launch** -> continue **Adjust** -> go back to R2 **Cancel** -> exit

Step R6: Create Team

Save the current HEAD as base for later commit verification. Echo it so the orchestrator captures the value - each Bash call is a fresh shell, so a bare assignment is lost; substitute it as `{BASE_SHA}` in the R10 / T6 blocks below (HEAD moves once teammate commits land, so it cannot be recomputed later):

BASE_SHA=$(git rev-parse HEAD); echo "$BASE_SHA"
TeamCreate(team_name="lets-team-{YYYYMMDD-HHMM}")

Step R7: Create Shared Task List

For each task:

TaskCreate(
  subject="{task title} ({task-id})",
  description="Assigned to teammate: {name}. Beads task: {task-id}. See teammate prompt for full context.",
  activeForm="Implementing {task title}"
)

After creation, assign:

TaskUpdate(taskId="{id}", owner="{teammate-name}", status="in_progress")

Step R8: Spawn Teammates

**CRITICAL: All teammates MUST be spawned in a SINGLE message (parallel launch).**

Teammate naming: `{task-slug}-{index}` (e.g., `fix-auth-1`, `add-search-2`). Numeric suffix guarantees uniqueness.

For each task, one Agent call:

Agent(
  subagent_type="lets:implementer",
  name="{task-slug}-{index}",
  team_name="lets-team-{timestamp}",
  description="Implement {task-id}",
  prompt="{TEAMMATE PROMPT - see template below}",
  isolation="worktree",
  mode="plan"
)

Teammate Prompt Template

Each teammate gets this as their entire context. Fill in all `{placeholders}`.

You are implementing a specific task as part of a parallel team.
You are in an isolated worktree - your changes won't affect other teamm
Read more
Ships withlets-workflow

A development workflow plugin for Claude Code Stop babysitting your AI. Start shipping with it.

Get the whole plugin, auto-invoked
Stats
16
Stars
1
Views
3
Forks
Active
Maintenance
Go
Language
MIT
License
3d ago
Last commit
5mo ago
Created

Repo: restarter/lets-workflow