agentleFS
creanlabcreanlab/agent-genome-lab/.agents/skills/rule-patcher/SKILL.md

rule-patcher

Skill2 starsChanged 4 months agoMITView on GitHub

Propose, test, and promote patches to rules, workflows, and skills via replay-gated promotion

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After a high-impact incident (Impact ≥ 7) or when a failure family is detected.

    line 13
  2. Distinctive:

    Write the proposed change:

    line 35
  3. Distinctive:

    Update the source genome file:

    line 80
  4. Distinctive:

    After rejection: refine the patch or propose a different patch type.

    line 112

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rule Patcher

Proposes mutations to the agent's rules, workflows, and skills based on incident data. V4: includes Failure Genome replay-gated promotion.

When to Use

After a high-impact incident (Impact ≥ 7) or when a failure family is detected.

Patch Types

TypeTargetExampleWhen to Use
rule_patch.agents/rules/*.mdAdd new invariantMissing knowledge — no rule existed
workflow_patch.agents/workflows/*.mdAdd new check stepProcess gap — steps skipped
skill_patch.agents/skills/*/SKILL.mdExtend extractionCapability gap
verifier_patchChecklist or testAdd verification checkInvariant was clear but not enforced
doc_patchdocs/*.mdUpdate architectureDocumentation drift

Procedure

1. Identify Gap

From the incident and its failure genome:

  • Which rule/workflow/skill would have PREVENTED this?
  • Is it a new gap or a known family with no patch?

2. Draft Patch

Write the proposed change:

patch_type: rule_patch
target_file: .agents/rules/10-truthfulness-and-no-fallbacks.md
change: Add CSS variable detection to pre-commit checklist
rationale: CSS var(--x) passes presence check but is unresolvable
source_genome: FG-000004

3. Replay-Gated Promotion

THIS IS THE CORE V4 MECHANISM

┌─ 1. Is the current incident FIXED? ──────────────────┐
│   NO → STOP. Fix first.                              │
│   YES ↓                                              │
├─ 2. Are there SIMILAR genomes in the family? ────────┤
│   NO → Promote with "replay: not_run" (first member) │
│   YES ↓                                              │
├─ 3. Would this patch have PREVENTED similar ones? ───┤
│   For each family member:                            │
│   - Read its incident                                │
│   - Simulate: would patch have caught it?            │
│   - Score: PASS / FAIL                               │
│   ↓                                                  │
├─ 4. Pass rate ≥ 60%? ───────────────────────────────┤
│   NO → Reject or refine the patch                    │
│   YES ↓                                              │
├─ 5. Holdout regression? ────────────────────────────┤
│   Pick 1-2 genomes from DIFFERENT family             │
│   Does patch obviously break them?                   │
│   YES → Reject                                       │
│   NO ↓                                               │
├─ 6. PROMOTE ────────────────────────────────────────┤
│   Apply patch to target file                         │
│   Update genome: promotion_decision = "promoted"     │
│   Update genome: replay.status = "passed"            │
│   Update genome: replay.pass_rate = actual_rate      │
│   Commit: "🧬 genome-promoted: [family] → [type]"   │
└──────────────────────────────────────────────────────┘

4. Record Promotion Decision

Update the source genome file:

{
  "promotion_decision": "promoted",
  "proposed_patch_types": ["rule_patch"],
  "replay": {
    "status": "passed",
    "family_sample_size": 3,
    "holdout_sample_size": 2,
    "pass_rate": 0.8,
    "notes": "Patch would have prevented 4/5 similar incidents. No holdout regressions."
  },
  "notes": "Added CSS var detection to rule 10 pre-commit checklist"
}

5. If Rejected

{
  "promotion_decision": "rejected",
  "replay": {
    "status": "failed",
    "family_sample_size": 5,
    "holdout_sample_size": 2,
    "pass_rate": 0.4,
    "notes": "Only prevented 2/5 family members. Too narrow."
  },
  "notes": "Patch too specific — only catches exact CSS var pattern, not general quality gate bypass"
}

After rejection: refine the patch or propose a different patch type.

What NOT to Do

  1. Don't auto-promote without replay — even if it "feels right"
  2. Don't mutate the global prompt — use targeted rules/workflows/skills
  3. Don't trust "felt useful" reflections — require evidence
  4. Don't merge failures and successes — they are different data types
  5. Don't overfit to last incident — test against the family

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.