Legacy Migration Guide
Legacy migration moves older applications, runtimes, databases, and operating processes into a supported architecture while preserving business rules, data integrity, and external contracts.
What is legacy migration?
Legacy migration is the planned movement of older applications, runtimes, databases, and operating processes into a supported architecture while keeping business rules, data integrity, and external contracts intact.
Autohand is useful when the migration has to be practical rather than theatrical: discover the real system, choose one migration slice, preserve contracts, validate old and new behavior, and cut over only when the evidence is good enough.
- COBOL, PL/I, or mainframe workloads moving to Java, .NET, Python, or cloud-native services.
- Monoliths moving toward service boundaries without breaking existing consumers.
- On-premises systems moving to cloud or private cloud with data and compliance constraints.
- Aging internal applications that need supported runtimes and clearer operating ownership.
Migration strategy comparison
The right migration path depends on what must stay stable: infrastructure, code behavior, data model, public contract, or all of them.
| Strategy | Best for | Tradeoff | Validation focus |
|---|---|---|---|
| Rehost | Moving infrastructure quickly with minimal code changes. | Old design problems usually remain. | Environment parity, batch jobs, integrations, and operations. |
| Replatform | Changing runtime or hosting while preserving most application behavior. | Compatibility shims can become long-term debt. | Runtime behavior, config, data access, and performance baselines. |
| Strangler replacement | Replacing one business capability at a time. | Routing, data ownership, and dual operation need discipline. | Contract tests, output comparison, traffic splits, and rollback criteria. |
| Rewrite | Cases where the legacy contract is intentionally being retired. | Hidden business rules are easiest to lose. | Requirements traceability, edge cases, and customer workflow coverage. |
Discovery and inventory
Begin with a comprehensive inventory of the running system. Treat batch schedules, copybooks, databases, queues, reports, manual operations, and downstream consumers as first-class migration inputs.
# Inventory the legacy codebase (read-only)
autohand --path /path/to/cobol --plan -p "Inventory the COBOL programs, copybooks, JCL, and data files in this repo"
# Generate dependency map
autohand --path /path/to/cobol -p "Map program, copybook, and dataset dependencies; write the map to docs/deps.json"
# Identify business logic hotspots
autohand --path /path/to/cobol -p "Identify the programs with the densest business rules; write the findings to docs/business-rules.md"
Review the inventory, dependency map, and hotspot report Autohand writes, and correct anything it got wrong before planning slices. Together they form your catalog of programs, copybooks, data structures, and inter-system dependencies.
Plan the first migration slice
A migration slice should have a clear business capability, known consumers, testable inputs and outputs, and rollback criteria. Start smaller than the org chart suggests.
- Boundary: define the program, workflow, API, job, or data domain being replaced.
- Consumers: list every caller, batch dependency, report, and human operator affected.
- Equivalence: decide which outputs must match exactly and which can intentionally change.
- Rollback: define the operational path back to the legacy behavior before cutover.
# docs/migration-plan.yaml (a plan file in your repo; reference it from AGENTS.md or your prompts)
strategy: refactor
source:
language: cobol
compiler: enterprise-cobol
target:
language: java
framework: spring-boot
database: postgresql
options:
preserve_comments: true
generate_tests: true
documentation_level: detailed
Phased execution
Execute the migration in phases that produce reviewable artifacts. Each phase should update code, tests, docs, and the migration inventory together when those surfaces are affected.
# Phase 1: Convert data structures
autohand --worktree data-models -p "Following docs/migration-plan.yaml, convert the copybook data structures to Java records"
# Phase 2: Migrate business logic
autohand --worktree business-logic --auto-mode "Migrate the business-logic programs listed in docs/migration-plan.yaml to Spring Boot services, one program at a time" \
--max-iterations 50 --checkpoint-interval 5 --max-cost 20
# Phase 3: Integration layer (preview as a patch, keep existing API contracts)
autohand -p "Build the integration layer without changing existing API contracts" --patch --output apis.patch
git apply --check apis.patch
# Validate each phase
mvn test
Parallel validation
Parallel validation runs legacy and modern behavior against the same important cases, then compares outputs, writes, errors, and timing where those values matter.
# Generate comparison tests
autohand -p "Generate equivalence tests that send the same inputs to the legacy service (localhost:8080) and the modern service (localhost:9090) and compare responses"
# Run parallel execution
mvn test
# Compare outputs
autohand -p "Summarize the equivalence test results and every output mismatch; write the report to reports/equivalence.md"
Use production-like fixtures when possible. If exact parity is impossible or undesirable, record the intentional difference and the owner who approved it.
Cutover planning
Plan the transition from legacy to modern systems before the replacement is complete:
- Define rollback procedures for each migration slice.
- Set up traffic splitting or job routing for gradual migration.
- Establish data synchronization, reconciliation, or read-only windows during transition.
- Document runbooks, ownership, alerts, and support paths for the new system.
Legacy migration FAQ
What is legacy migration?
Legacy migration moves older applications, runtimes, databases, and operating processes into a supported architecture while preserving business rules, data integrity, and external contracts.
How is legacy migration different from code modernization?
Legacy migration usually changes the runtime, architecture, hosting model, or system boundary. Code modernization can happen inside the existing system without moving the whole application.
How does Autohand verify a migrated system?
Autohand maps dependencies, generates migration tasks, runs old and new behavior in parallel where possible, compares outputs, and records evidence for reviewers and operators.