$npx -y skills add magnusrodseth/sparebank1-cli --skill sparebank1-contextBuild and maintain a personal finance context for the sb1 CLI (SpareBank 1) by running a short onboarding interview over the user's own accounts and transactions, then saving the answers to a private, git-ignored file the agent reads at the start of future finance sessions. Cap
| 1 | # sparebank1-context |
| 2 | |
| 3 | Turn `sb1` from "shows transactions" into "reasons over *your* money". This skill |
| 4 | runs a brief interview over the user's real data, then stores the answers as a |
| 5 | **personal finance context** that future finance sessions load up front. Read |
| 6 | [sparebank1-shared](../sparebank1-shared/SKILL.md) first for auth and flags. |
| 7 | |
| 8 | The CLI already surfaces the *data*. This skill captures the *personal meaning |
| 9 | layer* the bank cannot infer, and nothing more. |
| 10 | |
| 11 | ## The privacy contract (read this first) |
| 12 | |
| 13 | This skill's *mechanism* is public (it ships in a public repo and installs for |
| 14 | anyone), but the *answers are private personal data*. Therefore: |
| 15 | |
| 16 | - **Write the context file to a user-owned path outside this repo.** Default: |
| 17 | `~/.config/sparebank1-cli/context.md` (alongside where the `file` secret store |
| 18 | writes). Override with the `SB1_CONTEXT_FILE` environment variable. |
| 19 | - **Never** write answers, balances, account numbers, or counterparties into |
| 20 | this repository, a commit, a PR, or any shared/cloud-synced location. Treat the |
| 21 | file like the plaintext `file` secret store: keep it off backups and out of |
| 22 | anything that syncs. |
| 23 | - Prefer account **names + last 4 digits** over full account numbers. Don't |
| 24 | record figures the user didn't ask you to keep. |
| 25 | - The file is for *this user's* agent sessions. Don't paste its contents into |
| 26 | chats, issues, or external services. |
| 27 | |
| 28 | Resolve the path once at the start: |
| 29 | |
| 30 | ```bash |
| 31 | ctx="${SB1_CONTEXT_FILE:-$HOME/.config/sparebank1-cli/context.md}" |
| 32 | mkdir -p "$(dirname "$ctx")" |
| 33 | ``` |
| 34 | |
| 35 | ## When to run |
| 36 | |
| 37 | - **First time:** no context file exists → run the full interview below. |
| 38 | - **Refresh:** the file exists → read it, show the user what's captured, and only |
| 39 | ask about what's new or changed (new counterparties, new Uncategorized rows, |
| 40 | subscriptions to revisit). Don't re-ask settled questions. |
| 41 | |
| 42 | Confirm login before pulling data: |
| 43 | |
| 44 | ```bash |
| 45 | sb1 status # if not logged in, ask the user to run `sb1 login` (see sparebank1-shared) |
| 46 | ``` |
| 47 | |
| 48 | ## Step 1 — gather the data (no code change needed) |
| 49 | |
| 50 | Drive the interview from existing commands. Start with a short window: |
| 51 | |
| 52 | ```bash |
| 53 | sb1 --json summary --months 3 |
| 54 | ``` |
| 55 | |
| 56 | From the JSON, the rows worth asking about are: |
| 57 | |
| 58 | - `categories[]` — especially the **`"Uncategorized"`** bucket (the bank |
| 59 | couldn't classify these; you can, with the user's help). |
| 60 | - `topOutgoing[]` — the biggest counterparties by spend. |
| 61 | - `subscriptions[]` — what the bank already flagged as recurring. |
| 62 | |
| 63 | To see the actual Uncategorized rows behind that bucket, drill in per account: |
| 64 | |
| 65 | ```bash |
| 66 | sb1 --json transactions -a <account> --from <start> --to <end> --classified |
| 67 | ``` |
| 68 | |
| 69 | Each row has `category`, `recurring`, `subscription`, `counterpartyName`, |
| 70 | `amount` (negative = outgoing), and `date`. Filter to rows with a missing/`"Uncategorized"` |
| 71 | category or to the top counterparties — those are your interview targets. |
| 72 | |
| 73 | ## Step 2 — the interview (keep it short) |
| 74 | |
| 75 | **Prioritize the `Uncategorized` bucket and the top counterparties.** Do not walk |
| 76 | every transaction. Group similar rows and ask once per group. Aim for a handful |
| 77 | of focused questions, not a questionnaire. Capture these dimensions: |
| 78 | |
| 79 | | Dimension | The question to resolve | |
| 80 | |---|---| |
| 81 | | **Income classification** | For each inbound counterparty: salary, reimbursement, transfer from a partner, or a refund? (So "income" isn't overcounted.) | |
| 82 | | **Work-expensed / reimbursed** | Which outgoing rows does work pay back (travel, equipment)? These should net OUT of "real" spending. | |
| 83 | | **Account semantics** | What is each account *for* — daily, buffer, a savings goal, BSU, joint? | |
| 84 | | **Shared / split** | Anything split with a partner where only the user's share should count? | |
| 85 | | **Counterparty aliases** | Cryptic strings (e.g. `KLARNA*…`, acquirer codes) → a human label. | |
| 86 | | **Subscriptions** | For each flagged (or user-known) subscription: keep, cancel, or annual? | |
| 87 | | **Fixed vs discretionary** | Which spend is fixed (rent, loan, insurance) vs discretionary? | |
| 88 | |
| 89 | Ask in plain language, tied to what you actually saw: "You sent ~kr 4 000/month |
| 90 | to `BERG EIENDOM` — is that rent (fixed)?" beats an abstract checklist. Skip |
| 91 | dimensions that don't ap |