archive2025

Gemini CLI and Claude Code on the same small task

I gave the same small Python task to Gemini CLI and Claude Code. Notes on setup, context files, permission prompts, sandboxing, how each handled a failing test, and what each costs as of August 2025.

6 min read#agent#llm#dev

Google released Gemini CLI on 25 June 2025. It is an open source (Apache 2.0) agent for the terminal, very close in idea to Claude Code, which I have used since the preview (first notes here). I wanted to know if I should switch, or use both. So I gave both tools the same small task in the same repository and compared what happened.

This is one task on one small repo. It says something about how the tools feel to use. It says little about which model is “smarter”.

The task

The repository is the small Python app for HygroMonitor, my SHT31 sensor project. It has a command that exports readings from a local SQLite file to CSV. The task:

Add a --since option to the export command. It accepts an ISO date or a relative value like 7d or 12h. Only rows newer than that are exported. Add tests for both formats and for an invalid value. Do not change existing tests. Run pytest and make it pass.

It is a good task for an agent: small, clear, and there is a check at the end. Before each run I committed, so I could compare git diff and reset with git checkout . && git clean -fd.

Setup

Both are npm packages and need Node.js:

npm install -g @google/gemini-cli
gemini

npm install -g @anthropic-ai/claude-code
claude

Gemini CLI asks you to log in. With a personal Google account you get the free tier (more on that below). You can also use a Gemini API key or Vertex AI. Claude Code logs in with an Anthropic account, either a Claude subscription or API billing.

Both started without problems on my Mac. Nothing to say here, which is good.

Context files: GEMINI.md and CLAUDE.md

Both read a Markdown file with project instructions at the start of a session. Claude Code reads CLAUDE.md, Gemini CLI reads GEMINI.md. Both also support a global file in the home directory (~/.claude/CLAUDE.md and ~/.gemini/GEMINI.md) and files in subdirectories.

The content I want in them is the same: how to run tests, the Python version, “no new dependencies without asking”. I did not want two copies, so GEMINI.md is just a copy of CLAUDE.md for now. Gemini CLI has a setting to use a different file name for the context file, which I have not tried yet. A symlink also works.

/memory show in Gemini CLI prints the combined context it loaded. I found this useful to check that the right files were picked up. In Claude Code, /memory opens the memory files in an editor.

Permission prompts

By default both tools ask before they write a file or run a shell command. The prompts look similar: allow once, allow always for this kind of action, or no.

Differences I noticed:

  • Claude Code has allow and deny rules in .claude/settings.json, for example to allow pytest without asking and to deny git push. Shift+Tab switches to auto-accept for edits, and to plan mode, where it only reads and proposes a plan. I use plan mode a lot for anything bigger than this task.
  • Gemini CLI has --yolo, which approves all tool calls. There is also --checkpointing: it saves a snapshot of the project before file changes, and /restore goes back. Claude Code has no built-in undo like this today, so there I depend on git.

In this task I approved every edit by hand in both tools, so I could see the steps.

Sandboxing

This is the clearest difference.

Gemini CLI has a sandbox option built in. With gemini -s (or --sandbox), tools run either in a Docker or Podman container, or on macOS with Seatbelt (sandbox-exec). The default Seatbelt profile limits writes to the project directory. I tried the macOS profile. It worked for pytest without any extra setup, which I did not expect.

Claude Code has no sandbox mode of its own at the moment. The documentation describes a development container setup, and --dangerously-skip-permissions is meant only for an isolated environment like that. For my own work I keep the permission prompts on and run it on the host.

If you want to let an agent run without prompts, Gemini CLI makes the safe way easier right now.

How each handled the failing test

Both wrote a parser for 7d / 12h, changed the SQL query, and added tests. Both first had a failing test, and the reason was the same: time zones. The readings in the database are stored in UTC, and the relative value was computed from local time.

Claude Code ran pytest, read the failure, and said that the stored timestamps are UTC and the comparison was naive local time. It changed the code to use datetime.now(timezone.utc). The tests passed on the next run.

Gemini CLI also ran pytest and read the failure. Its first fix changed the expected value in the new test, not the code. The test was its own new test, so this did not break my rule, but it was the wrong fix: the test now matched the bug. When I said that the database stores UTC, it fixed the code and reverted the test change.

I would not draw a general conclusion from one case. I have seen Claude Code do the same kind of thing before. The lesson for both is the same as in my older notes: say in the task what must not change, and read the test diff first.

Output quality

After the fixes, both diffs were fine and similar in size. Small differences:

  • Claude Code put the parsing in a separate function with a docstring and reused the existing error style of the CLI. Gemini CLI wrote the parsing inline in the command first, and moved it out when I asked.
  • Gemini CLI’s tests were a bit more thorough. It added a case for an uppercase unit (7D) that I had not thought about.
  • Both updated the --help text. Neither updated the README. I had not asked, so that is fair.

I would merge either result after a normal review.

Cost and limits, as of August 2025

Gemini CLI: with a personal Google account, the free tier allows 60 model requests per minute and 1,000 per day, using Gemini 2.5 Pro with its one million token context window. For personal projects, that is a lot. With an API key you pay by usage instead.

Claude Code: there is no free tier. It is included in the Claude Pro ($20 per month) and Max ($100 or $200 per month) plans, with usage limits that reset every five hours, or you pay per token through the API. Anthropic announced at the end of July that weekly limits will be added on top for Pro and Max from 28 August. They said this will affect only a small share of users. I have not hit a limit with my usage so far, but I do not run long sessions.

For someone who wants to try a terminal agent without paying, Gemini CLI is the obvious start.

What I will do

For now I keep Claude Code as my main tool. I am used to it, the permission rules and plan mode fit how I work, and in this task its first fix was the right one. I will keep Gemini CLI installed for two cases: tasks where I want to run without prompts inside its sandbox, and questions over a large codebase where the free tier and the long context help.