memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Memory Skill

Memory技能

Persistent key-value storage for agent memory. Store important information and recall it later.
为Agent提供持久化键值对内存存储功能,可存储重要信息并在后续调取。

When to Use

适用场景

USE this skill when:
  • "Remember that my favorite color is blue"
  • "What did I tell you about my project?"
  • "Forget my preferences"
  • "What do you know about X?"
  • Storing user preferences for later recall
  • Saving context across conversations
适用场景:
  • "记住我最喜欢的颜色是蓝色"
  • "我之前跟你说过我的项目情况?"
  • "删除我的偏好设置"
  • "你知道关于X的什么信息?"
  • 存储用户偏好以便后续调取
  • 在对话间保存上下文

When NOT to Use

不适用场景

DON'T use this skill when:
  • Temporary storage during a single session → use variables
  • Large data storage → use file system
  • Sensitive data → use secure storage
不适用场景:
  • 单会话内的临时存储 → 使用变量
  • 大容量数据存储 → 使用文件系统
  • 敏感数据存储 → 使用安全存储

Storage Location

存储位置

Memory is stored in
~/.agent-memory/memory.json
as a JSON file.
内存数据以JSON文件形式存储在
~/.agent-memory/memory.json
中。

Commands

命令

Store Information

存储信息

bash
{baseDir}/memory.sh store "project_name" "My Cool Project"
{baseDir}/memory.sh store "preferences" '{"theme": "dark", "language": "en"}'
{baseDir}/memory.sh store --category "work" "company" "Acme Corp"
bash
{baseDir}/memory.sh store "project_name" "My Cool Project"
{baseDir}/memory.sh store "preferences" '{"theme": "dark", "language": "en"}'
{baseDir}/memory.sh store --category "work" "company" "Acme Corp"

Recall Information

调取信息

bash
{baseDir}/memory.sh recall "project_name"
{baseDir}/memory.sh recall --all
{baseDir}/memory.sh recall --category "work"
{baseDir}/memory.sh search "project"
bash
{baseDir}/memory.sh recall "project_name"
{baseDir}/memory.sh recall --all
{baseDir}/memory.sh recall --category "work"
{baseDir}/memory.sh search "project"

Forget Information

删除信息

bash
{baseDir}/memory.sh forget "project_name"
{baseDir}/memory.sh forget --category "work"
{baseDir}/memory.sh forget --all
bash
{baseDir}/memory.sh forget "project_name"
{baseDir}/memory.sh forget --category "work"
{baseDir}/memory.sh forget --all

List Categories

列出分类

bash
{baseDir}/memory.sh categories
{baseDir}/memory.sh stats
bash
{baseDir}/memory.sh categories
{baseDir}/memory.sh stats

Categories

分类

Organize memory by category:
  • personal
    - Personal preferences and info
  • work
    - Work-related information
  • projects
    - Project details
  • context
    - Conversation context
  • Custom categories as needed
可按分类整理内存数据:
  • personal
    - 个人偏好与信息
  • work
    - 工作相关信息
  • projects
    - 项目详情
  • context
    - 对话上下文
  • 可根据需求自定义分类

Examples

示例

Store user preference:
bash
{baseDir}/memory.sh store --category "personal" "timezone" "America/New_York"
Recall specific value:
bash
{baseDir}/memory.sh recall "timezone"
存储用户偏好:
bash
{baseDir}/memory.sh store --category "personal" "timezone" "America/New_York"
调取特定值:
bash
{baseDir}/memory.sh recall "timezone"

Output: America/New_York

输出: America/New_York


**Search for related keys:**
```bash
{baseDir}/memory.sh search "project"

**搜索相关键:**
```bash
{baseDir}/memory.sh search "project"

Output: project_name, project_status, project_url

输出: project_name, project_status, project_url


**Get all memory for a category:**
```bash
{baseDir}/memory.sh recall --category "work"

**获取某分类下的所有内存数据:**
```bash
{baseDir}/memory.sh recall --category "work"

Output: {"company": "Acme Corp", "role": "Developer"}

输出: {"company": "Acme Corp", "role": "Developer"}

undefined
undefined

Notes

注意事项

  • Memory persists across sessions in a JSON file
  • Values can be simple strings or JSON objects
  • Categories help organize related memories
  • Use
    --all
    flag carefully (affects all stored data)
  • 内存数据通过JSON文件在会话间持久化保存
  • 值可以是简单字符串或JSON对象
  • 分类有助于整理相关内存数据
  • 谨慎使用
    --all
    参数(会影响所有存储的数据)