contrastive-refinement

contrastive-refinement is a skill for Claude Code, Codex from moonlight-lupin/agent-skills. It costs 34 tokens per session (3,640 once invoked), scanned A, original, MIT.

A method for improving an agent skill by trying different versions on the same task and comparing the results. It records lessons together with evidence from those comparisons.

In plain words
What is it for?
Use it to refine an existing skill or harness when you have candidate edits, a real failed task, or a claimed improvement that needs testing.
Why use it?
It replaces guesses about whether an edit helps with a repeatable comparison. It also prevents unsupported lessons from being added to skill definitions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to refine an existing skill or harness when you have candidate edits, a real failed task, or a claimed improvement that needs testing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/moonlight-lupin/agent-skills/contrastive-refinement
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add moonlight-lupin/agent-skills --skill contrastive-refinement
Clone the repo
git clone --depth 1 https://github.com/moonlight-lupin/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for contrastive-refinement

README.md
[![agentmods](https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/contrastive-refinement/github.svg)](https://agentmods.dev/skills/moonlight-lupin/agent-skills/contrastive-refinement)
Your own site
<a href="https://agentmods.dev/skills/moonlight-lupin/agent-skills/contrastive-refinement"><img src="https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/contrastive-refinement/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for contrastive-refinement

Your own site · 80×15
<a href="https://agentmods.dev/skills/moonlight-lupin/agent-skills/contrastive-refinement"><img src="https://agentmods.dev/badge/skills/moonlight-lupin/agent-skills/contrastive-refinement.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,640 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.03640
Opus 5.5 $0.00014 $0.01456
Sonnet 5.5 $0.00007 $0.00728
Haiku 4.5 $0.00003 $0.00364

Measured 1mo ago against content hash ead9d02dd29d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

contrastive-refinement scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/contrast.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/skill-governance/skills/contrastive-refinement/SKILL.md · 271 lines

How it starts

The opening of the file, as written. The whole thing — 271 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Contrastive Skill Refinement

Refine a skill or harness edit with measured behavior, not judgment alone. Before an edit lands, run candidate versions of the skill on the SAME probe task, compare deliverables blind, and compose the surviving edit. Every recorded lesson carries an evidence line naming the observed contrast. This skill only changes skill definitions; for application code changes use build-review-loop.

Pattern source: Harness² (google-research/harness2, Apache-2.0, arXiv:2610.14224) — the Propose–Probe–Compose loop and the evidence-required lesson format, ported to Hermes skill dirs. See references/harness2-adaptation.md for what was ported and what was not.

When to Use

  • An edit to a skill promises better output but nobody has measured it
  • Two candidate edits both look right and you must pick one
  • A skill failed a real task and you want a proven fix, not a guess
  • A lesson about a skill needs to be written down and should carry evidence

Don't use for: typo and frontmatter fixes (no behavior change), live code repos (build-review-loop), first drafts of brand-new skills (nothing to contrast yet).

Fire backlog: an unanswered advisory re-fires every session until its fire row is closed. The contrastive-advisor plugin (v0.2.0+) self-installs a clearance cron (contrastive-advisor fire clearance) that closes backlog fires by classification (see its docs/README.md). Running this skill WITHOUT the plugin: either create an equivalent sweeper cron yourself with the same classification rules, or close each fire in the editing session — a documented classification with real-execution evidence is a legitimate close; never leave the demand unanswered.

When the contrastive-advisor fires but the edit fits 'Don't use for': respond with a documented classification, not a probe cycle. Create the per-skill probe dir (~/.hermes/skill-probes/<skill>/<tag>/) with a probe.md stating WHAT was edited and WHY the edit makes no behavioral claim (diff scope: quoted lines preserved verbatim, only a pointer/label/metadata changed), plus a selection.md recording the decision and the commitment rule: any FUTURE behavioral edit to this skill runs the full cycle. Never fabricate probe evidence; never leave the advisor's demand unanswered — an undocumented gap re-fires every session, and inventing a cycle result poisons the evidence root. This also covers consolidation edits (a no-loss pointer repoint with 0 rule-title deltas): the no-loss check IS the evidence line.

Read the full file on GitHub · 271 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 271 lines · 34 tokens per session scan A ead9d02dd29d

Subscribe to this mod's changes

contrastive-refinement is a skill published in the GitHub repository moonlight-lupin/agent-skills (136 stars, last pushed 2d ago), licensed MIT. It adds 34 tokens to every session and 3,640 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-28.

Related

contrastive-refinement compared with skills from other repositories

contrastive-refinement next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
contrastive-refinementmoonlight-lupin/agent-skillsSkill1362d agoMITA34Claude Code, Codex
product-description-generatornexscope-ai/eCommerce-SkillsSkill1.6k20d agoMITA126Claude Code, Codex
tiktok-shop-cross-bordernexscope-ai/eCommerce-SkillsSkill1.6k20d agoMITA55Claude Code, Codex
supply-chain-optimization-tiktoknexscope-ai/eCommerce-SkillsSkill1.6k20d agoMITA57Claude Code, Codex
ecommerce-landing-pagenexscope-ai/eCommerce-SkillsSkill1.6k20d agoMITA45Claude Code, Codex
product-title-optimizationnexscope-ai/eCommerce-SkillsSkill1.6k20d agoMITA44Claude Code, Codex
walmart-listing-optimizationnexscope-ai/eCommerce-SkillsSkill1.6k20d agoMITA35Claude Code, Codex