closer-ratchet
/closer-ratchet
Keep-or-revert loop for visual work that must look like a reference (a scene built in three.js or shaders, a UI recreated from a screenshot, a motion frame, a generated image, a product render). Every round produces one challenger that must beat the current champion in a blind, both-orders pairwise duel judged by fresh critics, and must not get measurably worse; otherwise it is thrown away. Use when the user says "make it match this", "closer to the reference", "keep iterating until it looks like this", "is this round actually better?", or when a long autonomous visual run keeps drifting, flat
- Author
- fangdididi ↗
- Repository
- closer-ratchet ↗
- Licence
- MIT
- Last repository change
- 12.11.2026
Assessment and security
- Files in this package
- 8
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: scripts/ratchet.py
What it does and when to use it
Keep-or-revert loop for visual work that must look like a reference (a scene built in three.js or shaders, a UI recreated from a screenshot, a motion frame, a generated image, a product render). Every round produces one challenger that must beat the current champion in a blind, both-orders pairwise duel judged by fresh critics, and must not get measurably worse; otherwise it is thrown away. Use when the user says "make it match this", "closer to the reference", "keep iterating until it looks like this", "is this round actually better?", or when a long autonomous visual run keeps drifting, flat
Triggers from the description
Original author description
Keep-or-revert loop for visual work that must look like a reference (a scene built in three.js or shaders, a UI recreated from a screenshot, a motion frame, a generated image, a product render). Every round produces one challenger that must beat the current champion in a blind, both-orders pairwise duel judged by fresh critics, and must not get measurably worse; otherwise it is thrown away. Use when the user says "make it match this", "closer to the reference", "keep iterating until it looks like this", "is this round actually better?", or when a long autonomous visual run keeps drifting, flat
How it works
- What this is
- When to use it
- Core ideas
- Files
- Steps
- Example
- Tips
SKILL.md preview
---
name: closer-ratchet
description: Keep-or-revert loop for visual work that must look like a reference (a scene built in three.js or shaders, a UI recreated from a screenshot, a motion frame, a generated image, a product render). Every round produces one challenger that must beat the current champion in a blind, both-orders pairwise duel judged by fresh critics, and must not get measurably worse; otherwise it is thrown away. Use when the user says "make it match this", "closer to the reference", "keep iterating until it looks like this", "is this round actually better?", or when a long autonomous visual run keeps drifting, flattering itself, or going in circles.
---
# Closer Ratchet
[中文版](SKILL.zh-CN.md)
## What this is
When an agent iterates on something visual for hours, three things go wrong:
1. **Self-flattery.** The model that made the change also grades it, and it remembers what it was trying to do, so it sees the intent instead of the pixels. Its absolute scores ("8.7/10, 96% match") creep upward while the work does not.
2. **Silent regressions.** Round 14 fixes the sky and breaks the shadows. Nobody notices until round 20, and by then the good version is gone.
3. **Circling.** Without a clear "better than the best so far" test, the loop keeps trying variations of the same idea.
Closer Ratchet replaces "rate this out of 10" with one narrow question that judges answer far more reliably: **"Which of these two is closer to the reference?"** It asks that question blind, in both left/right orders, to critics who were not part of the build. A challenger only becomes the new champion when it wins in both orders by majority *and* a cheap measured check (luma, saturation, warmth, edge density per region) does not get worse. Everything else is reverted. The work can only click forward, like a ratchet.
## When to use it
- Recreating a reference in code: 3D scenes, shaders, CSS/HTML UI, SVG, canvas, motion stills.
- Steering a generated image or video frame toward a target look over many attempts.
- Any long autonomous visual run where the user will look later and wants every kept step to be a real improvement.
- When the user asks "is this round actually better than the last one?" and you want evidence instead of an opinion.
Do **not** use it for pass/fail requirements ("the logo must be 24 px", "contrast must be at least 4.5:1"). Write those as hard rules and check them directly. The ratchet is for "closer or not", which has no rule.
## Core ideas
| Idea | Why |
|---|---|
| Champion vs challenger, never absolute scores | Relative judgments are easier and steadier than numbers; numbers drift and cluster. |
| Blind sheets | Critics see REFERENCE / LEFT / RIGHT, never file names, round numbers, or the change note. |
| Both orders | Judges favor one slot. A critic's vote only counts if the same image wins in both orders; a flip counts as a tie. |
| Fresh critics | A critic gets the sheet and one question, with no build history. Use a subagent, a different model, or a new session. |
| Measured guard | A cheap numeric check catches the case where critics prefer something that drifted away in color or light. |
| One lever per round | A round changes one region or one dimension, so a loss tells you what failed. |
| Ties keep the champion | Only a confirmed win moves the ratchet. Equal is not better. |
## Files
```
ratchet/
CARD.md the frozen card: reference(s), crop of what matters, hard rules, budget, plateau rule
LEDGER.jsonl one line per round (written by the helper)
sheets/ duel sheets and sealed keys
rounds/rNN/ renders for each round
```
`scripts/ratchet.py` (Python 3.8+, Pillow) does the mechanical parts: `init`, `measure`, `sheet`, `verdict`, `log`, `status`.
## Steps
### 1. Freeze the card (once)
Copy `templates/CARD.md` to `ratchet/CARD.md` and fill it in with the user, or from the request if it already answers everything:
- **Reference(s)** and the exact framing to compare at (camera, crop, viewport size, frame number).
- **What matters most**, ranked: for example "1. light direction and warmth, 2. silhouette of the building, 3. fog density". Critics get this list.
- **Ignore list**: things that must not influence the vote (watermark, placeholder text, different aspect bars).
- **Hard rules** checked separately (performance budget, required elements, forbidden assets).
- **Budget**: rounds or hours, and when to stop and show the human.
- **Plateau rule**: how many rounds without a win before changing approach (default 4) and before stopping (default 8).
- **Critics**: how many (3 or 5, odd), and where they come from.
After the card is frozen, do not edit the ranked list or the ignore list mid-run unless the human says so. Changing the question makes earlier wins meaningless.
### 2. Baseline
Render the current state at the card's framing, measure it, and log it as round 0:
```bash
python scripts/ratchet.py init
python scripts/ratchet.py measure ref.png ratchet/rounds/r00/shot.png > ratchet/rounds/r00/measure.json
python scripts/ratchet.py log 0 --challenger ratchet/rounds/r00/shot.png --verdict BASELINE --measure ratchet/rounds/r00/measure.json
```
Read `worst_cell` and the per-cell deltas. They tell you where the biggest measurable gap is (for example `r1c2` is too dark and too cold).
### 3. Pick one lever
Choose the next change from, in order: the human's latest feedback, the critics' named gaps from the last duel, the worst measured cell. Write one sentence: "Round 5: warm the key light in the upper middle, because critics said the sky reads blue-grey and r1c2 warm delta is -0.12." Change only that.
### 4. Render the challenger
Same framing, same size, same frame number as the champion. If the render path changed (new resolution, different renderer), re-render the champion too, or the duel is not fair.
### 5. Build the blind duel
```bash
python scripts/ratchet.py sheet ref.png CHAMPION.png CHALLENGER.png
```
Argument order matters: the champion is A, the challenger is B. The helper randomizes which side each appears on and writes two sheets (one per order) plus a sealed key. Show critics only the sheets.
### 6. Ask the critics
Give each critic both sheets, one at a time, with this prompt (adjust the ranked list):
> You see three images: REFERENCE, LEFT and RIGHT. Which of LEFT or RIGHT is closer to REFERENCE, judged on, in order: (1) … (2) … (3) …? Ignore: … Answer LEFT, RIGHT or TIE, then name the single biggest remaining difference between your pick and REFERENCE (region and what to change).
Rules: critics never see the key, file names, round numbers, or your change note. Use a new context for each critic. If you can only use one model, still use separate sessions; disagreement between orders is then your main warning sign.
Save votes as JSON:
```json
[{"critic": "c1", "sheet": "duel-3fa2c1-1.png", "pick": "RIGHT"},
{"critic": "c1", "sheet": "duel-3fa2c1-2.png", "pick": "LEFT"}]
```
### 7. Unseal and decide
```bash
python scripts/ratchet.py verdict ratchet/sheets/duel-3fa2c1.key.json votes.json
python scripts/ratchet.py measure ref.png CHALLENGER.png > ratchet/rounds/r05/measure.json
python scripts/ratchet.py log 5 --challenger CHALLENGER.png --verdict WIN --measure ratchet/rounds/r05/measure.json --note "warmer key light"
```
- **WIN** (most critics chose the challenger in both orders) and the measured gap did not get worse beyond the tolerance (default 10%): the challenger becomes champion. Commit it.
- **WIN but measured worse**: the helper logs it as TIE and keeps the champion. Look at which cell got worse; the critics may be rewarding a side effect.
- **LOSS or TIE**: revert the code to the champion's commit. Keep the critics' named gaps; they are the input for the next lever.
- **VOID**: the duel was unfair (wrong framing, a critic saw the key). Log it and redo.
Also read `order_flip_rate`. Above 0.5 means critics can't really tell the two apart, so the change was too small to matter, or the ranked list is unclear.
### 8. Check the plateau
```bash
python scripts/ratchet.py status --plateau 4
```
- `PLATEAU`: stop polishing the same thing. Switch to a different region or dimension, try a bolder change, or save a pair of stills for the human.
- `STOP`: ship the champion with the ledger, or ask the human to change the card.
### 9. Report
When you stop, show: the reference, the baseline, and the champion side by side; the number of rounds, wins, and the rounds where the champion changed; the remaining top gaps from the last critics; and what you did not check. Never quote an absolute "% match" unless you measured it and say how.
## Example
Request: "Recreate this sunset street photo as a three.js scene and keep going until it looks like it."
- Card ranks: 1) low warm sun from the left, 2) long shadows across the road, 3) haze on the far buildings. Ignore: cars, signage text. 3 critics, plateau 4, stop at 8 or 30 rounds.
- r00 baseline: worst cell `r1c1` (sky), warm -0.18, luma +0.09.
- r01 lowers the sun and warms the sky. Votes: c1 B/B, c2 B/B, c3 B/A. Verdict WIN, gap 0.81 to 0.52. Champion moves.
- r02 adds fog. c1 A/A, c2 B/A, c3 A/A. LOSS. Reverted. Critic note: "far buildings vanished entirely".
- r03 lighter fog, only past 200 m. WIN.
- r04 to r07: four non-wins on shadow tweaks → PLATEAU. Switch lever to the road material; r08 wins.
## Tips
- Compare at small size too. A sheet scaled to thumbnail size shows composition and value structure; full size shows detail. If they disagree, trust the ranked list's order.
- Keep every champion's commit hash in the ledger note so you can return to any step.
- When the human gives an opinion, it outranks critics. Log it as a round note and make it the next lever.
- If critics keep naming the same gap that your change already addressed, the change probably did not render the way you think. Look at the actual pixels.
- The measured guard is crude on purpose. It catches drift in light and color; it does not judge shape or taste. Never let it decide a WIN alone.
- For video, duel matched stills (same frame numbers) and, separately, short matched clips. Don't mix the two in one duel.
Files in this package (8)
- LICENSE 1 KB
- README.md 4 KB
- README.zh-CN.md 4 KB
- SKILL.md 10 KB
- SKILL.zh-CN.md 10 KB
- scripts/ratchet.py 10 KB
- templates/CARD.md 1 KB
- templates/CARD.zh-CN.md 1 KB
Versions
The database has no other skills named closer-ratchet.
Database snapshot: 13.11.2026 · package version 07e562dc184a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 90cook
Runs the Cook Loop for ambitious visual builds that must match reference images, screens or videos through long autonomous iteration. Use it for 3D worlds made in code (three.js, WebGL, shaders), code-rendered films, launch and motion videos, games and polished UI that must hold…