Update session-tree-plan.md with completed items

- Branch Summary Design: complete with fromId, fromHook, details fields
- Entry Labels: UI display and /label command complete in tree-selector
- UI Commands: /branch and /tree complete
This commit is contained in:
Mario Zechner 2025-12-30 00:19:43 +01:00
parent 81f4cdf3e3
commit 4a9c53347e

View file

@ -73,22 +73,25 @@ Reference: [session-tree.md](./session-tree.md)
Reference: [#314](https://github.com/badlogic/pi-mono/pull/314) - Structured compaction with anchored iterative summarization needs `details` field to store `ArtifactIndex` and version markers. Reference: [#314](https://github.com/badlogic/pi-mono/pull/314) - Structured compaction with anchored iterative summarization needs `details` field to store `ArtifactIndex` and version markers.
### Branch Summary Design ### Branch Summary Design
Current type: Current type:
```typescript ```typescript
export interface BranchSummaryEntry extends SessionEntryBase { export interface BranchSummaryEntry extends SessionEntryBase {
type: "branch_summary"; type: "branch_summary";
summary: string; summary: string;
fromId: string; // References the abandoned leaf
fromHook?: boolean; // Whether summary was generated by a hook
details?: unknown; // File tracking: { readFiles, modifiedFiles }
} }
``` ```
Questions to resolve: - [x] `fromId` field references the abandoned leaf
- [ ] Add `abandonedLeafId` field to reference what was abandoned? - [x] `fromHook` field distinguishes pi-generated vs hook-generated summaries
- [ ] Store metadata about why the branch happened? - [x] `details` field for file tracking
- [ ] Who generates the summary - user, LLM, or both options? - [x] Branch summarizer implemented with structured output format
- [ ] Design and implement branch summarizer - [x] Uses serialization approach (same as compaction) to prevent model confusion
- [ ] Add tests for `branchWithSummary()` flow - [x] Tests for `branchWithSummary()` flow
### Entry Labels ✅ ### Entry Labels ✅
@ -100,8 +103,8 @@ Questions to resolve:
- [x] Update `createBranchedSession()` to filter out LabelEntry and recreate from resolved map - [x] Update `createBranchedSession()` to filter out LabelEntry and recreate from resolved map
- [x] `buildSessionContext()` already ignores LabelEntry (only handles message types) - [x] `buildSessionContext()` already ignores LabelEntry (only handles message types)
- [x] Add `label?: string` to `SessionTreeNode`, populated by `getTree()` - [x] Add `label?: string` to `SessionTreeNode`, populated by `getTree()`
- [ ] Display labels in UI (tree view, path view) - deferred to UI phase - [x] Display labels in UI (tree-selector shows labels)
- [ ] `/label` command - deferred to UI phase - [x] `/label` command (implemented in tree-selector)
### CustomMessageEntry<T> ### CustomMessageEntry<T>
@ -361,23 +364,14 @@ interface BeforeAgentStartResult {
- [ ] Render full path (no compaction resolution needed) - [ ] Render full path (no compaction resolution needed)
- [ ] Responsive: collapse sidebar on mobile - [ ] Responsive: collapse sidebar on mobile
### UI Commands ### UI Commands
Design new commands based on refactored SessionManager: - [x] `/branch` - Creates new session file from current path (uses `createBranchedSession()`)
- [x] `/tree` - In-session tree navigation via tree-selector component
**`/branch`** - Current behavior (creates new session file from path) - Shows full tree structure with labels
- [ ] Review if this is still the right UX with tree structure - Navigate between branches (moves leaf pointer)
- [ ] Consider: should this use `createBranchedSession()` or `branch()`? - Shows current position
- Generates branch summaries when switching branches
**`/branch-here`** - In-place branching (new)
- [ ] Use `branch(id)` to move leaf pointer without creating new file
- [ ] Subsequent messages become new branch in same file
- [ ] Design: how to select branch point? (similar to current `/branch` UI?)
**`/branches`** - List/navigate branches (new)
- [ ] Show tree structure or list of branch points
- [ ] Allow switching between branches (move leaf pointer)
- [ ] Show current position in tree
### Documentation ### Documentation