Claude Fable 5
Deploy v20: engine-driven UI + SES email delivery (replaces v8 prompt wrapper)
7fd88a5 verified Download scripts/validate_tax.py from railnexus/value: direct link, hf CLI and curl.
- Browser
- Download file 32.4 kB
-
https://huggingface.co/spaces/railnexus/value/resolve/main/scripts/validate_tax.py
- Command line
-
hf download hf://spaces/railnexus/value/scripts/validate_tax.py
-
curl -L -o validate_tax.py https://huggingface.co/spaces/railnexus/value/resolve/main/scripts/validate_tax.py
32.4 kB
| #!/usr/bin/env python3 | |
| """ | |
| validate_tax.py — Tax compliance checklist generator by jurisdiction and transaction type. | |
| Usage: | |
| python scripts/validate_tax.py --jurisdiction spain --transaction sale --value 2500000 | |
| python scripts/validate_tax.py --jurisdiction uk --transaction sale --entity-type company | |
| python scripts/validate_tax.py --jurisdiction usa --transaction sale --value 3000000 | |
| python scripts/validate_tax.py --jurisdiction india --transaction sale --value 15000000 | |
| python scripts/validate_tax.py --jurisdiction spain --transaction lease | |
| Output: | |
| JSON checklist of tax obligations with DONE/PENDING/NA status fields, | |
| deadlines, sanctions for non-compliance, and responsible party. | |
| This script generates the checklist structure. The agent marks each item | |
| as DONE / PENDING / NA based on information provided by the user. | |
| IMPORTANT: This is a framework for analysis — not tax advice. Verify all | |
| obligations with qualified local tax counsel before any transaction. | |
| """ | |
| import argparse | |
| import json | |
| import sys | |
| # ─── Checklist Templates ─────────────────────────────────────────────────────── | |
| CHECKLISTS = { | |
| # ── SPAIN — SALE ────────────────────────────────────────────────────────── | |
| "spain_sale": { | |
| "title": "Tax Compliance Checklist — Spain Property Sale / Compraventa", | |
| "jurisdiction_label": "Spain — Análisis bajo ley española", | |
| "reference": "references/countries/eu/spain/tax-law.md", | |
| "items": [ | |
| { | |
| "id": "ES-S01", "obligado": "Buyer / Comprador", | |
| "item": "ITP_or_IVA_calculated_on_correct_base", | |
| "desc": ( | |
| "Determine if ITP (resale) or IVA+AJD (new build) applies — they are MUTUALLY EXCLUSIVE. " | |
| "Calculate on higher of: transaction price or valor de referencia catastral. " | |
| "ITP rate: 6-10% depending on CCAA (Madrid 6%, Cataluña 10%, Baleares 11%)." | |
| ), | |
| "deadline": "Autoliquidación within 30 days of deed (escritura)", | |
| "sanction": "Instrument inadmissible in court; AEAT demand + interest 3.75%/yr + penalty 50-150% of unpaid", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-S02", "obligado": "Buyer / Comprador", | |
| "item": "AJD_autoliquidated", | |
| "desc": ( | |
| "AJD (Actos Jurídicos Documentados) cuota gradual if deed is a public notarial document. " | |
| "Rate: 0.5-2% depending on CCAA (Madrid 0.75%, Valencia 2.0%). " | |
| "Paid separately from ITP." | |
| ), | |
| "deadline": "Within 30 days of deed", | |
| "sanction": "Surcharge 5-20% + interest if late; penalty if not filed", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-S03", "obligado": "Seller / Vendedor", | |
| "item": "plusvalia_municipal_IIVTNU_calculated_and_paid", | |
| "desc": ( | |
| "Calculate IIVTNU by BOTH methods (STC TC 26/2021 — mandatory): " | |
| "(1) Objective method: cadastral land value × coefficient × municipal rate. " | |
| "(2) Real method: (sale price of land portion) − (acquisition price of land portion). " | |
| "Use whichever is MORE FAVOURABLE to the taxpayer. " | |
| "If land has lost value: no tax due (STC TC 59/2017). " | |
| "Pay to the municipality where the property is located." | |
| ), | |
| "deadline": "30 days from deed date (inter vivos); 6 months (mortis causa)", | |
| "sanction": "Penalty 50-150% of unpaid + interest; criminal prosecution if fraudulent", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-S04", "obligado": "Buyer / Comprador (if seller is non-resident)", | |
| "item": "non_resident_seller_3pct_retention_via_modelo_211", | |
| "desc": ( | |
| "MANDATORY if seller is non-resident (regardless of nationality or country of residence): " | |
| "Buyer withholds 3% of the TOTAL SALE PRICE (not of the gain) and remits via " | |
| "Modelo 211 within 30 days of the deed. " | |
| "Legal basis: IRNR Art.25.2 LIRNR. " | |
| "If buyer does NOT withhold: buyer is jointly liable (responsable solidario) " | |
| "for the seller's IRNR on the capital gain. " | |
| "Seller can claim refund if IRNR on actual gain < 3% retention." | |
| ), | |
| "deadline": "30 days from escritura (deed date)", | |
| "sanction": "Buyer jointly liable for full IRNR + interest + penalty if not withheld", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-S05", "obligado": "Seller / Vendedor", | |
| "item": "IRPF_or_IRNR_capital_gain_declared", | |
| "desc": ( | |
| "IRPF (resident) or IRNR (non-resident) on the capital gain. " | |
| "IRPF savings rate: 19% (up to EUR 6K), 21% (6K-50K), 23% (50K-200K), " | |
| "27% (200K-300K), 28% (over EUR 300K). " | |
| "Exemptions to check: (1) Over-65 selling main residence — fully exempt. " | |
| "(2) Reinvestment in main residence — exempt pro-rata (Art.38 LIRPF). " | |
| "IRNR (non-resident): 19% EU/EEA residents; 24% all others. " | |
| "IRNR non-residents file Modelo 210 within 30 days of deed." | |
| ), | |
| "deadline": "IRPF: annual return (Apr-Jun following year). IRNR: 30 days from deed.", | |
| "sanction": "Interest 3.75%/yr + penalty 50-150% of unpaid tax", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-S06", "obligado": "Both parties", | |
| "item": "deed_registered_at_registro_de_propiedad", | |
| "desc": ( | |
| "Escritura pública registered at the Registro de la Propiedad. " | |
| "Without registration: transaction is not enforceable against third parties. " | |
| "Registrar will reject if taxes not paid (ITP/AJD self-assessment must be presented)." | |
| ), | |
| "deadline": "No statutory deadline but critical for security", | |
| "sanction": "Inoponibilidad frente a terceros — deal can be overridden by later registered transaction", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-S07", "obligado": "Buyer / Comprador", | |
| "item": "catastro_ownership_change_communicated", | |
| "desc": ( | |
| "Buyer must communicate the ownership change to the Catastro within 2 months " | |
| "of the deed. Usually handled by the notary (notificación automática) — confirm." | |
| ), | |
| "deadline": "2 months from escritura", | |
| "sanction": "Multa by Catastro for non-communication", | |
| "status": "PENDING", | |
| }, | |
| ], | |
| }, | |
| # ── UK — SALE ───────────────────────────────────────────────────────────── | |
| "uk_sale": { | |
| "title": "Tax Compliance Checklist — UK Property Sale", | |
| "jurisdiction_label": "United Kingdom — Analysis under UK law", | |
| "reference": "references/countries/uk/tax-law.md", | |
| "items": [ | |
| { | |
| "id": "UK-S01", "obligado": "Buyer (England/NI)", | |
| "item": "SDLT_return_filed_and_paid", | |
| "desc": ( | |
| "SDLT1 return filed with HMRC and Stamp Duty Land Tax paid. " | |
| "Residential rates: 0% up to GBP 250K; 5% (250K-925K); 10% (925K-1.5M); 12% above. " | |
| "Non-residential: 0% up to GBP 150K; 2% (150K-250K); 5% above. " | |
| "Surcharges: +3% additional dwelling; +2% non-resident buyer. " | |
| "Scotland: use LBTT (Revenue Scotland). Wales: use LTT (Welsh Revenue Authority)." | |
| ), | |
| "deadline": "14 DAYS from completion — SDLT Act 2003 s.76. NO EXTENSIONS.", | |
| "sanction": "Day 1: GBP 100 automatic. Day 91: GBP 200. 12 months: GBP 300 or 5% of SDLT. Interest accrues daily.", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "UK-S02", "obligado": "Seller (residential property)", | |
| "item": "CGT_reported_and_paid_within_60_days", | |
| "desc": ( | |
| "CGT on UK residential property MUST be reported and initial payment made within " | |
| "60 days of completion via HMRC's UK Property Account (online portal). " | |
| "Rates: 18% (basic rate) / 28% (higher rate). Annual exempt amount: GBP 3,000. " | |
| "PPR relief if main residence. " | |
| "Non-residents: same 60-day rule applies (since April 2020). " | |
| "Commercial property CGT: reported via self-assessment return — no 60-day rule." | |
| ), | |
| "deadline": "60 days from completion date", | |
| "sanction": "GBP 100 late filing penalty + interest on unpaid CGT from due date", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "UK-S03", "obligado": "Company owner (if applicable)", | |
| "item": "ATED_return_if_company_holds_residential", | |
| "desc": ( | |
| "Annual Tax on Enveloped Dwellings (ATED) applies if a company holds UK residential " | |
| "property worth more than GBP 500,000. " | |
| "Annual return due 30 April. Payment due 30 April. " | |
| "Multiple reliefs available — must be claimed on return (not automatic). " | |
| "Relief: property let to unconnected tenant at arm's length." | |
| ), | |
| "deadline": "30 April each tax year", | |
| "sanction": "Daily penalties + interest. Criminal prosecution in serious cases.", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "UK-S04", "obligado": "Seller (commercial property)", | |
| "item": "VAT_option_to_tax_checked", | |
| "desc": ( | |
| "Check if seller has opted to tax (OTT) the property. " | |
| "If OTT in place: 20% VAT charged on sale price — buyer must be able to recover. " | |
| "Transfer of Going Concern (TOGC): may disapply VAT if conditions met " | |
| "(both parties VAT-registered, property let, buyer adopts OTT). " | |
| "Check with seller's solicitor and accountant." | |
| ), | |
| "deadline": "Before exchange of contracts", | |
| "sanction": "Incorrect VAT treatment leads to HMRC assessment, interest and penalties", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "UK-S05", "obligado": "Seller (if non-resident)", | |
| "item": "NRCGT_reported_if_non_resident", | |
| "desc": ( | |
| "Non-Resident Capital Gains Tax (NRCGT): non-UK residents subject to CGT on " | |
| "UK property gains since April 2015 (residential) and April 2019 (commercial). " | |
| "Same 60-day reporting requirement as UK residents. " | |
| "Rates same as residents. File via HMRC UK Property Account." | |
| ), | |
| "deadline": "60 days from completion", | |
| "sanction": "Same as UK residents: GBP 100 penalty + interest", | |
| "status": "PENDING", | |
| }, | |
| ], | |
| }, | |
| # ── USA — SALE ──────────────────────────────────────────────────────────── | |
| "usa_sale": { | |
| "title": "Tax Compliance Checklist — US Property Sale", | |
| "jurisdiction_label": "USA — Analysis under US federal law (state taxes vary)", | |
| "reference": "references/countries/usa/tax-law.md", | |
| "items": [ | |
| { | |
| "id": "US-S01", "obligado": "Buyer / Closing Agent", | |
| "item": "state_transfer_tax_paid_at_closing", | |
| "desc": ( | |
| "State and local transfer taxes paid at closing. " | |
| "Rates vary dramatically: Texas 0%; California ~0.11%; Florida 0.7%; " | |
| "New York State 0.4% + NYC 1-2.075% + Mansion Tax if >= USD 1M. " | |
| "VERIFY specific state, county, and municipal rates with local counsel." | |
| ), | |
| "deadline": "At closing — must be paid before deed recorded", | |
| "sanction": "Deed not recorded; title defect; lender cannot fund", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "US-S02", "obligado": "Seller (if pursuing 1031 exchange)", | |
| "item": "1031_QI_designated_before_closing", | |
| "desc": ( | |
| "Section 1031 Like-Kind Exchange: Qualified Intermediary (QI) MUST be designated " | |
| "and exchange agreement signed BEFORE the relinquished property closing. " | |
| "Seller CANNOT receive, control, or pledge sale proceeds — QI holds them directly. " | |
| "If seller touches funds even briefly: exchange FAILS and full gain is taxable." | |
| ), | |
| "deadline": "QI engaged BEFORE closing — no exceptions", | |
| "sanction": "Exchange fails; entire capital gain taxable in year of sale + potential underpayment penalty", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "US-S03", "obligado": "Seller (if pursuing 1031 exchange)", | |
| "item": "1031_45_day_identification_window", | |
| "desc": ( | |
| "Replacement property must be IDENTIFIED IN WRITING to the QI within 45 CALENDAR " | |
| "DAYS of the relinquished property closing. " | |
| "Rules: 3-Property Rule (identify up to 3 properties, any value), OR " | |
| "200% Rule (any number of properties, total value ≤ 200% of relinquished), OR " | |
| "95% Rule (any number if 95% actually acquired). " | |
| "45-day window is ABSOLUTE — no extensions (except presidentially-declared disasters)." | |
| ), | |
| "deadline": "45 calendar days from relinquished property closing", | |
| "sanction": "Exchange fails; entire gain taxable if identification deadline missed", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "US-S04", "obligado": "Seller (if pursuing 1031 exchange)", | |
| "item": "1031_180_day_closing_window", | |
| "desc": ( | |
| "Replacement property must be ACQUIRED (closed) within 180 CALENDAR DAYS of the " | |
| "relinquished property closing, OR by the tax return due date (including extensions) " | |
| "— whichever is EARLIER. " | |
| "If tax return due before 180 days: file for extension to preserve 180 days." | |
| ), | |
| "deadline": "180 calendar days from relinquished property closing (earlier if tax return due sooner)", | |
| "sanction": "Exchange fails if closing window missed; full gain taxable", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "US-S05", "obligado": "Buyer (if seller is foreign person)", | |
| "item": "FIRPTA_withholding_15pct", | |
| "desc": ( | |
| "FIRPTA: if seller is a 'foreign person' (non-US citizen non-resident, foreign corporation, etc.), " | |
| "buyer must withhold 15% of the AMOUNT REALIZED (not the gain). " | |
| "File Form 8288 (and copy A of 8288-A) and remit withheld amount to IRS. " | |
| "Exceptions: (1) Amount realized ≤ USD 300K AND buyer will use as residence = 0%. " | |
| "(2) USD 300K-1M AND buyer residence use = 10%. " | |
| "(3) Seller provides withholding certificate (Form 8288-B)." | |
| ), | |
| "deadline": "Form 8288 filed and tax paid within 20 days of closing", | |
| "sanction": "Buyer becomes personally liable for seller's US tax + interest + penalties", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "US-S06", "obligado": "Seller", | |
| "item": "depreciation_recapture_Sec1250_calculated", | |
| "desc": ( | |
| "Unrecaptured Section 1250 gain (depreciation recapture) taxed at maximum 25% — " | |
| "separate from the general long-term capital gains rate. " | |
| "Applies to all commercial real property with accumulated depreciation. " | |
| "Calculate: total depreciation taken over holding period = recapture amount. " | |
| "Cannot be deferred in a 1031 exchange (recapture is still deferred in 1031)." | |
| ), | |
| "deadline": "Tax return for the year of sale", | |
| "sanction": "Underpayment penalty + interest on unpaid recapture tax", | |
| "status": "PENDING", | |
| }, | |
| ], | |
| }, | |
| # ── INDIA — SALE ────────────────────────────────────────────────────────── | |
| "india_sale": { | |
| "title": "Tax Compliance Checklist — India Property Sale", | |
| "jurisdiction_label": "India — Analysis under Indian law (Income Tax Act 1961, state stamp duty laws)", | |
| "reference": "references/countries/india/tax-law.md", | |
| "items": [ | |
| { | |
| "id": "IN-S01", "obligado": "Seller / Vendedor", | |
| "item": "capital_gains_LTCG_STCG_computed", | |
| "desc": ( | |
| "Determine LTCG (held > 24 months) or STCG (held ≤ 24 months). " | |
| "LTCG rate: 12.5% without indexation (Finance Act 2024 — verify current position). " | |
| "STCG: taxed at applicable slab rate. " | |
| "Exemptions to check: Sec.54 (reinvest in residential — max INR 10Cr), " | |
| "Sec.54F (reinvest from any asset), Sec.54EC (bonds — max INR 50L within 6 months). " | |
| "CGAS deposit if reinvestment not done by tax return due date." | |
| ), | |
| "deadline": "Advance tax quarterly; final settlement in annual return", | |
| "sanction": "Interest u/s 234B/234C + penalty if concealed", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "IN-S02", "obligado": "Buyer / Purchaser", | |
| "item": "TDS_194IA_deducted_and_Form_26QB_filed", | |
| "desc": ( | |
| "Section 194-IA: if consideration > INR 50 lakhs, buyer MUST deduct TDS at 1% " | |
| "and deposit via Form 26QB online within 30 days. " | |
| "Issue Form 16B to seller within 15 days of deposit. " | |
| "Note: TDS is on TOTAL consideration, not just the portion above 50L. " | |
| "Non-deduction: buyer is assessee-in-default — liable for TDS amount + interest 1%/month + penalty equal to TDS." | |
| ), | |
| "deadline": "Form 26QB within 30 days of month-end in which deduction made", | |
| "sanction": "Assessee-in-default; interest 1%/month (non-deduction) or 1.5%/month (non-payment) + equal penalty", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "IN-S03", "obligado": "Buyer / Purchaser", | |
| "item": "stamp_duty_and_registration_completed", | |
| "desc": ( | |
| "Stamp duty paid at state-specific rate (4-8%) on the HIGHER of: " | |
| "transaction value or circle rate (ready reckoner rate). " | |
| "Document registered at Sub-Registrar Office. " | |
| "If circle rate > transaction price: Sec.50C applies to seller (deemed consideration), " | |
| "and Sec.56(2)(x) may apply to buyer (deemed income if difference > INR 50K)." | |
| ), | |
| "deadline": "Before or at time of registration (must be done on day of execution or within statutory period)", | |
| "sanction": "Instrument inadmissible; document not accepted by Sub-Registrar; penalty for under-stamping", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "IN-S04", "obligado": "Seller / Vendedor", | |
| "item": "Section_50C_circle_rate_checked", | |
| "desc": ( | |
| "Section 50C: if circle rate > transaction price, capital gains computed on circle rate. " | |
| "Remedy: obtain certificate from registered valuer (Sec.50C(2) proviso) if actual FMV < circle rate. " | |
| "Threshold: no deemed consideration if circle rate ≤ 110% of transaction price (safe harbour). " | |
| "If circle rate > 110% of price: deemed consideration = circle rate." | |
| ), | |
| "deadline": "Before signing sale deed", | |
| "sanction": "Capital gains computed on higher circle rate; phantom income taxed", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "IN-S05", "obligado": "Both parties (if NRI/foreign entity involved)", | |
| "item": "FEMA_compliance_verified", | |
| "desc": ( | |
| "FEMA: NRI/OCI can purchase residential or commercial property (not agricultural/plantation/farmhouse) " | |
| "without RBI approval. Foreign companies/entities: case-by-case RBI approval required. " | |
| "Repatriation: up to 2 residential properties; proceeds from original remittance. " | |
| "Reporting: AD Bank must be notified. TRC and Tax Residency Certificate required for DTAA benefits." | |
| ), | |
| "deadline": "Before transaction", | |
| "sanction": "FEMA contravention: compounding fine up to 3× the transaction amount; criminal prosecution in serious cases", | |
| "status": "PENDING", | |
| }, | |
| ], | |
| }, | |
| # ── SPAIN — LEASE ───────────────────────────────────────────────────────── | |
| "spain_lease": { | |
| "title": "Tax Compliance Checklist — Spain Commercial Lease (Ongoing)", | |
| "jurisdiction_label": "Spain — Análisis bajo ley española", | |
| "reference": "references/countries/eu/spain/tax-law.md", | |
| "items": [ | |
| { | |
| "id": "ES-L01", "obligado": "Landlord / Arrendador", | |
| "item": "IVA_21pct_on_commercial_rent_charged_and_declared", | |
| "desc": ( | |
| "IVA at 21% on all commercial rent (uso distinto a vivienda). " | |
| "Landlord must be registered for IVA (Modelo 036/037). " | |
| "Issue factura with IVA to tenant each rental period. " | |
| "File quarterly Modelo 303; annual Modelo 390 summary. " | |
| "Tenant recovers IVA as input tax if VAT-registered." | |
| ), | |
| "deadline": "Quarterly declarations: April 20, July 20, October 20, January 30", | |
| "sanction": "AEAT demand for uncharge IVA + interest 3.75%/yr + penalty 50-150%", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-L02", "obligado": "Tenant / Arrendatario (if company or professional)", | |
| "item": "IRPF_19pct_retention_applied", | |
| "desc": ( | |
| "If tenant is a company (sociedad) or self-employed professional (autónomo), " | |
| "tenant must withhold IRPF retention of 19% from the rent and remit via " | |
| "Modelo 115 each quarter. " | |
| "Exception: tenant who is a private individual (persona física no empresaria) — " | |
| "no retention obligation. " | |
| "Annual summary: Modelo 180." | |
| ), | |
| "deadline": "Quarterly Modelo 115: April 20, July 20, October 20, January 30", | |
| "sanction": "Tenant is assessee-in-default for unretained amount + interest + penalty", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "ES-L03", "obligado": "Landlord / Arrendador", | |
| "item": "IBI_Impuesto_Bienes_Inmuebles_current", | |
| "desc": ( | |
| "IBI (Impuesto sobre Bienes Inmuebles) paid to municipality. " | |
| "Typically debited directly by municipality in August-November. " | |
| "Arrears on IBI create a real charge (carga real) on the property — " | |
| "buyer acquires property encumbered with IBI arrears. " | |
| "Always request IBI certification from municipality before any transaction." | |
| ), | |
| "deadline": "Per municipal calendar (usually August-November voluntary period)", | |
| "sanction": "Surcharge + interest; municipal enforcement proceedings; property charge", | |
| "status": "PENDING", | |
| }, | |
| ], | |
| }, | |
| # ── UK — LEASE ──────────────────────────────────────────────────────────── | |
| "uk_lease": { | |
| "title": "Tax Compliance Checklist — UK Commercial Lease (Ongoing)", | |
| "jurisdiction_label": "United Kingdom — Analysis under UK law", | |
| "reference": "references/countries/uk/tax-law.md", | |
| "items": [ | |
| { | |
| "id": "UK-L01", "obligado": "Landlord", | |
| "item": "SDLT_on_lease_premium_and_or_NPV_of_rent", | |
| "desc": ( | |
| "SDLT may be due on: (1) any premium paid for the lease, AND (2) the NPV of rent " | |
| "if it exceeds GBP 150,000 (non-residential). " | |
| "Calculate NPV of rent over lease term using HMRC formula. " | |
| "SDLT on NPV: 0% up to GBP 150K; 1% above GBP 150K (non-residential). " | |
| "File SDLT1 return within 14 days of lease commencement." | |
| ), | |
| "deadline": "14 days from lease effective date", | |
| "sanction": "Same as purchase SDLT penalties — GBP 100 day 1, escalating", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "UK-L02", "obligado": "Landlord", | |
| "item": "VAT_on_rent_if_OTT_in_place", | |
| "desc": ( | |
| "If landlord has opted to tax (OTT) the property: 20% VAT charged on rent. " | |
| "VAT invoices must be issued; quarterly VAT returns filed. " | |
| "If no OTT: rental is exempt — no VAT charged and no input VAT recovery on costs. " | |
| "OTT decision is irrevocable for 20 years (except in first 6 months)." | |
| ), | |
| "deadline": "Quarterly VAT returns", | |
| "sanction": "HMRC assessment for VAT not charged + interest + penalties", | |
| "status": "PENDING", | |
| }, | |
| { | |
| "id": "UK-L03", "obligado": "Landlord", | |
| "item": "rental_income_reported_for_income_tax_or_corporation_tax", | |
| "desc": ( | |
| "Individual landlord: rental profits taxed as income (20/40/45%). " | |
| "Finance cost restriction: mortgage interest restricted to basic rate (20%) relief. " | |
| "Company landlord: Corporation Tax at 25% (profits > GBP 250K). " | |
| "Non-resident landlord: 20% withheld by agent/tenant unless HMRC exemption granted (NRLS)." | |
| ), | |
| "deadline": "Self-assessment: 31 January following tax year-end", | |
| "sanction": "Automatic penalties + interest on unpaid tax", | |
| "status": "PENDING", | |
| }, | |
| ], | |
| }, | |
| } | |
| # ─── Helper ──────────────────────────────────────────────────────────────────── | |
| def get_checklist(jurisdiction: str, transaction: str, value=None, entity_type="individual") -> dict: | |
| key = f"{jurisdiction}_{transaction}" | |
| if key not in CHECKLISTS: | |
| available = list(CHECKLISTS.keys()) | |
| return { | |
| "error": f"No checklist found for jurisdiction='{jurisdiction}' transaction='{transaction}'.", | |
| "status": "NOT_IMPLEMENTED", | |
| "available_combinations": available, | |
| "declared_gap": ("data/jurisdiction_matrix.json lists exactly which jurisdiction/transaction " | |
| "checklists exist. Do not improvise a checklist for this combination; " | |
| "state the gap to the user and use the country reference file."), | |
| "add_instruction": f"To add: create CHECKLISTS['{key}'] in scripts/validate_tax.py", | |
| } | |
| cl = CHECKLISTS[key] | |
| return { | |
| "jurisdiction": jurisdiction, | |
| "transaction": transaction, | |
| "entity_type": entity_type, | |
| "value": value, | |
| "title": cl["title"], | |
| "jurisdiction_label": cl["jurisdiction_label"], | |
| "reference_file": cl["reference"], | |
| "item_count": len(cl["items"]), | |
| "items": cl["items"], | |
| "instructions": ( | |
| "Mark each item STATUS as: DONE (confirmed compliant) / PENDING (action required) / NA (not applicable). " | |
| "All PENDING items require action before closing or within stated deadline." | |
| ), | |
| "disclaimer": ( | |
| "This checklist is a structured framework for analysis only. " | |
| "It does not constitute tax advice. " | |
| "Verify all obligations with qualified local tax counsel before any transaction." | |
| ), | |
| } | |
| # ─── CLI ────────────────────────────────────────────────────────────────────── | |
| def main(): | |
| parser = argparse.ArgumentParser( | |
| description="Tax compliance checklist generator by jurisdiction and transaction type." | |
| ) | |
| parser.add_argument( | |
| "--jurisdiction", required=True, | |
| choices=["spain", "uk", "usa", "india", "uae", "france", "germany"], | |
| help="Country jurisdiction", | |
| ) | |
| parser.add_argument( | |
| "--transaction", required=True, | |
| choices=["sale", "lease", "purchase", "development", "refinancing"], | |
| help="Transaction type", | |
| ) | |
| parser.add_argument( | |
| "--value", type=float, default=None, | |
| help="Transaction value in local currency (optional — for context)", | |
| ) | |
| parser.add_argument( | |
| "--entity-type", default="individual", | |
| choices=["individual", "company", "non_resident", "reit", "trust", "nri", "foreign_entity"], | |
| help="Entity type of the principal party (default: individual)", | |
| ) | |
| args = parser.parse_args() | |
| result = get_checklist(args.jurisdiction, args.transaction, args.value, args.entity_type) | |
| print(json.dumps(result, indent=2, ensure_ascii=False)) | |
| # v16: a missing checklist is a declared gap, not a success. Exit 2 so callers | |
| # (and the agent) cannot mistake the error object for a checklist. | |
| sys.exit(2 if "error" in result else 0) | |
| if __name__ == "__main__": | |
| main() | |