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_decouple_20260510",
"title": "Context Composition Decoupling",
"phase": 6,
"created": "2026-05-10",
"status": "pending",
"spec_file": "spec.md",
"plan_file": "plan.md",
"depends_on": [],
"completion_checkpoints": []
}
@@ -0,0 +1,48 @@
# Implementation Plan: Context Composition Decoupling
## Phase 1: Core Data Model Changes
Focus: Add view_mode field to FileItem, understand current coupling
- [ ] Task 1.1: Audit FileItem model in models.py - add view_mode and custom_slices fields
- [ ] Task 1.2: Audit _render_context_composition_panel() to understand current coupling
- [ ] Task 1.3: Audit _render_files_panel() to understand how Files & Media populates context
- [ ] Task 1.4: Write tests for FileItem with view_mode and custom_slices
## Phase 2: Decouple Context Composition from Files & Media
Focus: Remove auto-population inheritance, make Context Composition independent
- [ ] Task 2.1: Remove auto-population of context from Files & Media in context composition
- [ ] Task 2.2: Add manual "Add Files" button to Context Composition (file picker from project whitelist)
- [ ] Task 2.3: Implement "Add All" batch operation
- [ ] Task 2.4: Write tests for decoupled context composition state
## Phase 3: Directory Grouping + File Stats
Focus: Compact file listing with stats
- [ ] Task 3.1: Implement directory grouping helper to group files by relative path prefix
- [ ] Task 3.2: Add file stats computation (line count, AST element count) - async
- [ ] Task 3.3: Render file list with collapsible directory headers
- [ ] Task 3.4: Display aggregate stats (total files, lines, AST elements)
- [ ] Task 3.5: Write tests for directory grouping and stats
## Phase 4: View Mode Selection UI
Focus: Per-file view mode dropdown (full/sig/def/custom)
- [ ] Task 4.1: Add view_mode dropdown to each file entry in Context Composition
- [ ] Task 4.2: Implement custom view mode indicator (enabled when custom slices exist)
- [ ] Task 4.3: Batch view mode change operations
- [ ] Task 4.4: Write tests for view mode selection
## Phase 5: Context Presets Infrastructure
Focus: Data structures for save/load (without UI)
- [ ] Task 5.1: Create ContextPreset and FileViewPreset data models
- [ ] Task 5.2: Implement serialization for context presets (TOML)
- [ ] Task 5.3: Write tests for context preset models
## Phase 6: Integration + Bug Fixes
Focus: Ensure aggregate respects new view modes, fix any issues
- [ ] Task 6.1: Verify aggregate.py respects view_mode when composing context
- [ ] Task 6.2: Test with gencpp project files
- [ ] Task 6.3: Conductor - User Manual Verification
@@ -0,0 +1,52 @@
# Track Specification: Context Composition Decoupling
## Overview
Decouple Files & Media from Context Composition, add directory grouping, file stats, and view mode selection per file. This is Phase 1 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
- Files & Media panel lists project files with wildcards
- Context Composition panel inherits files from Files & Media
- View flags (agg/full/sig/def) sync visually between panels
- `_render_context_composition_panel()` in gui_2.py:2794-2964
### Gaps to Fill (This Track's Scope)
- Files & Media populates Context Composition automatically (coupled)
- No directory grouping in file listings
- No file stats (line count, AST element count)
- View mode selection is limited (no custom view presets)
- Context Composition is NOT independent selection - it's derived from Files & Media
## Goals
1. Make Files & Media and Context Composition independent data sources
2. Add directory grouping to file listings for compact display
3. Add file stats per file and aggregate
4. Implement proper view mode selection (full/sig/def/custom)
5. User can add/remove files from Context Composition independently
6. "Add all" and bulk add/remove operations
## Functional Requirements
- Context Composition starts empty or from saved preset on discussion switch
- User manually adds files FROM project whitelist (not auto-inherited)
- Each file entry has: path, view_mode, custom_slices
- Directory grouping with collapsible headers (`📁 relative/path/`)
- File stats displayed: line count, AST element count per file
- Aggregate stats for selection: total files, lines, AST elements
- View mode dropdown per file: full, sig, def, custom
- Batch operations: add all from whitelist, remove selected, etc.
## Non-Functional Requirements
- No horizontal scrolling in file lists (directory grouping enables this)
- Stats computed asynchronously to not block UI
- FileItem model may need extension for view_mode field
## Architecture Reference
- `src/gui_2.py:_render_context_composition_panel()` - main panel
- `src/models.py:FileItem` - needs view_mode field extension
- `src/aggregate.py` - respects view modes when composing context
- `docs/superpowers/specs/2026-05-10-context-composition-redesign-design.md`
## Out of Scope
- Slice visualization and annotations (Phase 2)
- Context preset save/load (Phase 3)
- Context preview before send (Phase 3)