loop-engineering

A method for building agent workflows that repeat making, checking, and correcting work until machine-verifiable conditions are met.

In plain words
What is it for?
Use it to design or run loops with a maker, an independent read-only verifier, project files such as goal and rubric documents, and saved state in .claude/loop/.
Why use it?
It keeps completion evidence outside the conversation, separates implementation from grading, and prevents vague claims of being finished.

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

Made for: Claude Code, Codex.

Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 860 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.00052 $0.00860
Opus 5 $0.00026 $0.00430
Sonnet 5 $0.00010 $0.00172
Haiku 4.5 $0.00005 $0.00086

Measured yesterday against content hash 8da78eff826f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

loop-engineering 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-engineering/SKILL.md · 43 lines

How it starts

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

Loop Engineering

Design the system that prompts the agent instead of prompting the agent each turn. A loop = run → collect feedback → self-correct, repeated until a verifiable stop condition holds.

Three principles (non-negotiable)

  1. The maker must not grade its own work. Implementation belongs to the configured implementer (implementer: in loop.config.md — the Codex CLI when available, else the main agent); grading belongs to the verifier subagent: fresh context, read-only, rubric.md as its only standard. It returns a report; the main agent applies it to the loop files.
  2. "Done" is a claim, not a proof. Every stop condition must be machine-checkable: a command that exits 0, a file that exists, an output that matches. Subjective criteria are banned from rubric.md.
  3. Memory lives on disk, not in context. Everything the next session needs is in .claude/loop/state.md is the entry point; a fresh session reads that directory and resumes where the loop stopped.

Structure

Plugin = immutable logic (installed once per machine). .claude/loop/ = mutable state (once per project, created by /loopy:loop-init): goal.md, rubric.md, state.md (summary rewritten each cycle, max 100 lines), memory.md, review.md (human review summary, every cycle), loop.config.md (the only stack-dependent file).

Cycle shape

Implement (fresh codex exec per cycle when implementer: codex, prompt rebuilt from disk state; never resumed) → verifier grades ONCE at cycle end (phase gate — never per file edit) → main agent updates rubric checkboxes, rewrites state.md, records memory, overwrites review.md. Safety rails always on: max_iterations cap and 3-consecutive-failure escalation. An unbounded "repeat until pass" loop is forbidden.

Decision gates

Before a side-effecting action, classify by reversibility × impact. Reversible/local (edits, tests, local commits, work-branch push) → act or delegate, never re-ask. Irreversible or high-impact (merge to a protected branch, release, publish, external send, cost, destructive delete) → stop at a human gate. decision_gate.sh blocks the irreversible class; auto_push.sh (Stop hook) auto-pushes the work branch. The test is "can this be undone?", not "may I ask?".

Read the full file on GitHub · 43 lines

Files

What ships with it

5 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. yesterday First seen · 43 lines · 52 tokens per session scan A 8da78eff826f

Subscribe to this mod's changes

loop-engineering is a skill published in the GitHub repository hhamja/claude-code-harness (1 stars, last pushed 1mo ago), licensed MIT. It adds 52 tokens to every session and 860 once invoked, about $0.0003 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

weekly-digests

Generate a serial week-by-week narrative digest of a project's full claude-mem timeline. Splits the timeline into per-ISO-week files, then runs one consecutive subagent per week — each receiving the prior week's carry-forward block — to produce one chapter per ISO week of data. Use when asked for "weekly digests"…

thedotmack/claude-mem · 93 tokens

skill-creator

Create, install, or update skills in the workspace. Use when (1) installing a skill from a URL or remote source, (2) creating a new skill from scratch, (3) updating or restructuring existing skills. Always use this skill for any skill installation or creation task.

zhayujie/CowAgent · 61 tokens

skill-template

Template for creating new Agent Skills for context engineering. Use this template when adding new skills to the collection.

muratcankoylan/Agent-Skills-for-Context-Engineering · 24 tokens

geo-audit

Full website GEO+SEO audit with parallel subagent delegation. Orchestrates a comprehensive Generative Engine Optimization audit across AI citability, platform analysis, technical infrastructure, content quality, and schema markup. Produces a composite GEO Score (0-100) with prioritized action plan.

zubair-trabzada/geo-seo-claude · 60 tokens

Agent Development

This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development…

anthropics/claude-code · 80 tokens

skill-creator

Scaffold a new yoyo skill when a human or community issue asks for one ("add a skill for X", "create a skill that does Y"). Generates correct frontmatter, validates, writes to disk.

yologdev/yoyo-evolve · 46 tokens