Overview
You have the target architecture. Now the question is: how do you get there without breaking everything along the way? Phase 4 of the modernization workflow is where strategy becomes execution planning. The Architectural Decision Record from Phase 3 defines what the system should become. This playbook turns that vision into a sequenced set of work packages — each one independently deployable, each one ordered by dependency, and each one structured around the Transform → Coexist → Eliminate cycle — the operational expression of the Strangler Fig pattern (Martin Fowler, 2004) that makes incremental modernization safe. Rather than replacing the legacy system in one big-bang release, each work package builds the new component (Transform), runs it alongside the legacy component with traffic routing (Coexist), and retires the legacy component only after behavioral equivalence is verified (Eliminate). The sequencing problem is harder than it looks. You can’t just pick the easiest component and start — if that component shares a database with three others, you’ll immediately hit data decomposition challenges. You can’t just follow the dependency graph blindly either — sometimes the highest-risk component should go first (to retire risk early) and sometimes it should go last (to learn from easier migrations first). The right sequence balances dependency constraints, risk appetite, business value delivery, and team capability. CoreStory serves as a Navigator throughout this phase — mapping the specific dependencies, shared data stores, and integration points that determine what can be separated and what must move together. It also operates as an Oracle for understanding the implications of each sequencing choice: “If we modernize this component first, what temporary integration work is needed for everything that still depends on it?” Who this is for: Engineering leads, project managers, and modernization teams responsible for planning and tracking the migration. Also useful for technical program managers coordinating cross-team modernization efforts. What you’ll get: A sequenced set of work packages with scope, acceptance criteria, dependencies, estimated effort, and the Transform/Coexist/Eliminate structure for each — optionally pushed to Jira or Linear as epics and stories.When to Use This Playbook
- You’ve completed Phase 3 (Target Architecture) and have an approved Architectural Decision Record
- You need to break a modernization initiative into executable, independently-deployable work packages
- You need to determine the migration sequence — what to modernize first, second, third — based on dependency analysis
- You’re preparing to push migration work into Jira, Linear, or another project management system
- You need to identify which components must migrate together and which can be extracted independently
When to Skip This Playbook
- You haven’t defined the target architecture yet — go back to Target Architecture
- The modernization is a single-component refactor that doesn’t need sequencing — use Spec-Driven Development directly
- You’re doing a lift-and-shift (Rehost/Relocate) with no application-level decomposition
- You already have a sequenced migration plan and need to start execution — go to Spec-Driven Development for delta specs or the relevant architecture variant
Prerequisites
- A completed Target Architecture decision (Phase 3) — the Architectural Decision Record is the primary input
- A completed Codebase Assessment (Phase 1) — the dependency graph and coupling analysis feed directly into sequencing
- A CoreStory account with the legacy codebase ingested and ingestion complete
- An AI coding agent with CoreStory MCP configured (see Supercharging AI Agents for setup)
- (Optional) Jira or Linear MCP configured alongside CoreStory for work package creation (see Using CoreStory with Jira)
- (Recommended) The engineering lead who will own the migration backlog should be driving this phase — sequencing decisions affect team assignments, sprint planning, and delivery timelines
How It Works
CoreStory MCP Tools Used
| Tool | Step(s) | Purpose |
|---|---|---|
list_projects | 1 | Confirm the target project |
create_conversation | 1 | Start a dedicated decomposition thread |
send_message | 2, 3, 4, 5 | Query CoreStory for dependency mapping and decomposition analysis |
list_conversations | 1 | Find prior phase conversations (assessment, architecture) |
get_conversation | 1 | Retrieve prior phase findings for cross-reference |
get_project_techspec | 1 | Retrieve Tech Spec for component vocabulary |
get_project_prd | 1 | Retrieve synthesized PRD for business context and requirements |
rename_conversation | 6 | Mark completed thread with “RESOLVED” prefix |
The Decomposition & Sequencing Workflow
Note: The steps below are internal to this playbook. They are sub-steps of Phase 4 in the six-phase modernization framework, not a separate numbering system.This playbook follows a six-step pattern:
- Input Loading — Load the target architecture decision and dependency map from prior phases. Establish the migration scope.
- Component Decomposition — Break the migration into discrete, independently-deployable work packages. Identify what can be separated and what must move together.
- Dependency Mapping — Map dependencies between work packages. Identify the critical path and blocking relationships.
- Sequencing — Order work packages by dependency, risk, and business value. Produce the migration sequence.
- Work Package Definition — Define each work package with scope, acceptance criteria, dependencies, estimated effort, and the Transform/Coexist/Eliminate structure.
- Ticketing System Integration — Push work packages to Jira or Linear as epics and stories (if MCP is available).
The Strangler Fig Execution Model
Each work package follows the Transform → Coexist → Eliminate cycle:- Transform — Build the modernized version of the component using Spec-Driven Development. The legacy component remains untouched.
- Coexist — Run both old and new versions simultaneously. Route traffic through a façade or proxy layer. Validate behavioral equivalence using Behavioral Verification.
- Eliminate — Once the modernized component passes verification, retire the legacy component and remove the façade.
Branch by Abstraction
When a façade can’t intercept traffic — shared libraries, data access layers, deeply embedded utility code — the Strangler Fig pattern doesn’t apply. Branch by Abstraction (coined by Paul Hammant, popularized by Sam Newman in Monolith to Microservices) works from the inside:- Introduce an abstraction layer within the codebase that both old and new implementations can satisfy. This is an interface or adapter that wraps the current implementation.
- Build the new implementation behind the abstraction. Both old and new implementations coexist in the codebase.
- Switch consumers incrementally. Migrate callers from old to new one at a time, validating behavior at each step.
- Remove the old implementation once all consumers have switched. Optionally remove the abstraction layer if it no longer adds value.
Parallel Run (Shadow Traffic)
For high-risk components where behavioral equivalence must be proven in production before cutover — payment processing, financial calculations, regulatory-sensitive logic — Parallel Run provides the strongest verification.- Route copies of production requests to both the legacy and modernized systems simultaneously.
- Compare responses in real time. Flag discrepancies for analysis.
- Run until the discrepancy rate drops below threshold (typically below 0.01% for critical services, below 0.1% for standard services).
- Cut over to the modernized system and decommission the legacy component.
HITL Gate
After Step 4 (Sequencing): The engineering lead reviews the migration sequence, work package definitions, and dependency map before work packages are pushed to the ticketing system. This is the gate where the migration plan is approved for execution.
Step-by-Step Walkthrough
Step 1: Input Loading
Start by loading context from prior phases so all decomposition decisions are grounded in actual assessment and architecture data. Confirm the project and locate prior work:Step 2: Component Decomposition
Break the migration scope into discrete work packages. The goal is to identify the smallest independently-deployable migration units. Identify migration units:Step 3: Dependency Mapping
Map the dependencies between work packages to determine what must happen before what. The following example shows the dependency graph for our hypothetical e-commerce system — work packages arranged in waves, with the critical path highlighted in gold:Solid arrows = hard dependencies (must complete before). Dashed arrows = soft dependencies (easier if done first). Border color indicates strategy: cyan = Replatform, blue = Refactor, purple = Re-architect.Work package dependencies:
Step 4: Sequencing
Order the work packages into a migration sequence. This is where engineering judgment matters most — there’s no single correct sequence, and the right order depends on the team’s risk appetite, business priorities, and capacity. Dependency-driven sequence:Step 5: Work Package Definition
Define each work package in detail. This is the deliverable that feeds execution (Phase 5 of the hub) and the ticketing system. Generate work package definitions:Step 6: Ticketing System Integration
If your agent has a Jira or Linear MCP configured alongside CoreStory, push the work packages directly to your project management system. Create the migration epic (Jira):Linear Integration
Linear uses a different hierarchy than Jira. Map the modernization work packages as follows:- Project = the modernization initiative
- Cycle = each migration wave (group of work packages executed together)
- Issue = one work package (the component being modernized)
- Sub-issue = the three phases: Transform, Coexist, Eliminate
Output Format: Work Package
Each work package follows this template:Prompting Patterns Reference
Decomposition Patterns
| Pattern | Example |
|---|---|
| Migration unit identification | ”Which components share data stores that cannot be split without migrating both sides simultaneously?” |
| Boundary validation | ”Can [component] function correctly as a standalone service while the rest remains on legacy?” |
| Temporary integration scoping | ”If we extract [component] first, what anti-corruption layers and adapters are needed for the remaining legacy components?” |
| Minimal cluster | ”What is the minimal set of components that must be modernized together? Can any be split further?” |
Sequencing Patterns
| Pattern | Example |
|---|---|
| Critical path | ”What is the longest chain of hard dependencies? This determines the minimum migration timeline.” |
| Quick win identification | ”Which work packages have low coupling, high readiness, and few dependencies? These go first.” |
| Parallel opportunity | ”Which work packages have no mutual dependencies and could run in parallel on different teams?” |
| Risk concentration | ”Where in the sequence is the highest risk concentrated? Should we retire that risk early or late?” |
| Integration cost minimization | ”Which sequence minimizes the total amount of temporary integration code (adapters, anti-corruption layers)?” |
Best Practices
Sequence by dependency chain, not by perceived difficulty. Teams often want to start with the “easiest” component. But if that component depends on a shared database that three other components also use, you’ll immediately hit data decomposition challenges. Let the dependency graph drive the sequence, then optimize within the constraints it sets. Start with a quick win. Within the dependency constraints, front-load a work package that’s low-risk, low-coupling, and high-visibility. Proving the methodology works on a real component builds team confidence and organizational support for the rest of the migration. This is especially important for teams that haven’t done incremental modernization before. Don’t underestimate temporary integration work. Every work package’s Coexist phase requires integration between the modernized component and the legacy system. Anti-corruption layers, API adapters, data synchronization mechanisms — this is real engineering work that must be scoped and scheduled. The best sequences minimize the total temporary integration burden. Identify infrastructure prerequisites early. If the target architecture requires an API gateway, event bus, or service mesh, that infrastructure must be in place before component migration begins. Treat infrastructure as “Step 0” work packages with their own timelines and dependencies. Define “done” for each work package before starting. The acceptance criteria — functional, behavioral, performance, integration, operational — should be agreed before the Transform phase begins. This prevents scope creep and provides clear exit criteria for the Eliminate phase. Plan for parallel execution where possible. If two work packages have no mutual dependencies, they can run in parallel on different teams. This is the primary way to compress the migration timeline. The dependency mapping in Step 3 reveals these opportunities. Use the Coexist phase as a safety net. The Coexist phase (running old and new simultaneously behind a façade) is what makes incremental modernization safe. Don’t rush through it. Use it to validate behavioral equivalence, measure performance, and build confidence before cutting over. The façade enables instant rollback if anything goes wrong.Agent Implementation Guides
Claude Code
Claude Code
Setup
- Configure the CoreStory MCP server in your Claude Code settings (see CoreStory MCP Server Setup Guide).
- (Optional) Configure Jira MCP for ticketing integration (see Using CoreStory with Jira).
- Add the skill file:
.claude/skills/decomposition-sequencing/SKILL.md with the content from the skill file below.- Commit to version control:
Usage
Tips
- This skill focuses on Phase 4 of the broader modernization workflow. It expects Phase 3 (Target Architecture) to be complete.
- If Jira/Linear MCP is available, the skill can push work packages directly. If not, it produces structured definitions for manual import.
- Keep the SKILL.md under 500 lines for reliable loading.
Skill File
Save as.claude/skills/decomposition-sequencing/SKILL.md:GitHub Copilot
GitHub Copilot
Add the following to (Optional) Add a reusable prompt file. Create
.github/copilot-instructions.md:.github/prompts/decomposition-sequencing.prompt.md:Cursor
Cursor
Create
.cursor/rules/decomposition-sequencing/RULE.md:Factory.ai
Factory.ai
Create
.factory/droids/decomposition-sequencing.md:Troubleshooting
Everything seems tightly coupled — no clean decomposition points. This is common in monoliths. Look for the components with the lowest fan-in and fan-out — those are your best extraction candidates. If everything truly shares everything, consider a “modular monolith” intermediate step: introduce internal module boundaries within the monolith before extracting services. Ask CoreStory: “Which modules access the fewest shared database tables?” Work packages are too large (multi-month scope). Ask CoreStory more targeted decomposition questions: “What is the smallest independently-deployable subset of [component]?” and “If we extract just [specific feature], what temporary integration points are needed?” The goal is work packages that can be completed in 1–3 sprints. If a component truly can’t be decomposed further, it may need a dedicated team. The dependency graph has circular dependencies between work packages. Circular dependencies usually indicate that the decomposition boundaries are wrong. Ask CoreStory: “Components A and B appear to depend on each other — what specific integration points create this cycle? Can any of them be broken with an anti-corruption layer or event-driven decoupling?” If the cycle can’t be broken, the two work packages should be merged into a single migration unit. Sequencing produces analysis paralysis — too many valid orderings. Start with hard constraints (dependency chain), then optimize for one primary factor: either risk (tackle the riskiest component early to retire risk), or business value (deliver the highest-value modernization first), or team learning (start with the component the team understands best). Don’t try to optimize for everything simultaneously. Jira/Linear MCP is not configured. The work package definitions are the primary output regardless of whether a ticketing MCP is available. Export the definitions as a structured document and import manually. See Using CoreStory with Jira for Jira MCP setup instructions. Agent can’t access CoreStory tools. See the Supercharging AI Agents troubleshooting section for MCP connection issues. Verify the project has completed ingestion by callinglist_projects and checking the status.