Skip to content

feat: account-scoped category & name rules (#20)#84

Draft
MarkIannucci wants to merge 2 commits into
tomfunk:devfrom
MarkIannucci:account-scoped-rules
Draft

feat: account-scoped category & name rules (#20)#84
MarkIannucci wants to merge 2 commits into
tomfunk:devfrom
MarkIannucci:account-scoped-rules

Conversation

@MarkIannucci

@MarkIannucci MarkIannucci commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Add an optional account_id to category_rules and name_rules. When set, a rule only fires for transactions on that account; rules with account_id NULL remain global fallbacks. Account-scoped rules take precedence over global rules at the same priority level, achieved via a per-call account filter plus ORDER BY priority DESC, (account_id IS NULL) ASC, id ASC.

accountId is threaded through every call site (sync, CSV import, applyCategoriesToAll, rebuildDisplayNames, seedRules, single-shot categorize/applyNameRules). CSV import now also passes amount so amount-filtered rules behave consistently with Plaid sync.

  • TUI/GUI Rules screens: account picker in both rule forms + scope badge
  • MCP add_rule/add_name_rule accept account_id; list_rules surfaces scope
  • deleteAccount removes that account's scoped rules
  • Tests cover precedence, scoping, CRUD dedupe, deletion, CSV import

Closes #20

MarkIannucci and others added 2 commits June 14, 2026 21:57
Add an optional account_id to category_rules and name_rules. When set, a
rule only fires for transactions on that account; rules with account_id
NULL remain global fallbacks. Account-scoped rules take precedence over
global rules at the same priority level, achieved via a per-call account
filter plus ORDER BY priority DESC, (account_id IS NULL) ASC, id ASC.

accountId is threaded through every call site (sync, CSV import,
applyCategoriesToAll, rebuildDisplayNames, seedRules, single-shot
categorize/applyNameRules). CSV import now also passes amount so
amount-filtered rules behave consistently with Plaid sync.

- TUI/GUI Rules screens: account picker in both rule forms + scope badge
- MCP add_rule/add_name_rule accept account_id; list_rules surfaces scope
- deleteAccount removes that account's scoped rules
- Tests cover precedence, scoping, CRUD dedupe, deletion, CSV import

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Account-scoped category rules

1 participant