No slash command · from workflow-orchestration-plugin
Recovers a Workflow run killed mid-flight by salvaging completed agents' PRs and killed agents' worktrees. Use when a run reports agents_error after session limit, kill, or crash.
Ships in workflow-orchestration-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A Workflow run that dies partway leaves the world in two states at once.
Agents that completed have already had their effects: branches pushed, PRs
opened, issues filed. Agents that were killed left a git worktree holding
uncommitted work. Neither is visible in the run's return value, which reports
only that some agents errored.
The two mistakes both follow from treating the run as atomic:
Observed 2026-09-07 (
ForumViriumHelsinki/infrastructure#2305): a 13-agent run hit a session limit with 6 done and 7 killed. Two of the six had opened PRs. One of the killed agents had written 20 source files, a test suite and a golden-vector fixture into its worktree and was killed before its first commit. A naive resume would have duplicated two PRs and thrown away the 20 files.
The run's summarized return value truncates. The journal has one line per agent with its full return:
cd <transcriptDir>
python3 -c "
import json
for l in open('journal.jsonl'):
d = json.loads(l)
print(d.get('type'), d.get('key', '')[:24])
"
Then dump each result to a file and read them — a completed agent's return
usually names the PR it opened and the contract later stages depend on. Do not
assume a cached result is non-empty; check.
Everything below is state the workflow cannot roll back:
gh pr list --state open --json number,title,headRefName,isDraft
gh issue list --state open --limit 20 --json number,title
git fetch origin && git branch -r --list 'origin/<your-prefix>/*'
Anything already here must not be produced again.
Worktrees are removed only if unchanged, so a killed agent's survives with its work in it — usually untracked, because it died before committing:
git worktree list # find <repo>/.claude/worktrees/wf_<runid>-N
git -C <worktree> status --short # '??' entries are the salvage
git -C <worktree> log --oneline origin/main..HEAD # empty = it never committed
Copy those files into the new run's worktree rather than regenerating them, and brief the new agent to review them critically rather than trust them — they were written by an agent that never got to run its own gates, and any corrections discovered after it died will be missing.
resumeFromRunIdresumeFromRunId replays the longest unchanged prefix of agent() calls.
That is the trap: editing one prompt invalidates that call and everything after
it, so agents that already opened PRs re-run and open them again. Sibling calls
inside the same parallel() are not individually addressable either.
Resume is right when the script is genuinely unchanged and no completed agent had an external side effect. Otherwise write a new script containing only the work that did not happen, and hard-code the completed agents' outputs as inputs:
// PRs B and D are already open; do not re-run their agents.
const B_URL = 'https://github.com/<org>/<repo>/pull/2327'
const C_PROMPT = `${COMMON}
PR B is open as ${B_URL}. Do not touch its files.
The contract from the agent that completed: ${savedContract}
...`
Carry the verified findings forward as files on disk, referenced by absolute path in the new prompts, rather than pasting them into the script. It keeps the orchestrator's context free and gives the new agents the full detail:
const FACTS = '/abs/path/to/repo/tmp/<run>/facts'
// ...
`READ FIRST, IN FULL: ${FACTS}/chart.md`
Note that a gitignored scratch directory does not appear in a fresh
worktree, so reference it by absolute path into the main checkout, or add it to
.worktreeinclude.
Git refuses to check out a branch that is live in another worktree, so a fresh
isolation: "worktree" agent cannot take a branch a stale worktree still holds:
fatal: 'feat/x' is already checked out at '.../worktrees/agent-...'
Remove the stale worktrees first — after salvaging anything in them:
git worktree remove --force <repo>/.claude/worktrees/wf_<runid>-N
git worktree prune
git worktree list | grep -E '<your-branch-pattern>' || echo "branches free"
--force is correct here only because step 3 already salvaged the killed
agents' trees. After a run that completed cleanly there is nothing to
salvage: remove those worktrees non-force (so a dirty tree refuses),
scoped to this run's own wf_<run-id>- prefix and gated on the completion
notification — see agent-patterns-plugin:parallel-agent-dispatch →
references/worktree-hazards.md § "Workflow agents are unreachable and their
worktrees pin branches" (#2614).
An agent killed between "wrote the files" and "ran the gates" leaves work whose gates were never run, and the resumed agent inherits the files without inheriting that knowledge. State it in the brief, and make the new run re-run every gate rather than trusting the salvaged tree.
journal.jsonl — what actually returned, and what it returned.gh pr list / gh issue list / git branch -r — what already exists.git worktree list + status --short — what is salvageable.workflow-checkpoint-refactor — surviving your own context limit during a
long refactor, with checkpoint files. This skill covers a Workflow run
being killed, where the state to recover is other agents' worktrees and their
already-landed side effects.workflow-preflight — checking for an existing PR before starting work; the
same question, asked before the first run rather than after a failed one.git-plugin:git-coworker-check — a live peer in a shared checkout, which
produces similar-looking "my work vanished" symptoms from a different cause.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin workflow-orchestration-plugin8 skills in this plugin
/workflow-bake-offWorkflow template for a bake-off — 2–5 independent attempts, lens judges, a winner computed by Borda or a metric rule, then refine. Use when comparing competing designs or running A/B arms./workflow-checkpoint-refactorMulti-phase refactoring with checkpoint files that survive context limits. Use when refactoring spans 10+ files, needs phased rollout, or risks running out of context mid-session./workflow-implement-verifyWorkflow templates that implement 2–5 units in worktrees with a fresh verifier and one repair round, or close findings on existing branches. Use when fanning out implementers or repairs./workflow-preflightPre-work validation before implementation. Use when starting an issue or fix, or before fanning out agents, to check remote state, existing PRs, branch conflicts, gh auth, and merge gates./workflow-scale-budgetSize a Workflow script's agent count before running it, or tally a finished run's agents and tokens. Use when authoring or proposing a Workflow fan-out, or asking what a run used./workflow-verify-before-filingVerify accumulated bug claims at upstream HEAD and dedup against trackers before filing issues. Use when filing upstream reports from backlogs, audit docs, or git-history findings.Other plugins' skills for the same job