Skip to content

Feature Request: Selective context transfer and chat branching from history #28860

Open

Description

@codetonight78

What version of the Codex App are you using (From “About Codex” dialog)?

26.611.62324 • Released 17 june 2026

What subscription do you have?

plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x86_64

What issue are you seeing?

Hello,I am an active user of your AI chat assistant. However, when the context window (token limit) is exhausted during long conversations, I have to start a new chat. I experience a significant loss of efficiency during this transition.The Issue & Feature Request:There is currently no built-in way to transfer only a specific message or a small, relevant part of the conversation history into a new chat session. When I need to continue a conversation based solely on the very last response or a specific snippet, I am forced to manually copy and paste everything.To significantly improve the user experience (UX), I would like to request a feature that allows users to select a specific message from the chat history and either use it to start a new chat branch (thread) or automatically transfer it as context/reference into a new session.Thank you for taking my feedback into consideration. I look forward to hearing from you.

What steps can reproduce the bug?

Steps to Reproduce

  1. Open a new chat session with the AI assistant.
  2. Conduct a long conversation until the context window / token limit is reached or about to expire.
  3. Identify a specific, crucial response (e.g., the last message) that needs to be continued or referenced in a new session.
  4. Attempt to move or branch only that specific message/context into a new chat session without copying and pasting the entire history manually.
  5. Notice that there is no built-in feature or button to selectively transfer this specific context or start a new thread from a past message.

Open an existing chat and identify multiple relevant messages scattered across the conversation.
2. Note that current options like "Side Chat" (side chat) or "New Chat" (new chat) fail to solve the issue:

  • "New Chat" merely pastes the text inside the CURRENT session's input box instead of opening a brand new session.
  • "Side Chat" opens a side panel that still carries over the heavy context/continuation of the ongoing chat.
  1. Try to multi-select specific messages (like choosing multiple messages in WhatsApp) to send them to a completely clean, independent chat room.
  2. Notice that there is no check-box or multi-select tool to isolate these messages and transfer them as a fresh starting context.

What is the expected behavior?

Users should be able to click a button next to any message in the chat history to "Continue in a new chat" or "Transfer context to a new session," carrying over only the relevant snippet instead of losing efficiency through manual copy-pasting.

We need a WhatsApp-like multi-select feature. Users should be able to:

  1. Click and select multiple specific messages from the chat history.
  2. Click a button named "Export Selected to a New Chat Session".
  3. This action should automatically launch a completely fresh, separate chat window and inject only those selected messages as the baseline summary/context, bypassing the exhausted token limit of the old chat.

Additional information

No response

Activity

  1. added
    app
    on Jun 18, 2026
  2. added
    enhancement
    context
    session
    on Jun 18, 2026
  3. starSumi commented on Aug 6, 2026

    @starSumi

    I hit a concrete version of this use case: one thread began with DBeaver troubleshooting, then shifted into a useful knowledge-base design discussion. I wanted a new durable thread containing the later user/assistant Q&A without copying text, regenerating the answers, or retaining the unrelated earlier topic.

    Product value

    Selective transfer would turn archived conversation history into reusable project knowledge. It would reduce manual transcript reconstruction, repeated model generation, context pollution, and avoidable compaction. The important behavior is preserving the selected user messages and existing assistant answers as structured history, not flattening them into one new user prompt or a generated summary.

    Suggested semantic split

    There are two related operations, but they should not have the same agent semantics:

    1. Derive a new thread from selected turns. Copy dependency-safe whole turns from one source thread into a new normal thread. Preserve user messages and final assistant answers, keep the source unchanged, and record source-thread/turn provenance.
    2. Reference selected turns in an existing thread. Append a typed, source-aware context reference rather than pretending the imported messages were native history in the destination thread. This matters because the destination may have different instructions, workspace state, permissions, or tool side effects.

    The first operation is the narrower and safer initial slice.

    Existing Codex primitives and remaining work

    The current app-server already provides most organization and retrieval primitives:

    • thread/name/set lets a user treat a thread as a named topic.
    • threadSection/create, threadSection/update, and thread/section/move provide user-named thread grouping.
    • thread/list can query active or archived threads, so a destination/source picker can expose an Include archived toggle.
    • thread/fork already creates durable child history, but only for a continuous prefix through lastTurnId or before beforeTurnId.
    • thread/inject_items proves that raw Responses API items can be persisted and included in later model requests, but it is too low-level to expose directly as selective transfer.

    The main implementation work is therefore not a new topic database field. It is a safe history-derivation layer that:

    • resolves persisted canonical turn boundaries;
    • rejects in-progress, partial, rolled-back, or unavailable turns;
    • handles legacy and paginated history plus compaction explicitly;
    • preserves user messages and final assistant answers;
    • excludes reasoning, runtime-only context, inter-agent envelopes, and tool call/output items unless a dependency-closed policy explicitly supports them;
    • reloads the destination thread's current instructions and environment context;
    • records provenance without replaying tool calls or side effects.

    There is already a useful policy precedent in codex-rs/core/src/agent/control/spawn.rs: truncated subagent forks retain user messages and final assistant answers while filtering reasoning, tool calls/results, and inter-agent messages. ThreadManager::fork_thread_from_history also accepts prepared InitialHistory, so the core has a natural integration point after selected-turn filtering.

    The relevant source was inspected at commit aac9f842473ac6a05d417dd76ce8b89bdb3b707d, particularly:

    • codex-rs/app-server-protocol/src/protocol/v2/thread.rs
    • codex-rs/app-server/src/request_processors/thread_processor.rs
    • codex-rs/app-server/src/request_processors/turn_processor.rs
    • codex-rs/core/src/thread_rollout_truncation.rs
    • codex-rs/core/src/agent/control/spawn.rs
    • codex-rs/core/src/thread_manager.rs
    • codex-rs/app-server/tests/suite/v2/thread_inject_items.rs

    Would maintainers be open to the first slice as a focused app-server operation: create a new thread from one contiguous range of completed canonical turns, preserving user messages and final assistant answers with provenance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appcontextenhancementsession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions