Pass metadata_filter=<urlencoded JSON object> on
GET /api/memories or in the bulk-search body. Translates to Postgres'
JSONB @> (containment) operator.
# All memories where metadata = { speaker: "sarah" }
curl -H "Authorization: Bearer mnu_..." \
"https://mnueron.com/api/memories?metadata_filter=$(printf %s '{"speaker":"sarah"}' | jq -r @uri)"
# SDK
mem.search("our pricing approach", metadata_filter={"speaker": "sarah"}, k=5)
Notes
- Top-level keys only in v0.2.4. Nested matching works via JSON equality
(
{ "user": { "id": "abc" } }matches the whole nested object). - All filter conditions are AND'd together — every key=value pair must match for the memory to be returned.
- Stacks with
q,namespace, date filters in any combination.
Schema patterns that make this fast
Use predictable metadata keys at save time so filters don't return surprises:
mem.save(
content=decision.text,
namespace=f"meeting-{meeting_id}",
tags=["decision"],
metadata={
"speaker": decision.speaker, # short string
"ts_s": decision.timestamp, # number
"category": "pricing", # enum-like string
},
)
Then queries like metadata_filter={"category": "pricing"} are trivial.