Skip to content

feat: auto-categorize merchants with AI when confidence is high#8

Merged
shepherdwind merged 1 commit into
mainfrom
feat/auto-categorize-merchants
Apr 5, 2026
Merged

feat: auto-categorize merchants with AI when confidence is high#8
shepherdwind merged 1 commit into
mainfrom
feat/auto-categorize-merchants

Conversation

@shepherdwind

Copy link
Copy Markdown
Owner

Background

Reduce manual intervention in the categorization flow.

Approach

AI-first categorization: mapping → AI auto (>=0.8 confidence) → manual TG flow.

Changes

  • NLPService.autoCategorizeMerchant() with confidence scoring
  • DBSEmailParser 3-tier categorization: mapping → AI → manual
  • Validate AI output against expense AccountName enum
  • Remove auto-writing empty mappings
  • EmailParser interface now async
  • MessageQueueService timer unref()

Testing

40 tests pass (7 suites).

Code Review

  • Review tool: Codex
  • Rounds: 3
  • Issues fixed: validate AI category (P1), expense-only validation (P2), prompt clarity (P2), test listener order (P3)

Add AI-first categorization for unknown merchants:
- NLPService.autoCategorizeMerchant() returns category + confidence
- High confidence (>=0.8) with valid expense account: auto-categorize,
  skip manual flow, don't write to mapping file
- Low confidence or invalid category: fall back to manual TG flow
- Validate AI output against expense AccountName enum
- Remove auto-writing empty mappings for unknown merchants
- Update tests for async parse() and new AI categorization paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shepherdwind shepherdwind merged commit 0a336c1 into main Apr 5, 2026
3 checks passed
@shepherdwind shepherdwind deleted the feat/auto-categorize-merchants branch April 5, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant