- Home
- Skills
- Agents & Orchestration
- ratchet loop
More screenshots
Works with the AI Agents you already use
ratchet loop
Iterative optimization loop with frozen evaluators and independent research verification for code, prompts, and data.
$12
ratchet loop
Example session with this skill installed
I need to make the calculate_metrics function in analytics.py faster. I have a bench.py script that prints execution time in milliseconds. Setup a session and try one optimization.
- Read your context and instructions
- Compiled the ratchet loop
The optimization session has been initialized and the first attempt has been processed. The baseline was measured at 142.5ms, and the first attempt (caching) successfully reduced this to 98.2ms.
Optimization Log
| Attempt | Kind | Idea | Result | Score | Delta |
|---|---|---|---|---|---|
| 0 | baseline | Original code | init | 142.50 | 0.0% |
| 1 | explorer | Add memoization to expensive math lookups | keep | 98.20 | -31.1% |
Performance Analysis
# Champion: analytics.py (Generation 1)
# Improvement: 31.1% reduction in latency
# Evaluator: python3 bench.py (confirmed over 2 runs)
import functools
@functools.lru_cache(maxsize=1024)
def _expensive_lookup(val):
# Logic moved to cached helper to avoid redundant computation
return (val ** 2.5) / 1.7
Next steps
- Run
python3 ratchet.py statusto check if the next attempt should be an explorer or a tweak. - Propose a second optimization idea, such as vectorizing the loop with NumPy if available.
- When satisfied, run
python3 ratchet.py cleanto merge the champion and generate the final report.
Connects securely to your tools. The creator never sees your data.
About this skill
Optimization tasks often fail because agents "hallucinate" progress, game the scoring system, or overfit to specific data. This skill enforces a strict, iterative workflow where improvements only stick if they pass a frozen, independent evaluator. It provides a deterministic "ratchet" mechanism that prevents regressions and ensures every gain is verified against a noise-aware margin.
What it does
- Iterative optimization cycles through one-idea-at-a-kind attempts to improve code speed, binary size, prompt accuracy, or cost.
- Frozen evaluation executes targets in a clean, isolated workspace copy using an evaluator script the agent cannot modify mid-session.
- Noise-aware validation measures baseline variance and requires winners to exceed a statistical margin and pass a second "confirm" run.
- Holdout protection guards against overfitting by testing winners against a separate dataset or rubric hidden from the optimization loop.
- Research verification fact-checks claims using a multi-agent ledger system where a different model must independently reproduce every finding.
How it works
- Define the objective by selecting the target files and writing an evaluator script that outputs a numerical score or pass rate.
- Initialize the session with
ratchet.py init, which benchmarks the baseline, measures noise, and sets the acceptance margin. - Execute attempts using
ratchet.py try, where the agent implements a specific idea and the script automatically keeps or reverts the change. - Finalize the result with
ratchet.py cleanto produce a full RATCHET_REPORT.md detailing the baseline vs. champion delta and the log of attempts.
Frameworks & tools
This skill runs on Python 3.8+ and operates directly on the workspace filesystem. It supports any language or toolchain (Node.js, Rust, SQL, LLM APIs) that can be invoked via a shell command for scoring.
Why this beats prompting it yourself
Standard prompts often produce "refined" versions that actually break edge cases or only seem better due to randomness. This skill replaces trust with a deterministic gate, ensuring that the only way to win is to actually improve the metrics on a clean run.
Use cases
- Latency reduction for Python or C++ bottlenecks.
- Prompt engineering to maximize accuracy against a labelled validation set.
- Bundle size shrinking for frontend assets using minification and tree-shaking.
- Fact-dense reporting where every claim must be verified by a secondary model.
Known limitations
The system requires a working evaluator script that the unmodified workspace must pass. It is not designed for one-off edits and works best with tasks that have a clear, measurable number.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.
Requires Python 3.8+. Baseline must pass evaluator before starting. Deterministic only; cannot bypass model usage limits or access paywalled research sources. Windows users should prefer WSL.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 9 days ago