@fluentcommerce/ai-skills 0.1.0 → 0.3.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.

Potentially problematic release.


This version of @fluentcommerce/ai-skills might be problematic. Click here for more details.

Files changed (168) hide show
  1. package/README.md +866 -622
  2. package/bin/cli.mjs +2112 -1973
  3. package/content/cli/agents/fluent-cli/agent.json +149 -149
  4. package/content/cli/agents/fluent-cli.md +132 -132
  5. package/content/cli/skills/fluent-bootstrap/SKILL.md +214 -181
  6. package/content/cli/skills/fluent-cli-index/SKILL.md +1 -1
  7. package/content/cli/skills/fluent-cli-mcp-cicd/SKILL.md +117 -1
  8. package/content/cli/skills/fluent-cli-reference/SKILL.md +1040 -1031
  9. package/content/cli/skills/fluent-cli-retailer/SKILL.md +27 -2
  10. package/content/cli/skills/fluent-cli-settings/SKILL.md +21 -1
  11. package/content/cli/skills/fluent-connect/SKILL.md +937 -886
  12. package/content/cli/skills/fluent-module-deploy/SKILL.md +63 -5
  13. package/content/cli/skills/fluent-profile/SKILL.md +73 -0
  14. package/content/cli/skills/fluent-workflow/SKILL.md +360 -310
  15. package/content/dev/agents/fluent-backend-dev/AGENT.md +58 -0
  16. package/content/dev/agents/fluent-backend-dev/agent.json +69 -0
  17. package/content/dev/agents/fluent-backend-dev.md +287 -0
  18. package/content/dev/agents/fluent-dev/AGENT.md +98 -0
  19. package/content/dev/agents/fluent-dev/agent.json +14 -2
  20. package/content/dev/agents/fluent-dev.md +194 -525
  21. package/content/dev/agents/fluent-frontend-dev/AGENT.md +63 -0
  22. package/content/dev/agents/fluent-frontend-dev/agent.json +52 -0
  23. package/content/dev/agents/fluent-frontend-dev.md +323 -0
  24. package/content/dev/skills/fluent-archive/SKILL.md +234 -0
  25. package/content/dev/skills/fluent-build/SKILL.md +312 -192
  26. package/content/dev/skills/fluent-connection-analysis/SKILL.md +422 -386
  27. package/content/dev/skills/fluent-custom-code/SKILL.md +15 -9
  28. package/content/dev/skills/fluent-data-module-scaffold/SKILL.md +19 -2
  29. package/content/dev/skills/fluent-e2e-test/SKILL.md +501 -394
  30. package/content/dev/skills/fluent-event-api/SKILL.md +962 -945
  31. package/content/dev/skills/fluent-feature-explain/SKILL.md +680 -603
  32. package/content/dev/skills/fluent-feature-plan/PLAN_TEMPLATE.md +27 -2
  33. package/content/dev/skills/fluent-feature-plan/SKILL.md +478 -227
  34. package/content/dev/skills/fluent-feature-status/SKILL.md +335 -0
  35. package/content/dev/skills/fluent-feedback/SKILL.md +221 -0
  36. package/content/dev/skills/fluent-implementation-map/SKILL.md +644 -0
  37. package/content/dev/skills/fluent-job-batch/SKILL.md +10 -0
  38. package/content/dev/skills/fluent-module-scaffold/SKILL.md +64 -2
  39. package/content/dev/skills/fluent-module-validate/SKILL.md +778 -775
  40. package/content/dev/skills/fluent-mystique-analyze/SKILL.md +817 -0
  41. package/content/dev/skills/fluent-mystique-builder/COMPONENT_TEMPLATE.md +81 -0
  42. package/content/dev/skills/fluent-mystique-builder/README.md +63 -0
  43. package/content/dev/skills/fluent-mystique-builder/SKILL.md +1294 -0
  44. package/content/dev/skills/fluent-mystique-builder/components/INDEX.md +92 -0
  45. package/content/dev/skills/fluent-mystique-builder/components/fc.accordion.md +48 -0
  46. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.fulfilmentpack.md +20 -0
  47. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.multiparcel.md +21 -0
  48. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.returnitems.md +21 -0
  49. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.wavepick.md +21 -0
  50. package/content/dev/skills/fluent-mystique-builder/components/fc.action.inline.md +24 -0
  51. package/content/dev/skills/fluent-mystique-builder/components/fc.activity.entity.md +25 -0
  52. package/content/dev/skills/fluent-mystique-builder/components/fc.analytics.viz.md +20 -0
  53. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.column.md +111 -0
  54. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.json.md +20 -0
  55. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.jsoneditor.md +54 -0
  56. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.locationId.md +51 -0
  57. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.retailerId.md +52 -0
  58. package/content/dev/skills/fluent-mystique-builder/components/fc.button.bar.md +57 -0
  59. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.download.md +53 -0
  60. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.inline.compatibility.md +60 -0
  61. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.inline.md +53 -0
  62. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.md +24 -0
  63. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.pick.md +61 -0
  64. package/content/dev/skills/fluent-mystique-builder/components/fc.buttons.add.reject.md +20 -0
  65. package/content/dev/skills/fluent-mystique-builder/components/fc.card.attribute.md +73 -0
  66. package/content/dev/skills/fluent-mystique-builder/components/fc.card.attributes.grid.md +40 -0
  67. package/content/dev/skills/fluent-mystique-builder/components/fc.card.image.md +37 -0
  68. package/content/dev/skills/fluent-mystique-builder/components/fc.card.map.point.md +24 -0
  69. package/content/dev/skills/fluent-mystique-builder/components/fc.card.multi.md +79 -0
  70. package/content/dev/skills/fluent-mystique-builder/components/fc.card.product.md +27 -0
  71. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.area.md +34 -0
  72. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.area.wrapper.feed.md +98 -0
  73. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.bar.md +52 -0
  74. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.bar.wrapper.source.md +104 -0
  75. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.gauge.md +28 -0
  76. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.gauge.wrapper.threshold.md +118 -0
  77. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.line.md +32 -0
  78. package/content/dev/skills/fluent-mystique-builder/components/fc.conditional.md +62 -0
  79. package/content/dev/skills/fluent-mystique-builder/components/fc.dashboard.threshold.md +65 -0
  80. package/content/dev/skills/fluent-mystique-builder/components/fc.daterange.wrapper.forwarder.md +56 -0
  81. package/content/dev/skills/fluent-mystique-builder/components/fc.drawer.button.md +21 -0
  82. package/content/dev/skills/fluent-mystique-builder/components/fc.event.detail.md +20 -0
  83. package/content/dev/skills/fluent-mystique-builder/components/fc.events.search.md +21 -0
  84. package/content/dev/skills/fluent-mystique-builder/components/fc.field.daterange.md +83 -0
  85. package/content/dev/skills/fluent-mystique-builder/components/fc.field.filterComplex.md +106 -0
  86. package/content/dev/skills/fluent-mystique-builder/components/fc.field.intrange.md +82 -0
  87. package/content/dev/skills/fluent-mystique-builder/components/fc.field.multistring.md +50 -0
  88. package/content/dev/skills/fluent-mystique-builder/components/fc.filterPanel.md +53 -0
  89. package/content/dev/skills/fluent-mystique-builder/components/fc.json.editor.md +22 -0
  90. package/content/dev/skills/fluent-mystique-builder/components/fc.json.viewer.md +21 -0
  91. package/content/dev/skills/fluent-mystique-builder/components/fc.list.customAction.md +79 -0
  92. package/content/dev/skills/fluent-mystique-builder/components/fc.list.md +116 -0
  93. package/content/dev/skills/fluent-mystique-builder/components/fc.list.wrapper.bppmetrics.md +69 -0
  94. package/content/dev/skills/fluent-mystique-builder/components/fc.list.wrapper.feed.md +65 -0
  95. package/content/dev/skills/fluent-mystique-builder/components/fc.list.wrapper.source.md +64 -0
  96. package/content/dev/skills/fluent-mystique-builder/components/fc.modal.button.addItem.md +60 -0
  97. package/content/dev/skills/fluent-mystique-builder/components/fc.modal.button.md +21 -0
  98. package/content/dev/skills/fluent-mystique-builder/components/fc.mutation.inline.md +88 -0
  99. package/content/dev/skills/fluent-mystique-builder/components/fc.mystique.collapsible.attributes.md +83 -0
  100. package/content/dev/skills/fluent-mystique-builder/components/fc.mystique.collapsible.text.md +33 -0
  101. package/content/dev/skills/fluent-mystique-builder/components/fc.mystique.link.md +30 -0
  102. package/content/dev/skills/fluent-mystique-builder/components/fc.order.itemDetails.md +20 -0
  103. package/content/dev/skills/fluent-mystique-builder/components/fc.order.shipmentDetails.md +20 -0
  104. package/content/dev/skills/fluent-mystique-builder/components/fc.page.filter.select.md +87 -0
  105. package/content/dev/skills/fluent-mystique-builder/components/fc.page.md +64 -0
  106. package/content/dev/skills/fluent-mystique-builder/components/fc.page.refresh.md +48 -0
  107. package/content/dev/skills/fluent-mystique-builder/components/fc.page.section.column.md +71 -0
  108. package/content/dev/skills/fluent-mystique-builder/components/fc.page.section.header.md +61 -0
  109. package/content/dev/skills/fluent-mystique-builder/components/fc.page.section.md +59 -0
  110. package/content/dev/skills/fluent-mystique-builder/components/fc.page.wizard.md +45 -0
  111. package/content/dev/skills/fluent-mystique-builder/components/fc.page.wizard.summary.md +56 -0
  112. package/content/dev/skills/fluent-mystique-builder/components/fc.progress.circular.md +20 -0
  113. package/content/dev/skills/fluent-mystique-builder/components/fc.provider.graphql.md +71 -0
  114. package/content/dev/skills/fluent-mystique-builder/components/fc.quantity.list.md +87 -0
  115. package/content/dev/skills/fluent-mystique-builder/components/fc.repeater.md +56 -0
  116. package/content/dev/skills/fluent-mystique-builder/components/fc.reports.ipuipc.md +54 -0
  117. package/content/dev/skills/fluent-mystique-builder/components/fc.return.rowExpansion.md +19 -0
  118. package/content/dev/skills/fluent-mystique-builder/components/fc.scanner.barcode.md +21 -0
  119. package/content/dev/skills/fluent-mystique-builder/components/fc.scanner.barcodeFilter.md +72 -0
  120. package/content/dev/skills/fluent-mystique-builder/components/fc.scanner.camera.md +20 -0
  121. package/content/dev/skills/fluent-mystique-builder/components/fc.settingForm.md +64 -0
  122. package/content/dev/skills/fluent-mystique-builder/components/fc.sourcing.profile.drawer.button.md +19 -0
  123. package/content/dev/skills/fluent-mystique-builder/components/fc.sourcing.profile.modal.button.md +64 -0
  124. package/content/dev/skills/fluent-mystique-builder/components/fc.sourcing.strategy.modal.button.md +20 -0
  125. package/content/dev/skills/fluent-mystique-builder/components/fc.stepper.md +20 -0
  126. package/content/dev/skills/fluent-mystique-builder/components/fc.tab.content.md +56 -0
  127. package/content/dev/skills/fluent-mystique-builder/components/fc.tabs.card.md +64 -0
  128. package/content/dev/skills/fluent-mystique-builder/components/fc.tabs.md +69 -0
  129. package/content/dev/skills/fluent-mystique-builder/components/fc.tile.metric.md +73 -0
  130. package/content/dev/skills/fluent-mystique-builder/components/fc.workflow.provider.md +77 -0
  131. package/content/dev/skills/fluent-mystique-builder/validate-docs.ps1 +260 -0
  132. package/content/dev/skills/fluent-mystique-scaffold/SKILL.md +1830 -0
  133. package/content/dev/skills/fluent-mystique-validate/SKILL.md +646 -0
  134. package/content/dev/skills/fluent-pre-deploy-check/SKILL.md +1144 -1108
  135. package/content/dev/skills/fluent-retailer-config/SKILL.md +1162 -1111
  136. package/content/dev/skills/fluent-rollback/SKILL.md +387 -0
  137. package/content/dev/skills/fluent-rule-scaffold/SKILL.md +515 -385
  138. package/content/dev/skills/fluent-scope-decompose/SKILL.md +1123 -1021
  139. package/content/dev/skills/fluent-session-audit-export/SKILL.md +880 -632
  140. package/content/dev/skills/fluent-session-summary/SKILL.md +320 -195
  141. package/content/dev/skills/fluent-settings/SKILL.md +160 -1
  142. package/content/dev/skills/fluent-source-onboard/SKILL.md +31 -3
  143. package/content/dev/skills/fluent-sourcing/SKILL.md +1185 -0
  144. package/content/dev/skills/fluent-system-monitoring/SKILL.md +771 -767
  145. package/content/dev/skills/fluent-test-data/SKILL.md +514 -513
  146. package/content/dev/skills/fluent-trace/SKILL.md +1169 -1143
  147. package/content/dev/skills/fluent-transition-api/SKILL.md +364 -346
  148. package/content/dev/skills/fluent-use-case-discover/SKILL.md +593 -0
  149. package/content/dev/skills/fluent-use-case-discover/SPEC_TEMPLATE.md +281 -0
  150. package/content/dev/skills/fluent-version-manage/SKILL.md +53 -2
  151. package/content/dev/skills/fluent-workflow-analyzer/SKILL.md +995 -959
  152. package/content/dev/skills/fluent-workflow-builder/SKILL.md +668 -319
  153. package/content/dev/skills/fluent-workflow-deploy/SKILL.md +480 -267
  154. package/content/dev/skills/fluent-workspace-tree/SKILL.md +281 -0
  155. package/content/mcp-extn/agents/fluent-mcp.md +133 -69
  156. package/content/mcp-extn/skills/fluent-mcp-tools/SKILL.md +812 -461
  157. package/content/mcp-official/agents/fluent-mcp-core.md +91 -91
  158. package/content/mcp-official/skills/fluent-mcp-core/SKILL.md +94 -94
  159. package/content/rfl/skills/fluent-rfl-assess/SKILL.md +172 -172
  160. package/docs/CAPABILITY_MAP.md +106 -77
  161. package/docs/DEPLOYMENT_PROMOTION_RUNBOOK.md +218 -0
  162. package/docs/DESIGN-implementation-map.md +698 -0
  163. package/docs/DEV_WORKFLOW.md +814 -802
  164. package/docs/FLOW_RUN.md +142 -142
  165. package/docs/GETTING_STARTED.md +427 -0
  166. package/docs/USE_CASES.md +909 -52
  167. package/metadata.json +184 -156
  168. package/package.json +3 -2
@@ -1,386 +1,422 @@
1
- ---
2
- name: fluent-connection-analysis
3
- description: Analyze workflow connection topology across rulesets and workflows. Produces internal/cross-entity/cross-workflow maps, static-vs-dynamic runtime diffs, and webhook/setting conformance inventories with Mermaid output. Triggers on "connection analysis", "workflow connections", "cross workflow dependencies", "orphaned rulesets", "process flow classification", "webhook dependency map", "expected vs observed rulesets", "runtime workflow diff".
4
- user-invocable: true
5
- allowed-tools: Bash, Read, Write, Edit, Glob, Grep
6
- argument-hint: <workflow-file-or-name> [--deep] [--mermaid] [--output <path>] [--validate <entity-ref> --entity-type ORDER|FULFILMENT] [--from <iso> --to <iso>]
7
- ---
8
-
9
- # Fluent Connection Analysis
10
-
11
- Connection-focused analysis for Fluent workflows. Use this when the main question is not just "what statuses exist?" but "how does work move between rulesets/workflows and where are the risky dependency points?"
12
-
13
- ## Ownership Boundary
14
-
15
- This skill owns:
16
- - connection topology (internal, cross-entity, cross-workflow)
17
- - orphan/missing-target detection
18
- - process-flow type classification
19
- - webhook and setting dependency extraction
20
-
21
- Related skills:
22
- - Workflow structure baseline -> `/fluent-workflow-analyzer`
23
- - Workflow edits/fixes -> `/fluent-workflow-builder`
24
- - Runtime failure correlation -> `/fluent-trace`
25
- - Settings validation -> `/fluent-settings`
26
-
27
- ## When to Use
28
-
29
- - Mapping dependencies before changing a workflow
30
- - Explaining "what triggers what" across entities
31
- - Finding orphaned rulesets and missing SendEvent targets
32
- - Auditing integration/webhook touchpoints
33
- - Producing architecture handover docs with Mermaid diagrams
34
- - Comparing static expected paths vs runtime observed execution after an event/mutation
35
- - Verifying rule-referenced settings exist and are valid in live context
36
-
37
- ## Seamless Default Bundle
38
-
39
- Run this skill as a single-pass bundle by default:
40
-
41
- 1. Static connection topology + risk checks
42
- 2. Settings conformance (`rule props -> live setting status`)
43
- 3. Runtime diff (when `--validate` inputs are provided)
44
-
45
- If `--validate` is not provided, still emit sections 1-2 and explicitly mark runtime diff as `NOT_RUN`.
46
-
47
- ## Connection Analysis Procedure
48
-
49
- ### 1) Gather Workflow Set
50
-
51
- 1. Resolve target workflow(s) (local file or via `/fluent-workflow` download).
52
- 2. For dependency analysis, load adjacent workflows in the same retailer (ORDER + FULFILMENT + child types).
53
- 3. Build indexes:
54
- - rulesets by `(type, name)`
55
- - statuses by `(entityType, name)`
56
- - event emitters by `eventName` scan ALL rules with `eventName` or `noMatchEventName` props (SendEvent, ScheduleEvent, ForwardEvent*, SendEventOnVerifying*, and any other event-emitting rule)
57
-
58
- ### 2) Build Connection Graph
59
-
60
- For each ruleset:
61
- 1. Identify incoming edges:
62
- - event-name match (`event.name == ruleset.name`)
63
- - status-trigger match (`triggers[].status`)
64
- 2. Identify outgoing edges:
65
- - `SendEvent(eventName)` -> target ruleset(s)
66
- - `SetState(status)` -> status transition edges
67
- 3. Classify each edge:
68
- - `internal`: same workflow/entity scope
69
- - `cross-entity`: different entity type
70
- - `cross-workflow`: target flexType/workflow differs
71
- 4. Annotate conditional edges:
72
- - If a ruleset has a `subtype` field (e.g. `"subtype": "HD_WH"`), mark all its incoming edges as **conditional on subtype**. The event fires for all subtypes but only this ruleset's trigger scope matches the specific subtype.
73
- - In the report, label conditional edges: `ConfirmPick --(HD_WH only)--> RequestShipment`
74
-
75
- ### 3) Detect Risks
76
-
77
- Run these checks:
78
- - orphaned rulesets (no trigger and no inbound SendEvent)
79
- - missing SendEvent targets (no ruleset receives emitted event)
80
- - trigger conflicts (multiple rulesets for same status in same type)
81
- - dead-end non-terminal statuses
82
- - unreachable statuses (never targeted by SetState)
83
-
84
- **Duplicate ruleset severity calibration:**
85
- - Same name + same entity type + same subtype (or both subtype-empty) + **overlapping trigger statuses** = **HIGH** (ambiguous runtime behavior)
86
- - Same name + same entity type + same subtype (or both subtype-empty) + **non-overlapping trigger statuses** = **MEDIUM** (maintenance ambiguity; often intentional normal-vs-late variants)
87
- - Same name + same entity type + **different subtype filters** = **INFO** (usually intentional subtype partitioning; document explicitly)
88
-
89
- ### 4) Process Flow Classification
90
-
91
- Classify each ruleset into one flow type. There are 6 categories (not 5):
92
-
93
- | Type | Condition | Examples |
94
- |------|-----------|---------|
95
- | `CREATE` | Ruleset name is `CREATE` | ORDER.CREATE, FULFILMENT.CREATE |
96
- | `SCHEDULED_EVENT` | Ruleset receives event fired by `ScheduleEvent` | ValidationGraceExpired |
97
- | `CROSS_ENTITY_EVENT` | Ruleset receives event fired by `SendEventForOrder`, `SendEventForAllFulfilmentChoices`, `SendEventForAllFulfilments`, or other cross-entity Send rules | NotifyFCComplete, RouteFulfilmentChoice, CancelFulfilment |
98
- | `USER_ACTION` | Ruleset has non-empty `userActions[]` | CancelOrder, EscalateFulfilmentChoice |
99
- | `INTERNAL_EVENT` | Ruleset receives event fired by `SendEvent` or `ForwardEvent*` from another ruleset **within the same entity type** | ValidateOrder (from CREATE), ProcessOrder (from ConfirmValidation), TransitionToShipped (from NotifyFulfilmentShipped) |
100
- | `INTEGRATION_EVENT` | No inbound SendEvent from any ruleset in the workflow; event arrives from external system | ConfirmValidation, ConfirmPick, ConfirmShipment, ConfirmDelivery |
101
-
102
- **How to distinguish INTERNAL_EVENT from INTEGRATION_EVENT:**
103
- 1. Build the emitter index by scanning ALL event-emitting rule patterns in the workflow:
104
- - `core.SendEvent` → `eventName` prop
105
- - `core.ScheduleEvent` `eventName` prop
106
- - `ForwardEventBy*` (e.g. `ForwardEventByFulfilmentChoiceType`) → `eventName` prop
107
- - `SendEventOnVerifying*` (e.g. `SendEventOnVerifyingAttributeValue`) both `eventName` AND `noMatchEventName` props
108
- - `SendEventOnVerifyingAllFulfilment*States` → `eventName` prop
109
- - **Catch-all:** Any rule with an `eventName` or `noMatchEventName` prop emits events — include it.
110
- Record each emitted event name and which ruleset emits it.
111
- 2. If a ruleset's name appears as an emitted `eventName` from another ruleset in the same entity type `INTERNAL_EVENT`.
112
- 3. If a ruleset's name does NOT appear as any emitted `eventName` in the workflow → `INTEGRATION_EVENT` (external inbound).
113
- 4. Conditional emitters count: `noMatchEventName` targets, scheduled event targets, and gate-pattern event targets (from `SendEventOnVerifyingAll*`) are all internal emitters.
114
- 5. **Dual classification:** A ruleset can be both a USER_ACTION (has `userActions[]`) and an INTERNAL_EVENT target (e.g. `CancelOrder` is a user action but also sent by `GracePeriodTimeoutCancel`). Use the primary classification per priority order, but note dual roles in the report.
115
-
116
- Priority for deterministic classification (first match wins):
117
- 1. `CREATE`
118
- 2. `SCHEDULED_EVENT`
119
- 3. `CROSS_ENTITY_EVENT`
120
- 4. `USER_ACTION`
121
- 5. `INTERNAL_EVENT`
122
- 6. `INTEGRATION_EVENT`
123
-
124
- ### 5) Webhook + Setting Dependency Mapping
125
-
126
- Detect webhook/integration patterns by:
127
- - rule name patterns (`webhook`, `notify`, `callback`, `publish`, `subscribe`)
128
- - rule props referencing webhook/setting keys
129
-
130
- Detect setting usage by prop-key/value patterns:
131
- - `setting`, `config`, `parameter`, `option`, `property`
132
-
133
- Output:
134
- - ruleset -> webhook touchpoints
135
- - ruleset -> setting keys
136
- - setting -> dependent rulesets/workflows
137
- - setting runtime contract status (`FOUND`, `MISSING`, `EMPTY`, `INVALID_FORMAT`)
138
-
139
- Runtime setting verification:
140
- 1. For each extracted setting key, query live settings using **cascading scope resolution**:
141
- - First: `RETAILER` + retailer `contextId`
142
- - Then: `ACCOUNT` + `contextId=0`
143
- - Use the first scope where the setting is found.
144
- Module-installed settings often default to `ACCOUNT` scope. Always check both before reporting `MISSING`.
145
- 2. Validate existence and value shape:
146
- - `MISSING`: no setting found.
147
- - `EMPTY`: found but `value` and `lobValue` are empty.
148
- - `INVALID_FORMAT`: value exists but does not match expected shape (for example webhook JSON missing `url`).
149
- - `FOUND`: exists with plausible value shape.
150
- 3. Emit a contract table: `setting -> referencedByRulesets -> runtimeStatus -> notes`.
151
-
152
- For full CRUD/migration workflows, hand off to `/fluent-settings`.
153
-
154
- ### 6) Produce Deliverables
155
-
156
- Always generate:
157
- 1. Connection Summary (counts by internal/cross-entity/cross-workflow)
158
- 2. Risk Findings (ordered by severity)
159
- 3. Process Flow Table (ruleset -> flow type)
160
- 4. Integration Dependency Table (webhook + settings)
161
-
162
- When `--mermaid` is enabled, generate:
163
- - state machine per entity (`stateDiagram-v2`)
164
- - event/connection flow (`flowchart TD`)
165
- - cross-entity lifecycle (`flowchart LR`)
166
-
167
- **Mermaid syntax:** Validate all generated diagrams against `/fluent-mermaid-validate` rules before output (no colons in free text, no unicode arrows, quoted special-char labels).
168
-
169
- **Mermaid accuracy rules:**
170
- - Dotted-line labels between entities must use **event names**, not rule names. If a rule (e.g. `CreateFulfilmentFromSourcingLocation`) creates a child entity, label the edge as "creates entity" or the subsequent CREATE event, not the rule class name.
171
- - Cross-entity lifecycle must show **intermediate statuses** when an entity transitions through multiple states. E.g. if ReportShortpick sends both NotifyFulfilmentShipped and NotifyFulfilmentDelivered, show the ORDER transitioning through SHIPPED before COMPLETED, not skipping directly to COMPLETED.
172
- - Annotate subtype-conditional paths in diagrams: `RequestShipment [HD_WH]`, `ReadyForPickup [CC_PFS]`.
173
-
174
- ### 7) Validate Against Live Data (`--validate`)
175
-
176
- Use this when you have a real entity and want to compare "what the static connection graph predicts" vs "what actually executed at runtime". Requires `--validate <entity-ref> --entity-type <TYPE>`.
177
-
178
- #### 7a) Resolve Entity and Determine Scope
179
-
180
- 1. Accept entity ref and type from CLI arguments. Supported types: `ORDER`, `FULFILMENT`, `FULFILMENT_CHOICE`, `ARTICLE`.
181
- 2. Query the entity to confirm it exists and retrieve its current status and subtype:
182
- ```
183
- graphql.query: { orders(ref: ["<REF>"]) { edges { node { id ref type status } } } }
184
- ```
185
- (Adjust root field for entity type: `orders`, `fulfilments`, etc.)
186
- 3. Determine the workflow flexType from entity type + subtype (e.g. `ORDER::HD`, `FULFILMENT::HD_WH`).
187
- 4. Load the matching workflow JSON from the local workflow set (Steps 1-2 of the main procedure). If not found locally, download it.
188
- 5. Run Steps 2-4 (Build Connection Graph, Detect Risks, Process Flow Classification) on the workflow to produce the **expected connection graph** — the full set of rulesets, edges, and conditional branches.
189
-
190
- #### 7b) Query Live Orchestration Events
191
-
192
- Fetch all orchestration events for the entity:
193
- ```
194
- event.list({
195
- "context.entityRef": "<ENTITY_REF>",
196
- "context.entityType": "<ENTITY_TYPE>",
197
- "eventType": "ORCHESTRATION_AUDIT",
198
- "count": 200
199
- })
200
- ```
201
-
202
- Also collect business orchestration events for name-level matching:
203
- ```
204
- event.list({
205
- "context.entityRef": "<ENTITY_REF>",
206
- "context.entityType": "<ENTITY_TYPE>",
207
- "eventType": "ORCHESTRATION",
208
- "count": 200
209
- })
210
- ```
211
-
212
- If more than 200 events exist, paginate using `start` offset until all events are collected for both queries.
213
-
214
- For each returned event, extract:
215
- - `name` the event/ruleset name that fired
216
- - `status` event status (SUCCESS, FAILED, etc.)
217
- - `createdOn`timestamp for timing analysis
218
- - `entityId`, `entityRef`, `entityType` — confirm entity scope
219
- - `attributes` any rule-specific attributes (subtype, status transitions)
220
- - `category` — especially `ruleSet`, `rule`, `ACTION`, `exception` from `ORCHESTRATION_AUDIT`
221
-
222
- #### 7c) Cross-Entity Event Tracing
223
-
224
- For entity types that spawn or interact with child entities, also query child events:
225
-
226
- - **ORDER** entities: query events for related fulfilment choices and fulfilments:
227
- ```
228
- event.list({
229
- "context.rootEntityRef": "<ORDER_REF>",
230
- "context.rootEntityType": "ORDER",
231
- "context.entityType": "FULFILMENT_CHOICE",
232
- "eventType": "ORCHESTRATION",
233
- "count": 200
234
- })
235
- ```
236
- Repeat for `context.entityType: "FULFILMENT"`.
237
-
238
- - **FULFILMENT** entities: query events for the parent order:
239
- ```
240
- event.list({
241
- "context.entityRef": "<FULFILMENT_REF>",
242
- "context.entityType": "FULFILMENT",
243
- "eventType": "ORCHESTRATION",
244
- "count": 200
245
- })
246
- ```
247
- Also query any articles linked to the fulfilment.
248
-
249
- Collect all cross-entity events into a separate list for cross-entity edge validation.
250
-
251
- #### 7d) Map Actual Events to Expected Rulesets
252
-
253
- For each ruleset in the expected connection graph:
254
-
255
- 1. **Direct match**: Check if an ORCHESTRATION event with the same `name` as the ruleset name exists in the collected events. If found, mark as **MATCHED**.
256
- 2. **Conditional branch check**: If the ruleset has a `subtype` filter (e.g. `HD_WH` only), check whether the entity's actual subtype matches. If the subtype does not match, mark as **SKIPPED (subtype mismatch: entity is <actual>, ruleset requires <expected>)**.
257
- 3. **Gate ruleset check**: For gate-pattern rulesets (e.g. `SendEventOnVerifyingAllFulfilmentStates`), check if the gate event was emitted by looking for the gate's `eventName` in the event list. If the gate condition was not met, mark as **SKIPPED (gate condition not met)**.
258
- 4. **Cross-entity event check**: For rulesets that emit cross-entity events (via `SendEventForOrder`, `SendEventForAllFulfilmentChoices`, `SendEventForAllFulfilments`), verify the target event appears in the cross-entity event list. If found, mark as **MATCHED (cross-entity)**. If not found, mark as **SKIPPED (cross-entity event not propagated)**.
259
- 5. **Status precondition check**: If a ruleset triggers on a specific status and the entity never reached that status (based on observed SetState transitions), mark as **SKIPPED (status <STATUS> never reached)**.
260
-
261
- For each observed event that does NOT correspond to any expected ruleset, mark as **UNEXPECTED**.
262
-
263
- #### 7e) Timing Analysis
264
-
265
- Sort all matched events by `createdOn` timestamp and compute:
266
- - **Duration between consecutive events**: time from one ruleset completion to the next
267
- - **Total execution span**: time from first event to last event
268
- - **Slowest transition**: the largest gap between consecutive events (potential bottleneck)
269
- - **Gate wait time**: for gate rulesets, time between the last contributing child event and the gate event firing
270
-
271
- Flag any gap exceeding 5 seconds as a potential delay indicator.
272
-
273
- #### 7f) Produce Validate Report
274
-
275
- Generate the report with these sections:
276
-
277
- **Expected Path vs Actual Path Table:**
278
- ```
279
- | Ruleset | Flow Type | Expected | Observed | Status | Evidence |
280
- |---------|-----------|----------|----------|--------|----------|
281
- | CREATE | CREATE | yes | yes | MATCHED | evt-001 |
282
- | ValidateOrder | INTERNAL_EVENT | yes | yes | MATCHED | evt-002 |
283
- | ConfirmValidation | INTEGRATION_EVENT | yes | yes | MATCHED | evt-003 |
284
- | RequestShipment | INTERNAL_EVENT | yes | no | SKIPPED | subtype mismatch: entity is CC, ruleset requires HD_WH |
285
- | ReadyForPickup | INTERNAL_EVENT | yes | yes | MATCHED | evt-004 |
286
- | UnknownExternalEvt | - | no | yes | UNEXPECTED | evt-099 |
287
- ```
288
-
289
- **Summary Counts:**
290
- ```
291
- MATCHED: <N> rulesets executed as expected
292
- SKIPPED: <N> rulesets not executed (with reasons)
293
- UNEXPECTED: <N> events observed but not in expected path
294
- ```
295
-
296
- **Skipped Rulesets Detail:**
297
- For each SKIPPED ruleset, explain the skip reason:
298
- - `subtype mismatch` entity subtype does not match ruleset filter
299
- - `status never reached` prerequisite status was never set
300
- - `gate condition not met` gate ruleset waiting on child entities that are not all in required state
301
- - `cross-entity event not propagated` expected cross-entity event was not observed on child/parent
302
- - `conditional guard` — rule-level guard/attribute condition not satisfied
303
-
304
- **Conditional Branch Report:**
305
- ```
306
- Branch Point: <ruleset with multiple outgoing conditional edges>
307
- Taken: <branch that was observed> (subtype: HD_WH)
308
- Not taken: <branch not observed> (subtype: CC_PFS) — SKIPPED
309
- ```
310
-
311
- **Timing Analysis:**
312
- ```
313
- | From | To | Duration | Flag |
314
- |------|----|----------|------|
315
- | CREATE | ValidateOrder | 120ms | |
316
- | ValidateOrder | ConfirmValidation | 45200ms | SLOW (>5s) |
317
- | ConfirmValidation | ReadyForPickup | 340ms | |
318
- Total span: 45.66s | Slowest: ValidateOrder -> ConfirmValidation (45.2s)
319
- ```
320
-
321
- **Cross-Entity Propagation:**
322
- ```
323
- | Source Entity | Event Emitted | Target Entity Type | Target Event | Status |
324
- |--------------|---------------|--------------------|--------------|--------|
325
- | ORDER:ORD-001 | NotifyFCComplete | FULFILMENT_CHOICE | RouteFulfilmentChoice | MATCHED |
326
- | ORDER:ORD-001 | CancelFulfilment | FULFILMENT | CancelFulfilment | NOT FOUND |
327
- ```
328
-
329
- When `--output <path>` is specified, write the full report to the given file. When `--mermaid` is also enabled, annotate the connection graph diagram with color-coded edges: green for MATCHED, grey for SKIPPED, red for UNEXPECTED.
330
-
331
- #### 7g) Runtime Settings Conformance (required in validate mode)
332
-
333
- In `--validate` mode, always add a settings conformance section:
334
-
335
- 1. Reuse extracted setting refs from Step 5 (webhook + non-webhook settings).
336
- 2. Query live settings for each key using **cascading scope resolution**:
337
- - First: `RETAILER` (contextId = retailer id)
338
- - Then: `ACCOUNT` (contextId = 0)
339
- - Use the first scope where the setting is found.
340
- Record which scope the setting was found at this is important for the conformance table.
341
- 3. Evaluate status:
342
- - `FOUND`
343
- - `MISSING`
344
- - `EMPTY`
345
- - `INVALID_FORMAT` (for example webhook JSON without `url`)
346
- - `CONTRACT_MISMATCH` (exists but runtime evidence suggests wrong value; for example webhook request endpoint differs from configured setting URL)
347
- 4. If `ORCHESTRATION_AUDIT` contains webhook action evidence, compare:
348
- - configured webhook URL from setting
349
- - observed `Request Endpoint` in audit attributes
350
- and emit mismatch findings.
351
-
352
- Settings conformance table:
353
- ```
354
- | Setting | Referenced By | Runtime Status | Evidence |
355
- |---------|----------------|----------------|----------|
356
- | webhook.order.created | ORDER.CREATE | FOUND | setting id=... |
357
- | webhook.carrier.shipment.request | FULFILMENT.RequestShipment | CONTRACT_MISMATCH | configured=https://x, observed=https://y |
358
- | update.fulfilment.confirmPick | FULFILMENT.ConfirmPick | MISSING | no settings edge |
359
- ```
360
-
361
- ## Output Template
362
-
363
- ```text
364
- === Connection Analysis: <WORKFLOW_NAME> ===
365
-
366
- Topology:
367
- Internal edges: <N>
368
- Cross-entity edges: <N>
369
- Cross-workflow edges: <N>
370
-
371
- Findings:
372
- [CRITICAL|HIGH|MEDIUM] <finding>
373
-
374
- Process Flow Classification:
375
- <Ruleset> -> <FlowType>
376
-
377
- Webhook/Setting Dependencies:
378
- <Ruleset> -> webhook:<keys> setting:<keys>
379
- ```
380
-
381
- ## Decision Rules
382
-
383
- - If the user needs full state machine quality checks -> include `/fluent-workflow-analyzer`.
384
- - If gaps are found and user asks for fixes -> switch to `/fluent-workflow-builder`.
385
- - If runtime behavior differs from static analysis -> pivot to `/fluent-trace`.
386
-
1
+ ---
2
+ name: fluent-connection-analysis
3
+ description: Analyze workflow connection topology across rulesets and workflows. Produces internal/cross-entity/cross-workflow maps, static-vs-dynamic runtime diffs, and webhook/setting conformance inventories with Mermaid output. Triggers on "connection analysis", "workflow connections", "cross workflow dependencies", "orphaned rulesets", "process flow classification", "webhook dependency map", "expected vs observed rulesets", "runtime workflow diff".
4
+ user-invocable: true
5
+ allowed-tools: Bash, Read, Write, Edit, Glob, Grep
6
+ argument-hint: <workflow-file-or-name> [--deep] [--mermaid] [--output <path>] [--validate <entity-ref> --entity-type ORDER|FULFILMENT] [--from <iso> --to <iso>]
7
+ ---
8
+
9
+ # Fluent Connection Analysis
10
+
11
+ Connection-focused analysis for Fluent workflows. Use this when the main question is not just "what statuses exist?" but "how does work move between rulesets/workflows and where are the risky dependency points?"
12
+
13
+ ## Ownership Boundary
14
+
15
+ This skill owns:
16
+ - connection topology (internal, cross-entity, cross-workflow)
17
+ - orphan/missing-target detection
18
+ - process-flow type classification
19
+ - webhook and setting dependency extraction
20
+
21
+ Related skills:
22
+ - Workflow structure baseline -> `/fluent-workflow-analyzer`
23
+ - Workflow edits/fixes -> `/fluent-workflow-builder`
24
+ - Runtime failure correlation -> `/fluent-trace`
25
+ - Settings validation -> `/fluent-settings`
26
+
27
+ ## When to Use
28
+
29
+ - Mapping dependencies before changing a workflow
30
+ - Explaining "what triggers what" across entities
31
+ - Finding orphaned rulesets and missing SendEvent targets
32
+ - Auditing integration/webhook touchpoints
33
+ - Producing architecture handover docs with Mermaid diagrams
34
+ - Comparing static expected paths vs runtime observed execution after an event/mutation
35
+ - Verifying rule-referenced settings exist and are valid in live context
36
+
37
+ ## Progress
38
+
39
+ Emit this block at each phase transition to show progress:
40
+
41
+ ```
42
+ /fluent-connection-analysis [1/7]
43
+ Gather workflow set → Build connection graph
44
+ ○ Detect risks ○ Process flow classification
45
+ Webhook/setting deps ○ Produce deliverables
46
+ ○ Validate vs live data
47
+ ```
48
+
49
+ Update the block as each phase completes — mark completed phases with `✓`, the active phase with `→`, and remaining phases with `○`. Replace `[1/7]` with the current phase number.
50
+
51
+ ## Seamless Default Bundle
52
+
53
+ Run this skill as a single-pass bundle by default:
54
+
55
+ 1. Static connection topology + risk checks
56
+ 2. Settings conformance (`rule props -> live setting status`)
57
+ 3. Runtime diff (when `--validate` inputs are provided)
58
+
59
+ If `--validate` is not provided, still emit sections 1-2 and explicitly mark runtime diff as `NOT_RUN`.
60
+
61
+ ## Connection Analysis Procedure
62
+
63
+ ### 1) Gather Workflow Set
64
+
65
+ 1. Resolve target workflow(s) (local file or via `/fluent-workflow` download).
66
+ 2. For dependency analysis, load adjacent workflows in the same retailer (ORDER + FULFILMENT + child types).
67
+ 3. Build indexes:
68
+ - rulesets by `(type, name)`
69
+ - statuses by `(entityType, name)`
70
+ - event emitters by `eventName` scan ALL rules with `eventName` or `noMatchEventName` props (SendEvent, ScheduleEvent, ForwardEvent*, SendEventOnVerifying*, and any other event-emitting rule)
71
+
72
+ ### 2) Build Connection Graph
73
+
74
+ For each ruleset:
75
+ 1. Identify incoming edges:
76
+ - event-name match (`event.name == ruleset.name`)
77
+ - status-trigger match (`triggers[].status`)
78
+ 2. Identify outgoing edges:
79
+ - `SendEvent(eventName)` -> target ruleset(s)
80
+ - `SetState(status)` -> status transition edges
81
+ 3. Classify each edge:
82
+ - `internal`: same workflow/entity scope
83
+ - `cross-entity`: different entity type
84
+ - `cross-workflow`: target flexType/workflow differs
85
+ 4. Annotate conditional edges:
86
+ - If a ruleset has a `subtype` field (e.g. `"subtype": "HD_WH"`), mark all its incoming edges as **conditional on subtype**. The event fires for all subtypes but only this ruleset's trigger scope matches the specific subtype.
87
+ - In the report, label conditional edges: `ConfirmPick --(HD_WH only)--> RequestShipment`
88
+
89
+ ### 3) Detect Risks
90
+
91
+ Run these checks:
92
+ - orphaned rulesets (no trigger and no inbound SendEvent)
93
+ - missing SendEvent targets (no ruleset receives emitted event)
94
+ - trigger conflicts (multiple rulesets for same status in same type)
95
+ - dead-end non-terminal statuses
96
+ - unreachable statuses (never targeted by SetState)
97
+
98
+ **Duplicate ruleset severity calibration:**
99
+ - Same name + same entity type + same subtype (or both subtype-empty) + **overlapping trigger statuses** = **HIGH** (ambiguous runtime behavior)
100
+ - Same name + same entity type + same subtype (or both subtype-empty) + **non-overlapping trigger statuses** = **MEDIUM** (maintenance ambiguity; often intentional normal-vs-late variants)
101
+ - Same name + same entity type + **different subtype filters** = **INFO** (usually intentional subtype partitioning; document explicitly)
102
+
103
+ ### 4) Process Flow Classification
104
+
105
+ Classify each ruleset into one flow type. There are 6 categories (not 5):
106
+
107
+ | Type | Condition | Examples |
108
+ |------|-----------|---------|
109
+ | `CREATE` | Ruleset name is `CREATE` | ORDER.CREATE, FULFILMENT.CREATE |
110
+ | `SCHEDULED_EVENT` | Ruleset receives event fired by `ScheduleEvent` | ValidationGraceExpired |
111
+ | `CROSS_ENTITY_EVENT` | Ruleset receives event fired by `SendEventForOrder`, `SendEventForAllFulfilmentChoices`, `SendEventForAllFulfilments`, or other cross-entity Send rules | NotifyFCComplete, RouteFulfilmentChoice, CancelFulfilment |
112
+ | `USER_ACTION` | Ruleset has non-empty `userActions[]` | CancelOrder, EscalateFulfilmentChoice |
113
+ | `INTERNAL_EVENT` | Ruleset receives event fired by `SendEvent` or `ForwardEvent*` from another ruleset **within the same entity type** | ValidateOrder (from CREATE), ProcessOrder (from ConfirmValidation), TransitionToShipped (from NotifyFulfilmentShipped) |
114
+ | `INTEGRATION_EVENT` | No inbound SendEvent from any ruleset in the workflow; event arrives from external system | ConfirmValidation, ConfirmPick, ConfirmShipment, ConfirmDelivery |
115
+
116
+ **How to distinguish INTERNAL_EVENT from INTEGRATION_EVENT:**
117
+ 1. Build the emitter index by scanning ALL event-emitting rule patterns in the workflow:
118
+ - `core.SendEvent` `eventName` prop
119
+ - `core.ScheduleEvent` `eventName` prop
120
+ - `ForwardEventBy*` (e.g. `ForwardEventByFulfilmentChoiceType`) → `eventName` prop
121
+ - `SendEventOnVerifying*` (e.g. `SendEventOnVerifyingAttributeValue`) → both `eventName` AND `noMatchEventName` props
122
+ - `SendEventOnVerifyingAllFulfilment*States` → `eventName` prop
123
+ - **Catch-all:** Any rule with an `eventName` or `noMatchEventName` prop emits events — include it.
124
+ Record each emitted event name and which ruleset emits it.
125
+ 2. If a ruleset's name appears as an emitted `eventName` from another ruleset in the same entity type → `INTERNAL_EVENT`.
126
+ 3. If a ruleset's name does NOT appear as any emitted `eventName` in the workflow → `INTEGRATION_EVENT` (external inbound).
127
+ 4. Conditional emitters count: `noMatchEventName` targets, scheduled event targets, and gate-pattern event targets (from `SendEventOnVerifyingAll*`) are all internal emitters.
128
+ 5. **Dual classification:** A ruleset can be both a USER_ACTION (has `userActions[]`) and an INTERNAL_EVENT target (e.g. `CancelOrder` is a user action but also sent by `GracePeriodTimeoutCancel`). Use the primary classification per priority order, but note dual roles in the report.
129
+
130
+ Priority for deterministic classification (first match wins):
131
+ 1. `CREATE`
132
+ 2. `SCHEDULED_EVENT`
133
+ 3. `CROSS_ENTITY_EVENT`
134
+ 4. `USER_ACTION`
135
+ 5. `INTERNAL_EVENT`
136
+ 6. `INTEGRATION_EVENT`
137
+
138
+ ### 4A) Strict User Action Contract Checks (Anti-Hallucination)
139
+
140
+ When a ruleset is classified as `USER_ACTION`, enforce these checks:
141
+
142
+ 1. `userActions` must exist at the ruleset level (never inside rule props).
143
+ 2. Every action must have explicit `eventName` (no inferred defaults).
144
+ 3. Ruleset `subtype` must match the intended workflow branch for that action.
145
+ 4. `context[]` entries must include `label`, `type` (`PRIMARY` or `SECONDARY`), and non-empty `modules[]`.
146
+ 5. `attributes[]` entries must only use documented fields (`name`, `type`, `mandatory`, optional `source`, `options`).
147
+ 6. If expected actions are missing, compare `workflow.transitions` for target module vs `module: "all"` to detect visibility drift.
148
+
149
+ For canonical authoring and diagnostics, cross-check `/fluent-workflow-builder` and `/fluent-transition-api`.
150
+
151
+ ### 5) Webhook + Setting Dependency Mapping
152
+
153
+ Detect webhook/integration patterns by:
154
+ - rule name patterns (`webhook`, `notify`, `callback`, `publish`, `subscribe`)
155
+ - rule props referencing webhook/setting keys
156
+
157
+ Detect setting usage by prop-key/value patterns:
158
+ - `setting`, `config`, `parameter`, `option`, `property`
159
+
160
+ Output:
161
+ - ruleset -> webhook touchpoints
162
+ - ruleset -> setting keys
163
+ - setting -> dependent rulesets/workflows
164
+ - setting runtime contract status (`FOUND`, `MISSING`, `EMPTY`, `INVALID_FORMAT`)
165
+
166
+ Runtime setting verification:
167
+ 1. For each extracted setting key, query live settings using **cascading scope resolution**:
168
+ - First: `RETAILER` + retailer `contextId`
169
+ - Then: `ACCOUNT` + `contextId=0`
170
+ - Use the first scope where the setting is found.
171
+ Module-installed settings often default to `ACCOUNT` scope. Always check both before reporting `MISSING`.
172
+ 2. Validate existence and value shape:
173
+ - `MISSING`: no setting found.
174
+ - `EMPTY`: found but `value` and `lobValue` are empty.
175
+ - `INVALID_FORMAT`: value exists but does not match expected shape (for example webhook JSON missing `url`).
176
+ - `FOUND`: exists with plausible value shape.
177
+ 3. Emit a contract table: `setting -> referencedByRulesets -> runtimeStatus -> notes`.
178
+
179
+ For full CRUD/migration workflows, hand off to `/fluent-settings`.
180
+
181
+ ### 6) Produce Deliverables
182
+
183
+ Always generate:
184
+ 1. Connection Summary (counts by internal/cross-entity/cross-workflow)
185
+ 2. Risk Findings (ordered by severity)
186
+ 3. Process Flow Table (ruleset -> flow type)
187
+ 4. Integration Dependency Table (webhook + settings)
188
+
189
+ When `--mermaid` is enabled, generate:
190
+ - state machine per entity (`stateDiagram-v2`)
191
+ - event/connection flow (`flowchart TD`)
192
+ - cross-entity lifecycle (`flowchart LR`)
193
+
194
+ **Mermaid syntax:** Validate all generated diagrams against `/fluent-mermaid-validate` rules before output (no colons in free text, no unicode arrows, quoted special-char labels).
195
+
196
+ > **Diagram validation:** All Mermaid blocks must pass `/fluent-mermaid-validate` rules before writing to the plan file.
197
+
198
+ **Mermaid accuracy rules:**
199
+ - Dotted-line labels between entities must use **event names**, not rule names. If a rule (e.g. `CreateFulfilmentFromSourcingLocation`) creates a child entity, label the edge as "creates entity" or the subsequent CREATE event, not the rule class name.
200
+ - Cross-entity lifecycle must show **intermediate statuses** when an entity transitions through multiple states. E.g. if ReportShortpick sends both NotifyFulfilmentShipped and NotifyFulfilmentDelivered, show the ORDER transitioning through SHIPPED before COMPLETED, not skipping directly to COMPLETED.
201
+ - Annotate subtype-conditional paths in diagrams: `RequestShipment [HD_WH]`, `ReadyForPickup [CC_PFS]`.
202
+
203
+ ### 7) Validate Against Live Data (`--validate`)
204
+
205
+ Use this when you have a real entity and want to compare "what the static connection graph predicts" vs "what actually executed at runtime". Requires `--validate <entity-ref> --entity-type <TYPE>`.
206
+
207
+ #### 7a) Resolve Entity and Determine Scope
208
+
209
+ 1. Accept entity ref and type from CLI arguments. Supported types: `ORDER`, `FULFILMENT`, `FULFILMENT_CHOICE`, `ARTICLE`.
210
+ 2. Query the entity to confirm it exists and retrieve its current status and subtype:
211
+ ```
212
+ graphql.query: { orders(ref: ["<REF>"]) { edges { node { id ref type status } } } }
213
+ ```
214
+ (Adjust root field for entity type: `orders`, `fulfilments`, etc.)
215
+ 3. Determine the workflow flexType from entity type + subtype (e.g. `ORDER::HD`, `FULFILMENT::HD_WH`).
216
+ 4. Load the matching workflow JSON from the local workflow set (Steps 1-2 of the main procedure). If not found locally, download it.
217
+ 5. Run Steps 2-4 (Build Connection Graph, Detect Risks, Process Flow Classification) on the workflow to produce the **expected connection graph** the full set of rulesets, edges, and conditional branches.
218
+
219
+ #### 7b) Query Live Orchestration Events
220
+
221
+ Fetch all orchestration events for the entity:
222
+
223
+ > **Event filter reference:** For complete filter syntax, see `/fluent-event-api`. The examples below show connection-analysis-specific patterns.
224
+
225
+ ```
226
+ event.list({
227
+ "context.entityRef": "<ENTITY_REF>",
228
+ "context.entityType": "<ENTITY_TYPE>",
229
+ "eventType": "ORCHESTRATION_AUDIT",
230
+ "count": 200
231
+ })
232
+ ```
233
+
234
+ Also collect business orchestration events for name-level matching:
235
+ ```
236
+ event.list({
237
+ "context.entityRef": "<ENTITY_REF>",
238
+ "context.entityType": "<ENTITY_TYPE>",
239
+ "eventType": "ORCHESTRATION",
240
+ "count": 200
241
+ })
242
+ ```
243
+
244
+ If more than 200 events exist, paginate using `start` offset until all events are collected for both queries.
245
+
246
+ For each returned event, extract:
247
+ - `name` the event/ruleset name that fired
248
+ - `status` — event status (SUCCESS, FAILED, etc.)
249
+ - `createdOn` timestamp for timing analysis
250
+ - `entityId`, `entityRef`, `entityType` — confirm entity scope
251
+ - `attributes` any rule-specific attributes (subtype, status transitions)
252
+ - `category` — especially `ruleSet`, `rule`, `ACTION`, `exception` from `ORCHESTRATION_AUDIT`
253
+
254
+ #### 7c) Cross-Entity Event Tracing
255
+
256
+ For entity types that spawn or interact with child entities, also query child events:
257
+
258
+ - **ORDER** entities: query events for related fulfilment choices and fulfilments:
259
+ ```
260
+ event.list({
261
+ "context.rootEntityRef": "<ORDER_REF>",
262
+ "context.rootEntityType": "ORDER",
263
+ "context.entityType": "FULFILMENT_CHOICE",
264
+ "eventType": "ORCHESTRATION",
265
+ "count": 200
266
+ })
267
+ ```
268
+ Repeat for `context.entityType: "FULFILMENT"`.
269
+
270
+ - **FULFILMENT** entities: query events for the parent order:
271
+ ```
272
+ event.list({
273
+ "context.entityRef": "<FULFILMENT_REF>",
274
+ "context.entityType": "FULFILMENT",
275
+ "eventType": "ORCHESTRATION",
276
+ "count": 200
277
+ })
278
+ ```
279
+ Also query any articles linked to the fulfilment.
280
+
281
+ Collect all cross-entity events into a separate list for cross-entity edge validation.
282
+
283
+ #### 7d) Map Actual Events to Expected Rulesets
284
+
285
+ For each ruleset in the expected connection graph:
286
+
287
+ 1. **Direct match**: Check if an ORCHESTRATION event with the same `name` as the ruleset name exists in the collected events. If found, mark as **MATCHED**.
288
+ 2. **Conditional branch check**: If the ruleset has a `subtype` filter (e.g. `HD_WH` only), check whether the entity's actual subtype matches. If the subtype does not match, mark as **SKIPPED (subtype mismatch: entity is <actual>, ruleset requires <expected>)**.
289
+ 3. **Gate ruleset check**: For gate-pattern rulesets (e.g. `SendEventOnVerifyingAllFulfilmentStates`), check if the gate event was emitted by looking for the gate's `eventName` in the event list. If the gate condition was not met, mark as **SKIPPED (gate condition not met)**.
290
+ 4. **Cross-entity event check**: For rulesets that emit cross-entity events (via `SendEventForOrder`, `SendEventForAllFulfilmentChoices`, `SendEventForAllFulfilments`), verify the target event appears in the cross-entity event list. If found, mark as **MATCHED (cross-entity)**. If not found, mark as **SKIPPED (cross-entity event not propagated)**.
291
+ 5. **Status precondition check**: If a ruleset triggers on a specific status and the entity never reached that status (based on observed SetState transitions), mark as **SKIPPED (status <STATUS> never reached)**.
292
+
293
+ For each observed event that does NOT correspond to any expected ruleset, mark as **UNEXPECTED**.
294
+
295
+ #### 7e) Timing Analysis
296
+
297
+ Sort all matched events by `createdOn` timestamp and compute:
298
+ - **Duration between consecutive events**: time from one ruleset completion to the next
299
+ - **Total execution span**: time from first event to last event
300
+ - **Slowest transition**: the largest gap between consecutive events (potential bottleneck)
301
+ - **Gate wait time**: for gate rulesets, time between the last contributing child event and the gate event firing
302
+
303
+ Flag any gap exceeding 5 seconds as a potential delay indicator.
304
+
305
+ #### 7f) Produce Validate Report
306
+
307
+ Generate the report with these sections:
308
+
309
+ **Expected Path vs Actual Path Table:**
310
+ ```
311
+ | Ruleset | Flow Type | Expected | Observed | Status | Evidence |
312
+ |---------|-----------|----------|----------|--------|----------|
313
+ | CREATE | CREATE | yes | yes | MATCHED | evt-001 |
314
+ | ValidateOrder | INTERNAL_EVENT | yes | yes | MATCHED | evt-002 |
315
+ | ConfirmValidation | INTEGRATION_EVENT | yes | yes | MATCHED | evt-003 |
316
+ | RequestShipment | INTERNAL_EVENT | yes | no | SKIPPED | subtype mismatch: entity is CC, ruleset requires HD_WH |
317
+ | ReadyForPickup | INTERNAL_EVENT | yes | yes | MATCHED | evt-004 |
318
+ | UnknownExternalEvt | - | no | yes | UNEXPECTED | evt-099 |
319
+ ```
320
+
321
+ **Summary Counts:**
322
+ ```
323
+ MATCHED: <N> rulesets executed as expected
324
+ SKIPPED: <N> rulesets not executed (with reasons)
325
+ UNEXPECTED: <N> events observed but not in expected path
326
+ ```
327
+
328
+ **Skipped Rulesets Detail:**
329
+ For each SKIPPED ruleset, explain the skip reason:
330
+ - `subtype mismatch` — entity subtype does not match ruleset filter
331
+ - `status never reached` prerequisite status was never set
332
+ - `gate condition not met` — gate ruleset waiting on child entities that are not all in required state
333
+ - `cross-entity event not propagated` expected cross-entity event was not observed on child/parent
334
+ - `conditional guard` — rule-level guard/attribute condition not satisfied
335
+
336
+ **Conditional Branch Report:**
337
+ ```
338
+ Branch Point: <ruleset with multiple outgoing conditional edges>
339
+ Taken: <branch that was observed> (subtype: HD_WH)
340
+ Not taken: <branch not observed> (subtype: CC_PFS)SKIPPED
341
+ ```
342
+
343
+ **Timing Analysis:**
344
+ ```
345
+ | From | To | Duration | Flag |
346
+ |------|----|----------|------|
347
+ | CREATE | ValidateOrder | 120ms | |
348
+ | ValidateOrder | ConfirmValidation | 45200ms | SLOW (>5s) |
349
+ | ConfirmValidation | ReadyForPickup | 340ms | |
350
+ Total span: 45.66s | Slowest: ValidateOrder -> ConfirmValidation (45.2s)
351
+ ```
352
+
353
+ **Cross-Entity Propagation:**
354
+ ```
355
+ | Source Entity | Event Emitted | Target Entity Type | Target Event | Status |
356
+ |--------------|---------------|--------------------|--------------|--------|
357
+ | ORDER:ORD-001 | NotifyFCComplete | FULFILMENT_CHOICE | RouteFulfilmentChoice | MATCHED |
358
+ | ORDER:ORD-001 | CancelFulfilment | FULFILMENT | CancelFulfilment | NOT FOUND |
359
+ ```
360
+
361
+ **Default output path:** `accounts/<PROFILE>/analysis/topology/`. When `--output <path>` is specified, write the full report to the given file instead. When `--mermaid` is also enabled, annotate the connection graph diagram with color-coded edges: green for MATCHED, grey for SKIPPED, red for UNEXPECTED.
362
+
363
+ #### 7g) Runtime Settings Conformance (required in validate mode)
364
+
365
+ In `--validate` mode, always add a settings conformance section:
366
+
367
+ 1. Reuse extracted setting refs from Step 5 (webhook + non-webhook settings).
368
+ 2. Query live settings for each key using **cascading scope resolution**:
369
+ - First: `RETAILER` (contextId = retailer id)
370
+ - Then: `ACCOUNT` (contextId = 0)
371
+ - Use the first scope where the setting is found.
372
+ Record which scope the setting was found at — this is important for the conformance table.
373
+ 3. Evaluate status:
374
+ - `FOUND`
375
+ - `MISSING`
376
+ - `EMPTY`
377
+ - `INVALID_FORMAT` (for example webhook JSON without `url`)
378
+ - `CONTRACT_MISMATCH` (exists but runtime evidence suggests wrong value; for example webhook request endpoint differs from configured setting URL)
379
+ 4. If `ORCHESTRATION_AUDIT` contains webhook action evidence, compare:
380
+ - configured webhook URL from setting
381
+ - observed `Request Endpoint` in audit attributes
382
+ and emit mismatch findings.
383
+
384
+ Settings conformance table:
385
+ ```
386
+ | Setting | Referenced By | Runtime Status | Evidence |
387
+ |---------|----------------|----------------|----------|
388
+ | webhook.order.created | ORDER.CREATE | FOUND | setting id=... |
389
+ | webhook.carrier.shipment.request | FULFILMENT.RequestShipment | CONTRACT_MISMATCH | configured=https://x, observed=https://y |
390
+ | update.fulfilment.confirmPick | FULFILMENT.ConfirmPick | MISSING | no settings edge |
391
+ ```
392
+
393
+ ## Output Template
394
+
395
+ ```text
396
+ === Connection Analysis: <WORKFLOW_NAME> ===
397
+
398
+ Topology:
399
+ Internal edges: <N>
400
+ Cross-entity edges: <N>
401
+ Cross-workflow edges: <N>
402
+
403
+ Findings:
404
+ [CRITICAL|HIGH|MEDIUM] <finding>
405
+
406
+ Process Flow Classification:
407
+ <Ruleset> -> <FlowType>
408
+
409
+ Webhook/Setting Dependencies:
410
+ <Ruleset> -> webhook:<keys> setting:<keys>
411
+ ```
412
+
413
+ ## Learning Capture
414
+
415
+ This is an analysis skill — follow the **Learning Capture Protocol** (see CLAUDE.md Cross-Skill Conventions). After topology analysis, when the user confirms or corrects findings about cross-workflow connections, event routing, or webhook dependencies, write the confirmed learning to the `implementation-learnings.md` auto-memory file under the relevant account heading.
416
+
417
+ ## Decision Rules
418
+
419
+ - If the user needs full state machine quality checks -> include `/fluent-workflow-analyzer`.
420
+ - If gaps are found and user asks for fixes -> switch to `/fluent-workflow-builder`.
421
+ - If runtime behavior differs from static analysis -> pivot to `/fluent-trace`.
422
+