CTO AI Corner: How to design AI-friendly architectures?

Let's face it - AI struggles with complex monolithic applications. When the same terminology appears in dozens of places across the codebase, automated context-picking gets confused. And when dependency or call chains become too long, AI can't track them efficiently while debugging or generating new functionality.

Many of us work daily in these massive applications that take years to fully grasp. So, what's the optimal architecture for AI-assisted coding, and how can we gradually refactor monoliths into a more AI-friendly format?

Currently, AI has strict context limitations - more than we often realise. It can only "remember" a limited number of files, dependencies, and interactions at a time. When things get too complex, both humans and AI start making mistakes. The solution? Simplify and minimize context.

How to achieve AI-friendly code?

The good news is we don't need new tricks. The same principles that help humans manage complexity also apply to AI:

✅ Modularization & Encapsulation - Break large systems into coherent, well-defined packages with minimal dependencies.

✅ Clear APIs & Documentation - Ensure APIs are well-documented and structured to avoid unnecessary coupling.

✅ Minimize Side Effects - Keep functions and modules predictable, uniform, and easy to understand.

✅ Automated Testing - Maintain robust test coverage to ensure AI-assisted changes don't introduce regressions.

For humans, it's easier to focus on a single part of the code without worrying about breaking other parts. The same applies to AI.

The AI-specific advantage

Unlike humans, AI doesn't receive onboarding, documentation, or guidance before jumping into a project. But why not give it the same benefits? Before asking AI to tackle complex tasks, provide structured project documentation - architecture overviews, coding standards, and key dependencies.

📌 Use AI to generate concise documentation if it doesn't already exist.

📌 Optimize project-specific prompts with key details AI should always consider.

📌 Guide AI to relevant documentation sources so it can reference them when needed.

Try it out! You might be surprised at how well AI performs in complex environments when given the right support.

March 20, 2025
Authors
Tomi Leppälahti
Share

Leave a message and let's explore together how and where AI can make use of AI.

Thank you for your message! We will be in touch soon.
Whoops! Something went wrong with the form submission.