diff --git a/packages/coding-agent/docs/session-tree-plan.md b/packages/coding-agent/docs/session-tree-plan.md index 49c1ae0e..3b01e818 100644 --- a/packages/coding-agent/docs/session-tree-plan.md +++ b/packages/coding-agent/docs/session-tree-plan.md @@ -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. -### Branch Summary Design +### Branch Summary Design ✅ Current type: ```typescript export interface BranchSummaryEntry extends SessionEntryBase { type: "branch_summary"; 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: -- [ ] Add `abandonedLeafId` field to reference what was abandoned? -- [ ] Store metadata about why the branch happened? -- [ ] Who generates the summary - user, LLM, or both options? -- [ ] Design and implement branch summarizer -- [ ] Add tests for `branchWithSummary()` flow +- [x] `fromId` field references the abandoned leaf +- [x] `fromHook` field distinguishes pi-generated vs hook-generated summaries +- [x] `details` field for file tracking +- [x] Branch summarizer implemented with structured output format +- [x] Uses serialization approach (same as compaction) to prevent model confusion +- [x] Tests for `branchWithSummary()` flow ### Entry Labels ✅ @@ -100,8 +103,8 @@ Questions to resolve: - [x] Update `createBranchedSession()` to filter out LabelEntry and recreate from resolved map - [x] `buildSessionContext()` already ignores LabelEntry (only handles message types) - [x] Add `label?: string` to `SessionTreeNode`, populated by `getTree()` -- [ ] Display labels in UI (tree view, path view) - deferred to UI phase -- [ ] `/label` command - deferred to UI phase +- [x] Display labels in UI (tree-selector shows labels) +- [x] `/label` command (implemented in tree-selector) ### CustomMessageEntry @@ -361,23 +364,14 @@ interface BeforeAgentStartResult { - [ ] Render full path (no compaction resolution needed) - [ ] Responsive: collapse sidebar on mobile -### UI Commands +### UI Commands ✅ -Design new commands based on refactored SessionManager: - -**`/branch`** - Current behavior (creates new session file from path) -- [ ] Review if this is still the right UX with tree structure -- [ ] Consider: should this use `createBranchedSession()` or `branch()`? - -**`/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 +- [x] `/branch` - Creates new session file from current path (uses `createBranchedSession()`) +- [x] `/tree` - In-session tree navigation via tree-selector component + - Shows full tree structure with labels + - Navigate between branches (moves leaf pointer) + - Shows current position + - Generates branch summaries when switching branches ### Documentation