Skip to content

save_memory - Save Long-term Memory

Overview

The save_memory tool saves specific information or facts to long-term memory. This tool helps the AI assistant remember user preferences, habits, and important information to provide more personalized and effective assistance in future interactions.

Tool Name

  • Internal Name: save_memory
  • Display Name: Save Memory
  • Icon: Brain

Parameters

Required Parameters

ParameterTypeDescription
factstringThe specific fact or piece of information to remember. Should be a clear, self-contained statement. For example, if the user says "My favorite color is blue", the fact would be "My favorite color is blue".

Features

  1. Long-term Memory Storage:

    • Save user-related facts and preferences
    • Persist across sessions
    • Retrievable in future interactions
  2. Personalization Support:

    • Remember user preferences
    • Remember common configurations
    • Remember work habits
  3. Smart Memory:

    • Automatically identify important information
    • Avoid duplicate memories
    • Maintain memory relevance

Use Cases

When to Use This Tool

  1. User Explicitly Asks to Remember Something:

    • "Remember that I like pineapple on pizza"
    • "Please save this: my cat's name is Whiskers"
  2. User States Clear, Concise Personal Facts:

    • Information about themselves
    • Preference settings
    • Environment configuration
    • Information helpful for future interactions

When NOT to Use This Tool

  1. Conversational context only relevant for current session
  2. Long, complex, or rambling pieces of text
  3. Uncertain whether information is worth remembering long-term

Usage Examples

Remember User Preference

json
{
  "fact": "User prefers TypeScript over JavaScript"
}

Remember Personal Information

json
{
  "fact": "User's name is John Doe, age 25"
}

Remember Work Habits

json
{
  "fact": "User prefers using Vim editor and keyboard shortcuts"
}

Remember Project Configuration

json
{
  "fact": "User's main project path is /home/user/projects/main-app"
}

Remember Code Style Preference

json
{
  "fact": "User prefers single quotes over double quotes, 2-space indentation"
}

Remember Tool Aliases

json
{
  "fact": "User uses 'gco' as alias for 'git checkout'"
}

Return Value

The tool returns an object containing:

  • llmContent: Confirmation message
  • returnDisplay: User-friendly display information
  • summary: Operation summary

Example Output

✓ Saved to long-term memory: User prefers TypeScript over JavaScript

Best Practices

  1. Keep Facts Concise and Clear:

    • ✅ "User prefers React framework"
    • ❌ "User said they've been using various frontend frameworks over the years but recently found React particularly useful..."
  2. Use Complete Statements:

    • ✅ "User's primary programming language is Python"
    • ❌ "Python"
  3. Include Context:

    • ✅ "User uses PostgreSQL database in project X"
    • ❌ "PostgreSQL"
  4. Avoid Temporary Information:

    • ✅ "User's preferred code review tool is GitHub"
    • ❌ "User is reviewing PR #123"
  5. Confirm When Uncertain:

    • If unsure whether to remember, ask the user: "Should I remember that for you?"

Memory Type Examples

Personal Information

  • Name, age, occupation
  • Location, timezone
  • Contact preferences

Technical Preferences

  • Programming language preferences
  • Framework and library choices
  • Tools and editors
  • Code style

Work Habits

  • Working hours
  • Project organization
  • Documentation habits
  • Testing preferences

Project Information

  • Common project paths
  • Project structure preferences
  • Deployment processes
  • Team conventions

Learning Preferences

  • Learning style
  • Documentation preferences
  • Example type preferences

Privacy and Security

  1. Sensitive Information:

    • Don't save passwords, API keys, or other sensitive data
    • Don't save personal identification information (unless explicitly requested)
  2. Data Storage:

    • Memories stored locally
    • Respects user privacy settings
    • Can be deleted at any time
  3. Data Usage:

    • Only used to improve user experience
    • Not shared with third parties
    • Only used in relevant contexts

Memory Management

View Memories

Users can view saved memories (specific command depends on implementation).

Update Memories

Saving new facts will update or supplement existing memories.

Delete Memories

Users can request deletion of specific memories or clear all memories.

Distinction from Project-Specific Information

  • save_memory: For user-related personal information and preferences
  • SII.md files: For project-specific context and configuration

Use save_memory

User prefers Vim editor
User's name is John Doe
User practices TDD development

Use SII.md

Project uses React + TypeScript
API endpoint: https://api.example.com
Test command: npm test

Notes

  1. Selective Memory: Not all information needs to be remembered
  2. Clear Expression: Ensure facts are clearly and completely stated
  3. Relevance: Only remember information helpful for future interactions
  4. Privacy Awareness: Avoid remembering overly sensitive information
  5. User Control: Respect user's memory management needs

Error Handling

Possible error scenarios:

  1. Parameter Errors:

    • Empty fact parameter
    • Fact parameter too long
    • Incorrect fact parameter format
  2. Storage Errors:

    • Insufficient storage space
    • Permission issues
    • Filesystem errors
  • Project Context: Use SII.md files for project-specific information
  • Session Context: Temporary information in current conversation
  • Configuration Files: Tool and system configuration

Example Conversations

Scenario 1: Explicit User Request

User: "Remember I like using Tailwind CSS"

Assistant: Uses save_memory tool

json
{
  "fact": "User likes using Tailwind CSS"
}

Output: "✓ Remembered: User likes using Tailwind CSS"

Scenario 2: Identifying Important Preference

User: "I always use pnpm instead of npm"

Assistant: Uses save_memory tool

json
{
  "fact": "User prefers pnpm package manager over npm"
}

Scenario 3: Asking When Uncertain

User: "I'm working on the login feature today"

Assistant: "This is information about your current task. Would you like me to remember that you typically handle login feature development?"

Summary

The save_memory tool is a key feature for achieving personalized AI assistant experiences. By using this tool wisely, the AI assistant can better understand user preferences and habits, providing more thoughtful and efficient assistance.

Remember: Only save truly important information that will be helpful for future interactions, and always respect user privacy and control.

Released under the MIT License.