memory-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Memory Management Skill

内存管理Skill

Purpose

用途

AgentDB memory system with HNSW vector search. Provides 150x-12,500x faster pattern retrieval, persistent storage, and semantic search capabilities for learning and knowledge management.
基于HNSW向量搜索的AgentDB内存系统。为学习和知识管理提供150倍至12500倍的快速模式检索、持久化存储以及语义搜索能力。

When to Trigger

触发场景

  • need to store successful patterns
  • searching for similar solutions
  • semantic lookup of past work
  • learning from previous tasks
  • sharing knowledge between agents
  • building knowledge base
  • 需要存储成功模式
  • 搜索相似解决方案
  • 对过往工作进行语义查询
  • 从先前任务中学习
  • Agent间共享知识
  • 构建知识库

When to Skip

跳过场景

  • no learning needed
  • ephemeral one-off tasks
  • external data sources available
  • read-only exploration
  • 无需学习
  • 临时一次性任务
  • 可使用外部数据源
  • 只读探索

Commands

命令

Store Pattern

存储模式

Store a pattern or knowledge item in memory
bash
npx @claude-flow/cli memory store --key "[key]" --value "[value]" --namespace patterns
Example:
bash
npx @claude-flow/cli memory store --key "auth-jwt-pattern" --value "JWT validation with refresh tokens" --namespace patterns
在内存中存储模式或知识条目
bash
npx @claude-flow/cli memory store --key "[key]" --value "[value]" --namespace patterns
示例:
bash
npx @claude-flow/cli memory store --key "auth-jwt-pattern" --value "JWT validation with refresh tokens" --namespace patterns

Semantic Search

语义搜索

Search memory using semantic similarity
bash
npx @claude-flow/cli memory search --query "[search terms]" --limit 10
Example:
bash
npx @claude-flow/cli memory search --query "authentication best practices" --limit 5
使用语义相似度搜索内存
bash
npx @claude-flow/cli memory search --query "[search terms]" --limit 10
示例:
bash
npx @claude-flow/cli memory search --query "authentication best practices" --limit 5

Retrieve Entry

获取条目

Retrieve a specific memory entry by key
bash
npx @claude-flow/cli memory get --key "[key]" --namespace [namespace]
Example:
bash
npx @claude-flow/cli memory get --key "auth-jwt-pattern" --namespace patterns
通过key获取特定内存条目
bash
npx @claude-flow/cli memory get --key "[key]" --namespace [namespace]
示例:
bash
npx @claude-flow/cli memory get --key "auth-jwt-pattern" --namespace patterns

List Entries

列出条目

List all entries in a namespace
bash
npx @claude-flow/cli memory list --namespace [namespace]
Example:
bash
npx @claude-flow/cli memory list --namespace patterns --limit 20
列出命名空间中的所有条目
bash
npx @claude-flow/cli memory list --namespace [namespace]
示例:
bash
npx @claude-flow/cli memory list --namespace patterns --limit 20

Delete Entry

删除条目

Delete a memory entry
bash
npx @claude-flow/cli memory delete --key "[key]" --namespace [namespace]
删除内存条目
bash
npx @claude-flow/cli memory delete --key "[key]" --namespace [namespace]

Initialize HNSW Index

初始化HNSW索引

Initialize HNSW vector search index
bash
npx @claude-flow/cli memory init --enable-hnsw
初始化HNSW向量搜索索引
bash
npx @claude-flow/cli memory init --enable-hnsw

Memory Stats

内存统计

Show memory usage statistics
bash
npx @claude-flow/cli memory stats
显示内存使用统计信息
bash
npx @claude-flow/cli memory stats

Export Memory

导出内存

Export memory to JSON
bash
npx @claude-flow/cli memory export --output memory-backup.json
将内存导出为JSON格式
bash
npx @claude-flow/cli memory export --output memory-backup.json

Scripts

脚本

ScriptPathDescription
memory-backup
.agents/scripts/memory-backup.sh
Backup memory to external storage
memory-consolidate
.agents/scripts/memory-consolidate.sh
Consolidate and optimize memory
脚本路径描述
memory-backup
.agents/scripts/memory-backup.sh
将内存备份到外部存储
memory-consolidate
.agents/scripts/memory-consolidate.sh
整合并优化内存

References

参考资料

DocumentPathDescription
HNSW Guide
docs/hnsw.md
HNSW vector search configuration
Memory Schema
docs/memory-schema.md
Memory namespace and schema reference
文档路径描述
HNSW Guide
docs/hnsw.md
HNSW向量搜索配置
Memory Schema
docs/memory-schema.md
内存命名空间与架构参考

Best Practices

最佳实践

  1. Check memory for existing patterns before starting
  2. Use hierarchical topology for coordination
  3. Store successful patterns after completion
  4. Document any new learnings
  1. 开始前检查内存中是否已有现有模式
  2. 使用分层拓扑进行协调
  3. 完成后存储成功的模式
  4. 记录所有新的学习内容