@n8n/instance-ai 1.14.6 → 1.15.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.
- package/dist/agent/apply-agent-thinking.js +3 -3
- package/dist/agent/apply-agent-thinking.js.map +1 -1
- package/dist/agent/computer-use-prompt.js +12 -10
- package/dist/agent/computer-use-prompt.js.map +1 -1
- package/dist/agent/instance-agent.js +5 -2
- package/dist/agent/instance-agent.js.map +1 -1
- package/dist/agent/sanitize-mcp-schemas.js +3 -3
- package/dist/agent/sanitize-mcp-schemas.js.map +1 -1
- package/dist/agent/shared-prompts.js +3 -5
- package/dist/agent/shared-prompts.js.map +1 -1
- package/dist/agent/sub-agent-debriefing.d.ts +4 -4
- package/dist/agent/system-prompt.d.ts +1 -0
- package/dist/agent/system-prompt.js +10 -5
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/debug/run-debug-buffer.js +4 -4
- package/dist/debug/run-debug-buffer.js.map +1 -1
- package/dist/debug/sanitize-debug-snapshot.js +6 -5
- package/dist/debug/sanitize-debug-snapshot.js.map +1 -1
- package/dist/domain-access/domain-access-tracker.d.ts +8 -4
- package/dist/domain-access/domain-access-tracker.js +12 -7
- package/dist/domain-access/domain-access-tracker.js.map +1 -1
- package/dist/domain-access/domain-gating.d.ts +4 -4
- package/dist/domain-access/domain-gating.js +5 -5
- package/dist/domain-access/domain-gating.js.map +1 -1
- package/dist/error-formatting.js +3 -3
- package/dist/error-formatting.js.map +1 -1
- package/dist/index.d.ts +3 -20
- package/dist/index.js +4 -22
- package/dist/index.js.map +1 -1
- package/dist/mcp/mcp-client-manager.d.ts +11 -2
- package/dist/mcp/mcp-client-manager.js +17 -9
- package/dist/mcp/mcp-client-manager.js.map +1 -1
- package/dist/runtime/resumable-stream-executor.js +8 -8
- package/dist/runtime/resumable-stream-executor.js.map +1 -1
- package/dist/runtime/run-state-registry.d.ts +4 -0
- package/dist/runtime/run-state-registry.js +22 -8
- package/dist/runtime/run-state-registry.js.map +1 -1
- package/dist/runtime/terminal-response-guard.js +6 -1
- package/dist/runtime/terminal-response-guard.js.map +1 -1
- package/dist/storage/terminal-outcome-storage.d.ts +4 -4
- package/dist/storage/workflow-loop-storage.d.ts +94 -94
- package/dist/stream/map-chunk.js +17 -17
- package/dist/stream/map-chunk.js.map +1 -1
- package/dist/stream/output-redaction.js +8 -6
- package/dist/stream/output-redaction.js.map +1 -1
- package/dist/stream/usage-accumulator.d.ts +18 -18
- package/dist/stream/work-summary-accumulator.d.ts +6 -6
- package/dist/tools/attachments/parse-file.tool.d.ts +18 -18
- package/dist/tools/credentials.tool.d.ts +2 -2
- package/dist/tools/data-tables.tool.js +2 -2
- package/dist/tools/data-tables.tool.js.map +1 -1
- package/dist/tools/evals/column-ref-utils.js +4 -4
- package/dist/tools/evals/column-ref-utils.js.map +1 -1
- package/dist/tools/evals/describe-metric-for-workflow.service.js +3 -3
- package/dist/tools/evals/describe-metric-for-workflow.service.js.map +1 -1
- package/dist/tools/evals/detect-tool-refs.service.js +2 -2
- package/dist/tools/evals/detect-tool-refs.service.js.map +1 -1
- package/dist/tools/evals/eval-data-requirements.service.js +10 -10
- package/dist/tools/evals/eval-data-requirements.service.js.map +1 -1
- package/dist/tools/evals/evals.tool.js +7 -8
- package/dist/tools/evals/evals.tool.js.map +1 -1
- package/dist/tools/evals/extract-rows-from-history.service.js +7 -7
- package/dist/tools/evals/extract-rows-from-history.service.js.map +1 -1
- package/dist/tools/evals/generate-sample-rows.service.js +5 -5
- package/dist/tools/evals/generate-sample-rows.service.js.map +1 -1
- package/dist/tools/evals/metric-catalog.js +3 -3
- package/dist/tools/evals/metric-catalog.js.map +1 -1
- package/dist/tools/executions.tool.js +4 -6
- package/dist/tools/executions.tool.js.map +1 -1
- package/dist/tools/filesystem/create-tools-from-mcp-server.js +6 -6
- package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
- package/dist/tools/n8n-docs/schemas.d.ts +4 -4
- package/dist/tools/nodes/node-search-engine.js +3 -3
- package/dist/tools/nodes/node-search-engine.js.map +1 -1
- package/dist/tools/nodes.tool.js +13 -30
- package/dist/tools/nodes.tool.js.map +1 -1
- package/dist/tools/orchestration/complete-checkpoint.tool.js +2 -2
- package/dist/tools/orchestration/complete-checkpoint.tool.js.map +1 -1
- package/dist/tools/orchestration/delegate.schemas.d.ts +1 -1
- package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +8 -8
- package/dist/tools/orchestration/verification/analyze-result.js +4 -3
- package/dist/tools/orchestration/verification/analyze-result.js.map +1 -1
- package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +2 -2
- package/dist/tools/orchestration/verify-built-workflow.tool.js +4 -7
- package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
- package/dist/tools/research.tool.js +2 -2
- package/dist/tools/research.tool.js.map +1 -1
- package/dist/tools/shared/ask-user.tool.d.ts +4 -4
- package/dist/tools/shared/ask-user.tool.js +11 -21
- package/dist/tools/shared/ask-user.tool.js.map +1 -1
- package/dist/tools/tool-ids.d.ts +1 -0
- package/dist/tools/tool-ids.js +2 -1
- package/dist/tools/tool-ids.js.map +1 -1
- package/dist/tools/workflows/apply-workflow-credentials.tool.js +6 -11
- package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -1
- package/dist/tools/workflows/build-workflow.tool.d.ts +9 -2
- package/dist/tools/workflows/build-workflow.tool.js +171 -5
- package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/classify-node-destructiveness.service.js +4 -4
- package/dist/tools/workflows/classify-node-destructiveness.service.js.map +1 -1
- package/dist/tools/workflows/credential-url-resolver.d.ts +21 -0
- package/dist/tools/workflows/credential-url-resolver.js +79 -0
- package/dist/tools/workflows/credential-url-resolver.js.map +1 -0
- package/dist/tools/workflows/credential-utils.d.ts +28 -0
- package/dist/tools/workflows/credential-utils.js +61 -0
- package/dist/tools/workflows/credential-utils.js.map +1 -0
- package/dist/tools/workflows/detect-array-input-collapse.js +4 -4
- package/dist/tools/workflows/detect-array-input-collapse.js.map +1 -1
- package/dist/tools/workflows/detect-wrong-kind-locator.d.ts +10 -0
- package/dist/tools/workflows/detect-wrong-kind-locator.js +105 -0
- package/dist/tools/workflows/detect-wrong-kind-locator.js.map +1 -0
- package/dist/tools/workflows/generate-simulation-fixtures.service.js +3 -3
- package/dist/tools/workflows/generate-simulation-fixtures.service.js.map +1 -1
- package/dist/tools/workflows/materialize-node-type.tool.d.ts +4 -4
- package/dist/tools/workflows/setup-workflow.schema.d.ts +63 -27
- package/dist/tools/workflows/setup-workflow.service.js +26 -43
- package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
- package/dist/tools/workflows/summarize-workflow.d.ts +5 -0
- package/dist/tools/workflows/summarize-workflow.js +114 -0
- package/dist/tools/workflows/summarize-workflow.js.map +1 -0
- package/dist/tools/workflows/workflow-json-utils.js +6 -5
- package/dist/tools/workflows/workflow-json-utils.js.map +1 -1
- package/dist/tools/workflows/workflow-source-compiler.js +48 -9
- package/dist/tools/workflows/workflow-source-compiler.js.map +1 -1
- package/dist/tools/workflows/workflow-validation-warnings.js +5 -1
- package/dist/tools/workflows/workflow-validation-warnings.js.map +1 -1
- package/dist/tools/workflows.tool.d.ts +1 -1
- package/dist/tools/workflows.tool.js +47 -22
- package/dist/tools/workflows.tool.js.map +1 -1
- package/dist/tracing/langsmith-tracing.d.ts +5 -1
- package/dist/tracing/langsmith-tracing.js +66 -13
- package/dist/tracing/langsmith-tracing.js.map +1 -1
- package/dist/tracing/trace-payloads.d.ts +1 -0
- package/dist/tracing/trace-payloads.js +46 -29
- package/dist/tracing/trace-payloads.js.map +1 -1
- package/dist/types.d.ts +16 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/stream-helpers.js +5 -5
- package/dist/utils/stream-helpers.js.map +1 -1
- package/dist/workflow-builder/index.d.ts +0 -1
- package/dist/workflow-builder/index.js +1 -6
- package/dist/workflow-builder/index.js.map +1 -1
- package/dist/workflow-loop/index.d.ts +0 -1
- package/dist/workflow-loop/index.js +1 -3
- package/dist/workflow-loop/index.js.map +1 -1
- package/dist/workflow-loop/workflow-loop-state.d.ts +112 -112
- package/dist/workspace/snapshot-image-context.js +24 -11
- package/dist/workspace/snapshot-image-context.js.map +1 -1
- package/dist/workspace/snapshot-manager.d.ts +0 -1
- package/dist/workspace/snapshot-manager.js +0 -7
- package/dist/workspace/snapshot-manager.js.map +1 -1
- package/dist/workspace/template-telemetry.js +5 -4
- package/dist/workspace/template-telemetry.js.map +1 -1
- package/dist/workspace/workspace-manifest.js +2 -2
- package/dist/workspace/workspace-manifest.js.map +1 -1
- package/knowledge-base/reference/workflow-builder-guardrails.md +33 -0
- package/package.json +15 -13
- package/skills/post-build-flow/SKILL.md +106 -10
- package/skills/workflow-builder/SKILL.md +185 -228
- package/skills/workflow-builder/references/compositional-workflows.md +66 -0
- package/skills/workflow-builder/references/error-workflows.md +35 -0
- package/dist/tools/nodes/suggested-nodes-data.d.ts +0 -11
- package/dist/tools/nodes/suggested-nodes-data.js +0 -333
- package/dist/tools/nodes/suggested-nodes-data.js.map +0 -1
- package/dist/workflow-builder/sdk-prompt-sections.d.ts +0 -1
- package/dist/workflow-builder/sdk-prompt-sections.js +0 -9
- package/dist/workflow-builder/sdk-prompt-sections.js.map +0 -1
- package/dist/workflow-loop/terminal-remediation-guard.d.ts +0 -6
- package/dist/workflow-loop/terminal-remediation-guard.js +0 -18
- 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
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`planning` or call `create-tasks` first
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
`
|
|
56
|
-
|
|
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,
|
|
59
|
-
|
|
60
|
-
`
|
|
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
|
|
66
|
-
destination service
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
`ask-user
|
|
73
|
-
|
|
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
|
-
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
122
|
-
|
|
123
|
-
`
|
|
124
|
-
`
|
|
125
|
-
`
|
|
126
|
-
`scraping_and_research
|
|
127
|
-
|
|
128
|
-
names like "Gmail"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
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
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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)`,
|
|
147
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,21 @@ 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
179
|
+
11. After a successful direct `build-workflow` result, if the tool output
|
|
180
|
+
contains `postBuildFlow.required: true`, follow the inlined
|
|
181
|
+
`postBuildFlow.instructions` from that output (do not load `post-build-flow`
|
|
182
|
+
separately) before verification, setup, error-workflow follow-up,
|
|
183
|
+
publishing, testing, or any final user-visible summary. Do not call
|
|
184
|
+
`verify-built-workflow` directly from this skill for direct builds. Finish
|
|
185
|
+
with a concise completion message only when the post-build flow, required
|
|
183
186
|
setup routing, or required verification path is complete.
|
|
184
187
|
|
|
185
188
|
Do not produce visible output until the final step, unless blocked.
|
|
@@ -188,29 +191,29 @@ Do not produce visible output until the final step, unless blocked.
|
|
|
188
191
|
|
|
189
192
|
Use the current turn's higher-priority instructions to decide who verifies:
|
|
190
193
|
|
|
191
|
-
- Direct existing-workflow edits: after `build-workflow` succeeds,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
- Direct builds and existing-workflow edits: after `build-workflow` succeeds,
|
|
195
|
+
follow the inlined `postBuildFlow.instructions` when
|
|
196
|
+
`postBuildFlow.required: true` is present in the tool output. Those
|
|
197
|
+
instructions own verification, setup routing, error-workflow opt-in, and
|
|
198
|
+
final user-visible completion for direct builds.
|
|
194
199
|
- Checkpoint follow-ups: verify with `verify-built-workflow` or `executions` and
|
|
195
200
|
report once with `complete-checkpoint`.
|
|
196
201
|
- Planned build follow-ups that explicitly say to stop after save: stop after a
|
|
197
202
|
successful `build-workflow`. The checkpoint task owns verification.
|
|
198
203
|
|
|
199
204
|
Build/save success is not workflow-quality evidence. When this turn is
|
|
200
|
-
responsible for verification or repair, inspect the persisted workflow
|
|
201
|
-
`workflows(action="get-as-code", workflowId)` or
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
state explicitly that you could not verify and why. Never dismiss a live
|
|
213
|
-
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.
|
|
214
217
|
|
|
215
218
|
When this turn is responsible for verification, do not stop after a successful
|
|
216
219
|
save. The job is done when one of these is true:
|
|
@@ -229,17 +232,11 @@ If live connectivity also matters for a branch-controlled workflow, verify the
|
|
|
229
232
|
fixture-backed branch coverage first and run a separate live smoke check, or
|
|
230
233
|
state exactly which branch remains unverified.
|
|
231
234
|
|
|
232
|
-
Trigger
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
-
|
|
237
|
-
`{ "name": "Alice", "email": "a@b.c" }`. Do not wrap in `formFields`.
|
|
238
|
-
- Webhook: pass the body payload. The adapter wraps it under `body`; downstream
|
|
239
|
-
expressions should use `$json.body.<field>`.
|
|
240
|
-
- Chat Trigger: pass `{ "chatInput": "user message" }`.
|
|
241
|
-
- Other event triggers such as Linear, GitHub, Slack, or MCP: pass `inputData`
|
|
242
|
-
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).
|
|
243
240
|
|
|
244
241
|
If verification returns remediation with `shouldEdit: false`, stop editing and
|
|
245
242
|
follow its guidance. If verification fails with `shouldEdit: true`, make one
|
|
@@ -253,27 +250,22 @@ decision after testing.
|
|
|
253
250
|
## Credential Rules
|
|
254
251
|
|
|
255
252
|
- Call `credentials(action="list")` early when the task touches external
|
|
256
|
-
services
|
|
253
|
+
services; note each credential's `id`, `name`, and `type` (the credential
|
|
254
|
+
key, e.g. `slackApi`, comes from the node type definition).
|
|
257
255
|
- Use `newCredential('Credential Name', 'credential-id')` only when the user
|
|
258
|
-
selected a specific
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
- Never use raw credential objects like `{ id: '...', name: '...' }` in builder
|
|
265
|
-
SDK code. When editing roundtripped code that contains raw credential objects,
|
|
266
|
-
replace them with `newCredential()` calls.
|
|
267
|
-
- The credential key, such as `slackApi`, is the credential type from the node
|
|
268
|
-
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.
|
|
269
262
|
- If a required credential type is not listed, call
|
|
270
263
|
`credentials(action="search-types")` with the service name. Prefer dedicated
|
|
271
|
-
credential types over generic auth
|
|
272
|
-
`httpBearerAuth` over `httpHeaderAuth`.
|
|
273
|
-
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
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.
|
|
277
269
|
- Always declare `output` on nodes that use unresolved credentials when mock
|
|
278
270
|
data is needed for verification.
|
|
279
271
|
|
|
@@ -293,80 +285,22 @@ resource:
|
|
|
293
285
|
For resources that cannot be created via n8n, explain clearly what the user
|
|
294
286
|
needs to create manually and what ID or value belongs in setup.
|
|
295
287
|
|
|
296
|
-
If part of the requested workflow is infeasible
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
requested capability. Flag the substitution as an approximation that may not
|
|
301
|
-
work — and any unverified region/country support — and name that gap in the
|
|
302
|
-
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.
|
|
303
292
|
|
|
304
293
|
## Compositional Workflows
|
|
305
294
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
2. Give each supporting workflow an `executeWorkflowTrigger` (version 1.1) with
|
|
316
|
-
an explicit input schema.
|
|
317
|
-
3. Use the returned supporting `workflowId` in the main workflow's
|
|
318
|
-
`executeWorkflow` node with `source: 'database'`.
|
|
319
|
-
4. Create or edit the main workflow source file last, then save it with
|
|
320
|
-
`build-workflow` and without `isSupportingWorkflow`; this is the build task's
|
|
321
|
-
final deliverable outcome.
|
|
322
|
-
5. Do not publish the main workflow automatically. Supporting workflows may be
|
|
323
|
-
published when the parent workflow needs them active for verification or
|
|
324
|
-
runtime references, but only after their setup requirements are resolved.
|
|
325
|
-
|
|
326
|
-
Example supporting workflow trigger:
|
|
327
|
-
|
|
328
|
-
```ts
|
|
329
|
-
const inputTrigger = trigger({
|
|
330
|
-
type: 'n8n-nodes-base.executeWorkflowTrigger',
|
|
331
|
-
version: 1.1,
|
|
332
|
-
config: {
|
|
333
|
-
parameters: {
|
|
334
|
-
inputSource: 'workflowInputs',
|
|
335
|
-
workflowInputs: {
|
|
336
|
-
values: [
|
|
337
|
-
{ name: 'city', type: 'string' },
|
|
338
|
-
{ name: 'units', type: 'string' },
|
|
339
|
-
],
|
|
340
|
-
},
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
});
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
Example main-workflow reference:
|
|
347
|
-
|
|
348
|
-
```ts
|
|
349
|
-
const getWeather = node({
|
|
350
|
-
type: 'n8n-nodes-base.executeWorkflow',
|
|
351
|
-
version: 1.2,
|
|
352
|
-
config: {
|
|
353
|
-
name: 'Get Weather Data',
|
|
354
|
-
parameters: {
|
|
355
|
-
source: 'database',
|
|
356
|
-
workflowId: { __rl: true, mode: 'id', value: 'SUPPORTING_WORKFLOW_ID' },
|
|
357
|
-
mode: 'once',
|
|
358
|
-
workflowInputs: {
|
|
359
|
-
mappingMode: 'defineBelow',
|
|
360
|
-
value: { city: expr('{{ $json.city }}'), units: 'metric' },
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
|
-
});
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
Replace `SUPPORTING_WORKFLOW_ID` with the real ID returned by the supporting
|
|
368
|
-
`build-workflow` call. If a supporting workflow uses mocked credentials or
|
|
369
|
-
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.
|
|
370
304
|
|
|
371
305
|
## Data Tables
|
|
372
306
|
|
|
@@ -379,6 +313,14 @@ guidance already loaded by the orchestrator when available. Create or inspect
|
|
|
379
313
|
tables directly with `data-tables`; do not invent table IDs, table names, or
|
|
380
314
|
column names.
|
|
381
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
|
+
|
|
382
324
|
## SDK Code Rules
|
|
383
325
|
|
|
384
326
|
- SDK builder code is a restricted subset of TypeScript that builds a static
|
|
@@ -412,16 +354,17 @@ column names.
|
|
|
412
354
|
placeholders in `expr()`, objects, or arrays unless the node definition
|
|
413
355
|
explicitly expects an object and the placeholder is the direct value of one
|
|
414
356
|
field.
|
|
415
|
-
- For unresolved resource-locator fields (
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
cachedResultName
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
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).
|
|
425
368
|
- For single-execution nodes that receive many items but should run once, set
|
|
426
369
|
`executeOnce: true`.
|
|
427
370
|
- Whenever a node declares mock `output` for verification, include every field
|
|
@@ -434,6 +377,14 @@ column names.
|
|
|
434
377
|
single-item assumptions like `$input.first()` break during verification
|
|
435
378
|
instead of on the user's first run. A single-item mock hides array-vs-single
|
|
436
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.
|
|
437
388
|
- SDK node `output` mocks are raw `$json` objects. Do not wrap mock items in
|
|
438
389
|
n8n runtime item envelopes like `{ json: { ... } }` unless downstream
|
|
439
390
|
expressions intentionally read `$json.json.*`. Correct:
|
|
@@ -501,25 +452,31 @@ Follow these rules strictly when generating workflows:
|
|
|
501
452
|
set `alwaysOutputData: true` on every node that can emit zero items before
|
|
502
453
|
the effect — often both the HTTP fetch (empty `[]`) and the filter (all rows
|
|
503
454
|
dropped). Not on the formatter or notifier; consumers that receive zero
|
|
504
|
-
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.
|
|
505
460
|
- A Filter or IF only selects items; it does not perform the requested side
|
|
506
461
|
effect. If the user asks to archive, update, delete, send, or create only
|
|
507
462
|
matching items, wire the corresponding action node on the matching path.
|
|
508
463
|
5. Input and output indices are zero-based. `.input(0)` and `.output(0)` are the
|
|
509
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.
|
|
510
472
|
|
|
511
473
|
## Tool Naming Rules
|
|
512
474
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
to that service.
|
|
519
|
-
- Prefer concise snake_case action names like `get_email`, `add_labels`, or
|
|
520
|
-
`mark_as_read`.
|
|
521
|
-
- Avoid redundant names like `gmail_get_email`, `slack_send_message`, or
|
|
522
|
-
`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.
|
|
523
480
|
|
|
524
481
|
## Node Configuration Safety Rules
|
|
525
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.
|