Skip to content

Menu

Antigravity

GEMINI.md project context

Turn repository constraints, run instructions, and validation requirements into project guidance that Antigravity CLI and Gemini CLI can read.

min read
13
Level
Intermediate
Last verified

GEMINI.md is a set of project instructions for a terminal agent. It explains what the repository is, which paths the agent may change, how to validate its work, and when it must stop and ask a person. It is neither a copy of the README nor a repository encyclopedia that stuffs every document into context.

As of 2026-11-24, Antigravity CLI—and Gemini CLI when used under an active existing enterprise contract—can read GEMINI.md. The latter is being phased out for those subscriptions and should not be the default for new projects. The official migration documentation says existing workspace GEMINI.md and AGENTS.md files do not need to be rewritten for migration. However, discovery details differ between the clients, so the most reliable cross-client approach is to place shared constraints at the repository root and inspect the loaded result in the actual client.

Antigravity treats GEMINI.md as a continuously active rule; the file itself does not use YAML frontmatter. Starting from the workspace directory where you launch agy, it reads upward through the repository root. It does not automatically scan a subdirectory’s GEMINI.md simply because the agent later accesses that directory. If you launch from services/api/, it checks that directory and each parent through the repository root. If you launch from the repository root, do not assume src/routes/GEMINI.md will take effect automatically.

The official Gemini CLI page also documents global, workspace, and on-demand discovery levels, and /memory show displays the merged context. Because Gemini CLI no longer serves requests for the affected personal accounts, those users should move to Antigravity. Do not make new team rules depend only on the legacy CLI’s on-demand subdirectory behavior.

Content Recommended location Why
Repository-wide invariants Root-level GEMINI.md Most reliably read by both CLI paths
Personal preferences across projects Personal global GEMINI.md Keeps them out of the team repository; do not put required team rules here
Antigravity module rules .agents/rules/*.md Can define when they trigger instead of keeping every detail permanently in context
Repeatable multistep workflows .agents/skills/<name>/SKILL.md Loaded when needed rather than placed in the root context

Synthetic repository:

harbor-notes/
├── GEMINI.md
├── package.json
├── src/
└── tests/

Root-level GEMINI.md:

# Harbor Notes
This is a synthetic TypeScript example project.
## Edit boundaries
- Modify only the `src/` or `tests/` files explicitly named by the task.
- Do not edit `generated/` or access paths outside the repository.
- Ask before installing dependencies, deleting files, changing permissions, or making network requests.
## Acceptance criteria
- Run `npm test` after changing code.
- Report the files changed, test results, and unresolved risks.

Minimal validation prompt:

Do not modify files yet. List the three edit boundaries and the acceptance command in the current project rules,
and identify the file each rule comes from. Do not guess if you are uncertain.

The expected output should restate each rule and identify GEMINI.md. If it omits a prohibition, check the launch directory and load status before assigning any write task.

The following project is also synthetic; replace the project name and adapt this synthetic template before using it:

# Project: Harbor Notes
## Purpose and scope
This is an offline Markdown indexer. Source code is in `src/`, and tests are in `tests/`.
`fixtures/` contains synthetic data only; never add real customer documents or personal information.
## Before starting
1. First read the files named by the task and their adjacent tests.
2. If the request conflicts with this file, stop and identify the conflict. Do not expand the scope yourself.
3. Existing workspace changes belong to the user; do not overwrite or revert them.
## Edit rules
- Prefer the smallest relevant change; do not perform unrelated refactoring.
- Do not edit `generated/`, `dist/`, or lockfiles unless the task explicitly requires it.
- Do not add dependencies. If one is truly necessary, first explain the reason, license, and alternatives.
- Do not run deletion, publication, push, or permission-changing commands.
- Always write example tokens as `YOUR_API_KEY`.
## Validation
- Documentation changes: run `npm run check:links`.
- Code changes: run `npm test`.
- If a command fails, retain a complete error summary; do not claim it passed.
## Delivery format
- Lead with the outcome, then list changed files and actual check results.
- Clearly label anything not run, not verified, or blocked.

This file turns “be careful” into observable behavior by specifying directories, commands, stop conditions, and the delivery format. The expected result is not an agent that never makes a mistake. It is the ability to use diffs, command output, and the final report to judge whether the agent followed the rules.

Anti-pattern:

You are an elite engineer. Write the most elegant, professional code and guarantee that it has no bugs.

It contains no repository facts, allowed scope, or validation method, and “guarantee that it has no bugs” is not actionable. Rewrite it as follows:

- Modify only the files named by the task; never overwrite existing user changes.
- After changing TypeScript, run `npm test`. If it fails, report the failing cases and do not write “passed.”
- Ask for confirmation before adding a dependency or deleting a file.
  1. Start a new session and ask the client to restate one distinctive, low-risk rule.
  2. Check the launch directory: Antigravity scans only upward through the repository root.
  3. In the Antigravity App, loaded rules appear in the Customizations section of Project Settings; in an IDE or extension, open Customizations → Rules. The CLI has no equivalent rule-listing command, so verify the launch directory and rule-file paths. Existing Gemini CLI installations can use /memory show, then /memory reload after an edit.
  4. Design a synthetic task that should stop, such as “delete generated/.” A compliant client refuses or asks first rather than executing it.
  5. When rules conflict, record both sources and clarify the more specific rule. Do not infer precedence from file order.

Maintenance checklist and safety boundaries

Section titled “Maintenance checklist and safety boundaries”
  • Include only long-lived rules relevant to most tasks.
  • Commands must actually exist, and platform differences must be documented.
  • Do not include passwords, API keys, cookies, internal tokens, or real personal information.
  • Do not copy large sections of API documentation; use an in-repository file path or a controlled reference instead.
  • Do not treat unverifiable slogans such as “always” or “rewrite everything” as rules.
  • Review rule changes in code review and retest them with synthetic tasks.
  • Update the file when clients migrate, directories move, or test commands change.

If the rules do not load, return to a read-only task and verify the working directory and file location. If the rules are too long or conflict with one another, keep the root-level safety boundaries and acceptance criteria, and move occasionally used multistep workflows into a Skill. Do not paste private configuration or an entire production document into GEMINI.md just to help the agent “know more.”

Next: Turn repeatable workflows into a Skill by following Custom CLI commands. When migrating legacy directories, see Migrate from Gemini CLI to Antigravity CLI. Before connecting external tools, read MCP and plugins.