Recommendation Scoring#
Overview#
Decant surfaces up to 12 signal recommendations per run, ranked by a numeric score and drawn from a pool of independently-computed signal generators . Each generator applies its own eligibility filter and scoring formula; the results are merged, sorted descending by score, and sliced to the top 12 . All signals look at a rolling 30-day window .
The two Recommendation kinds are:
signalā data-derived from the session archive; scored and ranked.catalogā evergreen best-practice suggestions; alwaysscore: 0and appended after signals .
Signal Generators and Their Scores#
All generators live in src/recommendations.ts.
Hot context, churn, and search-heavy usage are measured per repository, grouped by COALESCE(project.root_path, project.path), the same key as the repo filter. Worktrees count toward their repository, and equal relative paths in two repositories are separate files. Sessions without a project do not produce these signals. Search-heavy usage uses only that repository's visible top-level sessions as its denominator; ingest health uses visible top-level sessions across the archive . Abandoned rate uses only classified visible top-level sessions and their outcome labels. Hot context, churn, search-heavy usage, and ingest health credit subagent file reads, edits, searches, and diagnostics to the top-level session that started them, so one session that fans out to five subagents counts once rather than six times .
Error Hotspots ā rate Ć calls#
errorHotspots() is the highest-priority signal class. Eligibility: a tool must have ā„ 20 calls, ā„ 5 errors, and an error rate ā„ 12%. Score formula:
score = (errors / calls) Ć calls Ć connector_factor
// connector_factor = 0.5 for claude.ai connectors, otherwise 1
A non-connector tool with a 50% error rate on 200 calls scores 100, while a claude.ai connector with the same counts scores 50. A tool with 3 errors in 20 calls does not qualify despite its 15% rate. Connector rows advise changing how agents call the tool rather than fixing the remote server .
Churn Files ā editors Ć 1.5#
churnFiles() finds files edited in ā„ 6 distinct sessions within one repository in the window. Score: editors Ć 1.5 . A file edited in 10 sessions scores 15.
Hot Context Files ā readers#
hotContextFiles() finds files read in ā„ 8 sessions within one repository with ⤠2 edit sessions ā stable context being re-derived every time. Score: readers . Up to 2 files are emitted.
Search-Heavy Usage ā ratio Ć 2#
searchHeavy() triggers when a repository has searches-per-session ā„ 5.0 (with a minimum of 20 top-level sessions in that repository in the window). Score: ratio Ć 2 . At a ratio of 8 searches/session the score is 16.
A search is a structured Grep or Glob tool call, or a shell statement whose leading command is a search binary (rg, grep, find, etc.). Compound shell commands are split on ;, &&, ||, and newlines ā each statement counts separately if it leads with a search command. Pipelines are never split: ps aux | grep node filters output rather than searching the repo, so it does not count. See Search counting for the full definition.
Abandoned Rate ā pct / 3#
abandonedRate() triggers when the abandoned-session share exceeds 25%, with a minimum of 10 classified sessions. Score: pct / 3 . A 60% abandon rate scores 20.
Ingest Health ā affected Ć 2#
ingestHealth() triggers when ā„ 10% of sessions carry ingest diagnostics, with a minimum of 15 sessions in the window. Score: affected Ć 2 . The unreachable_project_directory diagnostic does not count toward this signal: it describes a project directory that did not answer in time, not a transcript-format issue .
Cost Concentration ā fixed 5#
costConcentration() triggers when a single model accounts for ā„ 40% of total estimated spend. Score is a fixed 5 regardless of the concentration percentage .
Heavy-Tool and Heavy-Server Flattening#
heavyTools and heavyServers are intentionally scored below the issue-oriented signals to prevent high usage volume from outranking genuine problems.
| Generator | Threshold | Score formula | Example (200 calls) |
|---|---|---|---|
heavyTools() | ā„ 200 calls, top-2 non-MCP tools | USAGE_SIGNAL_SCORE = 2 | 2 |
heavyServers() | ā„ 50 calls, top-3 MCP servers | USAGE_SIGNAL_SCORE = 2 | 2 |
Both generators use a flat score of 2 regardless of call volume. Usage volume alone is not a problem, so these signals are kept at a fixed floor that loses to every issue-flagging signal. An eligible error hotspot has at least 5 errors and scores at least 5, or 2.5 for a claude.ai connector, and outranks any usage signal; a tool with 2000 calls at 0% errors still scores 2.
heavyTools is also capped at the top 2 non-MCP tools and heavyServers at the top 3 MCP servers before any threshold check.
Final Ranking#
Before merging, hot context, churn, and search-heavy usage are each capped at 2 rows across repositories. When 5 or more tools qualify as error hotspots, the top 3 keep individual rows and the rest fold into one "more tools fail often" row, naming the next five tools. With exactly four qualifying tools, all four keep individual rows. The summary row scores 0.99 Ć its highest-scoring member .
After these caps, the merged list is sorted by:
scoredescendingkeyascending (lexicographic tiebreaker)
The top 12 are returned . Catalog recommendations are appended with score: 0 and displayed after all signals.
An open signal that stops meeting its threshold is marked implemented with source activity and reopens if it qualifies again. A still-eligible signal omitted by a cap is removed instead and returns open when it ranks again; person- and agent-owned marks are kept. Repository signal keys end in .p plus a 16-digit digest of the repository root. A mark on a legacy unscoped key moves only when exactly one repository qualifies; ambiguous marks remain on the old key .
Key Source#
src/recommendations.tsā all signal generators, scoring formulas, eligibility thresholds, and thesignals()aggregator.