Let rules carry a note

A glob like *4412* says nothing about why it exists or who it catches, and
six months later neither does memory. Rules get an optional note: free text
that never takes part in matching, written as a TOML key rather than a
comment so it survives a round trip and can be shown back.

The rule builder grows a fourth field for it and the rules screen a last
column. Four fields spaced out are taller than a short window has room for,
so the form now drops its blank lines and then the hints on unfocused fields
before anything would run off the bottom.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 23:23:29 +02:00
co-authored by Claude Opus 5
parent 73fefea96d
commit 83d842d92e
6 changed files with 222 additions and 29 deletions
+21 -6
View File
@@ -100,14 +100,22 @@ a `▸` against each one the glob currently matches and a running
╰────────────────────────────╯
tab completes · ctrl+n: 1 more
note
╭────────────────────────────╮
│ optional │
╰────────────────────────────╯
why this rule exists
2 of 7 descriptions match
```
Only `gro` was typed in the tag field; `ceries` is the ghosted completion.
`tab` / `↑↓` move between the glob, account and tag fields, `pgup` / `pgdn`
scroll the list, and `enter` appends the rule to `rules.toml` and retags
`tab` / `↑↓` move between the glob, account, tag and note fields, `pgup` /
`pgdn` scroll the list, and `enter` appends the rule to `rules.toml` and retags
immediately, so the rows it caught disappear from the list. `esc` goes back.
On a short window the form gives up its spacing and then its hints, so all four
fields stay on screen.
The account and tag fields complete as you type: the rest of the match is
ghosted in grey after the cursor, and `tab` (or `→` at the end of the line)
@@ -131,12 +139,12 @@ Rules that claim none are marked `✗`.
```
money · rules · 5 rules · 2 match nothing
# Pattern Account Tag T Txns
1 *LIDL* (all) groceries 3
# Pattern Account Tag T Txns Note
1 *LIDL* (all) groceries 3 the weekly shop
2 ✗ *LIDL SOFIA* (all) shadowed 0
3 ✗ *OLD BANK NAME* (all) dead 0
3 ✗ *OLD BANK NAME* (all) dead 0 closed in 2025
4 *ZARA* (all) clothes 1
5 *КАУФЛАНД* checking groceries 1
5 *КАУФЛАНД* checking groceries 1 4412 is the branch
```
The count is how many transactions the rule *wins*, not how many its glob could
@@ -161,6 +169,12 @@ A rule matches on `match` (the description), `counterparty` (the other side's
account number) and `type` (the bank's own classification). Setting several is
an "and": all must match.
`note` is free text for you, never for the matcher: why the rule is there, or
what the unrecognisable payee behind the glob actually is. It shows in the last
column of the rules screen. Ordinary `#` comments still work and are preserved
on delete; a `note` differs in that it survives a round trip through the tool,
so the rule builder can write one and the rules screen can show it.
```toml
[[rule]]
tag = "groceries"
@@ -169,6 +183,7 @@ match = "*LIDL*"
[[rule]]
tag = "salary"
match = "*ACME PAYROLL*"
note = "paid on the 4th; the December one lands early"
# Money moved between your own accounts. Both legs need a rule.
[[rule]]