Add user-controlled, persistent transcript folding to Codex CLI
What variant of Codex are you using?
CLI
What feature would you like to see?
Add reversible, user-controlled transcript folding for any completed user message or assistant response in Codex CLI.
When an assistant response is folded, the committed tool activity associated with that response—such as web searches, commands, MCP calls, patches, and their output—should fold with it. The placeholder should retain a compact summary, including useful details such as tool-call count, related item count, line count, and character count.
The feature should:
- be explicitly user-triggered and never automatically hide transcript content;
- allow any completed user message or assistant response to be folded and expanded independently;
- fold an assistant response together with its associated tool activity;
- support fold-all and expand-all operations;
- persist fold state separately for each thread;
- restore the same fold state after task switching or
codex resume; - keep the normal inline view and the transcript viewer synchronized;
- preserve the complete transcript, model context, and workspace state.
This is a presentation-layer feature. Folding must not delete messages, remove information from the model context, or change any files produced during the task.
Why?
Long-running agent tasks often contain many searches, commands, patches, progress updates, and tool results. This information is valuable when inspecting how Codex performed the work, but it can make it difficult to reread the original requests, decisions, and final answers.
Reversible transcript folding lets users organize a long session without losing its audit trail or creating ambiguity about what the model can still see.
Working prototype
I implemented and tested a working Codex CLI prototype:
https://github.com/wdxhr3/codex-transcript-folding
The prototype currently includes:
TabandShift+Tabnavigation between completed user and assistant messages, with immediate selection feedback;Spaceto fold or expand the selected message;fto fold all messages andShift+Fto expand all messages;- assistant-response folding that also folds its associated tool activity;
- summaries such as
Assistant response collapsed · 3 tool calls · 12 lines · 684 chars · 1 related item; - per-thread fold-state persistence;
- restoration after task switching and
codex resume; - synchronized folded state in the normal view and transcript viewer;
- no automatic folding and no changes to model context or workspace output.
The repository contains source code, automated tests, bilingual documentation, build instructions, and a step-by-step manual verification procedure. The implementation has been built and manually verified with message folding, related tool activity, task switching, and session resume behavior.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗