@n8n/instance-ai 1.20.2 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/agent/aia-model-defaults.d.ts +3 -0
  2. package/dist/agent/aia-model-defaults.js +24 -0
  3. package/dist/agent/aia-model-defaults.js.map +1 -0
  4. package/dist/agent/apply-agent-thinking.js +35 -30
  5. package/dist/agent/apply-agent-thinking.js.map +1 -1
  6. package/dist/agent/instance-agent.js +36 -4
  7. package/dist/agent/instance-agent.js.map +1 -1
  8. package/dist/agent/model-config-identity.d.ts +3 -0
  9. package/dist/agent/model-config-identity.js +45 -0
  10. package/dist/agent/model-config-identity.js.map +1 -0
  11. package/dist/agent/sub-agent-debriefing.d.ts +5 -0
  12. package/dist/agent/system-prompt.d.ts +0 -1
  13. package/dist/agent/system-prompt.js +3 -14
  14. package/dist/agent/system-prompt.js.map +1 -1
  15. package/dist/build.tsbuildinfo +1 -1
  16. package/dist/errors/workflow-editor-locked.error.d.ts +6 -0
  17. package/dist/errors/workflow-editor-locked.error.js +20 -0
  18. package/dist/errors/workflow-editor-locked.error.js.map +1 -0
  19. package/dist/errors/workflow-not-found.error.d.ts +6 -0
  20. package/dist/errors/workflow-not-found.error.js +19 -0
  21. package/dist/errors/workflow-not-found.error.js.map +1 -0
  22. package/dist/index.d.ts +12 -4
  23. package/dist/index.js +16 -5
  24. package/dist/index.js.map +1 -1
  25. package/dist/mcp/connected-mcp-services.d.ts +2 -0
  26. package/dist/mcp/connected-mcp-services.js +20 -0
  27. package/dist/mcp/connected-mcp-services.js.map +1 -0
  28. package/dist/parsers/index.d.ts +2 -2
  29. package/dist/parsers/index.js +6 -1
  30. package/dist/parsers/index.js.map +1 -1
  31. package/dist/parsers/validate-attachments.d.ts +21 -0
  32. package/dist/parsers/validate-attachments.js +52 -1
  33. package/dist/parsers/validate-attachments.js.map +1 -1
  34. package/dist/runtime/run-state-registry.d.ts +3 -0
  35. package/dist/runtime/run-state-registry.js.map +1 -1
  36. package/dist/runtime/terminal-response-guard.js +3 -1
  37. package/dist/runtime/terminal-response-guard.js.map +1 -1
  38. package/dist/storage/workflow-loop-storage.d.ts +29 -0
  39. package/dist/stream/map-chunk.js +2 -0
  40. package/dist/stream/map-chunk.js.map +1 -1
  41. package/dist/stream/work-summary-accumulator.d.ts +8 -0
  42. package/dist/stream/work-summary-accumulator.js +13 -0
  43. package/dist/stream/work-summary-accumulator.js.map +1 -1
  44. package/dist/tools/credentials.tool.js +21 -8
  45. package/dist/tools/credentials.tool.js.map +1 -1
  46. package/dist/tools/data-tables.tool.js +1 -4
  47. package/dist/tools/data-tables.tool.js.map +1 -1
  48. package/dist/tools/evals/eval-config.tool.js +1 -3
  49. package/dist/tools/evals/eval-config.tool.js.map +1 -1
  50. package/dist/tools/evals/evals.tool.js +2 -3
  51. package/dist/tools/evals/evals.tool.js.map +1 -1
  52. package/dist/tools/executions.tool.js +11 -4
  53. package/dist/tools/executions.tool.js.map +1 -1
  54. package/dist/tools/filesystem/create-tools-from-mcp-server.d.ts +11 -1
  55. package/dist/tools/filesystem/create-tools-from-mcp-server.js +48 -9
  56. package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
  57. package/dist/tools/mcp-servers.tool.js +164 -26
  58. package/dist/tools/mcp-servers.tool.js.map +1 -1
  59. package/dist/tools/nodes/preferred-chat-model.d.ts +10 -0
  60. package/dist/tools/nodes/preferred-chat-model.js +49 -0
  61. package/dist/tools/nodes/preferred-chat-model.js.map +1 -1
  62. package/dist/tools/nodes.tool.js +2 -4
  63. package/dist/tools/nodes.tool.js.map +1 -1
  64. package/dist/tools/orchestration/build-agent.tool.js +1 -1
  65. package/dist/tools/orchestration/build-agent.tool.js.map +1 -1
  66. package/dist/tools/orchestration/complete-checkpoint.tool.js +41 -7
  67. package/dist/tools/orchestration/complete-checkpoint.tool.js.map +1 -1
  68. package/dist/tools/orchestration/plan.tool.d.ts +4 -0
  69. package/dist/tools/orchestration/plan.tool.js +1 -3
  70. package/dist/tools/orchestration/plan.tool.js.map +1 -1
  71. package/dist/tools/workflows/build-workflow.tool.d.ts +3 -0
  72. package/dist/tools/workflows/build-workflow.tool.js +133 -49
  73. package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
  74. package/dist/tools/workflows/credential-utils.d.ts +2 -1
  75. package/dist/tools/workflows/credential-utils.js +1 -11
  76. package/dist/tools/workflows/credential-utils.js.map +1 -1
  77. package/dist/tools/workflows/observed-workflow-checksums.d.ts +4 -0
  78. package/dist/tools/workflows/observed-workflow-checksums.js +82 -0
  79. package/dist/tools/workflows/observed-workflow-checksums.js.map +1 -0
  80. package/dist/tools/workflows/resolve-credentials.js +29 -5
  81. package/dist/tools/workflows/resolve-credentials.js.map +1 -1
  82. package/dist/tools/workflows/setup-skip-state.d.ts +28 -0
  83. package/dist/tools/workflows/setup-skip-state.js +97 -0
  84. package/dist/tools/workflows/setup-skip-state.js.map +1 -0
  85. package/dist/tools/workflows/setup-workflow.schema.d.ts +8 -0
  86. package/dist/tools/workflows/setup-workflow.schema.js +1 -0
  87. package/dist/tools/workflows/setup-workflow.schema.js.map +1 -1
  88. package/dist/tools/workflows/setup-workflow.service.js +7 -7
  89. package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
  90. package/dist/tools/workflows/summarize-workflow.js +1 -1
  91. package/dist/tools/workflows/summarize-workflow.js.map +1 -1
  92. package/dist/tools/workflows/workflow-build-remediation.d.ts +2 -0
  93. package/dist/tools/workflows/workflow-build-remediation.js +29 -7
  94. package/dist/tools/workflows/workflow-build-remediation.js.map +1 -1
  95. package/dist/tools/workflows/workflow-build-routing.d.ts +1 -0
  96. package/dist/tools/workflows/workflow-build-routing.js +14 -3
  97. package/dist/tools/workflows/workflow-build-routing.js.map +1 -1
  98. package/dist/tools/workflows/workflow-file-bindings.js +2 -0
  99. package/dist/tools/workflows/workflow-file-bindings.js.map +1 -1
  100. package/dist/tools/workflows/workflow-json-utils.d.ts +3 -0
  101. package/dist/tools/workflows/workflow-json-utils.js +107 -0
  102. package/dist/tools/workflows/workflow-json-utils.js.map +1 -1
  103. package/dist/tools/workflows/workflow-node-diff.d.ts +4 -0
  104. package/dist/tools/workflows/workflow-node-diff.js +125 -0
  105. package/dist/tools/workflows/workflow-node-diff.js.map +1 -0
  106. package/dist/tools/workflows.tool.js +147 -12
  107. package/dist/tools/workflows.tool.js.map +1 -1
  108. package/dist/tools/workspace.tool.js +1 -3
  109. package/dist/tools/workspace.tool.js.map +1 -1
  110. package/dist/types.d.ts +27 -9
  111. package/dist/types.js.map +1 -1
  112. package/dist/utils/custom-model-defaults.d.ts +15 -0
  113. package/dist/utils/custom-model-defaults.js +81 -0
  114. package/dist/utils/custom-model-defaults.js.map +1 -0
  115. package/dist/utils/eval-agents.d.ts +1 -0
  116. package/dist/utils/eval-agents.js +34 -6
  117. package/dist/utils/eval-agents.js.map +1 -1
  118. package/dist/utils/modal-session.d.ts +11 -0
  119. package/dist/utils/modal-session.js +52 -0
  120. package/dist/utils/modal-session.js.map +1 -0
  121. package/dist/utils/parse-model-headers.d.ts +1 -0
  122. package/dist/utils/parse-model-headers.js +28 -0
  123. package/dist/utils/parse-model-headers.js.map +1 -0
  124. package/dist/workflow-loop/guidance.js +6 -0
  125. package/dist/workflow-loop/guidance.js.map +1 -1
  126. package/dist/workflow-loop/verification-obligation.js +9 -0
  127. package/dist/workflow-loop/verification-obligation.js.map +1 -1
  128. package/dist/workflow-loop/workflow-loop-controller.js +6 -0
  129. package/dist/workflow-loop/workflow-loop-controller.js.map +1 -1
  130. package/dist/workflow-loop/workflow-loop-state.d.ts +39 -0
  131. package/dist/workflow-loop/workflow-loop-state.js +9 -1
  132. package/dist/workflow-loop/workflow-loop-state.js.map +1 -1
  133. package/dist/workspace/lazy-runtime-workspace.d.ts +0 -1
  134. package/dist/workspace/lazy-runtime-workspace.js +2 -17
  135. package/dist/workspace/lazy-runtime-workspace.js.map +1 -1
  136. package/dist/workspace/pack-workspace-sdk.d.ts +1 -1
  137. package/dist/workspace/pack-workspace-sdk.js +16 -4
  138. package/dist/workspace/pack-workspace-sdk.js.map +1 -1
  139. package/dist/workspace/sandbox-setup.js +1 -1
  140. package/dist/workspace/sandbox-setup.js.map +1 -1
  141. package/knowledge-base/reference/workflow-builder-guardrails.md +20 -0
  142. package/package.json +19 -17
  143. package/skills/intent-recognition/SKILL.md +9 -1
  144. package/skills/one-off-operations/SKILL.md +108 -0
  145. package/skills/planned-task-runtime/SKILL.md +3 -2
  146. package/skills/post-build-flow/SKILL.md +98 -14
  147. package/skills/workflow-builder/SKILL.md +29 -2
  148. package/dist/tools/nodes/node-search-engine.d.ts +0 -21
  149. package/dist/tools/nodes/node-search-engine.js +0 -314
  150. package/dist/tools/nodes/node-search-engine.js.map +0 -1
  151. package/dist/tools/nodes/node-search-engine.types.d.ts +0 -50
  152. package/dist/tools/nodes/node-search-engine.types.js +0 -18
  153. package/dist/tools/nodes/node-search-engine.types.js.map +0 -1
  154. package/dist/workspace/scoped-workspace.d.ts +0 -2
  155. package/dist/workspace/scoped-workspace.js +0 -141
  156. package/dist/workspace/scoped-workspace.js.map +0 -1
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: one-off-operations
3
+ description: >-
4
+ Handles one-off operations: the request is a concrete effect that happens
5
+ once — export or copy data somewhere, a migration, a backfill, a cleanup —
6
+ with no trigger, schedule, or reuse intent. The workflow is the vehicle, not
7
+ the deliverable. Users rarely say "one-off"; infer it from the task's shape.
8
+ Load before building for such a request, or when a build-workflow result
9
+ contains postBuildFlow.reason "direct-one-off-build-succeeded". Do not load
10
+ for automations the user will run again — that is the normal build +
11
+ post-build-flow path.
12
+ recommended_tools:
13
+ - build-workflow
14
+ - workflows
15
+ - executions
16
+ - ask-user
17
+ - verify-built-workflow
18
+ ---
19
+
20
+ # One-Off Operations
21
+
22
+ Use this skill when the request is a **one-off operation**: a concrete effect
23
+ that needs to happen once, where a workflow is only the vehicle to make it
24
+ happen. Typical shapes: "put this data in a spreadsheet", "copy these rows to
25
+ X", "migrate/backfill/clean up Y".
26
+
27
+ These instructions are in English, but user-visible text you write while
28
+ following them stays in the user's conversation language.
29
+
30
+ ## Recognizing a one-off
31
+
32
+ Users rarely label a task "one-off" — **infer it from the task's shape**, not
33
+ from explicit phrasing. It is a one-off when the deliverable is a *state
34
+ change*, not an automation:
35
+
36
+ - The user asks for an effect on data that **already exists and is bounded** —
37
+ pasted into the chat, sitting in a named node, table, file, or sheet — rather
38
+ than data that will keep arriving over time.
39
+ - The request is imperative about the here-and-now ("add these rows", "export
40
+ what's in X", "clean out the duplicates"), with no trigger, schedule, or
41
+ event vocabulary — no "when", "every", "whenever", "daily", "each time".
42
+ - Nothing suggests the user wants to keep and rerun the workflow; the workflow
43
+ is never mentioned as the thing they want, only the outcome is.
44
+
45
+ Explicit markers ("just this once", "I won't need this again") confirm the
46
+ classification but are not required — most one-offs arrive without them.
47
+ Signals against: trigger/schedule vocabulary, "from now on", a named event
48
+ source, or any hint the user wants the automation itself. **When in doubt,
49
+ treat the request as reusable** and follow the normal build flow — a reusable
50
+ workflow that runs once is harmless; a one-off flow applied to an automation
51
+ skips verification the user would have wanted.
52
+
53
+ A one-off that touches external systems is still workflow-anchored (you cannot
54
+ write to external services directly) — the intent changes the *post-build
55
+ flow*, not the anchor.
56
+
57
+ ## The one-off flow
58
+
59
+ 1. **Build** the workflow with a **manual trigger** — always. A one-off is
60
+ never published, so an event trigger (webhook, form, schedule) would never
61
+ fire and only misleads. If the task genuinely needs an event source or a
62
+ future run time, it is not a one-off — reclassify it as a reusable
63
+ automation or a scheduled task and use the normal flow. Pass
64
+ `executionIntent: "one-off"` to `build-workflow`. This marks verification
65
+ as optional in the build outcome — no verification follow-up is scheduled,
66
+ and the completion criterion becomes a live run whose output you read back.
67
+ 2. **Setup** is unchanged: if the build outcome requires credential or value
68
+ setup, route it through `workflows(action="setup")` as usual. A one-off
69
+ still needs real credentials before it can run live.
70
+ 3. **Run live** with `executions(action="run")`. The run-approval card is the
71
+ user's consent gate — for a one-off, the live run IS what the user asked
72
+ for, so the usual "reserve live runs for explicit user requests" rule is
73
+ satisfied by the request itself. Do not run before setup is complete.
74
+ 4. **Read back before reporting.** After the run, inspect the actual output of
75
+ the effect nodes with `executions(action="get-node-output")` — the run
76
+ result data is truncated and not enough for quantitative claims. Check that
77
+ each write/effect node's input was the intended data (the rows you meant to
78
+ write), not an upstream node's API response. Report only numbers, columns,
79
+ and shapes you actually read. If the target system is cheap to read (e.g. a
80
+ read operation of the same node type), offer a read-back of the destination
81
+ as final confirmation.
82
+ 5. **Offer cleanup.** When the operation succeeded, ask whether to keep the
83
+ workflow for future reuse or delete it now that the job is done. Never
84
+ delete without asking. If the user keeps it, mention it stays unpublished
85
+ unless they say otherwise.
86
+
87
+ ## Optional pre-flight verification
88
+
89
+ `verify-built-workflow` is available but **not required and never the
90
+ completion criterion** for a one-off. Offer it before the live run only when
91
+ the wiring is complex (branching, merges, non-trivial transformations) or the
92
+ user is cautious about touching real data.
93
+
94
+ When you do run it, present results honestly:
95
+
96
+ - Say which nodes were **simulated** — external writes did not happen, and the
97
+ data flowing into simulated write nodes was NOT validated (their output is a
98
+ fabricated success fixture).
99
+ - Never call the workflow "verified", "tested", or "working" from a simulated
100
+ pass alone, and never let it substitute for the live run and read-back.
101
+
102
+ ## Claiming success
103
+
104
+ Do not make quantitative claims ("22 rows written", "columns matched") that
105
+ you did not read back from actual execution output or the target system. A
106
+ successful run status alone does not prove the *right data* was written — read
107
+ the effect node's real output first. If you could not read it back, say so
108
+ plainly and name what is unconfirmed.
@@ -135,8 +135,9 @@ succeeds and any verified workflow dependency outcome has
135
135
  `workflows(action="setup")` with that workflowId before `complete-checkpoint`;
136
136
  the inline setup card appears automatically in the AI Assistant panel, so do not
137
137
  tell the user to open the editor, use the canvas, or click a Setup button. If
138
- setup returns `deferred: true`, respect it and still complete the checkpoint
139
- with a result that says setup was deferred. Do not call
138
+ setup returns `deferred: true`, or reports `skippedByUser`, respect it and still
139
+ complete the checkpoint with a result that says setup was deferred never call
140
+ setup again for a credential the user skipped. Do not call
140
141
  `credentials(action="setup")` or `apply-workflow-credentials` for workflow
141
142
  setup. Then call `complete-checkpoint(taskId, status, result)` **exactly once**
142
143
  to report the outcome (`status: "succeeded"` on pass, `"failed"` on a verification
@@ -20,6 +20,11 @@ especially when the build result contains `postBuildFlow.required: true`, or whe
20
20
  the current message contains `<workflow-verification-follow-up>` or
21
21
  `<workflow-setup-required>`.
22
22
 
23
+ One-off builds (`postBuildFlow.reason: "direct-one-off-build-succeeded"`) hand
24
+ off to the `one-off-operations` skill instead — verification is optional there
25
+ and completion is a live run with read-back. If both sets of instructions are
26
+ in context for a one-off build, the one-off flow wins.
27
+
23
28
  These instructions are in English, but user-visible text you write while
24
29
  following them stays in the user's conversation language.
25
30
 
@@ -45,6 +50,9 @@ is to call `workflows(action="setup")` with the `workflowId` from the payload. D
45
50
  not verify, do not ask, do not write a message first — the inline setup card in
46
51
  the AI Assistant panel is the user-visible surface. If it returns `deferred:
47
52
  true`, respect the user's choice and do not retry with any other setup tool.
53
+ A result carrying `skippedByUser` names credentials the user already passed on:
54
+ never re-open setup for those, in this turn or any later one — see
55
+ [Credentials the user skipped](#credentials-the-user-skipped).
48
56
  After setup completes or is applied, follow
49
57
  [Mocked verification live-test follow-up](#mocked-verification-live-test-follow-up)
50
58
  if the payload or prior verification evidence says mocked credentials,
@@ -148,6 +156,35 @@ If the user defers setup instead, don't hand them manual field-by-field
148
156
  credential instructions for the n8n editor — tell them to reopen setup when
149
157
  they're ready: the card pre-fills everything except their key.
150
158
 
159
+ ### Credentials the user skipped
160
+
161
+ Skipping is remembered for the whole conversation. A setup result may carry
162
+ `skippedByUser` (nodes and credential types the user passed on), and a build
163
+ outcome may carry `setupRequirement.status === "not_required"` with
164
+ `reason: "skipped-by-user"`. In both cases the blocking setup card is off the
165
+ table for those credentials — including after later edits, rebuilds, and
166
+ `<workflow-setup-required>` steps. Asking again is the single most common
167
+ complaint about this flow.
168
+
169
+ Instead, in your normal message:
170
+
171
+ - name what stays unconfigured and what happens at runtime (e.g. "the Slack post
172
+ will fail until a channel is selected; the email still sends"),
173
+ - offer to set it up whenever they want.
174
+
175
+ Only once the user asks for a specific credential — "connect Slack now", "let's
176
+ do the Slack setup", or picking it out of an offer you made — call
177
+ `workflows(action="setup", reopenSkipped: ["slackApi"])`, naming just what they
178
+ asked for so the rest stays skipped. A generic "yes" to an unrelated question is
179
+ not an ask.
180
+
181
+ Pass the `reopenWith` value the tool reported for that card, not the user's
182
+ wording — a credential type for a credential card, a node name for one that was
183
+ only missing a parameter. If nothing matches, setup answers with
184
+ `unknown_reopen_target` and the list you can choose from; pick from it or tell
185
+ the user what they named isn't part of this workflow. Don't fall back to
186
+ re-offering, the user already asked.
187
+
151
188
  ## Publishing and testing
152
189
 
153
190
  **Publishing is never required for testing.** Both `executions(action="run")` and
@@ -156,6 +193,23 @@ workflow does not need to be active. Form, webhook, chat, and other event-based
156
193
  triggers are all testable while the workflow is unpublished. Never publish a
157
194
  workflow as a precondition for running it.
158
195
 
196
+ Do not proactively offer, recommend, or mention publishing until a successful
197
+ execution has run every required node on the claimed path without mocked
198
+ credentials, simulated node output, fixture overrides, or temporary pin data
199
+ for those nodes. A successful verification that used any of these is not
200
+ publish-readiness evidence. If the user explicitly asks to publish before a
201
+ live execution succeeds, warn that the live path remains untested, then follow
202
+ the requested publish flow.
203
+
204
+ Execution evidence can come from a run you started or a run the user started.
205
+ If the user says they ran the workflow manually, call
206
+ `executions(action="list", workflowId)`, identify the relevant run, and inspect
207
+ it with `executions(action="get", executionId)`. The user's statement alone is
208
+ not execution evidence. A user-run execution satisfies the publishing gate only
209
+ when the inspected result confirms success and that every required node on the
210
+ claimed path ran. Do not count it if mocked, simulated, fixture, or pinned output
211
+ was used. You may offer publishing after that confirmation.
212
+
159
213
  For workflows produced by `build-workflow`, **always verify with
160
214
  `verify-built-workflow`, never with raw `executions(action="run")`.** It reuses
161
215
  the build outcome simulation plan, mocked credentials, and temporary pin data, so
@@ -181,6 +235,19 @@ have the source file, load `workflow-builder`, declare representative `output`
181
235
  fixtures on the controlling upstream node, rebuild the same workflow, and verify
182
236
  again.
183
237
 
238
+ **Never edit a saved workflow to reach a branch.** Disabling or deleting nodes to
239
+ steer a test mutates the user's workflow and leaves it broken for as long as the
240
+ test runs — if it is published, its triggers fire against the broken version.
241
+ For a workflow with more than one trigger (`triggerNodes` has multiple entries):
242
+
243
+ - When the user asked for a live run, pass `triggerNodeName` to
244
+ `executions(action="run")` — one run per trigger — and report each branch's
245
+ result. Naming no trigger runs only the auto-detected one.
246
+ - `verify-built-workflow` always exercises the auto-detected trigger, so it
247
+ covers one branch. Say which trigger was verified and which branches were not,
248
+ and offer the user a live run for the rest. Do not force coverage by editing
249
+ the workflow.
250
+
184
251
  ## After build-workflow succeeds
185
252
 
186
253
  1. Read `workflowId`, `workItemId`, `triggerNodes`, `verificationReadiness`,
@@ -236,19 +303,24 @@ again.
236
303
  4. When `workflows(action="setup")` opens the inline setup card, the card is the
237
304
  user-visible surface. Do not tell the user to open the editor, use the canvas,
238
305
  or click a Setup button; the user does not need to navigate anywhere.
239
- 5. When `workflows(action="setup")` returns `deferred: true`, respect the user's
240
- decision do not retry with `credentials(action="setup")` or any other
241
- setup tool. The user chose to set things up later.
306
+ 5. When `workflows(action="setup")` returns `deferred: true`, or reports
307
+ `skippedByUser`, or applies only part of the card, respect the user's
308
+ decision do not retry with `credentials(action="setup")`, another
309
+ `workflows(action="setup")` call, or any other setup tool. `partial: true`
310
+ with `nodesStillNeedingSetup` is not permission to re-open the card in the
311
+ same turn: report what remains as described in
312
+ [Credentials the user skipped](#credentials-the-user-skipped).
242
313
  6. After setup completes or is applied, follow
243
314
  [Mocked verification live-test follow-up](#mocked-verification-live-test-follow-up)
244
315
  when the latest verification evidence used mocks or simulations. If this
245
- follow-up is due, ask only that question now; do not also ask about the error
246
- workflow in the same response.
316
+ follow-up is due, ask only whether the user wants the live test. Do not
317
+ mention publishing or ask about the error workflow in the same response.
247
318
  7. If testing has not already been offered or completed, ask whether the user
248
319
  wants to test the workflow. Skip this if `verify-built-workflow` already
249
320
  proved it works end-to-end with full coverage.
250
321
  8. Only call `workflows(action="publish")` when the user explicitly asks to
251
- publish. Never publish automatically.
322
+ publish. Never publish automatically or proactively offer publishing before
323
+ the publish-readiness requirement above is met.
252
324
  9. After a direct new primary workflow is successfully published, follow
253
325
  [Error workflow follow-up](#error-workflow-follow-up).
254
326
  Do not replace this explicit opt-in with a generic "add
@@ -314,21 +386,33 @@ If the user says yes:
314
386
  After workflow setup completes or is applied, if the latest verification for
315
387
  that workflow used mocked credentials, simulated node output, fixture overrides,
316
388
  temporary pin data, or another mocked input, ask whether the user wants a live
317
- test without mocks. Do not run the live test automatically.
389
+ test without mocks. Ask only about the live test. Do not run it automatically.
390
+ Do not offer publishing as an alternative or describe the workflow as ready to
391
+ use or publish.
318
392
 
319
393
  If the user agrees, use the explicit live execution path (`executions(action="run")`
320
394
  for a direct live run) and report the result separately from the earlier mocked
321
- verification. If the user declines or defers, state what remains untested and do not claim live end-to-end verification.
395
+ verification. If the live test fails, treat the workflow as unresolved and do
396
+ not offer publishing. If the user declines or defers, state what remains
397
+ untested, do not claim live end-to-end verification, and do not offer
398
+ publishing.
322
399
 
323
400
  ## Claiming success
324
401
 
325
402
  Do not tell the user a workflow is "fixed", "verified", "tested", "working", or
326
- has "no errors" unless this turn has a passing `verify-built-workflow` or
327
- `executions(action="run")` that exercised the path being claimed. A successful
328
- `build-workflow`/save, a static `workflows(action="validate")`, or your own
329
- narration are NOT execution evidence. For a produced artifact (a file, generated
330
- document, or Code-node output), read the real output before calling it complete;
331
- do not infer correctness from the fact that a node ran. If you could not run the
403
+ has "no errors" unless you have a passing `verify-built-workflow`,
404
+ `executions(action="run")`, or inspected user-run execution that exercised the
405
+ path being claimed. Do not call a workflow "ready to use" or "ready to publish"
406
+ unless a passing execution met the publish-readiness requirement above. A
407
+ successful `build-workflow`/save, a static `workflows(action="validate")`, or
408
+ your own narration are NOT execution evidence. For a produced artifact (a file,
409
+ generated document, or Code-node output), read the real output before calling it
410
+ complete; do not infer correctness from the fact that a node ran. The same
411
+ applies to rows or records written to an external system: never make quantitative
412
+ claims ("22 rows written", "columns matched") that you did not read back from
413
+ the effect node's actual output (`executions(action="get-node-output")`) or from
414
+ the target system itself — a successful run status does not prove the *right
415
+ data* was written, only that nodes ran. If you could not run the
332
416
  failing path or inspect the artifact, say so plainly — "I couldn't verify X
333
417
  because Y" — and name what is unconfirmed. An honest "could not verify" beats an
334
418
  unverified success claim.
@@ -70,6 +70,13 @@ For repairs, prefer editing the workspace file directly with file tools
70
70
  (`workspace_str_replace_file`) and calling `build-workflow` again with the same
71
71
  `filePath`.
72
72
 
73
+ When a repair adds a node into an existing chain (an ensure-the-target-exists
74
+ step, a dedupe, a notification), check what the downstream node reads before
75
+ wiring it in-line — workflow rule 7 applies: an inserted write/create node
76
+ replaces the payload flowing into the next node with its own API response.
77
+ Branch it in parallel, reorder it upstream of the data producer, or make the
78
+ downstream node reference the data node explicitly.
79
+
73
80
  ## Escalation
74
81
 
75
82
  If the service or workflow shape is clear, never stop before the first
@@ -279,7 +286,8 @@ When this turn is responsible for verification, do not stop after a successful
279
286
  save. The job is done when one of these is true:
280
287
 
281
288
  - The workflow is verified by structured tool evidence.
282
- - Setup is required and `workflows(action="setup")` has been routed or deferred.
289
+ - Setup is required and `workflows(action="setup")` has been routed or deferred,
290
+ or the only setup left is for credentials the user skipped earlier.
283
291
  - A remediation guard says `shouldEdit: false`.
284
292
  - You are blocked after one repair attempt per unique failure signature.
285
293
 
@@ -476,7 +484,8 @@ unsolicited `sticky()`, forbidden builder constructs (e.g. `.map()`), and
476
484
  repeated `.onTrue()` / `.onFalse()` overwrites on the same IF variable. Fix
477
485
  every reported error and warning before calling `build-workflow`.
478
486
 
479
- - Code nodes need not always be necessary. You can use other n8n nodes to do the same thing.
487
+ - Avoid code node where possible, use n8n nodes that help do the same thing.
488
+ If it makes it simpler, go ahead and use code node.
480
489
  - SDK builder code is a restricted subset of TypeScript that builds a static
481
490
  graph; it is not a Code node and does not run. Build strings with template
482
491
  literals; do runtime joining, aggregation, or transforms in a Code node or
@@ -492,6 +501,15 @@ every reported error and warning before calling `build-workflow`.
492
501
  configs and from `sticky()` options alike. Positions are auto-calculated, and
493
502
  the saved workflow's own layout is restored on save, so nothing you drop here
494
503
  is lost. Leaving some in place is worse than dropping all of them.
504
+ - When editing a pre-loaded workflow, keep every `config.id` value **exactly** as
505
+ `get-as-code` produced it, on the node it came with. `id` is the node's
506
+ permanent identity in n8n — execution logs, poll cursors, deduplication state
507
+ and the version diff are all keyed on it. Rename a node freely; the `id` stays.
508
+ Move it, rewire it, change its parameters — the `id` stays. Never invent, edit,
509
+ renumber or reuse an `id`, and never copy one from a template, another workflow
510
+ or another node. **Omit `id` entirely for any node you are adding** — one is
511
+ assigned on save. Deleting a node means deleting its `id` line with it. This is
512
+ the opposite of `position`: drop every `position`, keep every `id`.
495
513
  - Use `placeholder('hint')` directly as the parameter value. Do not wrap
496
514
  placeholders in `expr()`, objects, or arrays unless the node definition
497
515
  explicitly expects an object and the placeholder is the direct value of one
@@ -624,6 +642,15 @@ Follow these rules strictly when generating workflows:
624
642
  match time units broadly (day/days, week/weeks…), and give every classifier
625
643
  an explicit fallback bucket — a one-phrasing regex silently misroutes every
626
644
  other phrasing.
645
+ 7. Inserting a node into an existing connection A→B changes what B receives:
646
+ `$json` and auto-mapped fields in B now read the inserted node's output, not
647
+ A's. Write/create/send nodes output their **API response** (ids, metadata,
648
+ `ok` flags), never the data that flowed into them — so inserting one
649
+ in-line (e.g. an ensure-the-target-exists step before a write) silently
650
+ replaces the payload with metadata. Keep the data path intact instead:
651
+ branch the inserted node in parallel from the data producer, reorder it
652
+ upstream of the data producer, or have B reference `$('Data Node')`
653
+ explicitly.
627
654
 
628
655
  ## Tool Naming Rules
629
656
 
@@ -1,21 +0,0 @@
1
- import type { NodeSearchResult, SearchableNodeType } from './node-search-engine.types';
2
- export declare const SCORE_WEIGHTS: {
3
- readonly CONNECTION_EXACT: 100;
4
- readonly CONNECTION_IN_EXPRESSION: 50;
5
- };
6
- export declare class NodeSearchEngine {
7
- private readonly nodeTypes;
8
- private readonly nameSearchCache;
9
- private readonly connectionSearchCache;
10
- constructor(nodeTypes: SearchableNodeType[]);
11
- private fuzzySearchNodes;
12
- searchByName(query: string, limit?: number): NodeSearchResult[];
13
- searchByConnectionType(connectionType: string, limit?: number, nameFilter?: string): NodeSearchResult[];
14
- formatResult(result: NodeSearchResult): string;
15
- getSubnodesForConnectionType(connectionType: string): string[];
16
- getRelatedSubnodeIds(nodeIds: string[], excludeNodeIds: Set<string>): Set<string>;
17
- getNodeType(nodeId: string): SearchableNodeType | undefined;
18
- private getConnectionScore;
19
- static isAiConnectionType(connectionType: string): boolean;
20
- static getAiConnectionTypes(): readonly string[];
21
- }