wp-mirror

A website mirroring command that downloads the files needed to serve a copy of a site locally and identifies the root element containing each page’s main section.

In plain words
What is it for?
Use it to mirror a website for local development, inspect its page structure, and locate the main content section inside pages built with tools such as Elementor.
Why use it?
It helps create a working local copy without leaving downloaded links pointed at the live site. It also handles sites whose content is rendered in the browser after the initial page loads.

Command

Part of the wp-to-code plugin — 1 skill, 8 commands, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/abdulkader-safi/wp-to-code/wp-mirror
Clone the repo
git clone --depth 1 https://github.com/Abdulkader-Safi/wp-to-code

Or install wp-to-code, the plugin that ships this one along with the rest of its 1 skill, 8 commands, 1 hook.

Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 571 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00022 $0.00571
Opus 5 $0.00011 $0.00285
Sonnet 5 $0.00004 $0.00114
Haiku 4.5 $0.00002 $0.00057

Measured 2d ago against content hash cda276f70e5f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

wp-mirror scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/wp-to-code/commands/wp-mirror.md · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Mirror the source site: $ARGUMENTS.

node "${CLAUDE_PLUGIN_ROOT}/scripts/mirror.mjs" [--page <slug>] [--render] [--no-sweep]

What it does: downloads CSS, JS and fonts preserving path structure, follows stylesheets into their own dependencies, scans downloaded JS for bundles loaded lazily at runtime, then loads each page in a browser and picks up anything the mirror could not serve. Images and video stay remote on purpose; they are most of the bytes and the CMS owns them later.

Only paths actually downloaded get rewritten, in all four encodings the same URL appears in, so nothing quietly keeps pointing at the live site. If the original goes away, the mirror still works.

Use --render if the mirrored page comes back nearly empty. That means the site renders its content client-side and the raw HTML is a shell.

After mirroring: find the section root

The diff compares the direct children of one selector on each side. For a builder that scopes CSS per post, a page contains several roots (header, footer, content) and you want the content one.

grep -oE 'elementor-[0-9]+' .wp-to-code/mirror/home.html | sort | uniq -c | sort -rn

Then check each candidate:

node "${CLAUDE_PLUGIN_ROOT}/scripts/serve.mjs" &
NODE_PATH="${CLAUDE_PLUGIN_DATA}/node_modules" \
  node "${CLAUDE_PLUGIN_ROOT}/scripts/measure.mjs" --page home --mode sections --root ".elementor-42"

The right root is the one with the page's real sections, not two. Write it into pages[].originalRoot in the config.

Other builders: #et-boc .et_builder_inner_content (Divi), .fl-builder-content (Beaver Builder), .brx-content (Bricks), .wp-site-blocks (Gutenberg), .entry-content or main for a hand-coded theme.

Repeat per page. Roots differ between pages.

Serving it

The mirror is a plain directory on a fixed port with no framework in front of it. That is deliberate: it means the thing you are building can be any stack, on any other port, with no shared origin and no CORS problem.

Read the full file on GitHub · 46 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 46 lines · 22 tokens per session scan A cda276f70e5f

Subscribe to this mod's changes

wp-mirror is a command published in the GitHub repository Abdulkader-Safi/wp-to-code (2 stars, last pushed 14d ago), licensed MIT. It adds 22 tokens to every session and 571 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.