Skip to content

Latest commit

ย 

History

49 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“’ KhaataKitab

โšก Agentic AI Ledger for Real-World Finance

Observe โ€ข Understand โ€ข Verify โ€ข Assist
Turning raw transaction signals into intelligent financial records


๐Ÿš€ Live App

Live App

The live deployment is primarily intended for demonstration. Some capabilities โ€” particularly native Android SMS ingestion and cloud synchronization โ€” remain under active development.


๐Ÿง  What Makes KhaataKitab Different?

Most finance apps expect users to input everything manually.

KhaataKitab behaves more like an assistant that watches, processes, and verifies โ€” reading signals that already exist (bank SMS, receipts) and turning them into structured, categorized ledger entries, with a human in the loop to confirm or correct.


๐ŸŽฏ Problem โ†’ Insight โ†’ Solution

๐Ÿšจ Problem ๐Ÿ’ก Insight โšก Solution
Scattered payments across apps/cash Bank SMS already contains the truth Parse SMS into structured transactions
Manual entry is tedious and error-prone Users forget to log transactions Auto-capture + review queue
Miscategorized spending Keyword rules alone don't generalize Multi-tier ML categorization with online learning
Numbers without context Data โ‰  insight Dashboards, cashflow trends, financial health score

๐Ÿ—๏ธ Architecture

flowchart TB
    U[User]

    U --> WEB[React Web App]
    U --> AND[Capacitor Android App]

    WEB --> AUTH[Supabase Auth]
    AND --> AUTH

    WEB --> DB[Dexie / IndexedDB]
    AND --> DB

    AND --> SMS[SMS Ingestion]
    SMS --> PARSER[Transaction Parser]

    PARSER --> CLASSIFIER[Local Categorization Engine]
    DB --> CLASSIFIER

    CLASSIFIER --> REVIEW[Human Verification]
    REVIEW --> DB

    CLASSIFIER --> AI[Supabase Edge Functions]
    AI --> LLM[AI Provider]

    DB --> INSIGHTS[Insights Engine]
    AI --> INSIGHTS
Loading

๐Ÿค– Agentic Workflow

flowchart LR
    A[Transaction Signals] --> B[Parse]
    B --> C[Categorize]
    C --> D{Confidence}
    D -->|High| E[Ledger]
    D -->|Low| F[AI Assistance]
    F --> G[User Verification]
    G --> H[Learn From Correction]
    H --> C
    E --> I[Insights]
Loading
  • Observe โ€” capture transaction signals from SMS and receipts
  • Understand โ€” extract and categorize transaction data
  • Verify โ€” confidence-based review and human confirmation
  • Assist โ€” generate summaries and financial insights
  • Learn โ€” incorporate user corrections into local categorization

โš™๏ธ Core System Capabilities

๐Ÿ“ฒ SMS-Based Transaction Capture

  • Regex-based parser extracts amount, direction (credit/debit), payment method, last 4 digits, and reference ID from raw bank SMS text
  • Runs entirely client-side โ€” no data leaves the device for parsing
  • Native Android auto-read (real-time SMS listener) is in progress; current build supports import of sample SMS for testing the parsing pipeline

๐Ÿง  Multi-Tier Intelligent Categorization

A cascading pipeline that only escalates cost when it needs to:

  1. User-learned mappings (IndexedDB) โ€” instant, from your own corrections
  2. Merchant dictionary match โ€” e.g. "Swiggy" โ†’ Food & Dining
  3. On-device Naive Bayes classifier โ€” probabilistic categorization with confidence scoring, Laplace smoothing, online learning from corrections
  4. AI fallback (Supabase Edge Function โ†’ AI provider) โ€” triggered only when local confidence is low

โœ… Review & Correction Loop

  • Transactions below a confidence threshold are flagged Needs Review
  • Correcting a category updates the on-device classifier's word-frequency table, improving it over time
  • Manual entries are cross-checked against parsed SMS (amount/time/merchant/method) to support verified vs. needs-review status

๐Ÿ“Š Insight Layer

  • Monthly income/expense summaries, category breakdown, cashflow trend charts
  • Financial Health Score (0โ€“100) from three weighted factors: income regularity, expense control, consistency
  • Cashflow "prediction" is currently a deterministic heuristic (rolling average), not a trained forecasting model โ€” labeled accordingly in-app, because the distinction between a heuristic and a model matters

๐Ÿ“ฆ Inventory Tracking

  • CRUD for stock items with quantity and computed value
  • Ledger โ†” Inventory integration (in progress): sales transactions will automatically decrement stock

๐Ÿ“ฑ UI/UX

  • Fully responsive: 1 column (mobile) โ†’ 2 (tablet) โ†’ 3 (desktop)
  • Offline-first: reads and writes continue uninterrupted with no network connection, backed by IndexedDB (Dexie)
  • Dark mode, smooth transitions, real-time reactive updates on data change

๐Ÿ” Current Implementation Status

Capability Status
Local ledger (add/edit/delete, filtering, search) โœ…
Offline persistence โœ…
AI categorization (Naive Bayes + fallback) โœ…
SMS parsing โœ…
AI chat copilot โœ…
Receipt processing (cloud vision) โœ…
Supabase authentication โœ…
Cloud synchronization ๐Ÿšง
Native Android SMS auto-capture ๐Ÿšง
Inventory โ†” ledger integration ๐Ÿšง

๐Ÿ› ๏ธ Tech Stack

Frontend: React ยท TypeScript ยท Vite ยท Tailwind CSS ยท shadcn/ui Data & Persistence: Dexie ยท IndexedDB Backend: Supabase ยท PostgreSQL ยท Edge Functions AI: AI Edge Functions ยท local Naive Bayes classifier Mobile: Capacitor ยท Android Visualization: Recharts


โšก Engineering Highlights

  • Multi-tier categorization pipeline balancing cost, latency, and accuracy (local-first, cloud fallback only when needed)
  • Online-learning classifier that improves from user corrections without a server round-trip
  • Offline-first architecture with reactive local persistence
  • Structured extraction from unstructured bank SMS text via regex parsing
  • Real authentication via Supabase Auth, replacing the earlier local-session prototype

๐Ÿš€ Run Locally

git clone <YOUR_GIT_URL>
cd <PROJECT_NAME>
npm install
npm run dev

Environment variables required (see .env.example):

VITE_SUPABASE_URL=
VITE_SUPABASE_ANON_KEY=

๐Ÿ”ฎ Roadmap

  • ๐Ÿ‘ฅ Contacts / party ledger ("who owes me, whom do I owe") โ€” the core khata use case, in progress
  • โ˜๏ธ Genuine cloud sync with conflict resolution
  • ๐Ÿ“ฆ Ledger โ†” inventory integration (sales auto-adjust stock)
  • ๐Ÿ“ฑ Native Android SMS auto-capture
  • ๐Ÿงช Automated test coverage (parser, classifier)
  • ๐Ÿ’ณ Credit/trust scoring for repeat customers
  • ๐ŸŒ Multi-language input (Hindi/Marathi voice and text)

๐Ÿ’ฌ Philosophy

The future of apps is not interaction. It's automation with intelligence โ€” and a human who can still check its work.


๐Ÿ“„ License

MIT License

About

Offline-first ledger app for small businesses - parses bank SMS into transactions, categorizes them with an on-device Naive Bayes classifier + AI fallback, and tracks spending, inventory, and cashflow.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages