---
name: harvest-anything
description: Deterministic 5-family public web, filing, and PDF schema extraction engine for AI agents (gov tenders/RFPs, SEC EDGAR 10-K/8-K/Form 4, ClinicalTrials.gov/patents, customs tariffs/RSS/Atom feeds, and embedded JSON-LD/Microdata/FlateDecode PDFs). Returns schema-validated JSON with per-field confidence, 1-based source line refs, and $0 billing on fake-200 soft-blocks, parse failures, empty results, or SSRF 422 rejections.
---

# Harvest-Anything Agent Skill

`Harvest-Anything` (`https://harvest.fastmesh.dev`) is a polymorphic, pure-Python-stdlib extraction engine built for AI agents, procurement monitors, financial research pipelines, life-sciences analysts, and trade compliance teams.

Every extraction call returns a standardized **`HarvestReceipt`** containing schema-validated **`extracted`** JSON, normalized **`records`**, calibrated **`field_confidence`** scores (`0.0`-`1.0`), 1-based **`source_line_refs`**, and a **`sha256_receipt`** digest.

## Hard Guarantees

1. **Strict `$0` Billing on Fake-200, Parse Failure, Empty Result, or 422**: You are billed **only** when the engine returns `ok: true` with verified non-empty structured output matching any supplied JSON Schema. Cloudflare/CAPTCHA challenge shells, HTTP 202 empty responses, malformed payloads, schema validation failures, and SSRF `HTTP 422` rejections strictly return `billed_micros: 0` with a non-empty `zero_bill_reason`.
2. **Pre-Fetch SSRF Guard (`HTTP 422`)**: Loopback (`127.0.0.1`, `::1`), RFC1918 private networks (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`), link-local/cloud metadata endpoints (`169.254.169.254`), and non-`http(s)` schemes (`file://`, `gopher://`) are rejected pre-fetch with `HTTP 422` and `$0` billed.
3. **Cross-Tenant Adaptive Archive Cache (7d-30d) & 10% Recheck Tier**: Verified extractions on stable public URLs enter a SQLite WAL archive cache (7d initial TTL expanding 1.5x up to 30d when unchanged). Cross-tenant cache hits bill 100% (`$0` upstream cost); same-tenant rechecks (`recheck: true`) bill **10%** of base mode pricing.
4. **Hard `$2.00` Batch Spend Cap**: `POST /batch` enforces `max_budget_micros <= 2000000` (`$2.00`) across concurrent items.
5. **Zero Payload or Trajectory Resale**: Submitted URLs, inline payloads, custom JSON Schemas, and webhook events are never sold, licensed, or used to train third-party models.

## Supported Modes & Micro-USD Pricing

| Mode (`mode`) | Target Public Data Family | Base Price | 10% Recheck | Key Capabilities |
| :--- | :--- | :---: | :---: | :--- |
| `gov_notices` | Public gov tenders, RFPs, permits, regulatory notices | `$0.08` (`80000`) | `$0.008` (`8000`) | Malformed HTML tables (`colspan`/`rowspan`, unclosed tags), pagination, currency/deadline normalization, OCDS & Federal Register |
| `sec_filings` | SEC EDGAR filings (10-K, 8-K, Form 4, XBRL) | `$0.06` (`60000`) | `$0.006` (`6000`) | Compliant SEC `User-Agent`, Form 4 XML insider transactions, 8-K events & amounts, XBRL `R2.htm` tables, timelines |
| `trials_patents` | ClinicalTrials.gov v2 & public patent grants | `$0.07` (`70000`) | `$0.007` (`7000`) | Nested `protocolSection` flattening, phases/sponsors/enrollment, independent vs dependent patent claims |
| `customs_feeds` | USITC HTS tariffs & heterogeneous RSS/Atom feeds | `$0.04` (`40000`) | `$0.004` (`4000`) | Latin-1/Windows-1252 to UTF-8 repair, double-entity unescaping, RFC-822/RFC-3339 timestamps, SHA-256 dedup |
| `embedded_pdf_schema` | Embedded JSON-LD, Microdata, dirty KV tables & PDFs | `$0.05` (`50000`) | `$0.005` (`5000`) | FlateDecode PDF text blocks, JSON-LD/Microdata/dirty tables projected onto buyer custom JSON Schema |

## Quick Invocation

### 1. Native Streamable MCP (`POST https://harvest.fastmesh.dev/mcp`)

List available flat tools (`harvest_extract`, `harvest_batch`, `harvest_diff_watch`):

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}
```

Extract structured records from a live SEC EDGAR Form 4 XML filing:

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "harvest_extract",
    "arguments": {
      "url": "https://www.sec.gov/Archives/edgar/data/320193/000114036126046128/form4.xml",
      "mode": "sec_filings"
    }
  }
}
```

### 2. HTTP REST API (`POST https://harvest.fastmesh.dev/harvest`)

Extract with a custom buyer JSON Schema:

```bash
curl -sS -X POST https://harvest.fastmesh.dev/harvest \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.python.org/",
    "mode": "embedded_pdf_schema",
    "schema": {
      "type": "object",
      "required": ["name", "url"],
      "properties": {
        "name": {"type": "string"},
        "url": {"type": "string"}
      }
    }
  }'
```

Concurrent batch extraction with a hard budget cap (`POST /batch`):

```bash
curl -sS -X POST https://harvest.fastmesh.dev/batch \
  -H "Content-Type: application/json" \
  -d '{
    "max_budget_micros": 500000,
    "items": [
      {"url": "https://www.federalregister.gov/api/v1/documents.json?per_page=2", "mode": "gov_notices"},
      {"url": "https://clinicaltrials.gov/api/v2/studies/NCT04280705", "mode": "trials_patents"},
      {"url": "https://hts.usitc.gov/reststop/search?keyword=8541", "mode": "customs_feeds"}
    ]
  }'
```

Register an incremental diff watch (`POST /webhooks/diff`):

```bash
curl -sS -X POST https://harvest.fastmesh.dev/webhooks/diff \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.federalregister.gov/api/v1/documents.json?per_page=2",
    "mode": "gov_notices",
    "callback_url": "https://hooks.example.com/rfp-diff"
  }'
```

### 3. Via `treg hub` (0% Seller Commission, `$0` on Fake-200 / Empty / 422)

```bash
treg call harvest-anything \
  --data '{"url":"https://www.sec.gov/Archives/edgar/data/320193/000114036126046128/form4.xml","mode":"sec_filings"}'
```

## Verified Live `HarvestReceipt` Example (SEC EDGAR Form 4)

```json
{
  "ok": true,
  "status_code": 200,
  "mode": "sec_filings",
  "url": "https://www.sec.gov/Archives/edgar/data/320193/000114036126046128/form4.xml",
  "extracted": {
    "form_type": "Form 4",
    "cik": "0000320193",
    "company_name": "Apple Inc.",
    "tickers": ["AAPL"],
    "filing_date": "2026-11-25",
    "events": [
      {
        "event_type": "form4_transaction",
        "insider_name": "Khan Sabih",
        "officer_title": "COO",
        "security": "Common Stock",
        "transaction_code": "S",
        "acquired_or_disposed": "D",
        "shares": 55000.0,
        "price_per_share": 349.38,
        "total_value": 19215900.0,
        "date": "2026-11-23"
      }
    ]
  },
  "field_confidence": {
    "form_type": 0.99,
    "company_name": 0.98,
    "events": 0.96,
    "amounts": 0.95
  },
  "source_line_refs": {
    "company_name": {"line": 12, "end_line": 12, "snippet": "<issuerName>Apple Inc.</issuerName>", "source_kind": "form4_xml"},
    "insider_name": {"line": 20, "end_line": 20, "snippet": "<rptOwnerName>Khan Sabih</rptOwnerName>", "source_kind": "form4_xml"}
  },
  "schema_valid": true,
  "cache_hit": false,
  "cache_tier": "live",
  "billed_micros": 60000,
  "zero_bill_reason": null
}
```

## Anti-Fake-200 `$0` Guard Example

When a target returns HTTP `200` containing a Cloudflare browser check or empty React shell, `Harvest-Anything` blocks billing and returns:

```json
{
  "ok": false,
  "status_code": 200,
  "mode": "gov_notices",
  "url": "https://ted.europa.eu/en/notice/-/detail/123456-2025",
  "extracted": {},
  "records": [],
  "billed_micros": 0,
  "zero_bill_reason": "fake_200_soft_block:cf-browser-verification"
}
```

## Support & Documentation

- Interactive Try-Now Console: `https://harvest.fastmesh.dev/`
- OpenAPI 3.1.0 Spec: `https://harvest.fastmesh.dev/openapi.json`
- AI Index: `https://harvest.fastmesh.dev/llms.txt`
- Technical Guides: `https://harvest.fastmesh.dev/guides`
- Support: `ops@fastmesh.dev`
