Skip to main content

Module sweep

Module sweep 

Source
Expand description

Maintenance sweeps for stale or weakly grounded skills.

The corpus has accumulated a long tail of conv-review-* skills that never get accepted, never get served past the first injection, and still pay full freight in the top-5 retrieval ranking. Two complementary sweeps live here:

  1. sweep_stale_skills multiplicatively decays confidence_score on skills that were installed long enough ago to have a track record, have NOT been served in the recent window, and have NEVER earned an accepted fix. Confidence is a multiplier in the recall ranker (context::retrieval::rules), so halving it ~halves the chunk’s fused score and naturally drops it out of the top 5 over two sweeps without deleting anything.

  2. quarantine_unguided_conv_reviews flips conv-review-* skills that have neither file_patterns nor a trigger to status = 'pending'. These are the worst offenders: imported from a PR comment with no grounding so the embedding has to do all the work, and the embedding usually loses to a real rule. Pending status keeps the row (it can be promoted back by a human or an accept event) but removes it from active recall.

Hard constraints: no schema changes, no DELETEs, all writes wrapped in a single sqlx transaction so a partial sweep can’t half-decay the corpus.

Structs§

QuarantineReport
Outcome of quarantine_unguided_conv_reviews. flipped_ids is the exact list of skill ids that moved from active to pending — useful for both audit logs and undo scripts.
SweepOpts
Tuning knobs for sweep_stale_skills. Defaults: 14-day install/serve windows, x0.5 decay, 0.05 floor.
SweepReport
Outcome of one sweep_stale_skills pass. Counts are best-effort snapshots taken during the same transaction as the writes (or the dry-run preview, if dry_run was set).

Functions§

quarantine_unguided_conv_reviews
Move conv-review-* skills with neither file_patterns nor a trigger to status='pending'. See module docs for the rationale.
sweep_stale_skills
Decay confidence_score on truly-stale skills. See module docs.