Comparing Claude Code, Codex CLI, Gemini CLI, and Aider
All four tools live in the terminal, read code, and make edits. Their differences become clearer after a week or two of real work, especially in how they gather context, handle permissions, and help you recover from a bad edit.
How they gather context
Aider asks you to add files to the session. It builds a repository map and works with the files you provide. This keeps token use predictable and relatively low, provided you already know which files matter.
Claude Code and Codex CLI explore the project themselves. They search the repository, read files, and browse directories to work out what they need. That helps in an unfamiliar codebase. The initial exploration also costs time and tokens, even when the eventual change is only one line.
Gemini CLI leans on a large context window, so it can take in more complete files at once. Once a project exceeds that window, it faces the same problem of selecting the relevant parts.
How they apply edits
- Aider automatically records edits in Git, with a separate commit for each change. You can undo an edit with
git revert, and the history is already there when you need it. - Claude Code edits files in the working directory and commits when you ask. You control what goes into each commit, and uncommitted changes can accumulate.
- Codex CLI runs in a sandbox by default and shows a diff for approval.
Permissions and safety
All four can run shell commands. The permission models vary from manual approval for actions to prompts only for writes, network-restricted sandboxes, and allowlists that you maintain yourself.
Commit work you want to keep before granting broad permissions. The agent focuses on the task it was given and may overwrite uncommitted changes you were planning to keep.
Which one to choose
- You know which files to edit. Aider gives you a straightforward workflow with automatic Git history.
- You are getting to know an unfamiliar project. Claude Code or Codex CLI can find the relevant files themselves.
- You need to work with large files in full. Gemini CLI is worth a look.
These tools change quickly. Whatever you choose, make sure you can see exactly what the agent did and recover if the edit turns out to be wrong.