loop

loop is a command for Claude Code from nyldn/claude-octopus. It costs 16 tokens per session (1,046 once invoked), scanned A, a copy of octo-loop, MIT.

An iterative task runner that repeats an operation until a stated goal is met or a limit is reached. It checks progress between attempts and stops when progress stalls.

In plain words
What is it for?
It can run tasks such as fixing failing tests, auditing code, or improving performance over several attempts.
Why use it?
It avoids repeatedly asking for fixes by hand and provides a safety limit against endless retries.

Command for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: positional $N argument.

Part of the octo plugin โ€” 70 skills, 106 commands, 10 agents, 18 hooks shipped together

Good fit It can run tasks such as fixing failing tests, auditing code, or improving performance over several attempts.

Compare 6 commands from other repositories โ†“
Install with agentmods
npx agentmods add commands/nyldn/claude-octopus/loop
About the project

Claude Octopus is an orchestration project that sends research, design, and coding tasks to Claude Code and other AI model providers so their results can be compared. Developers use it for multi-model work, disagreement detection, reviews, persistent context, and an optional workflow that moves from discovery through delivery. The catalogue entries are its commands, skills, agents, instructions, hooks, plugins, and settings.

nyldn/claude-octopus ยท 4,054 stars ยท on GitHub ยท reddit.com

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.

Clone the repo
git clone --depth 1 https://github.com/nyldn/claude-octopus

Made for: Claude Code.

Or install octo, the plugin that ships this one along with the rest of its 70 skills, 106 commands, 10 agents, 18 hooks.

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 loop

README.md
[![agentmods](https://agentmods.dev/badge/commands/nyldn/claude-octopus/loop.svg)](https://agentmods.dev/commands/nyldn/claude-octopus/loop)
Your own site
<a href="https://agentmods.dev/commands/nyldn/claude-octopus/loop"><img src="https://agentmods.dev/badge/commands/nyldn/claude-octopus/loop.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 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,046 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file โ€” not that it is safe.
Origin 97% copy Near-identical to another mod 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.00016 $0.01046
Opus 5 $0.00008 $0.00523
Sonnet 5 $0.00003 $0.00209
Haiku 4.5 $0.00002 $0.00105

Measured 3d ago against content hash 0518e68da243, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

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 3d 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.

Origin

This is a copy

97% identical to octo-loop โ€” 3 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

commands/loop.md ยท 138 lines

How it starts

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

Loop - Iterative Execution Skill

Your first output line MUST be: ๐Ÿ™ Octopus Loop Mode

Instructions

Read and follow the full skill instructions from: ${HOME}/.claude-octopus/plugin/.claude/skills/skill-iterative-loop/SKILL.md

Quick Usage

Just use natural language:

"Loop 5 times auditing, enhancing, testing"
"Keep trying until all tests pass"
"Iterate until performance improves"

Or use the explicit command:

/octo:loop "run tests and fix issues" --max 5
/octo:loop "optimize performance until < 100ms"

Loop Execution Approach

  1. Define Goal: Clear success criteria and exit conditions
  2. Set Max Iterations: Safety limit to prevent infinite loops
  3. Execute: Run the task/operation
  4. Evaluate: Check if goal is met or progress made
  5. Loop or Complete: Continue if needed, stop when done

What You Get

  • Systematic iteration with progress tracking
  • Clear exit conditions (max iterations or goal met)
  • Progress metrics after each iteration
  • Stall detection (stops if no progress)
  • Final summary of all iterations

Use Cases

Testing Loops:

"Loop until all unit tests pass, max 3 attempts"
"Keep fixing failing tests until test suite is green"

Optimization Iterations:

"Loop 5 times optimizing query performance"
"Iterate until API response time is under 100ms"

Progressive Enhancement:

"Loop around 3 times enhancing error handling"
"Iterate improving code quality until score > 80"

Retry Patterns:

"Try up to 5 times to connect to the database"
"Loop until deployment succeeds, max 3 retries"

Safety Features

  • Max iterations enforced: Never infinite loops
  • Stall detection: Stops if no progress after N iterations
  • Clear exit criteria: Always know when to stop
  • Progress tracking: See improvement each iteration

Parameters

  • Task/Goal: What to execute or achieve
  • Max iterations: Safety limit (default: 5, max: 20)
  • Exit condition: When to stop ("until tests pass", "until score > X")
  • Progress metric: How to measure improvement

Read the full file on GitHub ยท 138 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. 3d ago First seen ยท 138 lines ยท 16 tokens per session scan A 0518e68da243

Subscribe to this mod's changes

loop is a command published in the GitHub repository nyldn/claude-octopus (4,054 stars, last pushed today), licensed MIT. It adds 16 tokens to every session and 1,046 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 97% identical to octo-loop, differing in 3 lines, and is treated as a copy.