OpenClaw MemoryOS Memory Admin
Manage OpenClaw long-term memory by operating directly on MemoryOS storage files and by following the MemoryOS data model used in long_term_user.json and long_term_assistant.json.
Use the bundled script for deterministic operations. Read the reference file only when you need to confirm the on-disk layout or explain how MemoryOS maps user profile, user knowledge, and assistant knowledge.
Quick Start
Prefer scripts/memoryos_admin.py over ad hoc edits.
Common commands:
CODEBLOCK0
Workflow
Follow this order unless the user asks for a narrower task:
- 1. Locate the MemoryOS data root used by the OpenClaw integration.
- Run
summary to inspect current profile and knowledge counts. - Run
backup before any mutating action. - Use
search-user or search-assistant to verify whether the target memory already exists. - Use
add-user-knowledge, add-assistant-knowledge, or set-profile for intentional updates. - Use
export-markdown when the user wants a readable audit or handoff artifact.
Data Rules
Treat these files as the authoritative long-term memory state:
- - INLINECODE11
- INLINECODE12
Interpret them this way:
- -
user_profiles.<user_id>.data: current synthesized user profile - INLINECODE14 : user-specific long-term knowledge entries
- INLINECODE15 : assistant-side reusable knowledge entries
Preserve existing timestamps unless you are explicitly adding or replacing content.
Do not hand-edit embeddings. The bundled admin script stores and updates records without embeddings on purpose, because this skill is for memory administration, curation, backup, and inspection. Semantic retrieval inside live MemoryOS runtime can rebuild or add embeddings through normal MemoryOS flows when needed.
Mutation Guidance
Use set-profile only when the user wants to replace the synthesized profile with a curated version.
Use add-user-knowledge for durable facts about the user, preferences, identity, recurring tasks, or persistent context that OpenClaw should remember.
Use add-assistant-knowledge for workflow instructions, project background, house rules, or reusable operational knowledge that belongs to the assistant rather than the user.
Before appending a near-duplicate memory, search first and ask whether the old entry should be kept, replaced manually, or left unchanged if the instruction is ambiguous.
OpenClaw Integration Notes
If OpenClaw is not present in the workspace, treat OpenClaw as the consuming agent and MemoryOS as the storage backend. The critical integration contract is the MemoryOS data_storage_path and the chosen user_id plus assistant_id.
When wiring another agent project to MemoryOS:
- - keep a stable
user_id per person - keep a stable
assistant_id per OpenClaw persona or deployment - point the agent to the same INLINECODE24
- back up memory files before schema or workflow changes
References
Read references/memoryos-layout.md when you need exact file layout and field names.
OpenClaw MemoryOS 内存管理
通过直接操作MemoryOS存储文件并遵循longtermuser.json和longtermassistant.json中使用的MemoryOS数据模型,管理OpenClaw长期记忆。
使用捆绑脚本执行确定性操作。仅在需要确认磁盘布局或解释MemoryOS如何映射用户配置文件、用户知识和助手知识时,才读取参考文件。
快速入门
优先使用scripts/memoryos_admin.py而非临时手动编辑。
常用命令:
powershell
python scripts/memoryosadmin.py summary --data-root D:\path\to\memoryosdata --user-id alice --assistant-id openclaw
python scripts/memoryosadmin.py search-user --data-root D:\path\to\memoryosdata --user-id alice --query 项目偏好
python scripts/memoryosadmin.py add-user-knowledge --data-root D:\path\to\memoryosdata --user-id alice --text 用户偏好简洁的技术回答。
python scripts/memoryosadmin.py set-profile --data-root D:\path\to\memoryosdata --user-id alice --profile-file .\profile.txt
python scripts/memoryosadmin.py backup --data-root D:\path\to\memoryosdata --user-id alice --assistant-id openclaw
工作流程
除非用户要求更窄范围的任务,否则按以下顺序执行:
- 1. 定位OpenClaw集成所使用的MemoryOS数据根目录。
- 运行summary检查当前配置文件和知识条目数量。
- 在任何修改操作前运行backup。
- 使用search-user或search-assistant验证目标记忆是否已存在。
- 使用add-user-knowledge、add-assistant-knowledge或set-profile进行有意的更新。
- 当用户需要可读的审计或交接产物时,使用export-markdown。
数据规则
将这些文件视为权威的长期记忆状态:
- - users/id>/longtermuser.json
- assistants/id>/longtermassistant.json
按以下方式解释:
- - userprofiles.id>.data:当前合成的用户配置文件
- knowledgebase[]:用户特定的长期知识条目
- assistantknowledge[]:助手侧可复用的知识条目
除非明确添加或替换内容,否则保留现有时间戳。
不要手动编辑嵌入向量。捆绑的管理脚本有意在存储和更新记录时不包含嵌入向量,因为此技能用于内存管理、整理、备份和检查。实时MemoryOS运行时的语义检索可以在需要时通过正常的MemoryOS流程重建或添加嵌入向量。
修改指南
仅当用户希望用精选版本替换合成配置文件时,使用set-profile。
对于关于用户的持久事实、偏好、身份、重复性任务或OpenClaw应记住的持久上下文,使用add-user-knowledge。
对于工作流程指令、项目背景、内部规则或属于助手而非用户的可复用操作知识,使用add-assistant-knowledge。
在追加近似重复的记忆之前,先进行搜索,并询问旧条目是否应保留、手动替换,或在指令不明确时保持不变。
OpenClaw集成说明
如果工作区中不存在OpenClaw,则将OpenClaw视为消费代理,将MemoryOS视为存储后端。关键的集成契约是MemoryOS的datastoragepath以及选定的userid和assistantid。
将另一个代理项目连接到MemoryOS时:
- - 为每个人员保持稳定的userid
- 为每个OpenClaw角色或部署保持稳定的assistantid
- 将代理指向相同的datastoragepath
- 在模式或工作流程变更前备份记忆文件
参考资料
当需要确切的文件布局和字段名称时,请阅读references/memoryos-layout.md。