> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autosana.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating Existing Flows

> Export the flows, suites, and hooks you already have in the dashboard to files, and let the sync adopt them

Already have flows in the dashboard? Export them to files with the CLI, commit them, and the first sync adopts them with their run history intact.

## Export

[Install the CLI](/install-cli) and log in, then export:

```bash theme={null}
# Write every dashboard flow, suite, and their hooks to ./.autosana (with explicit keys)
autosana flows export --all

# Or export a single suite and its flows
autosana flows export --suite "Smoke Tests"
```

Export writes each flow (`*.flow.yaml`), suite (`_suite.yaml`), and the flows' **and** suites' own setup/teardown **hooks** (`hooks/<slug>.<ext>`), adding `setup_hooks`/`teardown_hooks` and `labels` to the flow files and the suite manifests as needed. cURL hooks have no file form, so they're referenced by slug but stay dashboard-authored.

Review the generated files, run `autosana flows validate`, commit them under `.autosana/`, then enable **Code-Managed Testing** for the repository (see [Enabling code-managed flows](/code-managed-flows#enabling-code-managed-flows)).

## How adoption works

On the first sync, anything whose identity **matches** an active dashboard definition is **adopted**: its run history is preserved and it becomes code-managed (read-only), now driven by your files.

* A **flow** or **suite** is adopted when its `name` exactly matches one active dashboard flow or suite.
* A **hook** is adopted when its slug (its filename) matches one active dashboard hook.

<Warning>
  Adoption is by **exact, case-sensitive** identity and only on a single match. A YAML flow named the same as an *unrelated* dashboard flow, or a hook file whose slug matches an unrelated dashboard hook, will claim it and make it read-only, so review your exported names before enabling. If two dashboard flows share a name (ambiguous), the sync creates a new flow instead of claiming either. A hook slug that collides with a **different repository's** hook is still a blocking error (see [Hooks as files](/code-managed-files#hooks-as-files)).
</Warning>

## Next Steps

* [Learn the file schema →](/code-managed-files)
* [Validate, sync, and preview on PRs →](/code-managed-sync)
* [Run the exported tests from the terminal →](/code-managed-cli)
