# Katie Roberts - Stop Maintaining, Start Evolving: Applying AI-Native Practices to Brownfield Codebas

## Executive summary

This talk addresses the challenge of modernizing complex, legacy 'brownfield' codebases—systems that are highly successful but burdened by accumulated technical debt and tribal knowledge. The speaker outlines how to apply AI-Native Engineering practices not for adding new features, but for architectural reclamation. Key strategies include using established patterns like the Strangler Fig Pattern and Branch by Extraction, coupled with structured processes (e.g., creating a 'plan skill') to systematically pay down technical debt while maintaining continuous function.

## Key takeaways

- AI should be used for paying down technical debt, not adding to it.: Autonomous agents deployed without strict guardrails can cause havoc through over-optimization or generating 'dark code,' undermining implicit architectural constraints and creating new hidden technical debt. Safety and bounded scopes are paramount.
- Adopt a structured approach to brownfield modernization.: Instead of starting with the code, begin by conducting forensic investigations using developer input (eyewitness accounts) and creating objective data visualizations (e.g., value vs. complexity graphs) to identify high-priority areas for improvement.
- Prioritize planning over immediate migration.: In brownfield environments, the planning phase is critical. Focus on creating a structured roadmap and defining clear contracts (specs) before writing code to ensure the right thing is built.
- Use AI-assisted skills for process automation.: Implement multi-agent flows ('skills') that automate tasks like generating PRDs from documentation, creating Jira tickets, and performing detailed code mapping. This accelerates development cycles (e.g., reducing 6 months of work to 8 weeks).

## Technical details

- Brownfield Codebases Challenges: Common issues include accumulated technical debt, dependency rot (e.g., upgrading Node taking months instead of days), 'fear-driven development' areas, and tightly coupled systems resulting in high maintenance costs.
- Pseudo Greenfield Development: A temporary isolation strategy where new features are developed outside the legacy system. Caution is advised as this can lead to duplication of shared concerns (e.g., authentication, logging) and divergence, making reintegration expensive.
- Strangler Fig Pattern: A method for system replacement with no downtime. It involves intercepting functionality at the edge by creating a facade around the old code, allowing new services to gradually take over responsibility one slice at a time.
- Branch by Extraction: Working from inside the codebase. An interface is placed within the existing code, and a new implementation is branched out behind a feature flag. This keeps the system 'trunk releasable' at all times and allows for direct comparison of old vs. new behavior in production.
- AI Guardrails: When using AI agents, it is crucial to maintain strict guardrails. Agents can hallucinate or cause havoc through over-optimization and generating 'dark code' that passes tests but undermines architectural constraints.

## Practical implications

- When facing technical debt in a monolith, evaluate the Strangler Fig Pattern for large-scale replacement or Branch by Extraction for internal component improvements.
- Do not deploy AI agents without bounded scopes and human oversight; use them to generate objective data (e.g., dependency graphs, dead code paths) rather than making autonomous refactors.
- Formalize a 'plan skill' that captures all technical and product considerations before development begins, treating the specification as the primary contract.
- Implement robust CI/CD practices by ensuring static analysis tools (like SonarQube) are fully operational and integrated into the process.

## Topics

Software Architecture, Technical Debt Management, AI Engineering, Legacy System Modernization, Microservices, The AI Native Dev Podcast, Your Code Code as a Crime Scene

Source: https://www.youtube.com/watch?v=5SKh-FmjX7U
