remember

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mem0 Remember

Mem0 记忆存储

Store a fact or learning directly into mem0.
直接将事实或学习内容存入mem0。

Execution

执行步骤

Step 1: Extract the content

步骤1:提取内容

The user provides the content as an argument:
/mem0:remember <text>
If no text was provided, ask: "What should I remember?"
用户通过参数提供内容:
/mem0:remember <text>
如果未提供文本,询问:“我应该记住什么?”

Step 2: Classify the memory

步骤2:分类记忆

Based on the content, pick the best
metadata.type
:
Content signalType
"we decided...", "always use...", "never..."
decision
"X doesn't work because...", "don't try..."
anti_pattern
"I prefer...", "use X instead of Y"
user_preference
"the convention is...", "we always..."
convention
"learned that...", "figured out..."
task_learning
setup, env, tooling, config
environmental
anything else
task_learning
根据内容选择最合适的
metadata.type
内容信号类型
“我们决定...”, “始终使用...”, “绝不...”
decision
“X无法工作是因为...”, “不要尝试...”
anti_pattern
“我偏好...”, “使用X而非Y”
user_preference
“惯例是...”, “我们总是...”
convention
“了解到...”, “弄清楚了...”
task_learning
设置、环境、工具、配置
environmental
其他任何内容
task_learning

Step 3: Store

步骤3:存储

Call
add_memory
with:
  • text="<the user's text>"
  • user_id=<active_user_id>
  • app_id=<active_project_id>
  • metadata={"type": "<classified_type>", "branch": "<active_branch>", "confidence": 1.0, "source": "remember_command"}
  • infer=False
infer=False
because the user stated the fact explicitly — no extraction needed.
confidence=1.0
because the user explicitly asked to store this.
调用
add_memory
接口,参数如下:
  • text="<用户输入的文本>"
  • user_id=<当前活跃用户ID>
  • app_id=<当前活跃项目ID>
  • metadata={"type": "<分类后的类型>", "branch": "<当前活跃分支>", "confidence": 1.0, "source": "remember_command"}
  • infer=False
设置
infer=False
是因为用户明确陈述了事实——无需额外提取。 设置
confidence=1.0
是因为用户明确要求存储该内容。

Step 4: Confirm

步骤4:确认

The
add_memory
response returns
event_id
(not
memory_id
) because writes are async. Call
get_event_status(event_id=<event_id>)
once.
  • If status is
    SUCCEEDED
    : print the memory ID from the result.
  • If status is
    PENDING
    or
    processing
    : print with the event ID as fallback.
Remembered as <type>: "<content, first 80 chars>"
Memory ID: <id from event status>
Append
...
only if content was truncated (longer than 80 chars).
add_memory
接口返回
event_id
(而非
memory_id
),因为写入操作是异步的。 调用一次
get_event_status(event_id=<event_id>)
  • 如果状态为
    SUCCEEDED
    :打印结果中的记忆ID。
  • 如果状态为
    PENDING
    processing
    :使用事件ID作为备选进行打印。
已存储为<type>:"<内容,前80个字符>"
记忆ID:<事件状态返回的ID>
仅当内容被截断(超过80字符)时才追加
...