loop

A controlled iteration process for running a mission as a series of separate coding attempts. Each attempt makes one change, checks it, and can resume from saved state after a restart.

In plain words
What is it for?
Use it to try multiple small improvements to a codebase while keeping a record of attempts and results. It is intended for ongoing missions, not a single task.
Why use it?
It limits repeated experimentation with timeouts, an attempt cap, and a stop rule after repeated failures. This prevents an automated loop from running indefinitely or relying only on trust.

Skill for Claude CodeCodex

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 skills/joymin5655/agent/loop
Any agent
npx skills add joymin5655/Agent --skill loop
Clone the repo
git clone --depth 1 https://github.com/joymin5655/Agent

Made for: Claude Code, Codex.

Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,223 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.00103 $0.01223
Opus 5 $0.00051 $0.00611
Sonnet 5 $0.00021 $0.00245
Haiku 4.5 $0.00010 $0.00122

Measured yesterday against content hash 53e277799889, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

skills/loop/SKILL.md · 93 lines

How it starts

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

/loop

Goal

Run a mission as a bounded series of attempts: pick one idea, make exactly one change, grade it, keep or discard, and stop at a hard cap, a per-attempt timeout, or two consecutive GATE failures (circuit breaker) — never on trust alone. All mechanical enforcement (state, ledger, cap, breaker) lives in core/infra/loop-run.sh; this skill is the iteration protocol that calls it.

Relationship to skills/harness-loop

This skill is the generic protocol: fresh context per iteration, exactly one task per iteration, resumable on-disk state, hard budget. /harness-loop is a SPECIALIZATION of it for one fixed mission — improving this harness's own reviewer prompts under §5's rules (fixed TARGET regex, GATE floor, branch convention). If the mission is "improve the harness itself", follow /harness-loop instead of the generic steps below — its numbered procedure is the maintained regulation for that mission.

Steps

  1. Mission intake. From the request, determine: a slug (short, kebab-case), a TARGET file-path regex the loop may edit, a base ref (the mission's starting commit — usually HEAD), an attempt cap (default 5), and a per-attempt timeout in seconds (default 600). Confirm any ambiguous one with the user — a loop whose edit scope isn't pinned down is not this skill's contract.

  2. Initialize.

    bash core/infra/loop-run.sh init <slug> --target '<regex>' --base <ref> \
      [--cap N] [--timeout-s N] --mission "<one-line description>"
    

    This creates the SQLite goal row (supervisor-goal.sh, attempts modeled as waves), the JSON state file, and the active-loop flag that arms core/hooks/loop-write-guard.py for the rest of the session.

  3. Iterate. Each iteration is a fresh context turn — start a new conversation turn or subagent dispatch per iteration rather than carrying the previous iteration's reasoning forward, so each attempt is judged on its own diff, not on accumulated history — doing exactly one task: a. Pick one improvement idea within the declared TARGET. b. Edit only TARGET files. c. git commit the change. d. Grade it:

    bash core/infra/loop-run.sh attempt <slug> --desc "<=80 char idea summary>"
    

    e. Read the LOOP: line at the end of the output — the only line to act on:

    • LOOP: continue — the same output's ATTEMPT: status=… line says whether to keep this commit or git reset --hard back to the pre-attempt commit; then start the next iteration.
    • LOOP: stop(cap) or LOOP: stop(circuit-breaker) — the loop ended on its own; go to step 5.

Read the full file on GitHub · 93 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 · 93 lines · 103 tokens per session scan A 53e277799889

Subscribe to this mod's changes

loop is a skill published in the GitHub repository joymin5655/Agent (2 stars, last pushed 7d ago), licensed MIT. It adds 103 tokens to every session and 1,223 once invoked, about $0.0005 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-31.

Related

Other skills, from other repositories

regex-mastery

Use this skill when writing regular expressions, debugging pattern matching,optimizing regex performance, or implementing text validation. Triggers on regex, regular expressions, pattern matching, lookahead, lookbehind, named groups, capture groups, backreferences, and any task requiring text pattern matching.

alibaba/anolisa · 60 tokens

shell-scripting

Use this skill when writing bash or zsh scripts, parsing arguments, handling errors, or automating CLI workflows. Triggers on bash scripting, shell scripts, argument parsing, process substitution, here documents, signal trapping, exit codes, and any task requiring portable shell script development.

alibaba/anolisa · 60 tokens

agent-vitals

Introspect the user's local AI agent infrastructure in real time. Use proactively: before starting tasks, before scheduling cron/timer work, when stuck, after long tasks, or when claiming something works. Exposes tools: vitalssummary, shadowlist, shadowstale, burnoutsummary, burnoutstucksessions.

anirudhprashant/agent-vitals · 68 tokens

agent-reach

MUST USE when user wants to 调研/research/搜索/search/查/找/look up anything on the internet — e.g. 全网调研 X / 帮我调研一下 X / 查一下 X / 搜搜 X / 看看大家怎么评价 X / X 上有什么讨论 / research this topic。 Also MUST USE when user mentions any platform or shares any URL/链接: 小红书/xiaohongshu/xhs, Twitter/推特/X, B站/bilibili, Reddit, Facebook, Instagram…

Panniantong/Agent-Reach · 349 tokens

memory

Use durable BB memory when prior project knowledge or cross-project user preferences can improve the current task, and save durable new learning through the bb memory CLI.

get-bb/bb · 32 tokens

workflows

Execute a workflow script that orchestrates multiple subagents deterministically. Use when the user explicitly requests a workflow, multi-agent orchestration, parallel or sequential agent pipelines, structured agent outputs, or a durable background workflow run.

get-bb/bb · 47 tokens