Site context¶
The Site Agent AI Context submodule (site_agent_ai_context) gives the model
the site's AI Context items: its
voice, standards and rules, written and published by the site's editors in AI
Context.
- Each toolset is an AI Context consumer, of the type "Site Agent toolset", listed with AI Context's consumers. Its subscriptions, always and never include lists, limits and selection mode are set there, and so is whether it gets context at all. It does by default.
- Before each model call, the toolset's items are selected for the user's latest message and the page the chat was opened on, and added to the system prompt as a "Site context" section after the toolset's fragment. The page is given to AI Context as its entity and its path, so Entity Types, Specific Entities, Taxonomy Terms and Site Sections items match it. The selection is cached until an item or AI Context's settings change, so a turn's tool rounds select once, record one usage row, and send the same system prompt. A remote client's instructions get the items selected without a message or a page.
- The
site_agent_ai_context:page_contexttool selects the items for a page being drafted or rewritten: by its entity type and bundle for a new page, or its id, and its path. It leaves out the site-wide items, which the system prompt has. Where the toolset offers it, the system prompt tells the model to call it before drafting a page and to follow its result as guidance. Installing the submodule adds it, pre-approved, to every toolset with a content write tool, such as Editor and Site builder; uninstalling takes it out of every toolset. A toolset made later gets it from the toolset form. It needs AI Context'saccess published ai contextpermission ("Use Published AI Context in AI Features"). - An item reaches the system prompt when its Context scope is Global, when it matches the page the chat was opened on, or when it matches a scope the toolset subscribes to. An item with no scope matches nothing.
- AI Context selects only items the user may view, so the roles that use the
chat need
access published ai context. Items in the system prompt are instructions to the model: give the AI Context editing permissions only to roles trusted to instruct it. - AI Context's own push into AI requests doesn't apply: the consumer type routes no request tags.
Selection gives AI Context the page through its request info resolver, and records usage through its usage tracker. Both are internal to AI Context, so the submodule's info file requires AI Context 1.0.0-rc1 or later, the version they were written against.