The scope chain
Synap uses a four-level hierarchical scope chain, ordered from narrowest (most private) to broadest (most shared):
Scope levels
User scope
The most granular scope. Memories stored at the user level are visible only when that specific user is the context for a retrieval query. Use this for personal information, individual preferences, and conversation-specific knowledge.| Aspect | Detail |
|---|---|
| Visibility | Only when user_id matches the query |
| Isolation | Complete — no other user can see these memories |
| Use cases | Personal preferences, individual history, private conversations |
- “User prefers dark mode and concise responses”
- “User’s name is Alice Chen”
- “User is based in Portland, Oregon”
- “User is preparing for an annual review next week”
Customer scope
Memories shared across all users within a customer or organization. Use this for company-wide knowledge, shared context, and organizational facts. In a B2B SaaS application, a “customer” is typically one of your client’s end-customer organizations.| Aspect | Detail |
|---|---|
| Visibility | When customer_id matches the query, regardless of user_id |
| Isolation | All users within the customer can see these memories |
| Use cases | Company policies, shared projects, organizational structure |
- “Acme Corp’s fiscal year ends in March”
- “Company uses Jira for project management and Slack for communication”
- “The engineering team is migrating to microservices”
- “Primary contact for billing is [email protected]”
Client scope
Memories shared across all customers of your application. In the Synap hierarchy, you (the developer) are the Client. Client-scoped memories are visible to all users of all your customers. Use this for product knowledge, documentation, and announcements.| Aspect | Detail |
|---|---|
| Visibility | All users across all customers of your application |
| Isolation | None within your application — all customers share these memories |
| Use cases | Product documentation, feature announcements, domain knowledge |
- “Our product supports SSO with SAML and OIDC”
- “Version 3.2 introduces bulk import for CSV files”
- “Billing inquiries should be directed to [email protected]”
- “The API rate limit is 1000 requests per minute”
World scope
Global knowledge shared across all Instances. This is rarely used directly by application developers. It exists primarily for Synap-managed global knowledge and cross-instance shared resources.| Aspect | Detail |
|---|---|
| Visibility | All Instances, all customers, all users |
| Isolation | None — truly global |
| Use cases | General domain knowledge, shared ontologies, global entity registries |
- General domain knowledge applicable across all applications
- Shared entity type definitions
- Universal formatting conventions
Most applications only need User and Customer scopes. Client scope is useful for product-wide knowledge, and World scope is managed by Synap internally. You do not need to use all four levels.
How scoping works with retrieval
When your agent fetches context, Synap merges memories from all applicable scopes in the chain. The merge follows a strict priority order: narrower scopes take precedence over broader scopes.Retrieval flow
Identify applicable scopes
Based on the
user_id and customer_id in the retrieval request, Synap determines which scopes to search. If both are provided, all four scope levels are searched. If only customer_id is provided, User scope is excluded.Search each scope
The retrieval engine searches vector and graph stores within each applicable scope level, returning candidate memories from each.
Merge and deduplicate
Candidates from all scopes are merged. If the same fact exists at multiple scope levels (e.g., a user-scoped fact and a customer-scoped fact about the same topic), the narrower-scoped version takes priority.
Priority resolution example
Consider a scenario where conflicting information exists at different scopes:| Scope | Memory | Priority |
|---|---|---|
| User | ”Preferred language: French” | Highest (returned) |
| Customer | ”Company language: English” | Lower (returned as additional context) |
| Client | ”Default language: English” | Lowest (may be returned if token budget allows) |
Scoped ingestion and retrieval
Ingesting memories with scope
When you ingest content, the scope is determined by theuser_id and customer_id parameters:
Retrieving memories across scopes
When retrieving, Synap automatically includes all applicable scope levels:Scope hierarchy table
| Scope | Identified by | Visible to | Typical content | Priority |
|---|---|---|---|---|
| User | user_id + customer_id | Only that user | Personal preferences, individual history | Highest |
| Customer | customer_id | All users in that customer org | Company policies, shared projects | High |
| Client | Implicit (your application) | All users across all customers | Product docs, announcements | Medium |
| World | Global | All Instances everywhere | General domain knowledge | Lowest |
Common scoping patterns
Single-user personal assistant
Single-user personal assistant
For a personal AI assistant serving one user at a time with no multi-tenant requirements.Ingest everything with
user_id. Each user has completely isolated memory.Multi-tenant B2B SaaS
Multi-tenant B2B SaaS
For a B2B application where each customer organization has multiple users, and you need both per-user personalization and shared organizational knowledge.Ingest user conversations with
user_id + customer_id. Ingest company documents with just customer_id. Use client scope for product documentation.Shared knowledge base
Shared knowledge base
Customer-first with optional personalization
Customer-first with optional personalization
For an application where organizational knowledge is primary but individual users can have some personal preferences.Default scope is customer. Personal preferences can be added by including
user_id on specific ingestion calls.Next steps
Entity Resolution
Learn how entities are resolved within scope boundaries.
Memory Architecture
Configure scoping strategies in MACA.
Multi-User Scoping Guide
Step-by-step guide to implementing multi-user, multi-tenant memory.
Clients & Instances
Understand the organizational hierarchy that scopes operate within.