⚡ Productivity
Hazel Rules for a Bookkeeper's Client Document Inbox: Conditions, Rename Patterns, Subfolder Sorting, and Safe Rule Order on macOS
Design a set of Hazel rules for macOS that sort a bookkeeper's downloaded bank statements, receipts, and tax forms into client and year folders: exact conditions, contents matching with custom tokens, rename and sort patterns, rule order, and a dry run plan so nothing gets lost.
0Reviews
Prompt
Act as a macOS automation consultant who builds Hazel rule sets for small accounting practices. You think about the file that matches two rules, the download that is still writing, and the client name with an apostrophe before you think about anything clever. Inputs: - Watched folder or folders and where the client archive lives: [WatchedFolders] - Document types that arrive and a real example file name for each (bank statement, card statement, receipt, W-9, 1099, payroll report): [DocTypes] - Client list with the short code you want in paths and any text that reliably appears in their documents (account last 4, EIN suffix, business name): [ClientKeys] - Target folder structure and naming convention: [NamingConvention] - Hazel version and whether files sync through iCloud Drive, Dropbox, or a NAS: [HazelSetup] - What should happen to files that match nothing: [Unmatched] - Output format: [Format] - Language: [Lang] Generate: 1. Rule order table for each watched folder. Hazel runs a folder's rules top to bottom and acts on the first rule a file matches in that pass, so put specific rules above general ones and the catch all last. 2. Each rule written the way it appears in Hazel: rule name; If all or any of the following conditions are met; each condition line (Extension is pdf, Name contains, Contents contain match with a custom token, Date Added is not in the last 2 minutes to skip files still downloading); then the Do the following actions list (Rename with pattern, Sort into subfolder with pattern, Add tags, Display notification). 3. Custom tokens: define each one for Contents contain match (for example a client token from the account last 4, a date token for the statement period) and show the exact pattern pieces. Explain that contents matching needs a text layer, so scanned image PDFs need OCR first. 4. Rename and sort patterns that produce NamingConvention, using the custom tokens plus Hazel date attributes, with the result shown for each example file name from DocTypes. 5. Collision and edge handling: duplicate names, a statement that matches two clients, client names with punctuation, and what Unmatched does (tag Needs Review and leave it, never delete). 6. Sync cautions for HazelSetup (cloud placeholder files, NAS permissions) and a dry run plan: duplicate the rules, point them at a test folder, use the Preview option on sample files, then enable. Constraints: - No Move to Trash or delete actions anywhere in the rule set. - Do not claim Hazel features you are unsure about; mark them verify in your Hazel version. - Never guess a client from a file; uncertain matches go to review. - No em dashes.
Instructions
Replace every [bracket] with your details before running. Works on ChatGPT, Claude, and Gemini.
Generated Output
This image was generated using the prompt above.

Examples
Example Input
WatchedFolders: ~/Downloads, archive at ~/Clients DocTypes: bank statements like Statement_2026-09-30_XX4417.pdf, card statements like eStmt_2026-09-28.pdf (no account digits in name), W-9 forms like fw9 (3).pdf, receipts emailed as Receipt-12345.pdf ClientKeys: BRK = Birch & Kettle Bakery, checking ending 4417, card ending 9021; ODY = O'Day Plumbing LLC, checking ending 7730 NamingConvention: ~/Clients/CODE/YYYY/Type/YYYY-MM CODE Type.pdf HazelSetup: Hazel 6, ~/Clients synced by Dropbox Unmatched: leave in Downloads, tag for review Format: rule table, then rules, then tests Lang: English
Example Output
1. Rule order for ~/Downloads | # | Rule | Why here | | 1 | BRK bank statement | name carries the account digits, most specific | | 2 | ODY bank statement | same pattern, different digits | | 3 | Card statement by contents | name has no digits, so it needs contents matching | | 4 | W-9 to review | W-9s need a human to pick the client | | 5 | Unmatched PDF tag | catch all, last | 2. Rules Rule 1: BRK bank statement If all of the following conditions are met: - Extension is pdf - Name starts with Statement_ - Name contains 4417 - Date Added is not in the last 2 minutes Do the following: - Rename with pattern: [period] BRK Bank Statement - Sort into subfolder with pattern, base ~/Clients/BRK: [year]/Bank Statements - Display notification: Filed BRK statement Rule 2: ODY bank statement. Same as Rule 1 with Name contains 7730, rename [period] ODY Bank Statement, base ~/Clients/ODY. Rule 3: Card statement by contents If all of the following conditions are met: - Extension is pdf - Name starts with eStmt_ - Contents contain match: ending in 9021 - Date Added is not in the last 2 minutes Do: Rename [period] BRK Card Statement; Sort into ~/Clients/BRK: [year]/Card Statements. A card statement whose text does not contain 9021 falls through to Rule 5. There is no ODY card yet. Rule 4: W-9 to review. Name starts with fw9, Extension is pdf: Add tags W-9 and Needs Review. No move; a W-9 does not tell you which client asked for it. Rule 5: Unmatched PDF. Extension is pdf and Date Added is not in the last 10 minutes: Add tags Needs Review. Receipt-12345.pdf lands here until you give receipts a client key. 3. Custom tokens - period (Rules 1 to 3): for the bank files, a Name matches condition on Statement_ then a date token (YYYY-MM-DD) saved as period. For card statements, a Contents contain match on Closing Date followed by a date token. Format the output as YYYY-MM. - year: derived from the same date token, format YYYY. eStmt files from this bank have a text layer. Any scanned PDF without one never matches Rule 3; run OCR first (verify the OCR option in Hazel 6 or use your scanner app). 4. Results - Statement_2026-09-30_XX4417.pdf becomes ~/Clients/BRK/2026/Bank Statements/2026-09 BRK Bank Statement.pdf - eStmt_2026-09-28.pdf with Closing Date 09/28/2026 and ending in 9021 becomes ~/Clients/BRK/2026/Card Statements/2026-09 BRK Card Statement.pdf - fw9 (3).pdf stays in Downloads, tagged W-9 and Needs Review 5. Edges - Same month twice: set the rename to add a counter on conflict, never overwrite. - O'Day: the code ODY keeps the apostrophe out of every path. - A statement listing both 4417 and 7730 (transfer page): Rule 1 wins by order. Add Name does not contain 7730 to Rule 1 if that ever happens, and send both-match files to review. 6. Dropbox and dry run - Keep online only placeholders in ~/Clients turned off for the current year so moves do not stall. - Duplicate the rules onto ~/Desktop/Hazel Test, copy last month's files there, use Preview on each file to see which rule matches, then enable on Downloads.