Analyze Workflow (Moshky)
Analyze Workflow (Moshky)
The Analyze button on the Workflow editor toolbar (sparkle icon, top-left) opens
Moshky's right-pane analyzer. It reads the current workflow's JSON and surfaces
concrete improvement suggestions.
What it suggests
- Collapse long question chains — three or more sequential Ask-Question
nodes are usually better expressed as a single AI Chatbot step that gathers
the same info conversationally.
- Replace category-style Conditions with Route by Intent — Conditions that
branch on a category / intent / topic attribute can be replaced with the
intentHandoff node, which lets AI classify the visitor's actual message.
- Convert 4+ category-style Multiple-Choice questions to Route by Intent —
when the visitor would otherwise be asked to pick Sales / Support / Billing
/ Other, intent classification skips the question entirely.
- Configure missing AI — flags AI nodes where
aiConfigIdis unset (the
workflow would silently skip the handoff at runtime).
- Remove orphaned subtrees — nodes that aren't reachable from the trigger
and will never run.
- Extract duplicate messages — when the same
sendMessagetext appears in
two or more branches, surface it for extraction into a reusable Section.
Each suggestion shows: a friendly rationale (Moshky may re-phrase it via the
LLM), the affected nodes (clickable — focuses the canvas), and a Show Diff
toggle that previews the before/after JSON.
How Apply works
When you click Apply on a suggestion:
1. A version snapshot is created with the title
Before Moshky suggestion: <title> so it's easy to find in Version History.
2. The deterministic mutation is applied to the workflow JSON. The LLM is
never allowed to mutate workflow JSON directly — Moshky only narrates.
3. A toast confirms Applied: <title>. Revert anytime from Version History.
Reverting
Open History in the toolbar. Find the version labeled
Before Moshky suggestion: <title> and click Restore. The workflow snaps
back to the pre-Apply state — Save or Publish to keep the revert.
Safety
- All Apply functions are pure, idempotent, and produce structurally valid
workflow JSON (no dangling childNodeId references, no duplicate node ids).
- A unit test covers each detector and Apply path in
client/src/pages/Messaging/Workflows/__tests__/WorkflowAnalyzer.test.ts.
- Running an Apply twice has no additional effect — the second run is a no-op.
Was this article helpful?