# SQLGuard Gateway — permission before production writes

**Sell:** AI agents need permission before they modify production data.

**Feature:** Authorization Receipt — `POST /v1/gateway/decide`

```
Agent requests:  UPDATE customers ...
Policy:          sqlguard.change_control.v1
Scope:           UPDATE — customer_status only
Expires:         +10 minutes
Result:          AUTHORIZED
```

**Not selling as headline:** Execution Certificate Firewall · AI-contract platform.

**Category:** Authority receipt — statement authorize before mutate. Buyers already budget **$20–$100+/mo** for write-approval gates; OAuth and DB roles do not bind the exact SQL.

## Companies: paste this Action

Paste into any repo that ships mutating SQL migrations. DENY → Pilot Challenge Exact **$100** (amount `100000000`) or Gateway invoice **$299/mo**.

| Asset | URL |
|-------|-----|
| Action docs | https://sqlguard.io/examples/sqlguard-authorize-gate.md |
| Paste YAML | https://sqlguard.io/examples/challenge-ci-paste.yml |
| Action uses (HOLD: GH flag) | `cabbageandtea/sqlguard/.github/actions/sqlguard-authorize-gate@master` |
| Buy | https://sqlguard.io/buy#pilot |
| Challenge | https://sqlguard.io/challenge |

```yaml
- uses: cabbageandtea/sqlguard/.github/actions/sqlguard-authorize-gate@master
  with:
    sql: ${{ github.event.inputs.sql || 'DROP TABLE customers CASCADE' }}
    mode: decide
    allow_approval: "false"
```

Free ALLOW from decide is tip only — not production authorize. Bonded PASS requires Challenge unlock / Pilot / invoice.

**Fail-closed hash bind:** `mode: pass` → `/v1/verify` with `expected_sql_hash` (SHA-256 of gated SQL). Borrowed PASS fails.

## Gateway pilot (on-ramp)

Flat **$100 / 7 days** (Exact USDC or invoice) → [`POST /v1/gateway/pilot`](https://sqlguard.io/v1/gateway/pilot) · UI [/buy#pilot](https://sqlguard.io/buy#pilot). Design partner window; **Starter $299/mo** remains primary close.

Pilot Challenge path: free `POST /v1/challenge` → unlock `POST /v1/challenge/unlock` amount `100000000`.

## Buyers

AI startups with DB-connected agents · MCP write-tool builders · companies letting AI read/write customer data.

## Pricing (invoice) — 3 paying companies mission

| Tier | Price | Role |
|------|-------|------|
| Builder | $99/mo | Early |
| **Starter** | **$299/mo** | **Primary close** |
| Company | $499/mo | Multi-seat AI SaaS |
| Production | $1,999/mo | Multi-tenant writes |
| Enterprise | $10k+/yr | Later |

Contact: hello@sqlguard.io

## Install

```bash
SQLGUARD_EXECUTOR_ENABLED=1
SQLGUARD_EXECUTOR_DATABASE_URL=postgres://writer:...@db/app
```

Public host executor stays OFF. Enable on your private deploy.

## API

- `POST /v1/gateway/decide` → Authorization Receipt (DENY may include `deny_id` + Challenge next)
- `POST /v1/challenge` → free DENY / Challenge start
- `POST /v1/challenge/unlock` → Exact $100 (amount `100000000`)
- `POST /v1/gate` → verify Ed25519 PASS
- `POST /v1/verify` → PASS + optional `expected_sql_hash` (fail-closed bind)
- `POST /v1/execute` → Gateway holds DB when enabled
- `GET /v1/gravity` / MCP `sqlguard_gravity` → ranked DENYs + live Exact Pilot amounts

## MCP elicitation: approval input, portable receipt

MCP `input_required` / elicitation is a useful pause point before a write retry. Use it to show the exact SQL and collect the human decision, then bind that decision to a SQLGuard Authorization Receipt:

1. The write tool proposes exact SQL and returns `input_required` instead of executing.
2. The host elicits approval from the human.
3. The tool resumes through `sqlguard_challenge` → Pilot unlock or Gateway policy.
4. SQLGuard issues a short-lived Ed25519 PASS bound to the SQL hash, scope, policy, and expiry.
5. The executor calls `sqlguard_verify`; only `ok: true` permits the database write.

The in-chat confirmation is not itself the execution credential. The signed receipt is portable across the MCP host, queue, worker, and database boundary. If the SQL changes after elicitation, request a new receipt.

Cursor partner package: `examples/cursor-sqlguard-authorize` in the SQLGuard repository.

Wealth Exact = Pilot Challenge $100 · company path = invoice $299+.  
Legacy Session $0.25 / Instant $0.05 / Workday $2.50 — OFF TABLE as primary.
Probe is free and does not authorize. CDP Bazaar may lag; Fly wire is authoritative.

Tracker: `team/MISSION-3PAY.md` · 50 AI+DB companies listed → pursue.
