DEV Community

Paulo Eremita
Paulo Eremita

Posted on

Legacy systems are rarely hard because of syntax

Legacy systems are rarely hard because of syntax.

They are hard because knowledge is fragmented.

A controller points to a facade.

A facade touches a model.

A model hides SQL.

A UI action triggers behavior through includes, query strings, and conventions nobody fully documented.

The database has its own story.

The team has another one.

And the code sits there like an archaeological site pretending to be an application.

I wanted a better way to understand systems like that.

So I built an AI-assisted workbench for legacy system analysis.

The real problem

When engineers talk about "understanding a legacy system", the usual tools are often too weak for the job:

  • manual grep is fast but shallow
  • one-off scripts solve one question at a time
  • raw LLM prompting without structure can sound smart while being operationally unreliable
  • database inspection is often disconnected from code inspection
  • UI behavior, backend flow, and schema meaning are rarely analyzed together

In real maintenance and modernization work, that gap hurts.

You are not just trying to read code.

You are trying to reconstruct intent.

What I built

The project became a Python-based analysis workbench focused on legacy systems, especially codebases where behavior is spread across:

  • PHP files
  • includes
  • facades and models
  • SQL Server schemas and procedures
  • UI-triggered backend flows
  • structural artifacts like GraphML and domain maps

The idea was simple:

don't ask AI to guess the system

first extract structure, then let AI comment on something real

That principle shaped the whole tool.

Core capabilities

The workbench combines multiple analysis layers:

  • static code scanning for risky and suspicious patterns
  • method and dependency tracing
  • include resolution
  • SQL Server schema inspection
  • stored procedure analysis
  • UI flow analysis from HTML and JavaScript surfaces
  • domain map generation from structural artifacts
  • AI commentary with prompt templates and response caching

So instead of running isolated scripts, I can move through the system with a more connected workflow.

Why AI is in the loop

I did not want AI to replace analysis.

I wanted it to amplify analysis.

The difference matters.

If you throw raw code at an LLM and ask "explain this system", you may get polished nonsense.

If you first extract methods, dependencies, SQL blocks, tables, actions, and context, then AI has something solid to work with.

In this project, AI becomes:

  • a technical commentator
  • a summarizer of structured findings
  • a helper for generating readable reports
  • an assistant for identifying risks and improvement opportunities

Not an oracle.

A tool.

That distinction is one of the most important lessons I keep learning in applied AI engineering.

Some design decisions I care about

A few things made this project much better than a simple "LLM + code" experiment.

1. Structured before generative

The system extracts real artifacts before asking for commentary.

That includes things like:

  • method signatures
  • dependency trees
  • SQL fragments
  • table metadata
  • UI actions
  • procedure summaries

This reduces hallucination risk and improves signal quality.

2. Caching AI outputs

If an analysis has already been generated for the same structured input, the tool can reuse it.

That saves cost, reduces latency, and makes the workflow more practical during repeated investigation.

3. Multiple analysis surfaces

Legacy understanding is not only about code files.

Sometimes the truth is in:

  • a table relationship
  • a stored procedure
  • an include chain
  • a UI event
  • naming patterns in domain entities

The tool had to support that reality.

4. Markdown-first outputs

I wanted outputs that humans could read, share, compare, and refine.

So a lot of the workflow is oriented around report generation instead of opaque internal state.

What surprised me

The most interesting part was realizing that legacy analysis itself can be treated as a product problem.

Not a script problem.

Not a one-time debugging problem.

A product problem.

Because the real value is not just "finding a file".

It is building a repeatable way to turn unknown systems into understandable systems.

That changes how you think about tooling.

What this project is not

It is not:

  • a fully autonomous agent
  • a universal code intelligence platform
  • a replacement for engineers with domain knowledge

It is a workbench.

A serious one, I hope.

Its job is to help engineers think better and move faster in ugly, under-documented systems.

Why I made a public version

The original tool came from a real internal context, so the public repository is a sanitized case study.

I removed environment-specific paths, generated artifacts, internal identifiers, and project-specific traces.

But I kept the architecture, the workflow ideas, and the engineering intent.

Because I think this is a problem many teams have:

how do we understand legacy systems with more rigor and less guesswork?

Final thought

I like building applications.

But more and more, I also like building the tools that help engineers understand, migrate, and modernize complex systems.

This project sits right in that space.

If you work with legacy code, reverse engineering, modernization, or AI-assisted development, I’d love to hear how you approach this problem.

Repo:
legacy-analysis-workbench

Top comments (0)