workflow-repair

workflow-repair is a command for Claude Code from marcusgoll/Spec-Flow. It costs 27 tokens per session (3,043 once invoked), scanned A, original, MIT.

A recovery command for diagnosing and repairing stuck or inconsistent workflow files. It checks workflow state, completion markers, artifacts, and locks, then can apply safe corrections or reset a workflow phase.

In plain words
What is it for?
Use it to diagnose workflow problems, automatically fix common state issues, clear stale locks, or reset a workflow to an earlier phase. It supports workflows for features and larger epics.
Why use it?
It helps recover when a workflow cannot continue because its state file is invalid, a phase is stuck, or an old lock remains. This avoids manually guessing which tracking files need repair.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/marcusgoll/spec-flow/workflow-repair
Clone the repo
git clone --depth 1 https://github.com/marcusgoll/Spec-Flow

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for workflow-repair

README.md
[![agentmods](https://agentmods.dev/badge/commands/marcusgoll/spec-flow/workflow-repair.svg)](https://agentmods.dev/commands/marcusgoll/spec-flow/workflow-repair)
Your own site
<a href="https://agentmods.dev/commands/marcusgoll/spec-flow/workflow-repair"><img src="https://agentmods.dev/badge/commands/marcusgoll/spec-flow/workflow-repair.svg" alt="Measured on agentmods" height="20"></a>
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,043 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00027 $0.03043
Opus 5 $0.00014 $0.01522
Sonnet 5 $0.00005 $0.00609
Haiku 4.5 $0.00003 $0.00304

Measured 4d ago against content hash ea094e3df0c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

workflow-repair scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/meta/workflow-repair.md · 444 lines

How it starts

The opening of the file, as written. The whole thing — 444 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/workflow repair - State Recovery Command

Use when:

  • /feature continue or /epic continue fails unexpectedly
  • state.yaml has invalid phase or status
  • domain-memory.yaml has stale locks
  • Workflow appears stuck with no clear error
  • Need to reset to a known good state

Active Workflows: !find specs epics -name "state.yaml" -exec dirname {} \; 2>/dev/null | head -5

Recent State Files: !find specs epics -name "state.yaml" -mmin -60 2>/dev/null | head -3

Locked Features (potential stale locks): !grep -l "locked_by:" specs/*/domain-memory.yaml epics/*/domain-memory.yaml epics/*/sprints/*/domain-memory.yaml 2>/dev/null | head -5

auto (Default)

Automatically diagnose and fix common issues:

  1. Detect workflow type and location
  2. Run all diagnostic checks
  3. Apply safe fixes automatically
  4. Report what was fixed

diagnose

Only diagnose - don't fix anything:

  1. Check state.yaml validity
  2. Check domain-memory.yaml consistency
  3. Check artifact presence vs phase claims
  4. Report issues found

reset-phase <phase_name>

Reset workflow to specific phase:

  1. Update state.yaml to specified phase
  2. Clear phase completion markers after that phase
  3. Preserve artifacts from completed phases

clear-locks

Clear all stale locks in domain-memory.yaml:

  1. Find all locked features
  2. Remove lock metadata
  3. Reset feature status to previous state

rebuild-state

Rebuild state.yaml from artifacts:

  1. Scan for existing artifacts (spec.md, plan.md, tasks.md)
  2. Infer completed phases from presence
  3. Generate new state.yaml

Step 1: Detect Active Workflow

# Find most recent active workflow
WORKFLOW_INFO=$(bash .spec-flow/scripts/utils/detect-workflow-paths.sh 2>/dev/null)

if [ -z "$WORKFLOW_INFO" ]; then
    echo "No active workflow detected."
    echo "Looking for any workflow with state.yaml..."

    # Fallback: find any state.yaml
    STATE_FILE=$(find specs epics -name "state.yaml" -type f 2>/dev/null | head -1)

    if [ -z "$STATE_FILE" ]; then
        echo "No workflows found. Nothing to repair."
        exit 0
    fi

    WORKFLOW_DIR=$(dirname "$STATE_FILE")
else
    WORKFLOW_DIR=$(echo "$WORKFLOW_INFO" | jq -r '"\(.base_dir)/\(.slug)"')
fi

echo "Repairing workflow at: $WORKFLOW_DIR"

Read the full file on GitHub · 444 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 444 lines · 27 tokens per session scan A ea094e3df0c3

Subscribe to this mod's changes

workflow-repair is a command published in the GitHub repository marcusgoll/Spec-Flow (92 stars, last pushed 4mo ago), licensed MIT. It adds 27 tokens to every session and 3,043 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.