Recency Weighting in Database [Beta V2]

Added by Justin Sheehan Justin S. March 31, 2026 5:42am
Column
Done June 9, 2026 7:37am
Assigned to
Troy Pastoral Troy P.
Notes
Spec - Recency Weighting in Database [Beta V2] - Google Docs
Subtasks
Review Spec - Recency Weighting in Database [Beta V2] Troy Pastoral Troy P. Thu, Apr 2
Figure out / implement Recency Weighting in Database [Beta V2] Troy Pastoral Troy P. Fri, Apr 3
Troy Pastoral
Troy Pastoral AI Whisperer June 2, 2026 7:56am June 2, 2026 7:56am
Recency Weighting Beta V2 — dodenai-ae-v1

What changed: The AI retrieval system now has smarter date
detection and tunable recency scoring. Source dates are
resolved from more places (including row update timestamps),
score weights can be adjusted without redeploying, and each
source card now carries its recency score for inspection.

What to test:

1. Chat response includes recency fields on source cards
Before: sources had no recencyBucket, recencyScore,
originalScore fields
After: each source in the API response shows those
three fields
Steps: Send any chat message. In the Network tab,
inspect the streaming response. Find a
"sources" array. Each item should have
recencyBucket (e.g. "recent"), recencyScore
(e.g. 0.04), originalScore (e.g. 0.82).

2. updated_at fallback for sources missing file_date
Before: sources with no file_date and no date in
title got 0.00 recency modifier
After: sources with no file_date but a valid
updated_at row get a secondary date assigned
Steps: Check Supabase knowledge_sources for rows
where file_date IS NULL. Ask a question that
retrieves one of those sources. Console logs
should show _dateSource: updated_at.

3. Env-var config override works
Before: bucket thresholds were hardcoded — changing
them required a code edit and redeploy
After: set RECENCY_CONFIG_OVERRIDE in env to
override bucket config without redeploying
Steps: In .env.local, add:
RECENCY_CONFIG_OVERRIDE={"buckets":[{"label":"recent","maxMonthsAgo":6,"boostModifier":0.06},{"label":"moderate","maxMonthsAgo":24,"boostModifier":0.02},{"label":"light","maxMonthsAgo":48,"boostModifier":0.01},{"label":"baseline","maxMonthsAgo":9999,"boostModifier":0.00}]}
Restart the edge function. Recent (<6 month)
sources should now get +0.06 boost (was +0.04).