conductor: add phase 6 context composition redesign tracks

- context_comp_decouple_20260510: Decouple Files & Media from Context Composition, directory grouping, file stats
- context_comp_slices_20260510: Slice visualization with annotations, view presets
- context_comp_presets_20260510: Context preset save/load with validation, context preview
- Depends_on chain: presets -> slices -> decouple
This commit is contained in:
2026-05-10 22:12:03 -04:00
parent f9cc89c877
commit de3dfec4de
10 changed files with 372 additions and 1 deletions
@@ -0,0 +1,11 @@
{
"id": "context_comp_slices_20260510",
"title": "Context Composition Slice Visualization",
"phase": 6,
"created": "2026-05-10",
"status": "pending",
"spec_file": "spec.md",
"plan_file": "plan.md",
"depends_on": ["context_comp_decouple_20260510"],
"completion_checkpoints": []
}
@@ -0,0 +1,48 @@
# Implementation Plan: Context Composition Slice Visualization
## Phase 1: Slice Data Model Extension
Focus: Extend custom_slices to support tags and comments
- [ ] Task 1.1: Extend custom_slices schema to include tag and comment fields
- [ ] Task 1.2: Update FileItem.to_dict() and from_dict() for new fields
- [ ] Task 1.3: Write tests for custom_slices with annotations
## Phase 2: Slice Inspector Enhancement
Focus: Visual AST highlighting with file content
- [ ] Task 2.1: Modify _render_ast_inspector_modal() to show file content with highlighted slices
- [ ] Task 2.2: Add color coding for Sig vs Def elements in file content view
- [ ] Task 2.3: Implement toggle buttons for each AST element in the content view
- [ ] Task 2.4: Write tests for slice inspector rendering
## Phase 3: Slice Editor Visual Enhancement
Focus: Visual slice editor with colored overlays
- [ ] Task 3.1: Enhance slice editor to show file content (not just line list)
- [ ] Task 3.2: Add colored overlays for custom slices on the content
- [ ] Task 3.3: Implement click-drag line range selection
- [ ] Task 3.4: Add tag/comment input for custom slices
- [ ] Task 3.5: Write tests for slice editor
## Phase 4: View Presets
Focus: Named view configurations
- [ ] Task 4.1: Create FileViewPreset model
- [ ] Task 4.2: Add preset selection dropdown to context composition
- [ ] Task 4.3: Implement preset save/load to project config
- [ ] Task 4.4: Write tests for view presets
## Phase 5: AST Slice Pre-population
Focus: Show auto-resolved slices before user customizes
- [ ] Task 5.1: On file add to context, compute AST slices automatically
- [ ] Task 5.2: Store pre-computed slices in FileItem for display
- [ ] Task 5.3: User can modify/remove auto-slices
- [ ] Task 5.4: Write tests for auto-slice computation
## Phase 6: Integration
Focus: Connect all pieces together
- [ ] Task 6.1: Verify slice data flows correctly through context composition
- [ ] Task 6.2: Test with C++ files from gencpp
- [ ] Task 6.3: Conductor - User Manual Verification
@@ -0,0 +1,63 @@
# Track Specification: Context Composition Slice Visualization
## Overview
Enhance slice visualization with visual editor, annotation support (tags/comments), and view presets. This is Phase 2 of the Context Composition Redesign per spec at `docs/superpowers/specs/2026-05-10-context-composition-redesign-design.md`.
## Current State Audit (as of 2026-05-10)
### Already Implemented
- [Inspect] button opens AST inspector modal showing AST tree with Def/Sig/Hide toggles
- [Slices] button opens Text Viewer with file content for slice management
- FileItem.ast_mask stores mask per AST path (Def/Sig/Hide)
- FileItem.custom_slices stores user-defined slices with line ranges
### Gaps to Fill (This Track's Scope)
- Inspect popup shows AST but doesn't show file content with highlighted slices
- Slices editor is just a list of line ranges - no visual representation
- No annotation support (tags/comments) for custom slices
- No view presets (named combinations of view settings)
- AST-derived slices not shown before user creates custom slice
## Goals
1. Slice inspector shows file content with AST-derived slices visually highlighted
2. Custom slices have visual representation (colored ranges) in slice editor
3. Each slice can have optional tag and comment annotation
4. View presets allow naming and reusing view configurations
5. User can toggle which AST elements are included in each view
## Functional Requirements
### Slice Inspector (replaces Inspect button)
- Opens as popup showing full file content with line numbers
- AST-derived slices highlighted with distinct colors:
- Sig elements: one color
- Def elements: another color
- User can toggle visibility of each AST element (Def/Sig/Hide)
- Changes persist to FileItem.ast_mask
### Slice Editor (extends Slices button)
- Visual file content display (not just line number list)
- Custom slices shown as colored overlays on the content
- Click-drag to select line range for new slice
- Each custom slice has:
- Line range
- Tag (optional, e.g., "performance", "api", "bug")
- Comment (optional, free-text explanation)
- Remove/edit existing custom slices
### View Presets
- Named presets defining default view + default slices per file type
- Examples:
- "Debug View" = full text + error-prone line slices
- "API Surface" = sig + public API function slices
- Presets project-scoped, saved in project config
- User can select preset, then override for specific file
## Architecture Reference
- `src/gui_2.py:_render_ast_inspector_modal()` - needs enhancement
- `src/models.py:FileItem.ast_mask` - existing mask storage
- `src/models.py:FileItem.custom_slices` - needs tag/comment support
- `docs/superpowers/specs/2026-05-10-context-composition-redesign-design.md`
## Out of Scope
- Context preset save/load UI (Phase 3)
- Context preview before send (Phase 3)
- Changes to Files & Media panel (Phase 1)