Move log-work-expense skill to ~/.openclaw/skills

This commit is contained in:
Connor Rhodes 2026-04-29 02:18:54 +00:00
parent 33081523a1
commit e667cf0e39
2 changed files with 0 additions and 102 deletions

View file

@ -1,40 +0,0 @@
---
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** — Use the vision workaround from TOOLS.md to classify each image as `"receipt"` or `"odometer"`. Do not extract amounts or other details from images.
2. **Determine type and account** — The user provides the expense type and account (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 script enforces file counts and rejects invalid input.
5. **Confirm** — Brief summary of what was logged.
## Notes
- Use the vision workaround from TOOLS.md for image classification only.
- Use the S2 upload endpoint from TOOLS.md for file uploads.
- The script hardcodes MongoDB connection details — do not pass credentials.

View file

@ -1,62 +0,0 @@
#!/usr/bin/env python3
"""Log work expenses to MongoDB (wip.work_expenses).
Usage:
python log_expense.py <type> <account> <date> <note> <s2_url_1> [s2_url_2]
type: "meal" or "mileage"
account: e.g. "LTISD"
date: YYYY-MM-DD
note: free-text context (quote if it has spaces)
s2_url: one or more S2 URLs of uploaded files
Rules enforced:
- meal: exactly 1 file per invocation
- mileage: exactly 2 files per invocation (start + end odometer)
"""
import sys
from pymongo import MongoClient
def main():
args = sys.argv[1:]
if len(args) < 5:
print("Usage: log_expense.py <type> <account> <date> <note> <s2_url_1> [s2_url_2]")
sys.exit(1)
exp_type = args[0]
account = args[1]
date = args[2]
note = args[3]
files = args[4:]
if exp_type not in ("meal", "mileage"):
print(f"Error: type must be 'meal' or 'mileage', got '{exp_type}'")
sys.exit(1)
if exp_type == "meal" and len(files) != 1:
print(f"Error: meal entries must have exactly 1 file, got {len(files)}")
sys.exit(1)
if exp_type == "mileage" and len(files) != 2:
print(f"Error: mileage entries must have exactly 2 files (start + end odometer), got {len(files)}")
sys.exit(1)
client = MongoClient("mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563")
db = client["wip"]
col = db["work_expenses"]
doc = {
"files": files,
"date": date,
"type": exp_type,
"account": account,
"note": note,
"status": "todo"
}
result = col.insert_one(doc)
print(f"Inserted {exp_type} for {account} on {date}: {result.inserted_id}")
if __name__ == "__main__":
main()