Skip to content
Development
Skill

/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.

From plugin
ai-rig
3148 skills16 agents2 MCP

Claude Code

$ npx -y skills add Borda/AI-Rig --skill sweep --agent claude-code

SKILL.md

sweep.SKILL.md
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 sentinel

Sweep 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
@borda
Ships withai-rig

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

3148 skills16 agents2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
31
Star history of Borda/AI-Rig on GitHub, a chart by star-history.com

Other skills on ai-rig.

debug

debug

Investigation-first debugging — gather evidence, form confirmed root-cause hypothesis, hand off to fix mode with diagnosis file.…

@borda@bordaInstall Skill
feature

feature

TDD-first feature development — crystallise API as a demo test, drive implementation to pass it, run quality stack and a bounded…

@borda@bordaInstall Skill
fix

fix

Reproduce-first bug resolution — capture bug in failing regression test, apply minimal fix, run quality stack and a bounded…

@borda@bordaInstall Skill
plan

plan

Analysis-only planning — classify and scope a task without writing code; outputs a structured plan to .plans/active/. TRIGGER…

@borda@bordaInstall Skill
refactor

refactor

Test-first refactoring — audit coverage, add characterization tests, apply changes with safety net, run quality stack and a…

@borda@bordaInstall Skill
review

review

Multi-agent code review of local Python files, directories, or the current git diff covering architecture, tests, performance,…

@borda@bordaInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

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.