[FEATURE] Add /session-tree command to visualize conversation fork/branch hierarchy

Resolved 💬 4 comments Opened Mar 21, 2026 by xxlokasenna Closed Apr 19, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

/branch lets users fork conversations, but there's no way to see the full tree of how sessions relate to each other.

claude --resume shows a flat list grouped by forks — it doesn't visualize depth or parent-child hierarchy. After a few rounds of branching (e.g. a design discussion that forks into sub-topics, each forking further), you end up with 5-6+ related sessions and no way to see how they connect or navigate back to the right one.

Proposed Solution

A built-in command (e.g. /session-tree) that reads forkedFrom.sessionId from session JSONL files and renders a tree view:

system-design-review [a1b2c3d4] (03/21)
├── database-options [e5f6a7b8]
│ └── postgres-vs-mysql [c9d0e1f2]
└── api-design [a3b4c5d6]
└── auth-middleware [e7f8a9b0]

Suggested behavior:

  • Default: only show sessions with fork relationships
  • --all flag: show all sessions
  • --project flag: filter by project

Why This Feature

  • The data already exists — every forked session's first JSONL line contains forkedFrom.sessionId
  • /branch is an official feature but lacks a companion visualization
  • claude --resume groups forks but doesn't show depth/hierarchy
  • Multi-branch workflows (research, design exploration, debugging) need this to stay oriented

Reference Implementation

Working prototype as a custom skill (~250 lines, Python, no external dependencies):
https://gist.github.com/xxlokasenna/fe7f477f0d9188919e55817356b83a71

Features: cross-project scanning, fork-only default view, project filtering, session name resolution from rename history.

Environment

  • Claude Code: 2.1.81
  • OS: macOS (Darwin 25.3.0)
  • Shell: zsh

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗