Skip to content

feat: add conversation turn tree navigation#3362

Open
ZolHo wants to merge 1 commit into
esengine:main-v2from
ZolHo:feat/turn-tree
Open

feat: add conversation turn tree navigation#3362
ZolHo wants to merge 1 commit into
esengine:main-v2from
ZolHo:feat/turn-tree

Conversation

@ZolHo
Copy link
Copy Markdown

@ZolHo ZolHo commented Jun 6, 2026

Why

DeepSeek-style prefix caching is most valuable when users can reuse a stable conversation prefix instead of repeatedly rebuilding the same context. For larger tasks, a common workflow is to establish project assumptions early, then branch from that shared prefix to investigate different implementation directions or problem areas.

Manual session forking can support that workflow, but it makes the session list noisy and difficult to manage as branches accumulate. This PR adds turn-level conversation tree navigation so users can understand the current conversation's branch structure, jump back to any saved node, and continue from that point with much lower friction.

The goal is to make cache-friendly long-task workflows easier: users can keep stable context in one prefix, inspect where branches came from, and create new branch conversations cheaply when they need to explore a different path.

If you feel the overall direction of my approach is sound but the code isn't suitable for merging, we can also defer this issue to a future milestone and close this PR.

What Changed

  • Add turn-tree construction for saved session branches, including parent/child links, current-node tracking, visible ancestor resolution, inherited branch prefixes, and prompt/response summaries.
  • Add controller support for jumping to a historical turn as a temporary preview, then materializing that preview as a branch when the user continues or explicitly persists it.
  • Add CLI /turntree navigation so terminal users can view the current conversation branch tree, select a node, and continue from that point.
  • Add a desktop conversation-tree entry point in the conversation toolbar. The panel shows the current conversation root's branch tree, supports branch collapse, marks the current node, and displays per-node prefix character counts.
  • Add desktop node actions for opening a selected node in the current tab or in a new session tab. Opening in the current tab replaces the visible transcript with the selected node's prefix; opening in a new tab creates a topic, jumps there, and persists the preview.
  • Add settings backed by a shared mode list for the tree, lanes, and metro conversation-tree layouts.
  • Keep the transcript scrolled to the selected node after turn-tree jumps.

Manual Verification

Verified the intended user flows:

  • CLI: /turntree displays the current conversation branch tree, allows selecting historical nodes, and supports continuing from the selected point as a new branch.
  • Desktop: the conversation toolbar button opens the tree panel; the panel shows branch structure, collapsible branches, the current node, and prefix character counts.
  • Desktop: selecting a node offers both current-tab and new-tab actions. Current-tab open replaces the current transcript with the selected node prefix; new-tab open creates a new session tab from that node.
  • Desktop: branch sessions opened from the tree can still open and inspect the same current-root conversation tree.
  • Settings: the conversation-tree layout preference can be switched between the available visual modes.

Verification

Automated checks:

  • go test ./internal/agent ./internal/control
  • go test ./internal/agent ./internal/cli -run 'TurnTree|ListSessions|TopicMigration|ManualNewline|SoftWrapped|ComposerGrow'
  • go test . -run TurnTree from desktop
  • npm run typecheck from desktop/frontend

Formatting checks:

  • gofmt -l desktop\tabs.go internal\agent\save.go internal\cli\chat_tui.go internal\cli\turntree.go
  • git diff --check

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) agent Core agent loop (internal/agent, internal/control) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 6, 2026
@ZolHo ZolHo force-pushed the feat/turn-tree branch 3 times, most recently from c2f5d7e to 586c089 Compare June 6, 2026 14:58
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 6, 2026
@ZolHo ZolHo changed the title feat(turntree): add conversation turn tree navigation feat(desktop): add conversation turn tree navigation Jun 6, 2026
@ZolHo ZolHo force-pushed the feat/turn-tree branch from 586c089 to 2081328 Compare June 6, 2026 15:58
@ZolHo ZolHo changed the title feat(desktop): add conversation turn tree navigation feat: add conversation turn tree navigation Jun 6, 2026
@ZolHo ZolHo marked this pull request as ready for review June 6, 2026 16:19
@ZolHo ZolHo requested review from SivanCola and esengine as code owners June 6, 2026 16:19
@ZolHo
Copy link
Copy Markdown
Author

ZolHo commented Jun 7, 2026

image The main functional behavior of this PR is shown in the figure.

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

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant