financialclaw 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +72 -0
- package/README.md +65 -0
- package/bin/financialclaw-setup.mjs +139 -0
- package/bin/postinstall-message.mjs +17 -0
- package/dist/src/db/database.d.ts +3 -0
- package/dist/src/db/database.js +58 -0
- package/dist/src/db/schema.d.ts +16 -0
- package/dist/src/db/schema.js +154 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +112 -0
- package/dist/src/services/daily-sync.d.ts +16 -0
- package/dist/src/services/daily-sync.js +135 -0
- package/dist/src/tools/add-recurring-expense.d.ts +16 -0
- package/dist/src/tools/add-recurring-expense.js +126 -0
- package/dist/src/tools/get-financial-summary.d.ts +8 -0
- package/dist/src/tools/get-financial-summary.js +158 -0
- package/dist/src/tools/helpers/currency-utils.d.ts +17 -0
- package/dist/src/tools/helpers/currency-utils.js +47 -0
- package/dist/src/tools/helpers/date-utils.d.ts +8 -0
- package/dist/src/tools/helpers/date-utils.js +102 -0
- package/dist/src/tools/list-expenses.d.ts +16 -0
- package/dist/src/tools/list-expenses.js +142 -0
- package/dist/src/tools/list-incomes.d.ts +12 -0
- package/dist/src/tools/list-incomes.js +124 -0
- package/dist/src/tools/log-expense-from-receipt.d.ts +13 -0
- package/dist/src/tools/log-expense-from-receipt.js +91 -0
- package/dist/src/tools/log-expense-manual.d.ts +12 -0
- package/dist/src/tools/log-expense-manual.js +60 -0
- package/dist/src/tools/log-income-receipt.d.ts +11 -0
- package/dist/src/tools/log-income-receipt.js +103 -0
- package/dist/src/tools/log-income.d.ts +13 -0
- package/dist/src/tools/log-income.js +103 -0
- package/dist/src/tools/manage-currency.d.ts +10 -0
- package/dist/src/tools/manage-currency.js +104 -0
- package/dist/src/tools/mark-expense-paid.d.ts +8 -0
- package/dist/src/tools/mark-expense-paid.js +44 -0
- package/dist/src/tools/run-daily-sync.d.ts +5 -0
- package/dist/src/tools/run-daily-sync.js +85 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.js +2 -0
- package/openclaw.plugin.json +24 -0
- package/package.json +52 -0
- package/skills/financialclaw/SKILL.md +257 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: financialclaw
|
|
3
|
+
description: |
|
|
4
|
+
Personal finance management via financialclaw. Use when: the user mentions spending money, buying something, paying a bill, sending a receipt photo, receiving money or salary, asking about their financial status, wanting to see expenses or income, setting up recurring payments, or configuring their currency. NOT for: topics unrelated to personal finance.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
"openclaw": { "emoji": "๐ฐ" }
|
|
8
|
+
}
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# financialclaw โ Personal finance
|
|
12
|
+
|
|
13
|
+
## First-time setup check
|
|
14
|
+
|
|
15
|
+
On the **very first financial interaction** with a user (before responding to their request), silently call `manage_currency` with `action: "list"`.
|
|
16
|
+
|
|
17
|
+
- If the call **succeeds**: proceed normally. Do not mention this check.
|
|
18
|
+
- If the call **fails with any error** (database error, module not found, tool unavailable, etc.): stop immediately and show this exact message, nothing else:
|
|
19
|
+
|
|
20
|
+
> "financialclaw needs a one-time setup. Run these two commands and come back:
|
|
21
|
+
>
|
|
22
|
+
> ```
|
|
23
|
+
> npx financialclaw financialclaw-setup
|
|
24
|
+
> openclaw gateway restart
|
|
25
|
+
> ```"
|
|
26
|
+
|
|
27
|
+
Do **not** offer alternatives. Do **not** try to diagnose the error further. Do **not** make any other tool calls. Wait for the user to confirm they ran the commands.
|
|
28
|
+
|
|
29
|
+
Only perform this check once per session. If a tool call already succeeded earlier in the session, skip it.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Expense logging
|
|
34
|
+
|
|
35
|
+
### Manual expense
|
|
36
|
+
|
|
37
|
+
Use `log_expense_manual` when the user describes an expense in words (no photo).
|
|
38
|
+
|
|
39
|
+
Required params: `amount`, `description`.
|
|
40
|
+
Optional params: `category`, `currency`, `merchant`, `due_date`.
|
|
41
|
+
|
|
42
|
+
If the amount is missing, ask before logging. If the date is missing, today is used by default (the tool handles this automatically).
|
|
43
|
+
|
|
44
|
+
Available categories: `HOUSING`, `SERVICES`, `TRANSPORT`, `SUPERMARKET`, `HEALTH`, `EDUCATION`, `ENTERTAINMENT`, `RESTAURANT`, `OTHER`.
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
- "I spent $50 at the supermarket" โ `log_expense_manual` with category: SUPERMARKET
|
|
48
|
+
- "I paid rent" โ ask for the amount if not given
|
|
49
|
+
- "Lunch for $18 at Crepes & Waffles" โ include merchant
|
|
50
|
+
|
|
51
|
+
### Expense from receipt photo
|
|
52
|
+
|
|
53
|
+
Use `log_expense_from_receipt` when the user sends a photo of a receipt, ticket, or invoice.
|
|
54
|
+
|
|
55
|
+
Mandatory flow โ do not skip any step:
|
|
56
|
+
|
|
57
|
+
1. Extract from the receipt using your vision capabilities:
|
|
58
|
+
- `amount`: the receipt total (number, no currency symbols or thousand separators)
|
|
59
|
+
- `date`: date in YYYY-MM-DD format
|
|
60
|
+
- `merchant`: name of the establishment
|
|
61
|
+
- `category`: infer from the type of business
|
|
62
|
+
- `raw_text`: all visible text from the receipt
|
|
63
|
+
|
|
64
|
+
2. Before invoking the tool, show the extracted data to the user and ask for confirmation:
|
|
65
|
+
|
|
66
|
+
> "Here's what I found on the receipt โ is this correct?
|
|
67
|
+
> โข Amount: [amount]
|
|
68
|
+
> โข Date: [date]
|
|
69
|
+
> โข Merchant: [merchant]
|
|
70
|
+
> โข Category: [category]"
|
|
71
|
+
|
|
72
|
+
If the channel is Telegram: send the message with an inline button "Yes โ
" using an interactive block (`type: "buttons"`, `label: "Yes โ
"`, `value: "si"`). The user can press the button to confirm, or type directly what needs to be corrected.
|
|
73
|
+
|
|
74
|
+
If the channel is not Telegram: ask for confirmation in plain text ("Reply 'yes' to save or tell me what to correct").
|
|
75
|
+
|
|
76
|
+
3. Only call `log_expense_from_receipt` after the user confirms (button or affirmative text) or after applying the corrections they indicate.
|
|
77
|
+
|
|
78
|
+
### Mark expense as paid
|
|
79
|
+
|
|
80
|
+
Use `mark_expense_paid` when the user confirms they paid a pending expense.
|
|
81
|
+
|
|
82
|
+
You need the `expense_id`. If the user doesn't have it handy, use `list_expenses` with `status: "PENDING"` to show them the list so they can choose.
|
|
83
|
+
|
|
84
|
+
### Recurring expense
|
|
85
|
+
|
|
86
|
+
Use `add_recurring_expense` for fixed services, subscriptions, or installments.
|
|
87
|
+
|
|
88
|
+
`frequency` param: `WEEKLY`, `BIWEEKLY`, `MONTHLY`, `INTERVAL_DAYS`.
|
|
89
|
+
For `INTERVAL_DAYS`, `interval_days` is required.
|
|
90
|
+
|
|
91
|
+
Example: "I want to log that I pay Netflix every month for $15" โ `add_recurring_expense` with frequency: MONTHLY.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Income logging
|
|
96
|
+
|
|
97
|
+
### New income
|
|
98
|
+
|
|
99
|
+
Use `log_income` for new income sources or one-time payments.
|
|
100
|
+
|
|
101
|
+
Required params: `amount`, `description`, `date`.
|
|
102
|
+
Optional params: `currency`, `is_recurring`, `frequency`, `interval_days`.
|
|
103
|
+
|
|
104
|
+
If the income is recurring (monthly salary, fixed client), set `is_recurring: true` and specify `frequency`.
|
|
105
|
+
|
|
106
|
+
Frequencies: `WEEKLY`, `BIWEEKLY`, `MONTHLY`, `INTERVAL_DAYS`.
|
|
107
|
+
For `INTERVAL_DAYS`, `interval_days` is required.
|
|
108
|
+
|
|
109
|
+
Examples:
|
|
110
|
+
- "I got my salary of $3,000" โ `log_income` with is_recurring: true, frequency: MONTHLY
|
|
111
|
+
- "A client paid me $500 USD" โ `log_income` with currency: USD
|
|
112
|
+
- "Freelance income, $200 every two weeks" โ frequency: BIWEEKLY
|
|
113
|
+
|
|
114
|
+
### Payment received on existing income
|
|
115
|
+
|
|
116
|
+
Use `log_income_receipt` when the user reports receiving an installment or payment against an already registered income (not a new one).
|
|
117
|
+
|
|
118
|
+
Requires `income_id`. If the user doesn't have it, use `list_incomes` first to show them.
|
|
119
|
+
|
|
120
|
+
Required params: `income_id`, `amount`, `date`.
|
|
121
|
+
Optional param: `notes`.
|
|
122
|
+
|
|
123
|
+
Example: "I received the March payment from client X" โ find the income_id with `list_incomes`, then use `log_income_receipt`.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Financial queries
|
|
128
|
+
|
|
129
|
+
### General summary
|
|
130
|
+
|
|
131
|
+
Use `get_financial_summary` for a consolidated view of the period: total expenses by category, total income, balance, and active recurring commitments.
|
|
132
|
+
|
|
133
|
+
Periods: `this_month` (default), `last_month`, `last_30_days`, `this_year`.
|
|
134
|
+
Filter by `currency` if the user manages multiple currencies.
|
|
135
|
+
|
|
136
|
+
Examples:
|
|
137
|
+
- "How are my finances this month?" โ `get_financial_summary`
|
|
138
|
+
- "Summary of last month's expenses" โ period: last_month
|
|
139
|
+
- "Year-to-date balance" โ period: this_year
|
|
140
|
+
|
|
141
|
+
### List expenses
|
|
142
|
+
|
|
143
|
+
Use `list_expenses` to see individual expenses with filters.
|
|
144
|
+
|
|
145
|
+
Available filters:
|
|
146
|
+
- `period`: `this_month`, `last_month`, `last_30_days`, `this_year`, `all`
|
|
147
|
+
- `status`: `PENDING`, `PAID`, `OVERDUE`
|
|
148
|
+
- `category`: category name
|
|
149
|
+
- `search`: search in description or merchant
|
|
150
|
+
- `source`: `manual` or `ocr`
|
|
151
|
+
- `limit` / `offset`: pagination (default 20, max 50)
|
|
152
|
+
|
|
153
|
+
Examples:
|
|
154
|
+
- "Show me pending expenses" โ status: PENDING
|
|
155
|
+
- "How much did I spend at the supermarket?" โ category: SUPERMARKET
|
|
156
|
+
- "Transport expenses in the last 30 days" โ period: last_30_days, category: TRANSPORT
|
|
157
|
+
|
|
158
|
+
If there are more results than shown, let the user know they can request more using offset.
|
|
159
|
+
|
|
160
|
+
### List income
|
|
161
|
+
|
|
162
|
+
Use `list_incomes` to see registered income.
|
|
163
|
+
|
|
164
|
+
Filters: `recurring` (true/false), `search`, `currency`, `include_receipts` (shows received payments per income).
|
|
165
|
+
|
|
166
|
+
Examples:
|
|
167
|
+
- "What income do I have?" โ `list_incomes`
|
|
168
|
+
- "My recurring income" โ recurring: true
|
|
169
|
+
- "Income with payment details" โ include_receipts: true
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Currency configuration
|
|
174
|
+
|
|
175
|
+
Use `manage_currency` with the appropriate action.
|
|
176
|
+
|
|
177
|
+
### Add currency
|
|
178
|
+
|
|
179
|
+
Action: `add`
|
|
180
|
+
Params: `code` (ISO 4217), `name`, `symbol`
|
|
181
|
+
|
|
182
|
+
Common currencies: COP / Colombian peso / $, USD / US dollar / $, EUR / Euro / โฌ, MXN / Mexican peso / $, ARS / Argentine peso / $
|
|
183
|
+
|
|
184
|
+
### List currencies
|
|
185
|
+
|
|
186
|
+
Action: `list`
|
|
187
|
+
Shows all configured currencies. The default currency is marked.
|
|
188
|
+
|
|
189
|
+
### Set default currency
|
|
190
|
+
|
|
191
|
+
Action: `set_default`
|
|
192
|
+
Param: `code`
|
|
193
|
+
|
|
194
|
+
### First-time setup flow
|
|
195
|
+
|
|
196
|
+
If the active currency is XXX (not yet configured), guide the user as follows:
|
|
197
|
+
|
|
198
|
+
1. Inform them that the currency is not configured and amounts will show with the `ยค` symbol
|
|
199
|
+
2. Ask which currency they primarily use
|
|
200
|
+
3. Use `add` to register it with the correct code, name, and symbol
|
|
201
|
+
4. Use `set_default` to set it as the default
|
|
202
|
+
5. Confirm the change by showing the configured currency name and symbol
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Daily sync and automatic reminders
|
|
207
|
+
|
|
208
|
+
### Automatic setup (first interaction)
|
|
209
|
+
|
|
210
|
+
On the **first financial interaction of the session**, silently call `cron.list` and check for a job named `financialclaw-daily-sync`.
|
|
211
|
+
|
|
212
|
+
- If **not found**: create it immediately using `cron.add`, without asking the user. Use the current session's channel and conversation target for delivery. Do not mention this to the user unless the setup fails.
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"name": "financialclaw-daily-sync",
|
|
217
|
+
"schedule": { "kind": "cron", "expr": "0 9 * * *" },
|
|
218
|
+
"sessionTarget": "isolated",
|
|
219
|
+
"payload": {
|
|
220
|
+
"kind": "agentTurn",
|
|
221
|
+
"message": "Call run_daily_sync. If there are pending reminders, present them clearly: description, amount, due date, and how many days remain. If everything is up to date, say so in one short sentence."
|
|
222
|
+
},
|
|
223
|
+
"delivery": {
|
|
224
|
+
"mode": "announce",
|
|
225
|
+
"channel": "<current channel>",
|
|
226
|
+
"to": "<current conversation target>"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
- If **already found**: do nothing. Do not recreate or mention it.
|
|
232
|
+
|
|
233
|
+
### Manual sync
|
|
234
|
+
|
|
235
|
+
Use `run_daily_sync` when:
|
|
236
|
+
- The user asks "what do I have pending?", "what's due?", "run the daily sync"
|
|
237
|
+
- The user wants to see overdue or upcoming recurring expenses right now
|
|
238
|
+
|
|
239
|
+
The tool generates pending recurring expense instances, marks overdue ones, and returns the list of payment reminders due today.
|
|
240
|
+
|
|
241
|
+
### User-requested reminder management
|
|
242
|
+
|
|
243
|
+
If the user asks to change, disable, or inspect the daily reminder:
|
|
244
|
+
|
|
245
|
+
| Request | Action |
|
|
246
|
+
|---|---|
|
|
247
|
+
| Change reminder time | `cron.update` with new schedule |
|
|
248
|
+
| Disable reminders | `cron.update` with `enabled: false` |
|
|
249
|
+
| Re-enable reminders | `cron.update` with `enabled: true` |
|
|
250
|
+
| See reminder status | `cron.list`, filter by `financialclaw-daily-sync` |
|
|
251
|
+
| Run sync now | `run_daily_sync` |
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Currency not configured
|
|
256
|
+
|
|
257
|
+
If any tool response includes a suggestion to configure the currency, inform the user that their default currency is not set and offer to configure it now with `manage_currency`.
|