Content Moderation
AI Context Items use Drupal's Content Moderation system to provide an editorial workflow. This ensures that context items go through a review process before being made available to AI agents.
Moderation states
Context items use the module-owned ai_context_editorial workflow. It is
separate from Drupal CMS's basic_editorial workflow, so installing AI
Context does not change moderation for other content types.
- Draft -- the item is being worked on and is not yet available to agents
- Published -- the item is live and can be selected by agents
- Archived -- the item is inactive and can only be restored to Draft or Published
Only published context items are included in agent system prompts. Draft and archived items are invisible to the context selection pipeline.
Transitions
Draft and Published items can be saved in their current state or moved between Draft and Published. Both can be archived. Archived items cannot be edited in place: a user must restore one to Draft or Published first. This prevents retired context from being changed accidentally while keeping a clear path to reactivate it.
Edit access follows the workflow rather than a hardcoded list of states: an item cannot be edited while it is in a state the workflow has no transition back into, which is what makes Archived restore-only.
Updating existing sites
When updating from a version that used basic_editorial, run database updates:
drush updatedb
The update creates ai_context_editorial, detaches AI Context Items from
whichever workflow moderated them, and repoints every existing moderation
record -- including past revisions -- at the new workflow. The former
Unpublished state becomes Archived; any state that does not exist in the
new workflow falls back to Draft and is logged. No new revisions are created.
Roles that can create drafts, publish, unpublish, archive, or restore through the previous workflow receive the matching AI Context transition permissions, as long as they already hold an AI Context Item permission. The previous workflow and its use by other content types are otherwise unchanged.
How it works
The ai_context_item entity extends EditorialContentEntityBase, which
provides built-in support for Content Moderation. The module depends on
Drupal core's Content Moderation module.
When editing a context item, the moderation state and revision information are grouped together in the sidebar (similar to how nodes behave). This includes:
- Revision log -- a message describing what changed
- Moderation state -- select a permitted workflow transition
- Publish status -- if Scheduler is configured, the target moderation state for scheduled transitions
Combined with scheduling
Content Moderation integrates with the Scheduler module through the Scheduler Content Moderation Integration module. This allows you to:
- Schedule a draft item to be published at a future date
- Schedule a published item to be archived at a future date
- Set the target moderation state for scheduled transitions
See Scheduling for details.
Combined with revisions
Each moderation state change creates a new revision, so you have a complete audit trail of when items moved between states and who made the change. See Revisions for details.