gemini

A setup guide for connecting Code Context Engine to Gemini CLI, Google's command-line coding agent. It explains the settings and instruction files needed, and how to check that searches and token-saving measurements are working.

In plain words
What is it for?
Use it to configure Gemini, verify context searches, measure token savings, and recall project decisions shared between Gemini CLI and Claude Code.
Why use it?
It helps Gemini find focused code context instead of reading files directly and can share project decisions with Claude Code. This reduces repeated exploration across agent sessions.

Agent

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 agents/elara-labs/code-context-engine/gemini
Clone the repo
git clone --depth 1 https://github.com/elara-labs/code-context-engine
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 435 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.00009 $0.00435
Opus 5 $0.00005 $0.00217
Sonnet 5 $0.00002 $0.00087
Haiku 4.5 $0.00001 $0.00044

Measured yesterday against content hash 02438eea0277, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gemini 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 yesterday.

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.

docs-src/src/content/docs/agents/gemini.md · 65 lines

What it actually says

CCE integrates with the Gemini CLI through its settings file and an instruction file.

Quick setup

cce init              # Auto-detects Gemini CLI if .gemini/ or GEMINI.md exists
cce init --agent all  # Explicitly includes Gemini

Files created

.gemini/settings.json

Registers the CCE MCP server for Gemini CLI.

{
  "mcpServers": {
    "context-engine": {
      "command": "cce",
      "args": ["serve", "--project-dir", "/path/to/your/project"]
    }
  }
}

GEMINI.md

Contains instructions for Gemini to prefer context_search over reading files directly. The CCE block is wrapped in markers so your own content is preserved.

Verify it's working

  1. After cce init, start a new Gemini CLI session in your project directory
  2. Ask a code question:
What's the main entry point of this project?
  1. Check the tool output for context_search calls
  2. Run cce savings to see token savings

Cross-agent memory

If you use both Gemini CLI and Claude Code on the same project, decisions recorded in one session are available to the other via session_recall. Memory is stored per-project in memory.db, not per-agent.

Troubleshooting

Gemini doesn't use context_search

Check that GEMINI.md exists and contains the CCE instructions block. Gemini CLI reads this file at session start. If missing, re-run cce init.

"cce: command not found"

Gemini CLI inherits PATH from your shell. Ensure ~/.local/bin is in your PATH if you installed with uv tool install.

Auto-detection doesn't find Gemini

CCE looks for .gemini/ directory or GEMINI.md in the project root. If neither exists, use cce init --agent all to force configuration.

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. yesterday First seen · 65 lines · 9 tokens per session scan A 02438eea0277

Subscribe to this mod's changes

gemini is an agent published in the GitHub repository elara-labs/code-context-engine (407 stars, last pushed 8d ago), licensed MIT. It adds 9 tokens to every session and 435 once invoked, about $0.0000 per session on Opus 5. 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.