Review Spec - Recency Weighting in Database [Beta V2] Troy P.
Thu, Apr 2
Figure out / implement Recency Weighting in Database [Beta V2] Troy P.
Fri, Apr 3
Troy Pastoral
AI Whisperer
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).
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).