What is Prompt-scrub? Features, Pricing & Tutorial (2026)

A screenshot showing the Prompt-scrub interface hiding sensitive API keys and code identifiers.
Prompt-scrub
Local-first PII redaction and rehydration tool for LLM prompts and responses.
📅 July 31, 2026|AI Coding AssistantsFree Plan Available
Editorial note: Independently researched from public product pages. No referral link used. Last checked: July 31, 2026.

What is Prompt-scrub?

Prompt-scrub is a local-first PII redaction and rehydration utility designed for LLM prompts and responses. It intercepts sensitive data before it leaves your machine, replacing identifiers with stable placeholders and restoring the original values locally when the model responds.

  • Best For: Developers and privacy-conscious LLM users
  • Pricing: Free and open-source utility
  • Category: AI Coding Assistants
  • Free Option: Yes ✅

The Problem Prompt-scrub Solves

When interacting with cloud-based large language models, developers and technical professionals frequently paste codebases, logs, error stack traces, and configuration files containing sensitive data. Accidental leakage of API keys, internal file paths, telephone numbers, emails, and postal addresses creates severe security and compliance liabilities. Transmitting this raw data to third-party endpoints means losing control over your private information immediately.

Software engineers, system administrators, and security-focused developers suffer most from this accidental exposure during debugging and daily coding workflows. Traditional cloud-hosted proxy services require trusting a third-party intermediary, creating new accounts, and routing traffic through external infrastructure.

Prompt-scrub fixes this by executing entirely on your local machine with zero network round-trips required. It detects identifying content deterministically, swaps findings with stable placeholders to preserve your prompt cache prefixes, and rehydrates the model responses locally after they return.

In this tutorial, you will learn exactly how to use Prompt-scrub — step by step.

How to Get Started with Prompt-scrub in 5 Minutes

  1. Ensure your development environment has Node.js installed on your local machine.
  2. Open your terminal and install Prompt-scrub globally using npm install -g @nanocollective/prompt-scrub or locally inside your project repository.
  3. Verify your installation and inspect a sample text string using the inspect command to check for sensitive data matches.
  4. Run the scrub operation via the CLI or import the scrub and rehydrate methods into your Node.js application scripts.
  5. Test response rehydration with your generated session ID to restore original local values before processing LLM output further.

How to Use Prompt-scrub: Complete Tutorial

Step 1: Installing the Package and Testing the CLI

The fastest way to test Prompt-scrub is via its command-line interface. You can install the package globally or as a project dependency depending on your workflow requirements. Once installed, the inspect command lets you preview detections without writing session files to disk, ensuring you maintain full visibility into what changes.

Execute an inspection on a sample string using your terminal to see how the default detectors behave. The tool outputs matched categories, character positions, and a cryptographic hash of your scrubbed content which verifies byte-stable prompt cache prefixes.

💡 Pro Tip: Always run inspect first before executing any actual scrub operations to verify that your data triggers the expected detectors without altering anything on disk.

Step 2: Scrubbing Prompts via the Node.js Library API

For programmatic use inside custom scripts or coding assistants, import the scrub function from the package. The function accepts either a plain string or an array of message objects containing role and content properties. It evaluates the text against eight built-in detectors including emails, phone numbers, postal addresses, file paths, secrets, and URLs.

When executed, the function replaces each sensitive finding with a category-namespaced placeholder such as Email_1 or Secret_1. It returns an object containing the modified content and a unique session ID which links the request to its corresponding local mapping file stored safely under your operating system configuration directory.

💡 Pro Tip: The session ID points to a local JSON file governed by restrictive permissions. You can override its default storage location by setting the PROMPT_SCRUB_CONFIG_DIR environment variable.

Step 3: Rehydrating Model Responses Locally

After your scrubbed prompt travels to your cloud LLM provider and returns an answer, the placeholders generated earlier will be present in the model's text output. To restore your original local values, pass the response string and the session ID into the rehydrate function.

The rehydrate utility walks through the text, looks up each placeholder in your local session map, and swaps them back with the original private data. If the model happens to hallucinate a placeholder or returns an unknown token from an older session, the tool safely passes it through unchanged and issues a warning.

💡 Pro Tip: Determinism is built into the core logic, meaning identical inputs combined with the same session map will always yield identical scrubbed outputs to keep prompt-cache prefixes stable.

Step 4: Managing Custom Detectors and Rule Packs

If your codebase requires specialized pattern matching beyond the eight default detectors, Prompt-scrub supports extensibility through custom detectors and rule packs. You can pass custom detector objects directly into the library API via the ScrubOptions parameter, allowing them to participate in the same priority and span-length resolution rules.

Alternatively, rule packs distributed as separate npm packages can be declared in your configuration file or package.json. These integrate automatically into your active detector set and can be verified anytime by running the rules list command in your terminal.

💡 Pro Tip: Enable opt-in detectors like name or code-tell when working with internal codenames or proper nouns to capture sensitive project terminology that standard rules might miss.

Prompt-scrub: Pros & Cons

Pros Cons
Runs entirely local with no network round-trips or new accounts required. Requires manual integration via CLI commands or Node.js code files.
Maintains byte-stable prompt-cache prefixes using deterministic replacements. Restricted exclusively to Node.js technical environments.
Handles both outgoing prompts and incoming response rehydration. Proper-noun and name detection are opt-in and require tuning.
Open-source and free community tool built by the Nano Collective. Session mapping files are stored in plaintext JSON in v1.0.0.

Prompt-scrub Pricing: Free vs Paid

Prompt-scrub is a free, open-source Node.js utility built and maintained by the Nano Collective. Because it runs locally on your machine without hosted infrastructure, API billing, or subscription tiers, there are no licensing fees or paid upgrades required to unlock its core features.

Users get full access to all eight built-in detectors, the CLI interface, Node.js library bindings, custom detector injection, and rule pack management entirely for free. The project relies on open-source community contributions rather than commercial paywalls.

👉 Check the latest pricing on the official Prompt-scrub website or GitHub repository.

Who is Prompt-scrub Best For?

For privacy-conscious developers: The tool ensures that accidental credentials, private API keys, and local file paths never leave your workstation when querying cloud-hosted language models.

For Node.js engineers: It provides a lightweight, scriptable library and CLI wrapper that integrates smoothly into existing development workflows, build scripts, and local agentic loops.

For cache-sensitive teams: The deterministic placeholder replacement engine preserves provider prompt-cache prefixes, saving token costs while maintaining high security hygiene.

Who Should Not Use Prompt-scrub?

Prompt-scrub is not suitable for non-technical users who require graphical user interfaces or cross-platform desktop applications outside of Node.js environments. Because the utility operates strictly via the command line or JavaScript imports, teams working exclusively in Python, Go, or web-based chat panels will find direct integration impractical without custom wrappers.

Additionally, users seeking total anonymity should look elsewhere. Prompt-scrub provides content-layer defense against identifier leaks; it does not protect your IP address, network headers, request timing, or stylistic writing patterns. If your local machine is compromised, local session maps written in plaintext JSON can also be read by unauthorized actors.

Alternatives to Prompt-scrub

Hosted privacy proxies route your LLM traffic through third-party servers to filter PII remotely.

Enterprise data loss prevention tools offer centralized policy enforcement across corporate endpoints.

Custom regex scripts allow developers to manually write basic search-and-replace filters for specific secrets.

Despite these alternatives, Prompt-scrub remains the preferred choice for engineers wanting a fast, open-source, local-first utility that handles both prompt scrubbing and response rehydration without depending on external accounts or network hops.

How We Evaluated Prompt-scrub

This tutorial and evaluation are based strictly on the official Nano Collective product release notes, public repository documentation, feature specifications, and threat model guidelines published for version 1.0.0. No speculative claims or unverified hands-on benchmarks were added.

Final Verdict: Is Prompt-scrub Worth It?

Prompt-scrub is an exceptionally practical, transparent open-source utility that solves a very real developer pain point without introducing subscription costs or third-party trust dependencies. For anyone writing code with LLMs on a Node.js stack, installing it is a smart addition to your security posture.

Our Rating: 9/10 — An essential, zero-cost local utility for developers wanting reliable prompt redaction and response rehydration.
Visit Prompt-scrub →Opens official website · No referral link

Frequently Asked Questions

Is Prompt-scrub free to use?
Yes, Prompt-scrub is a free and open-source utility designed for developers and privacy-conscious LLM users.
How does Prompt-scrub protect sensitive data in LLM prompts?
Prompt-scrub intercepts sensitive data locally before it leaves your machine, replacing identifiers with stable placeholders and restoring the original values when the model responds.
Who benefits the most from using Prompt-scrub?
Software engineers, system administrators, and security-focused developers who frequently paste codebases, logs, and config files into cloud-based large language models benefit the most.

🔗 Related AI Tool Tutorials

📋 Disclosure: This is an independent tutorial based on Prompt-scrub's publicly available documentation and website content as of July 31, 2026. GitNeural is not affiliated with, sponsored by, or endorsed by Prompt-scrub or nanocollective.org. Pricing and features may have changed — always verify on the official Prompt-scrub website.