log-expense

star 0

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.

pedro-f20 By pedro-f20 schedule Updated 4/16/2026

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

Lightweight expense logging during the newborn phase when spend patterns are shifting. Append-only JSONL so entries never get lost. Auto-detects the domain (baby, cooking, home, hobbies, utility, other) from the item text, confirming only when ambiguous. After logging, shows the running monthly total for that category to keep spending visible without building a full budgeting app. `/log-expense £42 formula` — Log £42 on formula (auto: baby) `/log-expense 89.50 drill bits` — Log £89.50 on drill bits (auto: hobbies/diy) `/log-expense £120 octopus bill` — Log £120 utility `/log-expense summary` — Show this month's totals by category `/log-expense month` — Same as summary ## 1. Ensure Log File Exists

The log lives at finances/logs/expenses.jsonl.

  • If finances/logs/ doesn't exist: create the directory
  • If expenses.jsonl doesn'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

  • summary or month — Skip logging, show current-month totals
  • summary --all — Lifetime totals across the log
  • No amount given — Ask: "How much?"
  • No item given — Ask: "What for?"
## Amount Parsing

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.

1. Entry appended to `finances/logs/expenses.jsonl` as valid JSONL 2. Log file and directory created if missing 3. Auto-detection works for common items without asking 4. Monthly total shown after every log 5. Clarifying question only asked when genuinely ambiguous 6. Backdated entries accepted 7. Never overwrites prior entries ## Example: `/log-expense £42 formula`
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.
Install via CLI
npx skills add https://github.com/pedro-f20/personal-assistant --skill log-expense
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator