Skip to content

AI Workspace: add posts and pages to a space as context #1402

Description

@whyisjake

Follow-up to item 8 of the #1004 review, for 1.7.0.

The workspace has two scopes. Site Context lets the assistant look up anything the person can read; General Knowledge touches nothing on the site. Neither lets the person point it at specific things. The one way to do that today is from the block editor: "Open in AI Workspace" hands over a single post.

This extends that to a picker: choose posts or pages, and the message names them, the way a handoff does.

How a handed-off post works today

The editor opens the workspace with ?wpai-post=<id>. Admin_Page::get_post_seed() checks read_post for that post and reports it as ready, denied, or not found. When it is ready, getSeedPrompt() (src/experiments/ai-workspace/utils/seed.ts) fills the composer with a prompt naming the post's title, type and ID. Nothing is sent until the person sends it. The post's body is not put into the turn: the assistant reads it with ai/read-content-bodies, under the person's own permissions. A post the person can't read, or that no longer exists, is not named, and the space says why instead.

What this would add

A reference picker, not a new way to load content:

  • An Add context control in the composer that picks one or more posts or pages.
  • Each pick adds a reference (title, type, ID) to the message, shown as a removable chip before sending.
  • The same read_post check per item, so the picker can't name something the person couldn't open themselves, with the same notice when an item can't be used.
  • Bodies are still read through ai/read-content-bodies. There is no second path for content into the model.

Open questions

  • How many? A handoff names one post, and ai/read-content-bodies returns at most 5 per call (Read_Content_Bodies::MAX_POSTS).
  • Post types beyond posts and pages?
  • What happens in General Knowledge, where the assistant touches nothing on the site? Disable the control, or offer to switch to Site Context?

Related: #1004, #1287.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions