# Implementation Plan: Context Composition Decoupling

## Phase 1: Core Data Model Changes
Focus: Add view_mode field to FileItem, understand current coupling

- [x] Task 1.1: Audit FileItem model in models.py - add view_mode and custom_slices fields [8addb97]
- [x] Task 1.2: Audit _render_context_composition_panel() to understand current coupling [8addb97]
- [x] Task 1.3: Audit _render_files_panel() to understand how Files & Media populates context [8addb97]
- [x] Task 1.4: Write tests for FileItem with view_mode and custom_slices [8addb97]

## Phase 2: Decouple Context Composition from Files & Media
Focus: Remove auto-population inheritance, make Context Composition independent

- [x] Task 2.1: Remove auto-population of context from Files & Media in context composition [9b3a4d6]
- [x] Task 2.2: Add manual "Add Files" button to Context Composition (file picker from project whitelist) [9b3a4d6]
- [x] Task 2.3: Implement "Add All" batch operation [9b3a4d6]
- [x] Task 2.4: Write tests for decoupled context composition state [9b3a4d6]

## Phase 3: Directory Grouping + File Stats
Focus: Compact file listing with stats

- [x] Task 3.1: Implement directory grouping helper to group files by relative path prefix [5112deb]
- [x] Task 3.2: Add file stats computation (line count, AST element count) - async [5112deb]
- [x] Task 3.3: Render file list with collapsible directory headers [5112deb]
- [x] Task 3.4: Display aggregate stats (total files, lines, AST elements) [5112deb]
- [x] Task 3.5: Write tests for directory grouping and stats [5112deb]

## Phase 4: View Mode Selection UI
Focus: Per-file view mode dropdown (full/sig/def/custom)

- [x] Task 4.1: Add view_mode dropdown to each file entry in Context Composition [fb1b72c]
- [x] Task 4.2: Implement custom view mode indicator (enabled when custom slices exist) [fb1b72c]
- [x] Task 4.3: Batch view mode change operations [fb1b72c]
- [x] Task 4.4: Write tests for view mode selection [fb1b72c]

## Phase 5: Context Presets Infrastructure
Focus: Data structures for save/load (without UI)

- [x] Task 5.1: Create ContextPreset and FileViewPreset data models [78c009f]
- [x] Task 5.2: Implement serialization for context presets (TOML) [78c009f]
- [x] Task 5.3: Write tests for context preset models [78c009f]

## Phase 6: Integration + Bug Fixes
Focus: Ensure aggregate respects new view modes, fix any issues

- [x] Task 6.1: Verify aggregate.py respects view_mode when composing context [4dc801e]
- [x] Task 6.2: Test with gencpp project files [4dc801e]
- [x] Task 6.3: Conductor - User Manual Verification [4dc801e]
