[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78AN4CBX4JJDGY3ZKDXDC7S":3,"skill-same:01M78AN4CBX4JJDGY3ZKDXDC7S":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":42,"ownerHtmlUrl":43,"ownerBlogUrl":6,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M78AN4CBX4JJDGY3ZKDXDC7S","contrastive-refinement",null,"Use when a skill or harness edit needs evidence before it lands — probe candidates on the same task, compose from contrasts, keep lessons with evidence.","moonlight-lupin\u002Fagent-skills","moonlight-lupin","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F136997773?v=4","01M78AEDSH1N62R0RNWPWMWVQY","01M78AEDT8ZF85MTK6XYBQBTNT",123,"MIT","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fskill-governance\u002Fskills\u002Fcontrastive-refinement\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: contrastive-refinement\ndescription: \"Use when a skill or harness edit needs evidence before it lands — probe candidates on the same task, compose from contrasts, keep lessons with evidence.\"\nlicense: MIT\nmetadata:\n  version: 0.2.0\n  author: moonlight-lupin\n  platforms: [linux, macos, windows]\n  tags: [agent-ops, skill-improvement, evidence, refinement]\n  related_skills: [repo-adoption-review, build-review-loop]\n---\n\n# Contrastive Skill Refinement\n\nRefine a skill or harness edit with measured behavior, not judgment alone.\nBefore an edit lands, run candidate versions of the skill on the SAME probe\ntask, compare deliverables blind, and compose the surviving edit. Every\nrecorded lesson carries an evidence line naming the observed contrast. This\nskill only changes skill definitions; for application code changes use\n`build-review-loop`.\n\nPattern source: Harness² (google-research\u002Fharness2, Apache-2.0,\narXiv:2610.14224) — the Propose–Probe–Compose loop and the evidence-required\nlesson format, ported to Hermes skill dirs. See\n`references\u002Fharness2-adaptation.md` for what was ported and what was not.\n\n## When to Use\n\n- An edit to a skill promises better output but nobody has measured it\n- Two candidate edits both look right and you must pick one\n- A skill failed a real task and you want a proven fix, not a guess\n- A lesson about a skill needs to be written down and should carry evidence\n\n**Don't use for:** typo and frontmatter fixes (no behavior change), live code\nrepos (`build-review-loop`), first drafts of brand-new skills (nothing to\ncontrast yet).\n\n**Fire backlog:** an unanswered advisory re-fires every session until its\nfire row is closed. The contrastive-advisor plugin (v0.2.0+) self-installs a\nclearance cron (`contrastive-advisor fire clearance`) that closes backlog\nfires by classification (see its docs\u002FREADME.md). Running this skill\nWITHOUT the plugin: either create an equivalent sweeper cron yourself with\nthe same classification rules, or close each fire in the editing session —\na documented classification with real-execution evidence is a legitimate\nclose; never leave the demand unanswered.\n\n**When the contrastive-advisor fires but the edit fits 'Don't use for':**\nrespond with a documented classification, not a probe cycle. Create the\nper-skill probe dir (`~\u002F.hermes\u002Fskill-probes\u002F\u003Cskill>\u002F\u003Ctag>\u002F`) with a\n`probe.md` stating WHAT was edited and WHY the edit makes no behavioral\nclaim (diff scope: quoted lines preserved verbatim, only a pointer\u002Flabel\u002Fmetadata\nchanged), plus a `selection.md` recording the decision and the commitment\nrule: any FUTURE behavioral edit to this skill runs the full cycle. Never\nfabricate probe evidence; never leave the advisor's demand unanswered — an\nundocumented gap re-fires every session, and inventing a cycle result poisons\nthe evidence root. This also covers consolidation edits (a no-loss pointer\nrepoint with 0 rule-title deltas): the no-loss check IS the evidence line.\n\n**Reconstruct the actual edit before classifying — do not classify from\nmemory.** Pull the edit from the session store: query `state.db` `messages`\n(`tool_calls` column) for the fire's `session_id`, parse each call's\n`function.arguments` (a doubly-encoded JSON string), and extract the\n`skill_manage`\u002F`patch`\u002F`write_file` operations naming the skill. Behavioral\nclaims backed by live execution in the editing session (a procedure that was\nrun end-to-end against the real target) satisfy the evidence gate without a\nsynthetic cycle.\n\nThree legitimate classifications beyond the mechanical one:\n- **Unresolved provenance** — the file changed but no logged tool row or\n  backup carries the delta (parallel sessions and file writes outside the\n  tool-call store). Document the gap, describe the current content class,\n  and treat the skill's next edit as gate-bearing. Never guess the edit's\n  purpose.\n- **Orphan fire** — the fired skill name has no SKILL.md in the tree (or a\n  frontmatter-only sweep confirms absence). Close as orphan; do not classify\n  an edit to a nonexistent artifact.\n- **Real-environment execution evidence** — a behavioral edit whose procedure\n  was already exercised against the live target in the editing session. State\n  the reopen condition in the selection doc.\n\nClose the bookkeeping too: set `answered_at` (+`answered_with` pointer) on\nthe fire's rows in `~\u002F.hermes\u002Fskill-probes\u002Ffire-ledger.jsonl`, and clear\nthe advisor's pending record in its plugin-data `state.json` when the fire\nbelongs to another session.\n\n## Concepts\n\n- **Probe task** — one fixed, realistic task for the target skill, with inputs\n  on disk. The judge is deliverable comparison, not a rubric score.\n- **Baseline** — the current skill, run once on the probe task.\n- **Candidate** — one proposed edit (INV or DOM), applied to a COPY of the\n  skill, never to the live skill. The standard cycle uses two candidates:\n  one INV, one DOM. A second pair of candidates is an extension, not default.\n- **INV edit** — skill-agnostic lever: a checklist, a script gate, an output\n  contract, a guardrail.\n- **DOM edit** — domain-specific content: a rule, an example, a parameter\n  tuned to the skill's actual subject matter.\n- **Composition** — one final edit merged from the contrasts that survived\n  blind comparison. Additive: it changes only what the evidence showed.\n\n## Procedure\n\n1. **Choose the probe task.**\n   Pick one realistic task for the target skill. Write inputs to a probe\n   directory. The task must be judgeable by comparing the deliverable text.\n   Completion: probe inputs exist on disk and will not change during the cycle.\n   - Anti-contamination: describe the work in the probe prompt. Never\n     mention that it is a test, a probe, a benchmark, or an evaluation —\n     measurement language changes agent behavior.\n\n2. **Run the baseline.**\n   Execute the current skill on the probe task once. Save the deliverable and\n   the trajectory in the probe directory. Completion: baseline deliverable\n   exists.\n\n3. **Propose candidates.**\n   Write the candidate edits: one INV (a skill-agnostic lever: checklist,\n   script gate, output contract, guardrail) and one DOM (a domain-specific\n   rule, example, or parameter). Write more pairs only when a strong reason\n   exists. Each candidate is a concrete patch to the target skill, written\n   out in full. State the expected behavioral difference for each.\n   Completion: every candidate has a written patch and a written expectation.\n\n4. **Probe.**\n   For each candidate, apply the patch to a COPY of the skill in a scratch\n   directory and run the probe task with that copy. Run the candidates in\n   parallel. Same model, same tools, same inputs — the only changing variable\n   is the edit. Completion: one deliverable per candidate plus the baseline,\n   all from identical probe inputs.\n\n5. **Blind selection.**\n   Run `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py ids` — `\u003Cskill_dir>` is this skill's\n   own directory (the path `skill_view` reports) — to assign anonymous ids to baseline plus\n   every candidate deliverable. Read the deliverables blind, write one\n   `\u003Cwhy>` line per deliverable, then unmask. Completion: a choice with a\n   written reason naming the observed contrast — or no choice.\n   - Fallback rule: if no contrast is visible, keep the baseline. One retry\n     of a failed candidate is the ceiling; after that, keep the base.\n   - Inconclusive probes kill the edit. Do not compose from vibes.\n\n6. **Compose, probe the composition, then apply.**\n   Merge only the contrasts that won blind into one final patch. Probe the\n   composition once: apply it to a FRESH copy of the baseline (not a copy\n   that already holds a candidate patch — that would apply an edit twice)\n   and run the probe task one more time. A merge of two individually winning\n   changes can still behave badly together. Compare the composition's\n   deliverable against the baseline through the same blind procedure (new\n   `ids` round, fresh `\u003Cwhy>` lines) before it lands: the composition must\n   deliver and beat the baseline. Then apply via\n   `skill_manage(action=\"patch\", ...)` to the live skill: `name` is the\n   target skill, `old_text` and `new_text` carry the composed edit. The edit\n   is additive and minimal. If the composition probe loses, keep the\n   baseline and discard the edit.\n   Completion: patched skill, or a recorded decision to keep the base.\n\n7. **Record the lesson with evidence.**\n   Format (all four fields, or no entry):\n   ```\n   cue: When \u003Csituation>\n   lesson: \u003Cthe rule>\n   evidence: \u003Cthe observed contrast from the probe run>\n   confidence: \u003Cscope of validity>\n   ```\n   Field values are single-line. `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py lesson-check` enforces\n   the gate: exit 0 required, and a value that is only a placeholder — `n\u002Fa`,\n   `-`, `none`, `todo`, with or without markdown wraps (`**n\u002Fa**`, `N\u002FA.`) —\n   or one bare `\u003Ctemplate>` tag counts as empty; evidence that assembles tag\n   spans stays valid; a repeated field takes the last\n   value. The gate is syntactic: it cannot judge the quality of an evidence\n   sentence, that judgment belongs to Steps 4–6. Send the lesson to the\n   target skill's lessons section or memory as fits. Completion: lesson\n   saved, evidence line names a real observation.\n\n## Post-Ship Monitoring (advisory artifacts)\n\nWhen the composed edit lands as a DEPLOYED artifact — an advisory plugin, a\nharness hook — the proof burden shifts from \"the edit won the probe\" to \"the\nartifact actually fires in the live host\". Registry rows ('enabled',\ncorrect version) and a clean load log prove DISCOVERY, not binding; many\nhooks log nothing on success, so silence is not evidence. Verify with:\n\n1. **One real end-to-end fire.** Perform one genuine behavioral edit the\n   artifact exists to catch, and check ALL of: the artifact's durable state\n   appears on the first pending write (e.g. its plugin-data state file), the\n   host logs carry no contract-rejection or load-failure lines after the\n   restart marker, and the artifact's output surfaces where the host injects\n   it. Never conclude from log absence alone.\n2. **Know the injection point.** `pre_llm_call` context is injected into the\n   user message that STARTS a turn: an advisory queued mid-turn by a tool\n   call surfaces at the start of the NEXT user-initiated turn, never in the\n   same turn as the triggering edit. Plan observation windows accordingly.\n3. **Effectiveness, not just firing.** The outcome signal is probe cycles\n   appearing under the evidence root within the review window after fires —\n   a cycle needs BOTH its planning and selection files present. Count\n   fires and false-positives from a DURABLE LEDGER THE ARTIFACT WRITES\n   ITSELF at delivery time (one row per injected advisory, plus auto-close\n   when the answering cycle lands) — not from chat logs: an in-band\n   injection leaves no host log line, the pending record expires after its\n   TTL, compaction prunes the conversation, and a hand-maintained ledger\n   cannot recover past fires (pre-ledger fires can only be mined from the\n   session store's `messages` table — see log-analyzer). If the deployed\n   artifact lacks self-recording, add it before judging the trial. If host\n   logs do not record tool arguments, the detection-rate denominator is\n   unobservable — label the rate UNVERIFIED rather than computing it from\n   fire counts alone.\n4. **Decision at the review date** (two weeks is the default): keep,\n   tune (TTL, thresholds, marker lists, exclusions), or disable. Catalog or\n   manifest publication waits until after that decision.\n\n## Pitfalls\n\n- **Same-model control is the whole validity claim.** If a probe runs a\n  different model or tools than the baseline, the contrast measures the\n  model, not the edit.\n- **Blinding breaks silently.** File names, paths, or self-reports often\n  reveal the candidate identity. Use the anonymized ids output only.\n  In-context selection: have every probe arm return the DELIVERABLE only\n  (no process notes in the report body — notes leak identity and pad the\n  comparison), save deliverables to files, re-read them by anon id, and\n  write the `\u003Cwhy>` lines from the files. When the arms already reported\n  with identities visible in the conversation, the honest compromise is\n  the file re-read — record it in the selection doc; do not claim the\n  comparison was blind when it was not.\n- **The cost shape is near-fixed.** A standard cycle is one baseline run\n  + two candidate runs + one composition-probe run (about 4 model runs),\n  then the selection round, which is your own read of the deliverables, not\n  a rollout. A candidate retry (Step 5 ceiling) can add one run. The `--k`\n  and `--mode` flags in `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py ids` are\n  shuffle-seed tags only; they do not change the run count. Budget the probe\n  task to be small enough for that.\n- **A winning contrast may be probe-specific.** Confidence says the scope.\n  Generalize only when the contrast is structural, not cosmetic.\n  Deliverable-quality contrasts (malformed output, missing\n   sections, wrong art) are strong from a single run — output damage is not\n   variance. Efficiency contrasts (call counts, duration) are the WEAKEST class:\n   one run cannot separate the edit's effect from run-to-run model variance —\n   rerun for the same direction before applying an efficiency-only edit, and say\n   so in the lesson's confidence line.\n- **Compose at most one new rule per tool section.** Two winning candidates\n  that touch the same tool section can interact: a merged process rule next to\n  an existing fallback can push the composed run toward hand-computing an\n  output instead of reproducing a known figure — both parts won alone, the\n  merge lost its own gate. Keep the baseline when that happens; the fallback\n  rule exists for exactly this.\n- **Apply the composed edit with anchors taken from a FRESH read of the live skill, never from the probe copies.** Copies drift from live (local rewordings, different frontmatter layout), and an `old_string` reused from a probe copy or from the composed deliverable text fails to match or matches the wrong region. Compose the edit as an abstract change, then re-derive the anchor from the most recent skill_view of the live file immediately before the skill_manage call.\n- **Pick the pilot target from usage data.** Read `.usage.json` at the skills root and choose the lowest `use_count` skill that still earns improvement; never pilot a cycle on a load-bearing skill (money, user content, repo operations) without the user's go. The fallback rule protects against loss, but the cycle still rewrites files. If the target has an upstream-provenance row in `UPSTREAM_MANIFEST.md`, a local refinement is drift by definition — record `✅ keep-ours (...)` on that manifest row or carry the fix upstream, never leave the row untouched.\n- **The live session's skill loader is cached.** A newly installed skill is\n  visible to the next session, not this one — test through file paths here.\n\n## Quick Reference\n\n`\u003Cskill_dir>` is this skill's own directory — the path `skill_view` reports\nfor this skill. Run the script from anywhere:\n\n```bash\n# Anonymous ids for blind selection (deterministic per task\u002Fk\u002Fmode seed)\npython3 \u003Cskill_dir>\u002Fscripts\u002Fcontrast.py ids --labels base,inv1,dom1 --task probe-1 --k 1\n\n# Evidence gate for lessons (reads stdin, exit 0 = valid)\npython3 \u003Cskill_dir>\u002Fscripts\u002Fcontrast.py lesson-check \u003C lesson.md\n```\n\n## Verification\n\n- Probe cycle directory holds: probe inputs, baseline deliverable, one\n  deliverable per candidate, the anonymized mapping, the `\u003Cwhy>` lines.\n- The chosen edit has a written contrast evidence line.\n- `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py lesson-check` passes on the recorded lesson.\n- The live skill shows only the composed additive edit (diff the target\n  skill before and after).\n","# Contrastive Skill Refinement\n\nRefine a skill or harness edit with measured behavior, not judgment alone.\nBefore an edit lands, run candidate versions of the skill on the SAME probe\ntask, compare deliverables blind, and compose the surviving edit. Every\nrecorded lesson carries an evidence line naming the observed contrast. This\nskill only changes skill definitions; for application code changes use\n`build-review-loop`.\n\nPattern source: Harness² (google-research\u002Fharness2, Apache-2.0,\narXiv:2610.14224) — the Propose–Probe–Compose loop and the evidence-required\nlesson format, ported to Hermes skill dirs. See\n`references\u002Fharness2-adaptation.md` for what was ported and what was not.\n\n## When to Use\n\n- An edit to a skill promises better output but nobody has measured it\n- Two candidate edits both look right and you must pick one\n- A skill failed a real task and you want a proven fix, not a guess\n- A lesson about a skill needs to be written down and should carry evidence\n\n**Don't use for:** typo and frontmatter fixes (no behavior change), live code\nrepos (`build-review-loop`), first drafts of brand-new skills (nothing to\ncontrast yet).\n\n**Fire backlog:** an unanswered advisory re-fires every session until its\nfire row is closed. The contrastive-advisor plugin (v0.2.0+) self-installs a\nclearance cron (`contrastive-advisor fire clearance`) that closes backlog\nfires by classification (see its docs\u002FREADME.md). Running this skill\nWITHOUT the plugin: either create an equivalent sweeper cron yourself with\nthe same classification rules, or close each fire in the editing session —\na documented classification with real-execution evidence is a legitimate\nclose; never leave the demand unanswered.\n\n**When the contrastive-advisor fires but the edit fits 'Don't use for':**\nrespond with a documented classification, not a probe cycle. Create the\nper-skill probe dir (`~\u002F.hermes\u002Fskill-probes\u002F\u003Cskill>\u002F\u003Ctag>\u002F`) with a\n`probe.md` stating WHAT was edited and WHY the edit makes no behavioral\nclaim (diff scope: quoted lines preserved verbatim, only a pointer\u002Flabel\u002Fmetadata\nchanged), plus a `selection.md` recording the decision and the commitment\nrule: any FUTURE behavioral edit to this skill runs the full cycle. Never\nfabricate probe evidence; never leave the advisor's demand unanswered — an\nundocumented gap re-fires every session, and inventing a cycle result poisons\nthe evidence root. This also covers consolidation edits (a no-loss pointer\nrepoint with 0 rule-title deltas): the no-loss check IS the evidence line.\n\n**Reconstruct the actual edit before classifying — do not classify from\nmemory.** Pull the edit from the session store: query `state.db` `messages`\n(`tool_calls` column) for the fire's `session_id`, parse each call's\n`function.arguments` (a doubly-encoded JSON string), and extract the\n`skill_manage`\u002F`patch`\u002F`write_file` operations naming the skill. Behavioral\nclaims backed by live execution in the editing session (a procedure that was\nrun end-to-end against the real target) satisfy the evidence gate without a\nsynthetic cycle.\n\nThree legitimate classifications beyond the mechanical one:\n- **Unresolved provenance** — the file changed but no logged tool row or\n  backup carries the delta (parallel sessions and file writes outside the\n  tool-call store). Document the gap, describe the current content class,\n  and treat the skill's next edit as gate-bearing. Never guess the edit's\n  purpose.\n- **Orphan fire** — the fired skill name has no SKILL.md in the tree (or a\n  frontmatter-only sweep confirms absence). Close as orphan; do not classify\n  an edit to a nonexistent artifact.\n- **Real-environment execution evidence** — a behavioral edit whose procedure\n  was already exercised against the live target in the editing session. State\n  the reopen condition in the selection doc.\n\nClose the bookkeeping too: set `answered_at` (+`answered_with` pointer) on\nthe fire's rows in `~\u002F.hermes\u002Fskill-probes\u002Ffire-ledger.jsonl`, and clear\nthe advisor's pending record in its plugin-data `state.json` when the fire\nbelongs to another session.\n\n## Concepts\n\n- **Probe task** — one fixed, realistic task for the target skill, with inputs\n  on disk. The judge is deliverable comparison, not a rubric score.\n- **Baseline** — the current skill, run once on the probe task.\n- **Candidate** — one proposed edit (INV or DOM), applied to a COPY of the\n  skill, never to the live skill. The standard cycle uses two candidates:\n  one INV, one DOM. A second pair of candidates is an extension, not default.\n- **INV edit** — skill-agnostic lever: a checklist, a script gate, an output\n  contract, a guardrail.\n- **DOM edit** — domain-specific content: a rule, an example, a parameter\n  tuned to the skill's actual subject matter.\n- **Composition** — one final edit merged from the contrasts that survived\n  blind comparison. Additive: it changes only what the evidence showed.\n\n## Procedure\n\n1. **Choose the probe task.**\n   Pick one realistic task for the target skill. Write inputs to a probe\n   directory. The task must be judgeable by comparing the deliverable text.\n   Completion: probe inputs exist on disk and will not change during the cycle.\n   - Anti-contamination: describe the work in the probe prompt. Never\n     mention that it is a test, a probe, a benchmark, or an evaluation —\n     measurement language changes agent behavior.\n\n2. **Run the baseline.**\n   Execute the current skill on the probe task once. Save the deliverable and\n   the trajectory in the probe directory. Completion: baseline deliverable\n   exists.\n\n3. **Propose candidates.**\n   Write the candidate edits: one INV (a skill-agnostic lever: checklist,\n   script gate, output contract, guardrail) and one DOM (a domain-specific\n   rule, example, or parameter). Write more pairs only when a strong reason\n   exists. Each candidate is a concrete patch to the target skill, written\n   out in full. State the expected behavioral difference for each.\n   Completion: every candidate has a written patch and a written expectation.\n\n4. **Probe.**\n   For each candidate, apply the patch to a COPY of the skill in a scratch\n   directory and run the probe task with that copy. Run the candidates in\n   parallel. Same model, same tools, same inputs — the only changing variable\n   is the edit. Completion: one deliverable per candidate plus the baseline,\n   all from identical probe inputs.\n\n5. **Blind selection.**\n   Run `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py ids` — `\u003Cskill_dir>` is this skill's\n   own directory (the path `skill_view` reports) — to assign anonymous ids to baseline plus\n   every candidate deliverable. Read the deliverables blind, write one\n   `\u003Cwhy>` line per deliverable, then unmask. Completion: a choice with a\n   written reason naming the observed contrast — or no choice.\n   - Fallback rule: if no contrast is visible, keep the baseline. One retry\n     of a failed candidate is the ceiling; after that, keep the base.\n   - Inconclusive probes kill the edit. Do not compose from vibes.\n\n6. **Compose, probe the composition, then apply.**\n   Merge only the contrasts that won blind into one final patch. Probe the\n   composition once: apply it to a FRESH copy of the baseline (not a copy\n   that already holds a candidate patch — that would apply an edit twice)\n   and run the probe task one more time. A merge of two individually winning\n   changes can still behave badly together. Compare the composition's\n   deliverable against the baseline through the same blind procedure (new\n   `ids` round, fresh `\u003Cwhy>` lines) before it lands: the composition must\n   deliver and beat the baseline. Then apply via\n   `skill_manage(action=\"patch\", ...)` to the live skill: `name` is the\n   target skill, `old_text` and `new_text` carry the composed edit. The edit\n   is additive and minimal. If the composition probe loses, keep the\n   baseline and discard the edit.\n   Completion: patched skill, or a recorded decision to keep the base.\n\n7. **Record the lesson with evidence.**\n   Format (all four fields, or no entry):\n   ```\n   cue: When \u003Csituation>\n   lesson: \u003Cthe rule>\n   evidence: \u003Cthe observed contrast from the probe run>\n   confidence: \u003Cscope of validity>\n   ```\n   Field values are single-line. `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py lesson-check` enforces\n   the gate: exit 0 required, and a value that is only a placeholder — `n\u002Fa`,\n   `-`, `none`, `todo`, with or without markdown wraps (`**n\u002Fa**`, `N\u002FA.`) —\n   or one bare `\u003Ctemplate>` tag counts as empty; evidence that assembles tag\n   spans stays valid; a repeated field takes the last\n   value. The gate is syntactic: it cannot judge the quality of an evidence\n   sentence, that judgment belongs to Steps 4–6. Send the lesson to the\n   target skill's lessons section or memory as fits. Completion: lesson\n   saved, evidence line names a real observation.\n\n## Post-Ship Monitoring (advisory artifacts)\n\nWhen the composed edit lands as a DEPLOYED artifact — an advisory plugin, a\nharness hook — the proof burden shifts from \"the edit won the probe\" to \"the\nartifact actually fires in the live host\". Registry rows ('enabled',\ncorrect version) and a clean load log prove DISCOVERY, not binding; many\nhooks log nothing on success, so silence is not evidence. Verify with:\n\n1. **One real end-to-end fire.** Perform one genuine behavioral edit the\n   artifact exists to catch, and check ALL of: the artifact's durable state\n   appears on the first pending write (e.g. its plugin-data state file), the\n   host logs carry no contract-rejection or load-failure lines after the\n   restart marker, and the artifact's output surfaces where the host injects\n   it. Never conclude from log absence alone.\n2. **Know the injection point.** `pre_llm_call` context is injected into the\n   user message that STARTS a turn: an advisory queued mid-turn by a tool\n   call surfaces at the start of the NEXT user-initiated turn, never in the\n   same turn as the triggering edit. Plan observation windows accordingly.\n3. **Effectiveness, not just firing.** The outcome signal is probe cycles\n   appearing under the evidence root within the review window after fires —\n   a cycle needs BOTH its planning and selection files present. Count\n   fires and false-positives from a DURABLE LEDGER THE ARTIFACT WRITES\n   ITSELF at delivery time (one row per injected advisory, plus auto-close\n   when the answering cycle lands) — not from chat logs: an in-band\n   injection leaves no host log line, the pending record expires after its\n   TTL, compaction prunes the conversation, and a hand-maintained ledger\n   cannot recover past fires (pre-ledger fires can only be mined from the\n   session store's `messages` table — see log-analyzer). If the deployed\n   artifact lacks self-recording, add it before judging the trial. If host\n   logs do not record tool arguments, the detection-rate denominator is\n   unobservable — label the rate UNVERIFIED rather than computing it from\n   fire counts alone.\n4. **Decision at the review date** (two weeks is the default): keep,\n   tune (TTL, thresholds, marker lists, exclusions), or disable. Catalog or\n   manifest publication waits until after that decision.\n\n## Pitfalls\n\n- **Same-model control is the whole validity claim.** If a probe runs a\n  different model or tools than the baseline, the contrast measures the\n  model, not the edit.\n- **Blinding breaks silently.** File names, paths, or self-reports often\n  reveal the candidate identity. Use the anonymized ids output only.\n  In-context selection: have every probe arm return the DELIVERABLE only\n  (no process notes in the report body — notes leak identity and pad the\n  comparison), save deliverables to files, re-read them by anon id, and\n  write the `\u003Cwhy>` lines from the files. When the arms already reported\n  with identities visible in the conversation, the honest compromise is\n  the file re-read — record it in the selection doc; do not claim the\n  comparison was blind when it was not.\n- **The cost shape is near-fixed.** A standard cycle is one baseline run\n  + two candidate runs + one composition-probe run (about 4 model runs),\n  then the selection round, which is your own read of the deliverables, not\n  a rollout. A candidate retry (Step 5 ceiling) can add one run. The `--k`\n  and `--mode` flags in `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py ids` are\n  shuffle-seed tags only; they do not change the run count. Budget the probe\n  task to be small enough for that.\n- **A winning contrast may be probe-specific.** Confidence says the scope.\n  Generalize only when the contrast is structural, not cosmetic.\n  Deliverable-quality contrasts (malformed output, missing\n   sections, wrong art) are strong from a single run — output damage is not\n   variance. Efficiency contrasts (call counts, duration) are the WEAKEST class:\n   one run cannot separate the edit's effect from run-to-run model variance —\n   rerun for the same direction before applying an efficiency-only edit, and say\n   so in the lesson's confidence line.\n- **Compose at most one new rule per tool section.** Two winning candidates\n  that touch the same tool section can interact: a merged process rule next to\n  an existing fallback can push the composed run toward hand-computing an\n  output instead of reproducing a known figure — both parts won alone, the\n  merge lost its own gate. Keep the baseline when that happens; the fallback\n  rule exists for exactly this.\n- **Apply the composed edit with anchors taken from a FRESH read of the live skill, never from the probe copies.** Copies drift from live (local rewordings, different frontmatter layout), and an `old_string` reused from a probe copy or from the composed deliverable text fails to match or matches the wrong region. Compose the edit as an abstract change, then re-derive the anchor from the most recent skill_view of the live file immediately before the skill_manage call.\n- **Pick the pilot target from usage data.** Read `.usage.json` at the skills root and choose the lowest `use_count` skill that still earns improvement; never pilot a cycle on a load-bearing skill (money, user content, repo operations) without the user's go. The fallback rule protects against loss, but the cycle still rewrites files. If the target has an upstream-provenance row in `UPSTREAM_MANIFEST.md`, a local refinement is drift by definition — record `✅ keep-ours (...)` on that manifest row or carry the fix upstream, never leave the row untouched.\n- **The live session's skill loader is cached.** A newly installed skill is\n  visible to the next session, not this one — test through file paths here.\n\n## Quick Reference\n\n`\u003Cskill_dir>` is this skill's own directory — the path `skill_view` reports\nfor this skill. Run the script from anywhere:\n\n```bash\n# Anonymous ids for blind selection (deterministic per task\u002Fk\u002Fmode seed)\npython3 \u003Cskill_dir>\u002Fscripts\u002Fcontrast.py ids --labels base,inv1,dom1 --task probe-1 --k 1\n\n# Evidence gate for lessons (reads stdin, exit 0 = valid)\npython3 \u003Cskill_dir>\u002Fscripts\u002Fcontrast.py lesson-check \u003C lesson.md\n```\n\n## Verification\n\n- Probe cycle directory holds: probe inputs, baseline deliverable, one\n  deliverable per candidate, the anonymized mapping, the `\u003Cwhy>` lines.\n- The chosen edit has a written contrast evidence line.\n- `\u003Cskill_dir>\u002Fscripts\u002Fcontrast.py lesson-check` passes on the recorded lesson.\n- The live skill shows only the composed additive edit (diff the target\n  skill before and after).\n",{"name":5,"license":14,"metadata":23,"description":7},{"tags":24,"author":9,"version":29,"platforms":30,"related_skills":34},[25,26,27,28],"agent-ops","skill-improvement","evidence","refinement","0.2.0",[31,32,33],"linux","macos","windows",[35,36],"repo-adoption-review","build-review-loop","main","e943e3285cd03c44b2c762a9a52328e3d16444b1","plugins\u002Fskill-governance\u002Fskills\u002Fcontrastive-refinement",22,"https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills","https:\u002F\u002Fhermes-agent.nousresearch.com","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin","Accounting\u002FFP&A\u002FM&A\u002FPERE guy by day, AI\u002Fself-host\u002Fprogramming hobbyist by night. \r\n\r\nPassionate in solving practical business issues.","2026-11-13 19:46:18",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add moonlight-lupin\u002Fagent-skills --skill contrastive-refinement",{"tool":52,"command":53},"bunx","bunx skills add moonlight-lupin\u002Fagent-skills --skill contrastive-refinement",{"tool":55,"command":56},"pnpm","pnpm dlx skills add moonlight-lupin\u002Fagent-skills --skill contrastive-refinement","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fskill-governance\u002Fskills\u002Fcontrastive-refinement\u002FSKILL.md",true,[60,66],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002Fharness2-adaptation.md","REFERENCE","参考文档",3391,"https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fskill-governance\u002Fskills\u002Fcontrastive-refinement\u002Freferences\u002Fharness2-adaptation.md",{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"scripts\u002Fcontrast.py","SCRIPT","脚本",6336,"https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fskill-governance\u002Fskills\u002Fcontrastive-refinement\u002Fscripts\u002Fcontrast.py",[73,80,87,94,101,108],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M78ATNRV7RYQ8M314V0QZX18","website-scraping","Generic playbook for extracting structured data from any website — hotel prices, flight fares, e-commerce listings, real estate, jobs, competitor product catalogues, anything where the goal is to turn one or more URLs into clean records on disk. Use this skill whenever the user mentions scraping, harvesting, extracting, or pulling data from a website; names a specific site or competitor they want data from; asks how to handle JavaScript-rendered pages, Cloudflare blocks, bot detection, Turnstile challenges, or Playwright; wants to monitor prices over time; needs to automate a copy-paste research task; or says things like \"just get the data from X\" or \"I need a script that grabs N from site Y\". Covers recon, picking the lightest extraction tool that works, surviving anti-bot defences, and writing clean JSONL output with a run manifest. Scope is scraping only — landing data in a database, scheduling, and downstream pipeline work are explicitly out of scope and live in other tools.","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fweb-scraping\u002Fwebsite-scraping\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M78ATK9XGEKSH3QRN7P2MEER","greet","Greets a named person warmly.","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fclaude_plugin_sample\u002Fskills\u002Fgreet\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M78ATEAQB5CK2D4MKPCW4YHQ","skill-quality-review","Use when auditing or reviewing skill quality — batch checks across a library, deep per-skill grep methodology, usage stats, efficacy testing, or fix planning. Single consolidated home for the writing-for-agents review framework and the 3-surface review methodology.","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fsoftware-development\u002Fskill-quality-review\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":18},"01M78AT58EM57023QSC79S8R6D","people-enrichment","Use when the user has a list of names or companies and wants their job, employer, work history, LinkedIn URLs or company profiles looked up, or wants to find people or companies matching criteria — trigger on phrases like \"enrich these contacts\", \"find their LinkedIn\", \"look up these people\", \"who works at X\", \"find directors at Y\", \"enrich these companies\", or \"get firmographics for\". Enrich and search People Data Labs (PDL) Person and Company data, writing results to .xlsx. Five operations: enrich named PEOPLE into a profile, employment history and LinkedIn URL; IDENTIFY an ambiguous person as several scored candidates; SEARCH people by criteria (company, title, location); enrich COMPANIES into firmographics (industry, size, employees, HQ, founded, LinkedIn); and SEARCH companies by criteria. Do not scrape LinkedIn directly — this uses a licensed data aggregator (PDL) instead, for legal and reliability reasons.","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fpeople-enrichment\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":18},"01M78AT0AZJ7WFY73766NBA1EC","notebooklm-mode","Source-grounded research pipeline inspired by NotebookLM. Collect verbatim source extracts into a temporary workspace, then answer questions and create deliverables grounded in those sources. Two grounding modes: strict (vault-only) and augmented (vault + labeled [background] knowledge). Trigger when the user asks to research a topic from sources, wants NotebookLM-style grounded answers, asks to build a resource vault, or says \"notebooklm mode\".","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fnotebooklm-mode\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":18},"01M78ASTJVZ9G5JY6GM40SF909","news-monitoring","Use when a topic or news stream needs recurring monitoring — cover it with web search, multi-language sources, digest formatting, and automated delivery via Hermes cron jobs. Covers search strategy, source selection, Chinese-language platforms, and digest templates.","https:\u002F\u002Fgithub.com\u002Fmoonlight-lupin\u002Fagent-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fnews-monitoring\u002FSKILL.md",[],[]]