DEV Community

Riley Xu
Riley Xu

Posted on

Decide Export vs Rebuild Before Your AI Host Migration

An export can preserve configuration text while leaving out the runtime that interprets it. Decide whether to adapt that export or rebuild from a written behavior spec before the cutover window opens, not in the middle of it. The classification work below is mostly reading and arguing, and it can expose behavior drift before it affects live work. Treat the export as evidence to be audited, and treat your own written contract as the thing you actually migrate.

Who this is for and what you need

This applies when you are leaving one AI host, coding assistant, or agent platform for another and you have prompts, tool schemas, or memory attached to the old one. You need export access on the old side, at least read access to the new host's configuration docs, and a small set of representative tasks you can replay. You also need somewhere to run a replay that cannot touch real tickets, mail, or repositories, because replay is where migrations quietly cause damage. Check both providers' current terms for what the export contains and how their APIs handle your data before you assume the artifact is complete.

Step 1: Write the behavior contract before you open the export

List what the system must do in plain language: which task classes it handles, which tools it may call, when it must refuse, and what output shape downstream code expects. Keep this list independent of any vendor syntax, because vendor syntax is exactly what you are migrating away from. If you cannot write the contract, you cannot verify the new host, and you should stop here. Start with enough examples to cover every externally visible outcome, including refusal and a missing input.

Step 2: Classify every exported field into three buckets

The useful move is to sort each exported field into portable, needs-a-translator, or host-bound (a field may also be deliberately discarded). Portable fields carry meaning that survives a copy, translator fields survive only after a deliberate rewrite, and host-bound fields must be dropped and re-established. Do this in a table your reviewers can edit, not in your head.

Field type Bucket Why
System prompt prose Portable Meaning survives, but section ordering may not
Tool names and JSON schema Translator Required/optional flags and descriptions carry routing weight
Tool descriptions Translator Written for the old router's tool-selection behavior
Sampling defaults (temperature, top_p) Host-bound Same number, different meaning across hosts
Model identifiers Host-bound Names do not map one-to-one
Stop sequences and output prefixes Translator Often honored differently or dropped
Attached files, knowledge IDs, memory handles Host-bound IDs are valid only inside the old host
Rate-limit and quota metadata Drop Belongs to the old account, not the workflow

Tool descriptions deserve explicit attention. In MCP the tool name, description and input schema are distinct parts of the declaration; keeping the name alone does not fix what the model or receiving service will do. MCP tool declarations A description tuned to make one host pick the right tool can make another host pick the wrong one or skip tools entirely. When in doubt, rewrite descriptions against your contract and test tool selection rather than copying text.

Step 3: Choose export-adapt or rebuild-from-spec

Export-adapt means you import the artifact, then patch the translator and host-bound fields you identified. Rebuild-from-spec means you write the new configuration from your behavior contract and use the export only as a reference while doing it. The choice depends on how much of your behavior lives in prose versus structure, and on how much you trust the export to be complete.

A rough decision matrix, stated as heuristics rather than measured thresholds:

  • Choose rebuild-from-spec when most fields are host-bound, when tool selection is central to correctness, or when the old configuration was edited by several people without review.
  • Choose export-adapt when the prompts are short, the tool surface is small, and you can replay enough representative tasks to catch drift.
  • Choose hybrid when prompts are stable but tool schemas are complex: rebuild the tool layer, adapt the prompt text.

Write the decision down with the date, because someone will ask later why the two halves of the system look different. If the answer is "we ran out of time on the tool layer," that is a legitimate note to record.

Step 4: Keep the old host as a read-only reference, not a runtime dependency

Freeze the old configuration once you have exported it, and record the version you froze. Do not let the new system read live state from the old one, because that turns your cutover into a permanent two-system coupling that nobody scheduled. Keep the old account available for a defined rollback window and put the end date in the cutover calendar. While you are there, list the leftovers that will outlive the switch: scheduled jobs, webhooks pointing at the old endpoint, and any script holding old credentials.

Step 5: Replay with side effects contained

Replay means running your representative tasks against the new configuration and comparing what the system intended to do, not what it did. Build an interception point where tool calls are recorded as intents instead of executed, so a replayed ticket creation does not create a ticket. The illustrative sketch below describes the shape of that harness; it is a design outline, not runnable code, and it has not been executed.

for each task in representative_tasks:
    run task against configuration_under_test
    intercept every tool call -> append (tool_name, normalized_args) to intent_log
    block all outbound effects
compare intent_log_old_host vs intent_log_new_host
report tasks where tool_name differs or normalized_args differ beyond tolerance
Enter fullscreen mode Exit fullscreen mode

Normalize arguments before comparing, or you will drown in timestamp and ID noise. Rank differences by their consequences. A free-text argument containing the wrong recipient or an unapproved query can matter more than a tool rename.

Test: how to check the migration is actually done

Run this as a verification pass and record the results, rather than asserting success from a successful import.

  • Contract coverage: every bullet in the behavior contract maps to at least one replayed task, and you can name that task. Expected observation: no unmapped bullets remain.
  • Tool-selection agreement: for each task, the new host selects the same tool as the old host, or you can explain the difference as intentional. Expected observation: differences are listed, not absent.
  • Output shape conformance: downstream parsers accept the new output without changes, or you have enumerated the changes. Expected observation: parse failures are zero or explained.
  • Refusal boundaries: tasks that should be refused are still refused on the new host. Expected observation: no boundary case flips from refuse to comply.
  • Rollback check: you can restore the frozen old configuration and route traffic back within your stated window. Expected observation: the rollback path was exercised in a non-production environment.

If any of these cannot be observed without touching production data, the honest conclusion is that verification is partial, and the cutover decision should say so.

Common failure modes

  1. Import succeeded, migration declared complete. A successful import only proves the file parsed, which is the weakest possible signal about behavior.
  2. Tool descriptions copied verbatim. Descriptions are routing instructions in disguise, and they rarely survive a host change unchanged in effect.
  3. Sampling defaults assumed equivalent. The same temperature value can produce noticeably different variance on a different host.
  4. Attachments referenced by old IDs. Check missing-file behavior explicitly; a host might reject the request or continue with empty context.
  5. Prompt sections reordered by the import. Role mapping and section order can change emphasis even when every sentence is preserved.
  6. Rollback blocked by later edits. If someone edits the frozen old configuration after cutover, your rollback target no longer exists.

Tradeoffs and when this does not apply

Classification costs time, and for a single prompt with no tools and no memory it is wasted effort; a short replay is enough there. If the destination host publishes a documented importer with an explicit fidelity specification, follow that specification and use replay to confirm it rather than rebuilding the classification by hand. This approach also does not help when the real blocker is organizational, such as unclear ownership of the old configuration, because no table fixes that. And it assumes you can intercept tool calls in a test path; if you cannot, rely on read-only task classes and treat tool-calling behavior as unverified until after cutover.

This article was created with AI assistance. The replay harness is a design sketch; it does not report an actual migration.

Top comments (0)