Skip to content

feat: infer tags from recall query for soft ranking boost (#142)#144

Merged
rahilp merged 7 commits into
mainfrom
142-infer-tags-from-the-recall-query-and-use-them-as-a-soft-ranking-boost
Jun 10, 2026
Merged

feat: infer tags from recall query for soft ranking boost (#142)#144
rahilp merged 7 commits into
mainfrom
142-infer-tags-from-the-recall-query-and-use-them-as-a-soft-ranking-boost

Conversation

@rahilp

@rahilp rahilp commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds inferQueryTags(query, env): three-tier tag inference — hashtag extraction (free, no DB), keyword match against known tag vocabulary (json_each query), and LLM fallback only when both find nothing; runs in parallel with embedding via Promise.all so the common path adds no latency
  • Adds queryTags: string[] param to rerankWithTimeDecay: entries whose tags overlap with inferred tags get a soft boost (TAG_BOOST_STEP=0.15, TAG_BOOST_MAX=1.5) applied outside the recency cap — tag-relevant memories can surface above marginally-closer but irrelevant ones without over-narrowing results
  • Wires both into recallEntries: explicit tag filter behaviour is unchanged; inference is soft ranking only

Resolves #142

Test plan

  • npm test — 314/314 passing
  • npx tsc --noEmit — no TypeScript errors
  • Manual: recall "what did I decide about #work today" — work-tagged memories rank higher
  • Manual: recall "office lease" with entries tagged "legal" — legal-tagged memories rank higher without explicit tag filter
  • Manual: recall with tag=work filter — no regression in existing tag-scoped behaviour

@rahilp rahilp linked an issue Jun 10, 2026 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 82.73% 604 / 730
🔵 Statements 83.6% 714 / 854
🔵 Functions 82.75% 96 / 116
🔵 Branches 77.29% 412 / 533
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/index.ts 82.56% 75.41% 81.48% 81.73% 113-160, 180, 471, 478, 519, 784, 895, 901, 910, 918-938, 1022-1025, 1057, 1064, 1065, 1076, 1098-1106, 1116, 1168, 1209, 1222, 1268-1490, 1499-1503, 1516-1541, 1560, 1602, 1640, 1674, 1840-1851, 1913, 1923
Generated in workflow #141 for commit 76a206d by the Vitest Coverage Report Action

@rahilp rahilp merged commit d11cf20 into main Jun 10, 2026
1 check passed
@rahilp rahilp deleted the 142-infer-tags-from-the-recall-query-and-use-them-as-a-soft-ranking-boost branch June 10, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infer tags from the recall query and use them as a soft ranking boost

1 participant