Repository navigation
AI Workspace: AI suggestions and "Ask AI" in the Command Palette - #1316
Conversation
When the command palette finds nothing for a plain-language search, ask the model which of the palette's own commands answer it, and show up to three of them as ordinary results. Ported from #1250 with its 450 ms debounce, three-character minimum and silent failure. The palette search is now part of the AI Workspace experiment rather than an experiment of its own. The ability is registered in the plugin's category, annotated open-world and not destructive, and set to meta.mcp.public = false, so it is not offered over MCP and the tool policy never hands it to the agent. It is not marked read-only: the REST run route only accepts GET for a read-only ability, and the command list is too long for a URL. Co-authored-by: Jaydeep Das <jaydeep.das@rtcamp.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the palette finds nothing, users who can open the AI Workspace get an "Ask AI: <query>" row after any AI suggestions. It stays when the AI request fails. Choosing it opens the workspace with the query in the wpai-prompt argument. The admin page reads the prompt once, as plain text on one line, cut to 500 characters, and puts it in the composer without sending it. It wins over a post handed off from the block editor. The screen then removes wpai-prompt from the URL, so a reload starts with an empty composer. Only users with manage_options, the workspace screen's own check, are offered the row or told the workspace URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' into feat/agent-command-palette
…empty The debounce checked for other results once, so a slow post or page search let the AI request fire for a query that then got real results. The loader now waits for the palette's own empty state, rechecking while other loaders are still fetching and giving up after two seconds. Answers, cached ones included, are not shown when the palette has results. The loading row is cleared on every way out of a request, and the request is cut to the ability's input limits: a search over 200 characters skips it and shows only Ask AI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A prompt carried in by the wpai-prompt link shows a short notice above the composer until the person edits or sends it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/agent-site-info-and-screens #1316 +/- ##
======================================================================
+ Coverage 86.60% 86.77% +0.16%
- Complexity 6246 6282 +36
======================================================================
Files 222 224 +2
Lines 22581 22769 +188
======================================================================
+ Hits 19557 19758 +201
+ Misses 3024 3011 -13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Agreed, @whyisjake yolo into the phrase (and in this case overall naming of the Workspace / Wordspace) that seems best to you |
"Searching with AI…" and "Ask AI: …" read as the same action twice, though the second leaves the palette for another screen. The row now reads "Ask in AI Workspace: …". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # tests/e2e-testing/e2e-testing.php
|
Thanks, both. The row now reads "Ask in AI Workspace: …" (60d6f2e), so it no longer repeats "Searching with AI…", and "Command Palette" is capitalized in the description (63524e3). On the name: I've kept "AI Workspace" for now, since every label and doc says it, and it's one string to change if we rename it later. AI assistance: Yes. Tool(s): Claude Code (Claude Opus 5.5). Used for: the change and drafting this reply. I've reviewed the changes, understand them and can explain them under review. |
…ase, Wapuu busy states (#1317) ## What? Related: #1287 The AI Workspace gains an audit trail, personal-data export and erase, and Wapuu busy states: - **One audit trail.** Every agent event is one `agent` row in the AI Request Log and one call of a new `wpai_agent_event` action. Events are tool calls (including withheld ones), each item an approval writes, and each step in a proposal's life: created, edited, declined, expired, failed, or refused because its chat was deleted. The action fires even when AI Request Logging is off. - **Chats are personal data.** Tools → Export Personal Data includes the person's saved chats, and Tools → Erase Personal Data deletes them. This works with the experiment off. - **Wapuu.** While a turn runs, the transcript shows a working Wapuu instead of a spinner, then a celebrating one for a moment when the turn finishes, or an oops one next to an error. This is the fourth stacked PR for #1287, on top of #1316, #1315 and #1314. ## Why? #1287 asks that a site owner can see everything the agent did, was asked and was refused, in one place, and that audit plugins can hook it. Before this, workspace rows were mixed in with every other `ability` row, proposal events weren't logged at all, and nothing fired with logging off. Saved chats are personal data that core's export and erase tools didn't know about. And Jeff posted a Wapuu set on #1287 so a long turn looks busy rather than stuck. ## How? **`Agent_Audit`** is the one place agent events are recorded. - It fires `wpai_agent_event( $operation, $status, $context, $error )`, then writes the row through `log_ai_request()` with the new `agent` type. - The two existing log calls, for tool calls in `Turn_Runner` and for written items in `Proposal_Writes`, now go through it. Proposal events are recorded in `Proposal_Store` and `Proposal_Controller`: - created, when a proposal is stored; - edited, when an approval carries edits, naming the edited items; - declined; - expired, once, when an expired proposal is next read, since it's deleted then; - failed, when a write throws or is interrupted for longer than the approval lock; - refused, when an approval comes after its chat was deleted. - Context names the conversation, the proposal and its item keys, the post and field, or the option. It never carries post content or option values. - The hook covers agent turns and approvals only. A direct MCP call to an ability doesn't fire it. Docs say so. - The log screen gains the `denied` status, ported from #1214, and agent rows are labelled "Agent". Rows logged before this keep the `ability` type. - #1214's `wp_after_execute_ability` listener isn't ported: `Turn_Runner` already logs each call, so it would log them twice. **`Conversation_Privacy`** registers an "AI chats" exporter and eraser. - They're hooked from `Main`, next to the chat ownership filter, so they work while the experiment is off. - The export has one item per chat: name, created and updated dates, whether it's archived, and each turn's message and reply. Tool results are left out. It pages at 20 chats. - The eraser deletes all the person's chats. - Chat IDs are read straight from the posts table, as the user-deletion cleanup already does, so archived chats are found even while their status isn't registered. That reader is now shared, as `Conversation_Store::chat_ids()`. - A proposal from an erased chat can't be approved, because an approval is refused once its chat is gone. **Wapuu** sprites replace the transcript's spinner. - **Sprites:** `working` while a turn runs, `celebrating` for 1.8 seconds after one finishes, and `oops` next to an error. They come from the set @jeffpaul posted on #1287. - **Accessibility:** each sprite is an `<img alt="">`. The existing "Responding…" text and error text stay as the status. - **Reduced motion:** an SVG inside an `<img>` doesn't reliably follow the page's setting. So with reduced motion on, the component switches each sprite's animations off in its markup, which gives the same still pose. - **Scope:** only busy, done and error states ship. Per-tool sprites need streaming to know which tool is running. - **Credit:** the sprites are derived from Kazuko Kaneuchi's original Wapuu, GPL-2.0-or-later, and credited in `CREDITS.md`. ### Use of AI Tools AI assistance: Yes. Tool(s): Claude Code (Claude Opus 5.5). Used for: implementing the changes and tests, and code review. I've reviewed the changes, understand them and can explain them under review. They have all been tested locally. ## Testing Instructions 1. Enable AI Workspace and AI Request Logging, and connect a provider. 2. Send a message. A Wapuu shows beside "Responding…", then a celebrating Wapuu for a moment when the reply arrives. 3. Ask for a new tagline. Edit the proposed value and approve it. Ask for a draft and discard it. 4. Open Tools → AI Request Logs and filter by type `agent`. The tool calls, `proposal_created`, `proposal_edited` and `proposal_declined` rows are there, none of them with the tagline's text. 5. Tools → Export Personal Data for your own email: the download has an "AI chats" section with your chats. Erase personal data for a test user who has chats: their chats are gone. 6. With reduced motion turned on in your OS, the Wapuu is still. **Tests run** (all passing): - **PHPUnit, full suite:** 3398 tests, single site and multisite, on WordPress latest. - **`Agent_AuditTest`:** `test_agent_is_a_log_type`, `test_an_event_writes_one_row_and_fires_the_hook`, `test_the_hook_fires_with_logging_off`, `test_a_proposal_event_names_the_proposal_and_its_items_only` and `test_a_proposal_without_a_kind_is_recorded_as_drafts`. - **`Proposal_ControllerTest`:** `test_each_proposal_event_is_recorded_once_in_order`, `test_events_fire_the_hook_with_logging_off`, `test_an_expired_proposal_is_recorded_once`, `test_an_expired_proposal_read_through_the_store_is_recorded_once`, `test_an_interrupted_write_is_recorded_failed_once`, `test_a_writer_that_throws_is_recorded_failed` and `test_an_approval_for_a_deleted_chat_is_recorded_denied`. - **`Turn_ControllerTest`:** `test_a_turn_records_a_withheld_call_and_a_proposal_in_order`, and `test_every_tool_call_writes_exactly_one_log_row` updated for the `agent` type. - **`Post_Field_ProposalTest`:** `test_a_content_update_records_the_field_not_the_content`. - **`AI_Request_Log_ControllerTest`:** `test_get_logs_filters_agent_rows_by_type_and_denied_status`. - **`Conversation_PrivacyTest`:** `test_the_exporter_and_eraser_are_registered_without_the_experiment`, `test_export_returns_every_chat_with_its_prompts_and_replies`, `test_export_with_the_experiment_off_includes_archived_chats`, `test_export_pages_at_twenty_chats`, `test_erase_removes_the_persons_chats_only`, `test_a_proposal_in_an_erased_chat_cannot_be_approved` and `test_an_unknown_email_exports_and_erases_nothing`. - **e2e (Chromium):** all `ai-workspace*` specs, the palette spec and the request-log spec, 168 passed in one run on a fresh site. That includes the new "AI Workspace Wapuu" tests in `ai-workspace.spec.js`: a running turn shows the busy Wapuu beside "Responding…"; with reduced motion the busy Wapuu is a still frame; a failed turn shows the error Wapuu with the error; a finished turn shows the done Wapuu briefly. Each Wapuu test also ran three more times, 12 of 12 passing. - **Test-first:** the audit tests failed before `Agent_Audit` existed. The privacy tests were written before `Conversation_Privacy` but first run after it, so they have no recorded red run. - **Other checks:** PHPStan finds no errors, phpcs is clean on the changed plugin PHP, and tsc, lint-js and the build are clean. Style lint reports errors in `ai-request-logs/index.scss` and `ai-workspace/index.scss` that are already on the base branch. - **Live check:** core's exporter and eraser lists include "AI chats" on a running site, and the screenshots below come from one. - **Not run yet:** a live check against a real provider, and the PHPUnit suite on WordPress trunk. **Code review:** seven reviewers ran on this PR's own diff (correctness, security, adversarial, testing, maintainability, frontend races and API contract), plus an independent validator. The verdict was "Ready to merge" with no actionable findings. The one candidate, that the status filter rejects `skipped`, was rejected because it's already on the base branch. Applied afterwards in eef886a: agent rows were labelled "Text" on the log screen, a docblock still said these rows use the `ability` type, and the store's expiry path had no test. **One test from #1316 hardened** (1060833): its short palette search for "q" matched "AI Request Logs" whenever AI Request Logging was on, which the request-log spec leaves on when both run in one session. It now searches for "~". ## Screenshots **A running turn**  **A finished turn**  **A failed turn**  **Agent events in the AI Request Log**  **AI chats in a personal-data export**  ## Known limits - After an erase, a pending proposal from an erased chat can still be read by its owner, though not approved, until it expires (about 90 minutes). - "Recorded once" for an expired or interrupted proposal holds for requests that run one after another. Two requests reading the same proposal at the same instant can each record it. - A `wpai_agent_event` listener that throws during an approval write marks the proposal failed, as any WordPress hook would. The hook isn't wrapped. - The log screen's status filter doesn't accept `skipped`, which item rows have used since before this PR. - Workspace rows written after this are `agent`, not `ability`, so a view filtered to `ability` no longer shows them. ## Changelog Entry > Added - AI Workspace records every agent tool call and proposal event in the AI Request Log under an `agent` type, with a `wpai_agent_event` hook that fires even when logging is off; saved chats are included in personal-data export and erase; and a Wapuu shows while a turn runs, finishes or fails. **Post-deploy monitoring:** no additional operational monitoring is required. This is an experiment behind the AI Workspace toggle, off by default. The exporter and eraser run only when an administrator processes a personal-data request. --- [](https://github.com/EveryInc/compound-engineering-plugin) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- wp-playground-preview:start --> <a href="https://playground.wordpress.net?blueprint-url=data:application/json,%7B%22preferredVersions%22%3A%7B%22wp%22%3A%22latest%22%7D%2C%22login%22%3Atrue%2C%22landingPage%22%3A%22%2Fwp-admin%2Fadmin.php%3Fpage%3Dai-wp-admin%22%2C%22steps%22%3A%5B%7B%22step%22%3A%22installPlugin%22%2C%22pluginData%22%3A%7B%22resource%22%3A%22url%22%2C%22url%22%3A%22https%3A%2F%2Fgithub.com%2FWordPress%2Fai%2Freleases%2Fdownload%2Fci-artifacts%2Fpr-1317-77686452fbd3e34a0cb582c18648d7667c78a603.zip%22%7D%7D%5D%7D" target="_blank" rel="noopener noreferrer"> <img src="https://raw.githubusercontent.com/adamziel/playground-preview/refs/heads/trunk/assets/playground-preview-button.svg" alt="Open WordPress Playground Preview" width="220" height="57" /> </a> <!-- wp-playground-preview:end --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## What? Related: #1287 The docs pass for the #1287 stack. AI Workspace keeps its name and is documented as the plugin's one agent. The experiment doc, `readme.txt`, `README.md`, the changelog and the settings card now describe what #1314 to #1317 added. No code paths change. This is the fifth and last stacked PR for #1287, on top of #1317, #1316, #1315 and #1314. ## Why? #1287 folds two planned experiments into AI Workspace: Site Agent (#1214) and Command Palette AI Search (#1250). A reader of the docs, readme or changelog should learn that from them. Before this, the settings card and readme still described a workspace that only creates drafts and templates. The changelog had nothing for the write, palette, audit, privacy or Wapuu changes, `README.md` had no AI Workspace entry at all, and "Site Agent" was still listed under Coming Soon. ## How? - **`docs/experiments/ai-workspace.md`** - The summary and key features cover changes to existing content, site answers and screen links, the chats panel, the Wapuu, the audit log and personal-data export. - A new "One agent" section says what Site Agent and Command Palette AI Search proposed and where each now lives. It also says that the name, menu, URL and every identifier, including the experiment ID `ai-workspace`, are unchanged. - The entry-points list names every ability the experiment registers, and `Conversation_Privacy`. - A stale limitation is removed. It said chats have no history screen, but the chats panel ships. - **`readme.txt` and `CHANGELOG.md`** - Added: changes to existing content, the palette's AI search and Ask AI, the `agent` log rows, chats in export and erase, and the Wapuu. - Developer: `wpai_agent_event`, the two new proposal filters, the MCP visibility change, `raw: true`, and the `ability` to `agent` log type change. - `CHANGELOG.md` also gains the two ability lines #1315 added only to `readme.txt`. - **`README.md`:** adds the missing AI Workspace entry. - **Both readme files:** "Site Agent" leaves Coming Soon. - **Settings card:** the AI Workspace description says it answers site questions, proposes changes to posts and the site title and tagline, and adds AI to the command palette. The name stays "AI Workspace". Nothing on #1287 has settled on another name. ### Use of AI Tools AI assistance: Yes. Tool(s): Claude Code (Claude Opus 5.5). Used for: writing the documentation and changelog entries, checking them against the code, and code review. I've reviewed the changes, understand them and can explain them under review. They have all been tested locally. ## Testing Instructions 1. Open Settings → AI. The AI Workspace card reads as in the screenshot below. 2. Read `docs/experiments/ai-workspace.md` → "One agent", and the Unreleased changelog in `readme.txt` and `CHANGELOG.md`. **Tests run** (all passing): - **PHPUnit, full suite:** 3398 tests, single site and multisite, on WordPress latest. Only the settings-card string is code, and no test asserts it. - **Other checks:** phpcs and `php -l` are clean on `AI_Workspace.php`. - **Name check:** a grep for "Site Agent" and "Wordspace" across `includes/`, `src/` and the built assets finds nothing user-visible. - **Claims checked against the code:** - the abilities `AI_Workspace::register()` registers; - `meta.mcp.public` false on the propose and ask-user abilities; - the `wpai_workspace_write_proposals_enabled` and `wpai_workspace_proposal_kinds` filters; - `raw` on `ai/read-content-bodies`; - the chats panel's rename, archive and delete actions; - the three in-page anchors the doc links to. - **Not run:** e2e. No script, style or behavior changes. **Code review:** `ce-code-review` sized this diff to a single-context review: 51 changed lines, two of them code. It found nothing and gave "Ready to merge". Its one residual is applied in 0b06540: the doc's feature bullet now says rows are written while AI Request Logging is on. ## Screenshots **The settings card**  ## Known limits - The changelog lines for #1314, #1316 and #1317 are added here rather than in those PRs, so they land only when this one merges after them. ## Changelog Entry > Changed - AI Workspace is documented as the plugin's one agent: it now includes what the Site Agent and Command Palette AI Search proposals planned, under its existing name. **Post-deploy monitoring:** no additional operational monitoring is required. Documentation and one settings-card string. --- [](https://github.com/EveryInc/compound-engineering-plugin) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- wp-playground-preview:start --> <a href="https://playground.wordpress.net?blueprint-url=data:application/json,%7B%22preferredVersions%22%3A%7B%22wp%22%3A%22latest%22%7D%2C%22login%22%3Atrue%2C%22landingPage%22%3A%22%2Fwp-admin%2Fadmin.php%3Fpage%3Dai-wp-admin%22%2C%22steps%22%3A%5B%7B%22step%22%3A%22installPlugin%22%2C%22pluginData%22%3A%7B%22resource%22%3A%22url%22%2C%22url%22%3A%22https%3A%2F%2Fgithub.com%2FWordPress%2Fai%2Freleases%2Fdownload%2Fci-artifacts%2Fpr-1318-aa0faf515572fcec68b35f0b8a0634d387875fd1.zip%22%7D%7D%5D%7D" target="_blank" rel="noopener noreferrer"> <img src="https://raw.githubusercontent.com/adamziel/playground-preview/refs/heads/trunk/assets/playground-preview-button.svg" alt="Open WordPress Playground Preview" width="220" height="57" /> </a> <!-- wp-playground-preview:end --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

What?
Related: #1287, #1250
The Command Palette joins the AI Workspace:
This is the third stacked PR for #1287, on top of #1315 and #1314.
Why?
#1287 asks for one agent surface, with the palette's "Ask AI" (#1250) folded in rather than shipped as a separate experiment. Before this, a plain-language palette search with no match just showed "No results found", and there was no route from the palette into a conversation.
How?
AI suggestions port #1250's ability and loader, credited to @JDeepD with Co-authored-by.
ai/command-palette-ai-search. The model picks up to three command IDs. IDs that weren't sent are dropped, on the server and again in the browser. Failures stay silent, and the palette shows its own empty state.edit_posts); subscribers don't.meta.mcp.public = false), and the workspace's tool policy refuses it as an agent tool. It's annotated non-destructive and idempotent, but not read-only: core's REST run route accepts only GET for read-only abilities, and the palette's command list is too long for a URL.Ask AI is offered only to workspace users (
manage_options, the AI Workspace screen's capability).wpai-promptquery arg. The text is seeded into the composer as plain text, cut to 500 characters, and never sent automatically. The arg is removed from the URL after load, so a reload doesn't seed it again.get_seed()gains a prompt field. A prompt seed takes precedence over a post seed.Adds
@wordpress/commands1.57.0 as a dependency.Use of AI Tools
AI assistance: Yes. Tool(s): Claude Code (Claude Opus 5.5). Used for: porting #1250, implementing the changes and tests, and code review.
I've reviewed the changes, understand them and can explain them under review. They have all been tested locally.
Testing Instructions
Tests run (all passing):
Command_Palette_AI_SearchTest(ported from Add Command Palette AI Search experiment #1250, extended): includingtest_ability_is_hidden_from_mcp_and_refused_as_an_agent_tool,test_execute_callback_drops_an_id_that_was_not_sent,test_execute_callback_drops_invalid_ids_and_caps_results,test_permission_callback_for_subscriberandtest_choose_commands_falls_back_without_structured_output.Command_PaletteTest:test_palette_search_has_no_experiment_of_its_own,test_loader_is_enqueued_with_the_command_palette_for_an_editor,test_loader_is_not_enqueued_for_a_subscriber,test_loader_offers_ask_ai_to_a_workspace_user,test_loader_does_not_offer_ask_ai_to_an_editorandtest_loader_is_not_enqueued_when_the_experiment_is_disabled.Admin_PageTest:test_prompt_seed_carries_the_query,test_prompt_seed_is_cut_to_the_cap,test_prompt_seed_is_plain_text,test_empty_or_whitespace_prompt_gives_no_seed,test_non_string_prompt_gives_no_seed,test_prompt_seed_takes_precedence_over_a_post_seedandtest_post_seed_has_an_empty_prompt.ai-workspace*specs plus the palette spec, 157 passed.command-palette-ai-search.spec.js: finds the right screen when the palette has no results; no suggestions when no screen fits; no AI search when the palette has results; a one or two character search makes no request; only the last search is sent and answered when the search changes; an answer naming a command the palette didn't send is dropped; waits for slow post results before searching with AI; a search longer than the ability accepts shows only Ask AI; the palette's own empty state when the request fails; an editor gets suggestions; a subscriber gets none; no AI row and no request when the experiment is disabled.ai-workspace-palette-handoff.spec.ts: Ask AI opens the workspace with the query in the composer, unsent; after a reload the composer is empty and the URL has no prompt; Ask AI comes after the suggestions; an editor sees suggestions but no Ask AI row; a 2,000-character query is cut to the cap; a prompt from a link shows a notice until it's edited; opening the workspace directly shows no notice; a query with markup arrives as plain text; an empty or whitespace query shows no Ask AI row; when the AI request fails, a workspace user sees only Ask AI.ai-workspace/index.scssthat are already on the base branch.Code review: six reviewers ran on this PR's own diff: correctness, security, adversarial, frontend races, testing and maintainability. Each finding was checked in the code before being fixed. Fixed in a4a84fb and a0d7830:
Known limits
Screenshots
A palette search with no match gets an AI suggestion
Searching with AI
Ask AI opens the workspace with the query in the composer, unsent
An editor gets suggestions but no Ask AI row
Changelog Entry
Post-deploy monitoring: no additional operational monitoring is required. This is an experiment behind the AI Workspace toggle, off by default.
🤖 Generated with Claude Code