Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

ai_context

59 sites Security covered
View on drupal.org

Beta1 released at DrupalCon Chicago! ๐ŸŽ‰

Beta testers welcome!

Please file bugs, feature requests, UX improvements, and ideas in the issue queue. ๐Ÿ™

For developers and those comfortable with ddev, see the installation and testing notes.

Context Control Center (CCC) helps your Drupal siteโ€™s AI use your content, rules, and terminology so it delivers more accurate, relevant results. Whether itโ€™s a content editor drafting product pages with the right compliance language, a marketer generating on-brand copy, or a site builder integrating AI with domain knowledge, CCC ensures every agent interaction is grounded in your siteโ€™s context.

Create and manage context items just like any other Drupal content, with drafts, approvals, scheduling, and version history. You can organize them by topic, language, or section of your site, link them to specific pages, and group related items so theyโ€™re used together.

Choose which AI features use which context, set limits to keep costs under control, and pin or exclude items as needed. A built-in dashboard, usage reports, and logs help you see whatโ€™s working and make improvements over time.

Context Examples

You can add whatever context makes sense for your website such as:

  • Brand voice and tone
  • Style guides
  • Editorial standards
  • Design systems and templates
  • Regulatory requirements (HIPAA, FERPA, GDPR)
  • Accessibility standards

Features

Context Content Management

Context items are managed as full content entities with moderation, scheduling, revisions, multilingual support, and a markdown editor, all within a UI consistent with Drupal CMS 2.0.

  • Content moderation
  • Scheduling
  • Duplication
  • Markdown editor
  • Multilingual support
  • Revisions and revision comparisons
  • UI that matches Drupal CMS 2.0 content editing

Context Scope

Context scope plugins categorize context items by criteria such as use case, language, tags, site section, or target entities, and agents subscribe to the scopes most relevant to their tasks. The plugin system is extensible, so custom scopes can be added to fit any site's needs.

  • Global: allow context to globally apply to any agent
  • Use Cases: common, predefined use cases (e.g. writing words)
  • Languages: target specific languages
  • Tags: flexible tagging based on vocabulary for custom categorization
  • Site Sections: define specific sections or paths of site
  • Target Entities: bind context with specific Canvas pages, node content, etc
  • Scope Subscriptions: configure agents to opt-in to the most relevant scope
  • Extensible: add your own custom scope plugins

Subcontext

Subcontexts organize context items into a one-level parent-child hierarchy, where each child is either always included with its parent or conditionally selected by an LLM based on relevance.

  • Required Subcontext: used for hierarchical organization
  • Conditional Subcontext: parent rules explain when to include children
  • Parent / Child UI: shows nested context with type icon
  • Subcontext Selection: LLM decides when child is relevant for inclusion

Agent Context Selection

Agent context selection lets administrators control which context items an LLM agent receives through scope subscriptions, entity targeting, and always/never inclusion rules, all governed by configurable item and token limits.

  • Context Limits: max context items and token limits to control costs
  • Scope Subscriptions: configure agents to opt-in to the most relevant scope
  • Global: global context is always included within max limit settings
  • Target Entities: include context associated with certain content entities
  • Always Include: ignore other configuration and always include context
  • Never Include: ignore other configuration and always exclude context

Additional Features

The module includes an admin dashboard, usage tracking, debug logging, granular permissions, configurable settings, and comprehensive test coverage and documentation.

  • Overview Page: lightweight dashboard with key actions and resources
  • Usage Tracking: tracks context usage by context, agent, route, and tools
  • Debug Logging: optional verbose debug logging for troubleshooting
  • Agent Debugging: integrated with agents explorer and debugger modules
  • Access Control: context management and module settings permissions
  • Admin Settings: disable scope plugins, finetune moderation settings, etc
  • Full Test Suite: extensive automated test coverage across all features
  • Documentation: detailed feature and configuration documentation

Getting Support

Installation and Testing Steps

You can install using Drupal CMS 2.0 or Drupal 11. Choose one.

Note: These instructions assume you have ddev installed.

Install dev branch on Drupal CMS 2.0

mkdir my-drupal-site && cd my-drupal-site
ddev config --project-type=drupal11 --docroot=web
ddev start
ddev composer create-project drupal/cms
ddev composer drupal:recipe-unpack
ddev exec sed -i 's/"minimum-stability": "stable"/"minimum-stability": "dev"/' composer.json
ddev composer require drupal/ai_context:dev-1.0.x -W
ddev composer require drupal/ai_agents_debugger
ddev launch
go through installer in browser and choose the Byte site template
ddev drush en ai_context ai_agents_debugger -y

Install dev branch on Drupal 11

mkdir my-drupal-site && cd my-drupal-site
ddev config --project-type=drupal11 --docroot=web
ddev start
ddev composer create-project "drupal/recommended-project:^11"
ddev composer require drush/drush
ddev exec sed -i 's/"minimum-stability": "stable"/"minimum-stability": "dev"/' composer.json
ddev composer require drupal/ai_context:dev-1.0.x -W
ddev composer require drupal/ai_agents_debugger
ddev drush site:install --account-name=admin --account-pass=admin -y
ddev drush en ai_context ai_agents_debugger -y
ddev launch
# or automatically log in with:
ddev launch $(ddev drush uli)

Configure a provider

If you are using Drupal CMS 2.0, you should have the amazee.io provider available with some free credits. You can also install and configure another AI provider if you prefer.

For Drupal 11, install and configure an AI provider.

The provider settings page is at: /admin/config/ai/providers

Simple testing steps

  • Go to: /admin/ai/context/overview
  • Add context: /admin/ai/context/items/add
  • Go to agent context settings: /admin/ai/context/settings/agents
  • Update an agent to always include a context item (e.g. Content Type Agent)
  • Test the agent using the debug option of the debugger: /admin/config/ai/agents

For example, if your context says "always add the word hello when you respond", and your prompt for the "Content Type Agent" is "list all the content types", then the response should have "hello" in it somewhere.

Working on issues

This is an official AI Initiative project. We welcome contributions from AI Partners as well as from the wider community.

Some issue etiquette:

  • Please do not work on an issue that is already assigned before first commenting on the issue and/or contacting the person assigned.
  • Only assign yourself an issue if you will be able to work on it within the next couple of days. Exceptions can be made for project maintainers or those who have arranged something with the project maintainers.
  • Since assigning an issue blocks others from working on the issue, it's important to unassign an issue as soon as you know you can't work on it. If an issue has been assigned for more than 3 days with no updates, we will assume it's not being worked on and we may unassign it so others can take it on.

Issues that are tagged as AI Initiative Sprint are worked on during sprints run by the AI Initiative. Sprints run for two weeks. If you are not officially part of the AI Initiative, you can still work on these issues if you follow the guidelines above. When in doubt, DM Kristen Pol in Drupal Slack or add a messaging in the #ai-context Slack channel.

Much of the code for this module has been created through AI assistance or generation, and has been spec'ed, reviewed, tested, and updated by real people.

Activity

Total releases
3
First release
Sep 2025
Latest release
3 weeks ago
Release cadence
88 days
Stability
0% stable

Release Timeline

Releases

Version Type Release date
1.0.0-beta1 Pre-release Mar 24, 2026
0.1.0-alpha1 Pre-release Dec 13, 2025
1.0.x-dev Dev Sep 30, 2025