Skip to content

Studio Code: Bring the remote-site runbook with a WordPress.com active site instead of a rule to load it - #5231

Merged
chubes4 merged 2 commits into
trunkfrom
studio-code/remote-site-runbook
Oct 21, 2026
Merged

chubes4 merged 2 commits into
trunkfrom
studio-code/remote-site-runbook

Conversation

@chubes4

@chubes4 chubes4 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude (via the Pi coding agent in a Roadie session) wrote the change and the tests, ran the eval below against a WordPress.com site I own, and cleaned up the posts it created. I reviewed the diff and the results.

Proposed Changes

The system prompt carried a general rule telling the agent to load the edit-manage-remote-site skill first for any WordPress.com site. That rule stood in for a fact Studio already knows: since #5192, the active site is stated in the prompt, including whether it is a WordPress.com site.

  • When a WordPress.com site is active, its runbook comes with it. The Active site section now includes the edit-manage-remote-site runbook. The agent starts out knowing that the site changes only through wpcom_request and how to use that tool, so it no longer spends a step loading the skill first.
  • The rule is removed from the general rules. For a WordPress.com site the user names while a local site is active, the skill list already covers it: the Skill tool and studio_instructions list edit-manage-remote-site with its description, "Edit and manage one of the user's live remote sites…".
  • Prompts for local sites and for no active site are unchanged, apart from one rule fewer.

Testing Instructions

  • npx vitest run apps/cli/ai apps/cli/commands/ai: 256 pass. The new test checks that the runbook is in the prompt only when a WordPress.com site is active.

  • Eval: 24 runs, 12 per arm, on Franklin Works, a Business-plan WordPress.com site. Trunk and this branch both include Studio Code evals: Let the agent ask the user, and run on a WordPress.com site #5230.

    • read: WordPress.com site active, "Which theme is active on this site, and does its plan let me install plugins?"
    • write: WordPress.com site active, "Add a draft post titled … with one short paragraph about field notes."
    • named: a local site active, the same draft request naming "my WordPress.com site Franklin Works (chubesmattic.wpcomstaging.com)".
    Case Arm Correct outcome Loaded the skill Median tokens
    read trunk 4/4 4/4 74k
    read branch 4/4 0/4 66k
    write trunk 4/4 4/4 49k
    write branch 4/4 1/4 38k
    named trunk 4/4 4/4 83k
    named branch 4/4 4/4 102k
    • Correct outcome:
      • read: the answer names Assembler and says the Business plan allows plugins.
      • write and named: exactly one draft with that title on Franklin Works.
    • In every run, the agent changed the site only through wpcom_request; no local tool was called.
    • named, branch: the agent loaded the skill in 4 of 4 runs without the rule. One run took 752k tokens, because GET !/me/sites with plan in fields returns 2.3 MB, and wpcom_request passes it through whole. Trunk has the same path. Without that run, the branch's median is 84k.
    • All 16 drafts were trashed afterwards.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@chubes4
chubes4 marked this pull request as ready for review October 21, 2026 02:05
@wpmobilebot

wpmobilebot commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing b03c761 vs trunk

app-size

Metric trunk b03c761 Diff Change
App Size (Mac) 922.00 MB 922.00 MB 0.00 MB ⚪ 0.0%

site-editor

Metric trunk b03c761 Diff Change
load 1217 ms 1193 ms 24 ms ⚪ 0.0%

site-startup

Metric trunk b03c761 Diff Change
siteCreation 8604 ms 8567 ms 37 ms ⚪ 0.0%
siteStartup 5897 ms 5887 ms 10 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@chubes4
chubes4 merged commit 596d469 into trunk Oct 21, 2026
12 checks passed
@chubes4
chubes4 deleted the studio-code/remote-site-runbook branch October 21, 2026 03:11
chubes4 added a commit that referenced this pull request Oct 21, 2026
## Related issues

- Follows #5231, which brings the remote-site runbook when a
WordPress.com site is active.

## How AI was used in this PR

Claude (via the Pi coding agent in a Roadie session) wrote the change
and the tests, and ran the eval below on trunk and on this branch. I
reviewed the diff and the transcripts.

## Proposed Changes

`site_list` listed only local sites. When the user names one of their
WordPress.com sites and no WordPress.com site is active, the agent
looked there, found nothing, and concluded the site doesn't exist.
Nothing pointed it to WordPress.com, except a line in the remote-site
runbook, which is only loaded once the agent already knows the site is
remote.

- `site_list` now returns `{ local, wordpressCom }`. `wordpressCom`
holds the sites the stored login reaches, with the ID `wpcom_request`
takes as `siteId`. They come from the same `getWpComSites()` the `/site`
picker uses: about 14 KB for 160 sites, versus 2.4 MB for `GET
!/me/sites` with `plan`.
- Signed out, it says `signedIn: false`. If the lookup fails, it reports
the error and still lists the local sites.
- Its annotation is now `REMOTE_READ`, like
`site_connected_remote_sites`. That tool is still read-only, so hosts
run it without asking.
- The remote-site runbook points to `site_list` for other sites instead
of `site_connected_remote_sites` or `GET !/me/sites`.

## Testing Instructions

- `npx vitest run apps/cli/ai/tests/tools.test.ts`: it lists local and
WordPress.com sites together, reports a signed-out user, and keeps the
local sites when WordPress.com can't be reached.
- Eval: two prompts naming a WordPress.com site (a Business plan Atomic
site) while no WordPress.com site is active, 4 runs each per arm, with
trunk and this branch as two providers in one promptfoo config.

| Prompt | Trunk | This branch |
|---|---|---|
| "Which theme is my Franklin Works site using?" (no active site) | 0/4:
asked which site was meant; one run grepped `~/Studio` with Bash | 4/4:
`site_list`, then one `wpcom_request` |
| "Add a draft post titled 'Site list eval' to my Franklin Works site."
(a local site active) | 0/4: offered the local site or a new one; one
run used Bash | 4/4: a draft on the right site, without touching the
local site |

No run on either arm called `GET !/me/sites`. Median tokens went from
37k to 52k (theme) and from 32k to 53k (draft), because the branch
finishes the task where trunk stopped to ask. The drafts were trashed
afterwards.

## Pre-merge Checklist

- [x] Have you checked for TypeScript, React or other console errors?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants