Registry-based Classifier
Rule-based classifier that resolves the best-matching entry from a registry KnowledgeResource given a set of input signals, using a deterministic weighted-score algorithm.
Deterministic, model-free router: scores every entry of a registry dataset against the given labels, tags and text with weighted rules and returns the best entry with its payload.
Unlike ai.classify / ai.classify.triage which rely on an LLM to pick a label, this operator scores each candidate entry declared in a structured registry (KR resource_type: dataset) against the caller's signals, and returns the highest-scoring entry along with its opaque payload — ready for downstream nodes to consume (task assignees, routing targets, SLA hints, pricing tiers, etc.).
The registry shape and matching semantics are fully client-agnostic. The registry lives in a KnowledgeResource so non-technical operators can add/edit/remove entries from the webapp without modifying the workflow graph or redeploying the orchestrator.
How it decides
Each entry declares match_rules with three independent channels:
labels: exact-string matches against the caller'slabels[]signal (e.g. a classification output like"some_category.some_subcategory").tags: exact-string matches against the caller'stags[]signal (e.g. routing hints emitted by an upstream triage).keywords: case-insensitive substring matches against the caller'stextsignal (e.g. the original email or document body).
Each rule carries a weight. The worker iterates all entries, sums the weights of matching rules, and returns the entry with the highest total score. Ties break by first-in-array order (ops can reorder rows to express priority explicitly).
If no entry scores > 0, the worker returns the entry whose slug matches the registry's default_entry field (or exits via port no_match if the registry has no default).
Typical use cases
- Intake routing: classify an incoming case to a branch / office / team from a registry of hundreds of such entities, with per-entity assignee, SLA and priority declared as data.
- Workload dispatch: pick a queue or specialist from a catalog when the choice depends on multiple signals (category + region + urgency hints).
- Product / plan selection: match a support ticket to a product variant based on classification + keywords in the text.
- Tiering and filtering: rule-based assignment of customers/leads to tiers, segments, or workflows when criteria evolve faster than code.
Why a dedicated worker instead of flow.switch or data.transform
flow.switch forces one case/port per outcome — doesn't scale past ~10 cases. data.transform with an inline IIFE duplicates the scoring code across workflows. ai.classify.registry centralizes the algorithm, validates the registry shape defensively, and exposes a clean input/output contract that downstream nodes (e.g. human.task.create) consume via expressions.
When NOT to use
When the decision requires semantic understanding (ambiguous text, novel cases, a justification written for a human reviewer), use ai.classify.triage instead. This operator is deterministic, explainable, and cheap to run — but it will only recover from novel phrasings if a matching keyword is declared.
How it works
- Merges the upstream payload with the node config (config wins); throws
Missing 'knowledge_resource_id'when it is empty.labelsandtagsaccept an array (non-strings are dropped) or a single string. - Loads the knowledge resource and reads
content.structured_data:entriesmust be an array;default_entryandversionare optional. - For each entry adds the
weightof everymatch_rules.labelsvalue present inlabels, everymatch_rules.tagsvalue present intags(both exact, case-sensitive) and everymatch_rules.keywordsvalue found intext(case-insensitive substring). A missing or non-numeric weight counts as 1; negative weights subtract. - Keeps entries with a score above 0 and picks the highest; ties go to the entry listed first.
- With no scoring entry, returns
default_entrywithis_default: trueand score 0 when it names an existing slug; otherwise routes tono_match.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-route-request",
"label": "Route request",
"operator_slug": "ai.classify.registry",
"operator_version": "1.0.0",
"config": {
"knowledge_resource_id": "<knowledge_resource_id>",
"labels": [
"{{ $json.category }}.{{ $json.subcategory }}"
],
"tags": [
"{{ $json.channel }}",
"{{ $json.priority }}"
],
"text": "{{ $json.text }}"
}
}{
"ok": true,
"data": {
"port": "resolved",
"entry": {
"slug": "refund-request",
"label": "Refund request",
"description": "Customer asks for money back.",
"payload": {
"queue": "finance",
"sla_hours": 24
},
"match": {
"score": 8,
"matched_reasons": [
"label:billing.refund(5)",
"keyword:reembolso(3)"
],
"is_default": false
}
},
"registry_version": 3
},
"port": "resolved"
}Configuration
-
knowledge_resource_idstring Required -
KnowledgeResource (resource_type: dataset) whose `content.structured_data` describes the registry: `{ version, default_entry?, entries: [{ slug, label, description?, match_rules: { labels, tags, keywords }, payload }] }`. Managed in the webapp at `/cognitive-assets/knowledge-resource/*`.
-
labelsarray<string> Optional -
Classification labels to score against `match_rules.labels` of each entry. Typically set via expression, e.g. `["{{ $json.category }}.{{ $json.subcategory }}"]`. Each element must be an exact string to match (no regex, no partial). Can also be provided as a single string, which is coerced to a one-element array.
-
tagsarray<string> Optional -
Tag/hint signals to score against `match_rules.tags`. Typically set to the upstream triage's `routing_hints` via expression, e.g. `"{{ $json.routing_hints }}"`. Exact string match.
-
textstring Optional -
Text used for case-insensitive substring matching against `match_rules.keywords`. Typically the normalized input text, e.g. `"{{ $json.text }}"`.
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
labels, tags, text - Read from the config first and then from the upstream payload. Matching is literal: no regex, no trimming, and labels and tags are case-sensitive. Non-string items are dropped, so an array element whose expression resolves to an array is lost; to pass a whole upstream list, set the key to a single expression such as
{{ $json.routing_hints }}(it resolves to the array at runtime). -
execution - Declared but ignored: neither the worker nor the engine reads
retryOnFail,maxTries,waitBetweenTries,continueOnFail,alwaysOutputDataortimeout_msfrom this block.
Output ports
resolved default An entry scored above 0, or the registry's default_entry was used.
{
"port": "resolved",
"entry": {
"slug": "refund-request",
"label": "Refund request",
"description": "Customer asks for money back.",
"payload": {
"queue": "finance",
"sla_hours": 24
},
"match": {
"score": 8,
"matched_reasons": [
"label:billing.refund(5)",
"keyword:reembolso(3)"
],
"is_default": false
}
},
"registry_version": 3
}no_match No entry scored above 0 (or the registry is empty) and there is no valid default_entry. The output has no entry.
{
"port": "no_match",
"registry_version": 3
}error The resource id is missing, the resource cannot be loaded or its structure is invalid.
{
"error": "Invalid registry: 'content.structured_data.entries' must be an array"
}In expressions
What a later node can read from this node's output with $("Registry-based Classifier").item.json.<path> (write your node's label instead of Registry-based Classifier). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through resolved, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Registry-based Classifier").item.json.entryWinning registry entry with its opaque payload and match diagnostics. | ||
$("Registry-based Classifier").item.json.entry.slug | ||
$("Registry-based Classifier").item.json.entry.label | ||
$("Registry-based Classifier").item.json.entry.description | ||
$("Registry-based Classifier").item.json.entry.payloadOpaque data declared on the entry; consumers read this via expressions. | ||
$("Registry-based Classifier").item.json.entry.match | ||
$("Registry-based Classifier").item.json.entry.match.score | ||
$("Registry-based Classifier").item.json.entry.match.matched_reasonsHuman-readable reasons for audit, e.g. ["label:foo(5)", "tag:bar(3)", "keyword:baz(1)"]. Empty when the default fallback is used. | ||
$("Registry-based Classifier").item.json.entry.match.is_defaultTrue when no entry scored > 0 and the registry's default_entry fired. | ||
$("Registry-based Classifier").item.json.registry_versionValue of structured_data.version from the registry, for traceability. | ||
$("Registry-based Classifier").item.json.port | — |
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Missing 'knowledge_resource_id' | error | No registry dataset is selected. |
Invalid registry: 'content.structured_data.entries' must be an array | error | The resource has no structured_data or its entries is not an array. Fix the dataset content. |
Knowledge resource not found: <knowledge_resource_id> | error | The id does not match any knowledge resource. A deleted resource fails with Knowledge resource "<name>" has been deleted. Update the node config to reference an active resource. |
Input contract
-
labelsarray | string Optional -
Classification labels (array of strings, or single string).
-
tagsarray | string Optional -
Tag/hint signals (array of strings, or single string).
-
textstring Optional -
Free-form text for keyword substring matching.
Output contract
-
entryobject Required -
Winning registry entry with its opaque payload and match diagnostics.
-
slugstring Required -
labelstring Required -
descriptionstring | null Optional -
payloadobject Required -
Opaque data declared on the entry; consumers read this via expressions.
-
matchobject Required -
-
scorenumber Required -
matched_reasonsarray<string> Required -
Human-readable reasons for audit, e.g. `["label:foo(5)", "tag:bar(3)", "keyword:baz(1)"]`. Empty when the default fallback is used.
-
is_defaultboolean Required -
True when no entry scored > 0 and the registry's `default_entry` fired.
-
-
-
registry_versioninteger | null Optional -
Value of `structured_data.version` from the registry, for traceability.
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "ai.classify.registry",
"name": "Registry-based Classifier",
"category": "ai",
"version": "1.0.0",
"description": "Rule-based classifier that resolves the best-matching entry from a registry KnowledgeResource given a set of input signals, using a deterministic weighted-score algorithm.\n\nUnlike `ai.classify` / `ai.classify.triage` which rely on an LLM to pick a label, this operator scores each candidate entry declared in a structured registry (KR `resource_type: dataset`) against the caller's signals, and returns the highest-scoring entry along with its opaque `payload` — ready for downstream nodes to consume (task assignees, routing targets, SLA hints, pricing tiers, etc.).\n\nThe registry shape and matching semantics are fully client-agnostic. The registry lives in a KnowledgeResource so non-technical operators can add/edit/remove entries from the webapp without modifying the workflow graph or redeploying the orchestrator.\n\n**How it decides**\n\nEach entry declares `match_rules` with three independent channels:\n\n- `labels`: exact-string matches against the caller's `labels[]` signal (e.g. a classification output like `\"some_category.some_subcategory\"`).\n- `tags`: exact-string matches against the caller's `tags[]` signal (e.g. routing hints emitted by an upstream triage).\n- `keywords`: case-insensitive substring matches against the caller's `text` signal (e.g. the original email or document body).\n\nEach rule carries a `weight`. The worker iterates all entries, sums the weights of matching rules, and returns the entry with the highest total score. Ties break by first-in-array order (ops can reorder rows to express priority explicitly).\n\nIf no entry scores > 0, the worker returns the entry whose `slug` matches the registry's `default_entry` field (or exits via port `no_match` if the registry has no default).\n\n**Typical use cases**\n\n- **Intake routing**: classify an incoming case to a branch / office / team from a registry of hundreds of such entities, with per-entity assignee, SLA and priority declared as data.\n- **Workload dispatch**: pick a queue or specialist from a catalog when the choice depends on multiple signals (category + region + urgency hints).\n- **Product / plan selection**: match a support ticket to a product variant based on classification + keywords in the text.\n- **Tiering and filtering**: rule-based assignment of customers/leads to tiers, segments, or workflows when criteria evolve faster than code.\n\n**Why a dedicated worker instead of `flow.switch` or `data.transform`**\n\n`flow.switch` forces one case/port per outcome — doesn't scale past ~10 cases. `data.transform` with an inline IIFE duplicates the scoring code across workflows. `ai.classify.registry` centralizes the algorithm, validates the registry shape defensively, and exposes a clean input/output contract that downstream nodes (e.g. `human.task.create`) consume via expressions.\n\n**When NOT to use**\n\nWhen the decision requires semantic understanding (ambiguous text, novel cases, a justification written for a human reviewer), use `ai.classify.triage` instead. This operator is deterministic, explainable, and cheap to run — but it will only recover from novel phrasings if a matching keyword is declared.",
"capabilities": [
"ai",
"classification",
"routing",
"rules",
"deterministic",
"registry",
"explainability"
],
"knowledge_binding": {
"enabled": true,
"resource_types": [
"dataset"
],
"field": "knowledge_resource_id",
"label": "Registry Dataset"
},
"config_schema": {
"type": "object",
"required": [
"knowledge_resource_id"
],
"properties": {
"knowledge_resource_id": {
"type": "string",
"title": "Registry Dataset",
"description": "KnowledgeResource (resource_type: dataset) whose `content.structured_data` describes the registry: `{ version, default_entry?, entries: [{ slug, label, description?, match_rules: { labels, tags, keywords }, payload }] }`. Managed in the webapp at `/cognitive-assets/knowledge-resource/*`.",
"x-ui-widget": "knowledge-resource-picker",
"x-knowledge-resource-types": [
"dataset"
]
},
"labels": {
"type": "array",
"title": "Label Signals",
"description": "Classification labels to score against `match_rules.labels` of each entry. Typically set via expression, e.g. `[\"{{ $json.category }}.{{ $json.subcategory }}\"]`. Each element must be an exact string to match (no regex, no partial). Can also be provided as a single string, which is coerced to a one-element array.",
"items": {
"type": "string"
},
"default": []
},
"tags": {
"type": "array",
"title": "Tag Signals",
"description": "Tag/hint signals to score against `match_rules.tags`. Typically set to the upstream triage's `routing_hints` via expression, e.g. `\"{{ $json.routing_hints }}\"`. Exact string match.",
"items": {
"type": "string"
},
"default": []
},
"text": {
"type": "string",
"title": "Free-form Text",
"description": "Text used for case-insensitive substring matching against `match_rules.keywords`. Typically the normalized input text, e.g. `\"{{ $json.text }}\"`.",
"default": ""
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"description": "Signals against which the registry entries are scored.",
"properties": {
"labels": {
"type": [
"array",
"string"
],
"description": "Classification labels (array of strings, or single string)."
},
"tags": {
"type": [
"array",
"string"
],
"description": "Tag/hint signals (array of strings, or single string)."
},
"text": {
"type": "string",
"description": "Free-form text for keyword substring matching."
}
}
},
"output_contract_schema": {
"type": "object",
"properties": {
"entry": {
"type": "object",
"description": "Winning registry entry with its opaque payload and match diagnostics.",
"properties": {
"slug": {
"type": "string"
},
"label": {
"type": "string"
},
"description": {
"type": [
"string",
"null"
]
},
"payload": {
"type": "object",
"description": "Opaque data declared on the entry; consumers read this via expressions.",
"additionalProperties": true
},
"match": {
"type": "object",
"properties": {
"score": {
"type": "number"
},
"matched_reasons": {
"type": "array",
"description": "Human-readable reasons for audit, e.g. `[\"label:foo(5)\", \"tag:bar(3)\", \"keyword:baz(1)\"]`. Empty when the default fallback is used.",
"items": {
"type": "string"
}
},
"is_default": {
"type": "boolean",
"description": "True when no entry scored > 0 and the registry's `default_entry` fired."
}
},
"required": [
"score",
"matched_reasons",
"is_default"
]
}
},
"required": [
"slug",
"label",
"payload",
"match"
]
},
"registry_version": {
"type": [
"integer",
"null"
],
"description": "Value of `structured_data.version` from the registry, for traceability."
}
},
"required": [
"entry"
]
},
"ports": [
{
"port_id": "resolved",
"label": "Resolved",
"is_default": true,
"description": "An entry was selected (either a real match, or the declared default)."
},
{
"port_id": "no_match",
"label": "No Match",
"description": "No entry scored > 0 and the registry does not declare a `default_entry`. The caller must handle the uncovered case explicitly."
},
{
"port_id": "error",
"label": "Error"
}
],
"execution_mode": "async",
"tags": [
"ai",
"classifier",
"registry",
"routing",
"rule-based",
"deterministic"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"required": [
"knowledge_resource_id"
],
"properties": {
"knowledge_resource_id": {
"type": "string",
"title": "Registry Dataset",
"description": "KnowledgeResource (resource_type: dataset) whose `content.structured_data` describes the registry: `{ version, default_entry?, entries: [{ slug, label, description?, match_rules: { labels, tags, keywords }, payload }] }`. Managed in the webapp at `/cognitive-assets/knowledge-resource/*`.",
"x-ui-widget": "knowledge-resource-picker",
"x-knowledge-resource-types": [
"dataset"
]
},
"labels": {
"type": "array",
"title": "Label Signals",
"description": "Classification labels to score against `match_rules.labels` of each entry. Typically set via expression, e.g. `[\"{{ $json.category }}.{{ $json.subcategory }}\"]`. Each element must be an exact string to match (no regex, no partial). Can also be provided as a single string, which is coerced to a one-element array.",
"items": {
"type": "string"
},
"default": []
},
"tags": {
"type": "array",
"title": "Tag Signals",
"description": "Tag/hint signals to score against `match_rules.tags`. Typically set to the upstream triage's `routing_hints` via expression, e.g. `\"{{ $json.routing_hints }}\"`. Exact string match.",
"items": {
"type": "string"
},
"default": []
},
"text": {
"type": "string",
"title": "Free-form Text",
"description": "Text used for case-insensitive substring matching against `match_rules.keywords`. Typically the normalized input text, e.g. `\"{{ $json.text }}\"`.",
"default": ""
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"description": "Signals against which the registry entries are scored.",
"properties": {
"labels": {
"type": [
"array",
"string"
],
"description": "Classification labels (array of strings, or single string)."
},
"tags": {
"type": [
"array",
"string"
],
"description": "Tag/hint signals (array of strings, or single string)."
},
"text": {
"type": "string",
"description": "Free-form text for keyword substring matching."
}
}
}{
"type": "object",
"properties": {
"entry": {
"type": "object",
"description": "Winning registry entry with its opaque payload and match diagnostics.",
"properties": {
"slug": {
"type": "string"
},
"label": {
"type": "string"
},
"description": {
"type": [
"string",
"null"
]
},
"payload": {
"type": "object",
"description": "Opaque data declared on the entry; consumers read this via expressions.",
"additionalProperties": true
},
"match": {
"type": "object",
"properties": {
"score": {
"type": "number"
},
"matched_reasons": {
"type": "array",
"description": "Human-readable reasons for audit, e.g. `[\"label:foo(5)\", \"tag:bar(3)\", \"keyword:baz(1)\"]`. Empty when the default fallback is used.",
"items": {
"type": "string"
}
},
"is_default": {
"type": "boolean",
"description": "True when no entry scored > 0 and the registry's `default_entry` fired."
}
},
"required": [
"score",
"matched_reasons",
"is_default"
]
}
},
"required": [
"slug",
"label",
"payload",
"match"
]
},
"registry_version": {
"type": [
"integer",
"null"
],
"description": "Value of `structured_data.version` from the registry, for traceability."
}
},
"required": [
"entry"
]
}[
{
"port_id": "resolved",
"label": "Resolved",
"is_default": true,
"description": "An entry was selected (either a real match, or the declared default)."
},
{
"port_id": "no_match",
"label": "No Match",
"description": "No entry scored > 0 and the registry does not declare a `default_entry`. The caller must handle the uncovered case explicitly."
},
{
"port_id": "error",
"label": "Error"
}
]Execution
- Execution
async- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
aiclassificationroutingrulesdeterministicregistryexplainability- Tags
aiclassifierregistryroutingrule-baseddeterministic
Notes and limits
- No model is called; the result depends only on the registry and the inputs, so the same inputs always give the same entry.
- The worker returns
portinside its result, so$json.portisresolvedorno_matchdownstream.registry_versionisnullwhenversionis not a number. entry.payloadis copied as-is from the registry (an empty object when absent); read routing data from it with expressions such as{{ $json.entry.payload.queue }}.- The knowledge resource is read from the backend on every run (10 s timeout). A resource whose status is not
activeis used anyway, with a warning in the log.
Reviewed against the orchestrator code · 31e874b · 2026-11-26