loop-system

A system for running repeated maker-and-verifier work cycles on a project. One part creates work, another checks it against measurable criteria, and notes from earlier sessions are retained.

In plain words
What is it for?
Use it to set up, resume, or continue an autonomous improvement loop for a project, provided the goal has clear criteria that a verifier can check.
Why use it?
It lets work continue across manually restarted sessions while recording lessons and checking whether the result actually meets the goal.

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

Made for: Claude Code, Codex.

Per session 219 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,487 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00219 $0.02487
Opus 5 $0.00110 $0.01243
Sonnet 5 $0.00044 $0.00497
Haiku 4.5 $0.00022 $0.00249

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

Security

Grade B, and why

loop-system scanned grade B with 1 finding 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

`<project>/.claude/settings.local.json` allowing exactly what the
mindgap-plugin/skills/loop-system/SKILL.md · 190 lines

How it starts

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

Loop System

Goal-driven loops: an independent verifier grades a maker's work against hard criteria, memory persists across manually-restarted sessions in markdown, lessons compound into skills. The model is stateless; this system isn't.

Dispatch — do this first

Scan self-learning-loop/*/STATE.md under the project root:

  • None found → INIT.
  • Exactly one → resume it — unless the user's prompt states a goal that does not match that loop's GOAL.md section 1; then INIT a new loop alongside it.
  • Several → resume the one named in the user's prompt. Ambiguous → list each loop (name + its Last session line) and ask which.

INIT

  1. Interview for the hard gate. Skim references/lessons.md for recorded misfires first. GOAL.md (templates/GOAL.md) has 7 required fields. Derive everything you can from the user's prompt first; ask one question at a time only for what's missing. The loop MUST NOT start until all 7 fields are filled — an unmeasurable gate means the verifier can never return PASS and the loop burns budget without converging.
    • Done-criteria must be measurable and checkable by a verifier that sees only the artifact. "Make it better" is not a criterion.
    • If the user can't supply a measurable criterion, propose a proxy: a verifier checklist of N observable properties. If they decline proxies too, refuse to loop — do the task one-shot and say why.
  2. Pick the engine per the decision rule in references/loop-patterns.md. Record choice + one-line reason in GOAL.md. Non-git project → note "no worktrees, sequential makers" in GOAL.md §7.
  3. Scaffold self-learning-loop/<loop-name>/ in the project root:
    • <loop-name> = short kebab-case slug from the goal; offer the user the chance to rename.
    • Copy templates/GOAL.md and templates/STATE.md, fill every {{field}}. Zero {{...}} may survive scaffolding.
    • Resolve §6 routing: ceiling = the current session model (auto-detected from the in-context "powered by …" line, never asked); classifier-block sibling = opus when the ceiling is fable, else none; seed the task-class list with kebab labels derived from §2 done-criteria. The only absolute model names written are the alias-ladder constant and the resolved sibling.
    • Create empty artifacts/ dir.
  4. Optional project skill: if lessons will be procedural and project-scoped, offer to create <project>/.claude/skills/<loop-name>-lessons/SKILL.md from templates/project-skill.md. Only with user approval.
  5. Permissions (with user approval): unattended sessions stall on permission prompts, so offer to write <project>/.claude/settings.local.json allowing exactly what the loop needs — Edit/Write plus the specific Bash commands derived from GOAL.md's done-criteria checks and the project's build/test commands, e.g.:

Read the full file on GitHub · 190 lines

Files

What ships with it

6 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 · 190 lines · 219 tokens per session scan B ab5cc2e06861

Subscribe to this mod's changes

loop-system is a skill published in the GitHub repository grburgess/mindgap (0 stars, last pushed 1mo ago), licensed MIT. It adds 219 tokens to every session and 2,487 once invoked, about $0.0011 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). 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

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens