You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Propose rtcamp/wp-dev-tools: an optional, dev-only package (chosen during scaffolding) that gives a coding agent — Claude Code or any MCP client — live runtime data it can't get from the code alone: what queries ran, what errored, what's slow, and which Core Web Vitals are poor and why. The agent already has the code and does the reasoning; dev-tools hands it the runtime truth, with the real file:line.
The proven seed already exists: the Query Monitor → telemetry → Abilities API → MCP module on rtcamp/wp-framework's feature/telemetry-abilities branch (PR rtCamp/wp-framework#45, idea #40) — the profile → fix → prove loop works today.
Planning/discussion issue. Nothing is built or moved yet; PR #45 stays as-is.
What goes where
Repo
Role
wp-dev-tools (new, require-dev, dev-only)
The package: Telemetry module, Core Web Vitals module, read-only diagnostic abilities, and the dev config it ships (.mcp.json, dev .wp-env.json keys).
One opt-in scaffold: on init, offer "enable dev tools?"; if yes, add wp-dev-tools to require-dev and drop .mcp.json + the dev .wp-env.json keys.
How it reaches the coding agent (Abilities API → MCP)
Each diagnostic is an ability — a named function with an input/output JSON schema and a permission_callback — registered through the core Abilities API (wp_register_ability()). The only extra step to expose one is flagging meta.mcp.public = true.
The official WordPress/mcp-adapter plugin runs in the dev environment (installed via .wp-env.json).
It auto-exposes every ability marked meta.mcp.public = true as an MCP tool — no custom MCP server to write.
The project ships a .mcp.json; the coding agent connects over STDIO (through wp-env's CLI container) and sees the abilities as callable tools.
The loop in practice: the agent calls profile-url on a slow page → get-telemetry returns the duplicate queries with the real file:line → the agent opens that file and fixes it → compare-requests proves the query count dropped. Same shape for CWV: get-web-vitals returns "LCP element = hero image, blocked by 12 duplicate queries in inc/Hero.php:42."
What dev-tools ships
All abilities are read-only, hard-gated to local + dev-mode, and return host-translated file:line so the agent opens the exact source.
Built on Query Monitor: each request is captured, normalized, and kept in a small per-site ring buffer, then surfaced read-only through these abilities.
list-requests — recent captures with headline metrics
get-telemetry — full normalized request: DB queries (duplicate/slow + backtrace), PHP errors, HTTP calls, assets, timing/memory
profile-url — fresh multi-sample capture of a same-site URL
compare-requests — before/after deltas to prove a fix
Core Web Vitals (exposed via abilities)
A tiny web-vitals (attribution build) snippet, enqueued behind the dev gate, beacons LCP / INP / CLS plus the offending element to a dev route and stores it on the matching telemetry record.
get-web-vitals — returns the field metrics + attribution for a URL/request, correlated with the server telemetry (e.g. "LCP element = hero image; TTFB = 12 duplicate queries in inc/Hero.php:42").
analyze-cwv(later) — lab data via PSI/Lighthouse for a URL (PSI key declared as a secret, never hardcoded).
More diagnostic abilities (as they prove useful)
list-duplicate-queries / list-slow-queries — N+1s and >500ms queries with stacks
get-hooks-fired, get-http-calls, cache-stats, deprecation-notices — further read-only signals
Opt-in scaffold (this repo's piece)
wp-dev-tools owns a dev/tools scaffold (+ index.json); wp-tooling adds the repo to scaffolds/sources.json once. It's a feature{} (config_key: "dev-tools") that adds rtcamp/wp-dev-tools to require-dev (with the VCS repositories entry) and writes .mcp.json + the dev .wp-env.json keys. /init offers it; toggle later via wp-tooling features --enable/--disable dev-tools. The engine prints the install command rather than running it. A production (--no-dev) install simply won't have it.
Summary
Propose
rtcamp/wp-dev-tools: an optional, dev-only package (chosen during scaffolding) that gives a coding agent — Claude Code or any MCP client — live runtime data it can't get from the code alone: what queries ran, what errored, what's slow, and which Core Web Vitals are poor and why. The agent already has the code and does the reasoning; dev-tools hands it the runtime truth, with the realfile:line.The proven seed already exists: the Query Monitor → telemetry → Abilities API → MCP module on
rtcamp/wp-framework'sfeature/telemetry-abilitiesbranch (PR rtCamp/wp-framework#45, idea #40) — the profile → fix → prove loop works today.What goes where
wp-dev-tools(new,require-dev, dev-only).mcp.json, dev.wp-env.jsonkeys).wp-frameworkRegistrable/Loader/AbstractModulecontracts.wp-tooling(this repo)init, offer "enable dev tools?"; if yes, addwp-dev-toolstorequire-devand drop.mcp.json+ the dev.wp-env.jsonkeys.How it reaches the coding agent (Abilities API → MCP)
Each diagnostic is an ability — a named function with an input/output JSON schema and a
permission_callback— registered through the core Abilities API (wp_register_ability()). The only extra step to expose one is flaggingmeta.mcp.public = true.WordPress/mcp-adapterplugin runs in the dev environment (installed via.wp-env.json).meta.mcp.public = trueas an MCP tool — no custom MCP server to write..mcp.json; the coding agent connects over STDIO (through wp-env's CLI container) and sees the abilities as callable tools.The loop in practice: the agent calls
profile-urlon a slow page →get-telemetryreturns the duplicate queries with the realfile:line→ the agent opens that file and fixes it →compare-requestsproves the query count dropped. Same shape for CWV:get-web-vitalsreturns "LCP element = hero image, blocked by 12 duplicate queries ininc/Hero.php:42."What dev-tools ships
All abilities are read-only, hard-gated to local + dev-mode, and return host-translated
file:lineso the agent opens the exact source.Telemetry (relocated from PR #45)
Built on Query Monitor: each request is captured, normalized, and kept in a small per-site ring buffer, then surfaced read-only through these abilities.
list-requests— recent captures with headline metricsget-telemetry— full normalized request: DB queries (duplicate/slow + backtrace), PHP errors, HTTP calls, assets, timing/memoryprofile-url— fresh multi-sample capture of a same-site URLcompare-requests— before/after deltas to prove a fixCore Web Vitals (exposed via abilities)
web-vitals(attribution build) snippet, enqueued behind the dev gate, beacons LCP / INP / CLS plus the offending element to a dev route and stores it on the matching telemetry record.get-web-vitals— returns the field metrics + attribution for a URL/request, correlated with the server telemetry (e.g. "LCP element = hero image; TTFB = 12 duplicate queries ininc/Hero.php:42").analyze-cwv(later) — lab data via PSI/Lighthouse for a URL (PSI key declared as a secret, never hardcoded).More diagnostic abilities (as they prove useful)
list-duplicate-queries/list-slow-queries— N+1s and >500ms queries with stackscheck-autoload-bloat— oversized / orphanedautoload='yes'options + latency impactcron-health— overdue / duplicate scheduled eventsget-hooks-fired,get-http-calls,cache-stats,deprecation-notices— further read-only signalsOpt-in scaffold (this repo's piece)
wp-dev-toolsowns adev/toolsscaffold (+index.json);wp-toolingadds the repo toscaffolds/sources.jsononce. It's afeature{}(config_key: "dev-tools") that addsrtcamp/wp-dev-toolstorequire-dev(with the VCSrepositoriesentry) and writes.mcp.json+ the dev.wp-env.jsonkeys./initoffers it; toggle later viawp-tooling features --enable/--disable dev-tools. The engine prints the install command rather than running it. A production (--no-dev) install simply won't have it.Suggested build order
wp-dev-toolsrepo and move the PR chore(deps): bump fast-uri from 3.1.2 to 3.1.4 #45 telemetry tree into it (re-namespaced); port its tests.get-web-vitalsability, correlated onto telemetry records.dev/toolsopt-in scaffold here inwp-tooling+ the/initprompt.features-plugin-skeletonandtelemetry-test-plugin.Open questions
.wp-env.json.References: rtCamp/wp-framework#45, rtCamp/wp-framework#40