CodePanel

GEMINI.md for an agent-to-agent review loop

What Gemini CLI loads from GEMINI.md, why it skips AGENTS.md by default, and three ways to give it the same review instructions as every other agent.

Updated

GEMINI.md is the context file Gemini CLI loads before it works: Markdown instructions it concatenates from every file it finds and sends with each prompt. It does not read AGENTS.md unless a setting names it, so a repository whose review loop lives in AGENTS.md gives Gemini CLI none of it. Point GEMINI.md at AGENTS.md rather than keeping a second copy.

What Gemini CLI loads

Gemini CLI's docs list three places, all concatenated, in this order:

Where When
~/.gemini/GEMINI.md Every session, in every project
GEMINI.md in the workspace directories and their parents At startup
GEMINI.md in a directory a tool touches, and its parents up to a trusted root When the tool runs

The file name is a setting, context.fileName, which takes a list such as ["AGENTS.md", "GEMINI.md"]. Without it, only GEMINI.md counts. GEMINI.md can also import another file with an @path line.

Run with --debug, Gemini CLI logs each file it loads, before any model call, so the loading can be checked without a valid key (GEMINI_API_KEY=invalid here). In CodePanel's own repository, which has AGENTS.md and CLAUDE.md but no GEMINI.md, Gemini CLI 0.64.0 searched the root and loaded nothing.

One file for every agent

Three ways to give Gemini CLI the AGENTS.md text, each run with Gemini CLI 0.64.0 in a repository holding AGENTS.md:

Setup What Gemini CLI loaded
.gemini/settings.json with "context": { "fileName": ["AGENTS.md", "GEMINI.md"] } AGENTS.md and GEMINI.md, both
The same setting, with GEMINI.md a symlink to AGENTS.md AGENTS.md once, skipping GEMINI.md as the same file
GEMINI.md holding one line, @AGENTS.md, and no setting GEMINI.md with AGENTS.md's text imported into it

The setting is the cleanest when nothing is Gemini-specific. It lives in the project's .gemini/settings.json, which Gemini CLI ignores in a folder it doesn't trust, so whoever runs it there has to trust the folder first.

The import line works without the setting, and leaves room under it for anything only Gemini needs.

GitHub Copilot CLI reads GEMINI.md too, and the choice matters to it. Its copilot instruction list command showed a symlinked GEMINI.md and AGENTS.md as one source. Given the @AGENTS.md file instead, it listed AGENTS.md and GEMINI.md separately, and its docs say it doesn't expand @ references in GEMINI.md. Copilot then reads the loop once, from AGENTS.md, plus a stray @AGENTS.md line.

Trust decides whether anything loads

In a folder it doesn't trust, Gemini CLI ignores the project's .gemini/settings.json, so a context.fileName set there does nothing, and connects no MCP server, CodePanel's included (trusted folders). A headless run there stops before it starts:

Gemini CLI is not running in a trusted directory. To proceed, either use `--skip-trust`, set the `GEMINI_CLI_TRUST_WORKSPACE=true` environment variable, or trust this directory in interactive mode.

With --skip-trust, the same run loaded GEMINI.md. In CI, pass it or set the variable only for a repository whose code you trust: trusting the folder also loads its .gemini/settings.json, its .env files and its MCP servers. The MCP side of this is in Other MCP clients.

The review section

What goes in the section is the same for every agent, and AGENTS.md covers it. One line differs: the agent name on each /feedback line. Gemini CLI's MCP client calls itself gemini-cli-mcp-client, so ratings sent through rate_finding carry that name unless the agent passes one. Have the section say --agent gemini-cli, and pass agent: "gemini-cli" to rate_finding, so every rating carries the same name whichever way it was sent.

Agents that read GEMINI.md

Read next