Research

Superlinear Logo

Your Codebase is a Monolith.
AI is Coming for It.

Software Architecture 2.0

[Part One]

Published: March 2025

Early in my career, an engineering leader shared a valuable lesson:

“Your first job is to write code I can understand. Your second job is to write code that works.”

We've optimized our codebases for human readability and collaboration. But the rapid evolution of AI coding assistants means that now, we're not just coding for human teammates; we're coding alongside AI engineers that operate under vastly different constraints.

Your code will be read, modified, and extended by both human and AI engineers, and our sprawling, interconnected codebases are poorly suited for AI collaboration. The advice emphasizing readability now takes on new meaning.

The Core Problem: AI's Limited Context Window

Today's large language models (LLMs)—the backbone of tools like Copilot, Claude Code, Windsurf, Cursor and other code-generation tools are powerful but face a crucial limitation: their limited context window.

This “short-term memory” typically fits individual classes or smaller code segments, not entire codebases. For AI to approach human-level accuracy and usefulness, it needs not only code but also the broader product context humans inherently have: product decisions, design documents, API documentation, domain knowledge, inspiration, and more.

This limitation is further compounded by the fact that the AI's generated output itself consumes part of the limited context window. Attempting large rewrites or extensive modifications with detailed prompts can easily lead to context overflow, significantly hindering the AI's effectiveness.

Research such as the needle in a haystack test demonstrates that even when input tokens fit within a model's defined context window, the model's performance deteriorates as the context window fills up. Notably, these tests merely involved retrieving a single fact from a large context, not deeply understanding or integrating multiple complex contexts.

AI code assistants struggle with monolithic codebases in predictable ways:

  • Increased Code Redundancy: AI tools, lacking global context, unknowingly reimplement existing features hidden deep within the system. Humans already inadvertently create redundancy; AI exacerbates it significantly.
  • Logic Drift and Subtle Bugs: When AI operates on a limited context window, subtle errors and inconsistencies creep in, akin to a surgeon lacking the patient's medical history.
  • Feature Regression and Side Effects: Complex systems rely heavily on implicit dependencies. An AI making seemingly isolated changes can unintentionally break existing functionality.

These aren't hypothetical concerns; early AI-adopters have already encountered these patterns, highlighting AI's difficulty navigating monolithic architectures.

Introducing Software Architecture 2.0: Optimized for AI

To leverage the full potential of AI coding assistants, we must rethink our software architectures. We need Software Architecture 2.0—architectures designed explicitly for easy navigation by AI and humans alike.

Priority #1: Extreme Modularity and Isolation

At its core, Software Architecture 2.0 prioritizes extreme modularity and isolation. Instead of skyscraper-sized monoliths, think of your architecture as a city of smaller, interconnected buildings. Each module should be:

  • Context Window-Friendly: Small enough to fit entirely within an AI's context window, maximizing the effectiveness of AI-driven code assistance.
  • Independently Understandable: Self-contained, with minimal dependencies, enabling both humans and AI to quickly grasp functionality.
  • Explicitly Defined with Clear Interfaces: Clear APIs reduce cognitive load and streamline AI interactions, avoiding unintentional side effects.
Priority #2: Languages with Robust Code Analysis and Introspection

The second critical priority is adopting languages and tools with robust code analysis, introspection capabilities, and powerful language servers (e.g., TypeScript, Rust, Elixir, Go). Historically, good tooling was always valuable but often considered a secondary factor. Now, its importance has significantly increased because AI assistants rely heavily on these capabilities to understand and navigate code effectively. Clearer introspection directly enhances the AI's ability to produce accurate, context-aware code.

Priority #3: Rapid, Comprehensive Testing

Fast, reliable test suites significantly boost productivity, particularly since AI-generated code doesn't always get things right on the first attempt. Rapid testing and robust checks enable quicker iteration cycles, helping AI detect and self-correct mistakes iteratively, ultimately enhancing code reliability and developer confidence.

Why Rewriting Could Actually Make Sense This Time

Joel Spolsky famously called rewrites “the single worst strategic mistake” a software company can make.

25 years later, in the age of AI, the calculus might have shifted - especially considering that AI itself can carry out much of the rewriting process.

If re-architecting your software to better harness AI actually unlocks the productivity of nearly “free” AI engineers, the long-term payoff could be enormous. A one-time strategic rewrite—especially incremental—could substantially outweigh the ongoing cost and friction of maintaining a monolith that AI struggles to navigate effectively.

This scenario could genuinely be one of the rare exceptions where rewriting isn't just justified but strategically essential to leverage the transformative potential of AI.

Maybe today isn't the day, but it's coming very very soon.

Practical Steps for Transitioning

Transitioning to AI-friendly architecture involves:

  • Incremental Modularization: Gradually extract features and domain logic into independent modules.
  • Adopt Modular Design from Day One: Strictly enforce small modules and clear interfaces in new development.
  • Leverage Modular Architectural Patterns: Patterns such as hexagonal architecture, bounded contexts, or component-based design inherently promote AI-friendly modularity.
  • Enforce Small, Focused Code Units: Use linting and coding standards to keep functions and files small and manageable.
  • Invest Heavily in Rapid Testing: Prioritize comprehensive, fast-running unit tests, empowering rapid iteration and verification by AI.

AI coding assistants aren't a passing trend; they're reshaping software engineering. Architecting our systems for seamless AI navigation isn't just accommodating machines—it's enhancing software quality, reliability, and maintainability for both humans and AI.

Part Two coming soon: We'll explore concrete case studies and explore practical tooling and languages best suited for the AI-enhanced coding landscape.

Authors: Eaden McKee, Superlinear Research Team

Research Hub ->

View all research reports and publications.

AI Solutions ->

Discover how we apply our research in practical business solutions.