Summary
Add first-class Studio Code support as a new runtime in wp-coding-agents, alongside the existing claude-code and opencode runtimes. Studio Code is the AI coding CLI built into WordPress Studio — Automattic's Electron desktop app for managing local WordPress sites.
This enables dogfooding the Intelligence system through Studio Code itself.
Background
Studio Code is built on the Claude Agent SDK (@anthropic-ai/claude-agent-sdk). It uses:
preset: 'claude_code' — which means it already has Claude Code's CLAUDE.md discovery and memory system built in
cwd: ~/Studio/ — the working directory for all sessions
- MCP tools for WordPress site management (
site_create, wp_cli, take_screenshot, etc.)
- A plugin/skills system at
apps/cli/ai/plugin/skills/
- Session persistence as JSONL files at
~/.studio/sessions/
- Per-site instruction files:
CLAUDE.md, AGENTS.md, STUDIO.md installed at ~/Studio/<site-name>/ on site creation
Key entry point: apps/cli/ai/agent.ts
Key Finding: Settings Already Load By Default
Investigation of the Agent SDK source (sdk.mjs) revealed that when settingSources is not set in the SDK options, the --setting-sources flag is never passed to the CLI process. The CLI's default allowedSettingSources is:
["userSettings", "projectSettings", "localSettings", "flagSettings", "policySettings"]
This means Studio Code already supports all of the following out of the box:
- ✅ CLAUDE.md file discovery (from
cwd and parent directories)
- ✅ SessionStart hooks (from
.claude/settings.json)
- ✅ User-configured MCP servers (from
.claude/settings.json)
- ✅ Project, user, and local settings files
No upstream changes to Studio are needed. The runtime just needs to set up the right files in the right places.
Studio's Existing Instruction System
Studio already installs three instruction files per site (see PR #2788, PR #2886):
| File |
Purpose |
Auto-updated? |
CLAUDE.md |
Just @AGENTS.md — minimal, user-editable |
No (explicitly excluded in PR #2889) |
AGENTS.md |
Brief intro, points to @STUDIO.md |
No |
STUDIO.md |
Comprehensive Studio/WP-CLI instructions |
Yes (refreshed on every site start) |
Skills are installed to .claude/skills/ and .agents/skills/ per site, sourced from WordPress/agent-skills plus a bundled studio-cli skill (PR #2741). There's also a UI for managing skills and instructions per-site (PR #2729).
Approach
Since the claude_code preset loads all settings sources by default, the wp-coding-agents runtime can integrate cleanly:
runtime_generate_config()
- Append Data Machine
@ imports to the per-site CLAUDE.md (e.g., @path/to/SOUL.md, @path/to/MEMORY.md)
- CLAUDE.md is user-editable and not auto-updated, so our additions persist
{{WP_CLI_CMD}} substitution should use studio wp
runtime_install_hooks()
- Install
dm-agent-sync.sh as a SessionStart hook in .claude/settings.json — this works natively, same as Claude Code
- The hook syncs Data Machine agent context into CLAUDE.md before each session
runtime_generate_instructions()
- Generate
AGENTS.md from the shared template
- Be careful not to duplicate content already in Studio's
STUDIO.md (WP-CLI usage, site management, debugging, constraints, etc.)
runtime_merge_mcp_servers()
- Additional MCP servers (e.g., context-a8c) can be configured in
.claude/settings.json and will load alongside Studio's built-in studio MCP server
- Studio's built-in server is passed via
mcpServers in the SDK options; user servers from settings.json are additive
runtime_install()
- Verify
studio CLI is available (bundled with Studio desktop app)
- Check version compatibility
runtime_skills_dir()
- Studio already installs skills to
.claude/skills/ and .agents/skills/ per site
- wp-coding-agents skills should coexist alongside Studio's bundled skills
runtime_print_summary()
- Print setup summary with Studio-specific paths
Differences from Claude Code runtime
| Aspect |
Claude Code |
Studio Code |
| Installation |
npm i -g @anthropic-ai/claude-code |
Bundled with Studio desktop app |
| WP-CLI command |
wp |
studio wp |
| Working directory |
WordPress root |
~/Studio/ (sessions start here, sites are subdirs) |
| Hooks |
✅ SessionStart via settings.json |
✅ Same — works by default |
| MCP servers |
✅ From settings.json |
✅ Same — additive to built-in studio server |
| Skills |
.claude/skills/ |
.claude/skills/ + .agents/skills/ (bundled by Studio) |
| Instruction files |
Generated by wp-coding-agents |
Scaffolded by Studio on site creation |
Open Questions
- cwd scope: Studio Code starts at
~/Studio/, not at the site root. Per-site CLAUDE.md may not be in scope until the agent navigates to a site directory. Need to test whether the preset discovers CLAUDE.md files in subdirectories or only at cwd.
- Instruction deduplication: Studio's
STUDIO.md already covers WP-CLI, debugging, constraints, etc. How much of the AGENTS.md template content overlaps? Need to audit and avoid duplication.
- Runtime file similarity: The Studio Code runtime may be very close to the Claude Code runtime since the underlying mechanisms are the same. Consider whether it should be a thin wrapper or a standalone file.
Related
Summary
Add first-class Studio Code support as a new runtime in wp-coding-agents, alongside the existing
claude-codeandopencoderuntimes. Studio Code is the AI coding CLI built into WordPress Studio — Automattic's Electron desktop app for managing local WordPress sites.This enables dogfooding the Intelligence system through Studio Code itself.
Background
Studio Code is built on the Claude Agent SDK (
@anthropic-ai/claude-agent-sdk). It uses:preset: 'claude_code'— which means it already has Claude Code's CLAUDE.md discovery and memory system built incwd: ~/Studio/— the working directory for all sessionssite_create,wp_cli,take_screenshot, etc.)apps/cli/ai/plugin/skills/~/.studio/sessions/CLAUDE.md,AGENTS.md,STUDIO.mdinstalled at~/Studio/<site-name>/on site creationKey entry point:
apps/cli/ai/agent.tsKey Finding: Settings Already Load By Default
Investigation of the Agent SDK source (
sdk.mjs) revealed that whensettingSourcesis not set in the SDK options, the--setting-sourcesflag is never passed to the CLI process. The CLI's defaultallowedSettingSourcesis:This means Studio Code already supports all of the following out of the box:
cwdand parent directories).claude/settings.json).claude/settings.json)No upstream changes to Studio are needed. The runtime just needs to set up the right files in the right places.
Studio's Existing Instruction System
Studio already installs three instruction files per site (see PR #2788, PR #2886):
CLAUDE.md@AGENTS.md— minimal, user-editableAGENTS.md@STUDIO.mdSTUDIO.mdsite start)Skills are installed to
.claude/skills/and.agents/skills/per site, sourced from WordPress/agent-skills plus a bundledstudio-cliskill (PR #2741). There's also a UI for managing skills and instructions per-site (PR #2729).Approach
Since the
claude_codepreset loads all settings sources by default, the wp-coding-agents runtime can integrate cleanly:runtime_generate_config()@imports to the per-siteCLAUDE.md(e.g.,@path/to/SOUL.md,@path/to/MEMORY.md){{WP_CLI_CMD}}substitution should usestudio wpruntime_install_hooks()dm-agent-sync.shas a SessionStart hook in.claude/settings.json— this works natively, same as Claude Coderuntime_generate_instructions()AGENTS.mdfrom the shared templateSTUDIO.md(WP-CLI usage, site management, debugging, constraints, etc.)runtime_merge_mcp_servers().claude/settings.jsonand will load alongside Studio's built-instudioMCP servermcpServersin the SDK options; user servers from settings.json are additiveruntime_install()studioCLI is available (bundled with Studio desktop app)runtime_skills_dir().claude/skills/and.agents/skills/per siteruntime_print_summary()Differences from Claude Code runtime
npm i -g @anthropic-ai/claude-codewpstudio wp~/Studio/(sessions start here, sites are subdirs)studioserver.claude/skills/.claude/skills/+.agents/skills/(bundled by Studio)Open Questions
~/Studio/, not at the site root. Per-site CLAUDE.md may not be in scope until the agent navigates to a site directory. Need to test whether the preset discovers CLAUDE.md files in subdirectories or only atcwd.STUDIO.mdalready covers WP-CLI, debugging, constraints, etc. How much of theAGENTS.mdtemplate content overlaps? Need to audit and avoid duplication.Related
studio wpstdin pipe