npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-autoverse-multitasking

v2.1.0

Published

Production-grade token, context, and deterministic guardrail optimizer for WhatsApp AI workflows in n8n.

Readme

AutoVerse Multi Tasking for n8n

AutoVerse Multi Tasking is a production-oriented n8n community node for WhatsApp and similar AI-agent workflows. It exposes one node with 15 selectable operations under the Operation dropdown. Its design principle is deliberately conservative: correctness, customer-intent preservation, safety, and context preservation take precedence over token and latency savings.

The package follows n8n’s community-node packaging convention: it starts with n8n-nodes-, declares the node and credential files in the n8n section of package.json, and ships compiled output under dist. [1]

No LLM calls are made by the local guardrail, normalization, pruning, deduplication, language, truncation, prompt, or token-limit operations. The only network-backed path is semantic retrieval, which uses a configured embedding endpoint and PostgreSQL with pgvector. The cache can use Redis or PostgreSQL when configured.

| Package property | Value | |---|---| | Package name | n8n-nodes-autoverse-multitasking | | Version | 2.0.0 | | Main node | AutoVerse Multi Tasking | | Operations | 15, selected one at a time | | Node runtime | Node.js 20.15+ | | n8n target | Modern self-hosted n8n with the Nodes API | | Default error behavior | Continue with an original-input safe fallback |

Installation

Install the ZIP package locally in the custom-node directory of a self-hosted n8n installation. Restart n8n after installing it. For deployments that use a managed image or container, include the package in the image build rather than mutating a running container.

# 1. Copy the delivered archive to the host running n8n.
mkdir -p ~/.n8n/nodes
unzip n8n-nodes-autoverse-multitasking-v2.0.0.zip \
  -d ~/.n8n/nodes/autoverse-multitasking

# 2. Install production dependencies from the extracted package.
cd ~/.n8n/nodes/autoverse-multitasking
npm ci --omit=dev

# 3. Restart the n8n process or container.

For a normal npm-based community-node installation, publish this package to a registry and install n8n-nodes-autoverse-multitasking from the n8n community-node interface. n8n’s guidance requires the package keyword and a node/credential manifest in package.json. [1]

Common behavior and output contract

Every input item remains intact. The node appends operation results at the top level by default or nests them under Output Field if you configure one. It never replaces the original message, prompt, response, customer context, or query unless the workflow deliberately maps a new output downstream.

{
  "message": "شكرا",
  "_autoverse": {
    "operation": "intentRouter",
    "optimized": true,
    "fallback": false,
    "warnings": [],
    "operationHistory": [],
    "flags": {},
    "metrics": {}
  },
  "route": "simple_reply",
  "handled_by_ai": false,
  "intent": "thanks",
  "reply": "العفو، يسعدني مساعدتك."
}

Every execution appends a non-sensitive operation event to _autoverse.operationHistory. Where applicable, it emits estimated metrics rather than falsely claiming exact provider-token values.

| Common control | Purpose | |---|---| | Output Field | Optional validated dot-path that nests the result rather than adding top-level properties. | | Error Handling | Continue with Safe Fallback preserves the original item and marks _autoverse.fallback=true; Fail This Item makes n8n fail the item. | | Debug Mode | Adds operation name, elapsed time, route, selected modules, cache state, and estimated metrics. It omits secrets and strips common credential-like keys. | | Token estimates | Local approximation that handles Arabic, English, and mixed input. It makes no network call and is labelled as estimated. |

Operations

Each node instance executes exactly one operation. Place multiple AutoVerse nodes in sequence only when the workflow benefits from the corresponding transformations.

| # | Operation | When to use it | Main output | |---:|---|---|---| | 1 | Intent Router | Before an AI agent to handle only safe greetings, thanks, acknowledgements, confirmations, emoji-only, and empty inputs. Anything uncertain routes to AI. | route, handled_by_ai, intent, optional reply | | 2 | Semantic Knowledge Retriever | Before an AI agent when retrieving static policies, product knowledge, FAQs, or documentation. | retrieval.matched, results, compact context, similarity | | 3 | Dynamic System Prompt Trimmer | When a prompt is stored as deterministic modules such as CORE, PRICING, and ORDERS. | system_prompt, selected_modules, estimated tokens | | 4 | Conversation Memory Summarizer | When a conversation exceeds its token threshold. It retains recent turns, deterministic facts, and a compact summary. | permanent facts, state, summary, recent turns | | 5 | Off-topic / Spam Early-exit Guard | Before AI to detect obvious keyboard noise, repeated characters, punctuation noise, and test input. | is_spam, route, reason | | 6 | Message Buffer Deduplication | Immediately after a webhook to skip an accidental repeated message inside a short window. | is_duplicate, route | | 7 | Customer Context Pruning | Before an AI call to reduce unnecessary CRM fields and avoid needless sensitive context. | customer_context, removed fields, estimated savings | | 8 | Max Output Token Optimizer | Before a model call to calculate a recommended cap appropriate to simple, normal, complex, or tool output. | recommendedMaxTokens, reason | | 9 | Response Length Enforcement | After a model response to limit prose safely at sentence or paragraph boundaries. | response, trim status, lengths | | 10 | Response Schema Optimizer | Before structured output, or after it for validation, to define the minimum required object. | JSON Schema and optional validation | | 11 | Language Guard | Before generation to choose Arabic, English, or the configured default without an LLM. | detected and preferred language | | 12 | Foreign Script Guard | After generation to flag unexpected scripts for workflow-level fallback or regeneration. | pass state, foreign scripts, violations | | 13 | Prompt Deduplicator | Before an AI call to eliminate exact and high-overlap prompt instructions while preserving conflicts. | deduplicated prompt, removed duplicates, conflicts | | 14 | Query Normalizer | Before retrieval, intent routing, or cache lookup to return a conservative normalized query copy. | original query, normalized query, changes | | 15 | Tool Result Cache | Around tool calls when the same conversation, tool, and normalized arguments can safely reuse a TTL-bounded result. | cacheHit, cached result, storage state |

1. Intent Router

Set Message Field to the webhook’s message field and Conversation ID Field to a stable chat identifier. The router only returns simple_reply for the explicitly supported trivial classes. A message such as تمام، السعر كام؟ has a business signal and always goes to ai_agent. Configure Reply Variants (JSON) with arrays to reduce repeated boilerplate. non_repeating rotates variants by conversation; deterministic selects a stable variant from the conversation and intent.

{
  "greeting": ["أهلاً بك، كيف يمكنني مساعدتك؟", "مرحباً، كيف أقدر أساعدك؟"],
  "thanks": ["العفو، يسعدني مساعدتك.", "تحت أمرك دائماً."]
}

2. Semantic Knowledge Retriever

This operation is for static knowledge only. Do not use it as a substitute for current inventory, order status, payment state, private customer data, real-time availability, or dynamic pricing unless the source and TTL policy explicitly make the data safe for this use.

It normalizes the workflow query upstream if available, obtains an embedding from the configured OpenAI-compatible endpoint, and executes a parameterized pgvector cosine-similarity query. Table names are identifier-validated and quoted; values are parameterized; vectors are checked for finite numeric values and reasonable dimension. The node returns no context on a miss so the agent can answer normally.

{
  "retrieval": {
    "matched": true,
    "results": [{"id": 12, "content": "Delivery takes 2–4 business days.", "similarity": 0.93}],
    "context": "Delivery takes 2–4 business days.",
    "similarity": 0.93
  }
}

3. Dynamic System Prompt Trimmer

Provide Prompt Modules (JSON) such as CORE, GENERAL, PRICING, PRODUCTS, ORDERS, and DELIVERY. CORE is selected first. The operation selects other modules through deterministic intent-string rules; it does not call an LLM to decide which prompt to include. Unmapped intent falls back to CORE plus GENERAL, and an empty prompt is never deliberately emitted.

4. Conversation Memory Summarizer

Use an array of { role, content } turns. The operation does nothing below Summary Trigger Tokens (Estimated). Above the threshold, it retains the configured Maximum Recent Turns, derives limited deterministic facts, keeps the existing summary, and caps summary size. A phrase such as ممكن أطلب 3؟ becomes requested_quantity=3; it is never upgraded to confirmed quantity absent explicit confirmation.

The implementation intentionally has no hidden automatic LLM summarization. If you want an LLM-based summary, route the compact candidate through a separately controlled low-cost model in the workflow, then pass the output back as Existing Summary Field.

5–7. Guards, deduplication, and context

The spam guard is intentionally conservative. Obvious junk may follow the configured Block, Reply, Ignore, or Pass to AI behavior, but short legitimate questions such as بكام؟, فين طلبي؟, and ممكن؟ remain AI-bound. Deduplication uses the selected message-ID or normalized-content key in a bounded time window; it will not suppress a later intentional repeat outside that window. Context pruning supports conservative removal of clearly internal metadata, an explicit allowlist, or an explicit blocklist; required fields always win.

8–10. Output controls

The maximum-token operation returns a recommendation only. A max token cap is not a promise that the model’s response will have that exact length. Response length enforcement detects valid JSON and preserves it by default rather than corrupting structured output. For prose, it prefers a complete sentence, then a paragraph boundary, and only hard-truncates when no safer boundary exists. Schema optimization never creates requests for model reasoning, internal thought, or chain-of-thought; fields such as reasoning, internalThought, and debug are identified as unnecessary defaults.

11–14. Language, scripts, prompts, and query normalization

Language guard detects Arabic and Latin character counts locally and applies the selected dominant/default policy. Foreign Script Guard ignores URLs and emails before inspecting text, then returns requiresFallback: true if it finds disallowed scripts. It does not delete or alter the response. Prompt Deduplicator removes exact or high-overlap statements but reports potential conflicting language directives instead of choosing a winner. Query Normalizer retains the original query and normalizes only safe Unicode, Arabic variant, whitespace, punctuation, and excessive-repeat changes; ambiguous words are preserved.

15. Tool Result Cache

The cache key is a SHA-256 hash of conversationId, toolName, and normalized arguments. It supports memory for development, Redis, and PostgreSQL. All cached results require a TTL. Do not cache dynamic payment, order, inventory, availability, or transient-customer results indefinitely.

| Storage | Suitable for | Required credential | |---|---|---| | Memory | Local development or a single n8n process | None | | Redis | Multi-worker or horizontally scaled production | AutoVerse Redis | | PostgreSQL | Durable cache with existing PostgreSQL infrastructure | AutoVerse PostgreSQL |

Credentials and PostgreSQL setup

The node only requests credentials for the operation that needs them.

| Credential | Used by | Fields | |---|---|---| | AutoVerse Embedding API | Semantic Knowledge Retriever | Base URL, API key, model, optional non-secret header JSON | | AutoVerse PostgreSQL | Semantic Knowledge Retriever; PostgreSQL Tool Result Cache | host, port, database, user, password, SSL | | AutoVerse Redis | Redis Tool Result Cache | Redis URL, including optional TLS/password information |

Run the needed sections of migrations/001_autoverse_schema.sql on PostgreSQL. It creates tables with IF NOT EXISTS; it never drops or changes existing application tables. pgvector provides vector data types and nearest-neighbor indexing support; choose the vector dimension and index operator class that match the embedding model selected for the knowledge table. [2]

psql "$DATABASE_URL" -f migrations/001_autoverse_schema.sql

Use TLS for remote PostgreSQL and rediss:// for Redis where supported. Scope database users to only the needed schema, tables, and actions.

Recommended production workflow

Do not enable every operation by default. Measure cost, quality, latency, and false-positive behavior for the specific customer workflow, then add only the operations that solve an observed problem.

WhatsApp Webhook
        ↓
Message Type Filter
        ↓
AutoVerse — Message Buffer Deduplication
        ↓
AutoVerse — Intent Router
        ↓
AutoVerse — Off-topic / Spam Early-exit Guard
        ↓
AutoVerse — Query Normalizer
        ↓
AutoVerse — Semantic Knowledge Retriever (static knowledge only)
        ↓
AutoVerse — Customer Context Pruning
        ↓
AutoVerse — Dynamic System Prompt Trimmer
        ↓
AutoVerse — Conversation Memory Summarizer
        ↓
AI Agent
        ↓
AutoVerse — Response Length Enforcement
        ↓
AutoVerse — Foreign Script Guard
        ↓
WhatsApp Send Message

Observability and metrics

Each operation appends history while preserving prior _autoverse metadata. When an operation changes token-bearing content, its event can contain:

{
  "tokens": {
    "estimatedBefore": 4200,
    "estimatedAfter": 1800,
    "estimatedSaved": 2400,
    "estimatedReductionPercent": 57.14
  }
}

The metrics represent the input to that operation and its output. Because each later node sees prior output, sequential operations do not re-measure against the original pre-pipeline input. Other machine-readable details include llmCallsAvoided, cacheHits, cacheMisses, earlyExits, duplicateMessages, promptModulesRemoved, and contextFieldsRemoved when relevant.

Error handling and security

Safe fallback is the default. A local or infrastructure failure leaves original item fields unchanged and appends a non-sensitive errorCode, such as VALIDATION_FAILED, INFRASTRUCTURE_UNAVAILABLE, or OPERATION_FAILED, under _autoverse. Internal passwords, API keys, access tokens, connection strings, hidden prompts, and model reasoning are not copied into metadata.

Security boundary: This package does not evaluate customer-provided JavaScript, does not execute arbitrary expressions from customer data, validates output field paths, validates and quotes SQL identifiers, parameterizes SQL values, checks vector values, and avoids exposing secrets in debug output.

Performance

Intent routing, spam guarding, message deduplication, customer-context pruning, output-token recommendation, response enforcement, language guarding, foreign-script detection, prompt deduplication, and query normalization run locally. Semantic retrieval makes only the minimum required embedding and database calls. The memory cache is intentionally process-local and should not be used as a durable shared production cache.

Limitations

The local estimator is deliberately approximate and does not replace a provider-specific tokenizer. Semantic retrieval depends on an externally configured embedding endpoint, matching pgvector dimensions, knowledge ingestion, and database availability. The package does not include a WhatsApp trigger, does not fetch real-time order/payment/inventory data, and does not automatically regenerate a response that fails Foreign Script Guard; these decisions remain explicit in the n8n workflow. SQL migration execution and cache retention are deployment responsibilities.

Development and testing

npm install
npm run build
npm test
npm run test:integration
npm run lint
npm run pack:check

The automated unit suite includes 396 cases, exceeding the requested 300-case target. It covers the required intent, spam, deduplication, query-normalization, prompt-trimming, memory, pruning, response-enforcement, language, foreign-script, prompt-deduplication, token, tool-cache, and mocked semantic-retrieval boundaries.

PostgreSQL / pgvector integration tests

Run the separate integration suite with the following command:

npm run test:integration

The integration suite is a high-fidelity mocked integration test, not a real PostgreSQL-plus-pgvector binary test. The execution environment used to build this package does not provide Docker or a local PostgreSQL server. It therefore uses pg-mem through its node-postgres adapter, creates and queries real in-memory SQL tables, registers a validated vector-equivalent type, and registers an exact cosine-distance function. The tests execute the store’s parameterized SQL path and verify ordering, threshold filtering, SQL LIMIT, category filtering, identifier/vector rejection before query dispatch, indexer-equivalent upsert round trips, node safe fallback after connection failure, PostgreSQL cache TTL expiry, and SQL prune behavior.

Delta from production: pg-mem does not parse pgvector’s native <=> operator. Production still uses <=> by default. The integration-only harness injects an equivalent registered cosine-distance SQL function so pg-mem can execute the same parameterized selection, filtering, ordering, and limit semantics. pg-mem itself describes its PostgreSQL emulation as experimental and best-effort, so this suite is not a replacement for deployment validation against the exact PostgreSQL and pgvector versions used in production. [3]

For optional manual validation against a real local PostgreSQL + pgvector binary, start a disposable pgvector image, apply the migration, then run your target workflow or an equivalent SQL smoke test:

docker run --rm --name autoverse-pgvector \
  -e POSTGRES_PASSWORD=autoverse \
  -e POSTGRES_DB=autoverse \
  -p 5432:5432 \
  pgvector/pgvector:pg16

export DATABASE_URL='postgresql://postgres:autoverse@localhost:5432/autoverse'
psql "$DATABASE_URL" -f migrations/001_autoverse_schema.sql

Production operators must still verify the selected embedding dimension, pgvector extension version, index/operator class, TLS policy, database permissions, clock synchronization for TTLs, and connection timeout behavior in their own deployment.

References

[1] n8n Docs — Building community nodes

[2] pgvector — Open-source vector similarity search for Postgres

[3] pg-mem — Experimental in-memory PostgreSQL emulation