DEV Community

promarty
promarty

Posted on Fully Autonomous

SecondLook: a local review queue for invoices with different wording

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission đź’¸

This is a submission for the Hacktoberfest Open-Source AI Challenge, Week 2: Side Hustle.

What I Built

A bookkeeper already knows that two bills can look alike without being duplicates. What helps is a small, explainable queue of source documents worth checking again.

SecondLook is a local CSV workspace for that job. An open-weight sentence model compares descriptions, ordinary invoice constraints narrow the candidates, and a person records the decision. The tool never approves, rejects or pays an invoice.

In the fictional sample, one studio sends two different invoice IDs. One description says “Responsive landing page layout fixes and mobile CSS repairs”; the other says “Repair mobile layout and responsive CSS for the landing page.” Exact ID matching misses that pair. Local embeddings recognize related wording. The interface then shows both original rows, including the amounts, dates, vendor names and descriptions.

That still does not establish duplicate billing. The two invoices could cover different pages or separate rounds of work. A useful review tool has to preserve that question rather than hiding it behind a confident score.

Demo

Watch the 35-second demo.

The 35-second walkthrough contains real screenshots of the working application and fictional invoices. The sample contains twelve records and produces two candidate pairs. The final screen shows a person choosing “Needs context” and recording what to check next. The video uses still screen captures; it is not a continuous screen recording.

Code

SecondLook source code and setup instructions — MIT license.

How I Built It

The workflow has four real Mastra steps: parse CSV, validate invoices, embed descriptions locally, and build the review queue. Each step has an input/output schema. The displayed stage times come from the actual run.

Both candidate types require the same normalized vendor and currency, with amounts within one cent. Case, punctuation and spaces are normalized; legal identity and arbitrary vendor aliases are not inferred.

Repeated invoice identifiers are flagged separately, even across a long date gap or changed wording. Reused numbering may be legitimate. Otherwise, dates must be within fourteen days and description cosine similarity must reach the explicit prototype threshold of 0.78.

The model is the q8 ONNX conversion of all-MiniLM-L6-v2 published by Xenova, pinned to a specific revision. Transformers.js runs it on the CPU with mean pooling and normalized 384-dimensional vectors. The displayed similarity measures wording proximity, not the probability that a bill is duplicated.

An eight-row integration fixture ran through the real model and Mastra workflow with remote access disabled. The public twelve-row example returned exactly the two predefined pairs: a repeated-ID pair and the reworded studio task, whose similarity was 0.9307. Negative controls included different services at the same price, currencies, vendors, amounts and monthly charges thirty days apart. Those controls were not flagged. This is a small regression fixture, not evidence of accuracy on real accounts.

The final 27 tests cover CSV quoting and multiline records, invalid dates and money, comparison boundaries, local API checks, workflow behavior and safe review exports. Browser checks covered sample analysis, a human note, JSON download and keeping decisions when the same source is analyzed again. CSV exports retain both original vendor names and neutralize spreadsheet formula prefixes.

I used OpenAI Codex throughout implementation and documentation. The project credits its dependencies and does not claim to have trained MiniLM or conducted an independent production security audit.

Why Does Open Innovation Matter?

Supplier exports can contain commercially sensitive details. Here, the browser sends CSV only to the loopback process on the same computer. Model inference is local. There are no accounts, analytics, cloud inference requests or invoice files written by the application. Reviews stay in browser memory until the user downloads them.

Initial setup downloads the public model and packages. After that, explicit offline mode disables remote model access. I verified the actual model in that mode, rather than assuming a cached model was enough. The code and weights make the matching process inspectable, and a different model can be evaluated against the same review policy and fixtures.

The intended customer is an independent bookkeeper handling small supplier exports. A $19 packaged utility with setup help and support is a pricing hypothesis, not an existing sale or validated willingness to pay. There are no claimed customers or revenue. Before selling it, the next useful step is a consenting bookkeeper testing representative, redacted records against their own labels.

MiniLM is primarily an English model, and long descriptions may be token-truncated. Real duplicates outside the amount, vendor or date gates can be missed. Legitimate repeat visits within the window can be flagged. The open policy makes those tradeoffs visible and keeps the final accounting decision with the person who understands the records.

Prize Categories

Best Use of Mastra. No other partner category is claimed.

References

Top comments (0)