Skip to content

Add session tree navigation commands#387

Closed
piercebrookins wants to merge 2 commits into
mpfaffenberger:mainfrom
piercebrookins:feature/session-tree-fork
Closed

Add session tree navigation commands#387
piercebrookins wants to merge 2 commits into
mpfaffenberger:mainfrom
piercebrookins:feature/session-tree-fork

Conversation

@piercebrookins

@piercebrookins piercebrookins commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds persistent, pi-inspired conversation branching through /tree, /fork, and /clone.

Why

A linear message list cannot preserve an abandoned branch after rewinding. The first implementation rendered tree glyphs beside that linear list, used process-local labels, and destructively discarded history. This revision stores a real append-only conversation graph per autosave session and reconciles the active pydantic-ai history into it.

What changed

  • Added an atomic persistent SessionTree store under the autosave directory, with stable node IDs, parent links, labels, timestamps, active-leaf state, and message payloads.
  • Reconciles each live linear history into the graph, preserving sibling branches after rewind and subsequent turns.
  • /tree renders actual branch depth/connectors and distinguishes the active leaf/path.
  • Selecting a user message restores its parent and returns the original prompt for editing; selecting another message restores through that node.
  • Added incremental text search plus default, no-tools, user-only, labeled-only, and all-message filters.
  • Label and display settings are preserved through selector navigation; labels persist across process restarts.
  • /tree summary now summarizes only the abandoned tail after the common ancestor and attaches that context at the destination. Failures leave active history untouched.
  • /fork uses the same tree selector in user-only mode rather than an unrelated numbered text menu.
  • /clone saves the active branch as a separate autosave artifact without rotating or mutating the current session identity.
  • Added regression coverage for branch creation, stable duplicate handling, persistence, labels, active paths, filtering/search, summary boundaries, user-message rewind behavior, /fork, and /clone.

Validation

  • uv run ruff check .
  • uv run pytest tests/plugins/test_session_tree.py -q --no-cov (14 passed)
  • git diff --check
  • Full suite: 10,365 passed, 82 skipped, 1 xpassed; 8 unrelated failures remain in pre-existing MCP/live-provider tests (test_builder_autostart_mcp, test_add_model_menu_coverage, and live compaction/provider tests).

@piercebrookins
piercebrookins force-pushed the feature/session-tree-fork branch from 83d7efb to 2dcfa1b Compare June 7, 2026 17:47
@piercebrookins
piercebrookins force-pushed the feature/session-tree-fork branch from 2dcfa1b to c83efbb Compare June 7, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant