@salesforce/afv-skills 1.68.0 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/package.json +1 -1
  2. package/skills/afcc-setup-coordinate/SKILL.md +348 -0
  3. package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
  4. package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
  5. package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
  6. package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
  7. package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
  8. package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
  9. package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
  10. package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
  11. package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
  12. package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
  13. package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
  14. package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
  15. package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
  16. package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
  17. package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
  18. package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
  19. package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
  20. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
  21. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
  22. package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
  23. package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
  24. package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
  25. package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
  26. package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
  27. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
  28. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
  29. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
  30. package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
  31. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
  32. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
  33. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
  34. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
  35. package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
  36. package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
  37. package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
  38. package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
  39. package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
  40. package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
  41. package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
  42. package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
  43. package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
  44. package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
  45. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
  46. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
  47. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
  48. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
  49. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
  50. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
  51. package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
  52. package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
  53. package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
  54. package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
  55. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
  56. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
  57. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
  58. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
  59. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
  60. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
  61. package/skills/commerce-react-storefront-create/SKILL.md +54 -21
  62. package/skills/dx-lifecycle-center/SKILL.md +24 -18
  63. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  64. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  65. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  66. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  67. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  68. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  69. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  70. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  71. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  72. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  73. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  74. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
  75. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  76. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  77. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  78. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  79. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  80. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  81. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  82. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  83. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  84. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  85. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  86. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  87. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  88. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  89. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  90. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  91. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  92. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  93. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  94. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  95. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  96. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  97. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  98. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  99. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  100. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  101. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  102. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  103. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  104. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  105. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  106. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  107. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  108. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  109. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  110. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  111. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  112. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  113. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  114. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  115. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  116. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  117. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  118. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  119. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  120. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  121. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  122. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  123. package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
  124. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  125. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  126. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  127. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  128. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  129. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  130. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  131. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  132. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  133. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  134. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  135. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  136. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  137. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  138. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  139. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  140. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  141. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  142. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  143. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  144. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  145. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  146. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  147. package/skills/platform-report-generate/SKILL.md +20 -1
  148. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  149. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  150. package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
  151. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  152. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  153. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  154. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  155. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  156. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  157. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
  158. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  159. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  160. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  161. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  162. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  163. package/skills/service-e911-configure/SKILL.md +242 -0
  164. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  165. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  166. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  167. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  168. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  169. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  170. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  171. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  172. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  173. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  174. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  175. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  176. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  177. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  178. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  179. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  180. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  181. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  182. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  183. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  184. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  185. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  186. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  187. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  188. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
@@ -0,0 +1,215 @@
1
+ # Authoring Posture: The Control Spectrum
2
+
3
+ This guide defines how to choose the right posture for each subagent.
4
+
5
+ Posture is the dial between model latitude (agentic) and authored control
6
+ (deterministic). Choose posture first, then choose subagent organization
7
+ (router-first architecture, verification gate, and so on).
8
+
9
+ ## Core Principle
10
+
11
+ Choose the least control that makes unacceptable failures unlikely or
12
+ impossible while preserving the flexibility the use case needs. This is a
13
+ tradeoff, not a rule that every exact fact must become a branch or that every
14
+ conversation should remain prompt-led.
15
+
16
+ More deterministic control provides stronger ordering, repeatability,
17
+ auditability, and protection around consequential actions. It also creates
18
+ more state, more lifecycle cases, more maintenance, and less natural recovery
19
+ from corrections, digressions, or changed intent.
20
+
21
+ More model latitude handles meaning, ambiguity, corrections, and conversational
22
+ variation more naturally. It also makes exact ordering, action choice, and
23
+ repeatability probabilistic.
24
+
25
+ Mixed control is often the useful middle: let the model interpret the user's
26
+ meaning and collect conversational inputs, while runtime predicates gate only
27
+ the consequences that need a guarantee.
28
+
29
+ | Posture | Main benefit | Main cost | Typical fit |
30
+ |---|---|---|---|
31
+ | Agentic | flexibility and natural recovery | probabilistic ordering and action choice | advice, discovery, low-risk assistance |
32
+ | Mixed | flexible interpretation with protected invariants | two owners must have a clear boundary | most action-oriented assistants |
33
+ | Scripted | repeatability, traceability, and strict ordering | rigidity, state lifecycle, and maintenance | regulated or externally ordered workflows |
34
+
35
+ Pin more behavior when the cost of a wrong or reordered decision justifies that
36
+ cost: regulation, authorization, confirmed consequential actions, external
37
+ ordering, or a reproduced reliability failure. Do not add control merely
38
+ because the runtime could express it.
39
+
40
+ ## Primary Controls
41
+
42
+ Three primitives control posture:
43
+
44
+ 1. `available when`
45
+ Primary invariant tool. Hide actions when preconditions are false.
46
+ 2. `with param = ...` vs `with param = value`
47
+ Default to `...`. Pin values only when sourced from controlled state
48
+ (for example, verified `customer_id`), needed after action-output scope ends,
49
+ or when a reproduced extraction failure requires it.
50
+ 3. `if` / `else` in `instructions: ->`
51
+ Use conditional instructions only when a named controlled value changes the
52
+ prompt the model must receive. More branching means more authored control.
53
+
54
+ Surviving conversation history is the default source for names, preferences,
55
+ answers, corrections, and current intent. Add mutable state only for a named
56
+ runtime consumer or a value explicitly required beyond the history window.
57
+
58
+ ## Decision Ownership Test
59
+
60
+ Do not choose posture from the fact that a sentence contains the word “if.”
61
+ Classify the decision:
62
+
63
+ | Decision | Likely owner | Example |
64
+ |---|---|---|
65
+ | Exact trusted fact with a required stable consequence | AgentScript | `@variables.account_status == "blocked"` |
66
+ | Mandatory eligibility or side-effect gate | AgentScript | hide submit until authorization succeeds |
67
+ | Model needs a stored value to explain or summarize | Model, with explicit interpolation | `{!@variables.case_summary}` |
68
+ | Semantic intent or ambiguity | Model | user wants a human, is changing topics, or is asking hypothetically |
69
+
70
+ Ask:
71
+
72
+ 1. Does the runtime already know the exact fact?
73
+ 2. Must the same fact always produce the same branch?
74
+ 3. Does the branch protect authorization, ordering, or a consequential effect?
75
+ 4. What happens if the model gets the decision wrong?
76
+ 5. What flexibility is lost if the branch is locked?
77
+ 6. Does the decision require interpreting natural language and context?
78
+
79
+ Runtime knowledge is a signal, not an automatic ownership rule. Use
80
+ deterministic control when stable behavior is worth the rigidity. Use model
81
+ reasoning when interpretation and recovery are more valuable than exact
82
+ repeatability. For mixed cases, let the model interpret intent, then gate the
83
+ available consequence with trusted runtime state.
84
+
85
+ Do not write an exact comparison as model prose:
86
+
87
+ ```agentscript
88
+ | If {!@variables.account_status} == "blocked", route to account recovery.
89
+ ```
90
+
91
+ Interpolation only reveals the value. It still asks the model to perform and
92
+ obey the comparison. If its consequence must be stable, encode it with `if`.
93
+
94
+ ## Match Reasoning Burden to the Target Model
95
+
96
+ Record the deployed model and configuration when they are known. For each
97
+ reasoning iteration, count the distinct classifications, precedence rules,
98
+ tool choices, and exact sequences the model must reconcile.
99
+
100
+ - A stronger model may handle broader semantic judgment with fewer examples.
101
+ - A smaller model generally benefits from a narrower objective, clearer
102
+ boundaries, and fewer simultaneous decisions.
103
+ - Treat contradictory instructions, missing values, impossible sequencing, and
104
+ invalid state combinations as authoring defects rather than assuming the
105
+ selected model will repair them.
106
+
107
+ If the target model is unknown, mark posture fit as unassessed. Do not
108
+ over-script preemptively for a hypothetical weak model or declare a dense
109
+ prompt safe because a hypothetical stronger model might follow it.
110
+
111
+ ## Failure Mode to Avoid
112
+
113
+ Do not start with step-by-step **prose** directives like:
114
+
115
+ - `Step 1: invoke X`
116
+ - `Step 2: invoke Y`
117
+ - `CRITICAL: always invoke Z`
118
+
119
+ These ask the LLM to follow a fixed procedure via natural language — brittle
120
+ and easily ignored.
121
+
122
+ Deterministic `if/else` conditionals are resolved before the LLM sees the
123
+ prompt, but that does not make every branch desirable. Justify each branch by
124
+ the value of stable behavior relative to its flexibility and lifecycle cost.
125
+ Common reasons include regulation, authorization, confirmed consequences,
126
+ external ordering, and reproduced trace failures. Its variable needs a known
127
+ writer and consumer.
128
+
129
+ **Favor runtime conditions when:**
130
+ - The branch consumes verified authorization or eligibility
131
+ - The branch consumes exact action output or confirmed consequence data
132
+ - The branch enforces required external ordering
133
+ - A reproduced trace failure requires deterministic resolution
134
+
135
+ **Favor prompt-led reasoning when:**
136
+ - The LLM needs judgment/flexibility (tone, phrasing, edge-case handling)
137
+ - The decision depends on unstructured user input the LLM must interpret
138
+ - Surviving conversation history already contains the relevant fact
139
+ - A rigid branch would make ordinary correction, digression, or intent change
140
+ harder without protecting a meaningful invariant
141
+
142
+ ## Posture Matrix
143
+
144
+ | Decision | Scripted | Mixed | Agentic |
145
+ |---|---|---|---|
146
+ | Action ordering | gates on required external outcomes | gates on real invariants | gates on real invariants |
147
+ | Action parameters | mostly pinned | mixed pinned + `...` | mostly `...` |
148
+ | Instructions | step-by-step with many branches | guidance with targeted branching | high-level intent, minimal branching |
149
+
150
+ When requirements do not justify a control, start prompt-led and add control
151
+ only where the cost of probabilistic behavior warrants it. When requirements
152
+ do justify strict sequencing, do not weaken it merely to appear more agentic.
153
+
154
+ ## Scripted Posture
155
+
156
+ Use when requirements are regulated, audited, or require strict traceability.
157
+
158
+ Signals in requirements:
159
+
160
+ - "regulated"
161
+ - "compliance"
162
+ - "auditable"
163
+ - "must trace every step"
164
+
165
+ Structural expectations:
166
+
167
+ - `available when` gates on auditable invariants
168
+ - Parameters mostly pinned to authored variables
169
+ - Detailed branching only where the regulated procedure requires it
170
+
171
+ ## Mixed Posture
172
+
173
+ Use when some decisions have machine-checkable invariants while the remaining
174
+ decisions depend on unstructured current intent or judgment.
175
+
176
+ Typical shape:
177
+
178
+ - Gate real invariants only (identity, entitlement, eligibility)
179
+ - Pin controlled values (for example `customer_id`), keep other values as `...`
180
+ - Use concise guidance, not full scripts
181
+
182
+ ## Agentic Posture
183
+
184
+ Use for open-ended assistance where the model can safely carry more reasoning.
185
+
186
+ Typical shape:
187
+
188
+ - Minimal gating outside trust/security invariants
189
+ - Most parameters use `...`
190
+ - High-level intent instructions with minimal branching
191
+
192
+ ## Review Checklist
193
+
194
+ For each subagent:
195
+
196
+ 1. Which posture is selected?
197
+ 2. Why that posture (regulation, trust gate, or observed failure)?
198
+ 3. Which invariants are enforced with `available when`?
199
+ 4. Which parameters are pinned, and what controlled source justifies each pin?
200
+ 5. For every variable, what named runtime expression or later action consumes it?
201
+ 6. Does that consumer need the exact stored value, or would a trusted boolean
202
+ outcome preserve the same invariant with less state?
203
+ 7. Which reset, expiry, correction, or cancellation paths can affect each
204
+ variable before it stops mattering, and are those paths defined?
205
+ 8. Which instructions can be simplified without losing required control?
206
+ 9. Which decisions are exact runtime facts, and which require semantic
207
+ interpretation?
208
+ 10. Is the reasoning burden supported by the deployed target model and evals?
209
+ 11. For each added control, what failure does it prevent and what
210
+ conversational flexibility does it remove?
211
+ 12. For each prompt-led decision, is the cost of a wrong or reordered choice
212
+ acceptable?
213
+
214
+ If a control cannot cite a cause and consumer, question it. Remove it only
215
+ after confirming that doing so preserves the required behavior.
@@ -31,8 +31,15 @@ Paths below are shown relative to the bots root directory. For org-backed retrie
31
31
  - variables updated by the action (bot variables set from invocation outputs)
32
32
  - escalation actions from system messages:
33
33
  - if a dialog contains `conversationSystemMessage` of type `Transfer`, add an action entry with `action_type: "escalate"`
34
- - determine escalation target type (`queue`, `flow`, `bot`, or `skill`) by reading `systemMessageMappings` under that `conversationSystemMessage` and resolving referenced variables against declarations in `<conversationVariables>`
35
- - store both the resolved `target_type` and mapped target identifier/value on the action record
34
+ - resolve the escalation target (`target_type` is one of `queue`, `flow`, `bot`, or `skill`) from the `systemMessageMappings` under that `conversationSystemMessage`:
35
+ - **`systemMessageMappings` present:** for each mapped variable (`variableName`):
36
+ - **target type** — infer from the variable's `SObjectType` in its `<conversationVariables>` declaration (for example `FlowDefinition` -> `flow`, `Queue` -> `queue`). If `SObjectType` is absent or matches none of these, record it as an open question; do not guess.
37
+ - **target value/name** — infer from the variable/value assignments that write the mapped variable earlier in the conversation: `VariableOperation` `Set` steps whose `botVariableOperands` `targetName` is the mapped variable (use `sourceName` for a metadata reference such as `sourceType: FlowDefinition`, or `sourceValue` for a literal), and action output mappings (`invocationMappings` of type `Output`) that write it. When an action output writes the variable, the value is dynamic: record the action and output parameter instead of a fixed name. When different paths assign different values, record each value with the condition under which it is assigned. If no assignment is found, record it as an open question.
38
+ - **`systemMessageMappings` absent:** the transfer uses the bot's default routing. Read the `<defaultOutboundFlow>` entry in `bots/<BotName>/<BotName>.bot-meta.xml`. The target type is `flow` and the target name is that entry's value. If the bot has no `<defaultOutboundFlow>`, record the unresolved target as an open question.
39
+ - store the resolved `target_type`, the target identifier/value, the source of the resolution (`systemMessageMappings` variable + assignment step, or `defaultOutboundFlow`), and the condition guarding the transfer step on the action record
40
+ - end chat from system messages:
41
+ - if a dialog contains `conversationSystemMessage` of type `EndChat`, add an action entry with `action_type: "end_session"`
42
+ - this is the terminal step in the conversation and indicates that the conversation should be ended
36
43
  - persist this as `invoked_actions` on the dialog node and as action-level records in `action_inventory`
37
44
  5. While scanning each step, detect transition-producing step types:
38
45
  - `Navigation` with `<botNavigationLinks>`
@@ -166,8 +173,8 @@ Paths below are shown relative to the bots root directory. For org-backed retrie
166
173
 
167
174
  When input mode is offline (`.bot-meta.xml` + `.botVersion-meta.xml` provided, no org fetch):
168
175
 
169
- 1. Generate action signatures from bot metadata mappings only (do not block on missing Apex/Flow source code).
170
- 2. For each invocation mapping:
176
+ 1. Prioritize existing local implementation files. For each invoked action, if its Apex class (under `classes/`, using `@InvocableMethod` / `@InvocableVariable`), Flow (under `flows/`), or other referenced artifact is present in `--offline-dir`, generate the signature from that file.
177
+ 2. Fall back to bot metadata mappings only for actions whose implementation files are not present locally (do not block on missing Apex/Flow source code). For each such invocation mapping:
171
178
  - extract action parameter names from invocation input/output mapping keys
172
179
  - resolve mapped bot variable names from mapping values
173
180
  - infer parameter types from mapped variable declarations in `<conversationVariables>` / `<contextVariables>` when available
@@ -59,7 +59,7 @@ Use this when user provides Einstein Bot artifacts and asks to migrate/upgrade i
59
59
  - Flow metadata under `flows/` (when present)
60
60
  - Apex classes under `classes/` (when present)
61
61
  - any other local files referenced by bot artifacts that are needed for extraction/mapping fidelity
62
- - In offline mode, do not limit ingestion to only two XML files if additional referenced artifacts are available locally.
62
+ - In offline mode, prioritize existing local implementation files: when Flow metadata, Apex classes, or other referenced artifacts are present in `--offline-dir`, use them as the primary source for action signatures and contracts. Fall back to the bot and botVersion XML mappings only for actions whose implementation files are not present locally.
63
63
  2. **Extract migration structure** — Read [Extraction Blueprint](extraction-blueprint.md) and derive:
64
64
  - bot capabilities
65
65
  - dialog graph
@@ -74,8 +74,7 @@ Use this when user provides Einstein Bot artifacts and asks to migrate/upgrade i
74
74
  - `<run_project_dir>/<AgentName>-open-questions.md`
75
75
  Use the same run-specific SFDX project directory created in the SF CLI setup step; do not write handoff artifacts to repository root.
76
76
  The Agent Spec markdown MUST use the same section names/order as
77
- `skills/agentforce-generate/assets/agent-spec-template.md`, then append the
78
- `## Migration Notes (Einstein Bot -> Agentforce)` appendix defined in [Handoff Output Format](handoff-output-format.md).
77
+ [agent-spec-template.md](../assets/_vendored/agent-spec-template.md) from the `agentforce-generate` skill.
79
78
  5. **Validate handoff quality** — Read [Quality Checklist](quality-checklist.md) and verify all required sections and mapping completeness before presenting output.
80
79
  6. **Resolve open questions loop (required)** — After generating artifacts, resolve all entries in `<run_project_dir>/<AgentName>-open-questions.md`. In interactive mode, guide the user through them one-by-one; when `--interactive=false`, auto-apply the recommended default for each entry without prompting. For each resolved item, immediately update:
81
80
  - `<run_project_dir>/<AgentName>-AgentSpec.md`
@@ -90,6 +89,23 @@ Use this when user provides Einstein Bot artifacts and asks to migrate/upgrade i
90
89
  - `<run_project_dir>/extraction-summary.json` as supporting context
91
90
  - `<run_project_dir>/<AgentName>-einstein-bot-handoff.json` and `<run_project_dir>/<AgentName>-open-questions.md`
92
91
  - `input_mode` (`online` or `offline`) explicit context
92
+ - as the final section of the prompt, a `## Hand-back and remaining orchestrator steps` section. It contains this hand-back instruction verbatim:
93
+ > This `/agentforce-generate` run is a sub-step of the `agentforce-bot-upgrade` orchestrator, not the end of the task. When generation finishes, do NOT write a final summary or end your turn. Write the outputs required by `agentforce-generate-output-contract.md`, then immediately return to `agentforce-bot-upgrade` and execute the remaining steps below in the same turn. The task is complete only after Step 5 has written `report.md`.
94
+
95
+ It is followed by a "Remaining orchestrator steps" checklist. Fill in this bot's concrete paths, org alias, and agent API name:
96
+ 1. **Step 4 — Post-conversion enhancements.** Run the [Post-Conversion Enhancements Reference](post-conversion-enhancements-reference.md) workflow on the generated `.agent` file, editing it in place.
97
+ 2. **Step 4 — Compile** (online mode only). Redeploy the bundle and run `sf agent validate authoring-bundle --api-name <AgentApiName> --target-org <org-alias> --json`.
98
+ 3. **Step 4 — Commit** (online mode only, and only when compile succeeds). Run `sf agent publish authoring-bundle --api-name <AgentApiName> --target-org <org-alias> --json`.
99
+ - This commit is pre-authorized by the orchestrator. Do not ask for publish approval, and do not require live preview.
100
+ - Never activate.
101
+ - If publish fails, fix the cause and retry, or record the failure and continue.
102
+ 4. **Step 4 — Publish audit** (online mode only). Append one record to `<orchestrator_working_dir>/publish-audit.jsonl` for every publish attempt, with actor, action, target, timestamp, and outcome. Never include tokens, session IDs, or credentials.
103
+ 5. **Step 4 — Agent ID and version** (online mode only, after a successful commit). Query `BotDefinition` and `BotVersion` for the agent ID and the committed version number.
104
+ 6. **Step 4 — Summary.** Prepare the color-coded per-agent summary as input to Step 5. Do not end the turn here.
105
+ 7. **Step 5 — Report.** Write `<orchestrator_working_dir>/report.md` last. The run ends only after this file is written; then emit the final message.
106
+
107
+ For `input_mode=offline`, the checklist marks items 2–5 as skipped (no compile, commit, or audit) and keeps items 1, 6, and 7.
108
+ The output contract must end with the same hand-back reminder: capturing these outputs is not completion; the orchestrator continues with the remaining Step 4 and Step 5 checklist in the invocation prompt.
93
109
  For `input_mode=offline`, include these strict instructions in the prompt:
94
110
  - syntax/structural validation is still mandatory
95
111
  - skip only org-dependent CLI operations
@@ -9,14 +9,14 @@
9
9
  The extraction step also persists `extraction-summary.json` in the same directory (see [Extraction Blueprint](extraction-blueprint.md)); it is carried forward as supporting context in the handoff.
10
10
 
11
11
  Write all required files in the run-specific SFDX project directory for the selected input mode:
12
- - Mode A: org-backed run project directory created during SF CLI setup
13
- - Mode B: offline run project directory containing/associated with provided XML inputs
12
+ - Online: org-backed run project directory created during SF CLI setup
13
+ - Offline: run project directory containing/associated with provided XML inputs
14
14
  Do not write handoff artifacts in the repository root.
15
15
 
16
16
  ## 1) Agent Spec Markdown
17
17
 
18
18
  Create `<run_project_dir>/<AgentName>-AgentSpec.md` by copying:
19
- `skills/agentforce-generate/assets/agent-spec-template.md`
19
+ [agent-spec-template.md](../assets/_vendored/agent-spec-template.md) from the `agentforce-generate` skill.
20
20
 
21
21
  The handoff Agent Spec MUST:
22
22
 
@@ -36,49 +36,26 @@ Required section order:
36
36
  9. `## Architecture Pattern`
37
37
  10. `## Agent Configuration`
38
38
 
39
- ### Section-by-section generation guidance (from `extraction-summary.json`)
39
+ ### How the generated agent works
40
40
 
41
- #### `## Purpose & Scope`
41
+ Write every section below for this runtime model.
42
42
 
43
- 1. Derive a meaningful purpose statement from bot description/identity and extracted intent summaries.
44
- 2. Describe the agent's business scope using the intents the bot actually handles.
45
- 3. Restrict scope to capabilities backed by configured actions:
46
- - do not claim unsupported capabilities
47
- - call out out-of-scope requests when no action support exists
48
-
49
- #### `## Behavioral Intent`
50
-
51
- 1. Start traversal from `Welcome` (or extracted entry dialog when `Welcome` is absent).
52
- 2. Build each workflow using:
53
- - `dialog_functionality_summary`
54
- - ordered `step_functionality`
55
- 3. Handle navigations by following target dialogs recursively, while preserving navigation semantics:
56
- - **`Call` navigation**: transfer control to the target dialog, then return control back to the source dialog after target execution completes. Continue source-dialog remaining steps after return.
57
- - **`Redirect` navigation**: transfer control permanently to the target dialog and halt source-dialog execution immediately (no return to source flow).
58
- 4. While reconstructing flows, track `Call` vs `Redirect` semantics internally so downstream agent design preserves return/non-return behavior.
59
- 5. For `Call` flows, capture both:
60
- - the delegated target workflow behavior, and
61
- - the resumed source workflow behavior after return.
62
- 6. For `Redirect` flows, do not append post-redirect source steps to the same path unless there is an explicit later re-entry edge.
63
- 7. Reconstruct meaningful user conversation flows across traversed dialogs.
64
- 8. Identify hard checkpoints by capturing strict ordering constraints, mandatory preconditions, and enforced branches/escalations.
65
- 9. Final behavioral intent must include:
66
- - ordered events for one or more workflows
67
- - action invocation scope and sequencing
68
- - variable usage scope (reads/writes and gating variables)
69
- - escalation/routing behavior
70
- - normalized transition behavior (return-after-delegation vs one-way transfer) expressed in agent-native terms only
71
- - other critical bot-specific constraints that affect conversation behavior
43
+ The generated agent is an intelligent, LLM-backed conversational experience provider. Unlike the bot, it does not follow a fixed dialog tree: it interprets each user message and decides which subagent should handle it.
72
44
 
73
- 10. Do NOT emit raw bot navigation constructs (`Call`, `Redirect`) in the final Agent Spec text. Convert them into agent-native behavioral descriptions only.
45
+ 1. **Router first.** Every incoming user message is processed first by the router subagent — the `start_agent` block. The router only classifies and routes; it never answers the user directly.
46
+ 2. **Intent-based transitions.** The router transitions to the subagent that best matches the user's intent, judged against each subagent's `description` and its transition action descriptions. Write every subagent description with a clear positive scope and important exclusions, so routing stays unambiguous.
47
+ 3. **Default `ambiguous` and `off_topic` subagents.** Always include both subagents, each with its own router transition, in every generated Agent Spec — even if the bot had no equivalent dialogs. List them in `## Subagent Posture` and `## Subagent Map` like any other subagent. Neither invokes any action.
48
+ - **`ambiguous`** — handles requests whose intent is unclear or could match more than one subagent. Say briefly that the request is unclear and ask one focused question for the missing detail. Do not guess an intent.
49
+ - **`off_topic`** — handles requests that no subagent covers. Say that the request is outside what the agent can help with, state the supported capabilities, and ask which of them the user wants help with. Do not answer the out-of-scope question.
50
+ - Write the two router transition descriptions so they do not overlap: unclear-but-possibly-supported requests go to `ambiguous`; clearly unsupported requests go to `off_topic`.
51
+ - Once the user's reply makes the intent clear, the router can route the request.
74
52
 
75
- #### `## Subagent Posture`
53
+ This default applies to every bot upgrade. It overrides agentforce-generate's general guidance to create `ambiguous_question` or `off_topic` subagents only when needed.
76
54
 
77
- 1. Derive baseline subagents from dialog clusters (`1 cluster -> 1 subagent`).
78
- 2. Ensure each subagent has coherent responsibility boundaries based on associated dialog behavior and actions.
79
- 3. Add additional subagents when dialogs are not assigned to any cluster but represent distinct bot functionality.
80
- 4. Ensure all dialog functionality is covered by at least one subagent.
81
- 5. Record any uncertain assignments in open questions instead of forcing low-confidence grouping.
55
+ Related agentforce-generate references:
56
+ - [Router-First Architecture Mechanics](_vendored/architecture-patterns.md#router-first-architecture-mechanics) — router behavior and transition paths.
57
+ - [Guardrail subagents](_vendored/agent-design-and-spec-creation.md) ("Guardrail Subagents") — example `ambiguous_question` and `off_topic` instructions.
58
+ - [Off-Topic and Escalation Routing](_vendored/agent-subagent-map-diagrams.md#off-topic-and-escalation-routing) — how ambiguity and out-of-scope paths appear in the Subagent Map.
82
59
 
83
60
  ### Bot-specific artifact translation rules (required)
84
61
 
@@ -106,14 +83,6 @@ When generating the Agent Spec, do not retain raw bot-only entities. Translate t
106
83
  - retain a lightweight guided-choice pattern only when it materially improves clarity or control
107
84
  6. If menu translation approach is ambiguous, ask the user and record the decision in open questions before finalizing. When `--interactive=false`, do not ask — apply the recommended translation, record it in open questions as an auto-applied decision, and continue.
108
85
 
109
- Then add this migration-specific appendix section at the end:
110
-
111
- 11. `## Migration Notes (Einstein Bot -> Agentforce)`
112
- - Source bot identity and version
113
- - Mapping confidence summary
114
- - Unmapped constructs
115
- - Open decisions requiring user approval
116
-
117
86
  ### Action Invocation Optimization Rules
118
87
 
119
88
  Use this step to optimize conversation efficiency by reducing unnecessary action invocations while preserving behavior and data contracts.
@@ -135,10 +104,19 @@ Use this step to optimize conversation efficiency by reducing unnecessary action
135
104
 
136
105
  If an action is applicable only to Einstein Bot runtime (for example, internal bot-state bookkeeping actions):
137
106
 
138
- 1. Mark the action as `candidate_for_removal`.
107
+ Examples of bot-only actions:
108
+ - storing the previous or current dialog name (for example, to return the user to a dialog later)
109
+ - updating bot-only variables, such as dialog counters, menu-selection flags, or retry and fallback counters
110
+ - tracking bot navigation state, such as recording which menu option or dialog path the user took
111
+ - logging dialog visits or bot-session telemetry that no business process consumes
112
+
113
+ An action that also changes business data, or sets a variable that a business action or a routing decision still needs, is not bot-only.
114
+
115
+ 1. Mark the action as `CANDIDATE_FOR_REMOVAL`.
139
116
  2. Show the user why it is bot-only and why it is not needed in Agentforce.
140
117
  3. Do not remove it automatically.
141
- 4. Remove only after explicit user confirmation. When `--interactive=false`, do not remove it — keep the action in place as the safe recommended default and record it as a deferred `candidate_for_removal` decision in open questions.
118
+ 4. Remove only after explicit user confirmation. When `--interactive=false`, do not remove it — keep the action in place as the safe recommended default and record it as a deferred `CANDIDATE_FOR_REMOVAL` decision in open questions.
119
+ 5. After the user confirms a removal, update `## Behavioral Intent` to match: in every workflow that invoked the removed action, drop its invocation from the ordered events and action sequencing, and drop any variable reads/writes that only that action used. Keep the rest of each workflow's behavior and ordering unchanged. Also remove the action from `## Actions` and `## Action Invocation Strategy`.
142
120
 
143
121
  #### User review gate (required)
144
122
 
@@ -158,7 +136,58 @@ Before finalizing optimized actions, present a complete change summary to the us
158
136
 
159
137
  Apply changes only after user approval.
160
138
 
161
- #### Persistence requirement
139
+ ### Section-by-section generation guidance (from `extraction-summary.json`)
140
+
141
+ #### `## Purpose & Scope`
142
+
143
+ 1. Derive a meaningful purpose statement from bot description/identity and extracted intent summaries.
144
+ 2. Describe the agent's business scope using the intents the bot actually handles.
145
+ 3. Restrict scope to capabilities backed by configured actions:
146
+ - do not claim unsupported capabilities
147
+ - call out out-of-scope requests when no action support exists
148
+
149
+ #### `## Behavioral Intent`
150
+
151
+ 1. Start traversal from `Welcome` (or extracted entry dialog when `Welcome` is absent).
152
+ 2. Build each workflow using:
153
+ - `dialog_functionality_summary`
154
+ - ordered `step_functionality`
155
+ 3. Handle navigations by following target dialogs recursively, while preserving navigation semantics:
156
+ - **`Call` navigation**: transfer control to the target dialog, then return control back to the source dialog after target execution completes. Continue source-dialog remaining steps after return.
157
+ - **`Redirect` navigation**: transfer control permanently to the target dialog and halt source-dialog execution immediately (no return to source flow).
158
+ 4. While reconstructing flows, track `Call` vs `Redirect` semantics internally so downstream agent design preserves return/non-return behavior.
159
+ 5. For `Call` flows, capture both:
160
+ - the delegated target workflow behavior, and
161
+ - the resumed source workflow behavior after return.
162
+ 6. For `Redirect` flows, do not append post-redirect source steps to the same path unless there is an explicit later re-entry edge.
163
+ 7. Reconstruct meaningful user conversation flows across traversed dialogs.
164
+ - Each workflow might contain variable-based conditions for routing to other dialogs. Parse these and convert routing-specific conditions into equivalent natural-language LLM instructions. For example, `if selected_option == 'Bookings'` can be converted into "If the user wants bookings information, route to the bookings subagent."
165
+ 8. Identify hard checkpoints by capturing strict ordering constraints, mandatory preconditions, and enforced branches/escalations.
166
+ - If the ordering of actions is strictly enforced, retain the same ordering in the agent. For example, the user can check their bookings only after logging in: enforce this with variable-based conditions (via `available when`) in `## Deterministic Controls (When Needed)`, in `## Behavioral Intent`, or both.
167
+ 9. Final behavioral intent must include:
168
+ - ordered events for one or more workflows
169
+ - action invocation scope and sequencing
170
+ - variable usage scope (reads/writes and gating variables)
171
+ - escalation/routing behavior
172
+ - normalized transition behavior (return-after-delegation vs one-way transfer) expressed in agent-native terms only
173
+ - other critical bot-specific constraints that affect conversation behavior
174
+
175
+ 10. Do NOT emit raw bot navigation constructs (`Call`, `Redirect`) in the final Agent Spec text. Convert them into agent-native behavioral descriptions only.
176
+
177
+ #### `## Subagent Posture`
178
+
179
+ Use [posture-and-determinism.md](_vendored/posture-and-determinism.md) from the `agentforce-generate` skill as the definition of posture (scripted / mixed / agentic) and of how to choose it. Read it before deriving this section; do not invent posture categories or criteria beyond it.
180
+
181
+ 1. Derive baseline subagents from dialog clusters (`1 cluster -> 1 subagent`).
182
+ 2. Ensure each subagent has coherent responsibility boundaries based on associated dialog behavior and actions.
183
+ 3. Add additional subagents when dialogs are not assigned to any cluster but represent distinct bot functionality.
184
+ 4. Ensure all dialog functionality is covered by at least one subagent.
185
+ 5. Record any uncertain assignments in open questions instead of forcing low-confidence grouping.
186
+ 6. For each subagent, choose its posture per the posture definition, based on the extracted dialog behavior. A rigid bot step order does not by itself require scripted posture; pin only what the definition says needs a guarantee (for example authorization or identity checks, confirmed consequential actions, or externally required ordering).
187
+ 7. Fill the template's posture table for every subagent: `Subagent`, `Posture`, `Why this posture?` (grounded in the bot's dialog behavior), and `Deterministic controls (if any)`. Keep the deterministic controls consistent with `## Deterministic Controls (When Needed)`.
188
+ 8. If the posture of a subagent is ambiguous, record it in open questions with a recommended posture.
189
+
190
+ ### Persistence requirement
162
191
 
163
192
  After user confirms, update the Agent Spec file to reflect all finalized action changes (adds/updates/deletes), including:
164
193
 
@@ -166,6 +195,7 @@ After user confirms, update the Agent Spec file to reflect all finalized action
166
195
  - input/output contracts
167
196
  - variable read/write assignments
168
197
  - action invocation strategy updates required by the optimization
198
+ - `## Behavioral Intent` workflow updates for removed actions (see Bot-only action handling, step 5)
169
199
 
170
200
  Do not treat non-confirmed changes as final.
171
201
 
@@ -4,15 +4,15 @@
4
4
 
5
5
  Input mode is selected from `--mode <online|offline>`:
6
6
 
7
- 1. **Online (Mode A: org-backed retrieval)** — Use org alias + bot identity, then fetch metadata/dependencies via SF CLI.
8
- 2. **Offline (Mode B: local metadata input)** — Use provided local metadata/artifacts directly without org fetch.
7
+ 1. **Online (org-backed retrieval)** — Use org alias + bot identity, then fetch metadata/dependencies via SF CLI.
8
+ 2. **Offline (local metadata input)** — Use provided local metadata/artifacts directly without org fetch.
9
9
 
10
10
  If `--mode` is omitted, default to **online**.
11
11
  Only ask the user to clarify mode when provided inputs are insufficient or contradictory for the inferred/default mode. When `--interactive=false`, do not ask — proceed with the inferred/default mode and record the assumption; halt only if the inputs cannot support any mode.
12
12
 
13
13
  ## Supported Input Modes
14
14
 
15
- ### Mode A: Org-backed retrieval
15
+ ### Online: Org-backed retrieval
16
16
 
17
17
  Required inputs:
18
18
 
@@ -20,7 +20,7 @@ Required inputs:
20
20
  2. `--bot <bot-name>` — Einstein Bot developer name/identifier to migrate.
21
21
  3. `--bot-version <bot-version>` — specific version to migrate (for example: `v3`).
22
22
 
23
- ### Mode B: Offline metadata input (new)
23
+ ### Offline: Local metadata input (new)
24
24
 
25
25
  Required inputs:
26
26
 
@@ -54,8 +54,8 @@ If required inputs for the selected mode are missing, stop and ask for them befo
54
54
 
55
55
  ## Identity Resolution Rules
56
56
 
57
- - For Mode A, use `org-alias + bot + bot-version` as the run identity key.
58
- - For Mode B, use `bot + bot-version` derived from provided XML metadata (or confirmed from user when not derivable).
57
+ - For Online mode, use `org-alias + bot + bot-version` as the run identity key.
58
+ - For Offline mode, use `bot + bot-version` derived from provided XML metadata (or confirmed from user when not derivable).
59
59
  - Do not merge artifacts from different versions in the same run.
60
60
  - If source files contain a mismatched bot identity, pause and ask the user which identity is authoritative. When `--interactive=false`, do not pause — treat the identity declared in the authoritative bot metadata as the recommended default and record the assumption in `open_questions`.
61
61
 
@@ -67,7 +67,7 @@ If required inputs for the selected mode are missing, stop and ask for them befo
67
67
 
68
68
  ## Post-Input Finalization Workflow (Required)
69
69
 
70
- ### Mode A: Org-backed retrieval
70
+ ### Online: Org-backed retrieval
71
71
 
72
72
  After `--org-alias + --bot + --bot-version` are finalized, execute the SF CLI sequence in:
73
73
 
@@ -82,7 +82,7 @@ This is the canonical command list for:
82
82
 
83
83
  Any unresolved dependency must be recorded in `open_questions` and mapped as `NEEDS_STUB` where applicable.
84
84
 
85
- ### Mode B: Offline metadata input
85
+ ### Offline: Local metadata input
86
86
 
87
87
  When both XML files are provided (`.bot-meta.xml` + `.botVersion-meta.xml`):
88
88
 
@@ -12,6 +12,7 @@ Convert extracted Einstein Bot behavior into a high-quality Agent Spec that `/ag
12
12
  - **Action inventory** -> **Action inventory in spec** (`NEEDS_STUB` when implementation unknown)
13
13
  - **Fallback dialogs** -> **Boundary handling and recovery behavior**
14
14
  - **Transfer/system handoff** -> **Built-in `@utils.escalate`** (escalation policy; never a new/standalone action)
15
+ - **End chat** -> **Built-in `@utils.end_session`** (conversation close; never a new/standalone action)
15
16
 
16
17
  ## Escalation Mapping Rule
17
18
 
@@ -26,6 +27,19 @@ Instead:
26
27
  - Express the escalation as an explicit `@utils.escalate` invocation in the relevant subagent's instructions (typically a terminal step of an escalation subagent).
27
28
  - Exclude the transfer from the action inventory entirely (it is not an authored action).
28
29
 
30
+ ## End Chat Mapping Rule
31
+
32
+ End-chat behavior (Einstein Bot `SystemMessage` `EndChat`, or any step that closes the conversation) MUST be mapped implicitly to the built-in `@utils.end_session` utility. Do NOT:
33
+
34
+ - create a new action for it in the action inventory (no `End_Chat`/`End_Session`-style action, no `NEEDS_STUB`/`NEEDS_CREATION` entry for the end chat),
35
+ - model it as a flow/apex/standard-invocable action, or
36
+ - represent it as generic "end the conversation" prose without the explicit `@utils.end_session` control.
37
+
38
+ Instead:
39
+
40
+ - Express the end chat as an explicit `@utils.end_session` invocation in the relevant subagent's instructions, at the point in the flow where the bot ended the chat (typically the terminal step of that path).
41
+ - Exclude the end chat from the action inventory entirely (it is not an authored action).
42
+
29
43
  ## Dialog Functionality Extraction Rules
30
44
 
31
45
  Capture the functional behavior of each bot dialog before action optimization.
@@ -57,8 +71,7 @@ When generating `step_functionality`, handle all supported Einstein Bot step fam
57
71
  - **Set**: capture source -> target variable assignment.
58
72
  - **Unset**: capture variable clear/reset behavior.
59
73
  - **Collect**: capture which variable is collected, requiredness, and option source (static/dynamic).
60
- - **SetConversationLanguage**: capture locale/language state update.
61
- - **CollectAttachment**: capture file-collection requirement and resulting variable update.
74
+ - **SetConversationLanguage** and **CollectAttachment** are not supported: do not convert them, and record each skipped step (dialog + step) in open questions so it appears in the run report.
62
75
  3. **Invocation**
63
76
  - Capture invocation target, invocation type (`apex`, `flow`, `standardInvocableAction`, `externalService`, `quickAction`, `api`), input mappings, output mappings, and resulting variable writes.
64
77
  4. **Navigation**
@@ -68,14 +81,14 @@ When generating `step_functionality`, handle all supported Einstein Bot step fam
68
81
  6. **Group**
69
82
  - Process nested steps recursively in order, preserving parent conditions and emitting child step sentences in sequence.
70
83
  7. **SystemMessage**
71
- - **Transfer**: capture escalation behavior and resolved target type/value, and map it implicitly to the built-in `@utils.escalate` (see Escalation Mapping Rule) — do not emit it as a new action.
72
- - **EndChat**: capture terminal behavior and conversation close.
84
+ - **Transfer**: capture escalation behavior and resolved target type/value (resolved per [Extraction Blueprint](extraction-blueprint.md) step 4: from `systemMessageMappings` variable `SObjectType` + assignments when present, otherwise from the bot's `defaultOutboundFlow`), and map it implicitly to the built-in `@utils.escalate` (see Escalation Mapping Rule) — do not emit it as a new action.
85
+ - **EndChat**: capture terminal behavior and conversation close, and map it implicitly to the built-in `@utils.end_session` (see End Chat Mapping Rule) — do not emit it as a new action.
73
86
  8. **RecordLookup**
74
87
  - Capture queried object/entity, filter criteria, and output variable/list assignment.
75
88
  9. **RichMessage**
76
- - Capture rich interaction type (for example forms/payments/selectors/links) and expected follow-up behavior.
89
+ - Not supported: do not convert it, and record each skipped step (dialog + step) in open questions so it appears in the run report.
77
90
  10. **GoalStep**
78
- - Mark as bot-specific/non-agentic telemetry unless it drives business behavior; include only if behaviorally relevant.
91
+ - Not supported and not needed in the agent: do not convert it, and record each skipped step (dialog + step) in open questions so it appears in the run report.
79
92
 
80
93
  ### Step rendering rules
81
94