Inspiration

Expense-tracking apps are often abandoned because every transaction requires typing. Receipt scanners solve data entry, but most of them forget the receipt immediately after extraction. We wanted to build an agent that accumulates long-term spending memory, so every receipt makes future questions easier to answer.

What it does

SnapLedger turns shopping receipts into structured, searchable spending memory.

Users can scan a receipt, review every extracted item, correct its name, amount, or category, and book it into a ledger. The dashboard then visualizes monthly totals, category distribution, daily trends, and transaction history.

The spending-memory agent answers natural-language questions such as “How many coffees did I buy last month?” It combines SQL aggregation with semantic vector search to retrieve relevant memories and produce an evidence-backed answer.

The public demo disables anonymous database writes to protect the shared dataset, while still querying persistent demonstration history stored in CockroachDB Cloud. Writable deployments persist newly booked receipts and their item-level embeddings.

How we built it

The bilingual frontend uses React and Vite, with a Node.js and Express API packaged as a Docker container.

CockroachDB Cloud is the persistent memory layer. Receipts and line items are stored as structured transactional data. Each line item has a 1024-dimensional embedding stored in a VECTOR column, with a distributed vector index used for semantic retrieval.

We used two CockroachDB tools:

  1. CockroachDB Cloud Managed MCP Server — used for schema management, data seeding, database inspection, and validating the memory layer during development.
  2. CockroachDB Distributed Vector Indexing — used at runtime to retrieve semantically related spending memories alongside SQL aggregation.

The current demo uses deterministic local embeddings for reproducibility and reliable judging. The embedding provider is isolated behind one function, allowing a production model provider to be introduced without changing the CockroachDB vector schema or query path.

The complete application runs on AWS. Images are stored in Amazon ECR and deployed through Amazon ECS Express Mode on AWS Fargate. An Application Load Balancer provides the public HTTPS endpoint, while CloudWatch captures service logs and deployment information.

Challenges

The hardest problem was combining approximate semantic recall with exact financial answers. Vector search is useful for discovering related purchases, but totals must remain deterministic. We solved this by using vector retrieval for semantic context and SQL aggregation for exact counts, dates, and amounts.

We also needed a public demo that judges could use without damaging shared data. Public writes are disabled, but the complete scanning workflow remains available through session-local demo receipts, and the memory agent queries real persistent CockroachDB data.

Accomplishments

  • Persistent agent memory backed by CockroachDB Cloud
  • Runtime distributed vector search with visible evidence and distance scores
  • SQL and semantic retrieval combined in one answer
  • Bilingual Chinese and English interface
  • Public AWS deployment with HTTPS
  • Editable, human-in-the-loop receipt recognition
  • Offline demo receipts for reliable judging

What we learned

Agentic memory is more than storing chat history. Useful memory needs structured facts, semantic retrieval, exact queries, and evidence that users can inspect. CockroachDB allowed us to keep transactional spending data and vector memory in one resilient system.

What's next

Next, we plan to add production-grade embedding providers, household and team ledgers, automatic expense reports, statement imports, and stronger receipt-image processing.

Disclosure

The original receipt-scanning interface was pre-existing open-source work. During the hackathon submission period, we built the CockroachDB persistent memory layer, vector schema and retrieval workflow, spending-memory agent, AWS container deployment, public read-only judging mode, and bilingual interface.

Built With

Share this project:

Updates

Submission history