MemOS Local Memory — Agent Guide
This skill describes how to use the MemOS memory tools so you can reliably search and use the user's long-term conversation history, share knowledge across agents, and discover public skills.
How memory is provided each turn
- - Automatic recall (hook): At the start of each turn, the system runs a memory search using the user's current message and injects relevant past memories into your context. You do not need to call any tool for that.
- When that is not enough: If the user's message is very long, vague, or the automatic search returns no memories, you should generate your own short, focused query and call
memory_search yourself. - Memory isolation: Each agent can only see its own memories and memories marked as
public. Other agents' private memories are invisible to you.
Tools — what they do and when to call
memory_search
- - What it does: Search long-term conversation memory for past conversations, user preferences, decisions, and experiences. Returns relevant excerpts with
chunkId and optionally task_id. Only returns memories belonging to the current agent or marked as public. - When to call:
- The automatic recall did not run or returned nothing.
- The user's query is long or unclear —
generate a short query yourself and call
memory_search(query="...").
- You need to search with a different angle (e.g. filter by
role='user').
-
query (string,
required) — Natural language search query.
-
maxResults (number, optional) — Max results, default 20, max 20.
-
minScore (number, optional) — Minimum score 0–1, default 0.45, floor 0.35.
-
role (string, optional) — Filter by role:
'user',
'assistant', or
'tool'. Use
'user' to find what the user said.
memory_get
- - What it does: Get the full original text of a memory chunk. Use to verify exact details from a search hit.
- When to call: A
memory_search hit looks relevant but you need to see the complete original content, not just the summary/excerpt. - Parameters:
-
chunkId (string,
required) — The chunkId from a search hit.
-
maxChars (number, optional) — Max characters to return (default 4000, max 12000).
memorywritepublic
- - What it does: Write a piece of information to public memory. Public memories are visible to all agents during
memory_search. Use for shared knowledge, team decisions, or cross-agent coordination information. - When to call: In multi-agent or collaborative scenarios, when you have persistent information useful to everyone (e.g. shared decisions, conventions, configurations, workflows). Do not write session-only or purely private content.
- Parameters:
-
content (string,
required) — The content to write to public memory.
-
summary (string, optional) — Short summary of the content.
task_summary
- - What it does: Get the detailed summary of a complete task: title, status, narrative summary, and related skills. Use when
memory_search returns a hit with a task_id and you need the full story. Preserves critical information: URLs, file paths, commands, error codes, step-by-step instructions. - When to call: A
memory_search hit included a task_id and you need the full context of that task. - Parameters:
-
taskId (string,
required) — The task
id from a memorysearch hit.
skill_get
- - What it does: Retrieve a proven skill (experience guide) by
skillId or by taskId. If you pass a taskId, the system will find the associated skill automatically. - When to call: A search hit has a
task_id and the task has a "how to do this again" guide. Use this to follow the same approach or reuse steps. - Parameters:
-
skillId (string, optional) — Direct skill ID.
-
taskId (string, optional) — Task ID — will look up the skill linked to this task.
- At least one of
skillId or
taskId must be provided.
skill_search
- - What it does: Search available skills by natural language. Searches your own skills, public skills, or both — controlled by the
scope parameter. - When to call: The current task requires a capability or guide you don't have. Use
skill_search to find one first; after finding it, use skill_get to read it, then skill_install to load it for future turns. - Parameters:
-
query (string,
required) — Natural language description of the needed skill.
-
scope (string, optional) — Search scope:
'mix' (default, self + public),
'self' (own only),
'public' (public only).
skill_install
- - What it does: Install a learned skill into the agent workspace so it becomes permanently available. After installation, the skill will be loaded automatically in future sessions.
- When to call: After
skill_get when the skill is useful for ongoing use. - Parameters:
-
skillId (string,
required) — The skill ID to install.
skill_publish
- - What it does: Make a skill public so other agents can discover and install it via
skill_search. - When to call: You have a useful skill that other agents could benefit from, and you want to share it.
- Parameters:
-
skillId (string,
required) — The skill ID to publish.
skill_unpublish
- - What it does: Make a skill private again. Other agents will no longer be able to discover it.
- When to call: You want to stop sharing a previously published skill.
- Parameters:
-
skillId (string,
required) — The skill ID to unpublish.
memory_timeline
- - What it does: Expand context around a memory search hit. Pass the
chunkId from a search result to read the surrounding conversation messages. - When to call: A
memory_search hit is relevant but you need the surrounding dialogue. - Parameters:
-
chunkId (string,
required) — The chunkId from a memory_search hit.
-
window (number, optional) — Context window ±N messages, default 2.
memory_viewer
- - What it does: Show the MemOS Memory Viewer URL. Call this when the user asks how to view, browse, manage, or check their memories. Returns the URL the user can open in their browser.
- When to call: The user asks where to see or manage their memories.
- Parameters: None.
Quick decision flow
- 1. No memories in context or auto-recall reported nothing
→ Call
memory_search(query="...") with a
self-generated short query.
- 2. Need to see the full original text of a search hit
→ Call
memory_get(chunkId="...").
- 3. Search returned hits with
task_id and you need full context
→ Call
task_summary(taskId="...").
- 4. Task has an experience guide you want to follow
→ Call
skill_get(taskId="...") or
skill_get(skillId="..."). Optionally
skill_install(skillId="...") for future use.
- 5. You need the exact surrounding conversation of a hit
→ Call
memory_timeline(chunkId="...").
- 6. You need a capability/guide that you don't have
→ Call
skill_search(query="...", scope="mix") to discover available skills.
- 7. You have shared knowledge useful to all agents
→ Call
memory_write_public(content="...") to persist it in public memory.
- 8. You want to share/stop sharing a skill with other agents
→ Call
skill_publish(skillId="...") or
skill_unpublish(skillId="...").
- 9. User asks where to see or manage their memories
→ Call
memory_viewer() and share the URL.
Writing good search queries
- - Prefer short, focused queries (a few words or one clear question).
- Use concrete terms: names, topics, tools, or decisions.
- If the user's message is long, derive one or two sub-queries rather than pasting the whole message.
- Use
role='user' when you specifically want to find what the user said.
Memory ownership and agent isolation
Each memory is tagged with an owner (e.g. agent:main, agent:sales-bot). This is handled automatically — you do not need to pass any owner parameter.
- - Your memories: All tools (
memory_search, memory_get, memory_timeline) automatically scope queries to your agent's own memories. - Public memories: Memories marked as
public are visible to all agents. Use memory_write_public to write shared knowledge. - Cross-agent isolation: You cannot see memories owned by other agents (unless they are public).
- How it works: The system identifies your agent ID from the OpenClaw runtime context and applies owner filtering automatically on every search, recall, and retrieval.
MemOS 本地记忆 — 智能体指南
本技能描述如何使用 MemOS 记忆工具,以便您能够可靠地搜索和使用用户的长期对话历史、跨智能体共享知识以及发现公共技能。
每轮对话中记忆的提供方式
- - 自动回忆(钩子): 每轮对话开始时,系统会使用用户的当前消息运行记忆搜索,并将相关的过往记忆注入到您的上下文中。您无需为此调用任何工具。
- 当自动回忆不足时: 如果用户的消息非常长、含糊不清,或者自动搜索返回无记忆,您应自行生成简短、有针对性的查询,并调用 memory_search。
- 记忆隔离: 每个智能体只能看到自己的记忆以及标记为 public 的记忆。其他智能体的私有记忆对您不可见。
工具——功能与调用时机
memory_search
- - 功能: 搜索长期对话记忆,查找过往对话、用户偏好、决策和经验。返回带有 chunkId 和可选的 task_id 的相关片段。仅返回属于当前智能体或标记为公共的记忆。
- 调用时机:
- 自动回忆未运行或返回空结果。
- 用户的查询很长或不清晰——
自行生成简短查询并调用 memory_search(query=...)。
- 您需要从不同角度进行搜索(例如按 role=user 过滤)。
- query(字符串,
必填)——自然语言搜索查询。
- maxResults(数字,可选)——最大结果数,默认 20,最大 20。
- minScore(数字,可选)——最低分数 0–1,默认 0.45,下限 0.35。
- role(字符串,可选)——按角色过滤:user、assistant 或 tool。使用 user 查找用户所说的内容。
memory_get
- - 功能: 获取记忆片段的完整原始文本。用于验证搜索命中结果的精确细节。
- 调用时机: memory_search 的命中结果看起来相关,但您需要查看完整的原始内容,而不仅仅是摘要/摘录。
- 参数:
- chunkId(字符串,
必填)——搜索命中结果中的 chunkId。
- maxChars(数字,可选)——返回的最大字符数(默认 4000,最大 12000)。
memorywritepublic
- - 功能: 将一条信息写入公共记忆。公共记忆在 memory_search 期间对所有智能体可见。用于共享知识、团队决策或跨智能体协调信息。
- 调用时机: 在多智能体或协作场景中,当您拥有对所有人有用的持久信息时(例如共享决策、约定、配置、工作流程)。不要写入仅限会话或纯私有的内容。
- 参数:
- content(字符串,
必填)——要写入公共记忆的内容。
- summary(字符串,可选)——内容的简短摘要。
task_summary
- - 功能: 获取完整任务的详细摘要:标题、状态、叙述性摘要以及相关技能。当 memorysearch 返回带有 taskid 的命中结果且您需要完整故事时使用。保留关键信息:URL、文件路径、命令、错误代码、逐步说明。
- 调用时机: memorysearch 的命中结果包含 taskid,并且您需要该任务的完整上下文。
- 参数:
- taskId(字符串,
必填)——来自 memory
search 命中结果的 taskid。
skill_get
- - 功能: 通过 skillId 或 taskId 检索已验证的技能(经验指南)。如果您传递 taskId,系统将自动找到关联的技能。
- 调用时机: 搜索命中结果包含 task_id,并且该任务包含如何再次执行此操作的指南。使用此工具遵循相同的方法或重用步骤。
- 参数:
- skillId(字符串,可选)——直接技能 ID。
- taskId(字符串,可选)——任务 ID——将查找与此任务关联的技能。
- 必须至少提供 skillId 或 taskId 中的一个。
skill_search
- - 功能: 通过自然语言搜索可用技能。搜索您自己的技能、公共技能或两者——由 scope 参数控制。
- 调用时机: 当前任务需要您不具备的能力或指南。先使用 skillsearch 查找;找到后,使用 skillget 阅读,然后使用 skill_install 加载以供后续轮次使用。
- 参数:
- query(字符串,
必填)——所需技能的自然语言描述。
- scope(字符串,可选)——搜索范围:mix(默认,自身 + 公共)、self(仅自身)、public(仅公共)。
skill_install
- - 功能: 将学到的技能安装到智能体工作区,使其永久可用。安装后,该技能将在未来的会话中自动加载。
- 调用时机: 在 skill_get 之后,当该技能对持续使用有用时。
- 参数:
- skillId(字符串,
必填)——要安装的技能 ID。
skill_publish
- - 功能: 将技能设为公共,以便其他智能体可以通过 skill_search 发现并安装它。
- 调用时机: 您拥有一个对其他智能体有用的技能,并且想要分享它。
- 参数:
- skillId(字符串,
必填)——要发布的技能 ID。
skill_unpublish
- - 功能: 将技能重新设为私有。其他智能体将无法再发现它。
- 调用时机: 您想要停止分享之前发布的技能。
- 参数:
- skillId(字符串,
必填)——要取消发布的技能 ID。
memory_timeline
- - 功能: 扩展记忆搜索命中结果周围的上下文。传递搜索结果的 chunkId 以读取周围的对话消息。
- 调用时机: memory_search 的命中结果相关,但您需要周围的对话。
- 参数:
- chunkId(字符串,
必填)——来自 memory_search 命中结果的 chunkId。
- window(数字,可选)——上下文窗口 ±N 条消息,默认 2。
memory_viewer
- - 功能: 显示 MemOS 记忆查看器 URL。当用户询问如何查看、浏览、管理或检查他们的记忆时调用。返回用户可以在浏览器中打开的 URL。
- 调用时机: 用户询问在哪里查看或管理他们的记忆。
- 参数: 无。
快速决策流程
- 1. 上下文中无记忆或自动回忆报告无结果
→ 使用
自行生成的简短查询调用 memory_search(query=...)。
- 2. 需要查看搜索命中结果的完整原始文本
→ 调用 memory_get(chunkId=...)。
- 3. 搜索返回带有 task_id 的命中结果且需要完整上下文
→ 调用 task_summary(taskId=...)。
- 4. 任务有您想要遵循的经验指南
→ 调用 skill
get(taskId=...) 或 skillget(skillId=...)。可选地调用 skill_install(skillId=...) 以备将来使用。
- 5. 需要命中结果的确切周围对话
→ 调用 memory_timeline(chunkId=...)。
- 6. 需要您不具备的能力/指南
→ 调用 skill_search(query=..., scope=mix) 以发现可用技能。
- 7. 拥有对所有智能体有用的共享知识
→ 调用 memory
writepublic(content=...) 将其持久化到公共记忆中。
- 8. 想要与其他智能体分享/停止分享技能
→ 调用 skill
publish(skillId=...) 或 skillunpublish(skillId=...)。
- 9. 用户询问在哪里查看或管理他们的记忆
→ 调用 memory_viewer() 并分享 URL。
编写良好的搜索查询
- - 优先使用简短、有针对性的查询(几个词或一个清晰的问题)。
- 使用具体术语:名称、主题、工具或决策。
- 如果用户的消息很长,推导出一两个子查询,而不是粘贴整个消息。
- 当您特别想查找用户所说的内容时,使用 role=user。
记忆所有权与智能体隔离
每条记忆都标记有 owner(例如 agent:main、agent:sales-bot)。这是自动处理的——您无需传递任何所有者参数。
- - 您的记忆: 所有工具(memorysearch、memoryget、memory_timeline)自动将查询范围限定为您智能体