systemone

The enterprise System 1 Gateway for TypeSafe Jev in n8n: sub-80ms calibrated classification, 3-tier physical routing, AI agent guardrails, and Universal LLM fallback powered discretely by Vaelis.

Package Information

Released: this month
Downloads: 0 weekly / 0 monthly
Latest Version: 0.2.0
Author: CubicMaldo

Documentation

System 1 Gateway for n8n (TypeSafe Jev)

CI
npm version
License: Apache-2.0
Tests Passing
TypeScript 6.x
n8n Community Node

The Enterprise-Grade System 1 Gateway for TypeSafe Jev & Cognitive AI in n8n workflows.
Sub-80ms calibrated classification, 3-tier physical routing, AI agent guardrails, and Universal LLM fallback powered discretely by the high-performance @cubicmaldo/vaelis engine.


⚡ The System 1 Architecture Axiom

"Classify in <80 ms, route deterministically in code, and delegate to heavy generative LLMs only by exception."

Standard LLM nodes (GPT-4o, Claude 3.5 Sonnet, Gemini Pro) are slow (1,500 - 4,000 ms) and expensive ($3 - $15 / million tokens) when used simply to categorize incoming data, check policies, or route tickets.

n8n-nodes-systemone brings System 1 Models (TypeSafe Jev) directly to your n8n workflows as an industrial-grade Fast-Path Gateway. By leveraging mathematical calibrated probabilities and perimeter defenses, your workflows decide routing in milliseconds, consume 0 LLM tokens for confident operations, and instantly block lethal agent commands.


🚀 Why This Gateway Outperforms Basic Jev Implementations

While basic community nodes (such as n8n-nodes-jev) act as simple single-output HTTP wrappers around the API, n8n-nodes-systemone is an architected safety gateway built for production autonomy:

Capability n8n-nodes-jev n8n-nodes-systemone (System 1 Gateway)
Physical Output Ports Single output or soft switch 3 Distinct Physical Output Ports (High, Medium, Escalate)
Zero-Token Fast-Path ❌ Unconditional LLM token spend ✅ 0 LLM Tokens on deterministic path ($\ge 0.90$ confidence)
Perimeter Static Guardrail ❌ None ✅ Sub-1ms Static Regex Defense (rm -rf, DROP TABLE, etc.)
Prompt Injection Defense ❌ None ✅ Dual-Query Cross-Check & Adversarial Freeze
Universal LLM Fallback ❌ Workflow fails on 429 / outage ✅ Automatic Fallback (Groq, OpenAI, Gemini, Claude, Ollama)
Context Window Bounding ❌ Unbounded payload size ✅ Strict 32k Token / Character Sanitizer
Connection Pooling ❌ New HTTP client per item ✅ In-memory Gateway & Client Connection Pooling
Live Savings Telemetry ❌ None ✅ Computes tokenSavingsPercent & costSavingsEstimateUsd
AI Agent Tool Support Basic tool mode ✅ Native Agent Tool (usableAsTool: true)

🔌 3 Physical Hardware-like Output Ports

Unlike conventional single-output nodes that require cascades of IF/Switch nodes, n8n-nodes-systemone splits execution physically into 3 hardware-like terminals:

flowchart LR
    A[Incoming Item / Agent Command] --> B[System 1 Gateway]
    B -->|minConfidence >= 0.90 & allowed| Port0["🟢 Port 0: High Confidence<br/>(Deterministic: Postgres / HTTP / Stripe)<br/>0 LLM Tokens"]
    B -->|0.65 <= minConfidence < 0.90| Port1["🟡 Port 1: System 2 Ambiguity<br/>(Deep LLM: Claude / GPT-4o / Gemini)"]
    B -->|minConfidence < 0.65 or Lethal/Block| Port2["🔴 Port 2: Escalate & Security Block<br/>(Human-in-the-Loop: Slack / Jira)"]
  1. Port 0 — High Confidence (Deterministic Fast-Path):
    • Activates when allowed: true and calibrated confidence exceeds highThreshold ($\ge 0.90$).
    • Connects straight to deterministic nodes (Postgres, HTTP Request, Stripe, Redis). Consumes 0 LLM tokens and completes in <80 ms.
  2. Port 1 — System 2 Ambiguity (Deep Semantic Reasoning):
    • Activates when confidence is moderate (ambiguityThreshold <= minConfidence < highThreshold, ej. 0.65 a 0.89).
    • Awakes heavy generative models (Claude 3.5 Sonnet, GPT-4o, Gemini 2.5 Flash) only when real semantic deliberation is needed.
  3. Port 2 — Escalate (HITL / Security Block):
    • Activates on security violations (allowed: false), static lethal pattern detection, cross-check dissonance (CROSS_CHECK_DISSONANCE), or low confidence (<0.65).
    • Routes straight to human escalation queues (Slack channel, Jira ticket, PagerDuty).

🛠 Operations

1. interceptToolCall (Perimeter Agent Guardrail)

Designed specifically for autonomous agent workflows (LangChain, AutoGPT, n8n AI Agents):

  • Pre-Guardrail Estático (<1 ms): Intercepts lethal commands (rm -rf, DROP TABLE, TRUNCATE, mkfs, FORMAT, chmod -R 777) in sub-millisecond execution without calling external APIs.
  • Dual-Vector Inspection: Evaluates safety and destructive impact against execution environment (isProduction, role).
  • Telemetry in Item: Returns vaelis.allowed, vaelis.latencyMs, vaelis.routing, and specific sub-decisions.

2. evaluateState (Calibrated Classification & Scoring)

Evaluates any incoming text or JSON against typed questions:

  • choice: Categorical classification (e.g. billing, technical, sales, cancellations).
  • noul: Binary boolean probability (0.0 to 1.0 calibrated likelihood of TRUE).
  • score: Continuous intensity or risk scoring (0.0 to 1.0).
  • Input Flexibility: Reads from plain text, expressions ({{ $json.ticket }}), full input items, or custom JSON.
  • JSON Question Mode: Supports the complete official TypeSafe JSON question schema.

📦 Installation

In your n8n instance:

  1. Go to Settings → Community Nodes.
  2. Click Install.
  3. Enter n8n-nodes-systemone and click Install.

For local development or self-hosted Docker:

cd ~/.n8n/custom
npm install n8n-nodes-systemone
# Or link locally:
cd /path/to/n8n-nodes-systemone
npm link
cd ~/.n8n/custom
npm link n8n-nodes-systemone

🔑 Credentials Setup

  1. In n8n, create a new credential: System 1 (TypeSafe Jev & Fallback) API.
  2. Fill in:
    • Primary Engine Provider: TypeSafe AI (Jev Cloud - Default), Google Gemini Flash, Groq (Llama 3.3), OpenAI (gpt-4o-mini), DeepSeek V3, Anthropic (Claude 3.5 Haiku), or Ollama (Local).
    • API Key: Primary API key for the chosen provider.
    • Custom Endpoint: https://api.typesafe.ai (or your edge proxy/local LLM host).
    • Fallback Strategy:
      • Universal LLM Fallback (default): Resilient fallback to any supported LLM provider (Gemini Flash, Groq, OpenAI, Anthropic, DeepSeek, Mistral, OpenRouter, or Ollama) if the primary engine experiences rate limits (429) or network errors.
      • Deterministic Heuristics: Offline heuristics running in 0 ms with 0 token spend.

📁 Pre-Built Example Workflows

Import these directly into n8n from the examples/ folder:

Example Workflow Description Link
1. Agent Tool Call Guardrail Intercepts agent tool executions, blocks destructive commands in <1 ms, and routes safe queries to DB. examples/1-autonomous-agent-guardrail.json
2. Three-Tier Support Triage High-volume ticket classification with 0-token automated resolution and human escalation. examples/2-three-tier-support-triage.json
3. Prompt Injection Defense Perimeter guardrail against prompt injection and jailbreak before invoking expensive LLMs. examples/3-prompt-injection-perimeter-defense.json

🧪 Testing & Verification

The package includes a comprehensive automated test suite testing the 3 physical ports, sub-1ms lethal command guardrails, state sanitization, and universal fallback:

# Transpile TypeScript and copy icons
npm run build

# Run automated tests
npm test

# Run linter
npm run lint

Test results:

✔ Node Structure & Metadata (3 outputs, credentials, properties)
✔ Compatibility with Vaelis alias
✔ Motor de Umbrales y Enrutamiento Determinista (Port 0, 1, 2)
✔ Sanitización y Límites de Estado (32k token boundary)
✔ Client Factory & Universal LLM Fallback (Groq / OpenAI / Gemini)
✔ Operación interceptToolCall ("rm -rf /" blocked in 1.3ms)
✔ Operación evaluateState (Structured rules & JSON schema)
✔ Ejecución Integral del Nodo SystemOne (Multi-item physical branch distribution)
19 passed, 0 failed

🛡 Discrete Core Engine

n8n-nodes-systemone utilizes the open-source @cubicmaldo/vaelis SDK as its discrete underlying engine to provide high-performance edge heuristics, state engineering, and mathematical confidence calibration for System 1 architectures.


📜 License

Apache-2.0 © CubicMaldo

Discussion