Add initial plugin implementation per the CTO engineering handoff (geomonitor/threads/2026-06-ai-visibility-v1/01-cto-eng-handoff.md). ## What - PGM_Probe_Provider interface + PGM_Probe_Result value object - PGM_Perplexity_Provider (sonar via OpenRouter/CF AI Gateway) - PGM_OpenRouter_Provider (GPT-search + Gemini-search, generic parameterised) - PGM_Gateway_Client: shared HTTP + exponential-backoff retry (mirrors PRAB) - PGM_Citation_Detector: domain extraction, is_cited(), get_our_position() - PGM_Cost_Ledger: MTD cost from DB, can_afford() pre-check, hard monthly cap - PGM_Probe_Runner: peptides×intents×models run, budget abort, in-run cache - PGM_Table_Manager: pgm_ai_visibility dbDelta, schema-version, drop_table() - PGM_Config: typed getters, seed_defaults() (12 peptides, 3 intents, 3 models) - PGM_Cron: weekly pgm_weekly_probe schedule/clear - PGM_Data_Collector + PGM_Dashboard_Panel interfaces (seam for future panels) - PGM_Collector_Registry: singleton registry - PGM_Ai_Visibility_Collector: trendline, standings, MTD cost (score formula) - PGM_Ai_Visibility_Panel: proxy note, Chart.js trendline, standings table - PGM_Admin_Page: GEO Monitor menu, Run now POST handler (nonce+capability) - uninstall.php: DROP TABLE + DELETE pgm_* options + wp_clear_scheduled_hook - Unit tests (6 files): citation detection, score calc, cost ledger + budget abort, provider response parsing (mock HTTP), cron, uninstall purge - ARCHITECTURE.md, CONVENTIONS.md, CONTEXT.md (score formula), README.md, CHANGELOG.md — same-commit per DoD - CI workflow: PHP lint (8.1/8.2/8.3) + PHPCS + 300-line check ## Security - Secrets from wp-config constants only; none hardcoded - manage_options + nonce on every admin action - Input sanitized; output escaped Agent-Session: geomonitor v0.1.0
Peptide GEO Monitor
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( 'PGM_OPENROUTER_API_KEY', 'sk-or-YOUR_KEY_HERE' );
// Cloudflare AI Gateway routing (optional — falls back to direct OpenRouter).
define( 'PGM_CF_ACCOUNT_ID', 'YOUR_CF_ACCOUNT_ID' );
define( 'PGM_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 GEO Monitor 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 (pgm_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 pgm_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}pgm_ai_visibility table and deletes all pgm_* options. Deactivation only clears the cron schedule.
Developer notes
- PHP 8.1+ required. No runtime Composer dependencies.
- All classes prefixed
PGM_. All options/hooks prefixedpgm_. - 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.