Codex CLI With JetBrains: Terminal and IDE Options

Codex CLI is a terminal tool that runs in the JetBrains built-in terminal. There is no dedicated JetBrains plugin. Here is how to use the CLI effectively inside JetBrains IDEs and how to keep project context consistent when you switch between the terminal and the editor.

Updated 4 min read

Codex CLI runs wherever your terminal runs, including the embedded terminal in JetBrains IDEs like IntelliJ IDEA, WebStorm, and PyCharm. There is no dedicated Codex CLI plugin for JetBrains at the time of writing. You use the CLI exactly as you would in a standalone terminal, with the IDE open alongside it.

The useful challenge with this setup is keeping context consistent. When Codex CLI edits a file through the terminal and JetBrains has it open in the editor, the IDE picks up the change — but the task context, the decisions behind the change, and the next step exist only in the terminal session. Tools like fenbs keep that task state outside the terminal so the record survives when you switch surfaces.

Running Codex CLI in the JetBrains terminal

JetBrains IDEs include an embedded terminal panel (View > Tool Windows > Terminal, or Alt+F12 on most platforms). This terminal runs a full shell, which means any CLI tool that works in your system terminal works here too. Open the terminal panel, navigate to your project root, and run Codex CLI as you normally would.

The embedded terminal shares your shell environment, including environment variables. If you set an API key with export OPENAI_API_KEY=... in your shell profile, it will be available in the JetBrains terminal. If you set it only in a separate terminal window, it will not.

Using Codex CLI alongside the JetBrains editor

  1. Open the terminal panel at the bottom of the IDE. Use the same project directory you have open in the editor.
  2. Start Codex CLI and give it a task. While it works, the editor above shows your project files. You can switch to the editor to review a file in context without leaving the CLI session.
  3. When Codex CLI writes a file, JetBrains detects the change automatically and shows a prompt to reload. Accept the reload before editing the file yourself; otherwise the IDE's copy and the disk copy will diverge.
  4. Use JetBrains's built-in diff viewer (Ctrl+D or Cmd+D) to review changes after a Codex CLI session. This is often clearer than reading the CLI's output summary.
  5. Commit from the JetBrains git panel or the terminal — whichever you find easier. Both commit the same changes.

JetBrains AI plugins vs Codex CLI

JetBrains offers its own AI assistant integration through the JetBrains AI plugin. This integrates directly into the editor: inline completions, chat in the IDE, and code explanations in context. It is a different product from Codex CLI and uses different underlying models depending on configuration.

The JetBrains AI plugin is tighter with the IDE — it can see the cursor position, the current file, and the selected code. Codex CLI operates at the filesystem level and has broader access to the repository but is not embedded in the editor experience. Both can be useful on the same project; they are not mutually exclusive.

Keeping project instructions consistent across surfaces

When you use multiple tools on the same codebase — Codex CLI in the terminal, the JetBrains AI plugin in the editor, and possibly another assistant for review — keeping the project instructions consistent is what prevents contradictory changes.

The most common problem is that each tool has a different understanding of what "the task" is. Codex CLI has what you told it in the terminal session. The JetBrains AI plugin has what you told it in its chat panel. A separate review session has whatever you explain in that conversation.

How fenbs helps

Keep task state when switching between terminal and editor

Save the current task, accepted decisions, and next step in fenbs before switching tools. Any connected assistant — whether in a terminal or an IDE plugin that supports MCP — reads the same record. The task does not need to be re-explained when you change surfaces. Connect at /integrations.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

What to watch for when Codex CLI and the IDE edit the same file

The JetBrains editor and Codex CLI both write to the same filesystem. If you have a file open and unsaved in the editor while Codex CLI modifies it on disk, JetBrains will ask you to reload. Accept the reload rather than saving your unsaved version on top of the CLI change — you would overwrite what the agent just did.

Similarly, if you make an edit in the IDE while Codex CLI is mid-session, the agent may not be aware of your change. It will have read the file before your edit and may overwrite it with a version that does not include your change. The safer pattern is to let the agent finish its task, review the result, and then make your own edits.

Using a branch for each Codex CLI session helps here. Your manual edits can go on a separate branch or be committed on the same branch before the agent starts. Either way, git tracks both sets of changes, and you can diff and merge them deliberately rather than losing one to the other.

How to do this with fenbs

  1. Create a free account and add a project for the codebase you are working on.
  2. Add tasks with clear plans. The plan is what both the terminal CLI and an IDE assistant read before starting work on a task.
  3. Record accepted design and implementation decisions as Decisions and rules. These apply regardless of which surface or tool handles the next session.
  4. Connect Codex CLI to fenbs at /integrations. Ask it to read project context at the start of each session.
  5. When a session ends — in the terminal or the IDE — save progress in the task. Note what was done, what was checked, and what the next session should start with.

For other Codex CLI interface comparisons, see codex app vs cli vs ide extension. For branch-based session management, see codex cli branch.

Questions people ask.

Is there a Codex CLI plugin for JetBrains?

There is no dedicated Codex CLI plugin for JetBrains at the time of writing. Codex CLI runs in the JetBrains embedded terminal, which provides full shell access. Check the JetBrains Marketplace and OpenAI's documentation for any plugin that may have been released since.

Will Codex CLI conflict with JetBrains's own AI assistant?

They operate independently. Codex CLI reads and writes files through the shell; the JetBrains AI plugin works inside the editor. Both can be used on the same project without conflict, though the two tools may have different understandings of the current task if you do not share context between them.

Can I open Codex CLI output directly in the JetBrains editor?

When Codex CLI creates or edits a file, JetBrains detects the change and the file becomes viewable in the editor immediately. There is no special step to open it; just switch to the editor and navigate to the file.

Does Codex CLI pick up JetBrains project settings?

Codex CLI reads the project directory on the filesystem. It does not read JetBrains project settings or .idea configuration. Any conventions you want the CLI to follow — code style, naming rules, file structure — should be written in a project instructions file or in the project context it reads at the start of a session.

More in Agent harness (for developers)

All Agent harness (for developers) articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.