Skip to content

Commit f98c6ec

Browse files
committed
Tighten learned node selection instructions
1 parent 5f91a77 commit f98c6ec

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

docs/agent-guide.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ Do not commit local planning notes, generated scratch exports, API keys, run log
5151
## Learned Nodes vs PythonFn
5252

5353
Default rule: inspect the catalog first, use built-in nodes when they solve the
54-
task, and create a learned node only when a reusable missing capability is
55-
needed.
54+
task exactly, and create a learned node when a reusable missing capability is
55+
needed. Do not treat brittle approximations as matches; for example, generic
56+
regex extraction is not a structural RSS parser if the requested output is only
57+
article titles.
5658

5759
Use `PythonFn` for one-shot code that belongs only to the current workflow.
5860
Examples: a tiny adapter between two ports, a temporary formatting expression,

docs/quickstart-mcp.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,16 @@ use learned nodes only when a reusable capability is missing:
9595
When building Blacknode workflows, always inspect the existing node catalog first
9696
with list_nodes and get_node_schema.
9797
98-
Use built-in nodes whenever they can solve the task.
98+
Use built-in nodes whenever they can solve the task exactly.
9999
100100
If the task needs a reusable capability that is missing from the catalog, create
101101
a learned node with create_node_type instead of using one-off Python code.
102102
103+
Do not treat a brittle approximation as a match. For example, if the user asks
104+
to parse RSS article titles and only a generic regex extractor exists, create a
105+
learned node that parses RSS structurally instead of returning feed metadata or
106+
other false positives.
107+
103108
Do not create or modify files under nodes/learned directly. Use
104109
create_node_type, list_learned_nodes, get_learned_node_source, and
105110
delete_learned_node.

python/blacknode/mcp/server.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,22 @@
2626
2727
1. Always inspect the existing node catalog first with list_nodes and
2828
get_node_schema.
29-
2. Use built-in nodes whenever they can solve the task.
29+
2. Use built-in nodes whenever they can solve the task exactly.
3030
3. If the task needs a reusable capability that is missing from the catalog,
3131
create a learned node with create_node_type instead of using one-off Python
3232
code.
33-
4. Do not create or modify files under nodes/learned directly. Use
33+
4. Do not treat a brittle approximation as a match. For example, if the user
34+
asks to parse RSS article titles and only a generic regex extractor exists,
35+
create a learned node that parses RSS structurally instead of returning feed
36+
metadata or other false positives.
37+
5. Do not create or modify files under nodes/learned directly. Use
3438
create_node_type, list_learned_nodes, get_learned_node_source, and
3539
delete_learned_node.
36-
5. Before creating a learned node, keep the interface small and typed, use
40+
6. Before creating a learned node, keep the interface small and typed, use
3741
requires_network=false unless network is strictly required, generate only a
3842
def run(...) function, and make sure the function parameters match the
3943
declared inputs.
40-
6. After creating a learned node, call list_learned_nodes, use it in the visual
44+
7. After creating a learned node, call list_learned_nodes, use it in the visual
4145
workflow, validate the graph, open it in the editor, and cook the final
4246
Output node.
4347

0 commit comments

Comments
 (0)