# Implementation Plan: Logging Reorganization and Automated Pruning

## Phase 1: Session Organization & Registry Foundation
- [x] Task: Initialize MMA Environment (Protocol: `activate_skill mma-orchestrator`) [9a66b76]
- [x] Task: Implement `LogRegistry` to manage `log_registry.toml` [10fbfd0]
    - [x] Define TOML schema for session metadata.
    - [x] Create methods to register sessions and update whitelist status.
- [x] Task: Implement Session-Based Directory Creation [3f4dc1a]
    - [x] Create utility to generate Session IDs: `YYYYMMDD_HHMMSS[_Label]`.
    - [x] Update logging initialization to create and use session sub-directories.
- [x] Task: Conductor - User Manual Verification 'Phase 1: Foundation' (Protocol in workflow.md) [3f4dc1a]

## Phase 2: Pruning Logic & Heuristics
- [x] Task: Implement `LogPruner` Core Logic [bd2a79c]
    - [x] Implement time-based filtering (older than 24h).
    - [x] Implement size-based heuristic for "insignificance" (~2 KB).
- [x] Task: Implement Auto-Whitelisting Heuristics [4e9c47f]
    - [x] Implement content scanning for `ERROR`, `WARNING`, `EXCEPTION`.
    - [x] Implement complexity detection (message count > 10).
- [x] Task: Integrate Pruning into App Startup [8b75883]
    - [x] Hook the pruner into `gui_2.py` startup sequence.
    - [x] Ensure pruning runs asynchronously to prevent startup lag.
- [x] Task: Conductor - User Manual Verification 'Phase 2: Pruning' (Protocol in workflow.md) [8b75883]

## Phase 3: GUI Integration & Manual Control
- [x] Task: Add "Log Management" UI Panel [7d52123]
    - [x] Display a list of recent sessions from the registry.
    - [x] Add "Star/Unstar" toggle for manual whitelisting.
- [x] Task: Display Session Metrics in UI [7d52123]
    - [x] Show size, message count, and status (Whitelisted/Pending Prune).
- [x] Task: Conductor - User Manual Verification 'Phase 3: GUI' (Protocol in workflow.md) [7d52123]

## Phase 4: Final Verification & Cleanup
- [x] Task: Comprehensive Integration Testing [23c0f0a]
    - [x] Verify that empty old logs are deleted.
    - [x] Verify that complex/error-filled old logs are preserved.
- [x] Task: Final Refactoring and Documentation [04a991e]
    - [x] Ensure all new classes and methods follow project style.
- [x] Task: Conductor - User Manual Verification 'Phase 4: Final' (Protocol in workflow.md) [04a991e]
