Rules Engine - grumnuts/dosh GitHub Wiki
Rules Engine
The Rules Engine automatically sets transaction fields based on conditions you define. Rules run when:
- A transaction is created manually (unless the transaction has Ignore Rules enabled)
- Transactions are imported via CSV (unless the transaction has Ignore Rules enabled)
- You manually trigger a rule (or all rules) from the Rules page
Note: If a transaction has the Ignore Rules toggle enabled, the rules engine skips it entirely — even if conditions match. This can be set per-transaction from the transaction form, or applied to multiple transactions at once via Bulk Edit.
Structure
Rules are organised into Rule Groups (for your own organisation — e.g. "Groceries", "Bills", "Income"). Within each group, you can have multiple Rules.
Each Rule has:
- Conditions — criteria that must match for the rule to fire
- Condition logic —
AND(all conditions must match) orOR(any condition can match) - Actions — what to set when the rule fires
Conditions
| Field | Available Operators |
|---|---|
| Payee | contains, equals, starts with, ends with |
| Description | contains, equals, starts with, ends with |
| Amount | equals, greater than, less than, between |
| Account | equals |
| Date | equals, before, after, between |
| Category | equals |
Conditions are case-insensitive for text fields.
Actions
| Field | Description |
|---|---|
| Payee | Set or normalise the payee name |
| Description | Set or override the description |
| Category | Assign the transaction to a budget category |
| Amount | Override the transaction amount |
| Account | Reassign to a different account |
| Date | Override the date |
The most common action is setting the Category — this is what makes rules useful for auto-categorisation during import.
Rule actions always override existing field values. If a transaction already has a category set, a matching rule will still replace it. To prevent a rule from applying to a specific transaction, use the Ignore Rules toggle on that transaction.
Condition Logic
- AND — All conditions must be true for the rule to fire. Use this for precise matching (e.g. payee = "Woolworths" AND amount > $50).
- OR — Any condition being true triggers the rule. Use this to consolidate variations (e.g. payee contains "Coles" OR payee contains "Woolworths" → Groceries).
Creating a Rule
- Go to Rules in the sidebar
- Create a Rule Group if needed, or select an existing one
- Click + Rule inside the group
- Give the rule a name (e.g. "Woolworths → Groceries")
- Add one or more conditions
- Choose AND or OR logic
- Add one or more actions
- Save
Running Rules
On a single rule: Click the run button next to a rule to apply it to all existing transactions.
All rules at once: Click Run All Rules to apply every enabled rule to your entire transaction history.
This is useful after adding new rules — run them once to backfill existing transactions.
Enabling / Disabling
Each rule has an enable/disable toggle. Disabled rules are skipped during automatic processing but can still be run manually.
Rule Order
Within a rule group, rules are applied in order. If multiple rules match a transaction, all of them fire — later rules may overwrite actions set by earlier ones.
Conflict Detection
Dosh warns you when two rules have overlapping conditions and conflicting actions (e.g. two rules that both match "Payee = Coles" but assign different categories). Resolve conflicts by refining conditions or disabling one of the rules.