---
name: ad-anything
description: Polymorphic 5-domain deterministic ad creative compiler: competitor landing-page hook dissection, 30+ character-limit-enforced scripts (Google RSA <=30/<=90, Meta, TikTok 3s hook, LinkedIn), hero A/B HTML/JSON variants, strict-XML multi-size SVG creatives (1080x1080, 1080x1920, 1200x628), ad-policy preflight rewrites, and Google/Meta RFC 4180 CSV exports via REST, JSON-RPC 2.0 /mcp, 0%-commission Treg Hub, or run_hand.py. Strictly bills $0 on empty, HTTP 422, SSRF, or error responses.
---

# Ad-Anything — Agent-Executable Skill Handbook

Use **Ad-Anything** (`https://ad.fastmesh.dev`, local dev `http://127.0.0.1:9007`) whenever an autonomous marketing agent, growth workflow, or ecommerce pipeline needs launch-ready, policy-checked ad creatives with exact platform character bounds, lossless vector SVGs (zero garbled raster typography), and bulk import CSVs from a single public URL or product brief.

---

## Core Surfaces & Distribution Channels

- **Web 5-Second Try-Now Storefront (zero signup)**: `https://ad.fastmesh.dev/`
- **Full 5-Domain Compile API**: `POST https://ad.fastmesh.dev/v1/compile`
- **Landing-Page Hook Dissector API**: `POST https://ad.fastmesh.dev/v1/dissect`
- **Deterministic Vector SVG Pack API**: `POST https://ad.fastmesh.dev/v1/svg`
- **Policy Pre-Flight & Safe Rewriter API**: `POST https://ad.fastmesh.dev/v1/preflight`
- **Concurrent Batch SKU Compiler API**: `POST https://ad.fastmesh.dev/v1/batch`
- **Native Streamable MCP Server (JSON-RPC 2.0)**: `POST https://ad.fastmesh.dev/mcp`
- **OpenAPI 3.1.0 Specification**: `GET https://ad.fastmesh.dev/openapi.json`
- **Health & Readiness**: `GET https://ad.fastmesh.dev/health`
- **Treg Hub 0%-Commission Package**: `ad_anything_compile` (`c07_ad_anything_v1`)
- **Causal Bazaar Edge Hand**: `run_hand.py` (`hand_id: c07_ad_anything_hand_v1`, `card_id: c07_ad_anything_v1`)
- **Discovery & Sitemap**: `https://ad.fastmesh.dev/llms.txt` & `https://ad.fastmesh.dev/sitemap.xml`

---

## Per-Call Pricing, Prepaid Packs & Invariants

| Endpoint / Mode | Scope | Base Rate | Same-Tenant Recheck (`10%`) | Invalid / `422` / SSRF / Error |
| :--- | :--- | :---: | :---: | :---: |
| `/v1/compile` (`compile`) | Dissection + 30+ scripts + Hero A/B + 3 SVG sizes + policy preflight + Google/Meta CSVs | `$0.05` (`50,000` micros) | `$0.005` (`5,000`) | `$0.00` |
| `/v1/dissect` (`dissect`) | Public URL / HTML above-the-fold UVP, social proof, price anchor, guarantee & attack wedges | `$0.02` (`20,000` micros) | `$0.002` (`2,000`) | `$0.00` |
| `/v1/svg` (`svg`) | Strict-XML `1080x1080`, `1080x1920`, `1200x628` vector SVGs with deterministic word-wrap | `$0.025` (`25,000` micros) | `$0.0025` (`2,500`) | `$0.00` |
| `/v1/preflight` (`preflight`) | Meta/Google/TikTok policy violation check + safe third-person/benefit rewrites | `$0.015` (`15,000` micros) | `$0.0015` (`1,500`) | `$0.00` |
| `/v1/batch` (`batch`) | Multi-SKU concurrent compilation capped at `max_spend_usd <= 2.00` | Sum of valid items | `10%` on cache recheck | `$0.00` per failed item |

**Non-Expiring Creem Prepaid Credit Packs** (zero monthly burn, zero auto-renewing seat lock-in):
- **Starter (`ad_starter_19`)**: `$19` -> `50` full compiles (`$0.380`/compile)
- **Growth (`ad_growth_59`)**: `$59` -> `200` full compiles (`$0.295`/compile)
- **Scale (`ad_scale_149`)**: `$149` -> `750` full compiles (`$0.199`/compile)

### Non-Negotiable Safety & Billing Guarantees

1. **Strict Platform Character-Limit Enforcement**:
   - **Google Ads RSA**: Headlines `<= 30` chars (`15+` generated), Descriptions `<= 90` chars (`4+` generated), `Path 1`/`Path 2 <= 15` chars.
   - **Meta Ads**: Primary text `<= 125` chars visible (`500`–`2,200` cap), Headline `<= 40` chars, Link Description `<= 30` chars.
   - **TikTok Ads**: 3-second hook `<= 60` chars (`<= 40` visual safe zone), Body `<= 150` chars (`<= 100` in-feed cap), CTA `<= 25` chars.
   - **LinkedIn Ads**: Intro `<= 150` chars (`600` hard cap), Headline `<= 70` chars.
2. **Strict XML SVG Guarantee**: Every generated SVG (`1080x1080`, `1080x1920`, `1200x628`) escapes `<>&"'`, uses deterministic line wrapping and font scaling to prevent clipping/overflow, and passes `xml.etree.ElementTree.fromstring`.
3. **SSRF & Unbilled `422` Guard**: Loopback (`127.0.0.0/8`, `localhost`, `::1`), RFC 1918 private IPs (`10/8`, `172.16/12`, `192.168/16`), link-local / cloud metadata (`169.254.169.254`, `metadata.google.internal`), non-HTTP(S) schemes, empty/sentinel inputs, and fake-200 HTML shells return HTTP `422` at `$0.00`.
4. **Hard `$2.00` Spend Cap**: `/v1/batch` and `run_hand.py` enforce `max_spend_usd <= 2.00` (`2,000,000` micros).
5. **Zero Data Resale (`zero_data_resale: true`)**: Pure Python 3 stdlib execution — customer copy, URLs, and campaign metrics are never sold or forwarded to third-party AI model trainers.

---

## Invocation Pattern 1: REST API (`/v1/compile`, `/v1/dissect`, `/v1/svg`, `/v1/preflight`, `/v1/batch`)

```bash
# 1. Full 5-domain compile from product parameters ($0.05)
curl -fsSL -X POST "https://ad.fastmesh.dev/v1/compile" \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: growth-team" \
  -d '{
    "product_name": "MetricPulse Analytics",
    "offer": "Cut cloud spend by 34% in 10 minutes with deterministic billing audits",
    "audience": "B2B SaaS engineering leads and FinOps teams",
    "price_anchor": "$19 non-expiring starter pack",
    "guarantee": "$0 billed on empty or failed runs",
    "brand_color": "#0F172A"
  }'

# 2. Dissect a public competitor landing page ($0.03)
curl -fsSL -X POST "https://ad.fastmesh.dev/v1/dissect" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

# 3. Render deterministic 1080x1080, 1080x1920 & 1200x628 vector SVGs ($0.03)
curl -fsSL -X POST "https://ad.fastmesh.dev/v1/svg" \
  -H "Content-Type: application/json" \
  -d '{
    "product_name": "MetricPulse",
    "headline": "Cut Cloud Waste 34%",
    "subheadline": "Zero seat lock-in. Starts at $19.",
    "cta": "Run Free Preview",
    "brand_color": "#0F172A",
    "template": "comparison_table"
  }'

# 4. Run Ad-Policy Pre-Flight check & get safe rewrite ($0.02)
curl -fsSL -X POST "https://ad.fastmesh.dev/v1/preflight" \
  -H "Content-Type: application/json" \
  -d '{"copy": "Are you broke and tired? 100% guaranteed cure in 7 days!"}'
```

---

## Invocation Pattern 2: Native JSON-RPC 2.0 MCP (`POST /mcp`)

Four flat MCP tools exposed via `initialize`, `tools/list`, and `tools/call`:

| MCP Tool | Purpose | Key Arguments |
| :--- | :--- | :--- |
| `ad_dissect_and_compile` | Dissect a public URL or product brief and compile 30+ scripts, hero A/B, SVGs, preflight, and CSVs | `url`, `html`, `product_name`, `offer`, `audience`, `price_anchor`, `guarantee`, `brand_color` |
| `ad_render_svg_pack` | Render strict-XML vector SVG creatives in `1080x1080`, `1080x1920`, and `1200x628` | `product_name`, `headline`, `subheadline`, `cta`, `brand_color`, `template`, `sizes` |
| `ad_policy_preflight` | Scan ad copy for Meta/Google/TikTok policy violations and return compliant rewrites | `copy`, `platform` |
| `ad_export_csv` | Export RFC 4180 Google Ads RSA (25-col) and Meta Ads Manager bulk upload CSVs | `product_name`, `offer`, `url`, `scripts` |

```bash
curl -fsSL -X POST "https://ad.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: mcp-ad-agent" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "ad_dissect_and_compile",
      "arguments": {
        "product_name": "MetricPulse Analytics",
        "offer": "Cut cloud spend by 34% in 10 minutes",
        "audience": "B2B SaaS engineering leads",
        "brand_color": "#0F172A"
      }
    }
  }'
```

### Calling `ad_render_svg_pack`, `ad_policy_preflight`, and `ad_export_csv`

```bash
# Render multi-size SVG creative pack via MCP
curl -fsSL -X POST "https://ad.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "ad_render_svg_pack",
      "arguments": {
        "product_name": "MetricPulse",
        "headline": "Zero Garbled Ad Text",
        "subheadline": "Strict XML vector creatives for Meta & LinkedIn",
        "cta": "Try Free Preview",
        "brand_color": "#0F172A"
      }
    }
  }'

# Run policy preflight via MCP
curl -fsSL -X POST "https://ad.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "ad_policy_preflight",
      "arguments": {
        "copy": "Are you struggling with debt? 100% guaranteed income boost!",
        "platform": "meta"
      }
    }
  }'

# Export Google RSA + Meta Ads CSVs via MCP
curl -fsSL -X POST "https://ad.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "tools/call",
    "params": {
      "name": "ad_export_csv",
      "arguments": {
        "product_name": "MetricPulse",
        "offer": "Cut cloud spend by 34% in 10 minutes",
        "url": "https://example.com"
      }
    }
  }'
```

---

## Invocation Pattern 3: Treg Hub (0%-Commission QuickJS Package)

```bash
treg call ad_anything_compile --data '{
  "mode": "compile",
  "product_name": "MetricPulse Analytics",
  "offer": "Cut cloud spend by 34% in 10 minutes",
  "audience": "B2B SaaS engineering leads",
  "max_cost_micros": 100000
}'
```

---

## Invocation Pattern 4: Causal Bazaar Edge Hand (`run_hand.py`)

```bash
python3 run_hand.py --json '{"product_name":"MetricPulse","offer":"Cut cloud spend 34%","max_spend_usd":0.50}'
```

```python
from run_hand import run_hand

result = run_hand({
    "product_name": "MetricPulse Analytics",
    "offer": "Cut cloud spend by 34% in 10 minutes",
    "audience": "B2B SaaS engineering leads",
    "max_spend_usd": 0.50,
})
assert result["ok"] is True
assert result["zero_data_resale"] is True
```

---

## Agent Recovery Playbook

- **HTTP `422` (`billed_micros: 0`)**: Input was empty, sentinel (`"N/A"`), blocked by the SSRF guard, or returned a fake-200 HTML shell. Zero credits were deducted; supply a valid public `https://` URL or structured `product_name` + `offer`.
- **Policy Preflight Blocked (`passed: false`)**: Replace flagged phrases using `policy_preflight.safe_copy` before importing the generated CSVs into Google Ads Editor or Meta Ads Manager.
- **CSV Verification**: Always pass `csv_exports.google_rsa_csv` and `csv_exports.meta_ads_csv` through Python `csv.DictReader` or Google Ads Editor directly — columns follow strict RFC 4180 quoting.
