Codex Layer
Table of ContentsClose
1. Description
This layer adds support for Codex IDE, an Emacs package that provides seamless integration with the OpenAI Codex CLI for AI-assisted coding.
1.1. Features:
- AI-powered code editing and generation using Codex
- Native integration with the
codex app-server(no terminal wrapper) - Syntax-highlighted code blocks rendered with Emacs major modes
- Diff rendering with a canonical session diff buffer
- Clickable file and code references that jump to real buffers
- Interactive in-buffer approval review flow
- Expandable/collapsible transcript detail
- Multi-project session management
- Resume and continue conversations
- Send prompts and images for analysis
- Project-aware context handling
2. Install
To use this configuration layer, add it to your ~/.spacemacs. You will need to
add codex to the existing dotspacemacs-configuration-layers list in this file.
You will also need to install the Codex CLI tool. For more information, please check the OpenAI Codex documentation.
# Install the Codex CLI (e.g. via npm)
npm install -g @openai/codex
Ensure the codex command works in your terminal before using this layer.
3. Configuration
Before using this layer, ensure the codex command works in your terminal.
The package supports various customization options. You can configure the options in your Spacemacs configuration:
(setq-default dotspacemacs-configuration-layers
'((codex :variables
codex-ide-model "gpt-5.2"
codex-ide-reasoning-effort "high"
codex-ide-fast "off")))
For the full options, please refer the Codex IDE configuration section on its project page.
4. Usage
This layer provides comprehensive integration with Codex through Emacs. The main
entry point is the transient menu accessible via SPC $ x y.
Basic workflow:
- Open your project in Spacemacs
- Use
SPC $ x yto open the Codex transient menu - Start a Codex session with
SPC $ x s - Send prompts with
SPC $ x por use helper functions - Continue conversations with
SPC $ x cor reset withSPC $ x r
The layer includes helpful functions for common tasks:
- Ask questions about symbols at point
5. Key bindings
5.2. Session Management
| Key binding | Description |
|---|---|
SPC $ x s |
Start Codex for current project |
SPC $ x c |
Continue Codex for current project |
SPC $ x r |
Reset the current session |
SPC $ x l |
Manage and list sessions |
SPC $ x q |
Stop Codex for current project |
SPC $ x b |
Switch to Codex session buffer |
5.4. Interaction
| Key binding | Description |
|---|---|
SPC $ x p |
Send prompt to Codex from minibuffer |
SPC $ x i |
Attach an image file |
SPC $ x I |
Attach clipboard image |
5.5. Manage
| Key binding | Description |
|---|---|
SPC $ x L |
List live session buffers |
SPC $ x D |
Open session diff buffer |
5.6. Debug Commands
| Key binding | Description |
|---|---|
SPC $ x d |
Open the debug menu |
SPC $ x d s |
Check Codex CLI status |
SPC $ x d v |
Show debug info |
5.7. Assistant Functions
| Key binding | Description |
|---|---|
SPC $ x * |
Ask question about symbol at point |