[FEATURE]: Navigation to parent session from child/subagent sessions #2179

Open
opened 2026-02-16 17:34:33 -05:00 by yindo · 3 comments
Owner

Originally created by @Astn on GitHub (Oct 19, 2025).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

[FEATURE]: Navigation to parent session from child/subagent sessions

Current Behavior

OpenCode currently supports session navigation via keybindings for cycling through child sessions:

  • ctrl+right (session_child_cycle): Cycles forward through child sessions (e.g., subagent sessions spawned via @mentions).
  • ctrl+left (session_cycle_reverse): Cycles backward through child sessions.

These allow switching between sibling child sessions within a parent. However, there is no dedicated keybinding to quickly navigate upward to the parent session from a child/subagent session. Users must rely on alternatives like the session list modal (<leader>l, where leader is ctrl+x by default) to switch back, which interrupts workflow.

Keybindings are customizable via the keybinds section in the config file (e.g., ~/.config/opencode/config.json), but no predefined options exist for parent navigation.

Problem

When working in a subagent/child session (e.g., after delegating a task to a specialized agent), users frequently need to return to the parent session to review context, delegate further, or integrate results. The lack of a direct upward navigation forces less efficient methods, like listing all sessions or interrupting flow. This is especially cumbersome in complex workflows with nested subagents.

Existing cycle keybindings (ctrl+left/right) work well for horizontal navigation among children but don't address vertical (parent/child) hierarchy. Platform-specific conflicts (e.g., #2816 on macOS where ctrl+left/right clashes with OS desktop switching) also suggest any new bindings should consider configurability and alternatives like cmd+ support (#653).

Proposed Solution

Introduce new configurable keybindings for vertical session navigation:

  • session_parent: Navigate to the parent session from a child (suggested default: ctrl+up).
  • session_child_return: Return to the last active child session from the parent (suggested default: ctrl+down), or cycle through children if multiple are active.

This would create an intuitive "up/down" metaphor for hierarchy, complementing the existing "left/right" for siblings. To address potential conflicts:

  • Make them fully customizable in the config, similar to other keybinds.
  • Add support for cmd+ equivalents on macOS (e.g., cmd+up as an alias).
  • Ensure navigation preserves context and fixes integration with existing bugs (e.g., proper message routing after switch, as in #2390).

Alternatives Considered

  • Expand session list modal: Allow quicker selection of parent via a dedicated shortcut in the modal, but this still requires opening the list.
  • Tree-view navigation: A more advanced TUI feature to visualize parent/child relationships, but that's a larger scope—start with simple keybinds. A visual of the session trees could be added later.

Implementation Thoughts

  • Define new actions in the keybinds registry (likely in src/keybinds or similar, based on repo structure).
  • Track session hierarchy in the session manager to enable parent lookup.
  • Test for conflicts with word navigation (#1975, #3090) and ensure compatibility with custom commands (#3161).
  • Since subagents create child sessions automatically, ensure navigation works seamlessly with agent configs.

What do folks think? Any concerns with defaults or better key suggestions?

Originally created by @Astn on GitHub (Oct 19, 2025). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request ### [FEATURE]: Navigation to parent session from child/subagent sessions #### Current Behavior OpenCode currently supports session navigation via keybindings for cycling through child sessions: - `ctrl+right` (session_child_cycle): Cycles forward through child sessions (e.g., subagent sessions spawned via @mentions). - `ctrl+left` (session_cycle_reverse): Cycles backward through child sessions. These allow switching between sibling child sessions within a parent. However, there is no dedicated keybinding to quickly navigate upward to the parent session from a child/subagent session. Users must rely on alternatives like the session list modal (`<leader>l`, where leader is `ctrl+x` by default) to switch back, which interrupts workflow. Keybindings are customizable via the `keybinds` section in the config file (e.g., `~/.config/opencode/config.json`), but no predefined options exist for parent navigation. #### Problem When working in a subagent/child session (e.g., after delegating a task to a specialized agent), users frequently need to return to the parent session to review context, delegate further, or integrate results. The lack of a direct upward navigation forces less efficient methods, like listing all sessions or interrupting flow. This is especially cumbersome in complex workflows with nested subagents. Existing cycle keybindings (`ctrl+left/right`) work well for horizontal navigation among children but don't address vertical (parent/child) hierarchy. Platform-specific conflicts (e.g., #2816 on macOS where `ctrl+left/right` clashes with OS desktop switching) also suggest any new bindings should consider configurability and alternatives like `cmd+` support (#653). #### Proposed Solution Introduce new configurable keybindings for vertical session navigation: - `session_parent`: Navigate to the parent session from a child (suggested default: `ctrl+up`). - `session_child_return`: Return to the last active child session from the parent (suggested default: `ctrl+down`), or cycle through children if multiple are active. This would create an intuitive "up/down" metaphor for hierarchy, complementing the existing "left/right" for siblings. To address potential conflicts: - Make them fully customizable in the config, similar to other keybinds. - Add support for `cmd+` equivalents on macOS (e.g., `cmd+up` as an alias). - Ensure navigation preserves context and fixes integration with existing bugs (e.g., proper message routing after switch, as in #2390). #### Alternatives Considered - Expand session list modal: Allow quicker selection of parent via a dedicated shortcut in the modal, but this still requires opening the list. - Tree-view navigation: A more advanced TUI feature to visualize parent/child relationships, but that's a larger scope—start with simple keybinds. A visual of the session trees could be added later. #### Implementation Thoughts - Define new actions in the keybinds registry (likely in src/keybinds or similar, based on repo structure). - Track session hierarchy in the session manager to enable parent lookup. - Test for conflicts with word navigation (#1975, #3090) and ensure compatibility with custom commands (#3161). - Since subagents create child sessions automatically, ensure navigation works seamlessly with agent configs. What do folks think? Any concerns with defaults or better key suggestions?
Author
Owner

@github-actions[bot] commented on GitHub (Oct 19, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2816: navigate child sessions shortcut: ctrl + left and ctrl + right on mac conflict with OS shortcuts of switching between spaces/desktops - discusses the exact ctrl+left/right keybinding conflicts mentioned in your issue
  • #2390: Switching to a child session doesn't send subsequent messages to that session but to the parent one - addresses the child session message routing bug you referenced
  • #3262: Configure switch session modal keybinds - requests customizable keybinds for session navigation modals
  • #3090: add ctrl+left/right to navigate by word - related to ctrl+left/right keybinding conflicts
  • #3173: Subagent results not always properly handled - discusses issues with subagent session management that relate to your navigation concerns

The combination of these existing issues covers many aspects of your feature request, particularly the keybinding conflicts on macOS (#2816) and the child session navigation problems (#2390).

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 19, 2025): This issue might be a duplicate of existing issues. Please check: - #2816: navigate child sessions shortcut: ctrl + left and ctrl + right on mac conflict with OS shortcuts of switching between spaces/desktops - discusses the exact ctrl+left/right keybinding conflicts mentioned in your issue - #2390: Switching to a child session doesn't send subsequent messages to that session but to the parent one - addresses the child session message routing bug you referenced - #3262: Configure switch session modal keybinds - requests customizable keybinds for session navigation modals - #3090: add ctrl+left/right to navigate by word - related to ctrl+left/right keybinding conflicts - #3173: Subagent results not always properly handled - discusses issues with subagent session management that relate to your navigation concerns The combination of these existing issues covers many aspects of your feature request, particularly the keybinding conflicts on macOS (#2816) and the child session navigation problems (#2390). Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

we are rewriting tui currently and once that ships we can pay more attention to things like this after

@rekram1-node commented on GitHub (Oct 19, 2025): we are rewriting tui currently and once that ships we can pay more attention to things like this after
Author
Owner

@ericwooley commented on GitHub (Nov 15, 2025):

I understand ya'll are possibly circling back to this, so I don't want to overwhelm you all. I just wanted to add on to the feature request.

+1 to tree based navigation. I would love to see a tree based navigation of sessions. Similar to /sessions I would love to see something like /agent_sessions which would bring up a tree view of the agents that ran during this session.

something else to consider though is something like the git log graphs you see. Something like this:

Image

then you could navigate to one by something like /agent_session <session_id>

@ericwooley commented on GitHub (Nov 15, 2025): I understand ya'll are possibly circling back to this, so I don't want to overwhelm you all. I just wanted to add on to the feature request. +1 to tree based navigation. I would love to see a tree based navigation of sessions. Similar to /sessions I would love to see something like /agent_sessions which would bring up a tree view of the agents that ran during this session. something else to consider though is something like the git log graphs you see. Something like this: <img width="600" height="500" alt="Image" src="https://github.com/user-attachments/assets/f0eb2d42-9bf9-4085-96f0-b3b8e8cba4d9" /> then you could navigate to one by something like /agent_session <session_id>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2179