refine-loop

refine-loop is a skill for Claude Code, Codex from joris887/exosuit. It costs 0 tokens per session (1,430 once invoked), scanned A, original, MIT.

A repeat-and-check workflow for improving a document, implementation, prompt, or design until a stated condition is met.

In plain words
What is it for?
Use it to run several improvement rounds, check each round against verifiable criteria, and stop after a set number of attempts or when further changes have little benefit.
Why use it?
It prevents work from stopping after the first draft when the result still needs refinement. It also records incomplete work so it can be continued later.

Skill for Claude CodeCodex

Part of the exosuit plugin — 44 skills, 1 command, 9 agents, 10 hooks 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/joris887/exosuit/refine-loop
Any agent
npx skills add joris887/exosuit --skill refine-loop
Clone the repo
git clone --depth 1 https://github.com/joris887/exosuit

Made for: Claude Code, Codex.

Or install exosuit, the plugin that ships this one along with the rest of its 44 skills, 1 command, 9 agents, 10 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 refine-loop

README.md
[![agentmods](https://agentmods.dev/badge/skills/joris887/exosuit/refine-loop.svg)](https://agentmods.dev/skills/joris887/exosuit/refine-loop)
Your own site
<a href="https://agentmods.dev/skills/joris887/exosuit/refine-loop"><img src="https://agentmods.dev/badge/skills/joris887/exosuit/refine-loop.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,430 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.00000 $0.01430
Opus 5 $0.00000 $0.00715
Sonnet 5 $0.00000 $0.00286
Haiku 4.5 $0.00000 $0.00143

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

Security

Grade A, and why

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

.claude/skills/refine-loop/SKILL.md · 162 lines

How it starts

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


refine-loop

Refining: $ARGUMENTS

Argument Parsing

Argument Required Default Description
<task> Yes - What to produce or improve
--until "<criteria>" Yes - Completion condition (must be verifiable)
--max <N> No 5 (50 if --autonomous) Maximum iterations before stopping
--autonomous No false Extended unattended mode: higher iteration cap, TSV logging, diminishing-returns auto-stop

Failure State Persistence

At loop entry, write docs/sessions/.failure-state.md with YAML frontmatter so the Stop hook and /continue can programmatically detect incomplete workflows.

At loop entry (before first execution):

---
status: active
skill: refine-loop
phase: "1"
phase_name: "Initial Execution"
started_at: "[ISO-8601 timestamp from date -u +%Y-%m-%dT%H:%M:%SZ]"
story: "[from $ARGUMENTS — the task description]"
branch: "[from git branch --show-current]"
next_action: "Execute task and produce first draft"
autonomous: [true|false]
files_modified: []
---

## Context
Task: [task description]
Criteria: [completion criteria]
Iteration: 1 of [max]
Mode: [standard | autonomous]

At each iteration: Update phase to the iteration number, phase_name to "Iteration N", next_action to the specific improvement being applied, and append to files_modified. Update the Context section with iteration progress and remaining gaps.

When criteria are met (or max iterations reached): Delete .failure-state.md — clean state means no failure to recover from.

Process

1. Initial Execution

Execute the task to produce the first draft/version.

If --autonomous: Initialize the iteration log file:

docs/sessions/.refine-log.tsv:
iteration	criteria_met	criteria_total	gap_description	action_taken	timestamp
0	0	<total>	Initial execution	Produced first draft	<ISO-8601>

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

Subscribe to this mod's changes

refine-loop is a skill published in the GitHub repository joris887/exosuit (4 stars, last pushed 14d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,430 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-08-31.

Related

Other skills, from other repositories

moai-workflow-docs-claim-check

Read-only check of whether the claims a public-facing document makes (README, release notes, install and usage guides) are supported by user-supplied evidence. Runs Preflight, Claim Triage, and Validation, splits composite claims into atomic ones, and labels each. Runs no commands and writes no fixes.

modu-ai/moai-adk · 72 tokens

moai-ref-seo

Search-visibility and crawlability reference for web output: canonical URL discipline, per-page title and meta description uniqueness, robots.txt and sitemap.xml as host-derived artifacts, JSON-LD structured data with entity consistency, and the document-semantics rules that decide whether a machine can read a page at…

modu-ai/moai-adk · 178 tokens

moai-workflow-project

Integrated project management system covering documentation, language initialization, template optimization, docs generation, and JIT document loading. Absorbed from moai-workflow-templates, moai-docs-generation, and moai-workflow-jit-docs.

modu-ai/moai-adk · 55 tokens

truthmark-document

Use when the user asks to document existing implemented behavior, or Sync, Check, or Structure finds implemented behavior missing canonical truth. Not for functional-code changes, doc-first implementation, or topology repair that needs Structure.

merlinhu1/truthmark · 46 tokens

doncheli-prd

Generate professional Product Requirement Documents (PRD) from multiple sources — Figma designs, briefs, user research, existing code. Includes risk analysis, RICE prioritization, Gherkin stories and launch plan. Activate when user mentions "PRD", "product requirements", "requirement document", "product spec", "figma…

doncheli/don-cheli-sdd · 81 tokens

doncheli-data-policy

Audit and document what personal or sensitive data the project collects, processes, and stores. Activate when user mentions "privacy", "data policy", "what data", "GDPR", "personal data", "data retention", "PII".

doncheli/don-cheli-sdd · 54 tokens