8000 GitHub - Dominic-DK/critic-loop: Two sealed loops that make LLM review produce evidence instead of opinion. Adversarial discovery until exhaustion, and reference-derived rubrics with a pass line declared up front. · GitHub
[go: up one dir, main page]

Skip to content

About

Two sealed loops that make LLM review produce evidence instead of opinion. Adversarial discovery until exhaustion, and reference-derived rubrics with a pass line declared up front.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

critic-loop

Two tools for evidence-based LLM review: critic-loop finds defects, and reference-bench guides improvements against reference-based criteria.

한국어 · 日本語 · 中文 · English

Overview

Skill Purpose Stop condition
critic-loop Two LLM critics independently review a target over multiple rounds Both critics report no new findings for K consecutive rounds, after a minimum number of rounds
reference-bench Build a scoring rubric from references and improve the target until it passes Scores meet the thresholds set before the run

Both tools fix their criteria before a run begins and use code to check whether those criteria have been met. Review targets can include repositories, designs, documentation, operating models, and agent skills.

Quick start

git clone https://github.com/Dominic-DK/critic-loop.git
cd critic-loop
python3 scripts/setup.py

setup.py checks for the required CLIs, makes the scripts executable, and reports the CLI prerequisites for each tier. It does not download dependencies.

To try a scan of this repository without calling a model:

C=.claude/skills/critic_loop_research/scripts
$C/critic-init.sh .critic/smoke D1,D2 0 0 0 --tiers 1
$C/critic-run.sh  .critic/smoke --target .

For this scan, exit code 1 means findings were detected; 0 means none were found. Results are saved in .critic/smoke/ledger/t1-scan.json.

Open the repository in Claude Code to load both skills from .claude/skills/. To use them in other projects, copy them to your user skills directory:

mkdir -p ~/.claude/skills
cp -r .claude/skills/critic_loop_research ~/.claude/skills/
cp -r .claude/skills/reference-bench ~/.claude/skills/

Skill documentation is in English by default. Run python3 scripts/set_language.py ko to switch to Korean.

Choose a workflow

Task Start with
Review a repository, design, or documentation system critic-init.sh .critic/run D1,D2,D3,D4,D5 40 5 --tiers 1,3,A, then fill dossier/ and run critic-run.sh
Run basic checks without model calls --tiers 1
Evaluate and improve a target against references bench-init.sh .bench/run A1,A2,A3 3 10

Tier 1 has no model cost. Tier 3 uses two frontier models over multiple rounds and can incur substantial usage costs. When an agent runs a review, it should state which tiers it will use before starting.

critic-init.sh cannot initialize the same run directory twice. Use a new directory to change the run criteria. On its first call, bench-log.sh creates an anchor template and exits with code 2; fill in one cited line per axis before running it again.

Example findings

A run against an evidence-ontology project recorded 186 findings over 17 rounds, with zero duplicates. Examples included:

  • A validator relied on a flag written by the generator it was supposed to check.
  • Market evidence for an iOS app came from Android reviews.
  • A naming mismatch (middle back versus middle_back) prevented 61 exercises from matching graph entries.
  • All 300 regression cases used a single random seed, covering one of 7.1 billion possible branches.
  • The audit had produced 252 repairs that had not been merged, leaving the affected rules in use.

These examples span implementation errors, evidence quality, and validation coverage.

Usage

S=.claude/skills/critic_loop_research/scripts

# 1) Fix the axes, minimum rounds, exhaustion rule, and tiers for this run.
#    Use a new directory for each run.
$S/critic-init.sh .critic/myrun D1,D2,D3,D4,D5 40 5 --tiers 1,3,A

# 2) Prepare the dossier so both critics review the same facts.
#    dossier/state.md    — deterministic snapshot. MUST include declared-vs-implemented diff
#    dossier/refs/       — primary sources, read directly
#    dossier/focus.txt   — 12~20 deep-dive targets, rotated one per round
#    dossier/scan/*.py   — optional target-specific deterministic checks

# 3) Run the configured tiers.
$S/critic-run.sh .critic/myrun --target /path/to/target

Progress lives in one file: .critic/myrun/ledger/discovery.md. Stop and resume any time — completed rounds are skipped.

Review tiers

Tier What it catches Share of one real run Cost
1 Deterministic scan Orphan references, duplicate IDs, declared-vs-actual mismatches, empty fields 41% No model
2 Narrow fan-out (optional) Doc-vs-implementation drift, two sources of truth — Lower-cost model, parallel
3 Adversarial loop Trust boundaries, circular arguments, validation scope 20% Two frontier models
A Amplify Additional instances of patterns identified by tier 3 46% matched recurring patterns Lower-cost model, parallel
--tiers 1          # hygiene check, minutes
--tiers 1,2        # single review pass
--tiers 1,3,A      # full audit (default)
--tiers A          # amplify a prior run's patterns against a new target

Tiers run in a fixed order and pass their findings to the next tier to reduce duplicate work. Running tier 1 first lets model-based reviews focus on issues that deterministic checks do not cover.


Background

Tracking new findings

The first version of this loop used consensus as its stop condition. Measured result: from round 2 onward, responses outnumbered new claims (net-new 36→7→9→3→4→4 while responses went 0→43→18→11→4→7). The run was closed by preventing further discovery.

Changing the objective back to discovery, with the same two models on the same target, moved net-new findings from 4 to 12 in a single round.

The aggregator does not use verdict to decide when to stop. The stop condition is both sides producing zero net-new findings for K consecutive rounds, and only after the minimum round count.

Why amplification exists

In that same 186-finding run, 87 findings (46%) were repeats of six patterns, and those 87 were spread across up to 17 rounds.

Pattern Findings Rounds spanned
Mixed units in one slot 22 1–17
Information dropped during build 19 1–16
Claim broader than validation 14 1–15
Filter applied on one path only 14 1–16
Two sources of truth 10 1–16
Depends on the audited party's own report 8 2–16

Of those findings, 68 appeared after the first instance of their pattern. This suggested that a targeted search for related instances could reduce repeated work across rounds.

Amplification uses a lower-cost model to search for additional instances of a pattern already identified by tier 3.

A narrow pattern description can miss related defects. So the amplify prompt is required to answer "what would this description miss?", and those answers are appended to focus.txt as deep-dive targets for the next tier-3 round.

Checking evidence with code

Critics write prose; the aggregator scores with code. critic-ledger.py rejects, by exit code: accept without a citation, reject without a citation, evidence with no file path or URL, duplicate claim IDs, invalid axis/grade/kind.

The critics provide qualitative analysis; code checks the required evidence and record structure.

Parallel model calls also increase the amount of evidence to verify. Validation checks should be in place before expanding parallel review so that additional findings remain practical to assess.

Keeping run criteria fixed

critic-init.sh writes loop.conf and refuses to run again. Minimum rounds, exhaustion rule, axes, and tiers cannot be overridden by environment variable.

In the first run, the stop condition was relaxed to close the loop. Fixing the configuration at initialization prevents that adjustment during a run.

The run follows four rules:

  1. A few low-yield rounds are not exhaustion. Exhaustion requires zero net-new from both sides for K consecutive rounds, after the minimum.
  2. Critics read the target and write only their own ledger. Permissions enforce this boundary.
  3. Everything is logged — withdrawals, rejections, duplicate candidates, discarded rounds. These records help later rounds avoid repeating rejected attempts.
  4. One backend failure discards that round and continues. A watchdog handles stalled calls during unattended runs.

reference-bench

reference-bench turns three or more references into a scoring rubric. Each axis needs a concrete, citable example, such as a sentence, a measurement, a screenshot crop, or a layout dimension. The tool requires an evidence anchor for every axis before accepting scores.

S=.claude/skills/reference-bench/scripts

# Declare the axes and the pass line BEFORE looping. Re-running is refused.
#   bench-init.sh <run-dir> <axes-csv> <min-per-axis> <sum-required>
$S/bench-init.sh .bench/myrun A1,A2,A3 3 10

# Each round: score every axis, and cite evidence for each one.
#   bench-log.sh <run-dir> <round> <axis-worked-on> <scores-csv> [note]
$S/bench-log.sh .bench/myrun R0 - 3,3,4 "baseline"
# → writes anchors/R0.md as a template and stops. Fill one cited line per axis:
#     A1: opening names the decision it serves — R-A "the first line names the decision"
#     A2: every figure cites a source — [measured] 12 of 14 now do
#     A3: no unsupported claim left — refs/notes.md:31
# Then run the same command again. Exit 0 = KEEP, 1 = REVERT, 2 = usage error.

Check CLIs and choose models

The scoring scripts run locally. For external scoring, check Claude and Codex first:

python3 scripts/setup.py                          # installation/version checks only
python3 scripts/setup.py --probe-models            # small headless calls; usage may be charged
python3 scripts/setup.py --probe-models --profile thorough

The diagnostic distinguishes an installed CLI from a model that actually responds. It reports each backend separately and recommends cross-model scoring, a fresh session on the one verified backend, or local-only preparation when neither model is verified.

Profile Claude candidate Codex candidate Intended use
quick haiku gpt-5.6-luna Evidence extraction, small edits
balanced (default) sonnet gpt-5.6-terra Routine scoring and improvement
thorough opus gpt-6-astra Complex judgment and final review

These are project recommendations based on the Codex model guide and Claude model guide, checked on September 7, 2026. They are candidates to test against your account, not a list of verified entitlements.

To override a model or save the result for a run:

S=.claude/skills/reference-bench/scripts
python3 "$S/bench-doctor.py" --probe --codex-model gpt-5.6-sol --output .bench/myrun/runtime.json

Use one verified model for edits and another in a fresh session for independent scoring. Give the scorer the target, rubric, references, and measurements; omit previous scores and edit history. Record the actual model assignments in runtime-selection.md. These choices are applied by the agent; bench-log.sh calculates the gate but does not launch models or restore files.

The probe excludes user/project settings, so custom routing stored only in those settings is not tested. See runtime checks and model selection for status meanings, overrides, fallback behavior, and the recommendation update procedure.

Review rules

  1. Set the pass thresholds before the run. Keep them fixed after scoring begins.
  2. Provide a cited anchor for every axis. Scores without anchors are not accepted.
  3. Use at least three references. Derive criteria by comparing multiple examples.
  4. Define quality independently of exact reproduction. References illustrate the standard; the target can meet it in its own way.
  5. Declare a read-only scope. Specify which parts of the target must remain unchanged.

The tools can be used together: run reference-bench to meet an agreed quality threshold, then critic-loop to look for defects the rubric may not cover.


Requirements

  • claude CLI (tier 2, 3, A)
  • codex CLI (tier 3, one of the two critics) — falls back to claude if unavailable
  • python3, bash
  • Tier 1 requires only python3 and bash; neither model CLI is needed

Models, effort, timeouts, and backends are environment-overridable (CRITIC_GPT_MODEL, CRITIC_OPUS_MODEL, CRITIC_EFFORT, CRITIC_TIMEOUT, CRITIC_FANOUT_CONCURRENCY, …). MIN_ROUNDS, EXHAUST_AFTER, DIMS, and TIERS are sealed and have no override.

License

MIT

About

Two sealed loops that make LLM review produce evidence instead of opinion. Adversarial discovery until exhaustion, and reference-derived rubrics with a pass line declared up front.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0