Fix 1: Add io_captured TINYINT(1) NOT NULL DEFAULT 0 to prv_call_meta CREATE (baked into initial schema — table is new in v0.3.0, no separate migration needed). PRV_Capture_Writer::write_io() sets io_captured=1 via set_io_captured() on success; error rows and legacy rows keep 0. Drawer state now driven by io_captured instead of config_version heuristic: 0 → Legacy/not-captured 1 + io → Normal 1 + no io → Pruned ARCHITECTURE.md schema section updated. Fix 2: Soften reconciliation copy in PRV_Costs_Renderer (~line 75): 'matches the Dashboard MTD total' → 'approximately reconciles to the Dashboard MTD total' — error calls write prv_call_meta (cost 0) but not prv_ai_visibility, so exact equality is not guaranteed. Fix 3: Harden security test (test-capture-writer Test 4): inject sentinel sk-or-TEST-LEAK-CANARY as PRV_OPENROUTER_API_KEY constant; queue a mocked 401 wp_remote_post response; drive PRV_Probe_Runner → PRV_Probe_Run_Executor → probe_one() 401 error path end-to-end; assert the sentinel, Bearer, and Authorization appear in NO stored row (prv_call_meta or prv_call_io). Original direct-writer security test retained as Test 3.
PR Vision
An internal WordPress plugin that runs weekly server-side LLM probes to measure whether peptiderepo.com is cited by AI assistants across core peptides.
v0.1.0 — AI-visibility dashboard only. Internal use; no public-facing output.
Purpose
GEO (Generative Engine Optimization) is peptiderepo.com's #1 strategic goal. This plugin provides the measurement instrument: weekly LLM probes → time-series storage → admin trendline + per-peptide standings.
The displayed metric is a directional proxy — API probes do not replicate the consumer ChatGPT/Gemini experience (different retrieval, personalisation, and system prompts), but they provide a consistent, trackable signal.
Required wp-config.php constants
// OpenRouter API key (sk-or-…) — required for all providers.
define( 'PRV_OPENROUTER_API_KEY', 'sk-or-YOUR_KEY_HERE' );
// Cloudflare AI Gateway routing (optional — falls back to direct OpenRouter).
define( 'PRV_CF_ACCOUNT_ID', 'YOUR_CF_ACCOUNT_ID' );
define( 'PRV_CF_GATEWAY_ID', 'YOUR_GATEWAY_NAME' );
Never commit these values. They are read at runtime from wp-config.php only.
Architecture
See ARCHITECTURE.md for the full file tree, data flow, and design decisions.
Admin page
Navigate to PR Vision in the WordPress admin sidebar (manage_options required).
The page shows:
- A proxy-metric disclaimer note.
- A Chart.js trendline of the visibility score across runs.
- A per-peptide standings table (cited?, our position, top competitor domains).
- Month-to-date cost vs. the monthly cap.
- A "Run now" button to trigger an on-demand probe run.
Scheduling
A weekly WP-Cron event (prv_weekly_probe) is registered on plugin activation and cleared on deactivation. Probe runs (cron or manual) respect the hard monthly budget cap.
Cost cap
Default cap: $5.00 USD/month (configurable via the prv_monthly_budget_usd option). The runner checks the month-to-date spend before each API call and stops gracefully when the cap is reached — partial runs are recorded, never over-spend.
Uninstall
Uninstalling the plugin drops the {prefix}prv_ai_visibility table and deletes all prv_* options. Deactivation only clears the cron schedule.
Developer notes
- PHP 8.1+ required. No runtime Composer dependencies.
- All classes prefixed
PRV_. All options/hooks prefixedprv_. - Files are kept under 300 lines; one class per file.
- See
CONVENTIONS.mdfor naming patterns and extension guides. - See
CONTEXT.mdfor the domain glossary including the visibility score formula.