---
name: negotiate-anything
description: Parse B2B quotes (SaaS renewals, cloud bills, freight quotes, agency SOWs, factory quotes) via HTTP, native /mcp, or treg hub into itemized USD overcharge benchmarks, red-flag junk fees, named BATNA alternatives, 3-tier pricing targets, and buyer-drafted counter-offer emails. Strictly $0 billed on HTTP 422 empty/unparseable inputs.
---

# Negotiate-Anything — AI Agent Integration Skill

- **Base URL**: `https://negotiate.fastmesh.dev`
- **Remote MCP Endpoint**: `https://negotiate.fastmesh.dev/mcp` (JSON-RPC 2.0)
- **OpenAPI 3.1 Schema**: `https://negotiate.fastmesh.dev/openapi.json`
- **Discovery Manifest**: `https://negotiate.fastmesh.dev/llms.txt`
- **Treg Hub Tool ID**: `negotiate-anything-quote-audit` (`$0.15` per verified hit, `max_price_usd: $0.25`, `0%` platform commission, `$0` on `422`)
- **Causal Bazaar Public Toll Card**: `negotiate_anything_quote_audit_batna_v1` (`is_public=1`, `price_micros=150000`, `repeat_price_micros=15000`)
- **Supported Domains**: `saas_renewal`, `cloud_bill`, `freight_quote`, `agency_sow`, `supplier_quote` (or `"auto"`)
- **Supported Currencies**: `USD`, `EUR`, `GBP`, `CNY`, `CAD`, `AUD`, `JPY`, `SGD`
- **Compliance & Privacy**: Independent procurement data-benchmarking tooling; not a law firm or CPA firm; does not provide legal advice or issue an audit report. Flat-fee prepaid credits (`$19 / $79 / $249`) or fixed per-call fees with zero percentage cut on savings and zero client quote resale.

---

## When to Invoke This Skill

Invoke Negotiate-Anything whenever a user or autonomous procurement workflow provides:
1. A B2B renewal quote, order form, invoice, CSV cloud export, Markdown freight table, agency Statement of Work (SOW), or factory BOM/MOQ quote.
2. A request to verify whether quoted unit prices exceed empirical market `p25`/`p50` benchmarks, isolate waivable junk fees, identify contract redlines, quantify named BATNA switching alternatives, or draft buyer counter-offer emails.

### Hard Safety & Accuracy Rules for Calling Agents
- **Never auto-send emails**: Counter-offer emails returned in `email_variants` (`polite_firm`, `quarter_end_lock`, `batna_leverage`) are strictly buyer-drafted templates for human approval. Present them to the user for review rather than transmitting externally without explicit user consent.
- **Respect `FAIR_MARKET` verdicts**: If `overcharge_verdict == "FAIR_MARKET"` and `verified_savings_high_usd == 0.0`, tell the user the quote is already priced at or below market median (`p50`) with clean terms—do not invent artificial overcharges.
- **Handle HTTP `422` cleanly ($0 charged)**: Empty strings, placeholders (`"N/A"`, `"TBD"`), or prose with zero parseable numeric line items return HTTP `422` with `error_code: "unparseable_or_empty_quote"`, `billed_micros: 0`, and `charge_usd: 0.0`. Prompt the user for a quote containing at least one numeric price line instead of retrying blindly.
- **Verify `receipt_sha256`**: Every response carries a deterministic 64-hex SHA-256 `receipt_sha256` binding the normalized inputs and computed totals for tamper-evident procurement records.

---

## Method 1: Native Remote MCP (`POST https://negotiate.fastmesh.dev/mcp`)

Add the remote MCP server directly to any JSON-RPC 2.0 MCP-compatible client:

```json
{
  "mcpServers": {
    "negotiate-anything": {
      "url": "https://negotiate.fastmesh.dev/mcp",
      "transport": "streamable-http"
    }
  }
}
```

### Exposed MCP Tools (`tools/list`)
1. `negotiate_analyze_quote` — Parse and benchmark a B2B quote across 5 domains; returns line-item p25/p50 evidence, junk fees, contract redlines, >= 3 named BATNA alternatives, 3-tier pricing targets, and `receipt_sha256`.
2. `negotiate_counter_offer` — Compile 3 buyer-drafted counter-offer emails (`polite_firm`, `quarter_end_lock`, `batna_leverage`) plus an itemized contract redline checklist.
3. `negotiate_list_benchmarks` — Retrieve public unit-price benchmarks, junk-fee ranges, contract traps, and BATNA alternatives for any domain or search keyword (backed by cross-tenant `ArchiveCache`).
4. `tools_search` / `tools_inspect` / `tools_execute` / `tools_poll_receipt` — Dynamic dual-facade discovery and execution meta-tools.

### Example JSON-RPC 2.0 Call (`tools/call`)

```bash
curl -fsSL -X POST "https://negotiate.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "negotiate_analyze_quote",
      "arguments": {
        "quote": "Salesforce Enterprise Renewal: 50 seats x $175/seat/mo = $105,000/yr. Mandatory Premier Success 30%: $31,500/yr. 12% annual uplift, 90-day auto-renewal notice.",
        "domain": "auto",
        "currency": "USD"
      }
    }
  }'
```

---

## Method 2: REST HTTP Endpoints

### 1. Analyze Quote (`POST /v1/analyze`)

Accepts raw plain text, CSV, Markdown tables, or structured JSON under `quote` (aliases: `quote_text`, `input`, `raw_quote`).

```bash
curl -fsSL -X POST "https://negotiate.fastmesh.dev/v1/analyze" \
  -H "Content-Type: application/json" \
  -d '{
    "quote": "item,qty,unit,unit_price_usd\nAWS EC2 m7i.xlarge,7300,instance_hour,0.2016\nAWS Data Transfer Out Egress,50000,gb_egress,0.09\nAWS NAT Gateway Data Processing,40000,gb_processed,0.045",
    "domain": "cloud_bill",
    "currency": "USD",
    "tenant_id": "finops-team-alpha"
  }'
```

**Verified Response Invariants (HTTP 200)**:
- `sum(item.line_total_usd) == computed_sum_usd` (exact cent rounding)
- `verified_savings_low_usd == round(sum(item.overcharge_low_usd), 2)`
- `verified_savings_high_usd == round(sum(item.overcharge_high_usd), 2)`
- `0 <= verified_savings_low_usd <= verified_savings_high_usd <= total_quoted_usd`
- `0 < pricing_targets.anchor_usd <= pricing_targets.target_usd <= pricing_targets.walk_away_usd <= total_quoted_usd`
- `len(batna_alternatives) >= 3` for overcharged quotes, each with `name`, `url`, `relative_cost_ratio`, `switching_cost_usd_range`, and `migration_weeks`
- `receipt_sha256` present (64 lowercase hex characters)

**Zero-Charge Gate Response (HTTP 422)**:
```json
{
  "ok": false,
  "status_code": 422,
  "error_code": "unparseable_or_empty_quote",
  "error_detail": "Quote input is empty or contains no parseable numeric pricing line items.",
  "billed_micros": 0,
  "charged_micros": 0,
  "charge_usd": 0.0,
  "receipt_sha256": "<64-hex-sha256>"
}
```

### 2. Compile 3-Tier Counter-Offer Emails (`POST /v1/counter-offer`)

```bash
curl -fsSL -X POST "https://negotiate.fastmesh.dev/v1/counter-offer" \
  -H "Content-Type: application/json" \
  -d '{
    "quote": "40ft FCL Shanghai to Los Angeles: $7,200. Peak Season Surcharge (PSS): $1,200. Destination THC: $950. Documentation + Arrival Notice + D/O + Telex: $425. 3 days free demurrage.",
    "domain": "freight_quote",
    "buyer_name": "Alex Rivera",
    "buyer_company": "Pacific Hardware Co.",
    "vendor_contact": "Account Desk"
  }'
```

Returns `pricing_targets`, `email_variants` (`polite_firm`, `quarter_end_lock`, `batna_leverage`), `contract_redline_checklist`, `analysis_summary`, and `receipt_sha256`.

### 3. Query Public Pricing Benchmarks (`POST /v1/benchmarks`)

```bash
curl -fsSL -X POST "https://negotiate.fastmesh.dev/v1/benchmarks" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "supplier_quote",
    "query": "p20 steel mold",
    "tenant_id": "hardware-ops"
  }'
```

Cross-tenant `ArchiveCache` serves verified benchmark hits with `100%` standard rate for first-time tenants and `10%` repeat lookup rate for the same `tenant_id`.

---

## Method 3: `treg hub` (`0%` Platform Commission Black-Box Call)

Invoke directly from the Treg CLI or any Treg-connected agent runtime (`$0.15` per verified dossier, `$0.00` on `422` or empty inputs):

```bash
treg call negotiate-anything-quote-audit --data '{
  "quote": "Senior Software Engineer (blended rate): 400 hrs x $240/hr = $96,000. Project Management (25%): $24,000. Internal Tech Surcharge (6%): $7,200. Open-ended T&M, agency retains proprietary framework IP.",
  "domain": "agency_sow",
  "currency": "USD",
  "include_counter_offer": true
}'
```

---

## Method 4: Local / Causal Bazaar Hand (`run_hand.py`)

When running via Causal Bazaar card `negotiate_anything_quote_audit_batna_v1` or local CLI:

```bash
echo '{"quote":"CNC Aluminum 6061 Part MOQ 100: 100 units x $38.00 = $3,800. Repeat setup fee: $1,200. FX buffer 4.5%. 100% prepaid TT.","domain":"supplier_quote","mode":"full"}' | python3 run_hand.py
```

Modes: `analyze` | `counter_offer` | `full` (default) | `benchmarks`.

---

## Agent Workflow Pattern (Recommended 3-Step Loop)

1. **Inspect & Normalize**: Call `POST /v1/analyze` (or MCP `negotiate_analyze_quote`) with the raw pasted quote text, CSV, or Markdown table. If HTTP `422` is returned (`charge_usd: 0.0`), ask the user for itemized prices and units.
2. **Check Verdict**:
   - If `overcharge_verdict == "FAIR_MARKET"`, report clean pricing with zero inflated savings and surface any non-price contract clauses (e.g., notice windows or IP terms) worth tightening.
   - If `OVERCHARGED` or `MODERATE_OVERCHARGE`, present the itemized USD benchmark table, flagged junk fees, and top 3 BATNA switching alternatives (including Year-1 net savings after switching cost).
3. **Compile Buyer Drafts**: Call `POST /v1/counter-offer` (or MCP `negotiate_counter_offer`) and present all three variants (`polite_firm`, `quarter_end_lock`, `batna_leverage`) alongside the `receipt_sha256` hash so the buyer can review and send from their own email client.

---

## Flat-Fee Prepaid Credit Packs (Creem Card Checkout)

- **Starter Pack (`sku_neg_starter_19`, `$19` one-time)**: 5 full dossiers (`$3.80`/dossier) — https://negotiate.fastmesh.dev/#pricing
- **Team Pack (`sku_neg_team_79`, `$79` one-time)**: 30 full dossiers (`$2.63`/dossier) + REST API & Remote `/mcp` — https://negotiate.fastmesh.dev/#pricing
- **Procurement Desk Pack (`sku_neg_desk_249`, `$249` one-time)**: 120 full dossiers (`$2.08`/dossier) + Batch CSV/SOW variance & Priority `/mcp` — https://negotiate.fastmesh.dev/#pricing
- **Zero-Percentage-Cut Promise**: Transparent flat-fee prepaid credits only—never a percentage split on negotiated savings.
