# Phase 2: Analysis **Role**: Researcher and software architect **Goal**: Research improvements and produce a refactoring roadmap **Constraints**: Analysis only — no code changes ## 2a. Deep Research 1. Analyze current implementation patterns 2. Research modern approaches for similar systems 3. Identify what could be done differently 4. Suggest improvements based on state-of-the-art practices Write `REFACTOR_DIR/analysis/research_findings.md`: - Current state analysis: patterns used, strengths, weaknesses - Alternative approaches per component: current vs alternative, pros/cons, migration effort - Prioritized recommendations: quick wins + strategic improvements ## 2b. Solution Assessment 1. Assess current implementation against acceptance criteria 2. Identify weak points in codebase, map to specific code areas 3. Perform gap analysis: acceptance criteria vs current state 4. Prioritize changes by impact and effort Write `REFACTOR_DIR/analysis/refactoring_roadmap.md`: - Weak points assessment: location, description, impact, proposed solution - Gap analysis: what's missing, what needs improvement - Phased roadmap: Phase 1 (critical fixes), Phase 2 (major improvements), Phase 3 (enhancements) **Self-verification**: - [ ] All acceptance criteria are addressed in gap analysis - [ ] Recommendations are grounded in actual code, not abstract - [ ] Roadmap phases are prioritized by impact - [ ] Quick wins are identified separately **Save action**: Write analysis artifacts **BLOCKING**: Present refactoring roadmap to user. Do NOT proceed until user confirms. **Quick Assessment mode stops here.** Present final summary and write `FINAL_report.md` with phases 0-2 content.