just-do-it-swarming
Skill45 starsChanged 4 days agoMITView on GitHub
Execute all remaining tasks using agent teams for context isolation. Each task runs in its own session. Pass --project <name> to pin the monorepo package for this whole run. Usage /groundwork:just-do-it-swarming [--project name] [--parallel]
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- build-unplannedSkill
- check-specs-alignmentSkill
- create-tasksSkill
- debugSkill
- design-architectureSkill
- design-it-twiceSkill
- design-productSkill
- domain-modelingSkill
- doubt-driven-developmentSkill
- finalize-taskSkill
- groundwork-checkSkill
- groundwork-helpSkill
- handoffSkill
- implement-taskSkill
- instrument-observabilitySkill
- just-do-itSkill
- plan-taskSkill
- review-prSkill
- select-projectSkill
- setup-repoSkill
- shipSkill
- skillsSkill
- source-architecture-from-codeSkill
- source-product-specs-from-codeSkill
- source-ux-design-from-codeSkill
- split-architectureSkill
- split-specsSkill
- staged-rolloutSkill
- statuslineSkill
- swarm-debugSkill
- swarm-design-architectureSkill
- task-validation-loopSkill
- test-driven-developmentSkill
- understanding-feature-requestsSkill
- use-git-worktreeSkill
- using-groundworkSkill
- ux-designSkill
- validateSkill
- vertical-sliceSkill
- work-on-next-taskSkill
- work-onSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
37 rules. About 0 are common, 22 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Use this (/groundwork:just-do-it-swarming) for large batches (>5 tasks) where context accumulation is a concern
- Very specific: line 15
Use /groundwork:just-do-it for small batches or when agent teams are not available
- Very specific: line 26
If effort is low or medium (i.e.
- Distinctive: line 27
If you are not Sonnet or Opus, you MUST show the recommendation prompt - regardless of effort level.
- Distinctive: line 45
If the user selects "Cancel — I'll switch first": output the switching commands above and stop.
- Very specific: line 53
Explicit project argument (highest precedence): If the invocation arguments include --project <name> and <name> is configured in …
- Very specific: line 54
Do NOT invoke select-project, do NOT persist or change the stored selection, and do NOT run the CWD mismatch check below.
- Very specific: line 59
If yes → Is {{project_name}} non-empty?
- Very specific: line 60
If empty → Invoke Skill(skill="groundwork:select-project") to select a project, then restart this skill.
- Very specific: line 61
If set → Project is {{project_name}}, specs at {{specs_dir}}/.
- Distinctive: line 62
If no → Continue (single-project repo).
- Distinctive: line 65
If CWD is the repo root → fine, proceed.
- Very specific: line 66
Check which project's path CWD falls inside (compare against all projects in .groundwork.yml).
- Distinctive: line 67
If CWD is inside the selected project's path → fine, proceed.
- Very specific: line 68
If CWD is inside a different project's path → warn via AskUserQuestion:
- Very specific: line 72
If the user switches, invoke Skill(skill="groundwork:select-project").
- Distinctive: line 73
If CWD doesn't match any project → proceed without warning (shared directory).
- Distinctive: line 78
Read the tasks file to find all tasks:
- Distinctive: line 94
Detection: Check for file first (takes precedence), then directory.
- Distinctive: line 133
If user declines, stop and suggest alternatives:
- Distinctive: line 140
Before creating the team, verify agent teams are available by checking if the team creation tools are accessible.
- Distinctive: line 156
Stop here if not enabled.
- Distinctive: line 160
Before spawning any teammates, load the work-on skill content so it can be embedded in each teammate's prompt:
- Very specific: line 162
Find the skill file: Use Glob to find /work-on/SKILL.md within the groundwork plugin directory.
- Distinctive: line 163
Read the file: Use the Read tool to read the entire file.
- Distinctive: line 167
CRITICAL: Embed the workflow VERBATIM: Do not summarize, condense, rewrite, or adapt the workflow text.
- Distinctive: line 177
Create an agent team. Then for each remaining task in dependency order:
- Very specific: line 227
Look for the VALIDATION: line with per-agent iteration counts (e.g., code-quality=2 test-quality=1 ...).
- Distinctive: line 228
If the validation line is present: proceed to step 8.
- Very specific: line 229
If the validation line is missing: send the teammate a correction via SendMessage:
- Distinctive: line 232
Wait for the teammate to respond and re-collect the result.
- Distinctive: line 233
If the teammate's second response still lacks the validation line: mark the task as failed with reason "Teammate did not complete …
- Distinctive: line 239
Shut down the teammate: before spawning the next one.
- Distinctive: line 263
If present: update task status to Complete.
- Very specific: line 264
If missing: send the teammate a correction via SendMessage:
- Distinctive: line 267
Wait for the teammate to respond and re-check.
- Distinctive: line 272
Continue to next dependency level: only after all tasks in the current level are complete.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Swarming Batch Task Execution
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, 9 validators), solving the context accumulation problem of inline batch execution.
When to use this vs /groundwork:just-do-it:
- Use this (
/groundwork:just-do-it-swarming) for large batches (>5 tasks) where context accumulation is a concern - Use
/groundwork:just-do-itfor small batches or when agent teams are not available
Requirement: Agent teams must be enabled (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1" in settings.json env section).
Model: Teammates spawn with model: "opus" for extended context.
Pre-flight: Model Recommendation
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.
If effort is low or medium (i.e. below high), you MUST show the recommendation prompt — regardless of model.
If you are not Sonnet or Opus, you MUST show the recommendation prompt - regardless of effort level.
Otherwise → use AskUserQuestion:
{
"questions": [{
"question": "Do you want to switch? Team orchestration with worktree coordination across agents benefits from consistent reasoning.\n\nTo switch: cancel, run `/effort high` (and `/model sonnet` if on Haiku), then re-invoke this skill.",
"header": "Recommended: Sonnet or Opus at high effort",
"options": [
{ "label": "Continue" },
{ "label": "Cancel — I'll switch first" }
],
"multiSelect": false
}]
}If the user selects "Cancel — I'll switch first": output the switching commands above and stop. Do not proceed with the skill.
Workflow
Step 0: Resolve Project Context
Before loading tasks, ensure project context is resolved:
- Explicit project argument (highest precedence): If the invocation arguments include
--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}}.- Do NOT invoke
select-project, do NOT persist or change the stored selection, and do NOT run the CWD mismatch check below. Other sessions may be running concurrently on different packages and must not be disturbed by a global switch. - Substitute the resolved project's paths for the template vars everywhere below:
<project root>/specsfor{{specs_dir}}and<project root>/.groundwork-plansfor{{plans_dir}}. - Thread the project explicitly through every downstream invocation instead of relying on the shared selection: call the worktree helper as
node ${CLAUDE_PLUGIN_ROOT}/lib/worktree-identity.js TASK-NNN --project <name>, prefix other lib calls withGROUNDWORK_PROJECT=<name>, and record the project in each teammate spawn prompt (ACTIVE PROJECT:line) so teammates resolve the same project. - Then skip directly to Step 1.
- Do NOT invoke
- Monorepo check: Does
.groundwork.ymlexist at the repo root?- If yes → Is
{{project_name}}non-empty?- If empty → Invoke
Skill(skill="groundwork:select-project")to select a project, then restart this skill. (select-projectis interactive setup for a single session — never run it when an explicit--projectwas provided; item 0 already resolved the project in that case.) - If set → Project is
{{project_name}}, specs at{{specs_dir}}/.
- If empty → Invoke
- If no → Continue (single-project repo).
- If yes → Is
- CWD mismatch check (monorepo only):
- Skip if not in monorepo mode or if the project was just selected in item 1 above.
- If CWD is the repo root → fine, proceed.
- Check which project's path CWD falls inside (compare against all projects in
.groundwork.yml). - If CWD is inside the selected project's path → fine, proceed.
- If CWD is inside a different project's path → 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").
- If CWD doesn't match any project → proceed without warning (shared directory).
- Proceed with the resolved project context. All
{{specs_dir}}/paths will resolve to the correct location.
Step 1: Load and Analyze Tasks
- Read the tasks file to find all tasks:
- Single file:
{{specs_dir}}/tasks.md - Directory:
{{specs_dir}}/tasks/(aggregated in sorted order)
- Single file:
- Parse all tasks and extract:
- Task ID (e.g.,
TASK-001) - Title
- Status (
Not Started,In Progress,Complete,Blocked) - Dependencies (
Blocked by:field)
- Task ID (e.g.,
- Build dependency graph and calculate execution order:
- Topological sort respecting dependencies
- Blocked tasks cannot execute until dependencies complete
- Sweep and resume gate: Run
node ${CLAUDE_PLUGIN_ROOT}/lib/task-resume.js sweep(add--project <name>in monorepos) and auto-clean only thecleanableentries per${CLAUDE_PLUGIN_ROOT}/references/task-resume-protocol.md. AnIn Progresstask whosenode ${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 anyNot Startedtask (the embedded workflow's resume gate continues it at the right phase).
Detection: Check for file first (takes precedence), then directory.
Step 2: Present Summary and Confirm
Present a summary to the user:
Swarming Batch Execution Summary
Mode: Agent Teams (swarming) Total tasks: X Already complete: Y Remaining: Z
Context Isolation
Each task runs in a separate teammate session with its own context window:
- Teammates are full Claude Code sessions with the complete system prompt
- Each teammate can spawn subagents (Plan, task-executor, 9 validation agents)
- Context is fully isolated between tasks — no accumulation in the lead's conversation
- Changes merged after each task completes
Worktree Isolation
Each task also executes in an isolated git worktree:
- Branch and working directory: resolved per task via the worktree-identity helper (
node ${CLAUDE_PLUGIN_ROOT}/lib/worktree-identity.js TASK-NNN) — project-qualified in monorepos (task/<project>/TASK-NNN,<repo>/.worktrees/<project>-TASK-NNN) - Branch created from current HEAD
- Changes merged automatically after each task completes successfully
- Worktrees cleaned up after successful merge
Execution Order
- TASK-NNN: [Title]
- TASK-NNN: [Title] ...
Blocked Tasks (will execute after dependencies complete)
- TASK-NNN: [Title] (blocked by TASK-XXX)
Ask for confirmation before proceeding.
If user declines, stop and suggest alternatives:
/groundwork:just-do-itfor inline execution (no agent teams required)/groundwork:work-on Nto work on a specific task/groundwork:work-on-next-taskto work on just the next available task
Step 2.5: Validate Agent Teams Enabled
Before 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.
Step 2.7: Load Execute-Task Workflow
Before spawning any teammates, load the work-on skill content so it can be embedded in each teammate's prompt:
- Find the skill file: Use Glob to find
**/work-on/SKILL.mdwithin the groundwork plugin directory. - Read the file: Use the Read tool to read the entire file.
- Extract the body: Skip the YAML frontmatter (the
---delimited block at the top of the file) and keep everything after it. This is the work-on workflow content. - Store as
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.
Step 3: Create Team and Execute
Determine execution mode from the user's argument or request:
- Sequential (default): One task at a time, each in its own teammate session. Clean context per task.
- Parallel (if
--parallelargument or user requests it): Independent tasks execute simultaneously in separate teammates.
Sequential Mode (Default)
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, dependencies). - Announce start: "Starting TASK-NNN: [Title] (teammate session)"
- Update task status to
**Status:** In Progressin 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] TASK IDENTIFIER: TASK-NNN TASK TITLE: [Title] TASK DEFINITION: [Full task section from tasks file: goal, action items, acceptance criteria, dependencies] 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` (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 validation results per agent: VALIDATION: code-quality=[N] test-quality=[N] security=[N] spec-alignment=[N] architecture=[N] simplification=[N] housekeeping=[N] performance=[N] design-consistency=[N] (where [N] is the number of iterations each agent required to pass) - 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.
- Look for the
VALIDATION:line with per-agent iteration counts (e.g.,code-quality=2 test-quality=1 ...). - If the validation line is present: proceed to step 8.
- If the validation line is missing: send the teammate a correction via
SendMessage:"Your completion report is missing the VALIDATION line with per-agent iteration counts. Run the validation loop (Step 7.5 of the work-on workflow) and report back with: VALIDATION: code-quality=[N] test-quality=[N] security=[N] spec-alignment=[N] architecture=[N] simplification=[N] housekeeping=[N] performance=[N] design-consistency=[N]"
- Wait for the teammate to respond and re-collect the result.
- If the teammate's second response still lacks the validation line: mark the task as failed with reason "Teammate did not complete validation".
- Look for the
- Update task status:
- Success →
**Status:** Completein the tasks file - Failure → STOP immediately (see failure handling below)
- Success →
- Shut 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 Mode (--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:
- Parse the teammate's completion message for the
VALIDATION:line with per-agent iteration counts. - If present: update task status to Complete.
- If missing: send the teammate a correction via
SendMessage:"Your completion report is missing the VALIDATION line with per-agent iteration counts. Run the validation loop (Step 7.5 of the work-on workflow) and report back with: VALIDATION: code-quality=[N] test-quality=[N] security=[N] spec-alignment=[N] architecture=[N] simplification=[N] housekeeping=[N] performance=[N] design-consistency=[N]"
- Wait for the teammate to respond and re-check.
- If the teammate's second response still lacks the validation line: mark the task as failed with reason "Teammate did not complete validation".
f. Shut down all teammates in this level before proceeding to the next.
- Parse the teammate's completion message for the
- 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.
Step 4: Completion Report
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 `/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`Edge Cases
| 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 |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

