- 想直接复制提示词来使用 mem 的普通用户
- 想知道“应该怎么对 Codex 开口”的协作者
- 不解释 Go 实现细节
- 不解释 MCP 传输协议
- 不替代 how-memory-works.md 的概念说明
这份文档给你一些可以直接发给 Codex 的提示词示例,帮助它正确使用 codex-mem。
这些不是 MCP 方法名,也不是命令行。
它们是 codex-mem 已经注册成 MCP server 之后,用户直接发给 Codex 的自然语言。
大多数情况下,你不用手动指定 scope。
更实用的理解是:
- 先让系统识别“你现在在哪个仓库/项目里”
- 再开始会话、恢复上下文
- 后续保存记忆时,默认就会保存到当前仓库/项目下面
只有在这些情况,才值得明确提“范围”:
- 当前目录不是标准仓库,怕识别不准
- 你想跨项目查记忆
- 你有多个 clone / worktree,想先确认系统识别到了哪一个
- 你只需要写自然语言
- Codex 会自己决定调用哪个 MCP 工具
- 下方列出的工具名只是帮助你理解它背后会做什么,不是让你手动输入
先恢复这个仓库之前的上下文。如果有相关的交接记录或长期笔记,就一起加载,然后开始一个新的会话继续当前任务。
可能调用的工具:
memory_bootstrap_session
先确认一下当前工作目录属于哪个仓库和项目,再开始一个新的带记忆会话。
可能调用的工具:
memory_resolve_scopememory_start_session
这个结论以后还会反复用到,请把它保存成长期记忆,重要度高一点,并带上相关文件。
可能调用的工具:
memory_save_note
这次 bug 的根因和修复方法以后可能还会用到,请整理成一条长期记忆,顺便带上改过的文件。
可能调用的工具:
memory_save_note
结束之前请保存一条交接记录,写清楚这次做了什么、下一步做什么、还有哪些问题没解决,以及改过哪些文件。
可能调用的工具:
memory_save_handoff
先为当前任务保存一个检查点,方便我下次从现在这个状态继续。
可能调用的工具:
memory_save_handoff
如果你不希望同一轮同时写长期 note 和 handoff,可以在提示词里明确说只保存一种:
这条信息只需要保存成长期记忆,不要另外写 handoff。
这次只保存任务交接记录,不要另外写长期 note。
先搜索一下以前和 HTTP MCP 传输、origin 校验或者远程部署相关的历史笔记和交接记录。
可能调用的工具:
memory_search
我现在在 A 项目里开发,这次任务和 B 项目有关。请搜索一下 B 项目里与当前任务相关的历史笔记或交接记录,并明确标出哪些结果来自 B 项目。
可能调用的工具:
memory_search
继续之前,先把这个仓库最近的笔记和交接记录加载出来给我看。
可能调用的工具:
memory_get_recent
先恢复当前 A 仓库之前的上下文。这次任务依赖 B 项目,也一起加载和 B 项目相关的历史记忆,并标明哪些内容来自 B 项目。
可能调用的工具:
memory_bootstrap_session
把这条记忆记录的完整内容加载出来给我看。
可能调用的工具:
memory_get_note
请为当前仓库以 safe 模式安装推荐的 AGENTS.md 指引。
可能调用的工具:
memory_install_agents
这些表达更容易让 Codex 明确知道你是在要求它使用持久记忆:
长期记录保存到记忆持久化保存交接记录下次继续恢复上下文搜索记忆最近笔记
这些说法太模糊,Codex 不一定会稳定调用 memory 工具:
记一下你记住这个先放脑子里
如果你真的希望它进入持久记忆,最好直接说:
把这个保存成长期记录请保存一条交接记录请先恢复这个仓库之前的上下文
This document gives example user prompts that encourage Codex to use codex-mem correctly.
These are not MCP method calls.
They are normal prompts a user can send to Codex after codex-mem has already been registered as an MCP server.
In most cases, you do not need to specify scope manually.
The practical model is:
- let the system identify the current repository/project first
- start or bootstrap the session
- save notes and handoffs into that current repository/project context
You only need to be more explicit when:
- the current directory may be ambiguous
- you want cross-project retrieval
- you have multiple clones or worktrees and want to confirm what was identified
- the user writes the prompt in natural language
- Codex decides which MCP tool or tools to call
- the tool names below are the likely tools Codex should choose, not text the user needs to type
Recover prior context for this repository. If there are relevant handoffs or durable notes, load them and start a new session so we can continue the current task.
Likely tools:
memory_bootstrap_session
First confirm which repository and project this working directory belongs to, then start a new memory-backed session.
Likely tools:
memory_resolve_scopememory_start_session
This is likely to matter again later. Save it as a durable memory note with high importance and include the relevant files.
Likely tools:
memory_save_note
This bug's root cause and fix may be useful again later. Save a durable note with the summary and the touched files.
Likely tools:
memory_save_note
Before stopping, save a handoff that summarizes what was done, what should happen next, what is still unresolved, and which files were changed.
Likely tools:
memory_save_handoff
Save a checkpoint for this task so I can resume from the current state later.
Likely tools:
memory_save_handoff
This should be saved only as a durable note for future reuse. Do not also write a handoff.
Likely tools:
memory_save_note
This should be saved only as a handoff for task continuation. Do not also write a durable note.
Likely tools:
memory_save_handoff
Search prior notes and handoffs related to HTTP MCP transport, origin checks, or remote deployment.
Likely tools:
memory_search
I am working in project A, and this task depends on project B. Search for prior notes or handoffs from project B that are relevant to the current task, and clearly label which results come from project B.
Likely tools:
memory_search
Before we continue, show the most recent notes and handoffs for this repository.
Likely tools:
memory_get_recent
Recover prior context for the current A repository. This task depends on project B as well, so also load relevant memory from project B and clearly label which items come from project B.
Likely tools:
memory_bootstrap_session
Load the full content of this saved memory record for me.
Likely tools:
memory_get_note
Install the recommended AGENTS.md guidance for this repository in safe mode.
Likely tools:
memory_install_agents
Prompts work better when they include one or more of these signals:
durablesave to memoryhandoffresume laterrecover prior contextsearch memoryrecent notes
These are more ambiguous and may not reliably cause Codex to use memory:
remember thiskeep this in mindnote this somewhere
If durable memory matters, say that explicitly:
save this as a durable recordplease save a handoffplease recover prior context for this repository first