agentleFS
vltingvlting/claude-skills/skills/run/SKILL.md

run

Skill2 starsChanged 9 months agoMITView on GitHub

Ephemeral parallel executor. Spawns agents in worktrees, serializes merges. Used by /think or standalone.

23 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use debug, review and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    debug

    Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.

    Also in 3 projects that use this

  • SentrySkill

    review

    Fixture review skill.

    Also in 4 projects that use this

  • BlockSkill

    plan

    Draft a TDD, PRD, or lightweight plan in the conversation without committing it.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 5 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the provided list directly, skip splitting.

    line 74
  2. Very specific:

    Batch processing: If tasks > --workers, spawn first batch.

    line 122
  3. Very specific:

    Wait for all spawned agents to return.

    line 128
  4. Distinctive:

    After all workers complete, run specialist review agents against each completed worktree.

    line 140
  5. Very specific:

    Ensure $TARGET_BRANCH is checked out at the end.

    line 244
  6. Distinctive:

    If any tasks have unresolved review issues, print them after the summary so the user can address them manually.

    line 258
  7. Very specific:

    If no /run is active: "No active /run session."

    line 278
  8. Very specific:

    Merge conflict cascade: If task 001 conflicts, tasks 002+ may also conflict (they were based on the same target).

    line 297
  9. Distinctive:

    Always rebase before merge: Every branch gets rebased onto latest target before merging.

    line 304
  10. Distinctive:

    One agent per task: No drain loops, no relay, no queue files.

    line 306

“Common” is measured: kept by at least 6 in 10 of the 19 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Run

Parallel execution with serialized merges. Spawns agents in isolated worktrees, waits for completion, then rebases and merges each result sequentially — eliminating merge race conditions.

/run {instructions}   — analyze, split, spawn, merge
/run status           — show active agents and progress

Flags:

  • --workers N — max concurrent agents (default 3, max 5)

When to use /run vs /do vs /q

/run/do/q
Tasks1–N parallel11–N parallel
PersistenceEphemeralEphemeralQueue files (survives interruption)
Merge ownerOrchestrator (serialized)Self (with confirmation)Self or /scope orchestrator
Use whenLocal parallel work, /thinkQuick single changeTracked work, /scope

Flow

/run {instructions}
    │
    ANALYZE  — split into file-disjoint tasks
    │
    SPAWN    — create worktrees, launch agents (up to --workers)
    │
    MONITOR  — wait for agents to complete
    │
    REVIEW   — specialist agents review each worktree (read-only)
    │
    MERGE    — sequential rebase + merge for each completed branch
    │
    CLEANUP  — remove worktrees, report results

Phase 1: ANALYZE

Record target branch: git rev-parse --abbrev-ref HEAD → $TARGET_BRANCH.

Standalone (/run {instructions}):

  1. Research the codebase to understand scope
  2. Split into file-disjoint tasks (each touches different files)
  3. Print task list:
    /run — {N} tasks
    ─────────────────────────
    001: {title} — {files}
    002: {title} — {files}
    003: {title} — integration
    Target: {$TARGET_BRANCH}

Called with pre-split tasks (from /think):

  • Use the provided list directly, skip splitting.
  • /think passes the full plan text. /run parses numbered steps into tasks.

Phase 2: SPAWN

For each task (up to --workers N concurrent):

  1. Create worktree:
    git worktree add -b run-{NNN} .worktrees/run-{NNN} $TARGET_BRANCH
    ln -sf "$(pwd)/node_modules" .worktrees/run-{NNN}/node_modules
  2. Spawn agent:
    Agent(
      prompt: <worker prompt below>,
      mode: "bypassPermissions",
      description: "run: {first 5 words of task}"
    )

Worker prompt:

You are a worker. Execute this task completely:

{task instructions}

Your working directory is: {absolute path to worktree}
All file reads, edits, and git commands MUST use this directory.
Do NOT modify files outside this worktree.
Do NOT merge to any branch. Just commit your work.

Rules:
- Implement the task fully. Do not ask questions.
- Commit your work with a conventional commit message.
- If you encounter a blocker you cannot resolve, commit what you have
  and note the blocker in your commit message.
- Read any relevant CONSTITUTION.md, *.spec.md, or *.ai.md files
  before making changes.
- All styling via STL (styled() or stl prop). No plain style={}.
- Use STL shorthands (bg, p, px, radius, etc).

Launch all agents in a single batch — multiple parallel Agent() calls in one message. This maximizes concurrency.

Batch processing: If tasks > --workers, spawn first batch. After that batch completes and merges, spawn next batch. Each batch gets the latest target (including prior batch merges).


Phase 3: MONITOR

Wait for all spawned agents to return. The Agent tool returns when each agent completes — this is the completion signal. No relay needed.

Track status per task:

  • · Pending (not yet spawned)
  • ⟳ Running (agent spawned, waiting for return)
  • ✓ Done (agent returned successfully)
  • ✗ Failed (agent returned with error)

Phase 4: REVIEW

After all workers complete, run specialist review agents against each completed worktree. Reviews are read-only — they produce verdicts, not edits.

Reviewer selection

The orchestrator selects reviewers conservatively per task: include by default, skip only when clearly irrelevant. Use the task description and changed files to decide.

AgentSkip when
design-criticNo UI/visual changes (e.g. pure logic, config, build scripts)
a11y-reviewerNo interactive/visible UI changes
stl-enforcerNo files importing STL or using styled()/stl prop
bundle-checkerNo new dependencies and no new exports
ui-testerNo UI changes, or no .claude/test-context.md in repo
test-writerTests already included by worker, or task is test-only

Reviewers with the Output Contract (design-critic, a11y-reviewer, stl-enforcer, bundle-checker) end their response with a fenced ```json block for machine consumption. ui-tester and test-writer return prose/artifacts.

When in doubt, include the reviewer. False positives (reviewer says "pass") are cheap. Missed issues are expensive.

Execution

For each completed worktree, spawn selected review agents in parallel (they're read-only, no conflicts):

Agent(
  name: "{reviewer}-run-{NNN}",
  prompt: "Review the changes in {worktree path}. Focus on files: {changed files list}.",
  // model + effort inherited from agent definition
)

Verdicts

For contract reviewers, parse the fenced ```json block at the end of each response:

{ "severity": "ok|warning|error", "blocking": true, "summary": "...", "findings": [...] }

Aggregate per task:

AggregateAction
All severity: "ok" (and any prose reviewers clean)Proceed to MERGE
Warnings only, no blocking: trueProceed to MERGE, surface warnings in results summary
Any blocking: trueRe-spawn worker with collected findings, max 1 retry, re-review
Still blocking after retryProceed to MERGE anyway, flag blocking findings prominently in results summary
Agent(
  prompt: "Fix these review issues in {worktree path}:\n\n{collected findings}\n\nCommit fixes.",
  mode: "bypassPermissions"
)

Malformed or missing JSON block from a contract reviewer → treat as warning, surface in summary, never retry on malformed output.


Phase 5: MERGE

Sequential, in task-number order. This is the core serialization guarantee.

For each completed task (in order 001, 002, 003...):

# Ensure we're on the target branch
git checkout $TARGET_BRANCH

# Incorporate any remote changes + prior merges
git fetch origin $TARGET_BRANCH 2>/dev/null || true
git rebase origin/$TARGET_BRANCH 2>/dev/null || true

# Rebase the worker branch onto latest target (includes prior task merges)
git checkout run-{NNN}
git rebase $TARGET_BRANCH
git checkout $TARGET_BRANCH

# Merge with merge commit
git merge --no-ff run-{NNN} -m "merge: run-{NNN} {task-title}"

On rebase conflict:

  • Skip this task
  • Record conflict details
  • Continue with remaining tasks
  • Report at end

On agent failure (no commit):

  • Skip, record failure, continue

No push. /run operates locally. Push is the caller's responsibility.


Phase 6: CLEANUP

For each task (merged, skipped, or failed):

git worktree remove .worktrees/run-{NNN} --force 2>/dev/null
git worktree prune
git branch -D run-{NNN} 2>/dev/null

Ensure $TARGET_BRANCH is checked out at the end.

Print results:

/run complete
─────────────────────────
  ✓ run-001: {title} — merged (reviews: all pass)
  ✓ run-002: {title} — merged (reviews: pass after retry)
  ⚠ run-003: {title} — merged (reviews: 1 unresolved issue)
  ✗ run-004: {title} — conflict (skipped)

Target: {$TARGET_BRANCH}

If any tasks have unresolved review issues, print them after the summary so the user can address them manually.


/run status

Show current state:

/run — active
─────────────────────────
Target: {$TARGET_BRANCH}
Workers: 2/3

  ✓ run-001: {title} — merged
  ⟳ run-002: {title} — running
  ⟳ run-003: {title} — running
  · run-004: {title} — pending

If no /run is active: "No active /run session."


Error Recovery

Orchestrator interrupted (leftover worktrees):

# List orphaned run worktrees
git worktree list | grep 'run-'

# Clean up
git worktree remove .worktrees/run-{NNN} --force
git worktree prune
git branch -D run-{NNN}

Agent dies mid-task: The Agent tool returns (with error). /run records the failure and continues with remaining tasks. No orphan recovery protocol needed — /run owns the full lifecycle.

Merge conflict cascade: If task 001 conflicts, tasks 002+ may also conflict (they were based on the same target). /run continues attempting remaining merges — some may succeed if they touch different files.


Rules

  1. Never push. Local merges only. Caller pushes if needed.
  2. Always rebase before merge. Every branch gets rebased onto latest target before merging.
  3. Sequential merge order. 001 before 002 before 003. Never parallel merges.
  4. One agent per task. No drain loops, no relay, no queue files.
  5. Session-tracked. Registered with state MCP for /state dashboard visibility. session_start(skill: "run", repo: {cwd}) at ANALYZE, session_checkpoint at SPAWN/MERGE, session_complete at CLEANUP. If interrupted, worktrees may remain — /state shows the stale session; user cleans up or /run detects them on next invocation.
  6. Never use Agent(isolation: "worktree") — it branches from origin/main, not the target branch. Always create worktrees manually.
  7. File-disjoint tasks. Each task must touch different files for safe parallel execution.
  8. Target = current branch. /run merges to whatever branch is checked out when invoked.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.