What
Score sessions by knowledge density and use it as a recall ranking signal. High-density sessions (decisions made, bugs fixed, code committed) should rank above low-density sessions (exploration, Q&A, back-and-forth) when recall scores are close.
Signal sources (all already in smriti tables)
| Signal |
Table |
Weight |
| Tool calls with success |
smriti_tool_usage |
+1 per tool |
| File operations (writes) |
smriti_file_operations |
+2 per write |
| Git commits |
smriti_git_operations |
+3 per commit |
| Errors resolved |
smriti_errors |
+2 per resolved error |
| Session tags (decision/*, bug/fix) |
smriti_session_tags |
+5 per quality tag |
| Session cost (proxy for depth) |
smriti_session_costs |
log-scaled |
Schema addition
ALTER TABLE smriti_session_meta ADD COLUMN density_score REAL DEFAULT 0;
Computed on ingest, recomputed by smriti enrich --density.
Recall integration
In recallMemories(), final score = relevance * 0.8 + density_normalized * 0.2. Configurable via SMRITI_DENSITY_WEIGHT env var (default 0.2, set 0 to disable).
Why
Two sessions with equal relevance scores are not equal. A session where you fixed a critical bug and committed a fix is worth more than a session where you explored an idea and abandoned it. The sidecar tables already capture this signal — we just don't use it in ranking.
No LLM calls needed. Purely structural. Ships before Phase 3.
Acceptance Criteria
What
Score sessions by knowledge density and use it as a recall ranking signal. High-density sessions (decisions made, bugs fixed, code committed) should rank above low-density sessions (exploration, Q&A, back-and-forth) when recall scores are close.
Signal sources (all already in smriti tables)
smriti_tool_usagesmriti_file_operationssmriti_git_operationssmriti_errorssmriti_session_tagssmriti_session_costsSchema addition
Computed on ingest, recomputed by
smriti enrich --density.Recall integration
In
recallMemories(), final score =relevance * 0.8 + density_normalized * 0.2. Configurable viaSMRITI_DENSITY_WEIGHTenv var (default 0.2, set 0 to disable).Why
Two sessions with equal relevance scores are not equal. A session where you fixed a critical bug and committed a fix is worth more than a session where you explored an idea and abandoned it. The sidecar tables already capture this signal — we just don't use it in ranking.
No LLM calls needed. Purely structural. Ships before Phase 3.
Acceptance Criteria
density_scorecomputed on all new ingestssmriti enrich --densitybackfills existing sessionsrecallMemories()final rankingsmriti show <id> --densityexplains the score breakdown