Expand description
Score formula and primary-selection logic.
score = 0.6 * freshness + 0.4 * volume
freshness = max(0, 1 - days_since_last_used / 14)— decays to 0 at 14 days.volume = min(1, log10(sessions + 1) / 3)— saturates at 1000 sessions.
pick_primary picks the top-scoring snapshot when one of:
- Recency dominance — the top candidate was used at least
RECENCY_DOMINANCE_HOURS(4 h) more recently than the runner-up. Just used Claude 5 seconds ago vs Copilot 2 days ago? Claude wins, period — volume can’t fight that. - Score gap — the top score is at least
PRIMARY_THRESHOLD(1.5×) the runner-up’s. Used as fallback when both candidates are equally fresh.
Otherwise returns None, signalling that the caller should ask the user.
Functions§
- compute_
score - pick_
primary - Pick the primary candidate.