infinite

infinite is a command for Claude Code from PacktPublishing/Agentic-Coding-with-Claude-Code. It costs 0 tokens per session (1,560 once invoked), scanned A, original, MIT.

A command for repeatedly generating numbered outputs from a specification file into an output directory. It accepts a file path, destination, and iteration count, including an “infinite” option.

In plain words
What is it for?
Use it for repeated, evolving output generation when the specification defines the content and iteration pattern.
Why use it?
The input does not describe a specific content type or additional behavior beyond iterative generation from a specification.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions subagents.

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/packtpublishing/agentic-coding-with-claude-code/infinite
Clone the repo
git clone --depth 1 https://github.com/PacktPublishing/Agentic-Coding-with-Claude-Code

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 infinite

README.md
[![agentmods](https://agentmods.dev/badge/commands/packtpublishing/agentic-coding-with-claude-code/infinite.svg)](https://agentmods.dev/commands/packtpublishing/agentic-coding-with-claude-code/infinite)
Your own site
<a href="https://agentmods.dev/commands/packtpublishing/agentic-coding-with-claude-code/infinite"><img src="https://agentmods.dev/badge/commands/packtpublishing/agentic-coding-with-claude-code/infinite.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 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,560 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.1 $0.00000 $0.01560
Opus 5 $0.00000 $0.00780
Sonnet 5 $0.00000 $0.00312
Haiku 4.5 $0.00000 $0.00156

Measured yesterday against content hash e07faf0c6ef5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

infinite 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 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.

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.

Chapter02/hookhub/hookhub/.claude/commands/infinite.md · 181 lines

How it starts

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

INFINITE AGENTIC LOOP COMMAND

Think deeply about this infinite generation task. You are about to embark on a sophisticated iterative creation process.

Variables:

spec_file: $ARGUMENTS output_dir: $ARGUMENTS count: $ARGUMENTS

ARGUMENTS PARSING: Parse the following arguments from "$ARGUMENTS":

  1. spec_file - Path to the markdown specification file
  2. output_dir - Directory where iterations will be saved
  3. count - Number of iterations (1-N or "infinite")

PHASE 1: SPECIFICATION ANALYSIS Read and deeply understand the specification file at spec_file. This file defines:

  • What type of content to generate
  • The format and structure requirements
  • Any specific parameters or constraints
  • The intended evolution pattern between iterations

Think carefully about the spec's intent and how each iteration should build upon previous work.

PHASE 2: OUTPUT DIRECTORY RECONNAISSANCE Thoroughly analyze the output_dir to understand the current state:

  • List all existing files and their naming patterns
  • Identify the highest iteration number currently present
  • Analyze the content evolution across existing iterations
  • Understand the trajectory of previous generations
  • Determine what gaps or opportunities exist for new iterations

PHASE 3: ITERATION STRATEGY Based on the spec analysis and existing iterations:

  • Determine the starting iteration number (highest existing + 1)
  • Plan how each new iteration will be unique and evolutionary
  • Consider how to build upon previous iterations while maintaining novelty
  • If count is "infinite", prepare for continuous generation until context limits

PHASE 4: PARALLEL AGENT COORDINATION Deploy multiple Sub Agents to generate iterations in parallel for maximum efficiency and creative diversity:

Sub-Agent Distribution Strategy:

  • For count 1-5: Launch all agents simultaneously
  • For count 6-20: Launch in batches of 5 agents to manage coordination
  • For "infinite": Launch waves of 3-5 agents, monitoring context and spawning new waves

Agent Assignment Protocol: Each Sub Agent receives:

  1. Spec Context: Complete specification file analysis
  2. Directory Snapshot: Current state of output_dir at launch time
  3. Iteration Assignment: Specific iteration number (starting_number + agent_index)
  4. Uniqueness Directive: Explicit instruction to avoid duplicating concepts from existing iterations
  5. Quality Standards: Detailed requirements from the specification

Agent Task Specification:

TASK: Generate iteration [NUMBER] for [SPEC_FILE] in [OUTPUT_DIR]

You are Sub Agent [X] generating iteration [NUMBER]. 

CONTEXT:
- Specification: [Full spec analysis]
- Existing iterations: [Summary of current output_dir contents]
- Your iteration number: [NUMBER]
- Assigned creative direction: [Specific innovation dimension to explore]

REQUIREMENTS:
1. Read and understand the specification completely
2. Analyze existing iterations to ensure your output is unique
3. Generate content following the spec format exactly
4. Focus on [assigned innovation dimension] while maintaining spec compliance
5. Create file with exact name pattern specified
6. Ensure your iteration adds genuine value and novelty

DELIVERABLE: Single file as specified, with unique innovative content

Parallel Execution Management:

  • Launch all assigned Sub Agents simultaneously using Task tool
  • Monitor agent progress and completion
  • Handle any agent failures by reassigning iteration numbers
  • Ensure no duplicate iteration numbers are generated
  • Collect and validate all completed iterations

PHASE 5: INFINITE MODE ORCHESTRATION For infinite generation mode, orchestrate continuous parallel waves:

Wave-Based Generation:

  1. Wave Planning: Determine next wave size (3-5 agents) based on context capacity
  2. Agent Preparation: Prepare fresh context snapshots for each new wave
  3. Progressive Sophistication: Each wave should explore more advanced innovation dimensions
  4. Context Monitoring: Track total context usage across all agents and main orchestrator
  5. Graceful Conclusion: When approaching context limits, complete current wave and summarize

Read the full file on GitHub · 181 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 · 181 lines · 0 tokens per session scan A e07faf0c6ef5

Subscribe to this mod's changes

infinite is a command published in the GitHub repository PacktPublishing/Agentic-Coding-with-Claude-Code (186 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,560 tokens. 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-09-04.