Moving orgs into another deployment
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 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 | 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 and records: the manifest counts them |
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 |
| 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
-
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.
-
Stop writes to the source. The bundle holds the rows at the moment each section is read. An erasure 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.
-
Export, on the source:
loom instance export --org acme --out ./acme-bundle loom instance export --org acme --namespace notes --out ./notes-bundleWith
--namespace, the bundle carries that namespace’s content, and the account rows its grants and owner name, so the plan can place them. Those accounts’ own content 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
highmemories: it is written readable by its owner only, and is copied to the target whole, the way a database dump is. Like a dump, the export writes no audit row per memory it reads. -
Plan, on the target. The dry run reads the target, prints each decision and refuses the plan while anything is unresolved:
loom instance import --bundle ./acme-bundle --map map.yamlEach 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, 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. -
Apply the plan it printed.
--expect-planrefuses to apply a plan that changed since the dry run, because the target or the map changed:loom instance import --bundle ./acme-bundle --map map.yaml --apply --expect-plan 5e25ef6da948b233 -
Hand out the receipt’s
set_up_againlist (the source org’s service accounts, bots and connected accounts, whichever namespaces the bundle selects), and register the repositories and knowledge sources the manifest’sleft_behindnames. 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
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) and a name
of the form single sign-on gives a person; the apply also refuses a name that holds
data with no namespace row. 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 or never planned it. Per-type settings, policies and the guide land with a created namespace only. - Merged namespaces.
mergewrites into an existing namespace throughmemory.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. 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 thenewest_winspolicy, 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. 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 undernewest_winsone user’s rows of a key, or the rows of a key with no user), the newest byvalid_at(itscreated_atwhere it has none), then the first in the bundle, lands, and the receipt counts the others asmemories_superseded. Undernewest_winsthe 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. Admission may still mark a target row a merged one contradicts as conflicted, and retire one: undernewest_wins, a row that states the same attribute of the same subject with another value, unless the merged row is the older statement byvalid_at, and, with the conflict resolver on, one it judges the merged row updates. - 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_atis 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, andmemory.bulk_setgives 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 asmemories_not_admitted. Under the Postgres authority amemory.bulk_setcall 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 asmemories_publication_pending, as admission’s answer for each is lost. - Documents. A document whose
source_urithe 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. An account lands as a claimable password account under its handle. The
plan refuses a handle the target holds, or one that already holds access there (a
grant, a namespace, a token, a task, or a setting such as
LOOM_PLATFORM_ADMINSnames 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 any target account signs in with, and an email another account of the bundle lands with, which single sign-on would refuse; it proposes a new handle ordrop. 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 single sign-on account has no password to prove the person, so it needs a mapping, orsso_same_issuer: truewhen 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. An account the source revoked, by an operator or by SCIM, lands with no password, email or links, and its grants stay behind, the grants to its emails too: nobody signs in to it, so the plan checks none of its emails. When the source revoked it after an earlier bundle landed it as an account 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; a merged one’s end users, and its grant subjects when it
carries its grants; none of a skipped one’s. 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 needskeep, a mapping to anotheruser:subject (an id:user:-anduser:name no user), ordrop. Its decision moves that end user’s memories too; two end users of one source org may not land as one.group:,agent:andeveryonehold 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, andkeepon one is refused. Any other subject needs a mapping ordrop. 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 needskeepordrop: underkeepthe target’s end-user tokens for its id read its rows again. - Grants. A grant lands under the subject
grants.createwould 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, in any case. A pending request is no grant: the source’s grant replaces it. - 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, guide revision or single sign-on link it holds in any state, 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, run the same erasure again once the import finishes.
Related
- Backup and recovery: full backups, and moving a deployment
- Single sign-on: how a person claims a password account