The package already creates project-specific Codex buffers, but these buffers are currently treated mostly as an implementation detail. It would be useful to expose them as explicit “sessions”, allowing users to list, switch, kill, and optionally create named Codex sessions.
A session can initially be defined simply as:
one Codex buffer + one running Codex process + its conversation state
When working on the same project, it is common to use Codex for different parallel tasks: reviewing a diff, writing tests, explaining an error, preparing a commit message, or working on a refactor.
Using a single Codex buffer per project can make the conversation noisy and mix unrelated contexts. Explicit sessions would make it easier to keep different tasks separated while staying inside Emacs.
For example:
*codex:ultra:review*
*codex:ultra:tests*
*codex:ultra:refactor*
*codex:ultra:commit*
Each buffer would represent a separate Codex conversation.
Proposed features
Add a small set of session-management commands:
my-codex-list-sessions
my-codex-switch-session
my-codex-kill-session
my-codex-kill-all-sessions
my-codex-start-session
The first implementation could be intentionally simple: sessions are discovered by looking for buffers whose names match the Codex buffer naming convention.
For example:
(defun my-codex-session-buffers ()
"Return all buffers that look like Codex session buffers."
(seq-filter
(lambda (buffer)
(string-match-p "\\`\\*codex:" (buffer-name buffer)))
(buffer-list)))
Named sessions
As a follow-up, my-codex-start-session could optionally ask for a session name:
The resulting buffer name could include the project name, session name, and project hash:
*codex:PROJECT:SESSION:HASH*
This would allow multiple Codex sessions for the same project without changing the current default behaviour.
Suggested implementation steps
- Add helpers to detect existing Codex session buffers.
- Add an interactive command to switch to an existing session.
- Add commands to kill one session or all sessions.
- Extend Codex startup to optionally accept a session name.
- Keep the current one-session-per-project behaviour as the default.
Notes
This should not require a persistent database or a complex session model at first. A buffer-based implementation would already provide most of the value and keep the feature simple to maintain.
The package already creates project-specific Codex buffers, but these buffers are currently treated mostly as an implementation detail. It would be useful to expose them as explicit “sessions”, allowing users to list, switch, kill, and optionally create named Codex sessions.
A session can initially be defined simply as:
When working on the same project, it is common to use Codex for different parallel tasks: reviewing a diff, writing tests, explaining an error, preparing a commit message, or working on a refactor.
Using a single Codex buffer per project can make the conversation noisy and mix unrelated contexts. Explicit sessions would make it easier to keep different tasks separated while staying inside Emacs.
For example:
Each buffer would represent a separate Codex conversation.
Proposed features
Add a small set of session-management commands:
The first implementation could be intentionally simple: sessions are discovered by looking for buffers whose names match the Codex buffer naming convention.
For example:
Named sessions
As a follow-up,
my-codex-start-sessioncould optionally ask for a session name:The resulting buffer name could include the project name, session name, and project hash:
This would allow multiple Codex sessions for the same project without changing the current default behaviour.
Suggested implementation steps
Notes
This should not require a persistent database or a complex session model at first. A buffer-based implementation would already provide most of the value and keep the feature simple to maintain.