Skip to content

Built-in scopes

The AI Context module ships with six scope types. Each can be enabled or disabled at /admin/ai/context/settings/scope.

Global

Mark context items as global to always include them for all agents. Global items bypass scope matching and are included regardless of an agent's subscriptions.

  • Agent subscriptions: Not applicable (global items are automatic)
  • Contextual detection: Not applicable
  • Multiple values: No (global is a boolean toggle)

Use case

Categorize context items by the type of task they support. Default values:

  • Writing words -- for agents that help create or edit text content
  • Working in canvas -- for agents that operate in a visual canvas editor

Additional values can be added via hook_ai_context_scope_values_alter().

  • Agent subscriptions: Yes
  • Contextual detection: No
  • Multiple values: Yes

Language

Scope context items to specific languages configured on your site. The available values are automatically populated from Drupal's language configuration.

  • Agent subscriptions: Yes
  • Contextual detection: Yes (detects current language from URL prefix, Referer header, or Drupal language negotiation)
  • Multiple values: Yes
  • Management link: /admin/config/regional/language

See the Multilingual documentation for more on languages.

Tag

Organize context items using tags from the AI Context Tags taxonomy vocabulary. Tags provide free-form categorization beyond the structured scope types.

  • Agent subscriptions: Yes
  • Contextual detection: No
  • Multiple values: Yes
  • Management link: /admin/structure/taxonomy/manage/ai_context_tags/overview

Site section

Scope context items to URL path patterns. This allows context to be associated with specific sections of your site based on URL structure.

Patterns support wildcards:

  • /blog/* -- matches any path under /blog/
  • /products/* -- matches any path under /products/
  • /about -- matches the exact /about path

Site sections can include both predefined patterns (configured in settings) and custom patterns added per context item.

  • Agent subscriptions: Yes
  • Contextual detection: Yes (matches current request URL against configured patterns)
  • Multiple values: Yes
  • Settings form: /admin/ai/context/settings/scope/site_section

Target entity

Associate context items with specific content entities (nodes, media, taxonomy terms, etc.) using dynamic entity references. When an agent operates on one of the targeted entities, the associated context items are prioritized.

Target entities are set directly on the context item form via the Target entities field, rather than through the scope checkboxes.

  • Agent subscriptions: Not applicable (context is applied based on the entity being worked on, not agent configuration)
  • Contextual detection: Yes (resolves the current entity from the route or request context)
  • Multiple values: Yes (can target multiple entities)