adding-memory
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOpenViking (OV) add-memory
add-memoryOpenViking (OV) add-memory
命令
add-memoryThe command adds long persistant memory — turning text and structured conversations into searchable, retrievable memories in the OpenViking context database.
ov add-memoryov add-memoryWhen to Use
使用场景
- After learning something worth remembering across sessions
- To persist conversation insights, decisions, or findings
- To build up a knowledge base from interactions
- When an agent wants to store context for future retrieval
- 在跨会话场景下,学到值得记住的内容后
- 用于持久化保存对话中的洞察、决策或发现
- 通过交互内容构建知识库
- 当Agent需要存储上下文以便未来检索时
Input Modes
输入模式
choose wisely between plain text and multi-turn mode. Multi-turn mode can contain more complex insights, let openviking handle the memory extraction.
请在纯文本模式和多轮对话模式中灵活选择。多轮对话模式可存储更复杂的洞察,由OpenViking负责提取记忆内容。
Mode 1: Plain Text for compressed memory
模式1:纯文本模式(用于压缩记忆)
A simple string is stored as a message:
userbash
ov add-memory "User's name is Bob, he participate in Global Hackathon in 2025-01-08, and won Champion."将简单字符串作为消息存储:
userbash
ov add-memory "User's name is Bob, he participate in Global Hackathon in 2025-01-08, and won Champion."Mode 2: Multi-turn Conversation for Richer Context
模式2:多轮对话模式(用于丰富上下文)
A JSON array of objects to store a full exchange:
{role, content}bash
ov add-memory '[
{"role": "user", "content": "I love traveling. Give me some options of Transport from Beijing to Shanghai."},
{"role": "assistant", "content": "You can use train, bus, or plane. Train is the fastest, but you need to book in advance. Bus is cheaper, but you need to wait. Plane is the most expensive, but you can get there any time of day."},
{"role": "user", "content": "I prefer train. I like sightseeing on the train. Can you give me the train schedule?"},
< ... more possible conversation about schedule and tickest need to be memorized ... >
]'通过对象组成的JSON数组存储完整对话内容:
{role, content}bash
ov add-memory '[
{"role": "user", "content": "I love traveling. Give me some options of Transport from Beijing to Shanghai."},
{"role": "assistant", "content": "You can use train, bus, or plane. Train is the fastest, but you need to book in advance. Bus is cheaper, but you need to wait. Plane is the most expensive, but you can get there any time of day."},
{"role": "user", "content": "I prefer train. I like sightseeing on the train. Can you give me the train schedule?"},
< ... more possible conversation about schedule and tickest need to be memorized ... >
]'Output
输出结果
Returns count of memory extracted:
memories_extracted 1返回提取到的记忆数量:
memories_extracted 1Agent Best Practices
Agent最佳实践
How to Write Good Memories
如何撰写优质记忆内容
- Be specific — Include concrete details, not vague summaries
- Include context — Why this matters, when it applies
- Use structured format — Separate the what from the why
- 具体明确——包含具体细节,而非模糊概括
- 包含上下文——说明内容的重要性及适用场景
- 使用结构化格式——区分内容本身和其重要性
Batch Related Facts
批量关联事实
Group related memories in one call rather than many small ones:
bash
ov add-memory '[
{"role": "user", "content": "Key facts about the ov_cli Rust crate"},
{"role": "assistant", "content": "1. runs faster than python cli\n2. uses HttpClient to connect openviking server\n3. Output formatting supports table and JSON modes\n4. Config lives at ~/.openviking/ovcli.conf"}
]'将相关记忆整合到一次调用中,而非多次零散调用:
bash
ov add-memory '[
{"role": "user", "content": "Key facts about the ov_cli Rust crate"},
{"role": "assistant", "content": "1. runs faster than python cli\n2. uses HttpClient to connect openviking server\n3. Output formatting supports table and JSON modes\n4. Config lives at ~/.openviking/ovcli.conf"}
]'Prerequisites
前置条件
- CLI configured:
~/.openviking/ovcli.conf
- 已配置CLI:
~/.openviking/ovcli.conf