/groundwork:just-do-it-swarming [--project name] [--parallel] [--take-over] [--on-unrelated-failure stop-and-ask|expand-and-fix|ignore-and-merge]from groundwork
Executes remaining tasks using agent teams with one session per task for context isolation. Supports flags for project pinning, parallel execution, session takeover, and failure handling.
Ships in groundwork. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Executes all remaining tasks using agent teams for context isolation. Each task runs in a separate teammate session with its own context window. Teammates are full Claude Code sessions that can spawn subagents (Plan, task-executor, the validation agents), solving the context accumulation problem of inline batch execution.
When to use this vs /groundwork:just-do-it:
/groundwork:just-do-it-swarming) for large batches (>5 tasks) where context accumulation is a concern/groundwork:just-do-it for small batches or when agent teams are not availableRequirement: Agent teams must be enabled. Step 2.5 verifies this and shows how to enable them.
Model: Teammates spawn with model: "opus" for extended context.
Your current effort level is {{effort_level}}. Skip this step silently if effort is high, xhigh, or max (the scale is low < medium < high < xhigh < max, so xhigh and max are already above high) AND you are Sonnet or Opus. Otherwise ask via AskUserQuestion (header "Model check"; options "Continue anyway" / "Cancel — I'll switch first"):
"Do you want to switch? Team orchestration with worktree coordination across agents benefits from consistent reasoning.
Recommended: Sonnet or Opus at high effort.
To switch: cancel, run
/effort high(and/model sonnetif on Haiku), then re-invoke this skill."
If the user selects "Cancel — I'll switch first": output the switching commands and stop. Do not proceed with the skill. Ask once per conversation: a skill invoked by another skill skips this step when the recommendation was already shown. In a non-interactive run (--noninteractive, GROUNDWORK_RUNNER_MODE=true, or GROUNDWORK_BATCH_MODE=true), skip the prompt and continue on the current model.
--project <name> and <name> is configured in .groundwork.yml, that project is authoritative for this entire run. Resolve its root directly from .groundwork.yml (<repo root>/<configured path>); do not read or consult {{project_name}}. If the invocation arguments include --on-unrelated-failure <mode> (stop-and-ask, expand-and-fix, or ignore-and-merge), remember it for this entire run: it is recorded in each teammate spawn prompt (ON UNRELATED FAILURE: line). An invalid mode value → stop the run with a usage error.
select-project — it is interactive setup for a single session, so never run it when an explicit --project was provided — and do NOT persist or change the stored selection. Other sessions may be running concurrently on different packages and must not be disturbed by a global switch. (The CWD mismatch check below skips itself for an explicit --project.)<project root>/specs for {{specs_dir}} and <project root>/.groundwork-plans for {{plans_dir}}.node ${CLAUDE_PLUGIN_ROOT}/lib/worktree-identity.js TASK-NNN --project <name>, prefix other lib calls with GROUNDWORK_PROJECT=<name>, and record the project in each teammate spawn prompt (ACTIVE PROJECT: line) so teammates resolve the same project..groundwork.yml exist at the repo root?
{{project_name}} non-empty?
Skill(skill="groundwork:select-project") to select a project, then restart this skill.{{project_name}}, specs at {{specs_dir}}/.--project.
.groundwork.yml: the repo root or the selected project's path → fine, proceed; no project's path → proceed without warning (shared directory).--noninteractive, keep the selected project and continue; otherwise warn via AskUserQuestion:
"You're working from
<cwd>(inside [cwd-project]), but the selected Groundwork project is [selected-project] ([selected-project-path]/). What would you like to do?"
- "Switch to [cwd-project]"
- "Stay with [selected-project]" If the user switches, invoke
Skill(skill="groundwork:select-project").
Read the tasks file to find all tasks:
{{specs_dir}}/tasks.md{{specs_dir}}/tasks/ (aggregated in sorted order)Parse all tasks and extract:
TASK-001)Not Started, In Progress, Complete, Blocked)Blocked by: field)Build dependency graph and calculate execution order:
Sweep and resume gate: Run node ${CLAUDE_PLUGIN_ROOT}/lib/task-resume.js sweep (add --project <name> in monorepos) and auto-clean only the cleanable entries per ${CLAUDE_PLUGIN_ROOT}/references/task-resume-protocol.md. An In Progress task whose node ${CLAUDE_PLUGIN_ROOT}/lib/task-resume.js check <TASK-NNN> reports existing work is in flight from a prior session — assign it to a teammate before any Not Started task (the embedded workflow's resume gate continues it at the right phase). Append --take-over to the check when this skill's invocation carried it; soft standdowns (including heartbeat-shared-daemon and heartbeat-same-session — run any emitted stop-validation-heartbeat action via task-resume.js before resuming) then proceed without asking, while an actively progressing exclusive heartbeat-worker-alive still stands down.
Detection: Check for a single file first (it takes precedence), then a directory. Read a directory as all its .md files recursively — _index.md first, then numerically-prefixed files, then alphabetically.
Present a summary to the user:
Mode: Agent Teams (swarming) Total tasks: X Already complete: Y Remaining: Z
Each task runs in a separate teammate session with its own context window:
Each task also executes in an isolated git worktree:
node ${CLAUDE_PLUGIN_ROOT}/lib/worktree-identity.js TASK-NNN) — project-qualified in monorepos (task/<project>/TASK-NNN, <repo>/.worktrees/<project>-TASK-NNN)Ask for confirmation before proceeding.
If user declines, stop and suggest alternatives:
/groundwork:just-do-it for inline execution (no agent teams required)/groundwork:work-on N to work on a specific task/groundwork:work-on-next-task to work on just the next available taskBefore creating the team, verify agent teams are available by checking if the team creation tools are accessible.
If agent teams are not enabled:
"Agent teams are required for swarming mode but are not enabled. To enable them, add this to your settings.json:
{ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }Alternatively, use
/groundwork:just-do-itfor inline batch execution (no agent teams required)."
Stop here if not enabled.
Before spawning any teammates, load the work-on skill content so it can be embedded in each teammate's prompt:
**/work-on/SKILL.md within the groundwork plugin directory.--- delimited block at the top of the file) and keep everything after it. This is the work-on workflow content.EXECUTE_TASK_WORKFLOW: Hold this content for use in the teammate spawn prompts below.CRITICAL: Embed the workflow VERBATIM. Do not summarize, condense, rewrite, or adapt the workflow text. The teammate needs the full, unmodified workflow to follow it step-by-step. Summarization loses gate conditions (e.g. mandatory validation before merge) that prevent broken tasks from being merged.
Determine execution mode from the user's argument or request:
--parallel argument or user requests it): Independent tasks execute simultaneously in separate teammates.Create an agent team. Then for each remaining task in dependency order:
Read the task section from {{specs_dir}}/tasks.md (or aggregated from {{specs_dir}}/tasks/) to extract the full task definition (goal, action items, acceptance criteria, test seams, dependencies).
Announce start: "Starting TASK-NNN: [Title] (teammate session)"
Update task status to **Status:** In Progress in the tasks file.
Spawn a teammate with model: "opus" to execute the task. The teammate's spawn prompt must include:
You are executing a single task as part of an automated batch run.
GROUNDWORK_BATCH_MODE=true — do NOT use AskUserQuestion. Proceed automatically.
PROJECT ROOT: [absolute path to project root]
SPECS DIR: {{specs_dir}}
ACTIVE PROJECT: [project name from Step 0 — teammates must use this project, not change the shared selection]
[Only when the invocation carried --on-unrelated-failure <mode>, include the line below]
ON UNRELATED FAILURE: [mode — treat this as the embedded workflow's --on-unrelated-failure flag value: thread it into the workflow's Step 4 validate invocation and its merge reporting exactly as its flag parsing specifies]
TASK IDENTIFIER: TASK-NNN
TASK TITLE: [Title]
TASK DEFINITION:
[Full task section from tasks file: goal, action items, acceptance criteria, test seams, dependencies — a recorded test seam is where this task's tests are written; when none is recorded the teammate follows the seam rule in the TDD skill and never asks]
EXECUTE-TASK WORKFLOW:
[EXECUTE_TASK_WORKFLOW loaded in Step 2.7]
INSTRUCTIONS:
1. Follow the EXECUTE-TASK WORKFLOW above starting from Step 1 (Parse Task Identifier).
- Skip Step 0 (context already resolved by the lead) — but still run its
resume gate item for this task: `node ${CLAUDE_PLUGIN_ROOT}/lib/task-resume.js check TASK-NNN`
(add `--project <name>` in monorepos) and act on the one-line JSON per
`${CLAUDE_PLUGIN_ROOT}/references/task-resume-protocol.md`. One `check` returns only
the next action, so re-run it after each recorded phase to fetch the one after
(skip the phases it says are done; stand down when live_owner is not none).
- TASK IDENTIFIER and TASK DEFINITION are provided above — use them directly.
- GROUNDWORK_BATCH_MODE is true — auto-proceed all confirmations.
2. When all the steps of the workflow are complete, report:
- Success: "TASK-NNN: SUCCESS — [one-line summary]"
Include the validation evidence by quoting the validate skill's terminal line verbatim:
VALIDATION: <the terminal line, e.g. `Validation PASSED (2 iter, 3 fixed, 0 unworked)`>
When it returned PASSED-WITH-WAIVERS, also include one WAIVED line per waived gate
(`WAIVED: <gate> — <one-line evidence>`) so the lead can report it; never present a waived gate as passed.
- Failure: "TASK-NNN: FAILURE — [one-line reason]"
Wait for teammate to complete. Monitor via the shared task list.
Collect result from the teammate's completion message.
Verify workflow compliance: Parse the teammate's completion message for validation evidence.
VALIDATION: line quoting the validate skill's terminal result — it begins Validation PASSED ( or Validation PASSED-WITH-WAIVERS (.SendMessage:
"Your completion report is missing the VALIDATION line. Run the validation step (Step 4: Validate of the work-on workflow) and report back with its terminal line, verbatim: VALIDATION: Validation PASSED (...) — or
Validation PASSED-WITH-WAIVERS (...)plus one WAIVED line per waived gate"
Update task status:
**Status:** Complete in the tasks fileShut down the teammate before spawning the next one. This ensures each task gets a completely clean context.
Log result: "Completed TASK-NNN: [Title] — [one-line summary]"
On Failure: Report the failed task, reason, tasks completed this session, and tasks remaining. Note that the failed task's worktree is preserved at its reported <worktree_path> for investigation. Clean up the team.
--parallel)Build dependency groups: Partition tasks into levels based on the dependency graph. Level 0 = tasks with no dependencies. Level 1 = tasks whose dependencies are all in Level 0. Etc.
Process one level at a time:
For each dependency level:
a. Determine the independent tasks in this level that are not yet complete.
b. Cap concurrency: Spawn at most 5 teammates simultaneously (to control token cost). If more tasks than the cap, queue the rest.
c. Spawn teammates for each task in the level, each with model: "opus" and the same spawn prompt as sequential mode.
d. Wait for all teammates in this level to complete. As teammates finish, collect results. If any task fails, stop spawning new teammates but let running teammates finish.
e. Verify workflow compliance for each teammate before shutting it down:
VALIDATION: line quoting the validate skill's terminal result (it begins Validation PASSED ( or Validation PASSED-WITH-WAIVERS ().SendMessage:
"Your completion report is missing the VALIDATION line. Run the validation step (Step 4: Validate of the work-on workflow) and report back with its terminal line, verbatim: VALIDATION: Validation PASSED (...) — or
Validation PASSED-WITH-WAIVERS (...)plus one WAIVED line per waived gate"
f. Shut down all teammates in this level before proceeding to the next.
Continue to next dependency level only after all tasks in the current level are complete.
On Failure in Parallel Mode: Report the failed task(s). If multiple tasks in the same level fail, report all of them. Stop processing further levels. Clean up the team.
Clean up the agent team, then report:
## Swarming Batch Execution Complete
**Mode:** Agent Teams (swarming)
**Session Summary:**
- Tasks completed: X
- Total tasks complete: Y/Z
- All worktrees merged and cleaned up
- Agent team cleaned up
### Completed Tasks
| Task | Title | Branch | Status |
|------|-------|--------|--------|
| TASK-001 | [Title] | task/TASK-001 | Merged |
| TASK-002 | [Title] | task/TASK-002 | Merged |
...
### Worktree Summary
- Worktrees created: X
- Successfully merged: X
- Cleaned up: X
### Context Isolation Summary
- Teammate sessions spawned: X
- Each task ran in its own context window
- Lead context remained clean throughout execution
### Next Steps
- Run `/groundwork:source-product-specs-from-code` to update specs with any implementation changes
- Plan next phase if milestone complete
- Review merged changes with `git log --oneline -10`
| Situation | Response |
|---|---|
| No tasks file | "Tasks file not found. Run /groundwork:create-tasks to generate tasks." |
| No remaining tasks | "All tasks are already complete! Nothing to execute." |
| All remaining blocked | "All remaining tasks are blocked. Cannot proceed automatically." |
| Single task remaining | Execute normally (still uses a teammate for context isolation) |
| Agent teams not enabled | Report error and suggest enabling or using /groundwork:just-do-it |
| Teammate crashes/hangs | Report failure for that task, preserve worktree, clean up team, stop batch |
| Merge conflict in teammate | Teammate reports failure, lead stops batch and reports the conflict |
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (etr/groundwork) — no native marketplace selected
npx claudepluginhub p/etr-groundworkOther plugins' skills for the same job
44 skills in this plugin
/build-unplannedBuild a feature from a description with worktree isolation and TDD. Optional flag - --on-unrelated-failure stop-and-ask|expand-and-fix|ignore-and-merge - how validation treats gate failures unrelated to the active project (default stop-and-ask)./check-specs-alignmentVerify alignment between code and specs./create-tasksGenerate implementation tasks from architecture document./debugUse when investigating bugs, unexpected behavior, test failures, or any code that does not work as expected - enforces systematic root cause analysis before any fix