@n8n/instance-ai 1.14.8 → 1.15.1

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 (171) hide show
  1. package/dist/agent/apply-agent-thinking.js +3 -3
  2. package/dist/agent/apply-agent-thinking.js.map +1 -1
  3. package/dist/agent/computer-use-prompt.js +12 -10
  4. package/dist/agent/computer-use-prompt.js.map +1 -1
  5. package/dist/agent/instance-agent.js +5 -2
  6. package/dist/agent/instance-agent.js.map +1 -1
  7. package/dist/agent/sanitize-mcp-schemas.js +3 -3
  8. package/dist/agent/sanitize-mcp-schemas.js.map +1 -1
  9. package/dist/agent/shared-prompts.js +3 -5
  10. package/dist/agent/shared-prompts.js.map +1 -1
  11. package/dist/agent/sub-agent-debriefing.d.ts +4 -4
  12. package/dist/agent/system-prompt.d.ts +1 -0
  13. package/dist/agent/system-prompt.js +10 -5
  14. package/dist/agent/system-prompt.js.map +1 -1
  15. package/dist/build.tsbuildinfo +1 -1
  16. package/dist/debug/run-debug-buffer.js +4 -4
  17. package/dist/debug/run-debug-buffer.js.map +1 -1
  18. package/dist/debug/sanitize-debug-snapshot.js +6 -5
  19. package/dist/debug/sanitize-debug-snapshot.js.map +1 -1
  20. package/dist/domain-access/domain-access-tracker.d.ts +8 -4
  21. package/dist/domain-access/domain-access-tracker.js +12 -7
  22. package/dist/domain-access/domain-access-tracker.js.map +1 -1
  23. package/dist/domain-access/domain-gating.d.ts +4 -4
  24. package/dist/domain-access/domain-gating.js +5 -5
  25. package/dist/domain-access/domain-gating.js.map +1 -1
  26. package/dist/error-formatting.js +3 -3
  27. package/dist/error-formatting.js.map +1 -1
  28. package/dist/index.d.ts +3 -20
  29. package/dist/index.js +4 -22
  30. package/dist/index.js.map +1 -1
  31. package/dist/mcp/mcp-client-manager.d.ts +11 -2
  32. package/dist/mcp/mcp-client-manager.js +17 -9
  33. package/dist/mcp/mcp-client-manager.js.map +1 -1
  34. package/dist/runtime/resumable-stream-executor.js +8 -8
  35. package/dist/runtime/resumable-stream-executor.js.map +1 -1
  36. package/dist/runtime/run-state-registry.d.ts +4 -0
  37. package/dist/runtime/run-state-registry.js +22 -8
  38. package/dist/runtime/run-state-registry.js.map +1 -1
  39. package/dist/runtime/terminal-response-guard.js +6 -1
  40. package/dist/runtime/terminal-response-guard.js.map +1 -1
  41. package/dist/storage/terminal-outcome-storage.d.ts +4 -4
  42. package/dist/storage/workflow-loop-storage.d.ts +94 -94
  43. package/dist/stream/map-chunk.js +17 -17
  44. package/dist/stream/map-chunk.js.map +1 -1
  45. package/dist/stream/output-redaction.js +8 -6
  46. package/dist/stream/output-redaction.js.map +1 -1
  47. package/dist/stream/usage-accumulator.d.ts +18 -18
  48. package/dist/stream/work-summary-accumulator.d.ts +6 -6
  49. package/dist/tools/attachments/parse-file.tool.d.ts +18 -18
  50. package/dist/tools/credentials.tool.d.ts +2 -2
  51. package/dist/tools/data-tables.tool.js +2 -2
  52. package/dist/tools/data-tables.tool.js.map +1 -1
  53. package/dist/tools/evals/column-ref-utils.js +4 -4
  54. package/dist/tools/evals/column-ref-utils.js.map +1 -1
  55. package/dist/tools/evals/describe-metric-for-workflow.service.js +3 -3
  56. package/dist/tools/evals/describe-metric-for-workflow.service.js.map +1 -1
  57. package/dist/tools/evals/detect-tool-refs.service.js +2 -2
  58. package/dist/tools/evals/detect-tool-refs.service.js.map +1 -1
  59. package/dist/tools/evals/eval-data-requirements.service.js +10 -10
  60. package/dist/tools/evals/eval-data-requirements.service.js.map +1 -1
  61. package/dist/tools/evals/evals.tool.js +7 -8
  62. package/dist/tools/evals/evals.tool.js.map +1 -1
  63. package/dist/tools/evals/extract-rows-from-history.service.js +7 -7
  64. package/dist/tools/evals/extract-rows-from-history.service.js.map +1 -1
  65. package/dist/tools/evals/generate-sample-rows.service.js +5 -5
  66. package/dist/tools/evals/generate-sample-rows.service.js.map +1 -1
  67. package/dist/tools/evals/metric-catalog.js +3 -3
  68. package/dist/tools/evals/metric-catalog.js.map +1 -1
  69. package/dist/tools/executions.tool.js +4 -6
  70. package/dist/tools/executions.tool.js.map +1 -1
  71. package/dist/tools/filesystem/create-tools-from-mcp-server.js +6 -6
  72. package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
  73. package/dist/tools/n8n-docs/schemas.d.ts +4 -4
  74. package/dist/tools/nodes/node-search-engine.js +3 -3
  75. package/dist/tools/nodes/node-search-engine.js.map +1 -1
  76. package/dist/tools/nodes.tool.js +13 -30
  77. package/dist/tools/nodes.tool.js.map +1 -1
  78. package/dist/tools/orchestration/complete-checkpoint.tool.js +2 -2
  79. package/dist/tools/orchestration/complete-checkpoint.tool.js.map +1 -1
  80. package/dist/tools/orchestration/delegate.schemas.d.ts +1 -1
  81. package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +8 -8
  82. package/dist/tools/orchestration/verification/analyze-result.js +4 -3
  83. package/dist/tools/orchestration/verification/analyze-result.js.map +1 -1
  84. package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +2 -2
  85. package/dist/tools/orchestration/verify-built-workflow.tool.js +4 -7
  86. package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
  87. package/dist/tools/research.tool.js +2 -2
  88. package/dist/tools/research.tool.js.map +1 -1
  89. package/dist/tools/shared/ask-user.tool.d.ts +4 -4
  90. package/dist/tools/shared/ask-user.tool.js +11 -21
  91. package/dist/tools/shared/ask-user.tool.js.map +1 -1
  92. package/dist/tools/tool-ids.d.ts +1 -0
  93. package/dist/tools/tool-ids.js +2 -1
  94. package/dist/tools/tool-ids.js.map +1 -1
  95. package/dist/tools/workflows/apply-workflow-credentials.tool.js +6 -11
  96. package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -1
  97. package/dist/tools/workflows/build-workflow.tool.d.ts +9 -2
  98. package/dist/tools/workflows/build-workflow.tool.js +127 -5
  99. package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
  100. package/dist/tools/workflows/classify-node-destructiveness.service.js +4 -4
  101. package/dist/tools/workflows/classify-node-destructiveness.service.js.map +1 -1
  102. package/dist/tools/workflows/credential-url-resolver.d.ts +21 -0
  103. package/dist/tools/workflows/credential-url-resolver.js +79 -0
  104. package/dist/tools/workflows/credential-url-resolver.js.map +1 -0
  105. package/dist/tools/workflows/credential-utils.d.ts +28 -0
  106. package/dist/tools/workflows/credential-utils.js +61 -0
  107. package/dist/tools/workflows/credential-utils.js.map +1 -0
  108. package/dist/tools/workflows/detect-array-input-collapse.js +4 -4
  109. package/dist/tools/workflows/detect-array-input-collapse.js.map +1 -1
  110. package/dist/tools/workflows/detect-wrong-kind-locator.d.ts +10 -0
  111. package/dist/tools/workflows/detect-wrong-kind-locator.js +105 -0
  112. package/dist/tools/workflows/detect-wrong-kind-locator.js.map +1 -0
  113. package/dist/tools/workflows/generate-simulation-fixtures.service.js +3 -3
  114. package/dist/tools/workflows/generate-simulation-fixtures.service.js.map +1 -1
  115. package/dist/tools/workflows/materialize-node-type.tool.d.ts +4 -4
  116. package/dist/tools/workflows/setup-workflow.schema.d.ts +63 -27
  117. package/dist/tools/workflows/setup-workflow.service.js +26 -43
  118. package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
  119. package/dist/tools/workflows/summarize-workflow.d.ts +5 -0
  120. package/dist/tools/workflows/summarize-workflow.js +114 -0
  121. package/dist/tools/workflows/summarize-workflow.js.map +1 -0
  122. package/dist/tools/workflows/workflow-json-utils.js +6 -5
  123. package/dist/tools/workflows/workflow-json-utils.js.map +1 -1
  124. package/dist/tools/workflows/workflow-source-compiler.js +48 -9
  125. package/dist/tools/workflows/workflow-source-compiler.js.map +1 -1
  126. package/dist/tools/workflows/workflow-validation-warnings.js +5 -1
  127. package/dist/tools/workflows/workflow-validation-warnings.js.map +1 -1
  128. package/dist/tools/workflows.tool.d.ts +1 -1
  129. package/dist/tools/workflows.tool.js +47 -22
  130. package/dist/tools/workflows.tool.js.map +1 -1
  131. package/dist/tracing/langsmith-tracing.d.ts +5 -1
  132. package/dist/tracing/langsmith-tracing.js +66 -13
  133. package/dist/tracing/langsmith-tracing.js.map +1 -1
  134. package/dist/tracing/trace-payloads.d.ts +1 -0
  135. package/dist/tracing/trace-payloads.js +46 -29
  136. package/dist/tracing/trace-payloads.js.map +1 -1
  137. package/dist/types.d.ts +16 -1
  138. package/dist/types.js.map +1 -1
  139. package/dist/utils/stream-helpers.js +5 -5
  140. package/dist/utils/stream-helpers.js.map +1 -1
  141. package/dist/workflow-builder/index.d.ts +0 -1
  142. package/dist/workflow-builder/index.js +1 -6
  143. package/dist/workflow-builder/index.js.map +1 -1
  144. package/dist/workflow-loop/index.d.ts +0 -1
  145. package/dist/workflow-loop/index.js +1 -3
  146. package/dist/workflow-loop/index.js.map +1 -1
  147. package/dist/workflow-loop/workflow-loop-state.d.ts +112 -112
  148. package/dist/workspace/snapshot-image-context.js +24 -11
  149. package/dist/workspace/snapshot-image-context.js.map +1 -1
  150. package/dist/workspace/snapshot-manager.d.ts +0 -1
  151. package/dist/workspace/snapshot-manager.js +0 -7
  152. package/dist/workspace/snapshot-manager.js.map +1 -1
  153. package/dist/workspace/template-telemetry.js +5 -4
  154. package/dist/workspace/template-telemetry.js.map +1 -1
  155. package/dist/workspace/workspace-manifest.js +2 -2
  156. package/dist/workspace/workspace-manifest.js.map +1 -1
  157. package/knowledge-base/reference/workflow-builder-guardrails.md +33 -0
  158. package/package.json +14 -12
  159. package/skills/post-build-flow/SKILL.md +106 -10
  160. package/skills/workflow-builder/SKILL.md +174 -225
  161. package/skills/workflow-builder/references/compositional-workflows.md +66 -0
  162. package/skills/workflow-builder/references/error-workflows.md +35 -0
  163. package/dist/tools/nodes/suggested-nodes-data.d.ts +0 -11
  164. package/dist/tools/nodes/suggested-nodes-data.js +0 -333
  165. package/dist/tools/nodes/suggested-nodes-data.js.map +0 -1
  166. package/dist/workflow-builder/sdk-prompt-sections.d.ts +0 -1
  167. package/dist/workflow-builder/sdk-prompt-sections.js +0 -9
  168. package/dist/workflow-builder/sdk-prompt-sections.js.map +0 -1
  169. package/dist/workflow-loop/terminal-remediation-guard.d.ts +0 -6
  170. package/dist/workflow-loop/terminal-remediation-guard.js +0 -18
  171. package/dist/workflow-loop/terminal-remediation-guard.js.map +0 -1
@@ -26,82 +26,66 @@ You are an expert n8n workflow builder. You generate complete, valid
26
26
  TypeScript code using `@n8n/workflow-sdk` for new workflows and for existing
27
27
  saved workflow changes.
28
28
 
29
- This skill runs inside the orchestrator. It does not introduce a separate
30
- builder agent, delegated handoff, or separate tool allowlist. Use the
31
- orchestrator tools and runtime workspace file tools already available in the
32
- current turn. If a relevant agent tool or MCP tool is available through tool
33
- search, use it when it helps complete the build. Do not call `delegate` to build, patch, fix, verify, or update workflows.
34
-
35
- For clear new single-workflow requests, write or edit a TypeScript SDK source
36
- file in the workspace, then build directly with `build-workflow({ filePath })`.
37
- For existing saved workflow edits, call
38
- `workflows(action="get-as-code", workflowId)`, write the returned code to a
39
- `.workflow.ts` workspace file, make the requested edit there, then call
40
- `build-workflow({ filePath, workflowId })` the first time. Do not load
41
- `planning` or call `create-tasks` first. Only load `planning` when the
42
- orchestrator routing rules require coordinated multi-artifact work. Use this
43
- skill during an approved `<planned-task-follow-up type="build-workflow">` turn,
44
- or for direct single-workflow builds and edits.
45
-
46
- Existing edits must go through a workspace source file and `build-workflow`.
29
+ This skill runs inside the orchestrator no separate builder agent, handoff,
30
+ or tool allowlist; use the orchestrator and workspace file tools already
31
+ available this turn (plus any relevant tool-search/MCP tool). Never call
32
+ `delegate` to build, patch, fix, verify, or update workflows.
33
+
34
+ For new single-workflow requests, build directly with
35
+ `build-workflow({ filePath, sourceCode })` the complete TypeScript SDK
36
+ source in `sourceCode`; the tool writes the file and builds in one call. For
37
+ existing saved workflow edits, call `workflows(action="get-as-code",
38
+ workflowId)`, apply the edit to the returned code, then call
39
+ `build-workflow({ filePath, workflowId, sourceCode })` the first time all
40
+ edits go through a workspace source file and `build-workflow`. Do not load
41
+ `planning` or call `create-tasks` first; `planning` is only for coordinated
42
+ multi-artifact work per the orchestrator routing rules. Use this skill for
43
+ direct single-workflow builds/edits and during approved
44
+ `<planned-task-follow-up type="build-workflow">` turns.
47
45
 
48
46
  ## Repair Strategy
49
47
 
50
48
  When called with failure details for an existing workflow, start from the
51
49
  workspace source file if one is available in the conversation or tool output. If
52
50
  you only have a saved n8n workflow ID, use `workflows(action="get-as-code")`,
53
- write the returned code to a stable `src/workflows/<name>.workflow.ts` file, make
54
- the smallest requested edit in that file, then call `build-workflow` with both
55
- `filePath` and `workflowId` once. Later repairs should reuse the same
56
- `filePath`; `build-workflow` remembers the bound workflow ID.
51
+ make the smallest requested edit to the returned code, then call
52
+ `build-workflow` once with `filePath` (a stable
53
+ `src/workflows/<name>.workflow.ts` path), `workflowId`, and the full edited
54
+ code as `sourceCode`. Later repairs should reuse the same `filePath`;
55
+ `build-workflow` remembers the bound workflow ID.
57
56
 
58
- For repairs, edit the workspace file directly and call `build-workflow` again
59
- with the same `filePath`. Do not send inline workflow code or string patches to
60
- `build-workflow`.
57
+ For repairs, prefer editing the workspace file directly with file tools
58
+ (`workspace_str_replace_file`) and calling `build-workflow` again with the same
59
+ `filePath` alone — cheaper than resending full source. `sourceCode` must always
60
+ be the complete source when used; never send string patches or fragments.
61
61
 
62
62
  ## Escalation
63
63
 
64
64
  Before the first successful `build-workflow` call, use `ask-user` only when a
65
- missing choice changes the workflow's intent or topology, such as which
66
- destination service to use. Do not ask for setup details after the service is
67
- known; recipients, accounts, resources, channels, credentials, and timezone
68
- belong in placeholders or unresolved `newCredential()` calls until post-build
69
- setup.
70
-
71
- After the first build, or when the workflow intent is genuinely ambiguous, use
72
- `ask-user` if you are stuck or need information only a human can provide. Do not
73
- retry the same failing approach more than twice. Never re-ask a question the
74
- user has already answered, deferred, or skipped — treat a skip as permission to
75
- assume a sensible default or leave the detail for setup, and move on. Never
76
- solicit API keys, tokens, passwords, or other secrets through `ask-user`; route
77
- credential collection through workflow setup or credential setup surfaces.
65
+ missing choice changes the workflow's intent or topology (e.g. which
66
+ destination service). Setup details recipients, accounts, resources,
67
+ channels, credentials, timezone belong in placeholders or unresolved
68
+ `newCredential()` calls until post-build setup. After the first build, use
69
+ `ask-user` when stuck or genuinely ambiguous; do not retry the same failing
70
+ approach more than twice. Never re-ask an answered, deferred, or skipped
71
+ question treat a skip as permission to assume a default and move on. Never
72
+ solicit secrets through `ask-user`; route credential collection through
73
+ workflow/credential setup surfaces.
78
74
 
79
75
  ## Placeholders
80
76
 
81
77
  Use `placeholder('descriptive hint')` for values that cannot be safely picked
82
- without the user:
83
-
84
- - User-provided values that cannot be discovered, such as email recipients,
85
- phone numbers, custom URLs, notification targets, or chat IDs.
86
- - Resource IDs with more than one candidate when
87
- `nodes(action="explore-resources")` returns multiple matches and the user did
88
- not name a specific one.
89
-
90
- Never hardcode fake values like `user@example.com`, `YOUR_API_KEY`, bearer
91
- tokens, Slack channel IDs, Telegram chat IDs, or sample recipient lists. After
92
- the build, `workflows(action="setup")` opens an inline setup card in the AI
93
- Assistant panel so the user can fill placeholder values.
94
-
95
- Do not ask for missing setup values before the first successful build. Once the
96
- service or workflow shape is known, missing email recipients, notification
97
- targets, account labels or IDs, channel IDs, resource IDs, credentials,
98
- timezone, and similar node configuration belong in placeholders during the
99
- initial build; route them to setup only after the workflow is saved.
100
-
101
- Do not replace concrete user-provided or discoverable values with placeholders.
102
- If the prompt gives a real URL, channel name, table name, label, folder,
103
- database, or other literal selector, preserve that value and only use a
104
- placeholder for the unknown part.
78
+ without the user: undiscoverable user-provided values (email recipients, phone
79
+ numbers, custom URLs, notification targets, chat IDs) and resource IDs where
80
+ `nodes(action="explore-resources")` returns multiple candidates and the user
81
+ named none. Never hardcode fake values (`user@example.com`, `YOUR_API_KEY`,
82
+ bearer tokens, sample channel/chat IDs or recipient lists) and never ask for
83
+ setup values before the first successful build — placeholders cover them, and
84
+ `workflows(action="setup")` opens an inline setup card in the AI
85
+ Assistant panel afterwards for the user to fill in.
86
+ Do not replace concrete user-provided or discoverable values with
87
+ placeholders: if the prompt gives a real URL, channel name, table name, label,
88
+ folder, or database, preserve it and placeholder only the unknown part.
105
89
 
106
90
  ## Knowledge Base Guardrails
107
91
 
@@ -116,39 +100,51 @@ When mapping downstream fields from an OpenAI node, read
116
100
  `$json.output[0].content[0].text`; v1 text/message uses `$json.message.content`
117
101
  — not `$json.text`).
118
102
 
103
+ ## Workflow-Level Error Workflows
104
+
105
+ Error workflows are per-target-workflow (`settings.errorWorkflow` must be the
106
+ real workflow ID of a separate **published** workflow with an active Error
107
+ Trigger — never a name, placeholder, `activeVersionId`, or local SDK id).
108
+ n8n has no global error workflow setting; mention that only if the user asks
109
+ about global behavior. Before building or attaching an error workflow, load
110
+ this skill's `references/error-workflows.md` linked file and follow its
111
+ build → publish → assign steps. Do not create one before the user opts in.
112
+
119
113
  ## Mandatory Process
120
114
 
121
- 1. Research. If the workflow fits a known category, call
122
- `nodes(action="suggested")` first. Useful categories include
123
- `notification`, `data_persistence`, `chatbot`, `scheduling`,
124
- `data_transformation`, `data_extraction`, `document_processing`,
125
- `form_input`, `content_generation`, `triage`, and
126
- `scraping_and_research`.
127
- 2. Use `nodes(action="search")` for service-specific nodes. Use short service
128
- names like "Gmail" or "Slack", not full task phrases like "send email SMTP".
129
- Search results include discriminators for nodes that need `resource`,
130
- `operation`, or `mode`.
131
- 3. Call `nodes(action="type-definition")` with the exact node IDs you will use.
132
- Include discriminators from search results. Fetch up to five definitions in
133
- one call. Do not speculatively fetch definitions for nodes you will not use.
134
- 4. Read `@builderHint`, `@default`, `@searchListMethod`, `@loadOptionsMethod`,
115
+ 1. Research only what the request actually needs. If the workflow fits a
116
+ known category and you are unsure which nodes to use, call
117
+ `nodes(action="suggested")` (categories: `notification`,
118
+ `data_persistence`, `chatbot`, `scheduling`, `data_transformation`,
119
+ `data_extraction`, `document_processing`, `form_input`,
120
+ `content_generation`, `triage`, `scraping_and_research`); use
121
+ `nodes(action="search")` for service-specific nodes you cannot name exactly
122
+ (short service names like "Gmail", not task phrases results include
123
+ resource/operation/mode discriminators).
124
+ 2. Call `nodes(action="type-definition")` with the exact node IDs you will use
125
+ (up to five per call), including discriminators. Do not speculatively fetch
126
+ definitions for nodes you will not use.
127
+ 3. Read `@builderHint`, `@default`, `@searchListMethod`, `@loadOptionsMethod`,
135
128
  valid enum values, credential types, and display conditions in the returned
136
129
  definitions.
137
- 5. Resolve real resource IDs. For each parameter with `searchListMethod` or
130
+ 4. Resolve real resource IDs: for each parameter with `searchListMethod` or
138
131
  `loadOptionsMethod`, call `nodes(action="explore-resources")` with the exact
139
- method name, method type, credential type, and credential ID. This is
140
- mandatory for calendars, spreadsheets, channels, folders, databases, models,
141
- and any other list-backed parameter when a credential is available.
142
- 6. Pick a stable workspace `filePath` for the source file, typically
132
+ method name, method type, credential type, and credential ID mandatory
133
+ for calendars, spreadsheets, channels, folders, databases, models, and any
134
+ other list-backed parameter when a credential is available.
135
+ 5. Pick a stable workspace `filePath` for the source file, typically
143
136
  `src/workflows/main.workflow.ts` for a one-off new workflow, or a clearly
144
137
  named `.workflow.ts` file when multiple source files are useful. For an
145
138
  existing workflow with no source file in context, call
146
- `workflows(action="get-as-code", workflowId)`, write the returned code to the
147
- chosen `.workflow.ts` file, and pass the n8n `workflowId` only on the first
139
+ `workflows(action="get-as-code", workflowId)`, apply your edit to the
140
+ returned code, and pass the n8n `workflowId` only on the first
148
141
  `build-workflow` call.
149
- 7. Write complete TypeScript SDK code to the workspace `filePath`, or read and
150
- selectively edit the existing `.workflow.ts` file for workflow changes. Do
151
- not put secrets in the source file.
142
+ 6. Produce complete TypeScript SDK code. For a new or fully rewritten source
143
+ file, do NOT write it with `workspace_write_file` pass it directly as
144
+ `sourceCode` on the `build-workflow` call (the tool writes `filePath` and
145
+ builds in one step; a separate write call wastes a full round-trip). Use
146
+ file tools only to selectively edit an existing `.workflow.ts` for
147
+ follow-up changes and repairs. Do not put secrets in the source file.
152
148
  Before building, decide whether verification needs branch fixtures. When a
153
149
  live or nondeterministic upstream node (such as HTTP Request, search/list
154
150
  lookups, weather feeds, or AI classifiers) feeds IF/Switch logic and
@@ -157,11 +153,12 @@ When mapping downstream fields from an OpenAI node, read
157
153
  and later `fixtureOverrides` can exercise those scenarios. Do not simulate
158
154
  every external read by default; use this when branch coverage or deterministic
159
155
  proof depends on controlling the upstream data.
160
- 8. Call `build-workflow` with `filePath`.
156
+ 7. Call `build-workflow` with `filePath` (plus `sourceCode` for new or fully
157
+ rewritten source).
161
158
  For planned build follow-ups where `buildTask.isSupportingWorkflow === true`,
162
159
  pass `isSupportingWorkflow: true`; that saved supporting workflow is the
163
160
  task's final deliverable.
164
- 9. Trace wiring before declaring done. For IF, Switch, Merge, AI-agent, loop, or
161
+ 8. Trace wiring before declaring done. For IF, Switch, Merge, AI-agent, loop, or
165
162
  multi-workflow wiring, trace each branch from source to target. Confirm IF
166
163
  branches are wired on the workflow builder (`.to(ifNode).onTrue(...).onFalse(...)`
167
164
  or `.to(ifNode.onTrue(...).onFalse(...))`), not as standalone calls on the IF
@@ -171,15 +168,15 @@ When mapping downstream fields from an OpenAI node, read
171
168
  every requested side effect is on a wired branch. Switch outputs use zero-based
172
169
  `.onCase(index, target)`, Merge modes match the data shape, and sub-nodes are
173
170
  attached to the correct parent.
174
- 10. Fix errors by editing the same workspace source file and calling
171
+ 9. Fix errors by editing the same workspace source file and calling
175
172
  `build-workflow` again with the same `filePath`. Save again before any
176
173
  verification step.
177
- 11. Modify existing workflows by editing the workspace `.workflow.ts` source
174
+ 10. Modify existing workflows by editing the workspace `.workflow.ts` source
178
175
  file. If the file was created from `workflows(action="get-as-code")`, pass
179
176
  the real n8n `workflowId` on the first `build-workflow` call so the file is
180
177
  bound to the saved workflow. Never pass local SDK workflow IDs as n8n
181
178
  workflow IDs.
182
- 12. After a successful direct `build-workflow` result, if the tool output
179
+ 11. After a successful direct `build-workflow` result, if the tool output
183
180
  contains `postBuildFlow.required: true`, follow the inlined
184
181
  `postBuildFlow.instructions` from that output (do not load `post-build-flow`
185
182
  separately) before verification, setup, error-workflow follow-up,
@@ -205,20 +202,18 @@ Use the current turn's higher-priority instructions to decide who verifies:
205
202
  successful `build-workflow`. The checkpoint task owns verification.
206
203
 
207
204
  Build/save success is not workflow-quality evidence. When this turn is
208
- responsible for verification or repair, inspect the persisted workflow with
209
- `workflows(action="get-as-code", workflowId)` or read the bound workspace
210
- source file after saving or before reporting a verdict. Judge the saved graph
211
- against the user's requested outcome and the current build/checkpoint goal, not
212
- a hidden service-specific or topology checklist.
213
- If the saved workflow is only a draft, misses the intended outcome, or has weak
214
- evidence, edit the same workflow source file and call `build-workflow` with the
215
- same `filePath`, then inspect and verify again.
216
-
217
- Do not tell the user a workflow is fixed, verified, tested, or working from a
218
- successful build, save, or static `validate` alone only from a
219
- `verify-built-workflow` or `executions` run that exercised the failing path, or
220
- state explicitly that you could not verify and why. Never dismiss a live
221
- execution error as a harness or stale-state artifact without re-running.
205
+ responsible for verification or repair, inspect the persisted workflow
206
+ (`workflows(action="get-as-code", workflowId)` or the bound workspace source
207
+ file) before reporting a verdict, judging the saved graph against the user's
208
+ requested outcome not a hidden service-specific checklist. If it is a
209
+ draft, misses the outcome, or the evidence is weak, edit the same source file,
210
+ rebuild with the same `filePath`, then inspect and verify again.
211
+
212
+ Never tell the user a workflow is fixed, verified, tested, or working from a
213
+ build/save or static `validate` alone — only from a `verify-built-workflow`
214
+ or `executions` run that exercised the claimed path; otherwise say explicitly
215
+ what you could not verify and why. Never dismiss a live execution error as a
216
+ harness or stale-state artifact without re-running.
222
217
 
223
218
  When this turn is responsible for verification, do not stop after a successful
224
219
  save. The job is done when one of these is true:
@@ -237,17 +232,11 @@ If live connectivity also matters for a branch-controlled workflow, verify the
237
232
  fixture-backed branch coverage first and run a separate live smoke check, or
238
233
  state exactly which branch remains unverified.
239
234
 
240
- Trigger input shapes:
241
-
242
- - Manual or Schedule: use `verify-built-workflow` when appropriate. Schedule
243
- usually needs no `inputData`.
244
- - Form Trigger: pass a flat field map, for example
245
- `{ "name": "Alice", "email": "a@b.c" }`. Do not wrap in `formFields`.
246
- - Webhook: pass the body payload. The adapter wraps it under `body`; downstream
247
- expressions should use `$json.body.<field>`.
248
- - Chat Trigger: pass `{ "chatInput": "user message" }`.
249
- - Other event triggers such as Linear, GitHub, Slack, or MCP: pass `inputData`
250
- matching the trigger's expected payload shape.
235
+ Trigger `inputData` shapes: follow the per-trigger guidance on the
236
+ `verify-built-workflow` tool's `inputData` field (flat field map for Form —
237
+ never `formFields`; body payload for Webhook expressions read
238
+ `$json.body.<field>`; `{ "chatInput": ... }` for Chat; omit for Schedule;
239
+ trigger-shaped payloads for other event triggers).
251
240
 
252
241
  If verification returns remediation with `shouldEdit: false`, stop editing and
253
242
  follow its guidance. If verification fails with `shouldEdit: true`, make one
@@ -261,27 +250,22 @@ decision after testing.
261
250
  ## Credential Rules
262
251
 
263
252
  - Call `credentials(action="list")` early when the task touches external
264
- services. Note each credential's `id`, `name`, and `type`.
253
+ services; note each credential's `id`, `name`, and `type` (the credential
254
+ key, e.g. `slackApi`, comes from the node type definition).
265
255
  - Use `newCredential('Credential Name', 'credential-id')` only when the user
266
- selected a specific existing credential, there is exactly one unambiguous
267
- matching credential, or the workflow already had that credential.
268
- - If no exact credential was selected, more than one credential matches, or the
269
- service needs a new credential, use `newCredential('Suggested Credential
270
- Name')`. Build tools mock unresolved credentials for verification, and setup
271
- collects real credentials later.
272
- - Never use raw credential objects like `{ id: '...', name: '...' }` in builder
273
- SDK code. When editing roundtripped code that contains raw credential objects,
274
- replace them with `newCredential()` calls.
275
- - The credential key, such as `slackApi`, is the credential type from the node
276
- type definition.
256
+ selected a specific credential, exactly one unambiguous match exists, or the
257
+ workflow already had it. Otherwise use `newCredential('Suggested Credential
258
+ Name')` build tools mock unresolved credentials for verification and setup
259
+ collects real ones later.
260
+ - Never use raw credential objects like `{ id: '...', name: '...' }` in SDK
261
+ code; replace them with `newCredential()` when editing roundtripped code.
277
262
  - If a required credential type is not listed, call
278
263
  `credentials(action="search-types")` with the service name. Prefer dedicated
279
- credential types over generic auth. When generic auth is truly needed, prefer
280
- `httpBearerAuth` over `httpHeaderAuth`.
281
- - Credential-selection guidance applies to outbound service calls. For inbound
282
- trigger nodes such as Webhook, Form Trigger, Chat Trigger, and MCP Trigger,
283
- keep authentication at its default `none` unless the user explicitly asks to
284
- authenticate inbound traffic.
264
+ credential types over generic auth; when generic auth is truly needed,
265
+ prefer `httpBearerAuth` over `httpHeaderAuth`.
266
+ - These rules apply to outbound service calls. Inbound trigger nodes (Webhook,
267
+ Form, Chat, MCP Trigger) keep authentication at its default `none` unless
268
+ the user explicitly asks to authenticate inbound traffic.
285
269
  - Always declare `output` on nodes that use unresolved credentials when mock
286
270
  data is needed for verification.
287
271
 
@@ -301,80 +285,22 @@ resource:
301
285
  For resources that cannot be created via n8n, explain clearly what the user
302
286
  needs to create manually and what ID or value belongs in setup.
303
287
 
304
- If part of the requested workflow is infeasible (no node or API for it, a source
305
- that blocks automated access, an action that cannot be performed
306
- programmatically, or a third-party API whose region/use-case coverage you have
307
- not verified), do not quietly substitute a stand-in and present it as the
308
- requested capability. Flag the substitution as an approximation that may not
309
- work — and any unverified region/country support — and name that gap in the
310
- one-line completion summary so the result is not mistaken for the original ask.
288
+ If part of the requested workflow is infeasible, apply the Capability Honesty
289
+ rules: never quietly substitute a stand-in as the requested capability — flag
290
+ it as an approximation (including unverified region/use-case coverage) and
291
+ name the gap in the one-line completion summary.
311
292
 
312
293
  ## Compositional Workflows
313
294
 
314
- For complex workflows, you may decompose work into supporting sub-workflows and
315
- a main workflow. This is part of an approved build task, not a reason to call
316
- `delegate` or create a new plan.
317
-
318
- Use this pattern when a workflow is large, has reusable chunks, or benefits from
319
- independent testing. Simple workflows should stay in one workflow.
320
-
321
- 1. Write a source file for each supporting workflow, then build it with
322
- `build-workflow` and `isSupportingWorkflow: true`.
323
- 2. Give each supporting workflow an `executeWorkflowTrigger` (version 1.1) with
324
- an explicit input schema.
325
- 3. Use the returned supporting `workflowId` in the main workflow's
326
- `executeWorkflow` node with `source: 'database'`.
327
- 4. Create or edit the main workflow source file last, then save it with
328
- `build-workflow` and without `isSupportingWorkflow`; this is the build task's
329
- final deliverable outcome.
330
- 5. Do not publish the main workflow automatically. Supporting workflows may be
331
- published when the parent workflow needs them active for verification or
332
- runtime references, but only after their setup requirements are resolved.
333
-
334
- Example supporting workflow trigger:
335
-
336
- ```ts
337
- const inputTrigger = trigger({
338
- type: 'n8n-nodes-base.executeWorkflowTrigger',
339
- version: 1.1,
340
- config: {
341
- parameters: {
342
- inputSource: 'workflowInputs',
343
- workflowInputs: {
344
- values: [
345
- { name: 'city', type: 'string' },
346
- { name: 'units', type: 'string' },
347
- ],
348
- },
349
- },
350
- },
351
- });
352
- ```
353
-
354
- Example main-workflow reference:
355
-
356
- ```ts
357
- const getWeather = node({
358
- type: 'n8n-nodes-base.executeWorkflow',
359
- version: 1.2,
360
- config: {
361
- name: 'Get Weather Data',
362
- parameters: {
363
- source: 'database',
364
- workflowId: { __rl: true, mode: 'id', value: 'SUPPORTING_WORKFLOW_ID' },
365
- mode: 'once',
366
- workflowInputs: {
367
- mappingMode: 'defineBelow',
368
- value: { city: expr('{{ $json.city }}'), units: 'metric' },
369
- },
370
- },
371
- },
372
- });
373
- ```
374
-
375
- Replace `SUPPORTING_WORKFLOW_ID` with the real ID returned by the supporting
376
- `build-workflow` call. If a supporting workflow uses mocked credentials or
377
- placeholders, route setup before publishing or relying on it.
295
+ Only for large workflows with reusable chunks or independently testable parts:
296
+ decompose into supporting sub-workflows (`executeWorkflowTrigger` v1.1 with an
297
+ explicit input schema, built with `isSupportingWorkflow: true`) referenced from
298
+ the main workflow's `executeWorkflow` node (`source: 'database'`, real returned
299
+ `workflowId`), main workflow saved last. This is part of the approved build
300
+ task not a reason to call `delegate` or create a new plan, and simple
301
+ workflows stay in one workflow. Before writing multi-workflow code, load this
302
+ skill's `references/compositional-workflows.md` linked file for the required
303
+ steps and SDK examples.
378
304
 
379
305
  ## Data Tables
380
306
 
@@ -387,6 +313,14 @@ guidance already loaded by the orchestrator when available. Create or inspect
387
313
  tables directly with `data-tables`; do not invent table IDs, table names, or
388
314
  column names.
389
315
 
316
+ When the ask is a summary, digest, or report over a period ("weekly summary of
317
+ what was recorded", "digest of this week's rows"), the summary branch must
318
+ read that period's rows back from where the workflow logs them (Data Table,
319
+ sheet, store) and build its content from those rows — reusing only the current
320
+ run's in-memory data produces a single-run report mislabeled as a period
321
+ summary. Drive the cadence from the schedule or a stored last-sent timestamp,
322
+ never from `$now.weekday == N`, which silently no-ops on other days.
323
+
390
324
  ## SDK Code Rules
391
325
 
392
326
  - SDK builder code is a restricted subset of TypeScript that builds a static
@@ -420,16 +354,17 @@ column names.
420
354
  placeholders in `expr()`, objects, or arrays unless the node definition
421
355
  explicitly expects an object and the placeholder is the direct value of one
422
356
  field.
423
- - For unresolved resource-locator fields (values shaped like `{ __rl: true,
424
- mode, value }`, such as Slack channel or Google Sheets document selectors),
425
- use the resource-locator object shape instead of a raw `placeholder()`
426
- string. Prefer the locator's picker (`list`) mode when it offers one, since
427
- it gives the user a searchable picker at setup, with an empty value and a
428
- `cachedResultName` hint, for example `{ __rl: true, mode: 'list', value: '',
429
- cachedResultName: 'Select support channel to monitor' }`. Not every locator
430
- has a `list` mode; when it doesn't, use a `name`/`url` mode with the known
431
- value, or `id` mode only when you have a concrete ID. Never use `id` with an
432
- empty or placeholder value.
357
+ - For unresolved resource-locator fields (`{ __rl: true, mode, value }` —
358
+ Slack channel / Sheets document selectors), use the locator object, never a
359
+ raw `placeholder()` string. When the user names the resource
360
+ (`#team-updates`, a sheet title) or you assumed a name (`Sheet1`), use `name`
361
+ mode with that exact value never leave the locator empty when a name is
362
+ known. Only when nothing is known, use `list` mode empty with a
363
+ `cachedResultName` hint (`{ __rl: true, mode: 'list', value: '',
364
+ cachedResultName: 'Select support channel to monitor' }`) a `list` value is
365
+ an opaque picked ID; never put a human-readable name there. Without a `list`
366
+ mode, use `name`/`url` with the known value, or `id` only with a concrete ID
367
+ (never empty or placeholder).
433
368
  - For single-execution nodes that receive many items but should run once, set
434
369
  `executeOnce: true`.
435
370
  - Whenever a node declares mock `output` for verification, include every field
@@ -442,6 +377,14 @@ column names.
442
377
  single-item assumptions like `$input.first()` break during verification
443
378
  instead of on the user's first run. A single-item mock hides array-vs-single
444
379
  bugs.
380
+ - Match the real payload SHAPE in webhook trigger mocks. When a third-party
381
+ platform calls the webhook (voice agents, payment providers, messaging
382
+ platforms), that platform's documented envelope fixes the shape — mock it
383
+ faithfully instead of inventing a flattened body. Tool-call style webhooks
384
+ from AI/voice platforms nest arguments in an OpenAI-compatible envelope
385
+ (`body.message.toolCalls[0].function.arguments`), not at the body root and
386
+ not under `call.arguments`. Coding against an invented flat mock
387
+ self-verifies green, then every field parses empty on the first real call.
445
388
  - SDK node `output` mocks are raw `$json` objects. Do not wrap mock items in
446
389
  n8n runtime item envelopes like `{ json: { ... } }` unless downstream
447
390
  expressions intentionally read `$json.json.*`. Correct:
@@ -509,25 +452,31 @@ Follow these rules strictly when generating workflows:
509
452
  set `alwaysOutputData: true` on every node that can emit zero items before
510
453
  the effect — often both the HTTP fetch (empty `[]`) and the filter (all rows
511
454
  dropped). Not on the formatter or notifier; consumers that receive zero
512
- items never run.
455
+ items never run. `alwaysOutputData` delivers an empty result as one item
456
+ with empty json (`{}`), not zero items — a downstream formatter or Code
457
+ node must treat empty-json items as zero rows (e.g. `const rows =
458
+ $input.all().filter(i => Object.keys(i.json).length > 0)`) before counting
459
+ or listing them.
513
460
  - A Filter or IF only selects items; it does not perform the requested side
514
461
  effect. If the user asks to archive, update, delete, send, or create only
515
462
  matching items, wire the corresponding action node on the matching path.
516
463
  5. Input and output indices are zero-based. `.input(0)` and `.output(0)` are the
517
464
  first input and output. `.input(1)` is the second input, not the first.
465
+ 6. When Code nodes score, classify, or gate on free-text human fields
466
+ (amounts, timeframes, priorities, intent), normalize before comparing —
467
+ humans write "≈ $12,500", "1.5k", "in three weeks", "ASAP". Strip currency
468
+ symbols/separators before parsing numbers, take the lower bound of ranges,
469
+ match time units broadly (day/days, week/weeks…), and give every classifier
470
+ an explicit fallback bucket — a one-phrasing regex silently misroutes every
471
+ other phrasing.
518
472
 
519
473
  ## Tool Naming Rules
520
474
 
521
- - Name tools by the action they perform, not by repeating the integration or
522
- tool family name.
523
- - Always set an explicit `config.name` on every `tool(...)` node. Do not rely on
524
- auto-generated names for tools.
525
- - Do not prefix a tool name with the service name when the tool already belongs
526
- to that service.
527
- - Prefer concise snake_case action names like `get_email`, `add_labels`, or
528
- `mark_as_read`.
529
- - Avoid redundant names like `gmail_get_email`, `slack_send_message`, or
530
- `notion_create_page` unless the user explicitly asked for that exact name.
475
+ Always set an explicit `config.name` on every `tool(...)` node concise
476
+ snake_case action names (`get_email`, `add_labels`, `mark_as_read`) describing
477
+ what the tool does. Never prefix with the service/family name
478
+ (`gmail_get_email`, `slack_send_message` are wrong) unless the user explicitly
479
+ asked for that exact name.
531
480
 
532
481
  ## Node Configuration Safety Rules
533
482
 
@@ -0,0 +1,66 @@
1
+ # Compositional Workflows
2
+
3
+ For complex workflows, you may decompose work into supporting sub-workflows and
4
+ a main workflow. This is part of an approved build task, not a reason to call
5
+ `delegate` or create a new plan.
6
+
7
+ Use this pattern when a workflow is large, has reusable chunks, or benefits from
8
+ independent testing. Simple workflows should stay in one workflow.
9
+
10
+ 1. Write a source file for each supporting workflow, then build it with
11
+ `build-workflow` and `isSupportingWorkflow: true`.
12
+ 2. Give each supporting workflow an `executeWorkflowTrigger` (version 1.1) with
13
+ an explicit input schema.
14
+ 3. Use the returned supporting `workflowId` in the main workflow's
15
+ `executeWorkflow` node with `source: 'database'`.
16
+ 4. Create or edit the main workflow source file last, then save it with
17
+ `build-workflow` and without `isSupportingWorkflow`; this is the build task's
18
+ final deliverable outcome.
19
+ 5. Do not publish the main workflow automatically. Supporting workflows may be
20
+ published when the parent workflow needs them active for verification or
21
+ runtime references, but only after their setup requirements are resolved.
22
+
23
+ Example supporting workflow trigger:
24
+
25
+ ```ts
26
+ const inputTrigger = trigger({
27
+ type: 'n8n-nodes-base.executeWorkflowTrigger',
28
+ version: 1.1,
29
+ config: {
30
+ parameters: {
31
+ inputSource: 'workflowInputs',
32
+ workflowInputs: {
33
+ values: [
34
+ { name: 'city', type: 'string' },
35
+ { name: 'units', type: 'string' },
36
+ ],
37
+ },
38
+ },
39
+ },
40
+ });
41
+ ```
42
+
43
+ Example main-workflow reference:
44
+
45
+ ```ts
46
+ const getWeather = node({
47
+ type: 'n8n-nodes-base.executeWorkflow',
48
+ version: 1.2,
49
+ config: {
50
+ name: 'Get Weather Data',
51
+ parameters: {
52
+ source: 'database',
53
+ workflowId: { __rl: true, mode: 'id', value: 'SUPPORTING_WORKFLOW_ID' },
54
+ mode: 'once',
55
+ workflowInputs: {
56
+ mappingMode: 'defineBelow',
57
+ value: { city: expr('{{ $json.city }}'), units: 'metric' },
58
+ },
59
+ },
60
+ },
61
+ });
62
+ ```
63
+
64
+ Replace `SUPPORTING_WORKFLOW_ID` with the real ID returned by the supporting
65
+ `build-workflow` call. If a supporting workflow uses mocked credentials or
66
+ placeholders, route setup before publishing or relying on it.