Repository navigation
Tag-filtered retrieval (#59) - #71
Merged
Merged
Conversation
Add an optional `tags` array plus `tagMatch: "and" | "or"` (default "or") to get_context and search_memory. "or" keeps a memory sharing any listed tag; "and" requires every listed tag. Matching is case-insensitive over whole tags. The filter is a predicate (lib/context.makeTagFilter) threaded through the shared retrieval pipeline: in fetchRepoContext every source (pinned, recent, search) passes through it; search_memory applies it to its FTS and vector legs and its fallback. When a filter is active the candidate fetch is widened (max(limit*4, 50), bounded since limit caps at 50) so matching rows below the cut are not lost to a naive post-slice; output is still capped at limit. Default behaviour with no tags is identical to before: makeTagFilter returns a pass-through predicate and fetchLimit stays at limit. bench:check confirms no ranking drift. Tools stay thin: zod validates the params, logic lives in lib. Depends on #58 (tags indexed in FTS).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
7vignesh
added a commit
that referenced
this pull request
Oct 27, 2026
Release 2.1.0. Ships the backlog merged to main since v2.0.0, notably: - Index memory tags in FTS (#58 / #69) - Tag-filtered retrieval on get_context and search_memory (#59 / #71) Pushing the v2.1.0 tag after this merges triggers the npm publish workflow, which re-checks that the tag matches package.json before publishing.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59. (Supersedes #70, which GitHub auto-closed when its stacked base branch
fix/index-tags-in-ftsmerged and was deleted. Rebased onto main; now a clean single-commit diff.)What
Expose an optional tag filter on both retrieval tools:
tags: array of tag labels to filter by.tagMatch:"or"(default, keep any listed tag) or"and"(require all).How
lib/context.makeTagFilterbuilds a case-insensitive whole-tag predicate; it returns a pass-through when no tags are given, so the default path is untouched.fetchRepoContextruns every source (pinned, recent, search) through the predicate. When a filter is active it widens the candidate fetch tomax(limit*4, 50)so matching rows ranked below the cut are not lost to a naive post-slice; output is still capped atlimit.search_memoryapplies the predicate to its FTS and vector legs and threadstags/tagMatchinto its pinned+recent fallback.tags/tagMatch, the logic lives inlib.Out of scope (unchanged)
tagsis byte-identical to before: pass-through predicate,fetchLimit === limit.Measurement
Does not touch ranking when no filter is set.
npm run bench:checkpasses with no drift.Tests
tests/tag-filter.test.ts: no filter, single tag, AND, OR, no-match, case-insensitivity, and the search-hit (not just backfill) path with a widened pool.tests/search-tag-filter.test.tsexercisessearch_memoryend to end.npm run cigreen.