跳到正文
DEV Community· Gabriel Anhaia·· 3 小時前AI 評分67

Claude Code、Codex、Gemini CLI 和 OpenCode 的 9 類常用指令對照:「/compact」還是「/compress」?

/compact or /compress? 9 Agent Commands in Claude Code, Codex, Gemini CLI and OpenCode

AI 導讀

作者整理 Claude Code、Codex CLI、Gemini CLI 和 OpenCode 的 9 類常用工作指令,逐項對照指令名稱及沒有內置指令的項目。

正文

Your Gemini CLI session is getting long, so you type /compact. Gemini CLI has no /compact. Its command is /compress, and the docs describe it in one line: "Replace the entire chat context with a summary." Claude Code, Codex CLI and OpenCode all call it /compact.

That's one mismatch. Run more than one coding agent and you hit them all week. /clear resets the conversation in one tool and also wipes the screen in another. /review reviews code in two tools and is missing from a third, and /stats opens a different screen in each agent that has it.

The cheat sheet below covers nine everyday jobs across four agents, with the real command name in each cell. Every cell comes from the vendor's own docs as of October 15, 2026. "No command" means the current docs list no built-in slash command for that job. The tool may still show that information somewhere else on screen.

The table: 9 jobs, 4 agents

Sources: Claude Code's commands reference, Codex CLI's command docs, Gemini CLI's commands reference and OpenCode's TUI docs. Aliases are in brackets.

Job Claude Code Codex CLI Gemini CLI OpenCode
Switch model /model /model /model /models
Plan before acting /plan /plan /plan Tab to the Plan agent
Compact context /compact /compact /compress /compact (/summarize)
See context use /context /status no command no command
Start fresh /clear (/new, /reset) /new or /clear /clear /new (/clear)
Resume a session /resume (/continue) /resume /resume (/chat) /sessions (/resume, /continue)
Show the diff /diff /diff no command no command
Review changes /code-review (/review) /review no command no command
Usage and cost /usage (/cost, /stats) /status, /usage /stats no command (opencode stats in the shell)

A few cells need a footnote. OpenCode has no /plan. Its Plan agent is a separate primary agent that asks before any edit or bash command, and you switch to it with Tab. Gemini CLI's closest documented command for context is /stats model, which shows token counts and quota. OpenCode has no slash command for usage or context. From the shell, opencode stats shows token usage and cost across your sessions.

Four different keys hanging on four hooks, each cut for a different lock but stamped with the same shape
Same job, four names: the command you need depends on which agent is in front of you.

The flags you start with

The same jobs show up again as launch flags, and they differ even more. From each tool's CLI reference (Claude Code, Codex, Gemini CLI, OpenCode):

Job Claude Code Codex CLI Gemini CLI OpenCode
Pick the model --model opus -m <model> -m <model> -m provider/model
Start in plan mode --permission-mode plan none --approval-mode plan --agent plan
Resume the last session -c codex resume --last -r latest -c
Resume a specific one -r <id or name> codex resume <id> -r <index or id> -s <id>

The resume row is the one people mistype most, because Codex makes it a subcommand while the other three use a flag:

claude -c              # Claude Code: most recent here
codex resume --last    # Codex CLI: skip the picker
gemini -r latest       # Gemini CLI: most recent session
opencode -c            # OpenCode: continue last session

Codex also has a non-interactive codex review for uncommitted changes, a base branch, or a commit, which is handy in a script.

Where the same name does different things

The cells that look identical are where you get surprised.

  • /model and persistence. In Claude Code, /model switches the model and saves it as your default for new sessions. Press s on a row in the picker to switch for this session only (docs). Gemini CLI's /model set <name> takes an optional --persist flag (docs), so decide whether your switch should outlive the session before you run it.
  • /clear vs /new. Claude Code's /clear starts a new conversation with empty context and keeps project memory. /new is just an alias. In Codex, /new starts a fresh chat in the same CLI session, while /clear also clears the terminal. In Gemini CLI, /clear resets the conversation and the screen, but Ctrl+L only clears the screen and keeps the context.
  • /review. In Claude Code it's an alias of /code-review, which checks the current diff for correctness bugs and takes --fix to apply findings. Before v2.1.223, /review was a separate command that reviewed a GitHub pull request by number, so older write-ups describe that version. Codex's /review asks it to review your working tree. Gemini CLI has no built-in review command.
  • /stats. Claude Code treats it as an alias of /usage that opens on the Stats tab. Gemini CLI's /stats shows session statistics, with model and tools subcommands.
  • Cost. Of these commands, only Claude Code's /usage is documented to show session cost. Codex's /status shows "session configuration and token usage," and /usage shows account token usage. Gemini's /stats model shows tokens and quota. None of those three commands is documented to give you a dollar figure.
  • /plan while busy. Codex says plainly that "while Codex is already working, /plan is temporarily unavailable." Wait for the turn to finish.

One more that catches people setting up a repo: /init exists in all four, and it writes a different file in each. Claude Code writes CLAUDE.md, Codex and OpenCode write AGENTS.md, and Gemini CLI writes GEMINI.md.

A note on Gemini CLI itself: its docs say that for unpaid-tier and Google One users, "Gemini CLI was replaced by Antigravity CLI on June 18th, 2026" (CLI reference). The banner names only those two groups. If you moved to Antigravity, its commands aren't in this table.

One bar for every agent: Hermes IDE 2.3.4

I build Hermes IDE, so weigh this section with that in mind. Hermes runs each agent's own interface in a real terminal, so every command in the table above still works exactly as the vendor documents it. Hermes doesn't rename them.

What 2.3.4, released October 15, 2026, changes is the bar above each session. Per the release notes, it "now works the same way for every agent, including Antigravity, OpenCode and Kiro: Model, Plan and Review are always in the same place, and you can pin the ones you use." You click Plan above a Codex session in the same spot you click it above a Claude Code one, and you stop guessing which name this agent uses.

The action bar above a Claude Code session in Hermes IDE 2.3.4, with Prompts, Context, Model, Plan, Review and the Commands list open showing pinned items and built-in commands such as Compact, Usage and Diff
Hermes IDE 2.3.4: the bar above a Claude Code session, with the Commands list open. Context, Model, Plan and Review are pinned, followed by built-in commands such as Compact, Usage and Diff.

The Commands list also includes your own commands and skills, each with a short description, plus the ones you used recently. Custom commands are where the naming problem gets worse, because every team invents its own, so seeing a description next to each name helps. The release notes also say command lists match each agent's current version.

Two safety details from the same release. Clicking a command never touches what you were typing, and it only runs when the agent is waiting. Starting a new chat, resetting or signing out asks first and says what you lose, which matters given how differently /clear behaves across tools.

There's also a context meter that shows how full the conversation is and offers Compact when it gets close to full, so you can compact from the bar without remembering this agent's word for it.

A Claude Code session in Hermes after pressing the Context chip, showing Claude Code's /context breakdown, per-session context gauges in the sidebar and a status strip with token total and estimated cost
After pressing the Context chip: Claude Code's own /context breakdown (44.4k of 1M tokens, 4%), context gauges per session in the sidebar, and the token total and estimated cost in the status strip.

If you use one agent all day, its own command menu (Claude Code's / filter is good at matching aliases) may be all you need. Hermes is free, source-available under BSL 1.1, and runs on macOS, Windows and Linux. It isn't affiliated with Nous Research, Anthropic, OpenAI, Google or any other agent vendor. Download it or read the source on GitHub.

Keep the table, check the version

Commands move. Claude Code's /review changed meaning at v2.1.223, and Gemini CLI's audience changed in June. Before you trust any cheat sheet, including this one, open the command list your installed agent shows and read that. In Claude Code, typing / lists the commands available to you, aliases included.

Which mismatch has bitten you the most? Tell me in the comments.


If this was useful

/usage and /status tell you what one session of your own cost in tokens or dollars. When the same models run inside a product you ship, you need that number per request, with traces showing which call burned it and evals that catch a quality drop after a model switch. That's what Observability for LLM Applications covers. If you'd rather keep your agents in one window, Hermes IDE is free on macOS, Windows and Linux.

Observability for LLM Applications — the book

來源:DEV Community · dev.to