2025-12-01 11:38:48 -08:00
|
|
|
# Memory tool (`save_memory`)
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
The `save_memory` tool allows the Gemini agent to persist specific facts, user
|
|
|
|
|
preferences, and project details across sessions.
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
## Technical reference
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
This tool appends information to the `## Gemini Added Memories` section of your
|
|
|
|
|
global `GEMINI.md` file (typically located at `~/.gemini/GEMINI.md`).
|
2025-06-24 15:31:58 -07:00
|
|
|
|
|
|
|
|
### Arguments
|
|
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
- `fact` (string, required): A clear, self-contained statement in natural
|
2025-10-09 08:17:37 -04:00
|
|
|
language.
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
## Technical behavior
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
- **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.
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
## Use cases
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
- Persisting user preferences (for example, "I prefer functional programming").
|
|
|
|
|
- Saving project-wide architectural decisions.
|
|
|
|
|
- Storing frequently used aliases or system configurations.
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
## Next steps
|
2025-06-24 15:31:58 -07:00
|
|
|
|
2026-02-13 14:09:17 -08:00
|
|
|
- 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.
|