> ## Documentation Index
> Fetch the complete documentation index at: https://iso-topology.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How to edit an AI architecture diagram without losing your layout

> Preserve manual diagram placement across AI revisions with stable IDs, saved layout state, Studio project files and a reproducible edit–save–reopen workflow.

**Save the architecture source and layout state together, then supply both to the next edit.** In iso-topology, a `.isotopo.json` project contains that pair. A YAML file alone preserves the architecture, but does not contain the automatic placement or the locks created by dragging in project mode.

Use this when a diagram is already close to what you want: you have positioned a component, clarified a label, and want an agent to add one service without starting the drawing over.

[Start in local Studio](https://iso-topology.mintlify.site/quickstart.md) · [Download its YAML](../assets/readme-starter.yaml) · [Create the first version with an agent](https://iso-topology.mintlify.site/guides/ai-architecture-diagram-workflow.md)

For installation and a first SVG, start with the [architecture diagram quickstart](https://iso-topology.mintlify.site/quickstart.md). For a deliberately authored composition, the [Mermaid-to-isometric examples](https://iso-topology.mintlify.site/articles/mermaid-to-isometric-architecture-diagrams.md) include YAML with explicit placement; keep those authored positions in the source when adapting a template.

## Source and layout have different jobs

| File | What it keeps | When to use it |
| - | - | - |
| `architecture.yaml` | Components, IDs, relationships and authored presentation | Reviewing changes to the architecture |
| `layout-state.json` | Generated positions and manual placement locks | Continuing an existing composition |
| `project.isotopo.json` | Source and matching layout state in one versioned file | Human–agent handoff, reopening and rollback |
| `topology.svg` | The published drawing | READMEs, design reviews and presentations |

Keep the SVG and editable files from the same revision. A successful export of yesterday's diagram does not cover changes made today.

## 1. Create a small project

With the [CLI installed](https://iso-topology.mintlify.site/getting-started/01-install.md), save the starter as `architecture.yaml` and run:

```bash theme={"system"}
isotopo design architecture.yaml out/first
isotopo serve out/first/project.isotopo.json
```

Open the local URL printed by `serve`. Starting Studio from the project is significant: it brings the existing placement into the editor, instead of asking a bare source document to reproduce it.

![The editable Client, API and Database starter](https://mintcdn.com/iso-topology/JRs3a6ALtsht9_pA/assets/readme-starter.svg?fit=max\&auto=format\&n=JRs3a6ALtsht9_pA\&q=85\&s=e188e160d459943dc1aabe425a5c8260)

## 2. Make and save a human change

In Studio, rename **API** to **Public API**, drag that component to a useful position, and save. In project mode, a direct drag creates a layout lock while leaving unrelated architecture source untouched. Undo and redo track source and state together.

Reopen the saved `.isotopo.json` file once. Verify that the label and placement survived before handing it to an agent. The [Studio guide](https://iso-topology.mintlify.site/guides/studio.md) explains its saving behavior; saving the project and publishing an updated SVG are separate actions.

Use **Export → Project file** to keep a portable copy. Reopen it with `isotopo studio path/to/project.isotopo.json`. Source-only exports are useful for text editing, but retain the project when placement matters.

## 3. Tell the agent what must survive

```text theme={"system"}
Read the latest saved out/first/project.isotopo.json, not the original
architecture.yaml or a source snippet from conversation history.
Keep Public API, all existing IDs, comments and connections.
Add a cache component and an API-to-Cache connection to the project's source.
Keep its layout_state unchanged as the input to the next design call.
Save the edited project as out/next-input.isotopo.json; keep the original.
Run isotopo design out/next-input.isotopo.json out/next.
Inspect the report and SVG. Reopen out/next/project.isotopo.json.
Verify that the manually positioned API retains its parent-local position
and lock, and that Cache and its connection are visible.
Return the new project, source and SVG paths, with remaining issues.
```

If your workflow uses separate files instead, save the current project's source as `architecture.yaml` and its state as `layout-state.json`, edit the source, and run:

```bash theme={"system"}
isotopo design --state layout-state.json architecture.yaml out/next
```

For MCP, pass the current project source as `dsl` and its `layout_state` as `previous` to `iso_design`. Use the newly returned source/state pair for the next turn. [See the MCP arguments](https://iso-topology.mintlify.site/agent/MCP.md).

## 4. Verify the round trip

| Check | Expected result |
| - | - |
| Read the final source | Public API remains; old IDs and edges remain; Cache is present |
| Compare the API state | Its parent-local x/y/z and lock survive the revision |
| Inspect the SVG | Cache is connected; arrows are attached; labels and routes are readable |
| Reopen the final project | The latest source and placement appear together |
| Try an invalid source edit | Correct or undo it; do not publish an earlier preview as the new result |

The repository's browser-engine regression exercises a Studio-style move, an agent-style source revision, project serialization and reopening. It checks source continuity, the manual lock and SVG replay. This is a deterministic tool-contract test, not a measurement of an LLM's success rate.

## What preservation means—and its limits

* **Stable IDs identify existing components.** A rename of `label` can preserve identity; replacing `id` breaks that correspondence.
* **Locks preserve parent-local placement.** They do not freeze component dimensions, a parent's position or the entire drawing's screen coordinates. Longer text can need more space.
* **Explicit source placement wins.** If an agent writes new coordinates or layout rules, it may intentionally override saved placement. Ask it to leave those fields alone when preserving the composition.
* **Recompose releases soft preferences, not manual locks.** It is a deliberate layout operation, not a synonym for “render the latest source.”
* **Crowding still needs review.** Adding many nodes while retaining positions can create a worse drawing. Inspect the report and routes, and choose which constraints to change.

See [source and layout](https://iso-topology.mintlify.site/concepts/source-and-layout.md) for the ownership model. Reproducible comparisons also require the same renderer and resources.

## Troubleshooting

### Why did my diagram move after I reopened YAML?

The automatic layout state was saved separately. Reopen the project or provide the matching state with `--state`. Authored coordinates in YAML are retained, but a plain architecture-only YAML export does not include previous automatic placement.

### Why did the agent undo my label edit?

It likely used a stale source revision. Have it read the saved project from disk immediately before editing. Stable layout state cannot recover a label overwritten in the source.

### Can I edit an existing screenshot or arbitrary SVG this way?

This workflow needs iso-topology's source model and layout state. It does not reconstruct arbitrary screenshots or reverse-engineer another tool's SVG into a project.

### Is Studio a shared cloud workspace?

No. Studio runs locally and saves accepted edits to its bound file. Keep that file or export a project before handing the diagram to someone else; it does not provide account storage or collaboration.

[Create and revise with an agent](https://iso-topology.mintlify.site/guides/ai-architecture-diagram-workflow.md) · [Watch the earlier source-only handoff](https://iso-topology.mintlify.site/guides/edit-ai-generated-diagrams.md) · [Publish a README diagram](https://iso-topology.mintlify.site/getting-started/05-publishing.md)

For a more detailed authored composition, [open the six-component service project and repeat a checked rename–render–reopen cycle](https://iso-topology.mintlify.site/articles/mermaid-to-isometric-architecture-diagrams.md#try-a-second-edit-then-reopen-it). The same page includes editable RAG and DuckDB projects.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.