Integrating AI Guidance Into Legacy Codebases

AI Guidance Technical Debt

Last updated: 13 September 2026

What is AI guidance when the codebase is already old?

AI guidance, in a legacy setting, is model-backed help for reading, changing, and deciding about code that already exists: navigation, review comments, refactor hints, and risk flags. It is not a blank-page generator. Abas Kadar’s August 2024 paper is about why that help is hard to install when the system is unstructured, high-debt, and written with tools the model barely knows.

The productivity pitch for AI in software development is now familiar: faster edits, better quality, sharper decisions. Kadar does not spend the page on that pitch. The research article starts from the mismatch. Challenges come from code structure, technical debt, outdated frameworks, and a lack of standardized documentation. Legacy systems, often built with older languages or obsolete tools, make a seamless drop-in of AI frameworks unlikely. A working-paper copy is also on SSRN as abstract 5150449. This piece stays with the obstacle list, because that is where most teams actually get stuck.

"Guidance is only guidance if it can see the system you have, not the system the training set wished you had."

If you have already read strategy papers on applying AI to legacy code, treat this one as the inverse. Katragadda-style roadmaps tell you what to do. Kadar tells you what will fight you: spaghetti structure, lost architecture, models that will not adapt, debt that multiplies suggestions, and languages that left the mainstream before the current models were born.

Why does unstructured code break AI assistants?

Unstructured code breaks AI assistants because they lean on consistent modules, names, and comments to infer intent. When those cues are missing, a suggestion can compile and still violate an unwritten rule. Kadar lists dealing with unstructured code as a primary obstacle. It is not a taste issue. It is a signal issue.

Think of the files everyone is afraid to format. Logic is copied. Names mean different things in different decades. A 2,000-line routine mixes I/O, business rules, and a workaround for a vendor bug from 2009. An assistant trained on small, named functions will try to “clean” that routine. Cleaning, without a map, is how you delete the workaround and rediscover the vendor bug in production.

The practical response is not to wait for perfect structure. It is to give the model more structure than the raw file has: a recovered call graph, a list of entry points, characterization tests, and a human who can say “this block looks dead and is not.” Guidance that starts with “explain this file” is safer than guidance that starts with “rewrite this file.” Kadar’s emphasis on unstructured code is a warning against skipping the explain step.

Signs your code is unstructured for a model

  • No stable module boundaries, or files that grew by accretion
  • Comments that contradict the code, or no comments at all
  • Copy-paste variants that look similar and behave differently
  • “Do not touch” regions that encode production knowledge

How do you recover legacy architecture so guidance can land?

You recover legacy architecture by mapping how the running system actually talks to itself, not how a faded diagram said it should. Kadar names understanding legacy architecture as a key obstacle. AI guidance that does not know the intended layers will suggest a shortcut across them. That shortcut is often the original sin that created the debt.

Older systems rarely have a current architecture doc. The real architecture is in job schedulers, stored procedures, shared disks, and a wiki last edited before a reorg. Recovering it is slow: trace a transaction, list the downstream jobs, mark which databases are canonical. An assistant can help summarize a directory or sketch a call graph. It cannot tell you that two services share a table because of a 2014 outage unless that story is in the context you provide.

Once you have even a coarse map, guidance gets safer. You can tell the model “stay inside the reporting path” or “do not touch the posting engine.” You can also see where a suggestion would cross a boundary. Architecture recovery is therefore not a museum project. It is the precondition for any AI-guided change that is larger than a local rename.

What to recover first

Entry points, data stores, batch windows, and the handful of modules that every incident seems to mention.

What can wait

Pretty C4 diagrams, a full domain rewrite, and naming every leftover script from a retired product line.

Why does technical debt make AI guidance riskier?

Technical debt makes AI guidance riskier because the model will either copy the shortcuts or fight them without knowing why they exist. Kadar groups debt with outdated frameworks and missing documentation. Debt is not only ugly code. It is unpaid cost: missing tests, duplicated rules, libraries that cannot be upgraded, and knowledge that left with people.

An assistant trained on cleaner public code will propose a “proper” pattern that your runtime cannot host. An assistant that overfits to your debt will generate more of it, faster. Both outcomes are failures of guidance. The first breaks the build. The second looks productive in a sprint chart and expensive a year later.

The workable path is to pay down just enough debt to create seams: tests around a module, an interface in front of a frozen library, a document for the workaround you are not ready to delete. Then let guidance operate inside the seam. Trying to use AI to “remove all debt” in one pass is how you get a second, AI-shaped debt layer on top of the first. Kadar’s challenge framing is useful here. The problem is not that AI cannot see debt. The problem is that debt is load-bearing until you prove otherwise.

Outdated frameworks sit next to debt and are easy to confuse with it. A frozen library is debt if you could upgrade and have not. It is a constraint if the vendor is gone and the certificate is pinned. Guidance that cannot tell the difference will recommend an upgrade path that does not exist. Missing standardized documentation makes that confusion worse. When every team names the same service differently, the model’s “architecture summary” is a fiction with good grammar. Kadar’s pairing of debt, frameworks, and docs is the right cluster. They fail together. They have to be treated together.

There is also a measurement trap. A team can count accepted suggestions and call the pilot a success while production incidents cluster in the files the bot touched. Guidance that increases short-term edit speed and long-term confusion is not the quality improvement the paper is aiming at. Track reverted patches, incident overlap, and time-to-understand a module before and after the assistant arrived. If those numbers do not move, you have installed a toy, not a practice.

How should AI models adapt to older languages and tools?

AI models should adapt to older languages and tools by being constrained, fine-tuned, or wrapped so they speak the stack you actually run. Kadar flags adaptability as a core obstacle. Legacy systems were often built with older programming languages or obsolete tools. A seamless implementation of current AI frameworks on top of that is the exception, not the default.

Adaptability has three layers. The model layer: extra examples in COBOL, Fortran, PL/I, classic Visual Basic, or whatever you have, plus retrieval from your own tree. The toolchain layer: parsers, formatters, and test harnesses that still work on that language, because an assistant that emits code you cannot compile is not guidance. The workflow layer: IDEs, review bots, and change windows that match how the system is already released, often in overnight batches rather than continuous deploys.

Challenge What goes wrong What adaptability looks like
Unstructured code The model invents structure that is not there Explain and map first, change later
Lost architecture Suggestions cross hidden boundaries Recover entry points and data stores
Technical debt Shortcuts are copied or naively deleted Pay down a seam, then guide inside it
Older languages Output targets a stack you do not run Language-specific context and compilers

If the table looks conservative, that is the point. Kadar is writing a challenge paper. Optimism without adaptability is how a team spends a quarter generating Java-shaped advice for a COBOL shop, or Python snippets for a locked-down mainframe editor. Match the guidance to the language, or do not call it integrated.

What does a challenge-first roadmap look like in practice?

A challenge-first roadmap starts by naming the obstacle that will actually kill the pilot, then designs the smallest guidance loop that can survive it. Kadar’s aim is long-term efficiency, scalability, and code quality, not a weekend rewrite. The sequence is understand, constrain, then assist.

Week one is diagnosis. Is the blocker unstructured files, a missing architecture map, debt without tests, or a language the model cannot parse well? Week two is a guardrail: tests, a recovered diagram, a language pack, or a rule that the assistant may only comment, not edit. Week three is a narrow task: explain a module, flag duplicates, or propose a rename in a well-covered area. Only after that do you let guidance touch behavior.

Older languages deserve a dedicated pass in that diagnosis. A model that is fluent in TypeScript may still be clumsy in COBOL, Fortran, PL/I, or a vendor 4GL that never had a public corpus. Kadar’s note that legacy systems were often built with older programming languages or obsolete tools is easy to nod at and then ignore in a tool-selection meeting. Ignore it and you will spend the pilot teaching the assistant a language it cannot compile. Include it and you may decide that the first guidance job is documentation recovery, not code generation: have the model explain a paragraph of procedural code, have a specialist correct the explanation, and store that pair as future context.

Documentation recovery is not glamorous, and it is one of the few tasks where a wrong answer is cheap if a person still checks it. A wrong generated patch is expensive. Kadar’s challenge list is, in that sense, also a priority list. Unstructured code and missing architecture are comprehension problems. Technical debt and outdated frameworks are change problems. Adaptability is a tooling problem. Solve comprehension first. Teams that invert that order, and ask for autonomous edits on day one, are not integrating AI guidance. They are generating new unstructured code on top of the old.

If you need a sentence for a steering committee, use this. AI can raise productivity, code quality, and decision quality on a legacy estate, and it will not do so until the system is visible enough for the model to be wrong in a way you can catch. Visibility is docs, structure, architecture, and tests. Guidance is what you add after visibility. That order is the whole paper, restated for people who will not read five pages of challenge analysis and still want a plan for Monday.

Keep the scope of “guidance” honest in that plan. Kadar is not arguing for an autonomous maintainer. He is arguing that suggestions, reviews, and navigation can help if the obstacles are treated as design inputs. Unstructured files, lost architecture, debt, outdated frameworks, and older languages will still be there on day ninety. The question is whether your AI loop has learned to see them, or whether it is still pretending they are noise.

Try a guidance pilot that can fail safely

Comment-only mode: the model explains and questions, people still type the patch

One language, one path: do not mix a COBOL batch and a Java API in the first experiment

Architecture on the prompt: paste the recovered map, or the model will invent one

Debt as a budget: count reverted AI patches as new debt, not as learning

The paper’s contribution is the refusal to skip that diagnosis. Integrating AI guidance into a complex legacy codebase is possible. It is not seamless. Unstructured code, lost architecture, stubborn debt, and older languages are not side quests. They are the work. If you treat them as the work, guidance can improve how you maintain and evolve the system. If you treat them as noise, the assistant will be another source of changes nobody fully understands, which is the one thing a legacy estate cannot afford.

Frequently Asked Questions

What is AI guidance in a legacy codebase?

AI guidance is model-backed help for reading, changing, and deciding about existing code: suggestions, reviews, and navigation, not a greenfield generator. Kadar’s 2024 paper is about putting that help into systems that are unstructured, high-debt, and often written in older languages, where the usual assistant assumptions fail.

Why is unstructured code a problem for AI tools?

Unstructured code lacks consistent modules, naming, and comments. Assistants rely on those cues to infer intent. Without them, suggestions can be locally valid and still violate an unwritten contract. Kadar treats dealing with unstructured code as a first obstacle, not a style complaint.

How does technical debt interfere with AI guidance?

Technical debt is the extra cost of past shortcuts: duplicated logic, frozen libraries, missing tests. An assistant trained on cleaner code will propose patterns that do not fit, or it will copy the debt faster. Kadar groups debt with outdated frameworks and missing documentation as reasons guidance is hard to drop in.

Can AI models adapt to older programming languages?

They can, but not automatically. Legacy systems often use older languages and obsolete tools that current models under-represent. Kadar’s adaptability point is that the model, the parsers around it, and the workflow have to be adjusted to that stack. Otherwise the guidance is a translation into a language the runtime does not speak.

What does a roadmap for AI guidance on legacy systems include?

The paper’s roadmap is challenge-first: understand unstructured code, recover the architecture, reduce enough debt to create seams, and make the model adaptable to the stack. The goal is long-term efficiency, scalability, and quality, not a one-shot rewrite. Humans still have to validate guidance against production behavior.

Related articles