---
name: zero-employee-saas-factory
description: Flat agent capability handbook for W4-F05 Zero-Employee-SaaS-Factory (https://factory.fastmesh.dev) — 4-stage deterministic clean-room micro-SaaS unbundler, runnable Python stdlib microservice compiler, 50-page Alternative SEO/GEO pack generator, and $0-on-no-change competitor pricing change watcher via /mcp, REST, CLI, Causal Bazaar, and 0%-commission treg hub.
---

# Zero-Employee-SaaS-Factory (`factory.fastmesh.dev`) — Agent Capability Handbook

> **Guarantees**: Pure Python 3 stdlib deterministic pipeline · Hard business gates (`>= 5.0x` cheaper than incumbent AND `>= 75.0%` gross margin) · Signed `receipt_sha256` on every call · Strictly **`$0` billed (`cost_micros = 0, billed_usd = 0.0`)** on empty/invalid inputs, HTTP 422 gate rejections, SSRF blocks, fake-200 WAF pages, and `0-change` watch snapshots · **Zero Customer Business-Plan & Trajectory Data-Resale Pledge**.

## Discovery & Integration Surfaces

| Surface | Endpoint / Identifier | Protocol / Pricing |
| :--- | :--- | :--- |
| **Remote MCP Server** | `https://factory.fastmesh.dev/mcp` | JSON-RPC 2.0 (`initialize`, `tools/list`, `tools/call`) |
| **REST API + OpenAPI 3.1** | `https://factory.fastmesh.dev/openapi.json` | `POST /v1/factory/{unbundle,compile-replacement,generate-seo-50,watch-snapshot,full-build}`, `GET /health` |
| **treg hub (0% Commission)** | `zero-employee-saas-factory` (`singularity.zero-employee-saas-factory`) | `$0.10` unbundle / `$0.50` compile / `$0.50` SEO-50 / `$0.05` watch diff (`$0` no-change) / `$1.20` full build |
| **Causal Bazaar Public Card** | `w4_f05_zero_employee_saas_factory_v1` (hand: `hand_w4_f05_zero_employee_saas_factory_v1`) | `is_public=1`, `PUBLIC_TOLL`, base `100000` micros (`$0.10`), hard cap `<= $2.00` |
| **Storefront & Prepaid Packs** | `https://factory.fastmesh.dev/` | `$149` Single Build (`sku_f05_single_build_149`) / `$399` Founder 5-Pack (`sku_f05_founder_pack_399`) / `$999` Venture Unlimited (`sku_f05_venture_unlimited_999`), `$0/mo` recurring |
| **Machine Directory & Guides** | `https://factory.fastmesh.dev/llms.txt` | Structured index + 24 verified English HTML/Markdown unbundling guides under `/seo_geo/` |

---

## 1. Calling via Remote `/mcp` (AI Coding Agents, Cursor & MCP Clients)

Register `https://factory.fastmesh.dev/mcp` as a remote HTTP MCP server. It exposes **5 direct flat factory tools** (`factory_unbundle`, `factory_compile_replacement`, `factory_generate_seo_50`, `factory_watch_snapshot`, `factory_full_build`) alongside **4 DualMcpFacade discovery meta-tools** (`tools_search`, `tools_inspect`, `tools_execute`, `tools_poll_receipt`).

### Initialize & List Tools

```bash
curl -fsSL -X POST "https://factory.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
```

### Stage 1: `factory_unbundle` (`$0.10` verified / `$0` on `<5x` savings, `<75%` margin, SSRF, or fake-200)

```bash
curl -fsSL -X POST "https://factory.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: my-agent-workspace" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "factory_unbundle",
      "arguments": {
        "incumbent_slug": "docparser"
      }
    }
  }'
```

Verified catalog presets built in from `intel/incumbent_unbundle_matrix.json`:
- `docparser` — Docparser Business (`$159/mo`) -> `$19/1k` docs (`8.37x` cheaper, `95.79%` margin)
- `glockapps` — GlockApps Growth (`$142/mo`) -> `$15/2k` checks (`9.47x` cheaper, `94.67%` margin)
- `visualping_business` — Visualping Business 20K (`$140/mo`) -> `$19/2k` alerts (`7.37x` cheaper, `93.68%` margin)
- `coupler_fivetran` — Coupler.io Pro (`$259/mo`) / Fivetran SMB (`$511/mo`) -> `$29/1.5k` runs (`8.93x` cheaper, `95.34%` margin)
- `semrush_site_audit` — Semrush Starter (`$199/mo`, API `$599/mo`) -> `$19/1.5k` audits (`10.47x` cheaper, `96.05%` margin)

### Stage 2: `factory_compile_replacement` (`$0.50` verified compile)

```bash
curl -fsSL -X POST "https://factory.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "factory_compile_replacement",
      "arguments": {
        "incumbent_slug": "docparser",
        "domain": "invoice-parser.example.dev",
        "verify_live": true
      }
    }
  }'
```

Outputs a standalone runnable pure-stdlib Python project directory containing `src/server.py` (`GET /health`, `GET /openapi.json`, `POST /mcp`, `POST /v1/execute`, `POST /webhooks/creem`), `gateway_route.json`, `treg_hub/{recipe.json,run.js,README.md,check.json}`, `billing/creem_skus.json`, `market_kill_clock.json`, `web/index.html`, and `CLEAN_ROOM_NOTICE.md`.

### Stage 3: `factory_generate_seo_50` (`$0.50` verified 50-page compile)

```bash
curl -fsSL -X POST "https://factory.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "tools/call",
    "params": {
      "name": "factory_generate_seo_50",
      "arguments": {
        "incumbent_slug": "semrush_site_audit",
        "domain": "schema-guard.example.dev",
        "page_count": 50
      }
    }
  }'
```

Returns `html_page_count` (50), `md_page_count` (50), `jsonld_valid_count` (50), `broken_link_count` (0), `core_files` (`sitemap.xml`, `llms.txt`, `skill.md`, `robots.txt`, `seo_geo/index.html`), `bundle_sha256`, and `receipt_sha256`.

### Stage 4: `factory_watch_snapshot` (`$0.05` on real diff / STRICTLY `$0` on 0-change or baseline init)

```bash
curl -fsSL -X POST "https://factory.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 5,
    "method": "tools/call",
    "params": {
      "name": "factory_watch_snapshot",
      "arguments": {
        "target_id": "docparser_business",
        "incumbent_name": "Docparser Business",
        "snapshot": {
          "tiers": [{"name": "Business", "monthly_usd": 179.0, "credits": 1000}],
          "free_tier_credits": 0
        }
      }
    }
  }'
```

When normalized pricing tiers are unchanged (or on first baseline registration), returns `changed: false`, `cost_micros: 0`, `billed_usd: 0.0`, `alert_emitted: false`. When an incumbent raises prices, shrinks its free tier, or adds a seat/API gate, returns `changed: true`, `alert_event`, `marketing_comparison_patch`, and `evolution_recommendation` at `$0.05`.

### Full End-to-End Pipeline: `factory_full_build` (`$1.20` verified / `$0` fail-fast on Stage 1 reject)

```bash
curl -fsSL -X POST "https://factory.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 6,
    "method": "tools/call",
    "params": {
      "name": "factory_full_build",
      "arguments": {
        "incumbent_slug": "visualping_business",
        "domain": "pricing-watch.example.dev"
      }
    }
  }'
```

---

## 2. Calling via Direct REST API

| Method & Path | Purpose | Verified Billing |
| :--- | :--- | :--- |
| `GET /health` | Liveness, stage registry, SKU catalog, business gates, cache & ledger stats | `$0` (free) |
| `GET /openapi.json` | Machine-readable OpenAPI 3.1.0 schema | `$0` (free) |
| `POST /v1/factory/unbundle` | Stage 1 Evolve: parse URL/spec & enforce `>=5x` savings and `>=75%` margin | `$0.10` (`$0` on 422/SSRF/fake-200) |
| `POST /v1/factory/compile-replacement` | Stage 2 Compile: generate runnable clean-room Python HTTP+MCP microservice | `$0.50` (`$0` on error) |
| `POST /v1/factory/generate-seo-50` | Stage 3 Rank: compile 50 English Alternative HTML+MD pages + JSON-LD + XML | `$0.50` (`$0` on error) |
| `POST /v1/factory/watch-snapshot` | Stage 4 Watch: SQLite WAL pricing snapshot diff + webhook alert + patch | `$0.05` on change / `$0` on 0-change |
| `POST /v1/factory/full-build` | Execute Stage 1 -> Stage 2 -> Stage 3 -> Stage 4 end-to-end | `$1.20` (`$0` if Stage 1 gate fails) |
| `POST /webhooks/creem` | Constant-time HMAC-SHA256 Creem payment webhook & idempotent credit ledger | Internal webhook |

```bash
# Quickstart REST Stage 1 unbundle check
curl -fsSL -X POST "https://factory.fastmesh.dev/v1/factory/unbundle" \
  -H "Content-Type: application/json" \
  -d '{"incumbent_slug":"coupler_fivetran","tenant_id":"agent_demo"}'
```

---

## 3. Calling via `treg hub` (`0%` Seller Commission)

```bash
# Unbundle a verified incumbent ($0.10 verified, $0 on gate reject / SSRF / fake-200)
treg call zero-employee-saas-factory --data '{"action":"unbundle","incumbent_slug":"docparser"}'

# Monitor competitor pricing changes ($0.05 on real change, strictly $0 on 0-change)
treg call zero-employee-saas-factory --data '{"action":"watch_snapshot","target_id":"semrush_starter","snapshot":{"tiers":[{"name":"Starter","monthly_usd":199}]}}'

# Compile a 50-page Alternative SEO/GEO bundle ($0.50 verified)
treg call zero-employee-saas-factory --data '{"action":"generate_seo_50","incumbent_slug":"semrush_site_audit","page_count":50}'
```

---

## 4. Agent Operating Rules & Safety Invariants

1. **Inspect `gate_passed`, `refused`, and `cost_micros` on every call**: if `refused == true` (`error_code == "business_gate_rejected"`), the target fails `>= 5.0x` savings or `>= 75.0%` gross margin and automatically bills `$0` (`cost_micros == 0`). Adjust the unit economics or choose a higher-margin incumbent instead of retrying identical inputs.
2. **Never poll private/internal URLs**: Stage 1 and Stage 4 strictly reject loopback (`127.0.0.0/8`, `::1`), RFC1918 (`10/8`, `172.16/12`, `192.168/16`), link-local/cloud metadata (`169.254.169.254`), and non-HTTP(S) schemes (`file://`, `javascript:`) with HTTP 422 `ssrf_blocked` at `$0`.
3. **Pass a stable `target_id` and `tenant_id` for Stage 4 Watch**: baselines are isolated per tenant in SQLite WAL; identical subsequent snapshots return `changed: false` and `billed_usd: 0.0` so agents can run scheduled competitor checks at zero waste.
4. **Verify `receipt_sha256` and `zero_resale_attestation`**: log both fields for deterministic audit reconciliation. All customer business-plan specs, blueprints, and watch payloads remain strictly private under the Zero Data-Resale Pledge.
5. **Clean-room positioning only**: never instruct compiled outputs to impersonate incumbent trademarks or copy closed-source UI/code.
