/sweep
End-to-end pipeline with J4 per-command execution approval — auto-configure program.md (accept defaults), run judge+refine loop (up to 3 iterations), then run the campaign. Single command from goal to result.
Claude Code
$ npx -y skills add Borda/AI-Rig --skill sweep --agent claude-code
Codex
$ npx skills add Borda/AI-Rig --skill sweep -a codex -y
Cursor
$ npx skills add Borda/AI-Rig --skill sweep -a cursor -y
Gemini CLI
$ npx skills add Borda/AI-Rig --skill sweep -a gemini-cli -y
GitHub Copilot
$ npx skills add Borda/AI-Rig --skill sweep -a github-copilot -y
OpenCode
$ npx skills add Borda/AI-Rig --skill sweep -a opencode -y
Windsurf
$ npx skills add Borda/AI-Rig --skill sweep -a windsurf -y
SKILL.md
sweep.SKILL.mdname: sweep
description: End-to-end pipeline with J4 per-command execution approval — auto-configure program.md (accept defaults), run judge+refine loop (up to 3 iterations), then run the campaign. Single command from goal to result.
argument-hint: '"<goal>" [--team] [--compute=local|colab|docker] [--colab[=H100|L4|T4|A100]] [--codex] [--researcher] [--architect] [--journal] [--hypothesis <path>] [--skip-validation] [--out <path>] [--keep "<items>"]'
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Agent, Skill, TaskCreate, TaskUpdate, AskUserQuestion
effort: medium
disable-model-invocation: true
<objective>
End-to-end research pipeline: auto-plan → judge gate with J4 per-command execution approval → run. Single command from goal to result. Accepts goal string, passes all run/colab/team flags.
NOT for: interactive planning (use `/research:plan`); methodology review only (use `/research:judge`); running already-approved plan (use `/research:run`).
</objective>
<compaction>
- Key boundaries: end of S2 — program.md written and confirmed; end of S3 — judge+refinement verdict settled.
- Preserve at S2: program-path (output of plan), GOAL string, OUT path (TMPDIR key), active sweep token printed at entry.
- Mid-loop refresh: after each S3 fix-apply the contract is rewritten with refine-iter/no-fixes-iter/last-verdict (placed after fixes so the "fixes applied" claim is true) — a mid-loop compaction resumes at the current iteration instead of restarting REFINE_ITER=0.
- Preserve at S3: judge verdict, JUDGE_REPORT path, program-path, GOAL.
- Clear at sweep entry (stale prior run) and every terminal exit, including stops before S5.
</compaction>
<workflow>
Before Agent Resolution, clear stale sweep state:
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name research) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
rm -f .temp/state/skill-contract.md "${TMPDIR:-/tmp}/sweep-out-path-${CSID}" "${TMPDIR:-/tmp}/sweep-run-args-${CSID}" # sweep entry cleanup — stale state must not mark a new invocation as inlined # timeout: 5000
SWEEP_TOKEN=$(python "$PLUGIN_ROOT/bin/make_run_dir.py" sweep .experiments) || exit 1 # timeout: 5000
printf '%s\n' "$SWEEP_TOKEN" > "${TMPDIR:-/tmp}/sweep-active-token-${CSID}"
echo "SWEEP_TOKEN=$SWEEP_TOKEN"Before every terminal exit (completion, abort, blocked, unresolved stop, load/validation/tool failure, or a stop inside an inlined skill), execute the S5 exit cleanup block below before printing the final reply. This applies to every stop instruction in S1–S5 and the loaded plan, judge and run steps. Pausing for an answer or compaction is not a terminal exit: keep the active sweep state until it resumes or terminates.
Before executing any loaded judge or run block or writing a sweep compaction contract, substitute this invocation's printed `SWEEP_TOKEN` for `<active-sweep-token>`. Every sweep contract's preserve field must include `sweep-token=<active-sweep-token>` with that literal value substituted, so a resumed sweep retains its invocation identity. Never derive that trusted substitution from a pre-existing sentinel; standalone judge/run leave the placeholder unset. The sentinel is only the equality check against the active invocation's token.
Agent Resolution
<!-- Agent resolution: see _RESEARCH_SHARED/agent-resolution.md -->
**Agent resolution**: load and follow the protocol below. Contains: foundry check + fallback table. Foundry not installed → substitute each `foundry:X` with `general-purpose` per table.
# loads: compaction-contract.md
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name research) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
python "$PLUGIN_ROOT/bin/resolve_shared.py" --persist research-shared --emit agent-resolution.md || exit 1 # timeout: 5000 — cold resolve; every later site (including the judge/run steps this skill runs inline) reads the research-shared sentinelSweep delegates to plan (S2), judge (S3), run (S5) — see each skill's Agent Resolution for fallback handling.
Steps S1–S5
**Shared path resolution** (always runs before S1):
`_RESEARCH_SHARED` does NOT survive the Agent Resolution block — each Bash call is a fresh shell — so re-resolve it here alongside `_RESEARCH_SKILLS`, and again in every later block that loads a skill file:
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name research) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
IFS= read -r _RESEARCH_SHARED < "${TMPDIR:-/tmp}/research-shared-${CSID}" 2>/dev/null || _RESEARCH_SHARED="" # warm read (Check 41)
_RESEARCH_SKILLS="${_RESEARCH_SHARED%/_shared}"
[ -z "$_RESEARCH_SKILLS" ] && _RESEARCH_SKILLS="$PLUGIN_ROOT/skills"**Task tracking** — one task per stage, never a bookkeeping-only turn: measured sweeps spent up to 5 of ~15 turns on task calls alone. The cost was the standalone turns, not the task count, so stage-level progress stays visible.
- Load the deferred task tools (`ToolSearch(query="select:TaskCreate,TaskUpdate", max_results=2)`) in the same response as the Agent Resolution block.
- Create tasks for S1–S5 at start, all in the same response as the first S1 call. Steps the inlined plan, judge and run skills track keep their own task lines.
- Every later `TaskUpdate` rides with the next real tool call. A stop before S5 (abort, blocked, unresolved stop) closes the finished stages and marks the remaining ones `deleted` in the response that prints the stop message — one response, not one per task. The only standalone call is the final `completed` right before the R6 summary.
- **Independent calls share one response — never across a question**: the S1 keep-flag and unsupported-flag-protocol blocks together, after the existing-program.md guard is answered (the `--out` validation runs before the guard, as
Read more
name: sweep description: End-to-end pipeline with J4 per-command execution approval — auto-configure program.md (accept defaults), run judge+refine loop (up to 3 iterations), then run the campaign. Single command from goal to result. argument-hint: '"<goal>" [--team] [--compute=local|colab|docker] [--colab[=H100|L4|T4|A100]] [--codex] [--researcher] [--architect] [--journal] [--hypothesis <path>] [--skip-validation] [--out <path>] [--keep "<items>"]' allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Agent, Skill, TaskCreate, TaskUpdate, AskUserQuestion effort: medium disable-model-invocation: true
<objective>
End-to-end research pipeline: auto-plan → judge gate with J4 per-command execution approval → run. Single command from goal to result. Accepts goal string, passes all run/colab/team flags.
NOT for: interactive planning (use `/research:plan`); methodology review only (use `/research:judge`); running already-approved plan (use `/research:run`).
</objective>
<compaction>
- Key boundaries: end of S2 — program.md written and confirmed; end of S3 — judge+refinement verdict settled.
- Preserve at S2: program-path (output of plan), GOAL string, OUT path (TMPDIR key), active sweep token printed at entry.
- Mid-loop refresh: after each S3 fix-apply the contract is rewritten with refine-iter/no-fixes-iter/last-verdict (placed after fixes so the "fixes applied" claim is true) — a mid-loop compaction resumes at the current iteration instead of restarting REFINE_ITER=0.
- Preserve at S3: judge verdict, JUDGE_REPORT path, program-path, GOAL.
- Clear at sweep entry (stale prior run) and every terminal exit, including stops before S5.
</compaction>
<workflow>
Before Agent Resolution, clear stale sweep state:
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name research) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
rm -f .temp/state/skill-contract.md "${TMPDIR:-/tmp}/sweep-out-path-${CSID}" "${TMPDIR:-/tmp}/sweep-run-args-${CSID}" # sweep entry cleanup — stale state must not mark a new invocation as inlined # timeout: 5000
SWEEP_TOKEN=$(python "$PLUGIN_ROOT/bin/make_run_dir.py" sweep .experiments) || exit 1 # timeout: 5000
printf '%s\n' "$SWEEP_TOKEN" > "${TMPDIR:-/tmp}/sweep-active-token-${CSID}"
echo "SWEEP_TOKEN=$SWEEP_TOKEN"Before every terminal exit (completion, abort, blocked, unresolved stop, load/validation/tool failure, or a stop inside an inlined skill), execute the S5 exit cleanup block below before printing the final reply. This applies to every stop instruction in S1–S5 and the loaded plan, judge and run steps. Pausing for an answer or compaction is not a terminal exit: keep the active sweep state until it resumes or terminates.
Before executing any loaded judge or run block or writing a sweep compaction contract, substitute this invocation's printed `SWEEP_TOKEN` for `<active-sweep-token>`. Every sweep contract's preserve field must include `sweep-token=<active-sweep-token>` with that literal value substituted, so a resumed sweep retains its invocation identity. Never derive that trusted substitution from a pre-existing sentinel; standalone judge/run leave the placeholder unset. The sentinel is only the equality check against the active invocation's token.
Agent Resolution
<!-- Agent resolution: see _RESEARCH_SHARED/agent-resolution.md -->
**Agent resolution**: load and follow the protocol below. Contains: foundry check + fallback table. Foundry not installed → substitute each `foundry:X` with `general-purpose` per table.
# loads: compaction-contract.md
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name research) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
python "$PLUGIN_ROOT/bin/resolve_shared.py" --persist research-shared --emit agent-resolution.md || exit 1 # timeout: 5000 — cold resolve; every later site (including the judge/run steps this skill runs inline) reads the research-shared sentinelSweep delegates to plan (S2), judge (S3), run (S5) — see each skill's Agent Resolution for fallback handling.
Steps S1–S5
**Shared path resolution** (always runs before S1):
`_RESEARCH_SHARED` does NOT survive the Agent Resolution block — each Bash call is a fresh shell — so re-resolve it here alongside `_RESEARCH_SKILLS`, and again in every later block that loads a skill file:
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name research) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
IFS= read -r _RESEARCH_SHARED < "${TMPDIR:-/tmp}/research-shared-${CSID}" 2>/dev/null || _RESEARCH_SHARED="" # warm read (Check 41)
_RESEARCH_SKILLS="${_RESEARCH_SHARED%/_shared}"
[ -z "$_RESEARCH_SKILLS" ] && _RESEARCH_SKILLS="$PLUGIN_ROOT/skills"**Task tracking** — one task per stage, never a bookkeeping-only turn: measured sweeps spent up to 5 of ~15 turns on task calls alone. The cost was the standalone turns, not the task count, so stage-level progress stays visible.
- Load the deferred task tools (`ToolSearch(query="select:TaskCreate,TaskUpdate", max_results=2)`) in the same response as the Agent Resolution block.
- Create tasks for S1–S5 at start, all in the same response as the first S1 call. Steps the inlined plan, judge and run skills track keep their own task lines.
- Every later `TaskUpdate` rides with the next real tool call. A stop before S5 (abort, blocked, unresolved stop) closes the finished stages and marks the remaining ones `deleted` in the response that prints the stop message — one response, not one per task. The only standalone call is the final `completed` right before the R6 summary.
- **Independent calls share one response — never across a question**: the S1 keep-flag and unsupported-flag-protocol blocks together, after the existing-program.md guard is answered (the `--out` validation runs before the guard, as
Practical agent workflows for Python, ML, and open-source maintenance. AI-Rig turns recurring work—scoping a change, reproducing a bug, reviewing a pull request, running an experiment, or checking release readiness—into explicit workflows with specialist
More skills from other plugins.
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
ask-matt
Ask which skill or flow fits your situation. A router over the skills in this repo.
Questions about sweep.
- Which coding agents can use sweep?
- sweep installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

