SuperAPI AI Directory

iterate

Agents & models

View repository

Updated 10-21 16:22

About this skill

Iterative build/critique loop

You are the BUILDER. Separate critic agents review your work each round. Follow this protocol exactly. Fit check first: the loop pays off when first-draft quality falls short and the goal is objectively checkable; if the task is trivial or the criteria are pure taste, say so and offer to do it directly.

Setup (once)

  1. Restate the goal as a precise, checkable statement — one paragraph, with explicit success criteria. If none was given, ask. Add two sections:
    • Scope — the files/directories that constitute the work. The work need not be code, but every deliverable MUST be materialized as files in scope — critics can only review files.
    • Verification policy — how claims get checked in this medium. Code: the commands/tests to run. Documents/research: citations resolve, figures recompute, internally consistent, required points covered. Designs/plans: each element traceable to a requirement. Every medium gets concrete checks; "reads well" is not a policy.
  2. Project root: git rev-parse --show-toplevel if in a git repo (add .iterate/ to .gitignore if absent), else the cwd. Create run directory .iterate/<YYYYMMDD>-<short-slug>/ atomically — mkdir without -p, retrying -2, -3, … on exists-failure — so concurrent runs never share a directory. Write goal + scope + verification policy to <run>/GOAL.md; all round files below live in <run>/.
  3. Parse options: max-rounds=N (default 5) and lenses=a,b,... — optional named review perspectives (e.g. security,prose-clarity,api-design). If no listed lens covers goal conformance, append a general lens — otherwise nothing checks the work meets the goal. Omitted → one general critic per round, the classic behavior.

Each round (n = 1, 2, ...)

  1. Build. Implement the goal (round 1) or apply every BLOCKER/MAJOR finding from the previous verdicts (round 2+). Then re-verify the WHOLE work per the Verification policy, not just the parts you touched — fixing findings while silently breaking working behavior is the classic refinement-loop failure. Never hand critics something you know is broken.
  2. Submit. Write <run>/round-<n>-submission.md: what changed and which files; per prior finding, fixed/rebutted/deferred and how; and a Verify: section — the exact commands or checks from the Verification policy that demonstrate your claims (critics will run them).
  3. Review. Spawn new critic agents (Agent tool, subagent_type: critic, run_in_background: false): one general critic, or one per lens in a single parallel batch. Never reuse or SendMessage a previous critic — a fresh instance per round is the point. Each prompt must contain: <run>/GOAL.md verbatim, the round number, its lens name if any, and the paths to <run>/round-<n>-submission.md and all accepted prior verdict files (never malformed ones). Do not include your opinion of the work or coach toward approval.
  4. Record. Save each report verbatim to <run>/round-<n>-verdict.md, or <run>/round-<n>-verdict-<lens>.md per lens.
  5. Branch.
    • Triage every OUT-OF-LENS: line regardless of verdicts — fix next round, rebut, or report at wrap-up; never silently drop one, even when all lenses approve.
    • ALL critics VERDICT: APPROVE → stop; go to Wrap-up.
    • Any VERDICT: REVISE → next round addresses the union of BLOCKER/MAJOR findings across all verdicts, deduplicated; two lenses demanding incompatible changes → treat as the oscillation guard: follow the goal contract's reading and flag it.
    • Malformed verdict (no VERDICT line; REVISE with no findings; APPROVE despite BLOCKER/MAJOR findings; APPROVE with a missing or empty VERIFIED line) → do not accept it; save it as round-<n>-verdict[-<lens>]-malformed-<k>.md (k = 1, 2) instead of step 4's path and respawn one fresh critic for that slot in the same round. Twice malformed in one slot → stop and surface to the user.
    • Round max_rounds reached without full approval → stop; go to Wrap-up anyway.

Convergence guards (checked per lens before each new round)

  • Stuck: precisely — you claimed a fix for a finding in round n's submission, and round n's verdict still reports that same defect (it has now appeared in the verdicts of both round n-1 and round n) → stop before starting round n+1 and surface it to the user; a second identical fix attempt is waste.
  • Oscillation: a new critic demands reversing a change a prior verdict demanded → don't ping-pong: follow the goal contract's reading, note the conflict in the next submission, flag it at wrap-up.
  • Rebuttal: never silently ignore a finding you think is wrong — rebut it in the next submission with evidence and let the next critic adjudicate. Once rebutted and re-asserted without new evidence, it goes to the user, not another round.

Anti-gaming rules

  • Never edit <run>/GOAL.md after round 1 to make the goal easier, and never drop a lens mid-run to make approval easier. If either genuinely must change, get the user's confirmation.
  • Never summarize findings more favorably than written — the verdict files are the source of truth.
  • The Verify commands you provide must be the real ones — never point critics at a subset you know passes.

Wrap-up

Report to the user: final verdict and rounds used (per lens, if any); the trajectory of findings per round; unresolved, conflicted, or OUT-OF-LENS-reported findings; and where the <run>/ audit trail lives (keep it — deleting is the user's call). Lead with the outcome.