Ad Ex Machina
Ads out of the Machine. Built to turn allotted ad budgets into paying customers — never vanity clicks, DIY browsers, student researchers, or cannibalized brand traffic.
Every capability in this skill is backed by zero-dependency Python 3.10+ executables in scripts/. Do not improvise raw curl loops, unvalidated mutations, or unresearched ad copy when a deterministic tool below already enforces the guardrails.
0. Iron Law — Zero Credential Exposure
- Credentials never enter any repository, prompt, commit, or markdown report.
developer_token, OAuthclient_id/client_secret/refresh_token, and Customer IDs live only in~/.google-ads.yaml(chmod 600) or environment variables outside Git.scripts/gads.pyrefuses to execute if the config file sits inside a Git working tree.
- Pre-flight scan before peer dispatch or publishing:
python3 scripts/secret_guard.py . python3 scripts/secret_guard.py --check-cred-file ~/.google-ads.yaml
1. Built-In Executable Toolkit
| Script | What It Does | Key Commands |
|---|---|---|
scripts/gads.py | Rate-shielded Google Ads REST + Keyword Planner + Offline Conversion CLI (searchStream, dual token-bucket limiter, TTL cache, mandatory validateOnly dry-run). | onboarding, doctor, accounts, audit <CID>, keyword-planner <CID>, search-terms <CID>, query <CID> "<GAQL>", mutate <CID> --ops-file ops.json [--apply], offline-upload <CID> |
scripts/gsuite_telemetry.py | Google Search Console organic-moat detector & GA4 paid landing-page funnel auditor. | auth-guide, gsc-sites, gsc-organic-moat --site sc-domain:example.com, ga4-properties, ga4-funnel --property <ID> |
scripts/research_vault.py | Free Ad Library deep-linker (Google Transparency, Meta, LinkedIn, TikTok), public forum VoC harvester, and Human-First RSA policy/anti-slop linter. | ad-libraries --vertical "..." --competitors "a.com,b.com", mine-anecdotes --query "...", lint-rsa rsa.json |
scripts/triad_router.py | Anti-Model-Tampering Protocol (AMTP) workspace planner & cross-model artifact gatekeeper (triad or solo mode). | plan --workspace ./runs/r1 --mission "..." --mode triad, verify-gate --workspace ./runs/r1 --gate all |
scripts/self_improve.py | Scrubbed empirical lesson recorder & deterministic guardrail synthesizer (2026–2027 eval-first loop). | record --category search_term_leak ..., synthesize |
scripts/secret_guard.py | Blocks leaked tokens, keys, PEM blocks, non-placeholder emails, and live CIDs. | secret_guard.py . |
2. Anti-Model-Tampering Protocol (AMTP) — Model Routing
When a single agent researches competitors, edits landing pages, configures conversion actions, mutates Google Ads, and grades its own work in one context, it tampers with the scoreboard (counting soft scroll/tool events as primary leads, bidding on existing brand customers, or pointing ads at broken forms).
Route substantive builds across three sovereign lanes — or run --mode solo when only one model is available so deterministic gates still separate every stage. Full specification: references/anti-model-tampering.md.
| Lane | Preferred Model Family | Owns | Hard Tampering Boundary |
|---|---|---|---|
| 1. Recon, Browser & Creative | OpenAI Codex (Browser-use + image/creative + adversarial review) | Scrapes public Ad Libraries & live SERPs, mines Reddit/review buyer language, generates visual ad creative & image briefs, and reviews diffs/ops adversarially. | Read-only on googleAds:mutate and backend routes. Outputs 01-research-dossier.json. |
| 2. Website & Conversion Stack | Anthropic Claude (Frontend, backend, UX & conversion tagging) | Builds /lp/* landing pages, 2-step mobile forms, /api/contact + CRM webhooks, gclid capture, Enhanced Conversions, WEBSITE_CALL forwarding, and post-submit /thank-you calendar embeds. | Cannot alter Google Ads customConversionGoals to mask low conversion rates. Outputs 02-conversion-surface-manifest.json. |
| 3. Ads Mechanics & Telemetry | Google AGY / Gemini (1M-context GAQL, Keyword Planner & creative setup) | Runs gads.py audit, keyword-planner, gsc-organic-moat, ga4-funnel, creative asset assembly, Custom Goal isolation, and atomic validateOnly -> --apply mutations. | Must pass research_vault.py lint-rsa + triad_router.py verify-gate before --apply. Outputs 03-mutate-operations.json. |
Solo-Model Fallback: Any single frontier model (Claude alone, AGY/Gemini alone, or Codex alone) can execute all three lanes end-to-end by initializing
python3 scripts/triad_router.py plan --mode solo ...and passingverify-gate(research->surface->ads) between phases.
3. End-to-End Execution Workflow
Step 1 — Bootstrap Access & Telemetry Health
If credentials are not yet configured, run python3 scripts/gads.py onboarding and python3 scripts/gsuite_telemetry.py auth-guide (full documentation in references/api-access-and-rate-limits.md). Otherwise verify connectivity first:
python3 scripts/gads.py doctor
python3 scripts/gads.py audit 1234567890
python3 scripts/gsuite_telemetry.py gsc-organic-moat --site sc-domain:example.com
python3 scripts/gsuite_telemetry.py ga4-funnel --property 123456789
Step 2 — Steal Proven Market Angles & Real Human Language
Good artists borrow; great artists steal. Never invent ad copy out of thin air:
python3 scripts/research_vault.py ad-libraries \
--vertical "commercial hvac repair" \
--competitors "competitor-one.com,competitor-two.com"
python3 scripts/research_vault.py mine-anecdotes --query "fired our seo agency"
Follow references/ad-library-and-human-copy.md to extract ads running >= 60 days and real buyer switching triggers into 01-research-dossier.json.
Step 3 — Model Keyword Economics & Channel Fit (Search vs. LSA)
Query real search volume and top-of-page CPC bounds before setting budgets or bid caps:
python3 scripts/gads.py keyword-planner 1234567890 \
--mode metrics \
--keywords "emergency plumber near me,water heater repair,commercial plumber" \
--geo 2840
Apply the 7 Non-Negotiable Campaign Laws:
- Zero Junk Match Types on Constrained Budgets (
<$150/day): Use 100%[EXACT]match (or tightly qualified high-intent phrases only in hyper-local zip radiuses) backed bytemplates/universal-negatives.json. PauseBROADunless feeding50+verified offline revenue conversions/month. - Never Starve CPC Caps Below Top-of-Page Low Bid: Setting a
$9Max CPC cap in a$16market locks ads out of buyer auctions and forcesTARGET_SPEND(Maximize Clicks) to buy$2student/DIY junk. Set ceilings at1.15x–1.30xKeyword Planner'stop_of_page_cpc_high_usdon pure[EXACT]buyer terms. - Isolate Conversion Goals cleanly: Demote soft events (
PAGE_VIEW, scroll depth, free audit email gates) toprimaryForGoal: false. When using a campaign Custom Goal, set overlapping standardcampaign_conversion_goalrows tobiddable: false. - Never Pay for Customers You Already Own (Brand & Organic Moat Check): Check
gsc-organic-moat+ GA4 organic conversion rates before running Brand Defense. If you own#1organic + a dominant GBP Knowledge Panel and competitors are not actively conquesting your name, put 100% of budget into net-new non-brand acquisition. - LSA vs. Search Follows Review Moat: For local trades, put budget into Google Local Services Ads (LSA) where your linked GBP already holds a massive review lead (
150–400+5★ reviews + live 3-ring phone pickup). Use Search for new expansion territories (where a brand-new GBP has too few reviews to rank in LSA) and for high-ticket specialty jobs (e.g., termite tenting, full system replacements) that LSA categories blur. - Close Every Conversion Leak on
/lp/*: Surface tracked click-to-call (WEBSITE_CALLforwarding snippet, 60s+ call threshold) on all paid landers, use 2-step progressive forms on mobile dialogs, and place booking calendars on/thank-youafter form submit — never as an untracked pre-form outbound tab that dropsgclid. - Human Copy Only — Lint Before Mutating: Every RSA must pass
research_vault.py lint-rsa(<=30char headlines,<=90char descriptions,<=15char paths,0exclamation marks in headlines,0single-pinPOORtraps,0synthetic buzzwords, concrete proof numbers + risk reversal).
Step 4 — Atomic Dry-Run (validateOnly) -> Live Apply -> Read-Back
Batch budgets, campaigns, ad groups, keywords, and RSAs using temporary negative IDs (templates/atomic-campaign-build.example.json):
python3 scripts/research_vault.py lint-rsa rsa-spec.json
python3 scripts/triad_router.py verify-gate --workspace ./runs/r1 --gate all
python3 scripts/gads.py mutate 1234567890 --ops-file ./runs/r1/03-mutate-operations.json # validateOnly=true dry-run
python3 scripts/gads.py mutate 1234567890 --ops-file ./runs/r1/03-mutate-operations.json --apply # live atomic commit
python3 scripts/gads.py audit 1234567890 # read-back verification
4. Self-Improvement Loop (2026–2027 Standard)
After every 7-day search-term review, GA4 funnel check, or offline CRM upload (gads.py offline-upload), record empirical findings via scripts/self_improve.py and promote recurring patterns into deterministic code inside scripts/ + regression tests in evals/run_evals.py. Read references/self-improvement-2026-2027.md before modifying this skill.