New: Earn 20% as an AgentAlley affiliate. Share your link and earn on every sale you refer. Join now New: Earn 20% as an affiliate. Join now

Phase 3 of building a Claude Managed Agent

Phase 3 — Grade → Iterate (the bounded loop)

by alirezarezvani · MIT license · ★ 26,349 on GitHub · v2.11.2 · updated Aug 30

Phase 3 — Grade → Iterate (the bounded loop) cover

Phase 3 of building a Claude Managed Agent — the bounded grade→iterate loop. Define a CMA outcome (a required markdown rubric graded by an isolated grader), read each verdict, decide the next move (sharpen / re-run / promote to…

---
name: grade-iterate
description: Phase 3 of building a Claude Managed Agent — the bounded grade→iterate loop. Define a CMA outcome (a required markdown rubric graded by an isolated grader), read each verdict, decide the next move (sharpen / re-run / promote to schedule), and once a version passes, run held-back eval cases in parallel. Use when the user says "grade my agent", "make it pass the rubric", "iterate until it's good", "is it good enough", or when the orchestrator routes phase=grade-iterate. outcome_builder.py builds the user.define_outcome payload (rubric required, max_iterations clamped 1..20 — never unbounded); verdict_reader.py reads the grader result and recommends the next move; eval_scaffold.py generates held-back cases + a parallel run plan (capped at the 25-thread CMA ceiling). Distinct from stage-launch (first launch) and run-without-you (scheduling).
version: 2.11.2
author: Alireza Rezvani
license: MIT
tags: [cma, outcome, rubric, grader, grade-iterate, loop, max-iterations, eval, held-back]
compatible_tools: [claude-code, codex-cli, cursor, antigravity, opencode, gemini-cli]
---

# Phase 3 — Grade → Iterate (the bounded loop)

This is the plugin's **loop**: CMA's `outcome` primitive self-grades the agent's
work in an isolated context and feeds failing verdicts back for the next attempt.
It is **always bounded** by `max_iterations` (1..20) — never "improve forever".

See [`../../references/loops-and-workflows.md`](../../references/loops-and-workflows.md)
and the outcome section of

Overview

This is the plugin's loop: CMA's outcome primitive self-grades the agent's work in an isolated context and feeds failing verdicts back for the next attempt. It is always bounded by max_iterations (1..20) — never "improve forever".

Manual install (npx, ZIP)
Claude Codenpx skills add alirezarezvani/claude-skills --skill grade-iterate -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/alirezarezvani/claude-skills/tar.gz/19392f7a0826 \ | tar -xz -C ~/.claude/skills --strip-components=3 claude-skills-19392f7a0826/agent-launcher/skills/grade-iterate
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/1a5e48b92de68c5750d0/grade-iterate.zip" -OutFile "$env:TEMP\grade-iterate.zip"; Expand-Archive "$env:TEMP\grade-iterate.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md4.1 KB
  • README.md997 B
  • scripts/3 files · 11.6 KB
Read the files here
alirezarezvani/19392f75 files
Shared references2SKILL.md reads these from elsewhere in the repo. Not in the ZIP.Get them on GitHub ↗
SKILL.md
Show the full text74 lines

Phase 3 — Grade → Iterate (the bounded loop)

This is the plugin's loop: CMA's outcome primitive self-grades the agent's work in an isolated context and feeds failing verdicts back for the next attempt. It is always bounded by max_iterations (1..20) — never "improve forever".

See ../../references/loops-and-workflows.md and the outcome section of ../../references/cma-primitives.md.

Workflow

  1. Define the outcome.
    python3 scripts/outcome_builder.py \
      --sheet ./my-agent/build-sheet.json --max-iterations 5 \
      --out ./my-agent/payloads/outcome.json
    
    The rubric is required; max_iterations is clamped to 1..20. Send the payload as a user.define_outcome event (append to the running session).
  2. Read every verdict first.
    python3 scripts/verdict_reader.py --result ./my-agent/last-verdict.json
    
    Tables the rubric outcome and recommends: SHIP (satisfied), SHARPEN then re-run (needs_revision), ESCALATE (max_iterations_reached / failed), RESUME (interrupted). With ≤1 iteration left it flips to "make the single highest-value fix or escalate now".
  3. Loop invariant. Each iteration must move ≥1 rubric line fail→pass, or the run halts at the cap and escalates. Don't burn the budget on cosmetic edits.
  4. Once a version passes, run held-back eval.
    python3 scripts/eval_scaffold.py \
      --sheet ./my-agent/build-sheet.json --out ./my-agent/eval.json --concurrency 5
    
    Held-back cases (never seen during iteration) run in parallel, capped at the 25-thread CMA ceiling, each graded against the same rubric.
  5. Decide. SHIP as v0, or promote to a scheduled deployment (Phase 4). Record the verdict on the goal: goal_state.py set --phase run-without-you.

Hard rules

  • Bounded, always. No outcome without a max_iterations cap.
  • Read the verdict before acting. The grader's explanation drives the next move.
  • Held-back cases are held back. Never grade generalization on cases the agent already iterated against.

Forcing-question library (recommend + cite)

  1. "What are the 3–5 rubric lines?" Recommend: grounded, checkable criteria. Cite: cma-primitives.md (rubric required).
  2. "How many iterations before you'd rather look yourself?" Recommend: 3–5. Cite: loops-and-workflows.md (bounded loop).
  3. "On a fail, sharpen the prompt or the tools?" Recommend: whichever rubric line failed points to. Cite: verdict_reader next-move table.
  4. "Which cases did the agent NOT see?" Recommend: hold back ≥3 for generalization. Cite: this SKILL (held-back eval).

Tools

  • scripts/outcome_builder.py — user.define_outcome payload (rubric required, cap 1..20).
  • scripts/verdict_reader.py — grader result → next move.
  • scripts/eval_scaffold.py — held-back cases + parallel run plan (≤25 threads).
1---
2name: grade-iterate
3description: Phase 3 of building a Claude Managed Agent — the bounded grade→iterate loop. Define a CMA outcome (a required markdown rubric graded by an isolated grader), read each verdict, decide the next move (sharpen / re-run / promote to schedule), and once a version passes, run held-back eval cases in parallel. Use when the user says "grade my agent", "make it pass the rubric", "iterate until it's good", "is it good enough", or when the orchestrator routes phase=grade-iterate. outcome_builder.py builds the user.define_outcome payload (rubric required, max_iterations clamped 1..20 — never unbounded); verdict_reader.py reads the grader result and recommends the next move; eval_scaffold.py generates held-back cases + a parallel run plan (capped at the 25-thread CMA ceiling). Distinct from stage-launch (first launch) and run-without-you (scheduling).
4version: 2.11.2
5author: Alireza Rezvani
6license: MIT
7tags: [cma, outcome, rubric, grader, grade-iterate, loop, max-iterations, eval, held-back]
8compatible_tools: [claude-code, codex-cli, cursor, antigravity, opencode, gemini-cli]
9---
10 
11# Phase 3 — Grade → Iterate (the bounded loop)
12 
13This is the plugin's **loop**: CMA's `outcome` primitive self-grades the agent's
14work in an isolated context and feeds failing verdicts back for the next attempt.
15It is **always bounded** by `max_iterations` (1..20) — never "improve forever".
16 
17See [`../../references/loops-and-workflows.md`](../../references/loops-and-workflows.md)
18and the outcome section of
19[`../../references/cma-primitives.md`](../../references/cma-primitives.md).
20 
21## Workflow
22 
231. **Define the outcome.**
24 ```bash
25 python3 scripts/outcome_builder.py \
26 --sheet ./my-agent/build-sheet.json --max-iterations 5 \
27 --out ./my-agent/payloads/outcome.json
28 ```
29 The **rubric is required**; `max_iterations` is clamped to 1..20. Send the
30 payload as a `user.define_outcome` event (append to the running session).
312. **Read every verdict first.**
32 ```bash
33 python3 scripts/verdict_reader.py --result ./my-agent/last-verdict.json
34 ```
35 Tables the rubric outcome and recommends: **SHIP** (`satisfied`), **SHARPEN**
36 then re-run (`needs_revision`), **ESCALATE** (`max_iterations_reached` /
37 `failed`), **RESUME** (`interrupted`). With ≤1 iteration left it flips to
38 "make the single highest-value fix or escalate now".
393. **Loop invariant.** Each iteration must move ≥1 rubric line fail→pass, or the
40 run halts at the cap and escalates. Don't burn the budget on cosmetic edits.
414. **Once a version passes, run held-back eval.**
42 ```bash
43 python3 scripts/eval_scaffold.py \
44 --sheet ./my-agent/build-sheet.json --out ./my-agent/eval.json --concurrency 5
45 ```
46 Held-back cases (never seen during iteration) run in parallel, capped at the
47 25-thread CMA ceiling, each graded against the same rubric.
485. **Decide.** SHIP as v0, or promote to a scheduled deployment (Phase 4). Record
49 the verdict on the goal: `goal_state.py set --phase run-without-you`.
50 
51## Hard rules
52 
53- **Bounded, always.** No outcome without a `max_iterations` cap.
54- **Read the verdict before acting.** The grader's explanation drives the next move.
55- **Held-back cases are held back.** Never grade generalization on cases the agent
56 already iterated against.
57 
58## Forcing-question library (recommend + cite)
59 
601. "What are the 3–5 rubric lines?" *Recommend:* grounded, checkable criteria.
61 *Cite:* cma-primitives.md (rubric required).
622. "How many iterations before you'd rather look yourself?" *Recommend:* 3–5.
63 *Cite:* loops-and-workflows.md (bounded loop).
643. "On a fail, sharpen the prompt or the tools?" *Recommend:* whichever rubric line
65 failed points to. *Cite:* verdict_reader next-move table.
664. "Which cases did the agent NOT see?" *Recommend:* hold back ≥3 for generalization.
67 *Cite:* this SKILL (held-back eval).
68 
69## Tools
70 
71- `scripts/outcome_builder.py` — user.define_outcome payload (rubric required, cap 1..20).
72- `scripts/verdict_reader.py` — grader result → next move.
73- `scripts/eval_scaffold.py` — held-back cases + parallel run plan (≤25 threads).
74 
View all files on GitHub →

Details

Version
2.11.2
Updated
Aug 30, 2026
License
MIT
Stars on the repo
★ 26,349
Checked
Source
alirezarezvani/claude-skills ↗
Creator
alirezarezvani · 363 listings
View creator

Similar skills

See all →
PromptAct as an expert AI engineer specializing in practicalf/prompts.chat · by Ersin YılmazAct as an expert AI engineer specializing in practical machine learning implementation and AI integration for production applications, ensuring efficient and robust AI solutions.New listingSkillQuery the 1000 Genomes Project datasetOneKGPd: Individual-Level Queries over the 1000 Genomes ProjectK-Dense-AI/scientific-agent-skills · by K-Dense-AIQuery the 1000 Genomes Project dataset (3,202 whole-genome-sequenced individuals, GRCh38) at the level of individual participants. Use when a question is about individuals or variants in the 1000 Genomes Project cohort: which individuals carry variants matching specific criteria in a gene or region, which individuals are homozygous-reference at a position, which variants exist in the dataset or carried by specified individuals in a gene or region, the relatedness between two specified individuals. Variants are returned with 1000 Genomes allele frequencies (AF), gnomAD v4.1 exome and genome AF, AlphaMissense score, and HGVSp annotations.★ 46k GitHub starsSkillBayesian modeling with PyMCPyMC Bayesian ModelingK-Dense-AI/scientific-agent-skills · by K-Dense-AIBayesian modeling with PyMC. Build hierarchical models, MCMC (NUTS), variational inference, LOO/WAIC comparison, posterior checks, for probabilistic programming and inference.★ 46k GitHub starsSkillStatistical models library for PythonStatsmodels: Statistical Modeling and EconometricsK-Dense-AI/scientific-agent-skills · by K-Dense-AIStatistical models library for Python. Use when you need specific model classes (OLS, GLM, mixed models, ARIMA) with detailed diagnostics, residuals, and inference. Best for econometrics, time series, rigorous inference with coefficient tables. For guided statistical test selection with APA reporting use statistical-analysis.★ 46k GitHub starsSkillHugging Face Transformers for loading Hub modelsK-Dense-AI/scientific-agent-skills · by K-Dense-AIHugging Face Transformers for loading Hub models, running pipeline inference, text generation, and Trainer fine-tuning on NLP, vision, audio, and multimodal tasks. Use when working with AutoModel, pipelines, tokenizers, or TrainingArguments—not for general ML outside the Transformers library.★ 46k GitHub starsSkillWorking with Outpost Bio's open microbiome foundation modelsWaypoint: Outpost Bio's Open Microbiome Foundation ModelsK-Dense-AI/scientific-agent-skills · by K-Dense-AIUse when working with Outpost Bio's open microbiome foundation models - the Waypoint checkpoints (Waypoint-6m, Waypoint-45m, Waypoint-170m), the Atlas pretraining corpus, the Compass eight-task benchmark, or the `waypoint` CLI from the `waypoint-bio` package. Covers embedding microbiome samples, fine-tuning on taxonomic abundance data, benchmarking a checkpoint on Compass, pretraining a GPT-2 model on taxonomic abundance profiles, and converting MetaPhlAn, Kraken2, QIIME 2, or MGnify abundance tables into waypoint format.★ 46k GitHub stars

More from alirezarezvani

SkillResume a paused experiment/ar:ar-resume — Resume Experimentalirezarezvani/claude-skills · by alirezarezvaniResume a paused experiment. Checkout the experiment branch, read results history, continue iterating. Use when the user runs /ar:ar-resume or asks to pick up a previously started autoresearch experiment.★ 26.3k GitHub starsSkillShow experiment dashboard with results, active loops/ar:ar-status — Experiment Dashboardalirezarezvani/claude-skills · by alirezarezvaniShow experiment dashboard with results, active loops, and progress. Use when the user runs /ar:ar-status or asks how an autoresearch experiment is going.★ 26.3k GitHub starsSkillStart an autonomous experiment loop with user-selected/ar:loop — Autonomous Experiment Loopalirezarezvani/claude-skills · by alirezarezvaniStart an autonomous experiment loop with user-selected interval (10min, 1h, daily, weekly, monthly). Uses CronCreate for scheduling. Use when the user runs /ar:loop or asks to run an autoresearch experiment continuously on a schedule.★ 26.3k GitHub starsSkillRun a single experiment iteration/ar:run — Single Experiment Iterationalirezarezvani/claude-skills · by alirezarezvaniRun a single experiment iteration. Edit the target file, evaluate, keep or discard. Use when the user runs /ar:run or asks for one manual autoresearch iteration.★ 26.3k GitHub starsSkillSet up a new autoresearch experiment interactively/ar:setup — Create New Experimentalirezarezvani/claude-skills · by alirezarezvaniSet up a new autoresearch experiment interactively. Collects domain, target file, eval command, metric, direction, and evaluator. Use when the user runs /ar:setup or asks to start optimizing a file with the autoresearch loop.★ 26.3k GitHub starsSkill/cs:boardroom <brief/cs:boardroom — Multi-Role Boardroom Deliberationalirezarezvani/claude-skills · by alirezarezvani/cs:boardroom <brief> — 6-phase multi-role deliberation across the C-suite with Phase 2 isolation, critic pre-screen, and synthesis. Outputs a board memo. Use when a decision spans multiple executive domains — e.g. a pricing change touching finance, positioning, and product, or a raise-vs-cut runway call.★ 26.3k GitHub stars