记忆工具 (save_memory)
¥Memory Tool (save_memory)
本文档描述了save_memoryGemini CLI 的工具。
¥This document describes the save_memory tool for the Gemini CLI.
描述
¥Description
使用save_memory保存和调用 Gemini CLI 会话中的信息。使用save_memory,您可以指示 CLI 记住会话中的关键细节,提供个性化和定向的帮助。
¥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.
参数
¥Arguments
save_memory接受一个参数:
¥save_memory takes one argument:
fact(字符串,必需):需要记住的具体事实或信息。这应该是用自然语言写成的清晰、自洽的陈述。¥
fact(string, required): The specific fact or piece of information to remember. This should be a clear, self-contained statement written in natural language.
如何使用save_memory使用 Gemini CLI
¥How to use save_memory with the Gemini CLI
该工具附加提供的fact到特别GEMINI.md位于用户主目录中的文件(~/.gemini/GEMINI.md)。此文件可以配置为具有不同的名称。
¥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.
一旦添加,事实就会存储在## Gemini Added Memories部分。此文件在后续会话中将作为上下文加载,从而允许 CLI 调用已保存的信息。
¥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.
用法:
¥Usage:
save_memory(fact="Your fact here.")
save_memory示例
¥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.
记忆文件:内存文件是纯文本 Markdown 文件,因此您可以根据需要手动查看和编辑它。
¥Memory file: The memory file is a plain text Markdown file, so you can view and edit it manually if needed.