gemini-md

A GEMINI.md rules file that gives the Gemini command-line tool and Google AI tools project-specific context. It can describe coding conventions, project structure, tools, and other instructions loaded into prompts.

In plain words
What is it for?
Use it to define project-wide instructions for coding style, naming, tools, and architecture. It also supports Gemini’s memory command and rules gathered from global, project, and subdirectory files.
Why use it?
AI coding tools otherwise lack important knowledge about a particular project’s preferred practices and architecture. A shared rules file avoids repeating that context in every request.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/gemini-md
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 570 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00570
Opus 5 $0.00000 $0.00285
Sonnet 5 $0.00000 $0.00114
Haiku 4.5 $0.00000 $0.00057

Measured 2d ago against content hash c547ab70145e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gemini-md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules-mdc/ai-tools/gemini-md.mdc · 45 lines

How it starts

The opening of the file, as written. The whole thing — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GEMINI.md Rules

GEMINI.md provides instructional context to the Gemini CLI. It's loaded with every prompt, so instructions defined once apply to every interaction without repeating them.

Discovery Hierarchy

  • Global: ~/.gemini/GEMINI.md — default instructions for all projects
  • Project root and ancestors: Gemini CLI searches for GEMINI.md from your current working directory up through each parent directory to the project root (identified by .git folder)
  • Sub-directory files: Also scans subdirectories below your current working directory. Respects .gitignore and .geminiignore
  • All found files are concatenated and sent with every prompt. The CLI footer shows the number of loaded context files

What Goes In GEMINI.md

  • Coding style: indentation, naming conventions, formatting preferences
  • Project-specific patterns: "prefix interface names with I," "use strict equality," "always add JSDoc comments"
  • Tool preferences: build system, test framework, package manager
  • Architecture context: what the project does, how it's structured, key directories

The /memory Command

  • Use /memory (or /mem) in Gemini CLI to interact with loaded context files
  • View which files are loaded, see their contents, and understand the active context
  • Useful for debugging when instructions aren't being followed — check if the file is actually loaded

Patterns That Work

  • Keep global GEMINI.md minimal — personal style preferences that apply to all your projects
  • Project root GEMINI.md covers stack, conventions, build/test commands
  • Subdirectory GEMINI.md files for component-specific or module-specific instructions
  • Use .geminiignore to prevent scanning directories that don't need context files (build output, node_modules)

Anti-Patterns

  • Don't duplicate information available in project files — Gemini can read your code. GEMINI.md is for behavioral instructions, not documentation
  • Don't make files too long — all files concatenate into one context block. Quality over quantity
  • Don't put secrets or credentials in GEMINI.md — it's a committed file

Read the full file on GitHub · 45 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 45 lines · 0 tokens per session scan A c547ab70145e

Subscribe to this mod's changes

gemini-md is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 570 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.