# Implementation Plan - Workflow Detection Fix - [x] 1. Fix VisionAnalysis attribute bug - Fix the `self.llm_manager` to `self.llm` attribute references - Add error handling around LLM calls - Ensure action signatures include all required fields - _Requirements: 2.1, 2.2, 2.3_ - [ ]* 1.1 Write unit test for VisionAnalysis attribute fix - Verify no AttributeError is raised when LLM is provided - Test with and without LLM manager - _Requirements: 2.1_ - [ ]* 1.2 Write property test for VisionAnalysis error handling - **Property 6: VisionAnalysis error resilience** - **Validates: Requirements 2.2** - [ ]* 1.3 Write property test for action signature completeness - **Property 7: Action signature completeness** - **Validates: Requirements 2.3** - [x] 2. Integrate SessionManager into Orchestrator - Import SessionManager in orchestrator.py - Initialize SessionManager in Orchestrator.__init__ - Add action forwarding in the cognitive loop - Connect session completion callback - _Requirements: 1.1, 1.2_ - [ ]* 2.1 Write property test for action forwarding - **Property 1: Action forwarding to SessionManager** - **Validates: Requirements 1.1** - [ ]* 2.2 Write property test for session grouping - **Property 2: Session grouping by time and context** - **Validates: Requirements 1.2** - [x] 3. Integrate WorkflowDetector into Orchestrator - Import WorkflowDetector in orchestrator.py - Initialize WorkflowDetector in Orchestrator.__init__ - Connect SessionManager to WorkflowDetector - Implement _on_workflow_detected callback - _Requirements: 1.3, 1.4_ - [ ]* 3.1 Write property test for session forwarding to WorkflowDetector - **Property 3: Completed sessions trigger workflow analysis** - **Validates: Requirements 1.3** - [ ]* 3.2 Write property test for workflow notifications - **Property 4: Workflow detection triggers notifications** - **Validates: Requirements 1.4** - [x] 4. Connect WorkflowDetector to SuggestionManager - Implement workflow notification in _on_workflow_detected - Ensure SuggestionManager receives workflow data - Add logging for workflow detection events - _Requirements: 1.5, 4.2_ - [ ]* 4.1 Write property test for suggestion generation - **Property 5: Workflow notifications generate suggestions** - **Validates: Requirements 1.5** - [ ]* 4.2 Write property test for workflow detection logging - **Property 11: Workflow detection logging** - **Validates: Requirements 4.2** - [x] 5. Implement workflow persistence - Create workflow save method in WorkflowDetector - Save workflows to data/user_profiles/workflows/ - Implement workflow loading on startup - Add confidence score update mechanism - _Requirements: 3.1, 3.2, 3.3_ - [ ]* 5.1 Write property test for workflow persistence - **Property 8: Workflow persistence** - **Validates: Requirements 3.1** - [ ]* 5.2 Write unit test for workflow loading - Create test workflow files - Verify they are loaded on startup - _Requirements: 3.2_ - [ ]* 5.3 Write property test for confidence score updates - **Property 9: Confidence score updates** - **Validates: Requirements 3.3** - [ ] 6. Add comprehensive logging - Add session creation logging in SessionManager - Add workflow detection logging in WorkflowDetector - Add error logging with context - _Requirements: 4.1, 4.3_ - [ ]* 6.1 Write property test for session logging - **Property 10: Session logging completeness** - **Validates: Requirements 4.1** - [ ]* 6.2 Write property test for error logging - **Property 12: Error logging with context** - **Validates: Requirements 4.3** - [x] 7. Checkpoint - Ensure all tests pass - Ensure all tests pass, ask the user if questions arise. - **Status**: ✅ Intégration complète effectuée - EventCapture passe maintenant les actions au SessionManager - SessionManager segmente les actions en sessions - WorkflowDetector analyse les sessions et détecte les patterns - SuggestionManager reçoit les notifications de workflows - Orchestrator coordonne tous les composants - [ ] 8. End-to-end integration test - Create test script that simulates repeated actions - Verify sessions are created - Verify workflows are detected - Verify suggestions are generated - _Requirements: 1.1, 1.2, 1.3, 1.4, 1.5_