Skip to main content
Glama
accounting-tax-doc-verifier

accounting-tax-doc-verifier

by nahianakhtar
README.md
# Accounting & 2026 IRS 1099-NEC/MISC Verification Engine (`accounting-tax-doc-verifier`)

Zero-dependency Python 3.12 accounting reconciliation, Tax Year 2026 Form 1099-NEC and 1099-MISC dual-threshold engine, fraud anomaly scanner, SHA-256 Merkle proof generator, and MCP `2025-11-25` Streamable HTTP server.

- **Interactive Browser Workbench**: https://nahianakhtar.github.io/demos/tax-doc-verifier/
- **Runtime Dependencies**: `0` (pure Python 3.12 standard library)
- **License**: MIT

## Why 2026 Accounting Teams Need Dual-Threshold Verification

Starting in Tax Year 2026 (filed in early 2027 through the IRS IRIS portal now that legacy FIRE is retired), federal Form 1099-NEC reporting rises from `$600.00` to `$2,000.00` under OBBBA. Three operational traps catch Accounts Payable teams and CPA practices off guard:

1. **Non-Conforming States & Legal Exceptions**: States such as NY, CA, MA, NJ, PA, and VT can still enforce `$600.00` state reporting, and gross proceeds or fees paid to attorneys (`legal` category) remain reportable at `$600.00` even when paid to corporations.
2. **Missing Form W-9 & 24% Backup Withholding**: Waiting until January to collect vendor W-9 TINs creates unrecovered `24.00%` IRS backup withholding exposure on cumulative payments.
3. **Floating-Point Drift & Split-Threshold Structuring**: Spreadsheet scripts leak cents on rounding, miss duplicate invoice resubmissions, and overlook vendors splitting a `$1,180.00` charge into two `$590.00` invoices three days apart to bypass `$1,000.00` approval rules.

## Core Capabilities

1. **Exact 128-Bit Scaled Integer Arithmetic**: Converts currency strings into integer micro-dollars (`10^-6 USD`) with `ROUND_HALF_EVEN` banker rounding so `subtotal + tax == total` holds with zero cent drift.
2. **2026 Federal `$2,000` vs `$600` State & Attorney Classifier**: Classifies every vendor across `services`, `legal`, `royalties` (`$10.00`), and `goods`, separating corporate exemptions from legal fee overrides and computing `24%` backup withholding reserves whenever a valid W-9 TIN is absent.
3. **Duplicate, Split-Invoice & Nigrini Benford Scanner**: Flags exact SHA-256 duplicate submissions, 7-day rolling split-invoice clusters, and first-digit Benford Mean Absolute Deviation (`MAD`).
4. **Domain-Separated SHA-256 Merkle Proofs & Human Approval Gate**: Builds a binary Merkle tree (`0x00` leaf prefix, `0x01` internal node prefix) with per-invoice inclusion proofs, exports an IRS IRIS intake CSV, and marks batches `human_approval_required: true` prior to general ledger posting.
5. **MCP `2025-11-25` + Vercel Serverless + Stripe/Polar Webhooks**: Ships `POST /mcp`, `POST /v1/audit`, timing-safe Stripe and Polar HMAC webhook handlers (`api/index.py` + `vercel.json`), a CLI (`--audit-csv`), `Dockerfile`, and GitHub Action (`action.yml`).

## Quickstart

```bash
# Run strict lint, static typing, and unit suite
ruff check .
mypy --strict src
PYTHONPATH=src pytest -q

# Start the local HTTP + MCP 2025-11-25 server on 127.0.0.1:8094
PYTHONPATH=src python3 -m tax_verifier.server --host 127.0.0.1 --port 8094
```

## Example MCP `2025-11-25` Tool Call

```bash
curl -s http://127.0.0.1:8094/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "audit_invoice_ledger_2026",
      "arguments": {
        "split_cap_usd": "1000.00",
        "invoices": [
          {
            "invoice_id": "INV-1001",
            "vendor_id": "V-APEX",
            "vendor_name": "Apex Cloud Consulting",
            "invoice_date": "2026-11-10",
            "category": "services",
            "entity_type": "sole_prop",
            "state": "NY",
            "w9_on_file": true,
            "tin_masked": "12-3456789",
            "subtotal_usd": "2150.00",
            "tax_usd": "0.00",
            "total_usd": "2150.00"
          }
        ]
      }
    }
  }'
```