AgentSkillsCN

memory

AI 代理长期记忆管理技能(基于 openmemory-py)。 通过语义搜索存储并检索对话上下文、用户偏好以及重要信息。 注意:自动上下文管理由 context-manager 插件负责处理。 当代理**显式**操作记忆时,会用到此技能。 适用场景: (1) 当用户请求保存或检索记忆时 → /memory add、/memory query (2) 当代理判断需要补充更多上下文时 → /memory query (3) 当需要删除冗余记忆时 → /memory delete

SKILL.md
--- frontmatter
name: memory
description: |
  AI agent long-term memory management skill (openmemory-py based).
  Store and retrieve conversation context, user preferences, and important information via semantic search.
  
  Note: Automatic context management is handled by the context-manager plugin.
  This skill is used when the agent **explicitly** manipulates memory.
  
  When to use:
  (1) When user requests memory save/retrieve → /memory add, /memory query
  (2) When agent determines additional context is needed → /memory query
  (3) When deleting unnecessary memories → /memory delete

Memory Skill

OpenMemory-based AI agent long-term memory management.

Relationship with Plugin

code
┌─────────────────────────────────────────────────────┐
│         memory Skill (Explicit Memory Ops)          │
│     • /memory add - Manually add memory             │
│     • /memory query - Manually search memories      │
│     • /memory list - List memories                  │
│     • /memory delete - Delete memory                │
│     • /memory status - Show memory system status    │
└─────────────────────────────────────────────────────┘

When to Use?

✅ Use This Skill

  1. On User Request

    • "Remember this" → /memory add
    • "Find what we analyzed before" → /memory query
    • "Delete that memory" → /memory delete
  2. Agent Autonomous Decision

    • When additional context is needed for current task → /memory query
    • When saving important learnings permanently → /memory add
    • When discovering user preferences or patterns → /memory add

🔄 Plugin Handles Automatically (Implicit)

  • Load related context at task start → context_start tool
  • Mid-task checkpoints → context_checkpoint tool
  • Save results at task end → context_end tool

CLI Usage

bash
# Add memory
/memory add "User prefers Python development" --tags=preferences,programming

# Search memory (semantic search)
/memory query "areas of interest" --limit=5

# List memories
/memory list --limit=10

# Delete memory
/memory delete <memory_id>

# Show status
/memory status

# Clear all memories (caution!)
/memory clear --confirm

Python API

python
from scripts.memory_client import MemoryClient

with MemoryClient() as mem:
    # Add
    mem.add("Important info", tags=["tag1"], metadata={"source": "chat"})
    
    # Search
    results = mem.query("search term", limit=5)
    
    # Delete
    mem.delete(memory_id)

Tag Guide

TagPurpose
preferencesUser preferences
topicsTopics of interest
projectsProjects of interest
contextConversation context
decisionDecision history
checkpointTask checkpoint (auto)
resultTask result (auto)

Storage Location

OpenMemory data stored in data/memory/ directory. Shares the same DB with Context Manager.

Dependencies

code
openmemory-py>=1.3.0
langchain>=1.0.0
langchain-core>=1.0.0