Every memory in OMP can carry aDocumentation Index
Fetch the complete documentation index at: https://docs.openmem.blog/llms.txt
Use this file to discover all available pages before exploring further.
scope — a hierarchical path that tells the system where that memory belongs and who is allowed to touch it. Scopes serve two purposes simultaneously: they organize memories into logical namespaces, and they form the basis of OMP’s access-control grammar so you can grant or restrict access at exactly the right level of granularity.
What is a scope?
A scope is a slash-delimited string that places a memory in a hierarchy. Think of it like a file path: the segments to the left are broader categories, and segments to the right are more specific. For example:| Scope | Meaning |
|---|---|
coding/preferences | Tooling and style choices for coding |
coding/languages | Programming language preferences |
health/symptoms | Health-related notes |
ui/preferences | Interface and display preferences |
work/meetings | Notes from work meetings |
scope on a memory, it has no namespace and can only be retrieved by direct ID or unscoped queries.
Wildcard matching
You can use a trailing* wildcard to match an entire subtree. The pattern coding/* matches coding/preferences, coding/languages, coding/tools, and any other path that begins with coding/.
This is the same wildcard syntax used in both data queries and access-control grants.
Adding memories with a scope
Passscope as a keyword argument to mem.add():
Filtering by scope in search and list
Bothmem.search() and mem.list() accept a scope parameter. When you provide a scope, results are restricted to memories whose scope matches exactly or falls within the wildcard pattern.
Access control with scopes
OMP’s authorization model uses a<verb>:<scope-path> grammar to express what an application is permitted to do. An app’s grant lists the specific verbs and scopes it may access.
ScopeDeniedError with a clear message identifying the missing grant.
Best practices
A few guidelines:- One concept per leaf. Keep the final segment focused on a single topic rather than mixing unrelated data under the same path.
- Match access boundaries. Draw scope boundaries where you expect to draw access boundaries — if
healthdata should always require separate consent fromworkdata, keep them as distinct top-level scopes. - Avoid deep nesting. More than three segments (
a/b/c) rarely adds value and makes wildcard grants harder to reason about.
Not all providers support scopes natively. Some simulate scope filtering by mapping scope values to tags internally. Call
mem.capabilities() and check caps.features.scopes — the value will be "native", "tags", or "none" — to understand what your current provider supports before designing a scope-heavy architecture.