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 agentmods add rules/ag-dmitry/composer-enhanced/07-reflect-retrygit clone --depth 1 https://github.com/AG-Dmitry/composer-enhancedWrote 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/rules/ag-dmitry/composer-enhanced/07-reflect-retry)<a href="https://agentmods.dev/rules/ag-dmitry/composer-enhanced/07-reflect-retry"><img src="https://agentmods.dev/badge/rules/ag-dmitry/composer-enhanced/07-reflect-retry.svg" alt="Measured on agentmods" 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.00035 | $0.00591 |
| Opus 5 | $0.00017 | $0.00296 |
| Sonnet 5 | $0.00007 | $0.00118 |
| Haiku 4.5 | $0.00003 | $0.00059 |
Grade A, and why
07-reflect-retry 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 6d 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.
How it starts
The opening of the file, as written. The whole thing — 59 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Phase 7 — Reflect & Retry
You arrive here when the red-team found a confirmed bug or a verification gate failed. The danger now is the doom loop: a cheap model patches blindly, breaks something else, and digs deeper into a wrong approach. This protocol bounds and grounds the loop.
Iteration counter
Count one iteration per failed verify-and-fix cycle. Track it in the Iteration log of the task-memory file. The cap is 5.
Every iteration
-
Diagnose the root cause before editing. Read the actual error/test output. State, in one or two sentences, why it failed. No fix until you can name the cause. A fix without a diagnosis is a guess.
-
Check your decision log. Does the fix contradict a design decision from phase 3? If so, either keep the decision and fix within it, or add a new dated decision-log entry explaining the reversal. Never silently flip-flop.
-
Re-ground against the code. If memory and the code disagree, the code wins. Re-read the relevant file (use the git drift check — see
working-memory.mdc). -
Apply the minimal fix, then return to
05-red-team.mdcand06-verify.mdc.
Iteration-3 checkpoint (mandatory)
If you reach iteration 3 without converging, stop patching. The local approach is probably wrong. Do one of:
- Re-plan: return to
03-design-tradeoffs.mdc, reconsider the approach you rejected, and pick a different one; or - Escalate: spawn a readonly critic subagent for a fresh perspective per
escalation-subagents.mdc.
Record which you chose and why in the decision log.
Iteration-5 cap (hard stop)
If you reach iteration 5 still failing, stop. Do not keep burning tokens or mutating code. Surface a structured blocker to the user containing:
- What you were trying to do and the success criteria.
- What you tried each iteration (from the iteration log).
- The exact current failure (pasted output).
- Your best hypothesis for the root cause.
- The specific decision or information you need from the user to proceed.
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.
- 6d ago First seen · 59 lines · 35 tokens per session scan A cfa96a3bed03
07-reflect-retry is a cursor rule published in the GitHub repository AG-Dmitry/composer-enhanced (3 stars, last pushed 2mo ago), licensed MIT. It adds 35 tokens to every session and 591 once invoked, about $0.0002 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.
Other cursor rules, from other repositories
error-handling-and-validation
在所有代码中优先考虑错误处理和边缘情况。定义如何管理错误、处理前置条件和实现日志记录。.
css-render-blocking-diagnosis
Cursor rule "css-render-blocking-diagnosis" from adobecom/da-express-milo, covering css render-blocking diagnosis & resolution, critical learning from 98 pagespeed achievement, primary diagnostic protocol, step 1: css blocking symptom recognition and step 2: css loading sequence audit.
workflow-level1
Streamlined workflow for Level 1 Quick Bug Fix tasks.
modus-checkbox-value-inversion-react-short
Critical bug fix for ModusWcCheckbox value property inversion.
javascript-expert-performance
Profile first. Measure before and after. Never optimize without data.
5-bug-finder
APPLY WHEN investigating a bug.