Feature/insight chat branching #109
Reference in New Issue
Block a user
Delete Branch "feature/insight-chat-branching"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add the ability to fork and branch conversations from a certain point and still see the original transcripts.
Store chat history as a tree in training_messages instead of a flat array. Rewind now sets active_leaf_id to the target node rather than truncating, so discarded paths survive as alternate branches. Fork indicators ("X/Y") mark divergence points and let the client load or switch to alternate paths. - llm_client: StoredChatNode/ChatHistoryStore with tree traversal helpers (path_to_leaf, children_of, fork_at_node, leaves*, etc.) and from_flat_array for backward-compatible reads of the old flat format. - insight_chat: load_history/chat_turn/rewind_history operate on the tree; new switch_branch and get_branches. render_tree_path walks every node (including non-rendered tool-dispatch nodes) when computing fork info, so a fork whose diverging child is a tool call still surfaces on the following rendered message. - handlers: GET /insights/chat/branches, POST /insights/chat/switch-branch, and a branch_id param on the history endpoint. Backward-compatible: flat arrays are converted to a tree lazily on read. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>