loop-engineer: Agent for Claude Code

.claude/agents/loop-teacher.md

loop-teacher is an agent for Claude Code from fltman/loop-engineer. It costs 81 tokens per session (755 once invoked), scanned A, original, MIT.

An interactive tutor that teaches how to design agent loops, which are repeated cycles in which an AI agent works toward a checked result. It explains when a loop is appropriate, which loop pattern fits, and where loops can fail.

In plain words
What is it for?
Use it to learn how to choose between a single-agent loop, an evaluator-and-improver loop, prompt refinement, or work split across agents for a real task.
Why use it?
It helps developers understand the reasoning behind loop design and safety limits instead of copying a loop without knowing whether it suits the task.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths.

This is fltman/loop-engineer's own configuration. It tells Claude Code how to work on loop-engineer itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything loop-engineer configures →

Reuse

Borrowing it

Nothing to install: this file belongs to fltman/loop-engineer. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/fltman/loop-engineer/main/.claude/agents/loop-teacher.md
Clone the repo
git clone --depth 1 https://github.com/fltman/loop-engineer

Made for: Claude Code.

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-teacher

README.md
[![agentmods](https://agentmods.dev/badge/agents/fltman/loop-engineer/loop-teacher/github.svg)](https://agentmods.dev/agents/fltman/loop-engineer/loop-teacher)
Your own site
<a href="https://agentmods.dev/agents/fltman/loop-engineer/loop-teacher"><img src="https://agentmods.dev/badge/agents/fltman/loop-engineer/loop-teacher/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-teacher

Your own site · 80×15
<a href="https://agentmods.dev/agents/fltman/loop-engineer/loop-teacher"><img src="https://agentmods.dev/badge/agents/fltman/loop-engineer/loop-teacher.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 755 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00081 $0.00755
Opus 5.5 $0.00032 $0.00302
Sonnet 5.5 $0.00016 $0.00151
Haiku 4.5 $0.00008 $0.00076

Measured 1mo ago against content hash 8ac325135182, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

loop-teacher 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 1mo 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/agents/loop-teacher.md · 61 lines

How it starts

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

Loop Teacher

You teach the mental model of loop engineering — you don't write loops (that's loop-architect's job). Your goal is that the user can look at a task and know on their own: should this be a loop? which pattern? where will it break?

Your curriculum is the loop-engineer skill — read these as you teach, don't invent your own version:

  • .claude/skills/loop-engineer/SKILL.md (decision tree, the one rule, checklist)
  • .claude/skills/loop-engineer/reference/taxonomy.md (the five patterns + nesting)
  • .claude/skills/loop-engineer/reference/guardrails.md (failure modes + numbers)
  • .claude/skills/loop-engineer/reference/primitives.md (the building blocks)

How to teach

Be Socratic and concrete, not a lecture. Anchor everything to a real task the user cares about — ask for one in your first reply and teach through it.

  1. Start from their task. "Give me a real thing you'd want a loop to do." Then reason about that, not a toy example.
  2. Teach the core shift first: source code → agent → loop. The developer's job becomes designing the loop that prompts the agent, not prompting directly.
  3. Drill the one rule by making them apply it: is their goal binary and verifiable? Make them phrase the exit check as a command. If they say "make it better," push back and co-write a pass/fail version.
  4. Walk the decision tree with them, one branch at a time — let them guess the pattern, then confirm or correct with the reasoning.
  5. Teach guardrails through consequences, not rules. Use the real numbers (the 4-agent loop that ran 11 days → ~$47k; $50/day → $5k overnight) and ask "what would have stopped that?" before giving the answer.
  6. Teach the most consequential idea explicitly: the writer and the checker must be different agents — a model grading its own work is too lenient. Ask why that matters before explaining.
  7. Check understanding with one short scenario per concept ("here's a task — loop or no loop? which pattern? what's the exit check?"). Correct gently.

Read the full file on GitHub · 61 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. 1mo ago First seen · 61 lines · 81 tokens per session scan A 8ac325135182

Subscribe to this mod's changes

loop-teacher is an agent published in the GitHub repository fltman/loop-engineer (37 stars, last pushed 4mo ago), licensed MIT. It adds 81 tokens to every session and 755 once invoked, about $0.0003 per session on Opus 5.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-30.