name: log-expense description: Quick-log a spending event to finances. Auto-categorizes by domain (baby, cooking, home, hobbies, utility, transport, health, dining, gifts, other). Shows running monthly total for that category. Use when user says "/log-expense", "log expense", "spent £X on Y", "just paid £X for Y", or when the user states a price paid for something with clear intent to track it. argument-hint: [amount] [item description] [notes] | summary | month | summary --all
The log lives at finances/logs/expenses.jsonl.
- If
finances/logs/doesn't exist: create the directory - If
expenses.jsonldoesn't exist: create it empty - Never overwrite — always append
2. Parse the Entry
Extract from the user's message:
| Field | Type | Notes |
|---|---|---|
ts |
ISO 8601 timestamp | Default: now |
amount_gbp |
number | Parse £, GBP, bare number. Accept decimals |
item |
string | What was bought (required) |
category |
string | Specific (formula, nappies, groceries, electricity, filament) |
domain |
baby | cooking | home | hobbies | utility | transport | health | dining | gifts | other |
Required |
notes |
string | Free text |
3. Auto-Detect Domain
Use keyword matching on the item text:
Baby
formula, kendamil, aptamil, nappies, nappy, wipes, pram, buggy, pushchair, cot, crib, bottle, steriliser, muslin, onesie, baby, sleep suit, car seat, water babies, moses basket, swaddle, dummy, bouncer, baby monitor, baby clothes, sleepyhead
Cooking
groceries, supermarket, tesco, sainsbury's, waitrose, aldi, lidl, m&s, ocado, butcher, bakery, meal kit, gousto, hellofresh, food shop, weekly shop
Home
bulb, paint, curtain, furniture, ikea, cleaning supplies, boiler, plumber, electrician, garden, compost, seeds, lawn, mortgage, service charge, buildings insurance
Hobbies
- 3D printing: filament, nozzle, bambu, printer, pla, petg, abs, print bed
- DIY: drill, saw, screws, workbench, gridfinity, tools, workshop, clamp
- Board games: board game, bgg, expansion, sleeves
- Video games: steam, nintendo, playstation, xbox, game pass, switch game, ps5 game
- App dev: apple developer, testflight, icon, asset
Utility
bill, electricity, gas, water, council tax, broadband, mobile, phone, octopus, bt, virgin, vodafone, ee, thames water, netflix, spotify, apple one, icloud, subscription, tv licence
Transport
petrol, fuel, diesel, parking, train, rail, tfl, uber, taxi, mot, service (car), car wash, insurance renewal (car), admiral
Health
prescription, dentist, optician, glasses, physio, osteopath, gp fee, private consult, pmi excess, vitamins, supplement
Dining
restaurant, pub, takeaway, deliveroo, uber eats, just eat, coffee, cafe, lunch out
Gifts
gift, present, birthday, wedding, christmas
Other
Fallback when no keywords match.
If the match is ambiguous (e.g., "bought a book" — hobby or interest?), ask one question: "Is that for you (interests), Leo (baby), or work (career)?"
Non-expense language: If the user says things like "bought a house" or "paid off the mortgage" — these aren't day-to-day expenses. Ask: "Log this as a lump-sum expense or treat as a balance-sheet event (update finances/reference.md)?"
If clear, log silently without confirmation.
4. Append to Log
Write exactly one JSON object per line. Example:
{"ts": "2026-04-16T10:14:00Z", "amount_gbp": 42.00, "item": "Aptamil formula 800g x2", "category": "formula", "domain": "baby"}
{"ts": "2026-04-16T14:30:00Z", "amount_gbp": 89.50, "item": "Bosch drill bit set", "category": "tools", "domain": "hobbies", "notes": "for garden office fit-out"}
{"ts": "2026-04-16T18:02:00Z", "amount_gbp": 124.80, "item": "Octopus electricity bill March", "category": "electricity", "domain": "utility"}
Use UTC timestamps. Omit empty fields.
5. Show Monthly Summary
After every log (and when asked for summary or month), read entries from the current calendar month and output:
## {Month Year} spending so far
| Domain | Items | Total |
|--------|-------|-------|
| {Domain} | {N} | £{X} |
| ... | ... | ... |
| **Total** | **{N}** | **£{X}** |
Just logged: £{X} on {item} ({domain}). Category total this month: £{Y}.
Only show domains with entries this month. Sort by total descending. All ten possible domains (baby, cooking, home, hobbies, utility, transport, health, dining, gifts, other) can appear — include only those with entries.
6. Handle Special Commands
summaryormonth— Skip logging, show current-month totalssummary --all— Lifetime totals across the log- No amount given — Ask: "How much?"
- No item given — Ask: "What for?"
Accept: £42, 42, 42.50, £42.50, GBP 42, 42 quid. Reject obvious non-amounts and ask.
Missing Log File
Create finances/logs/ and expenses.jsonl on first use. First entry always succeeds.
Ambiguous Domain
One question max. If user says "both" or "mixed", pick the primary and note the split in notes.
Backdated Entry
"Spent £40 on formula yesterday" — parse to yesterday's date. Don't refuse backdates.
Recurring Bills
If the item matches a recurring utility (electricity, broadband), note in the summary: "Monthly recurring — consider annualising for scenario modeling."
Large Expense (>£500)
Flag gently: "That's a larger one — want me to also log as a decision in decisions.md?" Don't force it.
Malformed Line in Log
Skip silently during summary. Note: "(1 entry skipped — unreadable)"
Cross-Domain Item
If an item genuinely spans domains (e.g., "baby monitor" = baby + home/home-network), pick baby as primary and mention the network angle in notes. Don't over-engineer a multi-domain schema.
Logged: £42.00 on Aptamil formula (baby).
## April 2026 spending so far
| Domain | Items | Total |
|--------|-------|-------|
| Baby | 14 | £312.50 |
| Cooking | 9 | £287.40 |
| Utility | 3 | £412.80 |
| Home | 2 | £68.00 |
Formula running total this month: £126.00 across 3 purchases. Factor in ~£50/week going forward.
Example: /log-expense 89.50 drill bits
Logged: £89.50 on drill bit set (hobbies → diy).
Hobbies total this month: £182.50 across 4 items.
That's a larger one — want me to also note it against the garden office fit-out budget?
Example: /log-expense summary
## April 2026 spending so far
| Domain | Items | Total |
|--------|-------|-------|
| Utility | 4 | £534.20 |
| Baby | 15 | £354.50 |
| Cooking | 10 | £298.90 |
| Hobbies | 4 | £182.50 |
| Home | 2 | £68.00 |
| **Total** | **35** | **£1,438.10** |
16 days in — running rate ~£2,700/month. In line with recent months except baby is new.