---
name: legal-anything
description: Deterministically screen commercial contracts (SaaS MSA, NDA, GDPR DPA, SOW/Supplier, Channel/Lease) for high-risk trap clauses and generate copy-paste counter-redlines, negotiation email snippets, 3-tier fallback ladders, and SHA-256 verification proofs via Remote /mcp, REST API, treg hub (0% commission), or Causal Bazaar. Strictly $0 billed on HTTP 422 empty/invalid input. Not a law firm and does not provide legal advice.
---

# Legal-Anything — Autonomous Agent Integration Handbook (`SKILL.md`)

- **Base URL**: `https://legal.fastmesh.dev`
- **Remote MCP Endpoint**: `https://legal.fastmesh.dev/mcp` (JSON-RPC 2.0 Streamable HTTP)
- **OpenAPI 3.1 Spec**: `https://legal.fastmesh.dev/openapi.json`
- **Crawler & AI Directory**: `https://legal.fastmesh.dev/llms.txt`
- **Treg Hub Tool ID**: `legal-anything-contract-redline` (`$0.19` per verified report, `max_price_usd: $0.25`, `0% commission` marketplace distribution, `empty_result_charge: 0` on HTTP `422`)
- **Causal Bazaar Public Paid Card**: `legal_anything_contract_redline_v1` (`is_public=1`, `price_micros=190000`, repeat-tenant verified cache hit `10%` = `19000` micros)
- **Supported Contract Genres (`contract_type`)**: `"auto"`, `"saas_msa"`, `"nda"`, `"dpa"`, `"sow_supplier"`, `"channel_lease"`
- **Deterministic Engine**: Pure deterministic clause parser + **48 calibrated trap rules** (9 per genre across all 5 genres + 3 cross-genre general traps) with negation-aware protective negative guards (`deterministic rules engine`; zero third-party model data leakage)
- **Compliance & Privacy**: Legal-Anything is a deterministic commercial contract clause pre-review software tool; it is not a law firm and does not provide legal advice or legal representation. Zero client contract data resale and zero AI model training on submitted agreements.

---

## When to Invoke This Skill

Call Legal-Anything whenever a user, founder, procurement workflow, or autonomous agent needs to pre-screen an incoming commercial agreement before execution:

1. **SaaS Master Services Agreements & Order Forms (`saas_msa`)**: Check for unlimited customer liability, asymmetric indemnification, silent 60–120 day auto-renewals, perpetual AI training / data resale licenses, uncapped renewal price hikes, unilateral URL ToS rewrites, and suspension without cure.
2. **Non-Disclosure Agreements (`nda`)**: Detect one-way confidentiality, perpetual non-trade-secret survival, disguised non-competes, buried non-solicitation, broad unaided-memory residuals, one-way attorneys' fees, hostile venue waivers, and missing standard carve-outs.
3. **GDPR / CCPA Data Processing Agreements (`dpa`)**: Catch vague breach notice windows exceeding 72 hours, silent subprocessor changes without 30-day prior notice/objection, missing 2021 EU SCCs / UK IDTA safeguards, indefinite retention (`>30` days), and blocked GDPR Article 28(3)(h) inspection rights.
4. **SOW, Agency & Supplier Agreements (`sow_supplier`)**: Flag Background IP / reusable tools confiscation, subjective acceptance ("sole and absolute discretion"), Net-90/120 or pay-when-paid terms, uncapped liquidated damages, convenience termination without WIP pay, and unilateral scope creep.
5. **Channel Distribution & Commercial Leases (`channel_lease`)**: Identify one-way exclusivity lock-ins, minimum purchase quota cash forfeitures, missing inventory buyback, customer-list confiscation, asymmetric force majeure keeping rent due during casualty, uncapped NNN CAM pass-throughs, 200%–300% holdover penalties, confession of judgment, and unlimited personal guarantees.

---

## Hard Agent Safety & Accuracy Rules

- **Always Surface the Software Disclaimer**: Echo `tool_disclaimer` clearly when summarizing findings: Legal-Anything is deterministic commercial contract clause pre-review software—it is not a law firm and does not provide legal advice or legal representation.
- **Never Auto-Sign or Auto-Transmit Redlines**: Present `counter_redline_clauses`, `email_negotiation_snippet`, and `negotiation_fallback_tiers` to the human decision-maker for review before sending to a counterparty or approving an e-signature.
- **Respect Clean Low-Risk Verdicts**: When `risk_grade == "LOW"` (`risk_score_0_100 <= 20` and zero high/critical findings), inform the user that the agreement contains balanced protective terms—do not fabricate artificial traps.
- **Handle HTTP `422` Cleanly (`billed_micros: 0`)**: Empty strings, placeholders (`"N/A"`, `"TBD"`), snippets `< 40` non-space characters or `< 6` words, or gibberish return HTTP `422` with `billed_micros: 0` (`$0` charged). Ask the user for the actual contract clauses instead of retrying the same invalid string.
- **Verify `sha256_proof`**: Every `200 OK` report includes a deterministic 64-hex `sha256_proof` digest suitable for procurement approval logs and verifiable archive storage.

---

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

Configure any JSON-RPC 2.0 MCP-compatible agent client with:

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

### Exposed MCP Tools (`tools/list`)
1. `legal_analyze_contract` — Analyze a commercial contract across all 5 genres (`auto` detection supported) and return a full `ContractTrapReport` with risk score, trap findings, copy-paste counter-redlines, 3-tier fallbacks, and `sha256_proof`.
2. `legal_generate_redlines` — Generate targeted copy-paste counter-redline text, negotiation email snippet, and 3-tier fallback ladder for a specific clause excerpt or explicit list of `rule_id`s.
3. `legal_list_rules` — Retrieve all 48 deterministic trap rules (9 per genre + 3 cross-genre), severity ratings, and protective guard descriptions.
4. `legal_batch_analyze` — Screen an array of commercial agreements in one call with per-document risk scores and aggregate portfolio summary.

### Example JSON-RPC 2.0 `tools/call` Request

```bash
curl -fsSL -X POST "https://legal.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "legal_analyze_contract",
      "arguments": {
        "contract_text": "MASTER SERVICES AGREEMENT. Section 8. Customer shall have unlimited liability for all claims. Section 9. Automatically renews for 12-month terms unless Customer delivers written non-renewal notice 90 days prior to expiration. Section 11. Vendor may use Customer Data to train artificial intelligence models.",
        "contract_type": "auto",
        "contract_title": "Vendor SaaS MSA Draft"
      }
    }
  }'
```

---

## Method 2: REST HTTP Endpoints

### 1. Analyze Single Contract (`POST /v1/analyze`)

Accepts raw legal prose, dirty OCR text, numbered paragraphs, or Markdown under `contract_text`:

```bash
curl -fsSL -X POST "https://legal.fastmesh.dev/v1/analyze" \
  -H "Content-Type: application/json" \
  -d '{
    "contract_text": "DATA PROCESSING AGREEMENT. Section 3. Processor may replace any subprocessor at any time without prior notice. Section 5. Upon a personal data breach, Processor shall notify Controller within a commercially reasonable time without specified hours. Section 7. Processor may retain personal data indefinitely.",
    "contract_type": "dpa",
    "contract_title": "Cloud Vendor DPA",
    "tenant_id": "ops-team-alpha"
  }'
```

**Canonical `ContractTrapReport` Fields (HTTP 200)**:
- `ok`: `true`
- `tool_disclaimer`: Non-law-firm deterministic pre-review software notice
- `contract_type` & `detected_contract_type`: Requested and deterministically detected genre (`saas_msa`, `nda`, `dpa`, `sow_supplier`, `channel_lease`)
- `clause_count` & `clean_clauses_verified`: Segmented clause totals
- `risk_score_0_100` (`0..100`) & `risk_grade` (`LOW` | `MODERATE` | `HIGH` | `CRITICAL`)
- `trap_findings[]`: Matched traps (`finding_id`, `rule_id`, `severity`, `title`, `clause_heading`, `matched_excerpt`, `risk_points`)
- `counter_redline_clauses[]`: Copy-paste `copy_paste_redline`, `redline_instruction`, and `email_negotiation_snippet` per trap
- `negotiation_fallback_tiers[]`: `tier_1_ideal`, `tier_2_balanced`, `tier_3_walkaway`, and `leverage_points[]`
- `cache_meta`: Cross-tenant `ArchiveCache` metadata (`100%` new tenant / `10%` same-tenant repeat verified hit)
- `sha256_proof`: 64-character lowercase hex digest
- `billed_micros`: Verified billing amount (`0` on HTTP `422`)

**Zero-Charge Gate Response (HTTP 422)**:
```json
{
  "ok": false,
  "status_code": 422,
  "error_code": "invalid_contract_input",
  "billed_micros": 0,
  "charged_micros": 0,
  "tool_disclaimer": "Deterministic commercial contract clause pre-review software tool; NOT a law firm and does NOT provide legal advice or legal representation."
}
```

### 2. Batch Analyze Contracts (`POST /v1/batch-analyze`)

```bash
curl -fsSL -X POST "https://legal.fastmesh.dev/v1/batch-analyze" \
  -H "Content-Type: application/json" \
  -d '{
    "contracts": [
      {"contract_title": "Vendor NDA", "contract_type": "nda", "contract_text": "ONE-WAY NDA. Obligations apply solely to Recipient in perpetuity and Recipient shall not compete for 3 years."},
      {"contract_title": "Agency SOW", "contract_type": "sow_supplier", "contract_text": "STATEMENT OF WORK. All pre-existing background IP and tools are assigned exclusively to Client. Payment is Net-90 upon Client sole and absolute discretion."}
    ]
  }'
```

### 3. Generate Targeted Counter-Redlines (`POST /v1/redline`), List Rules (`GET /v1/rules`) & Check Prepaid Balance (`GET /v1/billing/balance`, `GET /v1/billing/skus`)

```bash
curl -fsSL "https://legal.fastmesh.dev/v1/rules"
curl -fsSL "https://legal.fastmesh.dev/v1/billing/skus"
curl -fsSL "https://legal.fastmesh.dev/v1/billing/balance?tenant_id=ops-team-alpha"
curl -fsSL -X POST "https://legal.fastmesh.dev/v1/redline" \
  -H "Content-Type: application/json" \
  -d '{"rule_ids": ["MSA_UNCAPPED_LIABILITY", "MSA_SILENT_AUTO_RENEWAL"]}'
```

---

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

Invoke directly from Treg CLI or any Treg-connected runtime (`$0.19` per verified report, `0% commission` marketplace distribution, strictly `$0` charged on HTTP `422` invalid/empty input):

```bash
treg call legal-anything-contract-redline --data '{
  "contract_text": "COMMERCIAL LEASE. Section 21. Any holdover past expiration incurs 250% of full monthly rent plus consequential damages. Principal personally and unconditionally guarantees all obligations with confession of judgment.",
  "contract_type": "channel_lease",
  "include_redlines": true
}'
```

---

## Method 4: Causal Bazaar (`is_public=1`) & Local CLI (`run_hand.py`)

Discoverable publicly on Causal Bazaar under `hand_id: "legal_anything_contract_redline_v1"` (`is_public=1`, `price_micros=190000`, `10%` repeat-tenant cache pricing), or execute locally via `run_hand.py`:

```bash
echo '{"contract_text":"STATEMENT OF WORK. Supplier assigns all pre-existing background IP and tools to Client. Payment is Net-120 pay-when-paid upon Client sole discretion.","contract_type":"sow_supplier","tenant_id":"agent-local"}' | python3 run_hand.py
```

---

## Recommended 3-Step Autonomous Pre-Signing Workflow

1. **Screen Before Escalating**: Pass any incoming vendor/client/landlord agreement to `legal_analyze_contract` (MCP) or `POST /v1/analyze` (REST). If HTTP `422` returns (`billed_micros: 0`), ask the user to supply the full clause text.
2. **Triage by `risk_grade`**:
   - `LOW` (`0-20`): Confirm balanced protective terms were verified (`clean_clauses_verified`) and surface any minor commercial preferences.
   - `MODERATE` / `HIGH` / `CRITICAL`: Group matched `trap_findings` by severity (`CRITICAL` first), quote each `matched_excerpt`, and present the matching `copy_paste_redline` + `tier_1_ideal` / `tier_2_balanced` / `tier_3_walkaway` options.
3. **Prepare Human Markup Package**: Deliver the assembled `email_negotiation_snippet`s, `sha256_proof`, and software disclaimer so the user (or their qualified commercial counsel on material deals) can send tracked changes with one click.

---

## Self-Serve Prepaid Credit Packs (Creem Checkout)

- **Starter 5-Pack (`sku_legal_starter_19`, `$19` one-time)**: 5 contract dossiers (`$3.80`/contract) — https://legal.fastmesh.dev/#pricing
- **Pro 30-Pack (`sku_legal_pro_79`, `$79` one-time)**: 30 contract dossiers (`$2.63`/contract) + REST API & Remote `/mcp` — https://legal.fastmesh.dev/#pricing
- **Agency 100-Pack (`sku_legal_agency_199`, `$199` one-time)**: 100 contract dossiers (`$1.99`/contract) + Batch API & Priority `/mcp` — https://legal.fastmesh.dev/#pricing
- **Fixed Non-Contingent Fee Policy**: One-time flat prepaid packs with zero auto-renewal, zero percentage split, and zero client data resale.
