[Feature] Support for Tree-based Conversation Management (Chat Tree / Branch)

Open 💬 11 comments Opened Feb 21, 2026 by Reekin
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What variant of Codex are you using?

App,CLI

What feature would you like to see?

During conversations with the agent, it is very common to want to roll back the context to a specific previous node.

For example: You might go through several rounds of chatting to finalize the overall development direction for a feature. Then, while developing a specific part, you encounter unexpected behavior and spend multiple rounds providing detailed feedback and fixing bugs. Once that feature is done, you want the chat history to revert to the point before diving into all those bug-fixing details, so you can start working on another related requirement (which still requires the high-level context from the initial conversation).

Without a convenient way to manage context, we are currently forced into one of two bad options:

  1. Continue developing in the original session, which pollutes the context with a massive amount of irrelevant details that subsequent development doesn't care about.
  2. Ask the agent to summarize the first half of the conversation into a file, and then open a new session for the agent to read it. This is highly tedious and very prone to context omission/loss.

Furthermore, considering that in the Codex app, a single session might be bound to a specific worktree (which I personally think is a debatable design choice—I actually believe worktrees should be bound to sub-agents instead), switching sessions introduces a lot of friction. On the other hand, staying in the original session with accumulated "garbage context" leads to frequent context compactions, which severely degrades the agent's execution quality.

To address this, I have designed a solution for convenient context management via a ChatTree and developed a PoC demo.

Below are the PRD and a demonstration video of how it operates:

PRD
Repo

https://github.com/user-attachments/assets/fdc78c1a-b95a-4405-8158-56aa8e139dbd

Additional information

I'd love to hear your thoughts on this pain point and the proposed solution.

View original on GitHub ↗

11 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #11626
  • #11742
  • #11702
  • #11750
  • #11595

Powered by Codex Action

Reekin · 4 months ago
Potential duplicates detected. Please review them and close your issue if it is a duplicate.

While this proposal shares some conceptual overlap with standard rewind or edit history features, there is a fundamental distinction:

My goal is not simply to "modify" past prompts or reset the conversation. Instead, I am proposing a non-linear, multi-branching tree structure.

In a standard "edit" workflow, you usually lose the subsequent messages or create a linear replacement. In contrast, with a Conversation Tree:

  1. Node Switching: You can jump to any historical node at any time.
  2. Context Persistence: If I branch off to work on SubFeature B, but later discover a bug in the implementation of SubFeature A (which was discussed in a different branch), I can seamlessly switch back to the exact node where SubFeature A was being handled.

Therefore, I hope this issue will not be closed as a duplicate of those issues.

ignatremizov · 4 months ago

This exists already?
/fork + /rename each branch
then /resume from named branches

If you want to fork from an earlier message, /fork first (to make a full copy), ctrl+t, esc to user message you want to "branch" from, continue (so you prune the unneeded message in the fork)

Reekin · 4 months ago
This exists already? /fork + /rename each branch then /resume from named branches

Using fork requires you to know in advance where you might need to return to. If you want to go back to a point that wasn't previously forked, you have to manually edit the context and prune it down to that specific spot, which is more tedious than simply selecting a target node and jumping to it.
Furthermore, splitting content centered around the same parent topic into multiple sessions creates a management mess.

seasonsteven · 4 months ago

After my first "oh crap, I actually wanted what I just pruned off" moment, this would be a welcome feature to help go back to a previous branch.

ignatremizov · 4 months ago

@seasonsteven this is why you fork first :) I use ESC and continue when I know for sure it's unneeded history - treat it the same as doing git reset --hard <commit>, and forking as a git branch first

Reekin · 4 months ago
@seasonsteven this is why you fork first :) I use ESC and continue when I know for sure it's unneeded history - treat it the same as doing git reset --hard <commit>, and forking as a git branch first

The point of this issue is not simply "whether this effect can be achieved with existing features," but rather to provide a more seamless and convenient interaction experience that doesn't break the user's flow. Manually forking can roughly achieve the desired result, but it's really not a smooth or intuitive solution.
https://github.com/openai/codex/issues/11086#issuecomment-3998836279
https://stacktoheap.com/blog/2026/02/26/pi-tree-context-window-management/

Reekin · 4 months ago

https://github.com/user-attachments/assets/584aed3b-8f21-4ed3-bdca-5a73e96e6c34

Since Codex App is not open sourced and they doesn't plan to do it, I chose Codex Monitor to integrate the UI because this one behaviors like Codex App and it supports remote from mobile.

These changes are unlikely to be merged to upstream so here are the repos:

https://github.com/Reekin/codex/tree/codex/chat-tree
https://github.com/Reekin/CodexMonitor/tree/feat/chattree-integration

You can tell codex to merge them into your local lastest repo and build them.

ikx94 · 1 month ago

Would love to see this in Codex cli and Codex app

robbiemu · 1 month ago

If not OSS, Can you write "plugins" to extend behavior? like, add your own slash command, this kind of thing? I have a proposal that I made, and shortly thereafter the subagents mechanism was released and it is addressing the same need, so my idea won't get picked up. But I like the ergonomics of my own idea more. I wish I could keep it without needing to constantly sync and recompile

ojingo · 18 days ago

I guess they don't understand why we're jumping to Pi? Tree...