Get the FREE Ultimate OpenClaw Setup Guide →

user-memory

npx machina-cli add skill peerjakobsen/smartspender/user-memory --openclaw
Files (1)
SKILL.md
9.6 KB

User Memory

Purpose

Automatically detect when users provide information about their financial situation, preferences, or corrections, and persist this to the appropriate learnings file so future sessions can use it.

When to Activate

This skill activates automatically when:

  1. User answers a question about their financial situation
  2. User volunteers personal context information
  3. User corrects a categorization, subscription status, or merchant name
  4. User states an output preference

Trigger Patterns

Financial Situation (Danish)

PatternCategoryExtraction
Jeg har [X] kr i nødopsparing/opsparingemergency_fundamount
Min nødopsparing er [X] kremergency_fundamount
Jeg har [X] måneder i opsparingemergency_fundmonths_coverage
Jeg har gæld i/til [X]debtcreditor
Min gæld er [X] krdebtamount
Jeg skylder [X] kr til [Y]debtamount, creditor
Min pension er [X]%pensionpercentage
Jeg indbetaler [X]% til pensionpensionpercentage
Jeg har pension hos [X]pensionprovider
Min løn er [X] krincomeamount
Jeg tjener [X] kr om månedenincomeamount
Min bruttoløn er [X] krincomegross_amount

Financial Situation (English)

PatternCategoryExtraction
I have [X] in emergency fund/savingsemergency_fundamount
My emergency fund is [X]emergency_fundamount
I have [X] months of expenses savedemergency_fundmonths_coverage
I have debt with/to [X]debtcreditor
I owe [X] to [Y]debtamount, creditor
My pension is [X]%pensionpercentage
I contribute [X]% to pensionpensionpercentage
My salary is [X]incomeamount
I earn [X] per monthincomeamount

Personal Context (Danish)

PatternCategoryExtraction
Jeg arbejder hos [X]employercompany_name
Min arbejdsgiver er [X]employercompany_name
Jeg er ansat hos [X]employercompany_name
Jeg vil gerne [X]goalgoal_description
Mit mål er at [X]goalgoal_description
Jeg sparer op til [X]goalsavings_goal
Jeg planlægger at [X]goalplan_description
Jeg er [X] (single/married/etc.)life_situationstatus
Jeg har [X] børnlife_situationchildren_count
Jeg bor i [X]life_situationlocation
Jeg er [X] årlife_situationage

Personal Context (English)

PatternCategoryExtraction
I work at [X]employercompany_name
My employer is [X]employercompany_name
I want to [X]goalgoal_description
My goal is to [X]goalgoal_description
I'm saving for [X]goalsavings_goal
I plan to [X]goalplan_description
I am [X] (single/married/etc.)life_situationstatus
I have [X] childrenlife_situationchildren_count

Corrections (Danish)

PatternCategoryTarget File
[X] er ikke [Y], det er [Z]category_correctionlearnings/categorization.md
Nej, det er [X], ikke [Y]category_correctionlearnings/categorization.md
Det er (ikke) et abonnementsubscription_correctionlearnings/subscriptions.md
[X] er et abonnementsubscription_confirmationlearnings/subscriptions.md
[X] er det samme som [Y]merchant_aliaslearnings/merchants.md
[X] hedder egentlig [Y]merchant_aliaslearnings/merchants.md

Output Preferences (Danish)

PatternCategoryExtraction
Vis altid [X]display_preferenceformat
Jeg foretrækker [X]display_preferencepreference
Brug [X] formatdisplay_preferenceformat
Tal dansk/engelsklanguage_preferencelanguage
Mere/mindre detaljerdetail_preferencelevel

Output Preferences (English)

PatternCategoryExtraction
Always show [X]display_preferenceformat
I prefer [X]display_preferencepreference
Use [X] formatdisplay_preferenceformat
More/less detaildetail_preferencelevel

Target Files

Learning TypeTarget FileSection
Emergency fundlearnings/preferences.mdFinancial Situation
Debt statuslearnings/preferences.mdFinancial Situation
Pension statuslearnings/preferences.mdFinancial Situation
Incomelearnings/preferences.mdFinancial Situation
Employerlearnings/preferences.mdPersonal Context
Goalslearnings/preferences.mdPersonal Context
Life situationlearnings/preferences.mdPersonal Context
Category correctionslearnings/categorization.mdLearnings table
Subscription statuslearnings/subscriptions.mdConfirmed/Not sections
Merchant aliaseslearnings/merchants.mdAliases table
Output preferenceslearnings/preferences.mdOutput Preferences

Learning Entry Format

For preferences.md

### {YYYY-MM-DD}
**Category**: {financial_situation|personal_context|output_preference}
**Trigger**: "{exact user statement}"
**Rule**: {extracted structured information}
**Source**: {command that captured this}

For categorization.md

Append to the Learnings table:

| {YYYY-MM-DD} | {pattern} | {merchant} | {category} | {subcategory} | {user statement} |

For subscriptions.md

Append to Confirmed Subscriptions:

| {YYYY-MM-DD} | {pattern} | {merchant} | {frequency} | User confirmed |

Or append to Not Subscriptions:

| {YYYY-MM-DD} | {pattern} | {merchant} | User: "{reason}" |

For merchants.md

Append to Aliases table:

| {YYYY-MM-DD} | {raw_pattern} | {normalized_name} | User alias |

Workflow

When user provides information that matches a trigger pattern:

  1. Detect: Identify which pattern matched
  2. Extract: Pull out the relevant values (amounts, names, etc.)
  3. Validate: Ensure the extracted information makes sense
  4. Target: Determine which file and section to write to
  5. Check duplicates: Read target file, check if similar rule exists
  6. Write: Append the learning entry in the correct format
  7. Confirm: Acknowledge briefly without interrupting flow

Confirmation Behavior

After saving a learning, acknowledge briefly in Danish:

Learning TypeConfirmation
Financial status"Noteret: {summary}. Jeg husker det."
Personal context"Noteret: {summary}."
Correction"Forstået. Jeg retter det fremover."
Preference"Noteret. Jeg bruger det fremover."

Rules:

  • Keep confirmations short (one sentence)
  • Don't interrupt the conversation flow
  • Integrate naturally into the response
  • Don't ask for confirmation before saving

Reading Learnings

At the start of relevant workflows, read learnings to apply prior knowledge:

  1. Before asking about emergency fund: Check preferences.md for existing emergency_fund entry
  2. Before asking about pension: Check preferences.md for existing pension entry
  3. Before asking about employer: Check preferences.md for existing employer entry
  4. Before categorizing: Check categorization.md for learned rules
  5. Before detecting subscriptions: Check subscriptions.md for confirmed/denied

If a learning exists, skip the question and use the stored value.

Update Behavior

When user provides updated information:

  1. Detect update: User provides new value for existing learning
  2. Mark old entry: Add [Superseded by {date}] to old entry
  3. Write new entry: Append new learning with current date
  4. Confirm: "Opdateret: {old_value} → {new_value}"

Example: Advice Session

User: /smartspender:advice

Claude: [Reads learnings/preferences.md - no emergency_fund entry]
Claude: "Har du en nødopsparing?"

User: "Ja, jeg har 20.000 kr i opsparing"

Claude: [Detects pattern: "har X kr i opsparing"]
Claude: [Extracts: amount=20000, category=emergency_fund]
Claude: [Writes to learnings/preferences.md]
Claude: "Noteret: 20.000 kr i nødopsparing. [continues with advice]"

---
Next session:

User: /smartspender:advice

Claude: [Reads learnings/preferences.md - finds emergency_fund=20000]
Claude: [Skips emergency fund question, uses stored value]
Claude: "Baseret på din nødopsparing på 20.000 kr..."

Example: Category Correction

User: "Netflix er underholdning, ikke abonnement"

Claude: [Detects pattern: "X er Y, ikke Z"]
Claude: [Extracts: merchant=Netflix, correct=Underholdning, incorrect=Abonnementer]
Claude: [Writes to learnings/categorization.md]
Claude: "Forstået. Netflix kategoriseres som Underholdning fremover."

Integration Points

Commands that should trigger user-memory:

  • /smartspender:advice - Financial questions
  • /smartspender:analyze - Category corrections
  • /smartspender:subscriptions - Subscription confirmations
  • /smartspender:overview - Preference statements
  • Any conversation where user volunteers information

Conflict Resolution

If stored learning conflicts with new information:

  1. Prefer recent: Newer information supersedes older
  2. Ask if ambiguous: "Tidligere sagde du X, nu siger du Y. Hvad er korrekt?"
  3. Update on confirmation: Write new entry, mark old as superseded

Source

git clone https://github.com/peerjakobsen/smartspender/blob/main/skills/user-memory/SKILL.mdView on GitHub

Overview

User Memory detects when you share financial details, preferences, or corrections and saves them for future Cowork sessions. This enables a more personalized experience by recalling your context without reasking. Data is stored to the appropriate learnings file so subsequent sessions can reuse it.

How This Skill Works

The skill activates automatically when you provide financial information, personal context, corrections, or output preferences. It uses pattern-based extraction to pull structured fields (amount, creditor, months_coverage, percentage, provider, company_name, goal_description, savings_goal, plan_description, life_situation, etc.) in English and Danish, then persists them to the corresponding learnings file (for example categorization, subscriptions, or merchants) so future sessions can reuse the context.

When to Use It

  • User answers a question about their financial situation
  • User volunteers personal context information
  • User corrects a categorization, subscription status, or merchant name
  • User states an output preference

Quick Start

  1. Step 1: Listen for user-provided information about finances, preferences, or corrections
  2. Step 2: Map extracted values to the correct category and fields (amount, provider, etc.)
  3. Step 3: Persist to the designated learnings file and reuse in next Cowork session

Best Practices

  • Persist only information the user has explicitly shared or consented to and avoid storing unnecessary data
  • Write data to the correct learnings file based on category (emergency_fund, debt, pension, income, employer, etc.)
  • Store structured extractions (amount, creditor, months_coverage, percentage, provider, company_name) rather than free text
  • Provide an easy way for users to review and update stored data in future sessions
  • Respect privacy by keeping retention and usage aligned with the user's needs and regulatory requirements

Example Use Cases

  • A user says: 'Jag har 5.000 kr i nødopsparing' and emergency_fund.amount is stored for future sessions
  • A user says: 'My salary is 25,000 kr per month' and income.amount is saved for subsequent conversations
  • A user says: 'I work at Acme Corp' and employer.company_name is captured
  • A user corrects: 'Dette er ikke et abonnement' and subscription status is updated in the learning files
  • A user says: 'I'm saving for a down payment' and savings_goal is stored under goal

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers