mem
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesemem — Agent Memory Store
mem — Agent 记忆存储工具
A CLI tool for storing and retrieving memories with full-text search. Data is stored locally in .
~/.mem/mem.db一款支持全文搜索的CLI工具,用于存储和检索记忆内容。数据本地存储在中。
~/.mem/mem.dbWhen to Use
使用场景
- Remember user preferences, project decisions, important facts
- Store code snippets, commands, configurations for later recall
- Search your knowledge base before asking the user for information you may have stored
- Attach images (screenshots, diagrams) to memories
- 记录用户偏好、项目决策、重要事实
- 存储代码片段、命令、配置信息,方便后续检索
- 检索个人知识库,避免重复向用户询问已存储的信息
- 附加图片(截图、图表)到记忆内容中
Commands
命令说明
Three operators: (none) = recall, = remember, = forget.
+-三种操作符:无操作符 = 检索, = 存储, = 删除。
+-Recall (search, list, get)
检索(搜索、列表、查看详情)
bash
mem # list recent memories
mem "deploy" # full-text search
mem "database" --tag db # search filtered by tag
mem 7sjtNVyZrNIa # get full content by ID
mem --tag prefs # list filtered by tag
mem "api" --limit 5 --json # limit results, JSON output
mem --full # show full content for allbash
mem # 列出最近的记忆内容
mem "deploy" # 全文搜索
mem "database" --tag db # 按标签过滤搜索
mem 7sjtNVyZrNIa # 通过ID查看完整内容
mem --tag prefs # 按标签过滤列出内容
mem "api" --limit 5 --json # 限制结果数量,以JSON格式输出
mem --full # 显示所有内容的完整信息Remember
存储
bash
mem + "user prefers dark mode" --tag prefs
mem + "deploy: bun build --compile" --tag deploy
mem + "chose SQLite for simplicity" --tag architecture
mem + --image ./screenshot.png --title "Current UI" --tag ui
echo "long content" | mem + --tag notesbash
mem + "user prefers dark mode" --tag prefs
mem + "deploy: bun build --compile" --tag deploy
mem + "chose SQLite for simplicity" --tag architecture
mem + --image ./screenshot.png --title "Current UI" --tag ui
echo "long content" | mem + --tag notesForget
删除
bash
mem - <id> # delete one memory
mem - id1 id2 id3 # delete multiplebash
mem - <id> # 删除单条记忆内容
mem - id1 id2 id3 # 删除多条记忆内容Piping
管道操作
bash
mem "old" --json | jq -r '.[].id' | xargs -I{} mem - {}
echo "long content" | mem + --tag notesbash
mem "old" --json | jq -r '.[].id' | xargs -I{} mem - {}
echo "long content" | mem + --tag notesBest Practices
最佳实践
- Tag consistently — Use lowercase, descriptive tags like ,
prefs,api,deploydb - Search before asking — Check if you've stored relevant information before asking the user
- Store decisions — When making architectural or design decisions, store the reasoning
- Keep memories atomic — One concept per memory for better searchability
- 统一标签规范 — 使用小写、描述性标签,如、
prefs、api、deploydb - 先检索再询问 — 在向用户询问信息前,先检查是否已存储相关内容
- 记录决策过程 — 当做出架构或设计决策时,记录决策理由
- 内容原子化 — 每条记忆内容对应一个概念,提升搜索效率
Output Formats
输出格式
- Default: One-line summary per result
- : Complete content inline
--full - : Structured JSON for parsing
--json
- 默认:每条结果显示单行摘要
- : 内联显示完整内容
--full - : 输出结构化JSON格式,便于解析
--json