# Implementation Plan: Undo/Redo History Support

This plan implements a robust undo/redo system focusing on text inputs, control states, and discussion structure.

## Phase 1: History Core Logic & State Management [checkpoint: 9a699a5]
- [x] Task: Design and implement a generic `HistoryManager` class to handle undo/redo stacks and state snapshots. 7743b15
- [x] Task: Write failing tests for the `HistoryManager` core logic, including capacity limits and basic undo/redo functionality. 7743b15
- [x] Task: Implement `HistoryManager` to pass tests, ensuring it correctly manages a fixed stack of 50-100 actions. 7743b15
- [x] Task: Conductor - User Manual Verification 'Phase 1: History Core Logic & State Management' (Protocol in workflow.md) 9a699a5

## Phase 2: Text Input & Control Undo/Redo [checkpoint: a02849b]
- [x] Task: Integrate `HistoryManager` with `src/gui_2.py` for system prompt and discussion entry text fields. 095368b
- [x] Task: Implement state snapshots for AI model parameter sliders (Temperature, Top-P) and checkboxes. 095368b
- [x] Task: Write simulation tests using `live_gui` to verify undo/redo for text edits and control changes. 095368b
- [x] Task: Conductor - User Manual Verification 'Phase 2: Text Input & Control Undo/Redo' (Protocol in workflow.md) a02849b

## Phase 3: Discussion & Context Structure Mutation [checkpoint: 0a5b90e]
- [x] Task: Implement undo/redo for adding, deleting, and reordering discussion entries in `src/app_controller.py`. 095368b
- [x] Task: Extend the history system to track context file and screenshot additions/removals in `src/aggregate.py`. 095368b
- [x] Task: Write failing tests for reverting and redoing complex discussion tree mutations. 095368b
- [x] Task: Implement mutation tracking and restoration logic to pass tests. 095368b
- [x] Task: Conductor - User Manual Verification 'Phase 3: Discussion & Context Structure Mutation' (Protocol in workflow.md) 0a5b90e

## Phase 4: UI Features - Hotkeys & History List [checkpoint: 446a587]
- [x] Task: Implement global hotkey handling for `Ctrl+Z` and `Ctrl+Y` / `Ctrl+Shift+Z` in the main GUI loop. 095368b
- [x] Task: Create a dedicated 'History List' panel in `src/gui_2.py` showing a scrollable list of recent actions. a3d7376
- [x] Task: Implement functionality to jump to a specific historical state via the History List. a3d7376
- [x] Task: Write final integration tests for the full undo/redo cycle across all supported areas. 7bed4a8
- [x] Task: Conductor - User Manual Verification 'Phase 4: UI Features - Hotkeys & History List' (Protocol in workflow.md) 446a587

