mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
Docs: Refresh docs to organize and standardize reference materials. (#18403)
This commit is contained in:
+21
-40
@@ -1,54 +1,35 @@
|
||||
# Memory tool (`save_memory`)
|
||||
|
||||
This document describes the `save_memory` tool for the Gemini CLI.
|
||||
The `save_memory` tool allows the Gemini agent to persist specific facts, user
|
||||
preferences, and project details across sessions.
|
||||
|
||||
## Description
|
||||
## Technical reference
|
||||
|
||||
Use `save_memory` to save and recall information across your Gemini CLI
|
||||
sessions. With `save_memory`, you can direct the CLI to remember key details
|
||||
across sessions, providing personalized and directed assistance.
|
||||
This tool appends information to the `## Gemini Added Memories` section of your
|
||||
global `GEMINI.md` file (typically located at `~/.gemini/GEMINI.md`).
|
||||
|
||||
### Arguments
|
||||
|
||||
`save_memory` takes one argument:
|
||||
|
||||
- `fact` (string, required): The specific fact or piece of information to
|
||||
remember. This should be a clear, self-contained statement written in natural
|
||||
- `fact` (string, required): A clear, self-contained statement in natural
|
||||
language.
|
||||
|
||||
## How to use `save_memory` with the Gemini CLI
|
||||
## Technical behavior
|
||||
|
||||
The tool appends the provided `fact` to a special `GEMINI.md` file located in
|
||||
the user's home directory (`~/.gemini/GEMINI.md`). This file can be configured
|
||||
to have a different name.
|
||||
- **Storage:** Appends to the global context file in the user's home directory.
|
||||
- **Loading:** The stored facts are automatically included in the hierarchical
|
||||
context system for all future sessions.
|
||||
- **Format:** Saves data as a bulleted list item within a dedicated Markdown
|
||||
section.
|
||||
|
||||
Once added, the facts are stored under a `## Gemini Added Memories` section.
|
||||
This file is loaded as context in subsequent sessions, allowing the CLI to
|
||||
recall the saved information.
|
||||
## Use cases
|
||||
|
||||
Usage:
|
||||
- Persisting user preferences (for example, "I prefer functional programming").
|
||||
- Saving project-wide architectural decisions.
|
||||
- Storing frequently used aliases or system configurations.
|
||||
|
||||
```
|
||||
save_memory(fact="Your fact here.")
|
||||
```
|
||||
## Next steps
|
||||
|
||||
### `save_memory` examples
|
||||
|
||||
Remember a user preference:
|
||||
|
||||
```
|
||||
save_memory(fact="My preferred programming language is Python.")
|
||||
```
|
||||
|
||||
Store a project-specific detail:
|
||||
|
||||
```
|
||||
save_memory(fact="The project I'm currently working on is called 'gemini-cli'.")
|
||||
```
|
||||
|
||||
## Important notes
|
||||
|
||||
- **General usage:** This tool should be used for concise, important facts. It
|
||||
is not intended for storing large amounts of data or conversational history.
|
||||
- **Memory file:** The memory file is a plain text Markdown file, so you can
|
||||
view and edit it manually if needed.
|
||||
- Follow the [Memory management guide](../cli/tutorials/memory-management.md)
|
||||
for practical examples.
|
||||
- Learn how the [Project context (GEMINI.md)](../cli/gemini-md.md) system loads
|
||||
this information.
|
||||
|
||||
Reference in New Issue
Block a user