Context Scope
The Context Scope system allows you to categorize context items by various criteria. Agents can subscribe to scope values to receive the most relevant context for their specific use cases.
How scopes work
Each scope defines a set of values that can be assigned to context items. For example, the Use Case scope has values like "Writing words" and "Working in canvas". The Language scope has values for each language configured on your site.
When editing a context item, you select which scope values apply. When configuring an agent, you select which scope values the agent should prioritize. The scope matcher then scores each context item based on how well its scope values align with the agent's subscriptions.
Scope matching
The AiContextScopeMatcher service scores context items against an agent's
scope subscriptions. Items that match more subscribed scope values receive
higher scores and are more likely to be selected.
Some scopes also support contextual detection -- they can automatically determine the current value from the request context. For example:
- Language scope detects the current language from the URL
- Site Section scope matches the current URL path against configured patterns
- Target Entity scope identifies the entity being worked on
Scope settings
Manage scopes at /admin/ai/context/settings/scope. Each scope can be
individually enabled or disabled. Some scopes have additional settings
(e.g., Site Section has configurable URL patterns).
Next steps
- Built-in scopes -- the 6 scopes that ship with the module
- Custom scopes -- how to create your own scope plugins