---
name: log-work-expense
description: Log work expenses into MongoDB. Use when the user sends receipt images or odometer photos along with context, or says things like "log this expense", "record this receipt", "mileage for XYZ", "meals for XYZ", or provides any expense details for work reimbursement tracking. Triggers on any message that includes expense context (account, type, images of receipts or odometers).
---

# Log Work Expense

Log work expenses into `wip.work_expenses` via `scripts/log_expense.py`.

## Trigger Phrases

- "log this expense", "record this receipt", "add this to my work expenses"
- "mileage for XYZ", "meals for XYZ"

## Steps

1. **Classify images** — Run each image through `scripts/classify_image.py <path>` to determine if it is a `receipt` or `odometer`. The script outputs exactly one word.

   ⚠️ **Do NOT analyze receipt/odometer images yourself.** Do not extract merchant names, amounts, item details, or calculate mileage. Do not analyze odometer photos to figure out which image comes first. Do not analyze receipts to get dates from the receipts. You are only allowed to run the image classification script. Do not examine the images yourself. THIS IS LAW!

2. **Determine type and account** — The user provides the expense type and account in their verbal prompt to you (e.g. "meals and mileage for LTISD"). Ask if unclear.

3. **Upload images to S2** — Upload all images to S2 and collect the URLs.

4. **Insert via script** — Run the script once **per entry**:

```bash
uv run --with pymongo ~/notes/skills/log-work-expense/scripts/log_expense.py <type> <account> <date> "<note>" <s2_url_1> [s2_url_2]
```

- **Meal receipts**: Run once per receipt (1 file each).
- **Mileage**: Run once with both odometer URLs (2 files). The order of start/end odometer images does not matter — just pass both URLs.

The script enforces file counts and rejects invalid input.

5. **Confirm** — Brief summary of what was logged.

## Notes
- Use `classify_image.py` for image classification — it calls the vision model and returns only "receipt" or "odometer".
- Use the S2 upload endpoint from TOOLS.md for file uploads.
- The log script hardcodes MongoDB connection details — do not pass credentials.
