spec-loop

A command that repeatedly selects and implements the next highest-priority task from a feature specification until the work is finished or a limit is reached.

In plain words
What is it for?
Use it to execute spec tasks in sequence, track recent progress, limit iterations, and optionally run a command after clean completion.
Why use it?
It turns a task list into a continuing implementation cycle and reduces the need to restart the process for each task.

Command

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/habib0x0/spec-driven-plugin/spec-loop
Clone the repo
git clone --depth 1 https://github.com/Habib0x0/spec-driven-plugin
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,532 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00011 $0.01532
Opus 5 $0.00005 $0.00766
Sonnet 5 $0.00002 $0.00306
Haiku 4.5 $0.00001 $0.00153

Measured yesterday against content hash 8a69b6549bd4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

spec-loop scanned grade B with 1 finding 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 yesterday.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat .claude/specs/my-feature/progress.md | tail -20
commands/spec-loop.md · 180 lines

How it starts

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

/spec-loop Command

Run spec-driven implementation in a loop. Each iteration picks the next highest-priority task, implements it, and continues until all tasks are done or max iterations reached.

Usage

Run the script directly from your project root:

${CLAUDE_PLUGIN_ROOT}/scripts/spec-loop.sh [--spec-name <name>] [--max-iterations <n>] [--progress-tail <n>] [--on-complete <command>]

Or via Bash tool if invoked within Claude Code:

bash ${CLAUDE_PLUGIN_ROOT}/scripts/spec-loop.sh --spec-name <name>

Arguments

  • --spec-name <name> - Which spec to execute against. Auto-detected if only one spec exists in .claude/specs/.
  • --max-iterations <n> - Maximum number of iterations before stopping. Default: 50.
  • --progress-tail <n> - Number of recent progress entries to include in prompt. Default: 20.
  • --on-complete <command> - Shell command to run after clean completion. Only fires when <promise>COMPLETE</promise> is detected, not on max-iterations exit. Recommended: "bash scripts/spec-accept.sh --spec-name <name>".

What It Does

  1. Reads your spec files fresh each iteration
  2. Runs Claude to implement one feature per iteration
  3. Runs verification gates on completed tasks
  4. Checks output for <promise>COMPLETE</promise> to detect completion
  5. Stops when all tasks are done or max iterations reached

Recommended hook — run UAT automatically on clean completion:

bash scripts/spec-loop.sh --spec-name <name> \
  --on-complete "bash scripts/spec-accept.sh --spec-name <name>"

If you want docs too:

bash scripts/spec-loop.sh --spec-name <name> \
  --on-complete "bash scripts/spec-accept.sh --spec-name <name> && bash scripts/spec-docs.sh --spec-name <name>"

Post-completion (release notes, retro) should be run manually after reviewing acceptance results:

bash scripts/spec-accept.sh --spec-name <name>    # UAT gate
bash scripts/spec-docs.sh --spec-name <name>      # Docs
bash scripts/spec-release.sh --spec-name <name>   # Release notes
bash scripts/spec-retro.sh --spec-name <name>     # Retrospective

Read the full file on GitHub · 180 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. yesterday First seen · 180 lines · 11 tokens per session scan B 8a69b6549bd4

Subscribe to this mod's changes

spec-loop is a command published in the GitHub repository Habib0x0/spec-driven-plugin (10 stars, last pushed 3mo ago), licensed MIT. It adds 11 tokens to every session and 1,532 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.