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.
npx skills add grburgess/mindgap --skill loop-systemgit clone --depth 1 https://github.com/grburgess/mindgapWrote 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.
[](https://agentmods.dev/skills/grburgess/mindgap/loop-system)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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 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 sessionline) and ask which.
INIT
- 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_findthe goal's keywords with tagglobal-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/-nparse — 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.
- 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.
- 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-subagentwhen the ceiling is below fable and the alias spawns, elsenone(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. Amanual modeloop instead setsAuto mode: off(ceiling/triggers become informational). Seed STATE.md § Auto mode (status = the §4 value;budget spent: 0 / <ceiling>; everything elsenone/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.mdis 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 byloop-distill{{YYYY-MM-DD}}" with "Seeded byloop-systemINIT <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.
- Optional project skill: if lessons will be procedural and
project-scoped, offer to create
<project>/.claude/skills/<loop-name>-lessons/SKILL.mdfrom templates/project-skill.md. Only with user approval. - Permissions (with user approval): unattended sessions stall on
permission prompts, so offer to write
<project>/.claude/settings.local.jsonallowing 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.:
What ships with it
12 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.
- docs/loop-system-explainer.html 43 KB
- references/advisor-protocol.md 3.4 KB
- references/loop-patterns.md 4.5 KB
- references/structure-pass.md 12 KB
- references/verifier-protocol.md 3.8 KB
- templates/global-learnings.stub.md 1.1 KB
- templates/GOAL.md 3.6 KB
- templates/lessons.stub.md 365 B
- templates/project-skill.md 600 B
- templates/state_edit.py 4.2 KB runs code
- templates/STATE.md 3.8 KB
- templates/STRATEGY.md 2.6 KB
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.
- 23d ago Changed · +17 lines 0f0232e7714f
- 24d ago Changed · +15 lines 8bb2a689dcc7
- 27d ago Changed · +56 lines c27a3757e112
- 1mo ago Changed a91bc2b4415f
- 2mo ago Changed · +58 lines d5b2578d11b1
- 2mo ago Changed · +175 lines 053461d6d44d
- 2mo ago First seen · 190 lines · 219 tokens per session scan B ab5cc2e06861
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.
loop-system compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| loop-systemgrburgess/mindgap | Skill | 0 | 23d ago | MIT | B | 219 | Claude Code |
| imagegenopenai/codex | Skill | 133k | yesterday | Apache-2.0 | A | 113 | Codex |
| playwright-climicrosoft/playwright | Skill | 99k | yesterday | Apache-2.0 | A | 19 | Claude Code |
| local-ai-agentsmicrosoft/ai-agents-for-beginners | Skill | 79k | 4d ago | MIT | A | 200 | Claude Code, Codex |
| systematic-debuggingobra/superpowers | Skill | 313k | 3d ago | MIT | A | 21 | Claude Code |
| next-cache-components-adoptionvercel/next.js | Skill | 143k | yesterday | MIT | A | 95 | Claude Code |
| next-partial-prefetching-adoptionvercel/next.js | Skill | 143k | yesterday | MIT | A | 103 | Claude Code |