loop-operator

loop-operator is a skill for Claude Code, Codex from ApexIQ/skillsmith. It costs 40 tokens per session (2,374 once invoked), scanned A, original, MIT.

A set of rules for running autonomous or partly autonomous agent loops with limits, checkpoints, progress tracking, and stop conditions.

In plain words
What is it for?
Use it for batch processing, retries, multi-step workflows, migrations, or CI/CD stages that need bounded execution and resume support.
Why use it?
It reduces the risk of loops running indefinitely, repeating failures, or losing their place during long tasks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for batch processing, retries, multi-step workflows, migrations, or CI/CD stages that need bounded execution and resume support.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/apexiq/skillsmith/loop_operator
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.

Any agent
npx skills add ApexIQ/skillsmith --skill loop_operator
Clone the repo
git clone --depth 1 https://github.com/ApexIQ/skillsmith

Made for: Claude Code, Codex.

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-operator

README.md
[![agentmods](https://agentmods.dev/badge/skills/apexiq/skillsmith/loop_operator/github.svg)](https://agentmods.dev/skills/apexiq/skillsmith/loop_operator)
Your own site
<a href="https://agentmods.dev/skills/apexiq/skillsmith/loop_operator"><img src="https://agentmods.dev/badge/skills/apexiq/skillsmith/loop_operator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for loop-operator

Your own site · 80×15
<a href="https://agentmods.dev/skills/apexiq/skillsmith/loop_operator"><img src="https://agentmods.dev/badge/skills/apexiq/skillsmith/loop_operator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,374 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 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.00040 $0.02374
Opus 5.5 $0.00016 $0.00950
Sonnet 5.5 $0.00008 $0.00475
Haiku 4.5 $0.00004 $0.00237

Measured 3mo ago against content hash 83dc5375d190, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

loop-operator 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 3mo 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.

.agent/skills/loop_operator/SKILL.md · 305 lines

How it starts

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

🔄 Loop Operator — Autonomous Execution with Safety

Philosophy: Autonomous loops are powerful but dangerous. Every loop must have a clear exit condition, a safety budget, and a checkpoint mechanism. Unbounded loops are bugs, not features.

1. When to Use This Skill

  • Running multi-step agentic workflows autonomously
  • Processing batches of tasks (files, tests, migrations)
  • Implementing retry logic with exponential backoff
  • Building CI/CD pipeline stages
  • Any iterative process that needs bounded execution

2. The Autonomous Loop Contract

Every autonomous loop MUST have these 5 properties:

Property Description Example
Exit Condition When does the loop stop successfully? All tests pass, all files processed
Max Iterations Hard cap on loop cycles max_iterations=50
Max Duration Hard cap on wall-clock time max_hours=2
Failure Budget How many consecutive failures before abort early_stop_fails=3
Checkpoint State saved after each iteration for resume checkpoint_dir=.agent/loops/

The Bounded Loop Template

import time
import json
from pathlib import Path

class BoundedLoop:
    def __init__(
        self,
        max_iterations: int = 50,
        max_duration_seconds: int = 7200,
        early_stop_fails: int = 3,
        checkpoint_dir: str = ".agent/loops",
    ):
        self.max_iterations = max_iterations
        self.max_duration_seconds = max_duration_seconds
        self.early_stop_fails = early_stop_fails
        self.checkpoint_dir = Path(checkpoint_dir)
        self.checkpoint_dir.mkdir(parents=True, exist_ok=True)
        
        self.iteration = 0
        self.consecutive_failures = 0
        self.start_time = time.time()
        self.results = []
    
    def should_continue(self) -> bool:
        """Check all exit conditions."""
        if self.iteration >= self.max_iterations:
            print(f"⛔ Max iterations reached ({self.max_iterations})")
            return False
        
        elapsed = time.time() - self.start_time
        if elapsed >= self.max_duration_seconds:
            print(f"⛔ Max duration reached ({self.max_duration_seconds}s)")
            return False
        
        if self.consecutive_failures >= self.early_stop_fails:
            print(f"⛔ Too many consecutive failures ({self.early_stop_fails})")
            return False
        
        return True
    
    def checkpoint(self, state: dict):
        """Save state for resume capability."""
        checkpoint = {
            "iteration": self.iteration,
            "elapsed_seconds": time.time() - self.start_time,
            "consecutive_failures": self.consecutive_failures,
            "state": state,
            "results": self.results,
        }
        path = self.checkpoint_dir / "latest.json"
        path.write_text(json.dumps(checkpoint, indent=2))
    
    def record_result(self, success: bool, details: dict):
        """Track iteration outcomes."""
        if success:
            self.consecutive_failures = 0
        else:
            self.consecutive_failures += 1
        
        self.results.append({
            "iteration": self.iteration,
            "success": success,
            "details": details,
        })
        self.iteration += 1

Read the full file on GitHub · 305 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. 3mo ago First seen · 305 lines · 40 tokens per session scan A 83dc5375d190

Subscribe to this mod's changes

loop-operator is a skill published in the GitHub repository ApexIQ/skillsmith (5 stars, last pushed 8mo ago), licensed MIT. It adds 40 tokens to every session and 2,374 once invoked, about $0.0002 per session on Opus 5.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-31.

Related

loop-operator compared with skills from other repositories

loop-operator next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
loop-operatorApexIQ/skillsmithSkill58mo agoMITA40Claude Code, Codex
pptxaxoviq-ai/synthadocSkill2.0ktodayAGPL-3.0A10Claude Code, Codex
xlsxaxoviq-ai/synthadocSkill2.0ktodayAGPL-3.0A9Claude Code, Codex
agentic-sql23blocks-OS/ai-maestro-pluginsSkill11yesterdayMITA98Claude Code
agent-devices23blocks-OS/ai-maestro-pluginsSkill11yesterdayMITA91Claude Code
pdfsmith-network-solutions/threadknotSkill911d agoApache-2.0A88Claude Code, Codex
memory-searchevoelsewhere/evofluxSkill1326d agoApache-2.0A112Claude Code