The Verification Gate for AI-Generated Tax Decisions
Project description
๐ธ QWED-Tax
The Verification Gate for AI-Generated Tax Decisions
Tax software answers: "What is the correct calculation?"
QWED-Tax answers: "Should this AI-generated tax decision be allowed to execute?"
QWED-Tax sits between AI agents and execution systems (Gusto, Avalara, Stripe) โ verifying that tax decisions are legally sound before they execute. Not a calculator. Not a filing platform. A deterministic verification layer powered by Z3 and Decimal math.
โ๏ธ Why QWED-Tax?
Unlike calculators (Avalara) or executors (Gusto), QWED is a Verifier. We sit between the AI and the Execution.
| Solution | What They Do | The Risk | QWED's Role |
|---|---|---|---|
| Avalara / Stripe | Calculate tax based on inputs. | Garbage In, Garbage Out. If AI sends wrong input, tax is wrong. | The Filter: We verify inputs before API calls. |
| Gusto / Check | Execute payments and filings. | They execute erroneous commands (e.g., paying a W-2 as 1099). | The Shield: We block illegal payments before execution. |
| Blue J / ChatGPT | Research tax law. | Hallucination (85% accuracy). | The Proof: We verify the math & logic deterministically. |
๐จ The Problem: Unverified AI Tax Decisions
AI agents are making payroll and tax decisions that execute unchecked โ misclassifying workers, miscalculating withholding, and filing incorrect returns.
QWED-Tax is the verification gate:
AI-generated tax decision
โ
Deterministic verification (Allow / Block / Unverifiable)
โ
Execution system (Gusto, Avalara, Stripe)
"Death, Taxes, and Deterministic Verification."
๐๏ธ Architecture: The "Swiss Cheese" Defense
graph TD
A["๐ค AI Agent"] -->|"Intent"| B{"๐ก๏ธ QWED-Tax Pre-Flight"}
subgraph "Deterministic Guards"
C["Personal Tax<br/>(Payroll, 1099 vs W2)"]
D["Trading Tax<br/>(F&O, Crypto, STCG)"]
E["Corporate Tax<br/>(Sec 185 Loans, Valuations)"]
end
B --> C & D & E
C & D & E -->|"Audit Result"| B
B -- "โ
Verified" --> F["๐ Fintech API (Avalara/Gusto)"]
B -- "๐ Blocked" --> G["๐ซ Stop & Throw Error"]
style B fill:#00C853,stroke:#333,stroke-width:2px,color:white
style G fill:#ff4444,stroke:#333,stroke-width:2px,color:white
๐ง Procedural Accuracy (MSLR Aligned)
Unlike standard calculators, qwed-tax verifies the procedure, not just the result. This aligns with Multi-Step Legal Reasoning (MSLR) to prevent "Right Answer, Wrong Logic" errors.
- Step 1: Sanction Check $\rightarrow$ Is this transaction legal? (e.g.,
RelatedPartyGuardblocks illegal loans before rate checks). - Step 2: Limit Check $\rightarrow$ Is it within quota? (e.g.,
RemittanceGuardchecks LRS limit before TCS). - Step 3: Calculation $\rightarrow$ Apply math.
๐ Real World Failures We Blocked (From Audit Logs)
| Scenario | LLM Hallucinations | QWED Verdict |
|---|---|---|
| Senior Citizen FD | "Base 7% + 0.5% = 7.50000001%" (Float Error) | ๐ BLOCKED (Exact 7.50%) |
| Loss Set-Off | "Set off Intraday Loss against Salary" | ๐ BLOCKED (Illegal Inter-head adjustment) |
| Crypto Tax | "Deduct Bitcoin loss from Business Profit" | ๐ BLOCKED (Sec 115BBH violation) |
| Payroll | "FICA Tax on $500k = $31,000" | ๐ BLOCKED (Limit is $176k / ~$10k tax) |
๐ก Verification Coverage
Deterministic Tax Verification Layer for AI Agents A verification layer for tax decisions supported by
z3-solverandpython-decimal. It verifies claims across multiple jurisdictions โ it does not calculate, file, or execute.
| Feature | US (IRS) ๐บ๐ธ | India (CBDT / CBIC / FEMA) ๐ฎ๐ณ |
|---|---|---|
| Engine | z3 (ABC Test), decimal |
z3 (Intraday Rules), decimal |
| Key Guards | Payroll, FICA Limit, W-2/1099 | Crypto (Sec 115BBH), GST RCM (7 notified services), CGST/SGST/IGST split |
| Status | ๐ข Verification Layer | ๐ข Verification Layer |
Note: Guards verify specific deterministic rules. Full tax compliance (GSTR filing, GSTN integration, HSN/SAC classification) is explicitly out of scope. See What QWED-Tax Is Not.
๐ซ What QWED-Tax Is Not
QWED-Tax verifies decisions. It does not originate them, file them, or maintain the data pipelines that compliance platforms require.
Explicitly out of scope:
- GSTN portal integration / live GSTIN status lookup โ QWED validates GSTIN format and checksum, not registration status
- GSTR-1 / GSTR-2B / GSTR-3B reconciliation โ filing workflows belong in a compliance platform
- e-Invoicing / IRN generation โ execution-side operations, not verification
- HSN/SAC classification โ corpus maintenance is a data-curation problem, not a verification problem
- Tax filing or return preparation โ QWED verifies claims; it does not originate filings
- Regulatory change tracking as a service โ notifications, circulars, per-state rate updates
- Payroll processing or execution โ QWED verifies payroll math; it does not run payroll
- Tax calculation as a standalone engine โ QWED verifies a claimed result against statutory rules; it does not compute taxes for filing
If a feature requires live data sync, classification-corpus maintenance, or filing workflows, it belongs in a compliance platform โ not in QWED-Tax.
๐ก๏ธ The Guards
๐บ๐ธ United States (IRS)
- PayrollGuard: Verifies Gross-to-Net logic and enforces 2025 FICA Limit ($176,100).
- ClassificationGuard (IRS Common Law): Uses deterministic rules to verify W-2 vs 1099 status.
- ReciprocityGuard: Deterministically verifies state tax withholding (NY vs NJ rules).
- NexusGuard: Verifies Economic Nexus thresholds ($100k/$500k sales) to catch missing tax liabilities.
๐ฎ๐ณ India (CBDT / CBIC / FEMA)
- CryptoTaxGuard: Enforces Section 115BBH (No set-off of VDA losses).
- InvestmentGuard: Distinguishes Intraday (Speculative) from Delivery (Capital Gains) using strict rules.
- GSTGuard:
- Reverse Charge Mechanism (RCM): Verifies liability for notified services โ GTA, Legal, Security, Director, Sponsorship, Renting of motor vehicle, and Import of service.
- CGST/SGST/IGST split: Verifies the tax breakup against the place of supply (intra-state vs inter-state).
- RemittanceGuard (FEMA):
- LRS Limit: Enforces $250,000 annual limit per PAN.
- Prohibited: Blocks Gambling, Lottery, and Racing remittances.
- TCS: Applies 20% Tax Collected at Source on generic investments/tours.
- Accounts Payable Guards:
- InputCreditGuard: Blocks ITC on 'Blocked List' (Sec 17(5)) like Food/Motor Vehicles.
- TDSGuard: Enforces withholding tax (1% vs 10%) on Contractor/Professional payments.
๐ Zero-Data Leakage
Unlike cloud APIs (Avalara/Vertex), qwed-tax runs 100% Locally.
- Privacy First: Your payroll/trading data never leaves your server.
- No API Latency: Checks are instant (microseconds).
- GDPR/DPDP Compliant: Ideal for sensitive Fintech environments.
๐ See Determinism Guarantee for how QWED ensures 100% reproducible verification.
๐ฆ Installation
pip install qwed-tax
โก Usage
from qwed_tax.verifier import TaxVerifier
# 1. US FICA Check
us_tax = TaxVerifier(jurisdiction="US")
# ... usage (facade methods to be added or verified) ...
from qwed_tax.jurisdictions.us import PayrollGuard
pg = PayrollGuard()
result = pg.verify_fica_tax(gross_ytd=180000, current=5000, claimed_tax=310)
print(result.message)
# -> "โ FICA Error: Expected $68.20 (Hit Limit)"
# 2. India Crypto Check
in_tax = TaxVerifier(jurisdiction="INDIA")
res = in_tax.verify_india_crypto(losses={"VDA": -5000}, gains={"BUSINESS": 50000})
print(res.message)
# -> "โ ๏ธ Section 115BBH Alert: VDA loss cannot be set off."
๐งพ Accounts Payable Verification
qwed-tax verifies tax decisions in the Procure-to-Pay cycle for AI Agents:
- Validation: Checks GSTIN/VAT ID formats.
- Verification: Blocks Input Tax Credit (ITC) on "Personal" categories (Food, Cars, Gifts).
- Withholding: Verifies TDS/Retention amounts before commercial payment.
๐ TypeScript SDK
Run verification checks proactively in the browser/frontend.
npm install @qwed-ai/tax
import { TaxPreFlight } from '@qwed-ai/tax';
const result = TaxPreFlight.audit({
action: "hire",
worker_type: "1099",
worker_facts: { provides_tools: true, reimburses_expenses: true } // implies Employee
});
if (!result.allowed) {
alert(" Verification Block: " + result.blocks.join(", "));
}
๐ Fail-Closed Contract:
TaxPreFlightis strict by design. Missing, ambiguous, or unsupported intent payloads are blocked (allowed = false) rather than treated as a successful verification.
โก Usage (Frontend)
from qwed_tax.verifier import TaxPreFlight
preflight = TaxPreFlight()
report = preflight.audit_transaction({
"action": "hire",
"worker_type": "1099",
"worker_facts": {
"provides_tools": True,
"reimburses_expenses": True,
"indefinite_relationship": True
}, # Employee traits
"state": "NY",
"sales_data": {"amount": 600000} # Crosses Nexus
})
if not report["allowed"]:
print(f"๐ BLOCKED: {report['blocks']}")
โน๏ธ A claim is considered verified only when a supported
actionis provided and at least one deterministic check is actually executed.
๐ Examples
Check the examples/ directory for runnable scripts:
examples/demo_payroll.py: US FICA & Payroll verification.examples/demo_advanced.py: Complex Investment & Trading checks.
๐บ๏ธ Roadmap
Expanding verification guard coverage to more jurisdictions and tax rules. Check out our Detailed Roadmap for 2026 plans including:
- ๐ฌ๐ง UK (HMRC) & ๐จ๐ฆ Canada (CRA) Verification Guards
- Transfer Pricing & BEPS Verification Guards
- ERP Verification Connectors โ verify tax decisions before they enter SAP/Oracle
๐ฆ Related Packages
| Package | Description |
|---|---|
| qwed-verification | Core verification engine |
| qwed-finance | Banking & derivatives verification |
| qwed-mcp | Claude Desktop integration |
๐ค Contributing
We welcome contributions from Tax Experts and Developers! See CONTRIBUTING.md for guidelines.
๐ License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qwed_tax-0.2.0.tar.gz.
File metadata
- Download URL: qwed_tax-0.2.0.tar.gz
- Upload date:
- Size: 79.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
718d2e0e65bd6a3ceaddd5d45855f69dff63634fdbbf39c88b1da68c55661118
|
|
| MD5 |
b86f9612d3999ff32a268052fee8871d
|
|
| BLAKE2b-256 |
b4df3107bd59122897959dcde7a167263c711cbcd6fad1cfc343c8f07f7d9a8e
|
Provenance
The following attestation bundles were made for qwed_tax-0.2.0.tar.gz:
Publisher:
release.yml on QWED-AI/qwed-tax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qwed_tax-0.2.0.tar.gz -
Subject digest:
718d2e0e65bd6a3ceaddd5d45855f69dff63634fdbbf39c88b1da68c55661118 - Sigstore transparency entry: 1912094435
- Sigstore integration time:
-
Permalink:
QWED-AI/qwed-tax@60ee70a1f76b1a86e1670e5d8888f6a4cf081ef0 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/QWED-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60ee70a1f76b1a86e1670e5d8888f6a4cf081ef0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file qwed_tax-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qwed_tax-0.2.0-py3-none-any.whl
- Upload date:
- Size: 65.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9cb6fdd318a051877af3ba0ba8b429d12033bd0e4601dbf1a98efeec19c7259
|
|
| MD5 |
9f86db82bfae3776dd127c11f1af0ad4
|
|
| BLAKE2b-256 |
23a1d895f67e0c1780307fcb5687bf8b7f029f47bafae6e1d991d0f84350a78f
|
Provenance
The following attestation bundles were made for qwed_tax-0.2.0-py3-none-any.whl:
Publisher:
release.yml on QWED-AI/qwed-tax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qwed_tax-0.2.0-py3-none-any.whl -
Subject digest:
e9cb6fdd318a051877af3ba0ba8b429d12033bd0e4601dbf1a98efeec19c7259 - Sigstore transparency entry: 1912094508
- Sigstore integration time:
-
Permalink:
QWED-AI/qwed-tax@60ee70a1f76b1a86e1670e5d8888f6a4cf081ef0 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/QWED-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60ee70a1f76b1a86e1670e5d8888f6a4cf081ef0 -
Trigger Event:
release
-
Statement type: