Kkarthik.dev
Back to projects
AI

TrailCut

Tax-smart Regular-to-Direct mutual fund switch planner with an AI agent team that never invents a number

PythonFastAPIReactViteRazorpay BladeClaude APIcasparser

Overview

TrailCut reads an Indian mutual fund statement (CAMS / KFintech CAS), finds the money lost to Regular-plan commissions, and plans the cheapest, tax-smart way to move to Direct plans: which units, in what order, on which date, with the exact tax and exit load, explained in plain language. It is a calculator and explainer, not investment advice.

Problem

SEBI made Direct plans the default on AMC digital platforms from 1 Nov 2026, yet most retail money still sits in Regular plans. Switching everything at once can cost more in capital-gains tax and exit load than the commission it saves.

Solution

A pure, decimal-precise engine prices a switch for every purchase lot on candidate dates (today, when it turns long term, when exit load ends, when ELSS lock-in ends, 1 April) and picks the cheapest. An agent team explains the plan and may only quote numbers the engine produced.

Architecture

  1. 1apps/web: React + Vite + Razorpay Blade UI
  2. 2apps/api: FastAPI
  3. 3packages/ingest: casparser → normalise → mask PII in memory, nothing stored
  4. 4packages/engine: XIRR, FIFO lots, STCG/LTCG, exit load, TER projections, switch optimiser
  5. 5packages/agent: Claude tool calling, 4 specialists, 8 tools, numeric-claim validator, offline fallback
  6. 6Tax rules versioned in YAML with sources

Technical Challenges

  • Tax correctness: the yearly LTCG exemption is shared across lots and financial years, with ELSS lock-ins and 2018 grandfathering.
  • Stopping the AI from inventing numbers — a validator rejects any figure the calculator didn't produce.
  • Privacy: reading financial statements without storing or exposing personal data.

Results

  • 1,340+ tests passing with engine coverage of 90% or more.
  • 0 invented numbers in agent evals.
  • Lot-by-lot switch plan with CSV and PDF export, dark mode and a no-statement quick estimate.