The modernization target cannot be designed until someone understands what the legacy system actually does — and the people who knew retired. Large-context AI reads the COBOL, the aging .NET, the stored-procedure sprawl, and drafts the capability map and interface inventory that feed the target design. The architect consumes the map; the map is not the truth until sampled.
Tier: Core · Hands-on time: ~30 minutes
Legacy comprehension is the workload that agentic migration vendors lead with — AWS Transform's marketing counts billions of lines analyzed, which is evidence of demand whatever you make of the number. The architect's version of the job is narrower and more designable: not transforming the code, but extracting what the system does (capabilities), where it touches the world (interfaces), and which behaviors are load-bearing — as inputs to target-architecture design. Models with large context windows and repo-aware agents like Claude Code are genuinely strong here, with one systematic bias to manage: code describes what the system does, not why, and a model narrating legacy code will confidently supply the why it cannot know.
Skip AI when living experts and current documentation exist — interview first, and use the model to check the code against what the experts believe (the disagreements are gold), not to rediscover what is already known.
Index before comprehending. First pass is cartography, not reading: "Traverse the repository and produce an inventory — entry points (jobs, endpoints, triggers, scheduled tasks), major modules with one-line guesses at purpose, external touchpoints (connection strings, file paths, queue names, API URLs), and dead-looking code (unreferenced modules). Cite file paths for everything; mark every purpose guess as GUESS." The index scopes the deep passes and immediately surfaces the system's true perimeter, which is reliably larger than anyone remembered.
Extract capabilities with evidence discipline.
Deep-pass the order-management modules (list attached from the index).
Produce capability-map entries:
- CAPABILITY: what the system does, stated as a business function
("applies volume discounts at invoice generation"), not a code
summary ("loops over line items").
- EVIDENCE: the specific files, procedures, or jobs implementing it.
- BUSINESS RULES: encoded rules with the code location — thresholds,
date logic, special cases. Quote the constant, cite the line.
- INTERFACES: what this capability consumes and produces (tables,
files, messages, calls), with direction.
- WHY-UNKNOWN: where the code implies intent you cannot verify
(special-case handling, magic values, commented-out logic), list
it here as a question — do NOT explain it away with a plausible
story.
The WHY-UNKNOWN column is this playbook's load-bearing wall. A 2009 special case for one customer ID is exactly what a model will smooth into "handles legacy customer edge cases" — and exactly what the target design must decide to preserve, kill, or escalate.
Build the interface inventory as its own artifact. Consolidate every interface across capabilities into one table — consumers, producers, protocols, formats, schedules — and cross-check it against the analyzer export and network-flow data where available (pb-24's verified edges serve double duty). Interfaces the code shows but flows never confirm are candidates for dead; interfaces flows show but the code doesn't explain are the terrifying kind — both lists go to humans.
Sample the map against the code — stratified, not random. Verification effort goes where wrongness is expensive: every capability marked as owning data (a misread there corrupts the target's data architecture), every business rule with a quoted constant (open the file, confirm the quote and its context), and a random handful of the rest. Score the sample; a batch with fabricated evidence citations gets its whole module re-passed, because comprehension errors cluster.
Interrogate the map with the people who remain. Present the capability map to whatever institutional memory exists — ops staff, the DBA, the business analyst who filed the change requests. Their corrections and their confirmations both matter, but their surprises matter most: a capability nobody knew existed is either dead weight or a silent dependency, and the WHY-UNKNOWN list is the interview agenda.
Hand the map to design, with confidence attached. The deliverable set for the target-architecture work: capability map with per-entry confidence, interface inventory with verification status, the business-rules register, and the open WHY-UNKNOWN questions. Vikram's rule for his BFSI core-adjacent systems: no capability enters the target design's "replace" column while its confidence is low — low-confidence capabilities get discovery tasks, not design decisions.
Legacy source is often the client's most guarded IP — and in BFSI, the code encodes regulated business logic. Process inside the boundary without exception: Claude Code against the client-tenancy endpoint, or local models over a cloned repo for air-gapped estates (comprehension quality drops with model size; compensate by narrowing passes and doubling the sampling rate). Mainframe estates add a practical wrinkle — code often lives outside git in library managers; the extraction into reviewable text is itself a controlled operation under the client's change process. Analyzer exports usually contain hostnames and connection strings: scrub before any external processing, though inside-boundary processing makes scrubbing moot.
The code tells the model what; only evidence tells you it's true; and nobody living may know why. Ship the capability map with its confidence column and its open questions — a legacy map that claims total understanding is the one artifact you can be certain is wrong.