---
uid: how-to.bring-in-an-existing-codebase
description: "Want to leverage all the benefits of Intent Architect on your existing codebase? Reverse-engineer your system into Intent Architect with AI, using the initialize-brown-field skill."
---

# Bring an existing codebase into Intent Architect

Want to leverage all the benefits of Intent Architect on your existing codebase? Reverse-engineer your system into Intent Architect with AI, using the `/initialize-brown-field` skill.

The agent models your system as it is, in whatever languages and frameworks you use, and draws a diagram of each area, without changing your code. From then on, you direct the AI on your codebase, and the drift engine keeps your design and your code in step with every change.

This guide walks you through it on Acme Orders, a small repository with an ASP.NET Core API, EF Core persistence and a React front end. For more on what you get, see [Using Intent Architect on an existing codebase: what to expect](https://docs.intentarchitect.com/docs-md/application-development/ai-assisted-development/existing-codebases/existing-codebases.md).

## Create a solution in your repository

Intent Architect models your code where it is, so create the solution inside your repository.

1. On the Home screen, click **Create a new solution**.

   ![The Home screen's Get Started list with Create a new solution highlighted](images/home-create.png)

2. Enter a **Name**, and set **Location** to your repository's folder.
3. Clear **Create a sub-folder for the solution**. **Will be created at** then shows the solution in an `intent` folder at the top of your repository.
4. Leave the other options as they are, and click **Create solution**.

![The Create solution dialog with the repository folder as the Location and Create a sub-folder for the solution cleared](images/create-solution.png)

The solution opens in the Solution Shell, ready for the agent to set up your applications.

## Run /initialize-brown-field in the AI Assistant

In the Solution Shell's AI Assistant, choose your coding agent, such as Claude Code, then type `/initialize-brown-field` and send it. To set up your coding agent, see [Use Claude Code, Cursor or Copilot with Intent Architect](https://docs.intentarchitect.com/docs-md/how-to-guides/use-claude-code-cursor-or-copilot/use-claude-code-cursor-or-copilot.md).

![The AI Assistant with /initialize-brown-field offered as you type](images/slash-command.png)

The agent looks through your code, then asks you a few questions in one go:

- **Applications:** one application for each part of your system that's deployed on its own (recommended), or one for the whole repository.
- **Layers:** which layers to model, such as Domain, Services, Integration and UI. Each option shows what the agent found in your code.
- **Zoning:** whether to zone your code for Change Review, so reviewers see the riskiest changes first.

![The Layers question, with Domain, Services and UI selected and what the agent found for each](images/layers-question.png)
_On Acme Orders, the agent found 4 entities, 2 controllers with 7 actions, and a React front end with 3 pages and an API client._

Then it gets to work. If you chose zoning, it checks the zones with you near the end.

## Let /initialize-brown-field model your code

From here, the agent works on its own. It:

- sets up an application for each part of your system, over its code;
- models each layer you chose, and checks it with the drift engine;
- proves the drift engine catches a change in each layer;
- adds custom drift rules for your own patterns, wherever your code needs them;
- draws a diagram for each area of your system, and zones your code if you asked;
- adds your build and test commands as tasks.

Acme Orders was done in just over an hour. A larger system takes longer, as the agent works through each application in turn, so you can get on with other work while it runs. If the run is interrupted, start a new chat and run `/initialize-brown-field resume` to pick up where it left off.

## See what you got in the Solution Explorer and the designers

When the run finishes, the agent gives you a summary: what it modelled, any custom drift rules it added for your patterns, anything in your code that looks like a bug for you to review, and suggested next steps.

![The What's modelled part of the agent's summary for Acme Orders](images/final-summary.png)

In the Solution Explorer, the **App** folder holds an application for each part of your system, with a designer for each layer the agent modelled. The **Modules** folder holds your custom drift rules.

![The Solution Explorer with an application for the API and one for the React front end](images/solution-explorer.png)

Each designer has a diagram for each area of your system. Pick one from the diagram list at the top right of the designer.

![The Orders diagram in the Services designer, from each endpoint through the service to the entity it changes](images/services-diagram.png)
_The Services designer's **Orders** diagram: each endpoint with its route, the service operation it calls, and the entity that operation changes._

The User Interface designer does the same for your front end, whatever its framework, right down to the backend operation each API call reaches.

![The User Interface designer's Customers and Orders diagram, from each React page through the API client to the controller operations it calls](images/ui-diagram.png)
_The React front end's **Customers and Orders** diagram: each page with its route, the API calls it makes, and the backend operation each call reaches._

Your build and test commands are tasks now too, so the agent can build and test its own changes.

In Source Control, you'll see that none of your code has changed. The new files are Intent Architect's: the `intent` folder, `tasks.json`, and the skills and instructions your coding agent uses to work with Intent Architect, in folders such as `.claude` and `.agents`. Commit them, so your whole team works from the same design.

## Direct the AI, and let the drift engine govern every change

From now on, you direct the work and the AI does it. Ask the agent in the AI Assistant for a feature, and it changes your code and your design together.

The drift engine governs every change. Each time the agent runs the Software Factory, the drift engine checks the design against the code. If the agent got something wrong, or left part of the change out of the design, the drift engine tells it exactly what, down to the file and line, and the agent puts it right before it reports back. You don't have to step in: the change you get back is complete, in the code and in the design.

![A drift report showing the element, the file and line it was checked against, and what's different](images/drift-report.png)
_What the agent sees when the design and the code disagree: here, an endpoint whose route in the code no longer matches the design._

Then review the change through the design. Your diagrams always match your code, so you can see at a glance how the AI changed your system, and Change Review shows every design change as a visual diff next to the code that implements it. See [Change Review](https://docs.intentarchitect.com/docs-md/application-development/change-review/change-review/change-review.md).

The same guardrail covers changes made outside the AI. When we added a `Phone` property to `Customer` by hand in the Acme Orders code, the drift engine flagged it, and the agent brought the design in line. It also pointed out what else the change needed: a new database column, and the field on the API's DTOs.

![The agent adding Phone to the Customer entity and the check coming back clean](images/fix-drift.png)

> [!TIP]
> Drift says the design and the code disagree, not which one is right.

## Related articles

- [Using Intent Architect on an existing codebase: what to expect](https://docs.intentarchitect.com/docs-md/application-development/ai-assisted-development/existing-codebases/existing-codebases.md) - what you get when you bring in an existing codebase, and how it works.
- [Use Claude Code, Cursor or Copilot with Intent Architect](https://docs.intentarchitect.com/docs-md/how-to-guides/use-claude-code-cursor-or-copilot/use-claude-code-cursor-or-copilot.md) - use your own coding agent in Intent Architect.
- [Classify your codebase so reviews focus on what matters](https://docs.intentarchitect.com/docs-md/how-to-guides/classify-your-codebase/classify-your-codebase.md) - zone your code so reviews focus on what matters.
- [Turn existing code into living specs](https://docs.intentarchitect.com/docs-md/how-to-guides/turn-existing-code-into-living-specs/turn-existing-code-into-living-specs.md) - write down the rules your existing code follows as specs.
