---
title: Moving orgs into another deployment
lastModified: '2026-12-06T09:21:18.000Z'
description: loom instance export writes one deployment's orgs into a bundle, and loom instance import lands the bundle in another deployment that may already serve other…
---

`loom instance export` writes one deployment's orgs into a bundle, and `loom instance
import` lands the bundle in another deployment that may already serve other teams, by a
plan the operator reviews first. Run both with the CLI where each deployment's servers
run, with their settings. To move a whole deployment onto new hosts, see
[moving a deployment](/docs/operations/backup-and-recovery#moving-a-deployment) instead.

## What moves

| Moves                                                                                                                                                             | Stays behind                                                                                                                                                                                                                                 |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Memory namespaces, with their settings, per-type settings, policies and guide                                                                                     | Code-index and mirror namespaces, and collections: the target indexes the repositories again                                                                                                                                                 |
| Password accounts, with their argon2id hash, so the person signs in with their old password, and single sign-on accounts with their links under `sso_same_issuer` | Tokens, signing keys and the service accounts', bots' and connected accounts' credentials: the receipt lists each for its owner to set up again                                                                                              |
| Live grants, under the mapped subjects, with the import as `granted_by`                                                                                           | Pending join requests, revoked grants, groups and the grants of groups, agents and `everyone`, which collections hold                                                                                                                        |
| Blacklist entries, before any content, each on the created namespaces it reaches                                                                                  | Conversations, session briefs, tasks, promoted shared memories, records, memory evidence, working memory blocks, memory links and category assignments: the manifest counts them per namespace                                               |
| Deletion refusals, after the content, so the target refuses what the source deleted                                                                               | Extraction policies (the org's own too), the conflict allowlist, ontology entries, profile schemas, memory webhooks, categories, record schemas and dataset approvals: the manifest counts them per namespace for the owners to set up again |
| Live memories with their validity, plus `created_at` and attestation in a created namespace                                                                       | Documents an end user wrote, which the target could not erase as theirs: the manifest counts them                                                                                                                                            |
| Documents with their originals, embedded again by the target's embedder                                                                                           | Knowledge sources with a remote, and the documents a registered source syncs again or a removed one retires, except recording transcripts: the manifest lists the sources to register again, and counts the documents                        |
|                                                                                                                                                                   | A memory's earlier versions and its deleted memories: on the target, its history and a rollback start at the imported version                                                                                                                |
|                                                                                                                                                                   | Embeddings, caches, traces, rollups, the audit log and agent events: the target builds what it needs again                                                                                                                                   |

A namespace's settings move except those naming the source's services or rows:
`rerank_endpoint`, `classify_endpoint`, `budget_alert_inbox` and `released_aliases` are
cleared for the target's owners to set again. Imported memories and documents carry
`source_class=imported` and the importing command (`process:cli:instance`) as `actor`. A
document lands with its text and original, and its `ingested_at` is the import's time;
the source's record of how it extracted them (`format`, `parser`, `coverage`,
`artifact_sha256` and its ingestion) stays behind. `memory.bulk_set` embeds a merged
namespace's memories as it writes them; a created namespace's memories reach vector
search once the embedding worker's next full pass embeds them
(`LOOM_EMBEDDING_WORKER_ORPHAN_FULL_SCAN_SECONDS`).

## Procedure

1. Finish the source's erasures: the export refuses while one has not completed. Under
   the Postgres memory authority it also refuses while a selected namespace has
   documents waiting for publication.
2. Stop writes to the source. The bundle holds the rows at the moment each section is
   read. An erasure requested while the export reads refuses the export at its end,
   which removes what it wrote. One the source runs after the export does not reach the
   bundle: export again, or run the same erasure on the target once the import finishes.
3. Export, on the source:

   ```bash
   loom instance export --org acme --out ./acme-bundle
   loom instance export --org acme --namespace notes --out ./notes-bundle
   ```

   With `--namespace`, the bundle carries that namespace's content, and the account rows
   its grants and owner name, so the plan can place them, each with its blacklist
   entries and single sign-on links. Those accounts' own content, their per-type
   settings, policies and guide included, moves with a later export that selects them,
   which the target reads as the same landing. An org or namespace with nothing to
   export refuses the export.

   A bundle holds password hashes and `high` memories: it is written readable by its
   owner only, and is copied to the target whole, the way a database dump is. An export
   that stops on an error, Ctrl-C or SIGTERM removes what it wrote; one killed outright
   leaves files no import accepts, so delete that directory. Like a dump, the export
   writes no audit row per memory it reads.

4. Plan, on the target. The dry run reads the target, prints each decision and refuses
   the plan while anything is unresolved:

   ```bash
   loom instance import --bundle ./acme-bundle --map map.yaml
   ```

   Each problem says what settles it. Where a map entry does, the run prints the entries
   as YAML to copy into the map. The dry run builds every memory the bundle brings into a
   namespace it lands, as the run would write it, so one the target cannot store (a date
   past 2106, text the Postgres memory authority refuses, or in a merge a value past its
   `char_limit`) is named here, not part way through the run; it may name one the run
   would then leave out, such as a key the target holds. Under the Postgres authority it
   also names a document whose address holds text Postgres cannot store.

5. Apply the plan it printed. `--expect-plan` refuses to apply a plan that changed since
   the dry run, because the target or the map changed:

   ```bash
   loom instance import --bundle ./acme-bundle --map map.yaml --apply --expect-plan 5e25ef6da948b233
   ```

6. Hand out the receipt's `set_up_again` list (the source org's service accounts, bots
   and connected accounts, whichever namespaces the bundle selects), and register the
   repositories and knowledge sources the manifest's `left_behind` names. A source
   registered again writes its documents again, and keeps them up to date. A source
   removed with its documents kept writes them no more, so they move with the bundle,
   and a source retiring its documents takes them with it. A recording source lists only
   its last weeks of meetings, so its transcripts move with the bundle instead: they
   never change once written, and the source leaves each address it finds held as it is.

## The map

```yaml
orgs: # source org: target org (default: the same name)
  acme: acme
sso_same_issuer: false # the source signed people in with this identity provider
namespaces: # "<org>/<namespace>": rule (default: create)
  acme/notes: { rename: notes-legacy }
  acme/lessons: { merge: lessons } # add grants: true to carry its grants too
  acme/scratch: skip
subjects: # "<org>/<subject>": rule
  acme/alice: u-alice-1a2b3c4d # the same person's account on the target
  acme/bob: { claim: bob-legacy } # a claimable account under another handle
  acme/user:42: keep # the same end user on the target
  acme/sa:ci-1a2b3c: drop
```

- **Created namespaces.** A namespace is created under its own name, or the name the map
  gives it, owned by the source's owner under the mapped subject; where the map drops
  that subject, or there is none, the import owns it, as the dry run says. The plan
  refuses a name the target already holds (a namespace or a released alias), a name in
  use there with no namespace row (it holds data, or a grant, a source, an erasure or a
  setting names it) and a name of the form single sign-on gives a person. Two source
  orgs landing in one target org may not bring the same name. In a target org that
  serves others, a namespace anyone in the source org could join at once lands with
  `join_policy: approval`, so a namespace admin approves each member of the target org
  who asks. Its rows name their verifier and locker, and its policies and guide
  revisions their writer, under the mapped subject, and no one where the map drops it.
  Per-type settings, policies and the guide land with a created namespace only, from the
  bundle that brings its content. Its grants land before its memories, so each write of
  memories reads the namespace's keys again just before it: a key someone writes there
  while the run goes on stays theirs.
- **Merged namespaces.** `merge` writes into an existing namespace through
  `memory.bulk_set`, so the blacklist, conflict surfacing, pinned peers and the skip of
  an unchanged restatement hold there, with every entry checked, oldest first, and none
  reinforcing a row.
  - **Held keys.** It only adds: a key the target namespace holds or has held under the
    same agent, user and session is left as the target has it. Under the `newest_wins`
    policy, where a same-key write retires the older rows in other sessions too, a key
    is also left alone where the target holds or has held it for the same user in any
    agent or session, or, for a row with no user, for anyone; a namespace definition,
    which no other write of its key retires, holds only its own row. Each write reads
    that again just before it, so a key the target's owners write while the run goes on
    stays theirs too.
  - **Rows of one key.** Of the rows the bundle brings that a write of one would retire
    (one key under one agent, user and session, across two merged namespaces too, and
    under `newest_wins` one user's rows of a key, or the rows of a key with no user),
    the newest by `valid_at` (its `created_at` where it has none), then the first in the
    bundle, lands, and the receipt counts the others as `memories_superseded`. Under
    `newest_wins` the rows with no user are written first, so a named row of the same
    key, which a later write with no user would retire, lands beside them, as the source
    served both. A namespace definition, which no other write of its key retires, is
    written before them.
  - **Conflicts.** Admission may still mark a target row a merged one contradicts as
    conflicted, and retire one: under `newest_wins`, a row that states the same
    attribute of the same subject with another value, unless the merged row is the older
    statement by `valid_at`, and, with the conflict resolver on, one it judges the
    merged row updates. The merge writes in calls of up to 500 rows, each oldest first:
    of two statements of one attribute in different calls the older can be written
    second, and then it retires nothing, so the pair stays as a conflict to review.
- **Refused rows.** A row the target's blacklist or the source's refusals refuse is left
  out, and the receipt counts it as `memories_refused`. The import checks each value
  whole against the target's regex patterns: no request waits on it, so the work budget
  that refuses a request's value too long to check does not bind it.
- **Merged rows.** The source's refusals that reach the source namespace refuse the rows
  it brings, and none is stored on the target's namespace. A merge writes the rows reads
  serve, active or conflicted (the target's admission judges the pair again): a row in
  another state, redacted, or past its expiry when the run starts, is left out (one that
  expires before its write lands with a one-second expiry), and pins and locks are not
  carried. A merged row's `created_at` is the import's; its validity, expiry,
  sensitivity and evidence are the source's. The target's sensitive retention window
  applies to a merged row as to any write there, and `memory.bulk_set` gives it the
  target's expiry action for the level it grades the row at, so the dry run names a
  merged row the source expires by an action other than deleting it when the target's
  differs: land its namespace as a created one, which keeps it. The reason recorded for
  an expiry is not carried. Admission may decline a memory (a pinned peer, or a
  restatement it folds into a row): the receipt counts it as `memories_not_admitted`.
  Under the Postgres authority a `memory.bulk_set` call that commits but whose
  publication to ClickHouse is owed is left to the delivery worker, and the run goes on:
  the receipt counts its entries as `memories_publication_pending`, as admission's
  answer for each is lost.
- **Deletion refusals.** The source's record of the values its users and erasures
  deleted (fingerprints, no text) lands once a namespace's memories and documents have,
  so the target refuses a later write of such a value as the source does (`forgotten`).
  A namespace's refusals, and those of its users there, land with it under the mapped
  user; a user erasure's apply to the mapped user across the target org. A dropped
  user's do not land. A merge stores only a named user's refusals, not a namespace
  erasure's nor those of rows with no user: the target namespace is not the source's to
  refuse for. A source row that a later deletion's fingerprint matches lands as the
  source served it. The receipt counts each source refusal of a namespace the run lands,
  and each of a user erasure in an org it lands in, as landed (`deletion_refusals`),
  held by the target already (`deletion_refusals_the_target_holds`) or left out
  (`deletion_refusals_left_out`). A source memory whose value the target's writers
  deleted is left out, since the deletion is theirs, and the receipt counts it as
  `memories_forgotten`.
- **Documents.** A document whose `source_uri` the target namespace holds or has held is
  left as it is, read just before its write, and of two namespaces merged into one, the
  first in the bundle brings an address both hold. Under the Postgres authority a
  document that commits but whose publication is owed counts as written, and the run
  goes on.
- **Accounts.** A password account lands as a claimable one under its handle; a new
  handle for one may not start with `u-`, the prefix of single sign-on's names. A single
  sign-on account lands as the bullet below says.
  - **Refused handles and emails.** The plan refuses each of these and proposes a new
    handle or `drop`:
    - a handle the target holds as a namespace or a released alias;
    - a handle that already holds access there: a grant, a namespace, a token or a task
      names it, or a setting such as `LOOM_PLATFORM_ADMINS` does;
    - a handle in use there with no namespace row: a namespace of that name holds data,
      or a grant, a source, an erasure or a setting names it;
    - a handle the target revoked outright, in any org, which no token would sign in as,
      unless the source revoked that account too;
    - an email that already signs in on the target, as the owner of an active row whose
      contact it is;
    - an email another account of the bundle lands with, which single sign-on would
      refuse.
  - **Mappings.** Mapping an account onto a target account gives that account the source
    account's content and grants, and nothing proves a target account's contact email:
    map only the same person. A mapping names a live account, grant subject or namespace
    owner of the target org, never one the target deleted or revoked outright, under any
    spelling the gate folds onto it, nor an address the target's single sign-on refuses:
    one SCIM deactivated, or one whose account the target revoked. A mapped account's
    namespace is an ordinary one that lands as its `namespaces` entry says, by default
    under its own name, owned by the account it maps to. A `namespaces` entry for a
    claimed or dropped account refuses the plan: `claim` gives a claimed one another
    handle.
  - **Single sign-on accounts.** A single sign-on account has no password to prove the
    person, so it needs a mapping, or `sso_same_issuer: true` when both deployments use
    the same identity provider, which also carries its links. An account single sign-on
    made on the source lands as one it did not make on the target, so the target never
    gives back an owner grant the source revoked. With no password, its row stays an
    account only under a name of the form single sign-on gives a person, so a new handle
    for one keeps that form, and the plan proposes one that does.
  - **Revoked accounts.** An account the source revoked, by an operator or by SCIM,
    lands with no password, email or links, and its grants stay behind; nobody signs in
    to it, so the plan checks none of its emails. The grants to an address the source's
    single sign-on refuses for a revocation or a SCIM deactivation stay behind too, in
    any org of the bundle, and the plan refuses a map entry that keeps or maps one: an
    address SCIM deactivated, whatever account it reaches; one whose active account (the
    row naming it as its contact) is revoked by its name or owner; and, where no active
    row names it, one a revoked row names, deleted rows too, in any org of the source,
    as the export cannot tell which org single sign-on makes accounts in there. An
    enforced cell with SCIM on also refuses an address SCIM never provisioned; the
    bundle does not carry that rule, so the target's own provisioning decides.
  - **Revoked after a landing.** When the source revoked an account after an earlier
    bundle landed it as one that signs in, the plan refuses, whatever the map now does
    with it, until the target revokes that account
    (`loom revoke-token --subject <handle>`), which also ends the tokens and sessions it
    has had there since. The plan reads earlier landings only in the target org each
    source org lands in now. The revocation reaches the handle in every org of the
    target deployment; where another org has an account under it, deleting the landed
    account (`namespace.delete`) ends this refusal instead, but ends only its sign-in: a
    token it already holds keeps its grants until it expires. For a landing an earlier
    run did not finish, the plan then proposes another handle.
- **Subjects.** The plan decides the subjects a landing needs: a created namespace's
  grants, owner and end users, and whoever verified or locked a memory or wrote a policy
  or guide revision there; a merged one's end users, and its grant subjects when it
  carries its grants; none of a skipped one's. It also decides each end user a deletion
  refusal names: a point deletion's where its namespace needs its users, and a user
  erasure's in any case, since the erasure applies across the org, so a `--namespace`
  bundle asks about every user erased anywhere in the org. A grant to an email admits
  whoever proves the address at sign-in on the target, as on the source; it lands under
  the account that verified the address there, if one did (see Grants). A `user:`
  subject is kept in a target org only the import lands in. In one that serves others,
  or that two source orgs land in, it may name another person, so it needs `keep`, a
  mapping to another `user:` subject (an id: `user:-` and `user:` name no user), or
  `drop`. Its decision moves that end user's memories and deletion refusals too; two end
  users of one source org may not land as one. `group:`, `agent:` and `everyone` hold
  grants on collections only, so the plan refuses one on a moved namespace until the map
  drops it or maps it to a person's subject, and refuses a mapping onto one. `sa:`
  subjects are dropped, and `keep` on one is refused. A grant or owner that spells
  exactly one account of the bundle with its ASCII letters in another case is that
  account, as the source's gate folds them: the map may drop that spelling, and any
  other entry for it refuses the plan. Any other subject needs a mapping or `drop`. No
  grant of a subject the source revoked outright lands (an end user's revocation is
  `<org>/user:<id>`), and the plan refuses mapping one onto a target subject, who would
  gain its content. The target does not carry the revocation, so an end user the source
  revoked needs `keep` or `drop`: under `keep` the target's end-user tokens for its id
  read its rows again.
- **Grants.** A grant lands under the subject `grants.create` would write it under (a
  verified email's account handle). It is left out when the person already holds that
  role or higher there under a verified spelling, or a target admin revoked them there
  under any spelling the directory ties to the subject or on the row it would write. A
  person is matched as the gate matches them, with the ASCII letters of a stored
  subject folded to lower case and other letters left as they are. As with
  `grants.create`, a request to raise a grant the person holds there past the new role
  stays pending, and the grant answers any other request on its row, a request to join
  included; one under another spelling stays for the target's admins.
- A map entry that names no org, namespace or subject of the bundle refuses the plan.

## Running it again

An import that stops part way runs again with the same command. It plans the same digest
unless the target changed what the plan reads: a namespace someone created since in a
target org only the import landed in makes that org one that serves others, and the dry
run then shows the plan's new decisions. A namespace row an earlier run wrote takes two
of them: self-join by approval where it is open, and the owner the map now names in
place of the import's; anything else on it stays as the target has it, and no decision
opens it. Before it creates a namespace it writes an `instance.import` audit row naming
its source (`instance.import.merge` for a merge), and a later plan reads that row as
this source's landing, not as a collision, while the namespace row it finds is the one
the import wrote, with the source's `created_at`, and its owners have not deleted it: a
name someone took since is a collision. Once a namespace's content is written, an
`instance.import.done` row marks it, and later runs leave that namespace alone, so what
its owners deleted or revoked on the target since stays so. Within an unfinished
namespace, a run writes nothing the target holds already: no memory key (agent, user,
session and key) the namespace has held, deleted ones included, so a fact someone wrote
there before the rerun stays theirs, no document whose `source_uri` it has held, no
setting, policy or single sign-on link it holds in any state, no guide revision where it
holds a guide (its highest revision is the guide), and no grant the person holds at that
role or higher, or was revoked from. Under the Postgres memory authority, what the
authority holds counts, its publication to ClickHouse owed or not. These rows live as
long as the audit log keeps rows (`LOOM_RETENTION_AUDIT_LOG_DAYS`).

An erasure that runs on the target while an import is unfinished removes what the target
holds then, and a purge leaves no row for a later run to find: as after a
[restore](/docs/operations/backup-and-recovery#undoing-changes-inside-a-namespace), run the same
erasure again once the import finishes.

## Related

- [Backup and recovery](/docs/operations/backup-and-recovery): full backups, and moving a deployment
- [Single sign-on](/docs/operations/sso#accounts): how a person claims a password account
