Skip to content

runAutoRetire

runAutoRetire(deps): RetiredRecord[]

Defined in: src/learnings-lifecycle.ts:149

Cross-repo sweep: identify and retire underperforming active learnings.

For each repo path:

  1. Fetch active+promoted rules (injected set) and retired rules.
  2. Compute the base rate using all rules (incl. retired) to prevent cascade.
  3. Filter to ACTIVE-only candidates (promoted rules keep a verbatim CLAUDE.md copy; retiring them is inert — leave them alone).
  4. Sort worst-first (lowest Wilson bound) so the budget cap retires the worst rules.
  5. For each shouldRetire candidate:
    • If autoOptimizeFlagged and not yet optimized: optimizeOne (no retire, no budget hit).
    • Else if budget remains: retire it and increment the per-repo counter.

Returns flat array of RetiredRecord across all repos.

AutoRetireDeps

RetiredRecord[]