A document classification system
I developed a Claude Code-powered workflow to classify, name, and file a collection of 10,000 scanned business documents - ranging from financial filings and bank statements to correspondence with insurance companies and others... that runs on a $20/month AI subscription if need be, thanks to a token optimized workflow.
The workflow provides a complete audit trail of all steps taken, and can be transparently human-reviewed at every step.
AI
Claude
The workflow:
- Rotates and corrects the orientation when a scan is skewed
- Uses OCR to create a searchable PDF document
- Names the document and assigns its category based on an extensive rule set
- Moves the document into the right place in the file system
Training the system to recognize document boundaries
The pages that the system had to deal with were scanned in a previous, single concerted effort - however, pages belonging to the same document were not merged into one document. So the system had to learn to recognize document boundaries and stitch together the pages that form one document.
This required a long process of training and iteratively expanding the rule set - and is working fantastically now. The 10,000 documents are being classified and ordered at a rate of 200 to 300 per hour, more than fast enough for day-to-day operations.
Token-optimized and economical
The key to making this workflow viable with thousands of documents without ramping up a gigantic AI API bill was extreme optimization and a heavy reliance on deterministic scripts, command line tools and Apple's high-quality "Vision" OCR framework. As a result, the entire workflow runs within the limits of a $20 Claude Max subscription and is still capable of handling thousands of documents per month.
While it is currently wired for Claude, the workflow is platform and AI provider agnostic.
Need a similar workflow set up for your work or business? Let's talk.