tasks-loop

A command that works through the user stories in a `prd.json` product-requirements file until they are complete. It follows dependencies, priorities, completion status, and an optional iteration limit.

In plain words
What is it for?
Use it to run a JSON-defined implementation backlog iteratively, either without a limit or with a maximum number of iterations.
Why use it?
It removes the need to repeatedly inspect the task list and decide which unfinished story to handle next. The command keeps the task file as the source of progress.

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/gantisstorm/essentials-claude-code/tasks-loop
Clone the repo
git clone --depth 1 https://github.com/GantisStorm/essentials-claude-code
Per session 10 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,203 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.00010 $0.01203
Opus 5 $0.00005 $0.00602
Sonnet 5 $0.00002 $0.00241
Haiku 4.5 $0.00001 $0.00120

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

Security

Grade A, and why

tasks-loop 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 2d 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.

essentials/commands/tasks-loop.md · 153 lines

How it starts

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

Tasks Loop Command

Execute prd.json tasks iteratively until all tasks are complete.

Note: Loop and swarm are interchangeable - swarm is just faster when tasks can run in parallel. Both enforce exit criteria and sync prd.json.

Uses Claude Code's built-in Task Management System for dependency tracking and visual progress (ctrl+t).

Arguments

  • prd-path (optional): Path to prd.json (default: ./prd.json)
  • --max-iterations N (optional): Maximum iterations before stopping (default: unlimited)

Instructions

Step 1: Read prd.json (Only)

DO NOT read other files, grep, or explore the codebase - just parse the prd.json. Never spawn sub-agents or delegate work — do ALL implementation directly yourself.

cat <prd-path>

Parse the JSON and identify:

  • All userStories
  • Dependencies (dependsOn array)
  • Priorities (lower number = higher priority)
  • Completion status (passes: true/false)

Step 2: Create Task Graph

Create a task for each userStory and build an ID map as you go:

// Create tasks in order — each returns a task ID
TaskCreate({ "subject": "US-001: Setup database schema", ... })  // → task "1"
TaskCreate({ "subject": "US-002: Implement auth service", ... }) // → task "2"
TaskCreate({ "subject": "US-003: Add login route", ... })        // → task "3"

// ID map: { "US-001": "1", "US-002": "2", "US-003": "3" }

Full TaskCreate per story:

TaskCreate({
  "subject": "US-001: Setup database schema",
  "description": "<full description from userStory - self-contained>",
  "activeForm": "Setting up database schema",
  "metadata": { "id": "US-001", "prdPath": "<prd-path>" }
})

Translate dependsOn to addBlockedBy using the ID map:

// prd.json says: US-003 has dependsOn: ["US-001", "US-002"]
// ID map: US-001→"1", US-002→"2", US-003→"3"
TaskUpdate({
  "taskId": "3",
  "addBlockedBy": ["1", "2"]
})

A task with non-empty blockedBy shows as blocked in ctrl+t. When a blocking task is marked completed, it's automatically removed from the blocked list. A task becomes ready (executable) when its blockedBy list is empty.

Read the full file on GitHub · 153 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. 2d ago First seen · 153 lines · 10 tokens per session scan A cb7819a01e26

Subscribe to this mod's changes

tasks-loop is a command published in the GitHub repository GantisStorm/essentials-claude-code (91 stars, last pushed 6mo ago), licensed Unlicense. It adds 10 tokens to every session and 1,203 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.