quality-loop

quality-loop is a command for Claude Code from DNYoussef/context-cascade. It costs 5 tokens per session (878 once invoked), scanned A, original, MIT.

A quality-loop command applies the same library-first rules used by the related agent: inspect existing libraries, documented patterns, and projects before creating code.

In plain words
What is it for?
Use it when reviewing or improving work that may depend on reusable components, patterns, or prior implementations.
Why use it?
It helps prevent unnecessary new implementations and keeps changes aligned with existing project practices.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: model in frontmatter; names the TodoWrite tool.

Good fit Use it when reviewing or improving work that may depend on reusable components, patterns, or prior implementations.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/dnyoussef/context-cascade/quality-loop
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.

Clone the repo
git clone --depth 1 https://github.com/DNYoussef/context-cascade

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/dnyoussef/context-cascade/quality-loop/github.svg)](https://agentmods.dev/commands/dnyoussef/context-cascade/quality-loop)
Your own site
<a href="https://agentmods.dev/commands/dnyoussef/context-cascade/quality-loop"><img src="https://agentmods.dev/badge/commands/dnyoussef/context-cascade/quality-loop/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 quality-loop

Your own site · 80×15
<a href="https://agentmods.dev/commands/dnyoussef/context-cascade/quality-loop"><img src="https://agentmods.dev/badge/commands/dnyoussef/context-cascade/quality-loop.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 878 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.00005 $0.00878
Opus 5.5 $0.00002 $0.00351
Sonnet 5.5 $0.00001 $0.00176
Haiku 4.5 $0.00001 $0.00088

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

Security

Grade A, and why

quality-loop 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.

commands/quality-loop.md · 115 lines

How it starts

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



Library-First Directive

This agent operates under library-first constraints:

  1. Pre-Check Required: Before writing code, search:

    • .claude/library/catalog.json (components)
    • .claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md (patterns)
    • D:\Projects\* (existing implementations)
  2. Decision Matrix:

    Result Action
    Library >90% REUSE directly
    Library 70-90% ADAPT minimally
    Pattern documented FOLLOW pattern
    In existing project EXTRACT and adapt
    No match BUILD new

Library-First Directive

This agent operates under library-first constraints:

  1. Pre-Check Required: Before writing code, search:

    • .claude/library/catalog.json (components)
    • .claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md (patterns)
    • D:\Projects\* (existing implementations)
  2. Decision Matrix:

    Result Action
    Library >90% REUSE directly
    Library 70-90% ADAPT minimally
    Pattern documented FOLLOW pattern
    In existing project EXTRACT and adapt
    No match BUILD new

STANDARD OPERATING PROCEDURE

Purpose

  • Primary action: Primary input

Trigger Conditions

  • Command syntax: /quality-loop [args]
  • Ensure prerequisites are met before execution.

Inputs and Options

  • Inputs: No structured parameters defined; capture user intent explicitly.

Execution Phases

  1. Review the request and confirm scope.
  2. Execute the command flow.
  3. Summarize outcomes and next actions.

Success Criteria and Outputs

  • Document artifacts, decisions, and follow-up actions clearly.

Error Handling and Recovery

  • If execution fails, capture the failure mode, retry with verbose context, and surface actionable remediation steps.

Chaining and Coordination

Memory and Tagging

  • Tag session outputs with who/when/why for traceability.

Example Invocation

  • /quality-loop example

Output Format

  • Provide a concise summary, actions taken, artifacts generated, and recommended next steps.
  • Always include an explicit confidence line: "Confidence: X.XX (ceiling: TYPE Y.YY)".
  • Use ceilings — inference/report: 0.70, research: 0.85, observation: 0.95, definition: 0.95.
  • Keep user-facing output in plain English; reserve VCL markers for the appendix only.

Read the full file on GitHub · 115 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 · 115 lines · 5 tokens per session scan A 902859c05fa3

Subscribe to this mod's changes

quality-loop is a command published in the GitHub repository DNYoussef/context-cascade (32 stars, last pushed 3mo ago), licensed MIT. It adds 5 tokens to every session and 878 once invoked, about $0.0000 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.