Modernization Flow - Execute Phases Sequentially
Context
This modernization process is designed to systematically analyze, specify, and implement code modernization/migration projects. The process is divided into phases that MUST be executed one-by-one.
Critical Requirements
- ONE PHASE AT A TIME: Read one phase file, execute it completely, update state file, then move to next phase.
- DO NOT SKIP PHASES: Each phase builds on the previous one.
- STATE TRACKING: After each phase, update
agents/modernization-flow-state.md with completion status, keep this document concise.
- USER CONFIRMATION: Wait for user confirmation before proceeding to next phase.
- Make sure to have todo tasks for each phase! Do not skip phases!
- REMEMBER Do not put decisions/recommendations/suggestions/implementation code for the next phases in the output documents! The decisions are made at phase 6 and review at phase 7 AFTER full analysis. Respect that.
- MUST Create and update files that ARE EXPLICITLY stated here, ASK for permission to create any other file!
- MUST use grep/search on large files to read "table of contents" and then use line ranges to read what is needed.
- MUST use only applicable phases according to the target of the modernization (acquire user approval first and store it in state), as those phases are for multi-project cross-tech modernization. Do not take shortcuts within the phase!
- Prioritize ACCURACY over SPEED!
- THIS is very large workflow: MUST use best matching available separate subagents for each phase, top level agent is orchestrator, orchestrator must be smart with reading/writing files (avoid, fallback to grep and reading line-ranges, as those are very large)
- Phase subagents must contain additionally: "MUST APPLY PHASE <phase.md> — FULLY EXECUTE ALL STEPS", goal, context, original user request, inputs, expected outputs, and summary in the format useful for orchestrator, subagents must be informed they are used as subagents.
User Customizations
- If user did not specify any preferences perform all steps except optional.
- User CAN customize and ask only for specific steps OR steps could have been done already OR towards specific goal OR for specific case, in this case LISTEN and ADOPT to the user.
- Modernization scope could be small or could be done in place (example: upgrade Java 8 to 17 or 17 to 21), in this case only use
Phase 2 and Phase 6, unless you discover dependencies and project becomes bigger.
- If there is no need to rewrite code (example: upgrade .NET 6 to .NET 8), then take original and target code specs LIGHTLY, only document WHAT IS NECESSARY TO CHANGE (example: new way to use app builder).
Modernization Flow - Phase Overview
Phase 0: Prerequisites
- All Rosetta prep steps MUST be FULLY completed
- USE SKILL
load-project-context, orchestration, hitl
- MUST ALWAYS use todo tasks ledger, ASAP. Phases are sequential. Independent tasks can run in parallel.
Phase 1: Existing Library Analysis for Reusing in Target State [modernization-flow-reuse.md]
- APPLY SKILL FILE
phases/modernization-flow-reuse.md
- Execute phase instructions
- Update
agents/modernization-flow-state.md with brief state
- Validate by listing files in respective folders
Phase 2: Old Code Analysis, Generating Original Specs [modernization-flow-analysis.md]
- APPLY SKILL FILE
phases/modernization-flow-analysis.md
- Execute phase instructions
- Update
agents/modernization-flow-state.md with brief state
- Validate by listing files in respective folders
Phase 3: Pre-Modernization Test Coverage (OPTIONAL) [modernization-flow-testing.md]
NOTE: Execute this phase if user explicitly approves it
- APPLY SKILL FILE
phases/modernization-flow-testing.md
- Execute phase instructions
- Update
agents/modernization-flow-state.md with brief state
- Validate by listing files in respective folders
Phase 4: Class Group Analysis [modernization-flow-grouping.md]
- APPLY SKILL FILE
phases/modernization-flow-grouping.md
- Execute phase instructions
- Update
agents/modernization-flow-state.md with brief state
- Validate by listing files in respective folders
Phase 5: Cross-Project Analysis [modernization-flow-crossproject.md]
- APPLY SKILL FILE
phases/modernization-flow-crossproject.md
- Execute phase instructions
- Update
agents/modernization-flow-state.md with brief state
- Validate by listing files in respective folders
Phase 6: Implementation Mapping, Generating Target Specs [modernization-flow-mapping.md]
- APPLY SKILL FILE
phases/modernization-flow-mapping.md
- Execute phase instructions
- Update
agents/modernization-flow-state.md with brief state
- Validate by listing files in respective folders
Phase 7: Final Review [modernization-flow-review.md]
- APPLY SKILL FILE
phases/modernization-flow-review.md
- Execute phase instructions
- Update
agents/modernization-flow-state.md with brief state
- Validate by listing files in respective folders
Phase 8: Implementation [modernization-flow-implement.md]
- APPLY SKILL FILE
phases/modernization-flow-implement.md
- Get explicit human approval
- Follow approved target specs
- Implement one project at-a-time
- Maintain backward compatibility
- Write comprehensive tests
- Achieve 80% code coverage
State File Format
Create/update agents/modernization-flow-state.md briefly after each phase using sample:
# Modernization State
**Last Updated**: [Date and Time]
**Current Status**: [Phase Number or COMPLETE]
**Project**: [Project/Feature Name]
## Phase Completion Status
- [x] Phase 1: Existing Library Analysis - Completed [Date]
- [ ] Phase 2: Old Code Analysis - Not Started
- [ ] Phase 3: Test Coverage (OPTIONAL) - Not Started / Skipped
- [ ] Phase 4: Class Group Analysis - Not Started
- [ ] Phase 5: Cross-Project Analysis - Not Started
- [ ] Phase 6: Implementation Mapping - Not Started
- [ ] Phase 7: Final Review - Not Started
- [ ] Implementation Phase - Not Started
## Phase Details
### Phase 1
- Completed: [Date/Time]
- Files Created: [List files]
- Projects Analyzed: [List projects]
- Notes: [Any relevant notes]
[Add similar sections for each completed phase]
Important Notes
- Sequential Execution Required: Phases build on each other and must be done in order
- No Assumptions: If information is missing, track it in spec files
- User Guidance: Ask questions to resolve critical unknowns
- Evidence-Based: All findings must reference actual code
- Get Approval: Implementation phase requires explicit human approval
1---2name: modernization-flow3description: Workflow for converting, modernizing, upgrading, or re-architecting code (e.g. C++→Java, monolith→microservices), etc.4---56# Modernization Flow - Execute Phases Sequentially78## Context910This modernization process is designed to systematically analyze, specify, and implement code modernization/migration projects. The process is divided into phases that **MUST be executed one-by-one**.1112### Critical Requirements1314- **ONE PHASE AT A TIME**: Read one phase file, execute it completely, update state file, then move to next phase.15- **DO NOT SKIP PHASES**: Each phase builds on the previous one.16- **STATE TRACKING**: After each phase, update `agents/modernization-flow-state.md` with completion status, keep this document concise.17- **USER CONFIRMATION**: Wait for user confirmation before proceeding to next phase.18- Make sure to have todo tasks for each phase! Do not skip phases!19- **REMEMBER** Do not put decisions/recommendations/suggestions/implementation code for the next phases in the output documents! The decisions are made at phase 6 and review at phase 7 AFTER full analysis. Respect that.20- **MUST** Create and update files that ARE EXPLICITLY stated here, ASK for permission to create any other file!21- **MUST** use grep/search on large files to read "table of contents" and then use line ranges to read what is needed.22- **MUST** use only applicable phases according to the target of the modernization (acquire user approval first and store it in state), as those phases are for multi-project cross-tech modernization. Do not take shortcuts within the phase!23- Prioritize ACCURACY over SPEED!24- THIS is very large workflow: MUST use best matching available separate subagents for each phase, top level agent is orchestrator, orchestrator must be smart with reading/writing files (avoid, fallback to grep and reading line-ranges, as those are very large)25- Phase subagents must contain additionally: "MUST APPLY PHASE <phase.md> — FULLY EXECUTE ALL STEPS", goal, context, original user request, inputs, expected outputs, and summary in the format useful for orchestrator, subagents must be informed they are used as subagents.2627### User Customizations2829- If user did not specify any preferences perform all steps except optional.30- User CAN customize and ask only for specific steps OR steps could have been done already OR towards specific goal OR for specific case, in this case LISTEN and ADOPT to the user.31- Modernization scope could be small or could be done in place (example: upgrade Java 8 to 17 or 17 to 21), in this case only use `Phase 2` and `Phase 6`, unless you discover dependencies and project becomes bigger.32- If there is no need to rewrite code (example: upgrade .NET 6 to .NET 8), then take original and target code specs LIGHTLY, only document WHAT IS NECESSARY TO CHANGE (example: new way to use app builder).3334## Modernization Flow - Phase Overview3536**Phase 0: Prerequisites** 371. All Rosetta prep steps MUST be FULLY completed382. USE SKILL `load-project-context`, `orchestration`, `hitl`393. MUST ALWAYS use todo tasks ledger, ASAP. Phases are sequential. Independent tasks can run in parallel.4041**Phase 1: Existing Library Analysis for Reusing in Target State** [modernization-flow-reuse.md]421. APPLY SKILL FILE `phases/modernization-flow-reuse.md`432. Execute phase instructions443. Update `agents/modernization-flow-state.md` with brief state454. Validate by listing files in respective folders4647**Phase 2: Old Code Analysis, Generating Original Specs** [modernization-flow-analysis.md]481. APPLY SKILL FILE `phases/modernization-flow-analysis.md`492. Execute phase instructions503. Update `agents/modernization-flow-state.md` with brief state514. Validate by listing files in respective folders5253**Phase 3: Pre-Modernization Test Coverage (OPTIONAL)** [modernization-flow-testing.md]54**NOTE: Execute this phase if user explicitly approves it**551. APPLY SKILL FILE `phases/modernization-flow-testing.md`562. Execute phase instructions573. Update `agents/modernization-flow-state.md` with brief state584. Validate by listing files in respective folders5960**Phase 4: Class Group Analysis** [modernization-flow-grouping.md]611. APPLY SKILL FILE `phases/modernization-flow-grouping.md`622. Execute phase instructions633. Update `agents/modernization-flow-state.md` with brief state644. Validate by listing files in respective folders6566**Phase 5: Cross-Project Analysis** [modernization-flow-crossproject.md]671. APPLY SKILL FILE `phases/modernization-flow-crossproject.md`682. Execute phase instructions693. Update `agents/modernization-flow-state.md` with brief state704. Validate by listing files in respective folders7172**Phase 6: Implementation Mapping, Generating Target Specs** [modernization-flow-mapping.md]731. APPLY SKILL FILE `phases/modernization-flow-mapping.md`742. Execute phase instructions753. Update `agents/modernization-flow-state.md` with brief state764. Validate by listing files in respective folders7778**Phase 7: Final Review** [modernization-flow-review.md]791. APPLY SKILL FILE `phases/modernization-flow-review.md`802. Execute phase instructions813. Update `agents/modernization-flow-state.md` with brief state824. Validate by listing files in respective folders8384**Phase 8: Implementation** [modernization-flow-implement.md]851. APPLY SKILL FILE `phases/modernization-flow-implement.md`862. Get explicit human approval873. Follow approved target specs884. Implement one project at-a-time895. Maintain backward compatibility906. Write comprehensive tests917. Achieve 80% code coverage9293## State File Format9495Create/update `agents/modernization-flow-state.md` briefly after each phase using sample:9697```markdown98# Modernization State99100**Last Updated**: [Date and Time]101**Current Status**: [Phase Number or COMPLETE]102**Project**: [Project/Feature Name]103104## Phase Completion Status105106- [x] Phase 1: Existing Library Analysis - Completed [Date]107- [ ] Phase 2: Old Code Analysis - Not Started108- [ ] Phase 3: Test Coverage (OPTIONAL) - Not Started / Skipped109- [ ] Phase 4: Class Group Analysis - Not Started110- [ ] Phase 5: Cross-Project Analysis - Not Started111- [ ] Phase 6: Implementation Mapping - Not Started112- [ ] Phase 7: Final Review - Not Started113- [ ] Implementation Phase - Not Started114115## Phase Details116117### Phase 1118- Completed: [Date/Time]119- Files Created: [List files]120- Projects Analyzed: [List projects]121- Notes: [Any relevant notes]122123[Add similar sections for each completed phase]124```125126## Important Notes127128- **Sequential Execution Required**: Phases build on each other and must be done in order129- **No Assumptions**: If information is missing, track it in spec files130- **User Guidance**: Ask questions to resolve critical unknowns131- **Evidence-Based**: All findings must reference actual code132- **Get Approval**: Implementation phase requires explicit human approval