de3dfec4de
- 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
2.6 KiB
2.6 KiB
Track Specification: Context Composition Presets
Overview
Implement Context Preset save/load with validation, and Context Preview before sending to agent. This is Phase 3 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
- Preset system exists for system prompts, tool presets, personas
- ProjectManager handles TOML save/load
- Context Composition stores FileItem entries with flags
Gaps to Fill (This Track's Scope)
- No Context Preset model for saving file+view+slices compositions
- No save/load UI for Context Presets in Context Composition panel
- No validation when loading preset (missing files warn user)
- No Context Preview showing what will be sent to agent
Goals
- Context Preset model with name, description, files list
- Save Context Preset to project config
- Load Context Preset populates Context Composition
- Missing file validation on load with user choice
- Context Preview before send showing exact context text
Functional Requirements
Context Preset Model
- Contains: name, description, list of ContextFileEntry
- ContextFileEntry: relative_path, view_mode, custom_slices
- All paths stored as relative to project root
- Serializes to TOML in project config
Save Preset UI
- [Save] button in Context Composition
- Dialog: enter preset name + optional description
- Validation before save:
- Check all files exist in project
- If files missing: warn user, offer to save without or cancel
Load Preset UI
- Dropdown selector for preset selection
- On load: clear Context Composition, populate from preset
- If file missing from preset: highlight in red, warn user
- User can proceed with missing files or re-path
Context Preview
- "Preview" button/tab showing what will be sent
- Per file: view mode, line ranges, tags, comments
- Collapsed view: just file list + view modes
- Expanded view: actual text/slices that will be sent
- Token estimate for total context
Stale Preset Handling
- If project changes and preset references moved/renamed files:
- On load: detect and warn
- User can save preset without invalid files
- Or ignore warning and proceed
Architecture Reference
src/project_manager.py- existing preset save/load patternssrc/presets.py- existing preset manager patterns to followdocs/superpowers/specs/2026-05-10-context-composition-redesign-design.md
Out of Scope
- Slice visualization (Phase 2)
- Files & Media changes (Phase 1)
- RAG configuration changes