---
title: "GEMINI.md (Gemini CLI)：路径和格式 · DotsAgent"
description: "GEMINI.md 的存放位置、格式和 front matter，全局副本与嵌套副本的合并方式，以及哪些工具会读取它。核验日期：2026-10-01。"
url: https://dotsagent.io/zh/instructions/files/gemini-md
---

GEMINI.md

# GEMINI.md (Gemini CLI)：存放位置及工具读取方式

GEMINI.md 是 Gemini CLI 随每个 prompt 一同发送的上下文文件。它也可以读取 AGENTS.md，或通过 context.fileName 设置的其他文件名。

## 存放位置

- 全局：~/.gemini/GEMINI.md。
- 工作区目录及其父目录中的 GEMINI.md。
- 工具访问目录中按需发现的 GEMINI.md，以及这些目录向上直到可信根目录的祖先目录中的文件。

## 格式

使用 Markdown，不支持 frontmatter。通过 Memory Import Processor 使用 @file.md 引入其他文件，路径可以是相对路径或绝对路径。可通过 context.fileName 配置文件名，值可以是字符串或列表。

`GEMINI.md`

```
# Project context

@./docs/architecture.md

## Commands

- Install: `uv sync`
- Test: `uv run pytest`
- Lint: `uv run ruff check .`

## Rules

- Target Python 3.13 with type hints on public functions.
- Keep database code in app/db/.
- Never run migrations against production.
```

## 优先级与合并

文件按以下顺序加载：全局文件、工作区及祖先目录中的文件，然后是按需发现的文件。所有文件都会串联起来，并随每个 prompt 一同发送，因此不会相互覆盖。

## 可读取该文件的工具

| 工具 | 支持情况 |
| --- | --- |
| [Gemini CLI](https://geminicli.com/docs/cli/gemini-md/) | 原生支持。通过 context.fileName 重命名文件或添加 AGENTS.md；使用 /memory show 和 /memory reload 检查文件。 |
| [GitHub Copilot](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions) | 将根目录中的 GEMINI.md 作为 Agent 指令读取，可替代 AGENTS.md。 |

## 提示

- 在 .gemini/settings.json 中将 context.fileName 设为 ["AGENTS.md", "GEMINI.md"]，即可与其他 Agent 共用一个文件。
- 每个已加载文件都会随每个 prompt 一同发送，因此请删减模型无需每次读取的内容。
- 使用 /memory show 查看 Gemini CLI 实际加载的内容，编辑后使用 /memory reload 重新加载。

通过一个表单，为五种工具生成 AGENTS.md 和对应的规则文件。 [打开 AGENTS.md 生成器 →](https://dotsagent.io/zh/instructions)

## 其他指令文件

[AGENTS.md](https://dotsagent.io/zh/instructions/files/agents-md)

[CLAUDE.md](https://dotsagent.io/zh/instructions/files/claude-md)

[.cursor/rules/*.mdc](https://dotsagent.io/zh/instructions/files/cursor-rules)

[.github/copilot-instructions.md](https://dotsagent.io/zh/instructions/files/github-copilot-instructions)

[.devin/rules/*.md](https://dotsagent.io/zh/instructions/files/windsurf-rules)

[.clinerules/](https://dotsagent.io/zh/instructions/files/cline-rules)

[~/.openclaw/workspace/AGENTS.md](https://dotsagent.io/zh/instructions/files/openclaw-workspace)

## 来源

1. [geminicli.com](https://geminicli.com/docs/cli/gemini-md/)/docs/cli/gemini-md/

为 AI agent 开发者提供的独立参考资料。与此处提及的任何厂商均无关联。

© 2026 DotsAgent · 事实核查日期：2026年10月1日
