这份文档真正覆盖什么
记忆文档解释的是会话连续性、已保存上下文和长流程任务应该怎样运作,而不是靠临时重复输入撑起来。
怎么用这页
- 先看右侧目录,直接跳到你当前最关心的小节。
- 如果你只是来解决具体问题,优先读正文里的相关标题,再回站内对应 hub。
- 如果你要核对原始来源,可以直接打开 GitHub 原文链接。
记忆文档解释的是会话连续性、已保存上下文和长流程任务应该怎样运作,而不是靠临时重复输入撑起来。
记忆文档解释的是会话连续性、已保存上下文和长流程任务应该怎样运作,而不是靠临时重复输入撑起来。
The user-memory feature gives the model a small persistent note file that's injected into the system prompt on every turn. It's the place to put preferences and conventions that should survive across sessions — "I prefer pytest over unittest", "this codebase uses 4-space indentation", "always run cargo fmt before committing" — without having to repeat them in every conversation.
Memory is opt-in. When disabled (the default), nothing is loaded, nothing is intercepted, and the remember tool isn't surfaced to the model. This keeps zero-overhead behavior for users who haven't asked for the feature.
Either set the env var:
export DEEPSEEK_MEMORY=on
Accepted truthy values are 1, on, true, yes, y, and enabled.
…or add to ~/.deepseek/config.toml:
[memory]
enabled = true
Restart the TUI after toggling. Disabling is the same in reverse.
The memory file lives at ~/.deepseek/memory.md by default; override with memory_path in config.toml or DEEPSEEK_MEMORY_PATH in the environment. DEEPSEEK_MEMORY_PATH wins over the config file when both are set.
# remember that this repo prefers cargo fmt before commits
/memory
/memory path
/memory edit
/memory help
# remember that this repo prefers cargo fmt before commits in the composer to append a timestamped bullet without firing a turn./memory to confirm where the feature is writing and what is currently stored./memory edit when you want to groom the file manually in your editor.When memory is enabled and the file exists, every turn's system prompt carries an extra block:
<user_memory source="/Users/you/.deepseek/memory.md">
- (2026-05-03 22:14 UTC) prefer pytest over unittest
- (2026-05-03 22:31 UTC) this codebase uses 4-space indentation
…
</user_memory>
The block sits above the volatile-content boundary in the prompt assembly so it stays inside DeepSeek's prefix cache turn-over-turn. The file is read at every prompt-build call — edits via /memory or external editors land on the next turn, no restart needed.
Files larger than 100 KiB are loaded but truncated, with a marker appended so you can see the cut.
# composer prefix (#492)Type a single line that starts with # (but not ## or #!) in the composer:
# remember to use 4-space indentation in this repo
The TUI intercepts the input and appends a timestamped bullet to your memory file. No turn fires — your input is consumed, the status line confirms the path it wrote to, and you can keep typing your real question.
Multi-# prefixes deliberately fall through to normal turn submission so you can paste Markdown headings without surprise.
/memory slash command (#491)Inspect, clear, or get hints about editing the file:
| Subcommand | Effect |
|---|---|
/memory | Show the resolved path and current contents inline |
/memory show | Alias for the no-arg form |
/memory path | Print just the resolved path |
/memory clear | Replace the file with an empty marker |
/memory edit | Print the ${VISUAL:-${EDITOR:-vi}} <path> shell line |
/memory help | Show command-specific help and the current path |
The /memory edit form intentionally just prints the command rather than spawning the editor in-process — that keeps the slash-command handler simple and consistent regardless of which editor you use.
You can also discover the feature from the general help surfaces:
/help memory shows the slash-command summary and usage line./memory help prints the memory-specific subcommands plus the resolved path.remember tool (auto-update, #489)When memory is enabled the model gets a remember tool with this shape:
{
"name": "remember",
"description": "Append a durable note to the user memory file...",
"input_schema": {
"type": "object",
"properties": {
"note": { "type": "string", ... }
},
"required": ["note"]
}
}
The model uses this when it notices a durable preference, convention, or fact worth keeping across sessions. The tool is auto-approved because writes are scoped to the user's own memory file — gating them behind the standard write-approval flow would defeat the point of automatic memory capture.
If the model uses remember for transient task state ("I'm currently editing foo.rs") the result is harmless but wastes context. The tool's description explicitly tells the model not to do that — durable, single-sentence notes only.
Memory is plain Markdown with timestamped bullets:
- (2026-05-03 22:14 UTC) prefer pytest over unittest
- (2026-05-03 22:31 UTC) this codebase uses 4-space indentation
- (2026-05-04 09:02 UTC) all PRs need 2 reviewers before merge
You can hand-edit the file in any editor — the loader doesn't care about the timestamp format; it just reads the whole file as the memory block. The timestamp is convention so you can tell when each note was added when grooming the file.
Memory is intentionally user-scoped rather than repo-scoped. It sits alongside — not inside — project instruction sources such as AGENTS.md, .deepseek/instructions.md, and instructions = [...].
The memory loader currently reads one resolved file path verbatim. @path imports / includes are not supported today; if you need a larger reusable instruction bundle, put it in a project instruction file or a skill instead.
Memory is for durable signal. Things that should NOT live there:
note), not memory.AGENTS.md (project-level) or in a skill (reusable instruction packs).The memory file lives entirely on your machine in ~/.deepseek/. It's never uploaded to any cloud service — the TUI only ever includes it inline in the system prompt that the LLM provider receives, and only when memory is enabled. If you switch providers (DeepSeek / NVIDIA NIM / Fireworks / etc.) the same memory file is used; the file is provider-agnostic.
The file is per-user, not per-project. If you want project-specific memory, use the project-level AGENTS.md or .deepseek/instructions.md files instead — those are loaded by project_context and live in the repo (or wherever you commit them).
# ~/.deepseek/config.toml
[memory]
enabled = true # default false; or set DEEPSEEK_MEMORY=on
# Path is configured at the top-level (next to skills_dir, notes_path):
memory_path = "~/.deepseek/memory.md"
| Setting | Default | Override |
|---|---|---|
| Memory enabled | false | [memory] enabled = true or DEEPSEEK_MEMORY=on |
| Memory file path | ~/.deepseek/memory.md | memory_path = "..." or DEEPSEEK_MEMORY_PATH= |
| Max file size | 100 KiB | (none today; truncation marker shows the cut) |
docs/SUBAGENTS.md — sub-agents inherit memory and can use the remember tool too.docs/CONFIGURATION.md — full config reference.