agentleFS
Sagargupta16Sagargupta16/itr-agent/CLAUDE.md

itr-agent

CLAUDE.md9 starsChanged 3 months agoMITView on GitHub

This file stacks on top of the workspace root at C:\Code\GitHub\: - Root CLAUDE.md -- voice, rules, routing map, references, skills, slash commands, conventions. - Root MEMORY.md -- live facts across repos. - Root STATUS.md -- live PR/CI/security dashboard. - .claude/resources/ -- deep reference for collaboration, workflow, git, OSS, debugging, voice. Read those first. The guidance below only adds repo-specific context -- it does not override anything in the root. Local-first MCP server for Indian income tax (FY 2025-26 /…

  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never add a network transport or telemetry -- local-only is the product.

    line 78
  2. Very specific:

    Every new tool: annotations: { readOnlyHint: true, openWorldHint: false }, zod-described inputs, structuredContent output, disclaimers on …

    line 80
  3. Very specific:

    Never commit anything to fixtures/ -- it is gitignored because it is where real 26AS/AIS documents land during manual parser checks.

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file stacks on top of the workspace root at C:\Code\GitHub\:

  • Root CLAUDE.md -- voice, rules, routing map, references, skills, slash commands, conventions.
  • Root MEMORY.md -- live facts across repos.
  • Root STATUS.md -- live PR/CI/security dashboard.
  • .claude/resources/ -- deep reference for collaboration, workflow, git, OSS, debugging, voice.

Read those first. The guidance below only adds repo-specific context -- it does not override anything in the root.

Project

Local-first MCP server for Indian income tax (FY 2025-26 / AY 2026-27): deterministic tax engine + document parsers exposed as MCP tools over stdio. Public OSS, npm package itr-agent. Positioning: privacy-first -- everything runs on-device, unlike cloud finance MCPs (Fi/INDmoney).

Stack

  • Language: TypeScript 7 (strict, ESM, NodeNext)
  • Framework: @modelcontextprotocol/sdk 1.30 (stdio transport only), zod 4
  • Database: none -- rule packs are JSON files in data/
  • Package manager: pnpm
  • Deploy target: npm registry (npx -y itr-agent); .mcpb Desktop bundle planned

Run

pnpm install
pnpm build
node dist/index.js        # stdio MCP server
pnpm inspect              # MCP inspector UI

Test

pnpm test         # engine golden cases + in-memory MCP client round trips (151 tests)
pnpm lint         # biome
pnpm typecheck    # two configs: tsconfig.json (src) + tsconfig.test.json (src + tests)

pnpm typecheck runs twice on purpose: tsconfig.json carries the build's rootDir/outDir/declaration settings and excludes tests/, so without the second config the test suite is never typechecked and a stale call signature only shows up at runtime.

Entry points

  • src/index.ts -- stdio bootstrap (banner adds the shebang via tsup)
  • src/server.ts -- all tool registrations (the MCP surface)

Key files

  • src/engine/compute.ts -- the tax engine: slabs (incl. senior/super-senior slab sets), 87A + marginal relief, CG rates with the s.111A/s.112A(2) basic-exemption set-off, surcharge with its own marginal relief, cess, s.288A/288B rounding. Pure functions; the LLM never does arithmetic
  • data/fy2025-26.json -- rule pack: EVERY tax constant lives here, never inline in code. validatePack() in rulepack.ts throws at load time if a pack is missing a section the engine reads, which is why the config fields are required rather than optional-with-a-code-fallback
  • src/parsers/form26as.ts -- caret-delimited TRACES text parser (tolerant, warnings[] over throws). Amounts are read POSITIONALLY from the cells after the section code, never by filtering for numeric-looking cells: a blank cell shifts that window and silently mis-assigns amount paid / TDS deducted / TDS deposited
  • tests/engine.test.ts -- golden cases pinned to published worked examples plus statute-pinned surcharge, age-band, and rounding cases
  • docs/v0.2-spec.md -- researched design + statutory citations, NOT a description of shipped behaviour. It predates the v0.2 code and roughly half of it was never built (Form 16 PDF parsing, the AIS CSV fallback, the SFT lookup, reconcile H2/M2/L1/L2, the whitelist engine). Every section carries a status marker; the table at the top is the index. Update those markers whenever one of those items lands

Gotchas

  • stdout is the MCP channel -- all logging must go to stderr (console.error). One stray console.log breaks the protocol.
  • Rules key off TRANSACTION DATES, not just FY: 23-Jul-2024 (CG rate flip), 1-Apr-2023 (debt MF s50AA), 1-Oct-2024 (buyback deemed dividend). Keep date boundaries in the rule pack when those land.
  • 87A rebate NEVER offsets 111A/112A tax under the new regime (Finance Act 2025 second proviso) -- the engine applies it to normal-income slab tax only, driven by allowAgainst111A / allowAgainst112A in the pack. A mutation test in tests/engine.test.ts flips allowAgainst111A on and asserts the answer changes, so the claim is enforced and not just documented.
  • The 87A THRESHOLD tests TOTAL income in both regimes (thresholdBasis: "totalIncome", pack 1.4.0). Pack 1.3.0 had the new regime on normalIncome, which over-rebated anyone whose gains pushed total income past 12L; the statute's first proviso says "total income" in both clause (a) and clause (b). The contrary reading is a real practitioner position, so it stays encodable and compute_tax names the reading in disclaimers whenever gains are present.
  • parse_form26as: TCS collectors carry TANs exactly like deductors, so a part-header reset alone does NOT keep TCS out of tdsEntries. Rows are split by section (206C* -> tcsEntries). Booking status is the second cell after the section; only F is creditable and creditableTdsDeposited says so. Current 26AS layout: Part I TDS, Part II 15G/15H TDS, Part VI TCS, Part VII refunds; SFT/challans moved to AIS.
  • McpServer version comes from packageVersion() (reads package.json next to data/). Never hardcode it again; it drifted to 0.3.0 while the package was 0.4.0.
  • readDocument has an extension allow-list (.txt for 26AS, .json/.txt for AIS) and refuses dotfiles. path is otherwise an arbitrary-file-read for a prompt-injected client.
  • The senior / super-senior basic exemption is a SLAB SET (oldRegime.slabsSenior / slabsSuperSenior), never an income deduction. Subtracting it from income under-taxes by a whole slab and mis-states total income; the age-band tests pin taxableNormalIncome for exactly this reason.
  • Surcharge marginal relief compares tax PLUS surcharge at the band threshold against the actual figure (via a notional recomputation on income rolled back to the threshold). Comparing surcharge alone leaves the full amount standing just past a band edge.
  • The 25%/37% surcharge bands exclude 111A/112/112A/dividend income (First Schedule Part I Para A), so a taxpayer past Rs 2 crore purely on gains stays in the 15% band.
  • SDK v2 has NOT shipped: as of 2026-09-06 npm's latest dist-tag for @modelcontextprotocol/sdk is still 1.30.0, with no 2.x published. When it lands it flips registerTool input schemas from raw zod shapes to z.object(), which is why the multi-field shapes are hoisted to module-level consts in src/server.ts (taxInputShape, interest234Shape, hraShape); single-purpose tool schemas stay inline at their registration. Forward-looking, not an imminent migration.
  • data/ ships in the npm package (files field); resolveDataDir() in rulepack.ts probes both dist- and src-relative paths.
  • server.json (MCP registry manifest) carries the version TWICE -- top level and packages[0].version -- and both must equal package.json version and the release tag. publish.yml fails the release if they drift, or if server.json name stops matching package.json mcpName.
  • FY 2026-27 pack: Form 16 becomes Form 130 and HRA metros go 4 -> 8 (Income-tax Act 2025 + Income-tax Rules 2026, effective 1 Apr 2026); buyback reverts to capital gains (Finance Act 2026). New JSON pack + availableYears() update, no engine changes expected.
  • Deadlines: itr3_4_nonAudit 2026-08-31 and revised 2027-03-31 are BOTH Finance Act 2026 and both correct -- a line-by-line review flagged them as wrong before the fact-check confirmed them. deadlineCitations in the pack carries the basis for each; keep it in step with deadlines.

Repo-specific rules

  • Never add a network transport or telemetry -- local-only is the product.
  • Tax constants only ever change via data/*.json + a CHANGELOG entry citing the source (Finance Act / CBDT circular / incometax.gov.in page).
  • Every new tool: annotations: { readOnlyHint: true, openWorldHint: false }, zod-described inputs, structuredContent output, disclaimers on anything that computes tax.
  • Parsers must be tolerant: collect warnings[], never throw on layout surprises; errors must name the fix ("download the Text format from TRACES").
  • Text output masks PAN; structuredContent does NOT (downstream tools need the real value). So "local-only" describes this server, not the whole stack -- the connected client still sees parsed contents. Say that plainly in docs rather than claiming the PAN never leaves the process.
  • Never commit anything to fixtures/ -- it is gitignored because it is where real 26AS/AIS documents land during manual parser checks.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.