-
Notifications
You must be signed in to change notification settings - Fork 135
Description
Feature Description
Allow observation category filtering in search so queries like search_notes("project", "requirement", entity_types=["observation"]) return only observations whose category is exactly [requirement], instead of any observation that simply contains the word “requirement” in its title or body.
Problem This Feature Solves
Currently, entity_types=["observation"] only filters by the internal row type (entity/observation/relation). Users expect it to behave like an observation-category filter, so searching for “requirement” with that flag still returns [decision] observations whose text mentions “requirement,” plus other categories, creating noisy, misleading results.
Proposed Solution
-
User workflow: Support category: syntax or explicit parameters
(categories=["requirement"])so users can request category-exclusive searches. In the CLI/MCP tool,entity_types=["observation"]combined with a category selection would yield only matching bullets. -
Interface: Update search_notes to accept a categories option (and/or recognize category:requirement tokens). Documentation and help text should spell out how to target observation categories.
Technical approach
Extend SearchQuery with a categories: List[str] field and propagate it through SearchService into SearchRepository.
Add category IN (:categories) to the SQL WHERE clause alongside type='observation'.
Optionally remove the "{category}: " prefix from observation titles (or exclude it from FTS) so category-only searches rely on the explicit filter rather than incidental text matches.
Alternative Solutions
Manual workarounds include: searching for /observations/requirement/ in permalinks, post-filtering results client side, or using custom tags but none provide a clean category-exclusive search within the server.
Additional Context
Tests already show the mismatch: entity_types=["observation"] and query="requirement" returns [decision] observations if their body contains “requirement.”
Impact
Precise category filtering would eliminate noisy matches, making MCP searches more predictable for compliance, audit, and note-review workflows. Users could rely on Basic Memory to surface only the observations they tagged with a specific category, improving trust in search results and reducing manual triage.