---
name: tax-anything
description: Deterministic, pure-Decimal 5-domain cross-border tax calculation and Peppol BIS 3.0 UBL 2.1 e-invoice validation engine for AI agents and billing pipelines (US 50-state + DC Economic Nexus, EU-27 VAT OSS & Article 196 Reverse Charge, Peppol UBL XML validation, HS Tariff Landed Cost & De Minimis, and Bilateral WHT Treaties & DST). Emits tamper-evident SHA-256 TaxReceipts with strict $0 billing on HTTP 422 invalid inputs, XXE/malformed XML, or errors.
---

# Tax-Anything Agent Skill

`Tax-Anything` (`https://tax.fastmesh.dev`) is a flat, polymorphic, pure-`Decimal` tax calculation and e-invoice format validation engine built for autonomous AI billing agents, cross-border SaaS checkouts, AP/AR compliance workflows, and e-commerce logistics pipelines.

Every calculation returns a standardized, tamper-evident **`TaxReceipt`** sealed with a deterministic **`sha256_attestation`** digest and structured **`evidence_sources`**.

> **Software Disclaimer**: Tax-Anything provides deterministic tax calculation and e-invoice format validation software tooling only. It is **not a licensed CPA firm**, not a licensed customs broker, and does not provide formal tax, accounting, or legal advice. Always consult qualified local tax counsel for binding filings.

## Hard Guarantees

1. **Pure `Decimal` Arithmetic (`ROUND_HALF_UP`, Zero Float Drift)**: Every calculation executes exclusively in Python `decimal.Decimal` and serializes monetary totals as exact strings (eliminating `0.1 + 0.2 != 0.30` drift). Peppol UBL `LegalMonetaryTotal` reconciliation enforces strict `<= 0.01` balance tolerance.
2. **Strict `$0` Billing on HTTP `422` & Errors**: Invalid inputs (`HTTP 422`), negative monetary amounts, unsupported country/state codes, sentinel placeholders (`"N/A"`, `""`, `"null"`), malformed XML, or `<!DOCTYPE` / `<!ENTITY` (XXE) payloads strictly return `billed_micros: 0` with `zero_bill_reason: "invalid_input_422"`.
3. **Cross-Tenant Adaptive Archive Cache (7d-30d) & 10% Recheck Tier**: Deterministic results enter a SQLite WAL archive cache (7d initial TTL expanding 1.5x up to 30d). Same-tenant rechecks (`recheck: true`) bill **10%** of base domain pricing; new-tenant cache hits bill **100%**.
4. **Zero Customer Data Resale**: Customer tax payloads, order CSVs, VAT IDs, UBL XML invoices, and execution traces are never sold, licensed, or reused to train third-party models.

## Supported Tax & E-Invoice Domains & Micro-USD Pricing

| Domain (`domain`) | Scope & Rules | Base Price | 10% Recheck | Key Input Fields |
| :--- | :--- | :---: | :---: | :--- |
| `us_nexus` | US 50 states + DC 2026 Economic Nexus thresholds (CA/TX `$500k`, NY `$500k AND 100 txns`, NJ/IL `$100k OR 200 txns`, NOMAD exempt DE/MT/NH/OR, 80% warning) | `$0.030` (`30000`) | `$0.0030` (`3000`) | `state`, `sales_amount`, `transaction_count`, or `orders` / `orders_csv` |
| `eu_vat_oss` | EU-27 2026 standard & reduced/ebook VAT rates (incl. FI 25.5%, EE 24%, SK 23%), OSS `EUR 10,000` threshold, algorithmic VAT ID checksums, B2B `0%` Reverse Charge Art. 196 / Art. 44 legend | `$0.040` (`40000`) | `$0.0040` (`4000`) | `customer_country`, `seller_country`, `customer_type` (`B2B`/`B2C`), `customer_vat_id`, `net_amount`, `supply_type`, `oss_annual_sales_eur` |
| `ubl_peppol` | Peppol BIS Billing 3.0 / OASIS UBL 2.1 XML `Invoice` & `CreditNote` validator (XXE/DOCTYPE block, `CustomizationID`, `ProfileID`, `EndpointID/@schemeID`, line math, `<= 0.01` balance) | `$0.035` (`35000`) | `$0.0035` (`3500`) | `xml` (UBL 2.1 XML string) |
| `hs_landed_cost` | Cross-border HS tariff + import VAT/GST + MPF/handling across US, EU-27, UK, JP, CA, AU; `FOB` vs `CIF` conversion; De Minimis & `CN->US` Section 301 / Section 321 awareness | `$0.050` (`50000`) | `$0.0050` (`5000`) | `origin_country`, `destination_country`, `hs_code`, `goods_value`, `incoterm` (`FOB`/`CIF`), `freight_cost`, `insurance_cost`, `currency` |
| `wht_dst` | Bilateral WHT treaties (14 countries: US, IE, UK, DE, FR, NL, SG, JP, CA, AU, IN, CN, BR, KR), statutory vs treaty delta, W-8BEN-E / Form 10F checklists, and DST thresholds | `$0.045` (`45000`) | `$0.0045` (`4500`) | `payer_country`, `payee_country`, `payment_type`, `gross_amount`, `treaty_claim_valid`, `dst_country`, `annual_global_revenue`, `local_digital_revenue` |

## Quick Invocation

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

Discover available flat tools (`tax_calculate`, `tax_calculate_batch`, `tax_verify_receipt`):

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

Execute a live EU B2B Reverse Charge calculation via MCP:

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "tax_calculate",
    "arguments": {
      "domain": "eu_vat_oss",
      "seller_country": "DE",
      "customer_country": "IE",
      "customer_type": "B2B",
      "customer_vat_id": "IE6388047V",
      "net_amount": "1000.00",
      "supply_type": "saas"
    }
  }
}
```

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

Single US Economic Nexus check (New York conjunctive `$500k AND 100 txns`):

```bash
curl -sS -X POST https://tax.fastmesh.dev/calculate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ${TAX_API_KEY}" \
  -d '{
    "domain": "us_nexus",
    "state": "NY",
    "sales_amount": "525000.00",
    "transaction_count": 105
  }'
```

Concurrent heterogeneous batch with hard budget lock (`POST /calculate/batch`):

```bash
curl -sS -X POST https://tax.fastmesh.dev/calculate/batch \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ${TAX_API_KEY}" \
  -d '{
    "max_budget_micros": 250000,
    "items": [
      {"domain": "us_nexus", "state": "CA", "sales_amount": "510000.00", "transaction_count": 45},
      {"domain": "eu_vat_oss", "seller_country": "DE", "customer_country": "IE", "customer_type": "B2B", "customer_vat_id": "IE6388047V", "net_amount": "1000.00"},
      {"domain": "hs_landed_cost", "origin_country": "CN", "destination_country": "US", "hs_code": "8504.40", "goods_value": "500.00", "incoterm": "FOB"},
      {"domain": "wht_dst", "payer_country": "US", "payee_country": "IE", "payment_type": "software_license", "gross_amount": "10000.00", "treaty_claim_valid": true}
    ]
  }'
```

Retrieve a stored receipt by ID:

```bash
curl -sS https://tax.fastmesh.dev/receipt/tr_example_receipt_id
```

### 3. Via `treg hub` (0% Seller Commission, `$0` on 422/Miss)

```bash
treg call tax-anything \
  --data '{"domain":"hs_landed_cost","payload":"{\"origin_country\":\"CN\",\"destination_country\":\"US\",\"hs_code\":\"8504.40\",\"goods_value\":\"500.00\",\"incoterm\":\"FOB\"}"}'
```

## Example `TaxReceipt` Response

```json
{
  "receipt_id": "tr_euvat_de_ie_01",
  "domain": "eu_vat_oss",
  "target": "DE->IE/B2B",
  "verdict": "VERIFIED",
  "confidence": "1.0000",
  "disclaimer": "Deterministic tax calculation and e-invoice format validation software only. Not a CPA firm, not formal tax advice, and not legal or customs brokerage representation.",
  "evidence_sources": [
    {
      "source": "eu_vat_directive_2006_112_ec_2026",
      "url": "https://tax.fastmesh.dev/guides/eu-vat-oss-reverse-charge-2026",
      "status": "applied",
      "observed_at_utc": "2026-12-02T13:45:00Z",
      "summary": "2026 EU 27 Member State VAT rates, OSS EUR 10,000 threshold, and Art. 44 / Art. 196 Reverse Charge rules"
    }
  ],
  "checks": [
    {"name": "vat_id_checksum", "passed": true, "detail": "IE6388047V passed Irish Mod 23 check character"},
    {"name": "reverse_charge_art_196", "passed": true, "detail": "Reverse charge — VAT to be accounted for by the recipient under EU VAT Directive 2006/112/EC Articles 44 and 196."}
  ],
  "payload_sha256": "4f9e531ad0d3687511f85de2d689c7a0fbc40c7d9de85fe6d6eb2c314e548182",
  "sha256_attestation": "80c6764b59ce3db30e5f696daa8b2e61f63db49887cff8e47bc9e1a4bd073e06",
  "billed_micros": 40000,
  "base_price_micros": 40000,
  "cache_hit": false,
  "cache_tier": "live",
  "confirm_dual_source": false,
  "timestamp_utc": "2026-12-02T13:45:00Z",
  "zero_bill_reason": "",
  "details": {
    "customer_country": "IE",
    "applied_rate_pct": "0.00",
    "vat_amount_eur": "0.00",
    "reverse_charge_applied": true,
    "reverse_charge_legend": "Reverse charge — VAT to be accounted for by the recipient under EU VAT Directive 2006/112/EC Articles 44 and 196."
  }
}
```

## Local Tamper-Evident Receipt Verification (Python 3 Stdlib)

Any downstream auditor or agent can verify offline that a `TaxReceipt` has not been altered:

```python
import hashlib
import hmac
import json

def verify_receipt(receipt: dict) -> bool:
    """Recompute deterministic SHA-256 attestation over all fields except sha256_attestation."""
    expected = str(receipt.get("sha256_attestation") or "").strip().lower()
    if len(expected) != 64:
        return False
    unsigned = {k: v for k, v in receipt.items() if k != "sha256_attestation"}
    canonical = json.dumps(
        unsigned,
        sort_keys=True,
        separators=(",", ":"),
        ensure_ascii=False,
    ).encode("utf-8")
    actual = hashlib.sha256(canonical).hexdigest()
    return hmac.compare_digest(actual, expected)
```

Or invoke the MCP tool `tax_verify_receipt` directly with the full receipt JSON object.

## Prepaid Credit Packs (Creem.io, Non-Expiring, One-Time)

- **Starter (`$9.00`)**: `sku_tax_starter_9` — `$9.00` credits (`9,000,000` micros, `0%` bonus) — `https://www.creem.io/product/prod_tax_anything_starter_9`
- **Pro (`$29.00`, Recommended)**: `sku_tax_pro_29` — `$34.80` credits (`34,800,000` micros, `+20%` bonus) — `https://www.creem.io/product/prod_tax_anything_pro_29`
- **Scale (`$99.00`)**: `sku_tax_scale_99` — `$128.70` credits (`128,700,000` micros, `+30%` bonus) — `https://www.creem.io/product/prod_tax_anything_scale_99`
- **Enterprise (`$299.00`)**: `sku_tax_enterprise_299` — `$418.60` credits (`418,600,000` micros, `+40%` bonus) — `https://www.creem.io/product/prod_tax_anything_enterprise_299`

## Support & Discovery

- Service URL: `https://tax.fastmesh.dev/`
- Machine Index: `https://tax.fastmesh.dev/llms.txt`
- OpenAPI 3.1.0 Spec: `https://tax.fastmesh.dev/openapi.json`
- Technical Guides (30 pages): `https://tax.fastmesh.dev/guides`
- Contact: `ops@fastmesh.dev`
