fix(plugin): correct v2 filter syntax in mem0-mcp rubric

The rubric introduced in this PR taught the agent to use
`{"metadata.type": "decision"}` filters, but the v2 search
contract (docs/platform/features/v2-memory-filters.mdx) requires:

1. The root must be a logical operator (`AND`/`OR`/`NOT`) with an array.
   A bare `{"user_id": "..."}` is rejected.
2. Metadata uses a nested object — `{"metadata": {"type": "..."}}` —
   not a dotted key. Only top-level metadata keys are filterable.

Without this fix, agents following the rubric produce filter calls
the platform either ignores or rejects.

Also replaces the literal `"alice"` in the worked example with a
clearly-marked `<your_user_id>` placeholder so agents don't copy
verbatim, and adds a one-line "substitute the active user_id"
instruction.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mgeeeek
2026-05-06 19:13:10 +05:30
co-authored by Claude Opus 4.7
parent 875eedfbac
commit 1dcf842635
2 changed files with 29 additions and 19 deletions
+8 -6
View File
@@ -51,12 +51,14 @@ improve your answer. The agent -- not this hook -- owns this decision.
- Run **2-4 parallel** \`search_memories\` calls with different angles, not one
query that echoes the user's prompt.
- Phrase queries as **nouns** ("auth module decisions"), not full sentences.
- Use \`metadata.type\` filters where they fit:
- \`{"metadata.type": "decision"}\` -- design / architecture questions
- \`{"metadata.type": "anti_pattern"}\` -- debugging, error handling
- \`{"metadata.type": "user_preference"}\` -- tooling, stack, style
- \`{"metadata.type": "convention"}\` -- established patterns in this project
- Scope every query with \`{"user_id": "$USER_ID"}\`.
- Filter shape: the root must be a logical operator (\`AND\` / \`OR\` / \`NOT\`)
with an array, and metadata uses a **nested** object (not dotted keys).
Combine \`user_id\` with one \`metadata.type\` clause per call:
- \`{"AND": [{"user_id": "$USER_ID"}, {"metadata": {"type": "decision"}}]}\` -- design / architecture
- \`{"AND": [{"user_id": "$USER_ID"}, {"metadata": {"type": "anti_pattern"}}]}\` -- debugging, error handling
- \`{"AND": [{"user_id": "$USER_ID"}, {"metadata": {"type": "user_preference"}}]}\` -- tooling, stack, style
- \`{"AND": [{"user_id": "$USER_ID"}, {"metadata": {"type": "convention"}}]}\` -- established patterns
- Or scope with just \`{"AND": [{"user_id": "$USER_ID"}]}\` when no metadata filter fits.
- Empty results are normal -- proceed without context.
EOF