agent-loop-design

A design guide for building supervised AI-agent work loops: generate a result, verify it, and decide whether to finish or try again.

In plain words
What is it for?
Use it to specify an agent process for recurring tasks before implementing it in an agent framework.
Why use it?
It replaces open-ended reruns with observable completion rules, iteration limits, human approval at irreversible steps, and defined failure paths.

Skill for Claude CodeCodex

Part of the skilldrop plugin — 51 skills, 4 agents shipped together

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

Made for: Claude Code, Codex.

Or install skilldrop, the plugin that ships this one along with the rest of its 51 skills, 4 agents.

Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,704 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.00092 $0.01704
Opus 5 $0.00046 $0.00852
Sonnet 5 $0.00018 $0.00341
Haiku 4.5 $0.00009 $0.00170

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

Security

Grade A, and why

agent-loop-design 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.

skills/agent-loop-design/SKILL.md · 69 lines

How it starts

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

agent-loop-design

You shouldn't be prompting agents; you should be designing the loops that prompt them — and a loop is only as good as its exits. This skill produces a loop spec: the states, gates, caps, and failure routes that turn "run the agent again until it looks right" into a system a team can trust unattended. feature-implement-loop is this repo's worked example of the pattern (generate → adversarial review → gate, capped at 3 rounds); this skill designs new loops for the user's own tasks. Fan-out inside a stage is subagent-design's job; what the loop may spend is agent-budget's.

How to respond

  1. Pin the loop's job and its "done". Ask at most 2 questions, spent on: "what artifact does one successful run produce?" and "how would a human verify it's right without watching the run?" The done-condition must be observable — tests pass, checklist satisfied, reviewer-agent returns zero blockers — never "output looks good". No observable done-condition derivable → the task isn't loop-ready; say what needs defining first. Non-interactive run (no user to ask): derive both from the input and tag [assumption]; no artifact derivable → emit BLOCKED: need the task and its done-condition.

  2. Draw the state machine — generate, verify, gate, and nothing mushier.

    • Generate: produces or revises the artifact. Must consume the verifier's findings from the previous round as explicit input — a generate step that can't see why it failed is retry, not iteration.
    • Verify: judges the artifact against the done-condition. The verifier is never the generator — same model grading its own homework inflates; use a different persona, prompt, or agent (devils-advocate-style adversarial framing where quality is the risk, or programmatic checks where they exist — cheapest adequate check wins, per llm-eval-harness's grading ladder).
    • Gate: routes on the verdict — pass → exit/handoff; fail → generate with findings; fail at cap → escalate. Every loop has exactly these three state types; "polish", "reflect", and "improve" states with no verdict are where loops go to wander.

Read the full file on GitHub · 69 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 69 lines · 92 tokens per session scan A bc66758d04f7

Subscribe to this mod's changes

agent-loop-design is a skill published in the GitHub repository sananthanarayan/skilldrop (2 stars, last pushed 19d ago), licensed MIT. It adds 92 tokens to every session and 1,704 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

openlore-brainstorm

Transform a feature idea into an annotated story using a Domain Sketch or Constrained Option Tree. Use when asked to brainstorm, explore, or shape a feature before implementation.

clay-good/OpenLore · 40 tokens

openlore-analyze-codebase

Run a full static OpenLore analysis and summarize architecture, call graph, refactoring issues, and duplicate code. Use when asked to analyze, map, or assess a codebase without LLM inference.

clay-good/OpenLore · 48 tokens

openlore-review-changes

Review code changes using OpenLore risk, call, coverage, and cluster evidence without editing code. Use when asked for a change review, pre-PR safety check, or merge recommendation.

clay-good/OpenLore · 44 tokens

architect-implement

Generate a full Architecture Description (AD.md) from accepted ADRs using multi-agent DAG orchestration. Use when accepted ADRs exist and you need to produce or update unified architecture documentation.

tikalk/adlc-team-skills · 41 tokens

team-repair

Re-index OKF v0.2 index.md/log.md files, derive CDR.md, rebuild .skills.json and AGENTS.md in team-ai-directives, migrate v0.1→v0.2 frontmatter, scan for rule conflicts, and verify directive freshness. Use when indexes are inconsistent, orphans are detected, after bulk changes, or for periodic team AI directives…

tikalk/adlc-team-skills · 84 tokens

mission-brief

Mission-driven SDD orchestrator: take a feature description, structure it into a Mission Brief (goal, constraints, success criteria), generate an ordered step list with prompts that trigger installed SDD skills via model invocation or command-file discovery, and walk those steps to converged implementation. Use when…

tikalk/adlc-team-skills · 99 tokens