loop-system

loop-system is a skill for Claude Code from grburgess/mindgap. It costs 219 tokens per session (7,818 once invoked), scanned B, original, MIT.

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 Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

Part of the mindgap plugin — 13 skills shipped together

Good fit 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.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/grburgess/mindgap/loop-system
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.

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.

Or install mindgap, the plugin that ships this one along with the rest of its 13 skills.

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 loop-system

README.md
[![agentmods](https://agentmods.dev/badge/skills/grburgess/mindgap/loop-system/github.svg)](https://agentmods.dev/skills/grburgess/mindgap/loop-system)
Your own site
<a href="https://agentmods.dev/skills/grburgess/mindgap/loop-system"><img src="https://agentmods.dev/badge/skills/grburgess/mindgap/loop-system/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for loop-system

Your own site · 80×15
<a href="https://agentmods.dev/skills/grburgess/mindgap/loop-system"><img src="https://agentmods.dev/badge/skills/grburgess/mindgap/loop-system.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 219 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,818 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00219 $0.07818
Opus 5.5 $0.00088 $0.03127
Sonnet 5.5 $0.00044 $0.01564
Haiku 4.5 $0.00022 $0.00782

Measured 23d ago against content hash 0f0232e7714f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 23d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (templates/state_edit.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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 · 511 lines

How it starts

The opening of the file, as written. The whole thing — 511 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.

State lives at $MINDGAP_HOME/learning/loop-system/. If a file is missing, create it from templates/<name>.stub.md — a fresh install starts with empty ledgers.

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 $MINDGAP_HOME/learning/loop-system/lessons.md and $MINDGAP_HOME/learning/loop-system/global-learnings.md for recorded misfires + cross-project rules first (mindgap MCP available → also mindgap_find the goal's keywords with tag global-learning). 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.
    • Satisfiability: a criterion must be able to PASS when the work is done well, not only fail when it isn't. When a criterion bounds a rate over simulated or sampled data (divergence-free fraction, coverage, acceptance rate), pilot it on ≥ 5 prior/simulated draws before the gate closes, or mark it provisional in GOAL §2 until the first pilot. A bar the method can't reach at part of the prior only surfaces sessions later, as an escalation (popinf-gates criterion 5, 2026-09-23).
    • Executability: when the artifact must run against an external system (SQL, an API request, a shell command), add a criterion that actually exercises it cheaply — a BigQuery dry_run, a request-schema validation, a --dry-run/-n parse — not only substring or mocked asserts. An all-offline PASS is proxy-complete, never final, until the artifact has run for real: offline asserts passed 7/7 on SQL that did not parse (lessons.md 2026-07-02).
    • 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 — default is workflow; use Shape 1 only for a single artifact refined in place (N=1, no parallelism) or a runtime with no workflow engine. Record choice + one-line reason in GOAL.md §7. 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. Advisor = fable-subagent when the ceiling is below fable and the alias spawns, else none (references/advisor-protocol.md). An opus/high orchestrator + fable advisor is the recommended setup; the advisor is the only sanctioned fable subagent (read-only, ≤3 calls/session).
    • Fill §4 auto-mode defaults (auto mode is ON by default): write Auto mode: on, Total budget ceiling = Max sessions × Max iterations per session, and the standard Stop-and-notify trigger set. A manual mode loop instead sets Auto mode: off (ceiling/triggers become informational). Seed STATE.md § Auto mode (status = the §4 value; budget spent: 0 / <ceiling>; everything else none/no). Then print ONE line to the user: "Auto mode ON (default): self-continues up to total iterations, halts+notifies on ; say 'manual mode' to disable."
    • Optional retrieval-policy artifact: if the loop tunes a selection/retrieval policy across sessions (which sources / queries / filters / connection heuristics to use — a discovery, mining, or scan loop), copy templates/STRATEGY.md, seed §1–§2 from the goal, and add it to STATE.md ## Consult. It is the separately-tuned structure-loop substrate (see references/structure-pass.md); a loop with a fixed one-shot policy skips it.
    • Create empty artifacts/ dir.
    • Seed the project ledger: if <project>/.claude/PROJECT-LEARNINGS.md is absent, create it from ../loop-distill/templates/PROJECT-LEARNINGS.md (sibling skill, relative to this skill's base dir), filling its placeholders — {{project-name}} = this project, and replace the header line "Distilled by loop-distill {{YYYY-MM-DD}}" with "Seeded by loop-system INIT <today's date> — not yet distilled." No distill has run, and RESUME step 1 reads this file every session; a header claiming a distill that never happened is a false claim every later session inherits. Zero {{...}} may survive. Then register this loop in its §2. Seeded from the FIRST loop, not the second — the project layer exists before there is anything to reconcile.
  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 · 511 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. 23d ago Changed · +17 lines 0f0232e7714f
  2. 24d ago Changed · +15 lines 8bb2a689dcc7
  3. 27d ago Changed · +56 lines c27a3757e112
  4. 1mo ago Changed a91bc2b4415f
  5. 2mo ago Changed · +58 lines d5b2578d11b1
  6. 2mo ago Changed · +175 lines 053461d6d44d
  7. 2mo ago 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 23d ago), licensed MIT. It adds 219 tokens to every session and 7,818 once invoked, about $0.0009 per session on Opus 5.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

loop-system compared with skills from other repositories

loop-system next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
loop-systemgrburgess/mindgapSkill023d agoMITB219Claude Code
imagegenopenai/codexSkill133kyesterdayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill99kyesterdayApache-2.0A19Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill79k4d agoMITA200Claude Code, Codex
systematic-debuggingobra/superpowersSkill313k3d agoMITA21Claude Code
next-cache-components-adoptionvercel/next.jsSkill143kyesterdayMITA95Claude Code
next-partial-prefetching-adoptionvercel/next.jsSkill143kyesterdayMITA103Claude Code