@salesforce/afv-skills 1.37.0 → 1.38.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 (247) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-generate/README.md +20 -3
  3. package/skills/agentforce-generate/SKILL.md +253 -440
  4. package/skills/agentforce-generate/assets/agent-spec-template.md +6 -2
  5. package/skills/agentforce-generate/assets/agents/order-service.agent +16 -12
  6. package/skills/agentforce-generate/assets/agents/production-faq.agent +4 -4
  7. package/skills/agentforce-generate/assets/agents/router-first.agent +5 -5
  8. package/skills/agentforce-generate/assets/agents/template-single-subagent.agent +4 -4
  9. package/skills/agentforce-generate/assets/agents/verification-gate.agent +8 -6
  10. package/skills/agentforce-generate/assets/agents/voice-knowledge-grounded.agent +9 -9
  11. package/skills/agentforce-generate/assets/agents/voice-service-agent.agent +7 -7
  12. package/skills/agentforce-generate/assets/patterns/README.md +3 -3
  13. package/skills/agentforce-generate/assets/patterns/action-callbacks.agent +5 -5
  14. package/skills/agentforce-generate/assets/patterns/advanced-input-bindings.agent +6 -8
  15. package/skills/agentforce-generate/assets/patterns/bidirectional-routing.agent +11 -13
  16. package/skills/agentforce-generate/assets/patterns/critical-input-collection.agent +11 -16
  17. package/skills/agentforce-generate/assets/patterns/lifecycle-events.agent +2 -3
  18. package/skills/agentforce-generate/assets/patterns/llm-controlled-actions.agent +6 -7
  19. package/skills/agentforce-generate/assets/patterns/open-gate-routing.agent +3 -3
  20. package/skills/agentforce-generate/assets/patterns/prompt-template-action.agent +14 -19
  21. package/skills/agentforce-generate/assets/patterns/system-instruction-overrides.agent +11 -20
  22. package/skills/agentforce-generate/references/actions-reference.md +2 -2
  23. package/skills/agentforce-generate/references/agent-audit-and-repair.md +135 -0
  24. package/skills/agentforce-generate/references/agent-audit-candidate-verification.md +160 -0
  25. package/skills/agentforce-generate/references/agent-audit-diagnostic-catalog.md +156 -0
  26. package/skills/agentforce-generate/references/agent-audit-diagnostics-actions-state.md +176 -0
  27. package/skills/agentforce-generate/references/agent-audit-diagnostics-architecture-evaluation.md +68 -0
  28. package/skills/agentforce-generate/references/agent-audit-diagnostics-instructions-routing.md +283 -0
  29. package/skills/agentforce-generate/references/agent-audit-evaluation-loop.md +191 -0
  30. package/skills/agentforce-generate/references/agent-audit-repair-report.md +143 -0
  31. package/skills/agentforce-generate/references/agent-audit-scope-path-review.md +180 -0
  32. package/skills/agentforce-generate/references/agent-design-and-spec-creation.md +105 -59
  33. package/skills/agentforce-generate/references/agent-script-core-language.md +144 -61
  34. package/skills/agentforce-generate/references/agent-subagent-map-diagrams.md +33 -23
  35. package/skills/agentforce-generate/references/agent-validation-and-debugging.md +37 -11
  36. package/skills/agentforce-generate/references/agentscript-toolchain.md +112 -0
  37. package/skills/agentforce-generate/references/architecture-patterns.md +81 -18
  38. package/skills/agentforce-generate/references/common-control-flow-pitfalls.md +255 -0
  39. package/skills/agentforce-generate/references/control-flow-actions-sequencing.md +198 -0
  40. package/skills/agentforce-generate/references/control-flow-lifecycle-side-effects.md +87 -0
  41. package/skills/agentforce-generate/references/examples.md +22 -22
  42. package/skills/agentforce-generate/references/instruction-resolution.md +123 -83
  43. package/skills/agentforce-generate/references/known-issues.md +1 -2
  44. package/skills/agentforce-generate/references/optimization-pattern-1-data-flow.md +4 -0
  45. package/skills/agentforce-generate/references/optimization-pattern-2-deterministic-logic.md +33 -0
  46. package/skills/agentforce-generate/references/optimization-pattern-3-reference-syntax.md +32 -3
  47. package/skills/agentforce-generate/references/optimization-pattern-4-escalation.md +2 -2
  48. package/skills/agentforce-generate/references/patterns-by-requirement.md +3 -1
  49. package/skills/agentforce-generate/references/posture-and-determinism.md +103 -22
  50. package/skills/agentforce-generate/references/reference-map.md +19 -3
  51. package/skills/agentforce-generate/references/scoring-rubric.md +1 -1
  52. package/skills/agentforce-generate/references/voice-latency-heuristics.md +4 -0
  53. package/skills/agentforce-generate/references/voice-modality-reference.md +4 -4
  54. package/skills/agentforce-generate/references/zen-of-agentscript.md +139 -23
  55. package/skills/agentforce-generate/scripts/agentscript-sdk-loader.mjs +133 -0
  56. package/skills/agentforce-generate/scripts/index-agent.mjs +141 -0
  57. package/skills/agentforce-generate/scripts/setup-agentscript-sdk.mjs +337 -0
  58. package/skills/automation-sandbox-post-copy-config-generate/SKILL.md +1 -1
  59. package/skills/automation-sandbox-post-copy-configure/SKILL.md +433 -0
  60. package/skills/automation-sandbox-post-copy-configure/assets/api_request_templates.json +89 -0
  61. package/skills/automation-sandbox-post-copy-configure/examples/sample_config_input.json +40 -0
  62. package/skills/automation-sandbox-post-copy-configure/examples/sample_execution_summary.md +79 -0
  63. package/skills/automation-sandbox-post-copy-configure/references/api_endpoints.md +273 -0
  64. package/skills/automation-sandbox-post-copy-configure/references/authentication.md +94 -0
  65. package/skills/automation-sandbox-post-copy-configure/references/execution_phasing.md +93 -0
  66. package/skills/automation-sandbox-post-copy-configure/references/rules_gotchas.md +35 -0
  67. package/skills/automation-sandbox-post-copy-configure/scripts/classify-patch-result.mjs +88 -0
  68. package/skills/automation-sandbox-post-copy-configure/scripts/map-metadata-key.mjs +98 -0
  69. package/skills/automation-sandbox-post-copy-configure/scripts/plan-phases.mjs +98 -0
  70. package/skills/automation-sandbox-post-copy-configure/scripts/resolve-target-org.mjs +56 -0
  71. package/skills/design-systems-slds-validate/SKILL.md +14 -13
  72. package/skills/dx-code-analyzer-custom-rule-create/examples/xpath-examples.md +1 -1
  73. package/skills/dx-code-analyzer-custom-rule-create/references/xpath-patterns-security.md +1 -1
  74. package/skills/dx-org-devhub-configure/SKILL.md +268 -0
  75. package/skills/dx-org-devhub-configure/examples/status-output.md +39 -0
  76. package/skills/dx-org-devhub-configure/scripts/devhub.sh +650 -0
  77. package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +116 -0
  78. package/skills/dx-org-manage/SKILL.md +135 -42
  79. package/skills/dx-org-manage/assets/derive-alias.sh +95 -0
  80. package/skills/dx-org-manage/assets/scratch-def.seed.json +6 -0
  81. package/skills/dx-org-manage/examples/README.md +1 -1
  82. package/skills/dx-org-manage/examples/scratch-orgs/delete_output.json +8 -0
  83. package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +23 -0
  84. package/skills/dx-org-manage/examples/scratch-orgs/list_output.json +58 -0
  85. package/skills/dx-org-manage/examples/scratch-orgs/resume_output.json +38 -0
  86. package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +1 -1
  87. package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +1 -1
  88. package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +41 -0
  89. package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +1 -1
  90. package/skills/dx-org-manage/examples/snapshots/error_output.json +3 -3
  91. package/skills/dx-org-manage/references/creating-scratch-org.md +2 -2
  92. package/skills/dx-org-manage/references/creating-snapshot.md +1 -2
  93. package/skills/dx-org-manage/references/definition_file_options.md +24 -0
  94. package/skills/dx-org-manage/references/edition_types.md +10 -8
  95. package/skills/dx-org-manage/references/opening-org.md +11 -12
  96. package/skills/dx-org-manage/references/scratch-org-create.md +303 -0
  97. package/skills/dx-org-manage/references/scratch-org-operations.md +135 -0
  98. package/skills/experience-aura-lwc-migrate/SKILL.md +120 -0
  99. package/skills/experience-aura-lwc-migrate/references/aura-api-expert.md +170 -0
  100. package/skills/experience-aura-lwc-migrate/references/aura-data-expert.md +172 -0
  101. package/skills/experience-aura-lwc-migrate/references/aura-migration-guidelines.md +299 -0
  102. package/skills/experience-aura-lwc-migrate/references/aura-prd-framework.md +79 -0
  103. package/skills/experience-aura-lwc-migrate/references/aura-redundant-code-expert.md +24 -0
  104. package/skills/experience-aura-lwc-migrate/references/aura-reference-expert.md +140 -0
  105. package/skills/experience-aura-lwc-migrate/references/aura-resolver-expert.md +115 -0
  106. package/skills/experience-aura-lwc-migrate/references/aura-slots-expert.md +67 -0
  107. package/skills/experience-aura-lwc-migrate/references/aura-style-expert.md +62 -0
  108. package/skills/experience-aura-lwc-migrate/references/aura-to-lwc-completeness-checklist.md +188 -0
  109. package/skills/experience-aura-lwc-migrate/references/aura-values-expert.md +67 -0
  110. package/skills/experience-content-media-search/SKILL.md +17 -12
  111. package/skills/experience-content-media-stock-image-search/SKILL.md +192 -0
  112. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +102 -0
  113. package/skills/experience-lds-best-practices-apply/SKILL.md +245 -0
  114. package/skills/experience-lds-best-practices-apply/references/adapter-apis.md +1640 -0
  115. package/skills/experience-lds-best-practices-apply/references/lds-data-consistency.md +126 -0
  116. package/skills/experience-lds-best-practices-apply/references/lds-expert.md +429 -0
  117. package/skills/experience-lds-best-practices-apply/references/lds-referential-integrity.md +322 -0
  118. package/skills/experience-lds-best-practices-apply/references/wire-adapter-types.md +1511 -0
  119. package/skills/experience-lds-graphql-generate/SKILL.md +222 -0
  120. package/skills/experience-lds-graphql-generate/references/generation-guide.md +236 -0
  121. package/skills/experience-lds-graphql-generate/references/generation-mutation.md +277 -0
  122. package/skills/experience-lds-graphql-generate/references/generation-query.md +237 -0
  123. package/skills/experience-lds-graphql-generate/scripts/fetch-lds-graphql-schema.sh +230 -0
  124. package/skills/experience-lds-graphql-generate/scripts/test-lds-graphql-query.sh +128 -0
  125. package/skills/experience-lwc-accessibility-validate/SKILL.md +112 -0
  126. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-1-1-non-text-content.md +88 -0
  127. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-i-lists.md +52 -0
  128. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-ii-tables.md +106 -0
  129. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iii-form-labels.md +78 -0
  130. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iv-regions.md +26 -0
  131. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-v-groups.md +66 -0
  132. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-5-identify-input.md +70 -0
  133. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-4-3-contrast.md +115 -0
  134. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-1-1-keyboard.md +47 -0
  135. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-4-link-purpose.md +39 -0
  136. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-6-headings-labels.md +50 -0
  137. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-1-pointer-gestures.md +54 -0
  138. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-2-pointer-cancellation.md +49 -0
  139. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-3-label-in-name.md +77 -0
  140. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-7-dragging-movement.md +45 -0
  141. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-1-on-focus.md +55 -0
  142. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-2-on-input.md +51 -0
  143. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-1-error-identification.md +84 -0
  144. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-2-labels-instructions.md +50 -0
  145. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-3-error-suggestion.md +64 -0
  146. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-i-name.md +105 -0
  147. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-ii-role.md +99 -0
  148. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-iii-value.md +97 -0
  149. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-1-1-non-text-content.md +83 -0
  150. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-1-use-of-color.md +62 -0
  151. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-10-resize-reflow.md +18 -0
  152. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-11-non-text-contrast.md +43 -0
  153. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-3-contrast.md +25 -0
  154. package/skills/experience-lwc-accessibility-validate/scripts/contrast-ratio.py +153 -0
  155. package/skills/experience-lwc-design-generate/SKILL.md +261 -0
  156. package/skills/experience-lwc-design-generate/references/figma-to-prd-blueprint.md +66 -0
  157. package/skills/experience-lwc-design-generate/references/prd-analysis-template.md +17 -0
  158. package/skills/experience-lwc-design-generate/scripts/check-component-name.sh +75 -0
  159. package/skills/experience-lwc-design-generate/scripts/detect-project-tools.sh +97 -0
  160. package/skills/experience-lwc-runtime-observe/SKILL.md +244 -0
  161. package/skills/experience-lwc-runtime-observe/examples/component-preview-and-dom.md +41 -0
  162. package/skills/experience-lwc-runtime-observe/scripts/extract-dom.sh +79 -0
  163. package/skills/experience-lwc-runtime-observe/scripts/open-frontdoor.sh +46 -0
  164. package/skills/experience-lwc-runtime-observe/scripts/verify-toolchain.sh +48 -0
  165. package/skills/experience-lwc-security-validate/SKILL.md +151 -0
  166. package/skills/experience-lwc-security-validate/examples/review-report.md +6 -0
  167. package/skills/experience-lwc-security-validate/examples/score-report.sarif.json +32 -0
  168. package/skills/experience-lwc-security-validate/references/lws-security-expert.md +986 -0
  169. package/skills/experience-lwc-security-validate/references/security-analysis.md +611 -0
  170. package/skills/experience-lwc-security-validate/scripts/check-lwc-import.sh +166 -0
  171. package/skills/experience-lwc-security-validate/scripts/validate-sarif.sh +131 -0
  172. package/skills/experience-ui-bundle-2gp-deploy/SKILL.md +454 -0
  173. package/skills/experience-ui-bundle-2gp-deploy/assets/CustomApplication.app-meta.xml +12 -0
  174. package/skills/experience-ui-bundle-2gp-deploy/assets/PermissionSet.permissionset-meta.xml +9 -0
  175. package/skills/experience-ui-bundle-2gp-deploy/scripts/find-bundle-package-dir.sh +53 -0
  176. package/skills/experience-ui-bundle-agentforce-client-generate/SKILL.md +104 -26
  177. package/skills/experience-ui-bundle-agentforce-client-generate/references/constraints.md +35 -24
  178. package/skills/experience-ui-bundle-agentforce-client-generate/references/examples.md +92 -1
  179. package/skills/experience-ui-bundle-agentforce-client-generate/references/style-tokens.md +2 -0
  180. package/skills/experience-ui-bundle-agentforce-client-generate/references/troubleshooting.md +14 -1
  181. package/skills/experience-ui-bundle-agentforce-client-generate/scripts/detect-framework.sh +67 -0
  182. package/skills/experience-ui-bundle-deploy/SKILL.md +83 -14
  183. package/skills/experience-ui-bundle-deploy/assets/Communities.settings-meta.xml +19 -0
  184. package/skills/experience-ui-bundle-deploy/assets/org-setup.config.template.json +5 -0
  185. package/skills/experience-ui-bundle-deploy/assets/social-login-auth-providers.apex +158 -0
  186. package/skills/experience-ui-bundle-deploy/references/config-scaffold.md +13 -1
  187. package/skills/experience-ui-bundle-deploy/references/social-login.md +179 -0
  188. package/skills/experience-ui-bundle-frontend-generate/SKILL.md +14 -0
  189. package/skills/experience-ui-bundle-mfa-configure/SKILL.md +6 -5
  190. package/skills/experience-ui-bundle-mfa-configure/references/social-login.md +15 -7
  191. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +41 -5
  192. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +10 -22
  193. package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +4 -19
  194. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +5 -0
  195. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +33 -150
  196. package/skills/mobile-platform-native-capabilities-integrate/references/nfc.md +35 -0
  197. package/skills/platform-apex-generate/SKILL.md +8 -7
  198. package/skills/platform-apex-test-generate/SKILL.md +3 -1
  199. package/skills/platform-apex-test-run/SKILL.md +9 -8
  200. package/skills/platform-lightning-type-widget-coordinate/SKILL.md +1 -1
  201. package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +1 -1
  202. package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +1 -1
  203. package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +3 -3
  204. package/skills/platform-mcp-tool-widget-coordinate/SKILL.md +43 -67
  205. package/skills/platform-mcp-tool-widget-coordinate/examples/action-name-source-prompt.md +1 -2
  206. package/skills/platform-mcp-tool-widget-coordinate/examples/apex-invocable-source-prompt.md +2 -3
  207. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-list-source-prompt.md +163 -0
  208. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-single-source-prompt.md +198 -0
  209. package/skills/platform-mcp-tool-widget-coordinate/examples/pasted-tool-output-prompt.md +0 -1
  210. package/skills/platform-mcp-tool-widget-coordinate/references/build-plan-format.md +17 -11
  211. package/skills/platform-mcp-tool-widget-coordinate/references/mcp-tool-output-discovery.md +48 -15
  212. package/skills/platform-mcp-tool-widget-coordinate/references/two-clt-modeling.md +73 -10
  213. package/skills/platform-mcp-tool-widget-coordinate/references/validation-gates.md +48 -8
  214. package/skills/platform-policy-rule-generate/SKILL.md +22 -12
  215. package/skills/platform-policy-rule-generate/references/deploy-errors.md +1 -1
  216. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +8 -29
  217. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  218. package/skills/platform-sharing-owd-configure/SKILL.md +20 -8
  219. package/skills/platform-sharing-owd-configure/references/access_levels.md +14 -1
  220. package/skills/platform-sharing-rules-generate/SKILL.md +67 -35
  221. package/skills/platform-sharing-rules-generate/examples/create-cases.md +16 -17
  222. package/skills/platform-sharing-rules-generate/examples/delete-cases.md +34 -79
  223. package/skills/platform-sharing-rules-generate/examples/edit-cases.md +13 -26
  224. package/skills/platform-sharing-rules-generate/scripts/count-remaining-rules.sh +33 -0
  225. package/skills/platform-widget-generate/SKILL.md +3 -5
  226. package/skills/platform-widget-generate/examples/conditional.json +18 -13
  227. package/skills/platform-widget-generate/examples/list-with-foreach.json +2 -2
  228. package/skills/platform-widget-generate/examples/single-object.json +2 -2
  229. package/skills/platform-widget-generate/references/schema-from-lightning-type.md +27 -6
  230. package/skills/platform-widget-generate/references/widget-bundle-layout.md +4 -3
  231. package/skills/service-itsm-agentic-setup-cmdb-access-assign/SKILL.md +287 -0
  232. package/skills/service-itsm-agentic-setup-cmdb-access-assign/references/mcp-invocation.md +260 -0
  233. package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/SKILL.md +252 -0
  234. package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/references/mcp-invocation.md +204 -0
  235. package/skills/service-itsm-agentic-setup-cmdb-configure/SKILL.md +259 -0
  236. package/skills/service-itsm-agentic-setup-cmdb-configure/references/mcp-invocation.md +188 -0
  237. package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +197 -0
  238. package/skills/service-itsm-agentic-setup-cmdb-coordinate/examples/output-templates.md +77 -0
  239. package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/SKILL.md +316 -0
  240. package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/references/mcp-invocation.md +221 -0
  241. package/skills/service-itsm-incident-priority-configure/SKILL.md +168 -0
  242. package/skills/service-itsm-incident-priority-configure/examples/matrix-operations.md +200 -0
  243. package/skills/service-itsm-incident-priority-configure/examples/render-matrix.md +54 -0
  244. package/skills/service-itsm-incident-priority-configure/examples/seed-full-matrix.md +52 -0
  245. package/skills/service-itsm-incident-priority-configure/references/sf-cli-invocation.md +264 -0
  246. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-source-prompt.md +0 -191
  247. package/skills/platform-policy-rule-generate/references/fixtures-index.md +0 -29
@@ -21,7 +21,7 @@
21
21
 
22
22
  Agent Script operates in two phases: deterministic resolution, then LLM reasoning.
23
23
 
24
- **Phase 1: Deterministic Resolution.** The runtime executes a subagent's reasoning instructions top to bottom — evaluating `if`/`else` conditions, running actions via `run`, and setting variables via `set`. The LLM is NOT involved yet. The runtime builds a prompt string by accumulating `|` pipe text and resolving conditional logic. If a `transition` command occurs, the runtime discards the current prompt and starts fresh with the target subagent.
24
+ **Phase 1: Deterministic Resolution.** The runtime executes a subagent's reasoning instructions top to bottom — evaluating `if`/`else` conditions, running actions via `run`, and setting variables via `set`. The LLM is NOT involved yet. The runtime builds a prompt string by accumulating `|` pipe text and resolving conditional logic. If a `transition` command occurs, the current subagent stops resolving and the target subagent begins its lifecycle with shared state and conversation history retained.
25
25
 
26
26
  **Phase 2: LLM Reasoning.** The runtime passes the resolved prompt to the LLM along with any reasoning actions (tools) the subagent exposes. The LLM decides what to do — it can call available actions but cannot modify the prompt text. It only reasons against what Phase 1 resolved.
27
27
 
@@ -36,8 +36,8 @@ subagent check_order:
36
36
  with id = @variables.order_id
37
37
  set @variables.status = @outputs.status
38
38
 
39
- | Your order status is {!@variables.status}.
40
- You can modify it using the {!@actions.update_order} action.
39
+ | Tell the user the exact order status is {!@variables.status} and
40
+ use {!@actions.update_order} for a requested modification.
41
41
 
42
42
  actions:
43
43
  update: @actions.update_order
@@ -53,7 +53,9 @@ You can modify it using the update_order action.
53
53
 
54
54
  The LLM then receives this prompt plus the `update` tool and decides whether to call it based on what the user asks.
55
55
 
56
- This split is critical: **deterministic logic controls WHAT the agent knows (via resolved prompt), and the LLM controls WHETHER and HOW to act on that knowledge**.
56
+ This split is critical: **deterministic resolution controls which authored
57
+ prompt text and tools reach the planner; the LLM chooses its text and
58
+ model-selected actions within that resolved context**.
57
59
 
58
60
  ---
59
61
 
@@ -96,14 +98,21 @@ subagent my_subagent:
96
98
 
97
99
  **Note:** The compiler does not enforce top-level block ordering. Use the order above when generating new files, but do not reorder existing files that use a different order — they are equally valid.
98
100
 
101
+ This page is a practical authoring reference, not an exhaustive schema for
102
+ every supported compiler or target version. In repair work, do not delete an
103
+ existing construct merely because an abbreviated list or example on this page
104
+ omits it. Preserve accepted constructs unless the selected compiler, target-org
105
+ validator, or concrete runtime evidence identifies a defect.
106
+
99
107
  **Within `start_agent` and `subagent` blocks**, the internal ordering is:
100
108
 
101
- 1. `description` (required)
102
- 2. `system` (optional — subagent-level override of global system instructions)
103
- 3. `before_reasoning` (optional — runs before reasoning phase)
104
- 4. `reasoning` (required)
105
- 5. `after_reasoning` (optional — runs after reasoning phase)
106
- 6. `actions` (optional — action definitions)
109
+ 1. `label` (optional human-readable display name)
110
+ 2. `description` (required)
111
+ 3. `system` (optional — subagent-level override of global system instructions)
112
+ 4. `before_reasoning` (optional — runs before reasoning phase)
113
+ 5. `reasoning` (required)
114
+ 6. `after_reasoning` (optional — runs after reasoning phase)
115
+ 7. `actions` (optional — action definitions)
107
116
 
108
117
  ---
109
118
 
@@ -234,9 +243,21 @@ system:
234
243
  error: "Sorry, something went wrong. Please try again."
235
244
  ```
236
245
 
246
+ The selected global or subagent `system.instructions` value is rendered on
247
+ each reasoning iteration and may contain merge fields such as
248
+ `{!@variables.account_status}`. It is declarative prompt text, not a procedure:
249
+ do not use `instructions: ->`, `run`, `set`, `if`, or `transition` inside a
250
+ system block. Put deterministic procedures in the supported lifecycle or
251
+ reasoning procedure blocks. Interpolation exposes a current value to the
252
+ model; it does not make the model's use of that value deterministic.
253
+
237
254
  The `instructions` field is required and contains text directives sent to the LLM in every reasoning phase. Subagent-level system blocks can override this.
238
255
 
239
- Both `welcome` and `error` messages are required.
256
+ The `messages` block is optional. When a target or use case requires custom
257
+ welcome or error copy, define the relevant messages and validate them against
258
+ that target. Do not add messages, rewrite an existing instruction scalar, or
259
+ change tone during a bounded repair without an accepted finding tied to an
260
+ affected use case.
240
261
 
241
262
  **Access and config blocks** contain runtime identity and agent metadata:
242
263
 
@@ -251,13 +272,15 @@ config:
251
272
  agent_type: "AgentforceServiceAgent"
252
273
  ```
253
274
 
254
- The `access:` form is covered by this repository's pinned
255
- [AgentScript toolchain floor](../../../tests/agentscript-toolchain.json).
256
- Public npm packages and target-org compilers can lag; validate against the
257
- deployment org before release.
275
+ The `access:` form is covered by the compiler workflow in
276
+ [AgentScript Compiler Setup](agentscript-toolchain.md). Public npm packages,
277
+ public source, and target-org compilers can differ; record the local provider
278
+ and validate against the deployment org before release.
258
279
 
259
280
  **Required fields:**
260
281
  - `developer_name` (NOT `agent_name`) — unique identifier following naming rules. Must exactly match the AiAuthoringBundle directory name (e.g., if the directory is `aiAuthoringBundles/Travel_Advisor/`, then `developer_name` must be `"Travel_Advisor"`). A mismatch causes deploy failures.
282
+
283
+ **Recommended explicit field for newly authored bundles:**
261
284
  - `agent_type` — `"AgentforceServiceAgent"` or `"AgentforceEmployeeAgent"`. Determines deployment context and whether `default_agent_user` is required:
262
285
  - `"AgentforceServiceAgent"` — customer-facing, deployed via messaging channels. **Requires `default_agent_user`** with Einstein Agent license.
263
286
  - `"AgentforceEmployeeAgent"` — internal employee-facing. Agent Script files with this agent type MUST NOT include:
@@ -266,6 +289,14 @@ deployment org before release.
266
289
  - Escalation subagent with `@utils.escalate`
267
290
  - `connection messaging:` block
268
291
 
292
+ Existing bundles and compiler versions can accept an omitted `agent_type`;
293
+ some environments apply a default. Do not add or change it during a bounded
294
+ repair merely to complete the schema. Require a target diagnostic or a
295
+ user-declared deployment context, and do not infer employee versus service
296
+ type from wording or from the absence of channel-specific constructs alone.
297
+ When creating a new bundle, set it explicitly and validate the related
298
+ access and connection contracts against the target org.
299
+
269
300
  **Common mistake — service-agent constructs on employee agent:**
270
301
 
271
302
  ```agentscript
@@ -392,6 +423,7 @@ In prompt text (inside `|` pipe sections), always use `{!@variables.X}` with bra
392
423
 
393
424
  ```agentscript
394
425
  subagent order_lookup:
426
+ label: "Order Lookup"
395
427
  description: "Handle customer order inquiries"
396
428
 
397
429
  reasoning:
@@ -413,6 +445,11 @@ subagent order_lookup:
413
445
 
414
446
  **Description is required** — the LLM uses this to understand when the subagent is relevant.
415
447
 
448
+ **Label is optional** — use `label` on `start_agent` or `subagent` when a
449
+ human-readable display name is useful. It is distinct from top-level
450
+ `config.agent_label`. Preserve an existing `label` during repair unless the
451
+ selected compiler or deployment target rejects it.
452
+
416
453
  **Subagent-level system override** (optional) — replaces global system
417
454
  instructions for this subagent and does not merge with them. Omit the override
418
455
  when global instructions should remain intact. If an override is necessary,
@@ -431,12 +468,13 @@ subagent product_specialist:
431
468
 
432
469
  **Internal block ordering within a subagent**:
433
470
 
434
- 1. `description`
435
- 2. `system` (optional override)
436
- 3. `before_reasoning` (optional)
437
- 4. `reasoning` (required)
438
- 5. `after_reasoning` (optional)
439
- 6. `actions` (optional definitions)
471
+ 1. `label` (optional display name)
472
+ 2. `description`
473
+ 3. `system` (optional override)
474
+ 4. `before_reasoning` (optional)
475
+ 5. `reasoning` (required)
476
+ 6. `after_reasoning` (optional)
477
+ 7. `actions` (optional definitions)
440
478
 
441
479
  **Before/after reasoning directive blocks**:
442
480
 
@@ -464,9 +502,10 @@ Directive blocks use the arrow syntax (`->`) for logic but no LLM reasoning. The
464
502
 
465
503
  Reasoning instructions combine deterministic logic and prompt text. The runtime resolves deterministic parts first, then sends the resulting prompt to the LLM for reasoning.
466
504
 
467
- The resolved prompt is rebuilt on every reasoning iteration, including after a
468
- tool call updates variables. Keep it short and task-local: current objective,
469
- relevant state, action guidance, exclusions, and stop conditions. Keep persona,
505
+ The resolved prompt is rebuilt for every reasoning iteration. A completed tool
506
+ batch normally leads to another iteration unless execution hands off, pauses,
507
+ is cancelled, or reaches a limit. Keep the prompt short and task-local: current
508
+ objective, relevant state, action guidance, exclusions, and stop conditions. Keep persona,
470
509
  tone, disclosure, safety, and broad scope rules in the effective system layer.
471
510
  Treat effective system and reasoning text as cumulative unless the target
472
511
  runtime's public, versioned contract guarantees different precedence, so the
@@ -529,50 +568,56 @@ instructions: ->
529
568
  | Suggest self-service options.
530
569
  ```
531
570
 
532
- Within `->` blocks, a line without `|` continues the previous line. A new `|` starts a new line:
571
+ Within `->` blocks, a line without `|` continues the current prompt fragment.
572
+ Use one `|` per contiguous block and align continuation lines beneath its
573
+ content:
533
574
 
534
575
  ```agentscript
535
576
  instructions: ->
536
577
  | This is a long instruction that
537
578
  continues on the next physical line.
538
- | This starts a new logical line.
579
+ This remains part of the same prompt block.
539
580
  ```
540
581
 
582
+ Start another `|` after a runtime statement or conditional boundary when a new
583
+ prompt fragment is structurally required. Repeating `|` on every adjacent
584
+ sentence is valid syntax, but it does not create steps or control flow.
585
+
541
586
  ### Conditional Control Flow Syntax
542
587
 
543
- Use `if / else if / else` for one mutually exclusive chain:
588
+ When authoring a new two-way branch whose alternatives are exclusive, prefer
589
+ `if / else`:
544
590
 
545
591
  ```agentscript
546
- # Supported multi-branch chain
547
592
  if @variables.count < 5:
548
593
  run @actions.small
549
- else if @variables.count < 10:
550
- run @actions.medium
551
594
  else:
552
595
  run @actions.large
596
+ ```
553
597
 
554
- # Invalid legacy spelling
598
+ For three or more alternatives where exactly one branch should run, use an
599
+ `if / else if / else` chain. The first matching branch wins:
600
+
601
+ ```agentscript
555
602
  if @variables.count < 5:
556
603
  run @actions.small
557
- elif @variables.count < 10:
604
+ else if @variables.count < 10:
558
605
  run @actions.medium
606
+ else:
607
+ run @actions.large
559
608
  ```
560
609
 
561
- `else if` is supported and may repeat before the optional final `else`. `elif`
562
- is not an AgentScript keyword and produces a syntax error.
610
+ Spell the clause `else if`; Python-style `elif` is not valid AgentScript. Do not
611
+ place a separate `if` inside a conditional body: true user-written nested
612
+ conditionals are unsupported. Combine predicates with `and` or `or`, or use an
613
+ `else if` chain.
563
614
 
564
- This conditional form is covered by the repository's pinned
565
- [AgentScript toolchain floor](../../../tests/agentscript-toolchain.json).
566
- Run target-org validation before release because org compilers can lag the
567
- open-source toolchain.
568
-
569
- Do not place an `if` inside another conditional body. Agentforce lint rejects
570
- user-written nested conditionals with the `unsupported-nested-if` error. The
571
- compiler also warns for nested `if/else` because its condition slot is shared.
572
- Flatten the logic with an `else if` chain, compound conditions, or sequential
573
- top-level `if` statements. Sequential top-level conditions execute
574
- independently, so make their predicates mutually exclusive when only one branch
575
- should run.
615
+ Sequential top-level `if` statements execute independently. Use them when more
616
+ than one branch may need to run, or when their predicates are intentionally and
617
+ provably mutually exclusive. For new alternative branches, an `else if` chain
618
+ usually expresses first-match priority more clearly. In a bounded repair, do
619
+ not rewrite equivalent, mutually exclusive conditions solely to normalize
620
+ style; require a diagnostic, overlap, gap, priority error, or affected use case.
576
621
 
577
622
  A direct post-action `if` in a `run @actions.*` body is also supported:
578
623
 
@@ -623,17 +668,30 @@ All logic is resolved first; only matching `|` pipe lines are included in the pr
623
668
 
624
669
  ```agentscript
625
670
  instructions: ->
626
- | Welcome!
671
+ | Welcome the user.
627
672
  if @variables.is_returning:
628
- | Nice to see you again.
673
+ | Acknowledge that they are returning.
629
674
  else:
630
- | Let's get started.
631
- | How can I help?
675
+ | Greet them as a new user.
676
+ | Ask how you can help.
632
677
 
633
678
  # If is_returning == False, the prompt becomes:
634
- # "Welcome! Let's get started. How can I help?"
679
+ # "Welcome the user. Greet them as a new user. Ask how you can help."
635
680
  ```
636
681
 
682
+ Indentation and step numbering inside the emitted pipe text affect only the
683
+ text shown to the model. They do not create nested executable scope. Likewise,
684
+ words such as `Show`, `Ask`, `Call`, `Set`, `STOP`, and `Continue` inside pipe
685
+ text are natural-language instructions, not AgentScript directives.
686
+
687
+ Action availability is resolved independently from prompt layout. Mentioning an
688
+ action beneath one conditional pipe block does not hide that action when the
689
+ condition is false. Use `available when` when an action must exist only for a
690
+ machine-known branch.
691
+
692
+ For a review checklist and paired examples, see
693
+ [Common Control-Flow Pitfalls](common-control-flow-pitfalls.md).
694
+
637
695
  ---
638
696
 
639
697
  ## 9. Flow Control
@@ -708,7 +766,7 @@ reasoning:
708
766
  if @variables.order_id != "":
709
767
  | Show order details for {!@variables.order_id}.
710
768
  else:
711
- | I need an order ID to help you.
769
+ | Ask the user for the order ID needed to continue.
712
770
  ```
713
771
 
714
772
  ---
@@ -929,7 +987,8 @@ run @actions.fetch_order
929
987
 
930
988
  Utility functions control flow and state. They do not call external systems.
931
989
 
932
- **`@utils.transition to`** — permanent one-way handoff to another subagent:
990
+ **`@utils.transition to`** — non-returning handoff to another subagent (there
991
+ is no automatic return to the source):
933
992
 
934
993
  ```agentscript
935
994
  reasoning:
@@ -939,7 +998,10 @@ reasoning:
939
998
  available when @variables.cart_has_items == True
940
999
  ```
941
1000
 
942
- Transition discards the current subagent's prompt and starts fresh with the target subagent.
1001
+ Transition stops the current subagent before another planner call and starts
1002
+ the target subagent's lifecycle and prompt resolution. Shared state and
1003
+ conversation history persist, and the target may later transition elsewhere,
1004
+ including back to the source when the design allows it.
943
1005
 
944
1006
  **`@utils.escalate`** — route to a human agent (**service agents only** — requires a `connection messaging:` block, which is only valid for `AgentforceServiceAgent`; do not use in employee agents):
945
1007
 
@@ -951,7 +1013,9 @@ reasoning:
951
1013
  available when @variables.needs_human == True
952
1014
  ```
953
1015
 
954
- Escalation ends the current conversation and routes to the escalation system defined in the connection block.
1016
+ Escalation ends the current agent turn and hands control to the escalation path
1017
+ defined by the connection block. What the downstream human-support session
1018
+ does next is outside the AgentScript utility's authoring contract.
955
1019
 
956
1020
  **`@utils.setVariables`** — LLM-driven variable capture (slot-filling):
957
1021
 
@@ -964,7 +1028,19 @@ reasoning:
964
1028
  with budget = ...
965
1029
  ```
966
1030
 
967
- The LLM extracts values from the conversation and populates the specified variables. **`setVariables` ends the turn after capturing** — instructions do not re-evaluate in the same turn. For "capture X then immediately act on X" patterns, use planner slot-fill directly on the action (`with param = ...`) instead.
1031
+ The LLM extracts values from the conversation and populates the specified
1032
+ variables through a model-selected tool call. The call updates state but does
1033
+ not itself define a turn boundary. Any later reasoning or response follows the
1034
+ runtime's normal tool-loop behavior; do not use `setVariables` to force either
1035
+ an end or another reasoning iteration.
1036
+
1037
+ Do not confuse an instruction to call `setVariables` with the call itself.
1038
+ During prompt construction, deterministic `run`, `set`, and `if` statements
1039
+ resolve and all `|` text is assembled before the model runs. A `|` instruction
1040
+ therefore cannot pause deterministic resolution while the model captures a
1041
+ value. For inseparable "capture X, then act on X" behavior, use planner
1042
+ slot-fill directly on the real action, deterministic chaining, or one
1043
+ purpose-built implementation that owns the complete sequence.
968
1044
 
969
1045
  **`@subagent.X`** — delegation to another subagent with return:
970
1046
 
@@ -978,19 +1054,26 @@ reasoning:
978
1054
 
979
1055
  Calling a subagent as a tool runs that subagent's reasoning, then returns control to the calling subagent.
980
1056
 
981
- **Post-action directives apply only to `@actions`, not `@utils`**:
1057
+ **Utility actions do not expose `@outputs`**:
982
1058
 
983
1059
  ```agentscript
984
- # WRONG — utilities don't support set
1060
+ # WRONG — escalation has no output to bind
985
1061
  escalate: @utils.escalate
986
- set @variables.escalated = True
1062
+ set @variables.result = @outputs.status
987
1063
 
988
- # CORRECT — only @actions support set
1064
+ # CORRECT — backing action output can be captured
989
1065
  process: @actions.process_order
990
1066
  set @variables.result = @outputs.status
1067
+
1068
+ # SPECIAL CASE — setVariables supports direct state assignments
1069
+ mark_ready: @utils.setVariables
1070
+ set @variables.status = "ready"
991
1071
  ```
992
1072
 
993
- Utilities cannot have output, so `set` is invalid.
1073
+ Utilities do not provide action outputs, so output-based post-action directives
1074
+ are invalid. `@utils.setVariables` is the state-update utility: it supports
1075
+ `with` clauses and direct `set @variables...` clauses. It does not support
1076
+ follow-up `run` statements or transitions.
994
1077
 
995
1078
  ---
996
1079
 
@@ -25,8 +25,8 @@ For a multi-subagent agent, it displays:
25
25
  - Action calls within subagents (with backing type: Apex, Prompt Template, Flow)
26
26
  - Gating conditions (`available when` expressions), when required
27
27
  - Variable state changes that have a trusted writer and named consumer
28
- - Escalation and off-topic handling
29
- - Conditional instructions based on variable values
28
+ - Escalation, off-topic handling, and conditional instructions when the
29
+ intended use cases require them
30
30
 
31
31
  Subagent Map diagrams are the primary visual deliverable in an Agent Spec (design document) and serve both specification and comprehension purposes.
32
32
 
@@ -36,10 +36,10 @@ Subagent Map diagrams are the primary visual deliverable in an Agent Spec (desig
36
36
 
37
37
  ### Graph Orientation
38
38
 
39
- - ALWAYS use `graph TD` (Top-Down orientation)
39
+ - Prefer `graph TD` (top-down) for the provided templates
40
40
  - Put the `start_agent` entry point at the top
41
41
  - For a router-first design, subagents flow downward from the router
42
- - Never use other orientations
42
+ - Use another orientation when it makes the actual design materially clearer
43
43
 
44
44
  ### Node Identification
45
45
 
@@ -101,16 +101,21 @@ graph TD
101
101
 
102
102
  ### Decision/Gating Nodes
103
103
 
104
- Use curly braces `{}` for required deterministic conditions. Common formats:
104
+ Curly braces `{}` create a Mermaid decision diamond. Use a decision node when
105
+ the design actually branches. Label it according to who owns the decision:
105
106
 
106
- - Authorization or confirmation gates: `{Check: customer_verified == true?}`
107
- - External outcome gates: `{Check: verification_success == true?}`
108
- - Subagent transition logic: `{user_intent matches?}`
107
+ - Machine-enforced authorization gate: `{customer_verified == true?}`
108
+ - Machine-enforced external outcome gate: `{verification_success == true?}`
109
+ - Model-interpreted transition: `{User wants account help?}`
110
+
111
+ `Check:` is optional display text, not AgentScript syntax. Do not make a
112
+ semantic model decision look like a machine-enforced predicate, and do not
113
+ invent a deterministic gate merely to satisfy the diagram format.
109
114
 
110
115
  ```mermaid
111
116
  %%{init: {'theme':'neutral'}}%%
112
117
  graph TD
113
- A[account_changes<br/>Subagent] --> B{Check: customer_verified<br/>== true?}
118
+ A[account_changes<br/>Subagent] --> B{customer_verified<br/>== true?}
114
119
  B -->|Yes| C[Call update_account<br/>backing: Flow]
115
120
  B -->|No| D[Call verify_customer<br/>backing: Apex]
116
121
  ```
@@ -127,7 +132,7 @@ history and do not need state-change nodes.
127
132
  %%{init: {'theme':'neutral'}}%%
128
133
  graph TD
129
134
  A[Call verify_customer] --> B[Set verified_customer_id<br/>= action output]
130
- B --> C{Check: verified_customer_id<br/>!= empty?}
135
+ B --> C{verified_customer_id<br/>!= empty?}
131
136
  C -->|Yes| D[Protected action available]
132
137
  ```
133
138
 
@@ -160,14 +165,16 @@ graph TD
160
165
 
161
166
  ### Subagent with Gating Condition
162
167
 
163
- `available when` expressions prevent protected action execution until trusted
164
- preconditions are met.
168
+ For model-selected actions, `available when` controls whether the action schema
169
+ is exposed in the current reasoning iteration. Use a trusted predicate to keep
170
+ a protected action unavailable until its preconditions are met; independently
171
+ verify authorization again in the backing implementation when required.
165
172
 
166
173
  ```mermaid
167
174
  %%{init: {'theme':'neutral'}}%%
168
175
  graph TD
169
176
  A[account_changes<br/>Subagent]
170
- A --> B{Check: verified_customer_id<br/>!= empty?}
177
+ A --> B{verified_customer_id<br/>!= empty?}
171
178
  B -->|No| C[Call verify_customer<br/>backing: Apex]
172
179
  B -->|Yes| D[Protected account action<br/>backing: Flow]
173
180
  C --> E[Set verified_customer_id<br/>= action output]
@@ -184,7 +191,7 @@ Do not add a variable solely to create a conditional prompt.
184
191
  graph TD
185
192
  A[Call verify_customer<br/>backing: Apex]
186
193
  A --> B[Set verification_success<br/>= action output]
187
- B --> C{Check: verification_success<br/>== true?}
194
+ B --> C{verification_success<br/>== true?}
188
195
  C -->|Yes| D[Offer protected operations]
189
196
  C -->|No| E[Explain verification failure]
190
197
  ```
@@ -288,15 +295,18 @@ Before finalizing a Subagent Map diagram:
288
295
  - [ ] Nodes use sequential capital letter IDs
289
296
  - [ ] All subagents labeled with `[subagent_name<br/>Subagent]` format
290
297
  - [ ] Action calls include backing type (Apex, Prompt Template, Flow)
291
- - [ ] Required gating conditions are shown as decision nodes with `{Check: ...?}` format
298
+ - [ ] Machine-enforced gates that materially affect the map are shown as
299
+ decision nodes and labeled with their actual predicate
300
+ - [ ] Semantic model decisions are labeled in natural language rather than as
301
+ machine checks
292
302
  - [ ] Every shown variable has a trusted writer and named runtime consumer
293
303
  - [ ] Variable state changes that affect logic are labeled with `[Set variable = value]`
294
304
  - [ ] Escalation uses `[Call @utils.escalate]` format
295
305
  - [ ] All transition branches are labeled
296
- - [ ] Diagram fits in 20-30 nodes
306
+ - [ ] Diagram remains readable; split or summarize it when detail obscures the
307
+ architecture
297
308
  - [ ] Subagent routing from start_agent is clear
298
- - [ ] Off-topic and escalation paths are visible
299
- - [ ] Required conditional instruction logic is shown
309
+ - [ ] Required off-topic, escalation, and conditional paths are visible
300
310
 
301
311
  ---
302
312
 
@@ -304,7 +314,6 @@ Before finalizing a Subagent Map diagram:
304
314
 
305
315
  ### Don't
306
316
 
307
- - Use `graph LR` or other orientations instead of `graph TD`
308
317
  - Place `start_agent` anywhere except top (node A)
309
318
  - Label actions without backing type information
310
319
  - Use ambiguous decision node labels (avoid `{Process?}`)
@@ -315,17 +324,18 @@ Before finalizing a Subagent Map diagram:
315
324
  - Create subagent routing without labels on the decision logic
316
325
  - Mix subagent nodes with action nodes at same level without clear containment
317
326
  - Use custom color styling (breaks in dark mode)
318
- - Leave off-topic and escalation paths out of diagram
327
+ - Omit off-topic or escalation paths that the intended use cases require
319
328
 
320
329
  ### Do
321
330
 
322
331
  - Keep the selected `start_agent` at the top
323
332
  - Show all subagents reachable from start_agent
324
333
  - Include backing type for every action call
325
- - Make gating conditions explicit as decision nodes
334
+ - Make material machine-enforced gates explicit as decision nodes
326
335
  - Show justified variable updates as separate nodes when they affect logic flow
327
336
  - Label all transition branches
328
- - Include off-topic and escalation subagents
329
- - Show conditional instructions with decision nodes
337
+ - Include off-topic and escalation subagents when the design calls for them
338
+ - Show material conditional branches without implying that every model
339
+ judgment is a runtime predicate
330
340
  - Use `%%{init: {'theme':'neutral'}}%%` for light/dark mode compatibility
331
341
  - Focus diagram on subagent structure, not detailed action logic
@@ -31,6 +31,18 @@ Example:
31
31
  sf agent validate authoring-bundle --json --api-name Local_Info_Agent
32
32
  ```
33
33
 
34
+ On an internal test-pod or OrgFarm org, the validation endpoint can return a
35
+ 404 whose message explicitly says `SF_TEST_API=false`. In that specific case,
36
+ retry the same command with the test-API switch enabled:
37
+
38
+ ```bash
39
+ SF_TEST_API=true sf agent validate authoring-bundle --json \
40
+ --api-name Local_Info_Agent --target-org <TEST_ORG_ALIAS>
41
+ ```
42
+
43
+ Do not set `SF_TEST_API=true` for a normal production or sandbox host, and do
44
+ not treat the initial 404 as an Agent Script compile failure.
45
+
34
46
  ### Interpreting Output
35
47
 
36
48
  When validation succeeds, the JSON output contains `result.success` set to `true`:
@@ -53,9 +65,12 @@ Do not attempt to preview or deploy until validation passes.
53
65
 
54
66
  ### Validation Checklist (Pre-Validate Mental Model)
55
67
 
56
- Before running the validation command, mentally check these 14 items. This checklist prevents the most common errors and speeds up the feedback loop:
68
+ Before running the validation command, mentally check these 15 items. This checklist prevents the most common errors and speeds up the feedback loop:
57
69
 
58
70
  - Block ordering is correct: `system` → `access` → `config` → `variables` → `connections` → `knowledge` → `language` → `start_agent` → `subagent` blocks
71
+ - The bundle directory, `.agent` filename, and `.bundle-meta.xml` basename use
72
+ the same case-sensitive API name; never leave the metadata file named only
73
+ `bundle-meta.xml`
59
74
  - `config` has `developer_name`; service agents also need `access.default_agent_user`
60
75
  - `system` block has `messages.welcome`, `messages.error`, and `instructions`
61
76
  - `start_agent` block exists with description and at least one transition action
@@ -69,7 +84,8 @@ Before running the validation command, mentally check these 14 items. This check
69
84
  - New files use 4-space structural indentation; edited files do not mix styles
70
85
  - Names follow naming rules (letters, numbers, underscores only; no spaces; start with letter)
71
86
  - No duplicate block names or action names within the same scope
72
- - Conditional chains use `if / else if / else`, never legacy `elif`; true
87
+ - Exclusive multi-branch logic uses `if / else if / else`; independent top-level
88
+ conditions are used only when more than one branch may run; `elif` and true
73
89
  nested conditionals are avoided
74
90
 
75
91
  ---
@@ -158,26 +174,36 @@ session_id: linked string
158
174
 
159
175
  Linked variables are populated from their `source` at runtime. Do not assign a default value.
160
176
 
161
- **7. Post-Action Directives on Utility Actions**
177
+ **7. Output-Based Directives on Utility Actions**
162
178
 
163
179
  ```agentscript
164
- # WRONG — utilities don't support post-action directives
180
+ # WRONG — transition has no output to bind
165
181
  go_next: @utils.transition to @subagent.next
166
- set @variables.navigated = True
182
+ set @variables.result = @outputs.result
167
183
 
168
- # CORRECT — only @actions support post-action directives
184
+ # CORRECT — backing action output can be captured
169
185
  process: @actions.process_order
170
186
  set @variables.result = @outputs.result
187
+
188
+ # SPECIAL CASE — setVariables supports direct state assignments
189
+ mark_navigated: @utils.setVariables
190
+ set @variables.navigated = True
171
191
  ```
172
192
 
173
- Post-action directives (`set`, `run`, `if`, `transition`) only work after `@actions.*` invocations. Utility actions (`@utils.*`) and subagent delegates (`@subagent.*`) do not produce outputs, so post-action directives are not applicable.
193
+ Utility actions and subagent delegates do not produce `@outputs`, so
194
+ output-based directives are not applicable. `@utils.setVariables` is the
195
+ exception for direct state assignment: it accepts `with` and
196
+ `set @variables...`, but not follow-up `run` statements or transitions.
174
197
 
175
198
  **8. Conditional Syntax**
176
199
 
177
- Use `if / else if / else`; `elif` produces a syntax error. Agentforce lint
178
- rejects true nested conditionals with `unsupported-nested-if`; the compiler
179
- also warns about the narrower nested `if/else` condition-slot limitation. For
180
- examples, post-action behavior, and flattening alternatives, use the canonical
200
+ Use `if / else` for two alternatives and `if / else if / else` for three or
201
+ more alternatives where the first matching branch should win. Spell it
202
+ `else if`; Python-style `elif` is invalid. Use independent top-level `if`
203
+ statements only when more than one branch may run. True nested conditionals are
204
+ unsupported.
205
+ For examples, post-action behavior, and flattening alternatives, use the
206
+ canonical
181
207
  [Conditional Control Flow Syntax](agent-script-core-language.md#conditional-control-flow-syntax)
182
208
  section rather than maintaining a second syntax guide here.
183
209