10 KiB
Extraction Blueprint
Goal
Extract only migration-relevant behavior from Einstein Bot and discard transport noise.
Required Extractions
1) Dialog Graph
Input files:
Paths below are shown relative to the bots root directory. For org-backed retrieval this root is the SFDX default metadata directory force-app/main/default/ (so the full path is force-app/main/default/bots/<BotName>/…, as retrieved in SF CLI Bot Reference section 3). For offline input this root is the provided --offline-dir (e.g. bots/).
bots/<BotName>/<BotName>.bot-meta.xml(bot-level metadata)bots/<BotName>/<version>.botVersion-meta.xml(dialog + step graph source of truth)
Build the graph with this process:
- Parse every
<botDialogs>block in<version>.botVersion-meta.xmlas one node. - For each node, capture:
developerName(node id)labelmlIntent(if present)dialogGroup/ grouping metadata if present
- Treat each
<botSteps>entry inside a dialog as a step in execution order. - While scanning each step, also detect action invocations and variable mappings from bot steps:
- invocation/action step types (for example
Invocation) - action identifier/name and invocation type (
apex,flow,standardInvocableAction, etc.) - variables read by the action (bot variables passed as invocation inputs)
- variables updated by the action (bot variables set from invocation outputs)
- escalation actions from system messages:
- if a dialog contains
conversationSystemMessageof typeTransfer, add an action entry withaction_type: "escalate" - determine escalation target type (
queue,flow,bot, orskill) by readingsystemMessageMappingsunder thatconversationSystemMessageand resolving referenced variables against declarations in<conversationVariables> - store both the resolved
target_typeand mapped target identifier/value on the action record
- if a dialog contains
- persist this as
invoked_actionson the dialog node and as action-level records inaction_inventory
- invocation/action step types (for example
- While scanning each step, detect transition-producing step types:
Navigationwith<botNavigationLinks>Groupcontaining nestedNavigationWaittype steps, which define intent-driven routing points (intent redirect behavior)
- For every discovered transition, add one directed edge:
source_dialog->targetBotDialogtype(redirect,call,intent_redirect)
- Capture conditions from enclosing step/group when present:
leftOperandNameoperatorTyperightOperandValue- store as a normalized condition expression on the edge
- Mark graph role hints:
- probable entry dialogs (for example
Welcome,Main_Menu, or system entry mapping) - terminal dialogs (for example paths ending in
SystemMessage+EndChat, with no outbound navigation)
- probable entry dialogs (for example
Required output for dialog graph extraction:
{
"nodes": [
{
"dialog": "Main_Menu",
"label": "Main Menu",
"intent": "Main_Menu",
"invoked_actions": [
{
"action_name": "Airline_Get_User_Details",
"action_type": "flow",
"variables_read": ["user_email"],
"variables_written": ["airline_user", "is_success"]
}
]
}
],
"edges": [
{
"source": "Main_Menu",
"target": "Bookings_Menu",
"type": "redirect",
"condition": null
}
]
}
Quality checks:
- Every
targetBotDialogin edges must resolve to an existing dialog node. - Keep
CallandRedirectdistinct (do not merge semantics). - Preserve multiple outgoing edges from the same step when configured.
2) Intent Layer
- Intent name/developer name
- Intent description
- Linked dialogs
- Intent examples/utterances (if available)
Intent summarization workflow:
- For each dialog node in the dialog graph, read its
mlIntentvalue (if present). - Treat that
mlIntentas the lookup key for intent metadata inMlDomainwith the same name. - From the matched intent metadata, extract:
developerNamelabel/description(if present)mlIntentUtterances(training utterances)
- Generate a concise intent summary (2-3 sentences) per unique intent:
- sentence 1: user goal the intent represents
- sentence 2: typical phrasing style inferred from
mlIntentUtterances - sentence 3 (optional): routing nuance or disambiguation hint if overlapping with other intents
- If an
mlIntentis referenced by a dialog but no matchingMlDomainintent is found:- flag the intent as unresolved
- add it to
open_questions - still generate a provisional summary from dialog label/description with
confidence: low
3) Variable and Entity Layer
Input files:
bots/<BotName>/<BotName>.bot-meta.xml(context variables, slot/entity metadata)bots/<BotName>/<version>.botVersion-meta.xml(conversation variable usage through steps)
Variable extraction and typing rules:
- Extract context variables from
bot-meta.xml(<contextVariables>entries). - Mark every context variable as:
variable_type: linkeddata_type: map from bot metadatadataTypesource: derive from context mappings (SObjectType+fieldName) when present
- Extract conversation variables directly from
botVersion-meta.xml<conversationVariables>entries (authoritative source for declared conversation variables). - Mark every conversation variable as:
variable_type: mutabledata_type: read directly from the variable's declared data type in<conversationVariables>
Required output shape (variables):
{
"variables": [
{
"name": "ContactId",
"data_type": "Id",
"variable_type": "linked",
"source": "MessagingEndUser.ContactId"
},
{
"name": "Complaint_Id",
"data_type": "Text",
"variable_type": "mutable"
}
]
}
4) Action/Invocation Layer
- Action name and invocation type (
apex,flow, etc.) - Inputs, outputs, and variable mappings
- Also extract knowledge-backed action signals from
botVersion-meta.xml:- If
knowledgeActionEnabledistrue:- add an action entry with
action_type: "knowledge" - include
knowledgeActionEnabled: true
- add an action entry with
- If
knowledgeFallbackEnabledistrue:- add an action entry with
action_type: "knowledge" - include
knowledgeFallbackEnabled: true
- add an action entry with
- If
- When both fields are
true, capture both flags (either on one combined knowledge action record or two explicit knowledge action records), but ensure both booleans are present in extracted output.
Offline mode signature generation (required):
When input mode is offline (.bot-meta.xml + .botVersion-meta.xml provided, no org fetch):
- Generate action signatures from bot metadata mappings only (do not block on missing Apex/Flow source code).
- For each invocation mapping:
- extract action parameter names from invocation input/output mapping keys
- resolve mapped bot variable names from mapping values
- infer parameter types from mapped variable declarations in
<conversationVariables>/<contextVariables>when available
- If type cannot be inferred, use a conservative placeholder type (
TextorObject) and flag in notes/open questions. - Keep unresolved/partial signatures as non-blocking and continue extraction.
Signature construction rules:
- Do not copy bot variable names as action parameter names unless metadata explicitly uses the same name.
- Preserve both layers in output:
- contract layer:
input_name/output_name,type - mapping layer:
mapped_variable,variable_type(mutableorlinked)
- contract layer:
- For each signature entry, capture direction explicitly:
direction: inputfor values read by the actiondirection: outputfor values written by the action
- If one action is invoked multiple times with different mappings, keep one action signature and record per-call mapping context separately (for example
call_context).
5) Dialog Clusters and Categorization
After extracting actions and dialog/action mappings, categorize bot functionality into dialog clusters.
- Classify actions into groups using these priority criteria (highest priority first):
- actions working on the same underlying entity SHOULD be grouped together
- actions writing/updating the same variable SHOULD be grouped together
- actions reading the same input variable CAN be grouped together
- actions invoked by dialogs in the same dialog group CAN be grouped together
- actions with similar intent CAN be grouped together
- Keep group size between:
- minimum: 1 action
- maximum: 4 actions If a group exceeds 4 actions, split it while preserving higher-priority criteria.
- An action may belong to multiple groups when criteria requires an overlap.
- Assign dialogs to groups based on associated actions:
- for each grouped action, trace back dialogs that invoke it
- include those dialogs in the corresponding dialog cluster
- maintain an
action_dialog_mappingfor each group (action -> [dialogs])
- Generate a short functional description (2-3 sentences) per group using grouped actions and associated dialogs.
Extraction Output Shape
Build an intermediate extraction summary used by mapping:
{
"run_identity": {},
"dialog_graph": {
"nodes": [],
"edges": []
},
"intent_catalog": {},
"variables": {},
"action_inventory": {},
"dialog_clusters": {},
"unmapped_items": {}
}
Persist Extraction Output
Write the extraction summary to a JSON file before starting mapping.
- Output filename:
extraction-summary.json - Output location: same working/output directory used for the current bot/version handoff artifacts
- The file content must preserve the extraction output shape defined above
- If extraction is rerun, overwrite this file with the latest extraction snapshot
action_inventory should include any extracted knowledge action entries with explicit knowledgeActionEnabled and/or knowledgeFallbackEnabled boolean flags when present in bot version metadata.
Extraction Principles
- Favor explicit configured behavior over assumptions.
- Preserve branch conditions where available.