Inspiration
Accountants and bookkeepers often spend hours matching invoices to receipts that are scattered across folders with inconsistent names. Duplicates, unreadable scans, and missing receipts are easy to overlook, and a wrong guess can be costly. We wanted a tool that does the tedious finding and comparing, and that is honest about what it doesn't know.
What it does
PaperTrail is a read-only Skill for UGREEN AI NAS. Given a folder path, it:
- Finds invoice and receipt documents in that folder only.
- Detects duplicate candidates.
- Extracts structured details (vendor, reference number, dates, amounts, taxes).
- Proposes invoice-receipt pairs using a fixed evidence order: reference number first, then vendor, currency, and amount, then amount within a stated date tolerance.
It returns a reconciliation queue sorted into Consistent, Discrepancy, Duplicate candidate, Missing evidence, Unmatched, and Uncertain. Each item lists its source paths, matched and differing fields, and a suggested human follow-up.
PaperTrail never claims an invoice is paid, never matches on amount, date, or filename alone, and never moves, renames, deletes, or tags files.
How we built it
The Skill is a single SKILL.md that orchestrates UGREEN's expert agents in six steps:
- file-agent with
ug-filesystem findto locate documents - file-agent with
ug-filemgr scan-dedupeto detect duplicates - document-agent with
ug-document extractfor invoice and receipt fields - document-agent with
ug-document qa(comparison intent) to match and compare - A final step that builds the review summary
Every delegation state (completed, failed, cancelled, waiting_user, waiting_approval) is handled explicitly. We used GitHub Copilot in VS Code to draft and statically validate the Skill. It uses no third-party libraries.
Challenges we ran into
- Avoiding false confidence. A matching amount or date is not proof that two documents belong together, and a match is never proof of payment. We designed strict matching rules and made uncertainty a first-class result.
- Handling bad input. Unreadable scans, duplicates, and invoices with no receipt must be reported, not hidden or papered over.
- Building without a NAS. Round 1 doesn't require NAS hardware, so the runtime behavior still needs validation on a real device.
Accomplishments that we're proud of
- A complete, well-bounded workflow with explicit rules for matching, categories, and failure handling.
- A design that is safe by default: it is read-only, limited to one user-authorized folder, and keeps all processing on the NAS.
- Defined test scenarios for two core cases and one edge case.
What we learned
Reconciliation tools earn trust by showing their evidence and their gaps. Clear rules about what counts as a match, and what doesn't, matter more than clever guessing. We also learned to treat duplicate detection as supporting evidence rather than a reason to discard a file.
What's next for PaperTrail
- Validate the workflow on a real UGREEN AI NAS, including CLI behavior, extraction accuracy on scans, and approval handling.
- Tune the date tolerance and comparison quality using real-world documents.
- Consider optional report saving and richer outputs in a later version, always with explicit user approval.