promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_

The ratchet — every mistake becomes a rule — step 9 of 9

Checkpoint

One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.

Final ratchet drill. Combine the audit + the leverage assessment into one function: triage_ratchet(rules).

Each rule is a dict with date (YYYY-MM-DD), rule (string), and model_native_in_year (int, 9999 if never).

Return a dict with three fields:

  • kept_count: int, rules still earning their place (model_native_in_year > 2025)
  • remove_count: int, rules to retire (model_native_in_year <= 2025)
  • highest_leverage: string, the rule with the MOST RECENT date among the kept rules (the rule that most recently earned its place is the highest-leverage rule still in the harness)

On a tie for the most recent date, return the LAST one in input order (Python's max is stable).

Five rules run. Expected output:

{'kept_count': 3, 'remove_count': 2, 'highest_leverage': 'use structlog, not stdlib logging'}

full-screen editor opens — close anytime to keep reading.