Lossless Semantic Tree (LST)

The compiler-accurate, format-preserving code model that makes safe, automated modernization possible across thousands of repositories.

Modern code transformation needs a better model

Most tools rely on ASTs or text search, which weren’t built for today’s massive, polyglot, multi-repo systems.

  • Types and symbols are missing – refactorings break when the model can’t resolve class hierarchies, generics, or dependencies.
  • Formatting and comments are lost – developers won’t trust PRs that rewrite code but strip intent.
  • Scale breaks down – parsing each repo in isolation makes cross-repo upgrades slow, brittle, and inconsistent.

The result: manual review, fragile scripts, and stalled modernization when enterprises need to move thousands of repositories forward safely.

51% of organizations report having attempted six or more rewrite projects due to failed modernization.

Changing one line is easy.

Transforming thousands of repos safely and consistently is not.

WHAT IS THE LOSSLESS SEMANTIC TREE (LST)

The Lossless Semantic Tree (LST) is a high-fidelity, compiler-accurate map of your source code — built on OpenRewrite — that powers safe, repeatable refactoring at scale.

Deep code understanding. 

  • Captures everything the compiler knows — full type attribution, symbol resolution, generics, inheritance, transitive dependencies.
  • Preserves formatting, comments, and style, so diffs are clean and reviewable.
  • Works across multi-repo, multi-language estates — generate once, cache, and reuse.

Safe, automated modernization.

  • Confidently apply accurate, consistent changes across thousands of repositories.
  • Avoid false positives and breaking builds.
  • Trust that automated changes behave exactly like hand-written refactors — but at automation speed.

how the LST powers modernization at scale

  • Global semantic search & impact analysis — find APIs, patterns, and dependencies across your entire estate before changing a line.
  • Deterministic, multi-repo transformations — apply one recipe safely across thousands of repositories in parallel.
  • Reuse & speed — LSTs are generated once, cached, and reused for faster, iterative campaigns.
  • AI augmentation — The LST gives AI agents structured, compiler-accurate context to reason from, enabling faster analysis, more reliable suggestions, and deterministic execution at scale.

“Moderne made it safe to jump multiple Java versions in a single wave, instead of doing slow, incremental migrations.”

Stephen Cihak, Senior Director
Choice Hotels

Why LST Matters

The right change at the right cursor position, across hundreds of millions of lines of code, without breaking anything.

Type attribution

Type attribution in the LST reveals what every variable, method, and symbol actually refers to—not just what it looks like. It resolves types across files, libraries, and even transitive dependencies, enabling tools to distinguish similar-looking code, avoid false positives, and make precise, safe changes.

Type attribution makes code transformations trustworthy.

Format fidelity

The LST retains formatting details—indentation, spacing, imports, and comments—so code changes look and feel like they were written by the team itself. This matters: developers are far more likely to review, trust, and merge changes when presented in clean, idiomatic diffs.

Format fidelity turns automation from disruptive to seamless.

With serialized LSTs, you're working on your entire software system as a unified whole—making large-scale code transformation not only possible, but safe, auditable, and efficient.

Abstract Syntax Tree (AST)

Lossless Semantic Tree (LST)

Compiler Accuracy

Shallow syntax only; limited or no type info, weak cross-module understanding.
Full type attribution, symbol resolution, generics, inheritance, and transitive dependencies.

Format fidelity

Loses formatting and comments; diffs are noisy and hard to trust.
Keeps formatting, comments, and structure for clean, reviewable diffs.

Scale

Single-repo bound; fragile when scaled across large portfolios.
Designed for multi-repo, multi-language estates; LSTs can be cached and reused.

Safety

Fragile; regex-like transformations often break builds.
Deterministic, reproducible changes that behave like hand-written refactors.

AI

Context poor; AST alone can’t safely guide AI refactoring.
Precomputed, compiler-accurate context powers reliable agent reasoning, eliminating token waste, reducing hallucinations, and enabling deterministic execution at scale.

Real-world context for AI-driven refactoring

To modernize code reliably with AI, you need more than a prompt—you need structured access to your actual codebase.

With the LST, AI doesn’t just see that a method exists—it understands how that method connects to the rest of the system, what it depends on, and what downstream effects a change might trigger. This enriched context makes AI more useful for analysis, summarization, and identifying what should change.

Leveraging OpenRewrite recipes as tools, AI agents can access structured insights in the form of data tables and reports, turning the LST into a living source of organizational knowledge. These recipes make analysis auditable and repeatable, and when change is required, they apply it safely, consistently, and at scale.

The long-term value isn’t just in the model—it’s in the data that guides it, and the systems that operationalize its output.

What can you do with LST

Semantic code search

Find API calls, dependences, or type references across repos.

Security

Identify and patch vulnerable code paths programmatically

Modernization

Safely migrate frameworks/libraries

Compliance & standards

Search + enforce coding conventions automatically

Artificial intelligence (AI)

Power coding agents with precomputed, resolved context, reducing token costs, preventing hallucinations, and enabling coordinated change across repositories.

Dive Deeper

blog

What is the Lossless Semantic Tree (LST) code model?

Dive deeper into the LST and how it enables automated refactoring and analysis at scale.

Agent Tools

Scale agent workflows across the organization

Structured knowledge, precision targeting, and deterministic execution infrastructure that empowers coding agents.

product

Transform code at enterprise scale

Built on the Lossless Semantic Tree, Moderne unifies large-scale code transformation—bringing accuracy, consistency, and automation to every layer of your stack.

Frequently Asked Questions

What is a Lossless Semantic Tree (LST)?
How is LST different from an Abstract Syntax Tree (AST)?
What is semantic code search?
How does LST improve automated refactoring?
Can the LST handle multiple languages?
Why does the LST preserve formatting?
Can the LST be used with AI-driven code analysis?
How does the LST support coding agents?
What is Moderne Prethink and how does it relate to the LST?