Skip to content

feat(search): scope memory search by workspace - #196

Closed
yordis wants to merge 3 commits into
petabridge:devfrom
TrogonAi:yordis/filter-by-workspace
Closed

feat(search): scope memory search by workspace#196
yordis wants to merge 3 commits into
petabridge:devfrom
TrogonAi:yordis/filter-by-workspace

Conversation

@yordis

@yordis yordis commented Jun 28, 2026

Copy link
Copy Markdown
Contributor
  • Memories already support being owned by either a workspace or a project, but the search surface (MCP search_memories, REST GET /api/memory/search, and the underlying HybridSearch / SearchWithMetadataEmbedding) only exposed project-level scoping, leaving no way to query "everything in this workspace" in a single call.
  • Agents and tools that operate at the workspace level (cross-project context, team-wide notes, broader recall) had to either issue N project queries and merge, or fall back to global search — both lose precision and waste tokens.
  • Scope is intentionally limited to direct workspace + its directly-owned projects so this change is small and reviewable; sub-workspace recursion is a follow-up once the simple shape proves itself.
  • projectId and workspaceId are kept mutually exclusive so the API stays unambiguous and easy to evolve — adding union/intersect semantics later is reversible; reserving the namespace now is not.

@yordis
yordis force-pushed the yordis/filter-by-workspace branch from 62215b4 to e58fbd1 Compare June 28, 2026 01:52
Memories can be owned by either a workspace or a project, but search only
exposed project-level scoping; agents working at the workspace level had
no way to query "everything in this workspace" in a single call.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis force-pushed the yordis/filter-by-workspace branch from e58fbd1 to c85f4ec Compare June 28, 2026 01:53
@yordis
yordis marked this pull request as ready for review June 28, 2026 01:56
@Aaronontheweb

Copy link
Copy Markdown
Member

I patched the review findings on branch petabridge/memorizer:aaron/pr-196-workspace-search-fixes at commit 751d9bd.

Fixes included:

  • REST GET /api/memory/search and GET /api/memory/search/metadata now accept and forward workspaceId scope, with projectId / workspaceId mutual-exclusion validation.
  • MCP SearchMemories now rejects malformed non-empty projectId / workspaceId values instead of silently widening to global search.
  • Added regression tests for MCP workspace forwarding, malformed workspace IDs, REST workspace forwarding on both search endpoints, and REST mutual-exclusion validation.

Verification:

  • dotnet test /home/aaronontheweb/repositories/petabridge/memorizer-v1/src/Memorizer.UnitTests/Memorizer.UnitTests.csproj --no-restore from outside the repo root: passed, 171 tests.
  • dotnet test /home/aaronontheweb/repositories/petabridge/memorizer-v1/src/Memorizer.IntegrationTests/Memorizer.IntegrationTests.csproj --no-restore --filter FullyQualifiedName~McpToolsProjectScopingTests from outside the repo root: passed, 10 tests.

I could not push directly to the PR head fork TrogonAi/memorizer; GitHub returned 403 for my account, so the fixes are available on the Petabridge branch above.

@yordis

yordis commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@Aaronontheweb I put your changes in it

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.

2 participants