Concepts
How wp2next is put together: phases and checkpoints, the three modes, the parity gate, the two config files, how secrets are handled, companion skills, playbooks, and where every report lands. Read it once before your first client build. To get going first, see Quick start. Terms are defined in the glossary.
What a build produces
wp2next is an Agent Skill. Your agent reads its instructions and rebuilds a WordPress site from a copy in Local as a pnpm monorepo:
| Folder | What it is |
|---|---|
apps/web | The website: Next.js 16, React 19, Tailwind v4 used only as a token engine, CSS Modules. Deployed on Vercel |
apps/studio | Sanity Studio, where editors change content. Hosted by Sanity |
packages/sanity | Schema, queries, projection types and the seed that imports WordPress content |
packages/brand | The brand's single source (logos, colors, fonts) and the generated root DESIGN.md |
Two private working pages ship with every site: a brand guide at /brand/ and a component library
at /components/. They are never linked or indexed and are off in production unless you turn them on
(WP2NEXT_BRAND_ROUTE / WP2NEXT_COMPONENTS_ROUTE; see
Troubleshooting).
wp2next runs on macOS, native Windows (PowerShell 7) and Linux, with WSL2 as an advanced Windows option (Windows). Its helper scripts are Python and Node, so the agent runs the same commands on every system; where a shell step differs, the docs show each system. The docs assume the Claude desktop app's Code tab as the AI tool by default; Claude Code in a terminal, Codex and Cursor work too (AI environments).
The code rules every build follows (no inline styles, one CSS Module per component, shared components
only, enforced by pnpm lint) are pasted into each project's CLAUDE.md. The canonical copy is
skills/wp2next/references/process-rules.md (external site).
Phases and checkpoints
migrate runs an interview (phase 0) and then twelve phases. Each phase ends with a checkpoint,
and the next phase doesn't start until it passes. Phases 1–12 are tracked in wp2next.json →
phases, which is how status and a resumed session know where you are.
| # | Phase | What happens | Checkpoint (short) |
|---|---|---|---|
| 0 | Interview | Site questions; echo-back table of every name to be created; wp2next.json written | You said yes to the table |
| 1 | Inventory | Read-only look at the WordPress database and files; builder detected, playbook matched | Pages, posts, menus, forms, tracking, consent banner, fonts, breakpoints and redirects listed |
| 2 | Snapshot | Content exported, every URL rendered to HTML, media copied | One rendered file per URL |
| 3 | Scaffold | Monorepo created (Node 24, pnpm 11.10.0, Next 16), /brand/ and /components/ routes | pnpm lint and pnpm typecheck pass |
| 4 | Parity baseline | WordPress screenshots at 390/1440/1920/2560 px, Lighthouse baseline of the old site | Every probe resolves |
| 5 | Tokens and chrome | Design tokens, fonts, header, footer, tracking wiring, brand package seeded from WordPress | Tokens and chrome show in /components/; /brand/ renders |
| 6 | Content contract | Types and queries for the content model | pnpm typecheck passes |
| 7 | Sanity | Sanity project, schema, converter, repeatable seed, Studio | Studio loads and saves; seed reruns cleanly. Asks before creating |
| 8 | Blocks and routes | Blocks, every WordPress URL, redirects, metadata, sitemap, forms endpoint | Every old URL returns 200 or its redirect; seo parity run |
| 9 | Parity loop | Old vs new compared on the production build; Lighthouse on the new site | You sign off parity (pixel, faithful) |
| 10 | Mobile and quality | Phone and tablet layouts, design critique and accessibility audit | Departures approved and recorded |
| 11 | Infrastructure | GitHub repo, Vercel project and env, Sanity webhook | Pushes deploy; one real submission per form reaches every destination. Asks before each resource |
| 12 | CLAUDE.md and cutover (go-live) | Client CLAUDE.md and cutover checklist; tracking on in Vercel Production (still noindex); gates A (compliance), B (Lighthouse) and C (SEO parity) on the production deployment with tracking on; NEXT_PUBLIC_SITE_INDEXABLE=true; domain and DNS; post-launch compliance re-scan; then it offers handoff and report | Gate A: no open high-severity compliance finding; gate B: no Accessibility/SEO Lighthouse regression vs WordPress; gate C: no unapproved seo parity regression; post-launch re-scan done |
The agent-facing detail for each phase is in skills/wp2next/references/commands/migrate.md (external site). Plain-language version for site owners: Step 6: Rebuild your site (migrate).
Departures. Any intentional difference from the WordPress site is a departure: it needs your
approval and is recorded in the project CLAUDE.md and wp2next.json → departures, so the next
developer knows it was on purpose.
The three modes
migrate asks for one mode per site; parity.defaultMode in your user config pre-selects it.
| Mode | Desktop | Phones and tablets | Phase 9 | Parity gate |
|---|---|---|---|---|
| pixel | Matches WordPress; probes within 0.5 px on the production build | Redesigned below the site's own breakpoint | Automated pixel parity loop, then sign-off | Yes |
| faithful | Same content, structure and brand; small cleanups allowed | Redesigned | Parity run as a visual review, then sign-off | Yes |
| facelift | New visual design | New design | Content parity (URLs, headings, links, forms) | No |
All modes keep the content, URLs, search signals, forms and tracking, and all follow the same code rules; in facelift only the values (tokens, layout) change. Choosing between them: Facelift: new design, same site.
The parity gate
Parity is always measured on a production build (next build && next start), with data-parity
selectors, never on next dev.
In pixel and faithful mode, nothing may change the look until you sign off parity (recorded as
parity.signedOff in wp2next.json, with date and who). Until then:
- only the companion skills marked safe before parity are loaded, and wp2next's overrides apply
(no
next/image,next/font, Tailwind utilities orprose); optimizeonly reports, or applies changes with no visual effect;contentcopy changes in pixel mode are departures.
After sign-off, the agent offers optimize: it splits findings into safe fixes (applied, then
verified with a parity re-run) and design-changing ones (each proposed as a departure). A later change
that moves desktop pixels means re-running parity; if it fails, the sign-off is cleared.
The two config files
Neither file ever holds a secret.
| File | Where | Holds | Written by |
|---|---|---|---|
| User config | ~/.config/wp2next/config.json (Windows: C:\Users\<you>\.config\wp2next\config.json; $XDG_CONFIG_HOME/wp2next/config.json if set) | Your defaults: role, account owners, plans, naming patterns, secret backend, form destinations, tracking, parity mode, agent, companion skills, install method | init |
| Project config | <repo>/wp2next.json (committed) | One site: code, domain, Local slug, names, Sanity project, mode, breakpoint, form and tracking IDs, SEO and compliance choices, phase progress, departures, parity sign-off, wp2next version, report state | migrate and later commands |
Precedence is project > user > built-in default, and objects deep-merge. Values from config
pre-fill every question, so migrate doesn't re-ask what your defaults already settle. Both files
are read and written through config.py, which validates enums and ID formats and refuses
secret-looking values.
Every key: Configuration reference. The helper: Scripts.
Secrets
A build needs a handful of private values: Sanity tokens, the revalidation secret, form-sending keys (Resend, HubSpot, monday.com, webhook). The model:
- Two places. Your secret store holds everything, including tokens only your machine needs. Vercel environment variables hold what the live site needs. Deploy-time values go to both, because Vercel "Secret" values can't be read back.
- One shim. The agent goes through
scripts/secrets.py(the same on macOS, Windows and Linux; the oldersecrets.shnow just hands over to it):putreads a value from stdin or a hidden prompt,run -- <cmd>injects values into a command,listshows names only. There is noget. - Never printed. No secret in chat, logs, commits, command arguments,
.env.example,wp2next.jsonor the user config. The agent never displays.envfiles orvercel env pulloutput. If a value leaks by accident, it says so and asks you to rotate it. - Never public. Tokens never go under
NEXT_PUBLIC_*, which ships to every visitor's browser. - Your manager. Supported backends: 1Password, Keeper, Bitwarden Secrets Manager, Doppler,
Infisical, macOS Keychain (Mac only), Vercel as the source of truth, or plain
.envfiles.
Choosing and setting up a backend: Secrets: where wp2next keeps passwords and API keys. Every variable a site uses: Environment variables.
Companion skills
Optional skills and plugins from other teams (Sanity, Vercel, the Next.js team, Microsoft's
Playwright, Resend, and others) that add know-how for parts of the job. init offers them in bundles;
every phase works without them.
| Bundle | Examples | When |
|---|---|---|
| Build helpers | Sanity toolkit, React best practices, composition patterns | During the build; safe before parity |
| Deploy helper | Vercel CLI skill (light) or the Vercel plugin (adds MCP, hooks and telemetry) | Phase 11, cutover, handoff |
| After-parity review | Web design guidelines, Vercel optimize, Next.js skills, Next devtools MCP | Only through optimize, after sign-off |
| Browser checks | Playwright | Looking at the live site, visual checks |
| Writing | humanizer | content drafts |
| Resend skills | When forms send email (the default) |
wp2next decides when each one is loaded, and wp2next's rules win where a companion's advice conflicts. Nothing is installed without your yes, one command at a time. Details, install commands per agent and privacy notes: Companion skills.
impeccable is separate: it powers critique, audit, polish and design work in facelift, and
is switched on by quality.useImpeccable.
Playbooks
WordPress sites are built in very different ways. A playbook holds what is specific to one builder or theme type: how to detect it, where its content lives, how to export and convert it, and the parity traps it causes. In phase 1 the agent checks the database and rendered HTML for detection signals and reads every matching playbook (a site can match two) before scaffolding.
| Status | Meaning |
|---|---|
| tested | Two or more migrations |
| draft | One migration |
| stub | Detection signals only, from public knowledge; unverified |
Current playbooks cover Gutenberg, block themes (including the REST export when there is no Local copy), PHP-template themes, and stubs for Elementor, Divi, WPBakery, Beaver Builder, Bricks, Oxygen and Avada. The index with detection signals: skills/wp2next/references/playbooks/index.md (external site).
No match, or only a stub? The agent keeps notes in .wp2next/notes/<builder>.md as the build goes,
and wp2next contribute later turns them into a scrubbed playbook pull request (with a yes at each
step). No client names, domains, IDs or people ever go in a playbook.
Where reports go
Everything lands inside the project repo.
| Report | Path | In git? |
|---|---|---|
| Project state | wp2next.json | Committed |
Status dashboard (status --dashboard) | .wp2next/status.html | Ignored (rebuilt from committed data) |
| Lighthouse runs | .wp2next/lighthouse/<label>-<date>.json | Committed (baselines) |
| SEO parity, audit, AI search | .wp2next/seo/ (parity-<date>.md, audit-<date>.md, aeo-<date>.md) | Committed |
| Content audit, plans, rewrite ledgers | .wp2next/content/ | Committed |
| Voice guide | docs/content/voice.md | Committed |
| Optimize reports | .wp2next/optimize/<date>-<area>.md | Committed (*-tmp/ ignored) |
| Builder notes for playbooks | .wp2next/notes/<builder>.md | Committed |
| Compliance scans | .compliance/reports/<YYYY-MM-DD>.md (+ .json) | Your call; ignore .compliance/ if the repo is public |
| Design critique, audit, polish | .impeccable/reports/<date>-<kind>-<slug>.md (polish: inside its own worktree) | Not committed by the side process |
| Parity report | apps/web/parity/report.html | — |
| Tracking setup | docs/analytics/README.md (+ gtm-container.json with GTM) | Committed |
| Brand sign-off | docs/brand-signoff.md | Committed |
Handover runbook (written by handoff) | HANDOFF.md | Committed |
Drafts for report, feedback, contribute | .wp2next/report/, .wp2next/feedback/, .wp2next/contrib/ | Ignored |
| Upgrade scratch | .wp2next/upgrade/*/ | Ignored |
Older projects may lack the .gitignore lines; status offers to add them.
How the agent behaves
- Asks before anything outside the repo: every account resource, DNS change, secret-store entry, Sanity write (drafts included), install, transfer or post. One yes covers one action.
- WordPress is read-only. It never writes to the Local database or the live site, and never reads personal-data tables (users, comments, form entries, orders).
- Content is never published by the agent.
content,seo fixandoptimize structurewrite Sanity drafts; the client reviews and publishes in Studio. It never invents claims, testimonials, numbers or prices. - Side processes don't block.
critique,audit,polish,optimize,seo auditandcontent auditrun as a background subagent in Claude Code, a separate session elsewhere, or inline. - Nothing private leaves the machine.
report,feedbackandcontributeshare only generic facts, every draft passes a scrub check, and each sends only after a yes. - Compliance output is not legal advice.