Skip to content

GhostClaw Full Lab ​

Build a privacy-protected AI agent from scratch using OpenClaw, NemoClaw, and GhostClaw.

This lab walks you through every step — from installing OpenClaw to verifying that PII is tokenized before it ever reaches an LLM. By the end, you'll have a fully functional AI agent running inside a NemoClaw sandbox with GhostClaw enforcing data privacy on every message.


Prerequisites ​

Before you begin, make sure you have:

RequirementVersionCheck
Node.js22.0 or laternode --version
npm10.0 or laternpm --version
Docker24.0 or later (for NemoClaw)docker --version
GitAny recent versiongit --version
GhostAI accountFree tier or aboveSign up at your GhostAI instance or deploy self-hosted

You'll also need a GhostAI API key (starts with gst_). Create one at Settings → API Keys in your GhostAI dashboard, or use a self-hosted instance.


Step 1: Install OpenClaw ​

OpenClaw is the open-source AI assistant that GhostClaw protects. Install it globally:

bash
npm install -g openclaw

Verify the installation:

bash
openclaw --version

You should see version 2026.3.2 or later. If you're on an older version, upgrade:

bash
npm update -g openclaw

Start OpenClaw once to initialize its configuration directory:

bash
openclaw

Press Ctrl+C to exit after you see the welcome prompt. This creates ~/.openclaw/ with the default openclaw.json configuration file.


Step 2: Install NemoClaw CLI ​

NemoClaw provides sandboxed execution environments for OpenClaw agents. Install the CLI:

bash
npm install -g @nvidia/nemoclaw-cli

Verify:

bash
nemoclaw --version

NemoClaw requires Docker for running sandboxed containers. Make sure Docker is running:

bash
docker info

Bootstrap a new sandbox environment:

bash
nemoclaw init my-secure-agent
cd my-secure-agent

This creates a project directory with:

  • nemoclaw.yaml — Sandbox configuration
  • openclaw.json — OpenClaw config (sandbox-specific)
  • policies/ — Network egress policies

Step 3: Configure GhostAI as a Provider ​

Open the openclaw.json in your sandbox directory and add GhostAI as a custom LLM provider. This is the zero-code approach — no plugin installation needed.

json
{
  "models": {
    "providers": {
      "ghostclaw": {
        "api": "openai-completions",
        "baseUrl": "https://your-ghostai-instance.com/v1",
        "apiKey": "${GHOSTAI_API_KEY}",
        "models": [
          "openai/gpt-4o",
          "openai/gpt-4o-mini",
          "anthropic/claude-3.5-sonnet"
        ]
      }
    }
  }
}

Set your API key as an environment variable:

bash
export GHOSTAI_API_KEY="gst_your_key_here"

Tip: Add this to your ~/.zshrc or ~/.bashrc so it persists across sessions.

What this does: Every chat completion request from OpenClaw now routes through GhostAI's /v1/chat/completions endpoint. GhostAI transparently scans for PII, tokenizes it, forwards the clean request to the actual LLM, and restores the tokens in the response. You get the same AI experience with automatic privacy protection.


Step 4: Add GhostAI MCP Tools ​

MCP (Model Context Protocol) tools let the AI agent proactively scan text and files for PII. Add the ghostai-mcp server to the same openclaw.json:

json
{
  "models": {
    "providers": {
      "ghostclaw": {
        "api": "openai-completions",
        "baseUrl": "https://your-ghostai-instance.com/v1",
        "apiKey": "${GHOSTAI_API_KEY}",
        "models": ["openai/gpt-4o", "openai/gpt-4o-mini"]
      }
    }
  },
  "mcp": {
    "ghostai": {
      "command": "ghostai-mcp",
      "env": {
        "GHOSTAI_BASE_URL": "https://your-ghostai-instance.com",
        "GHOSTAI_API_KEY": "${GHOSTAI_API_KEY}"
      }
    }
  }
}

This gives the agent access to four tools:

  • ghostai_detect_pii — Scan text for PII entities
  • ghostai_sanitize — Tokenize PII in text
  • ghostai_restore — Restore tokenized values
  • ghostai_scan_file — Deep-scan files (100+ formats)

Step 5: Install the GhostClaw Plugin ​

For richer integration (slash commands, onboarding wizard, privacy receipts), install the GhostClaw plugin:

bash
openclaw plugins install ghostclaw

Or via ClawHub:

bash
clawhub install ghostclaw

Verify it's installed:

bash
openclaw plugins list

You should see ghostclaw in the list with status active.


Step 6: Run the Onboarding Wizard ​

Start OpenClaw and run the setup command:

bash
openclaw

Then type:

/ghostclaw setup

The wizard walks you through four steps:

Step 1/4: Welcome to GhostClaw

GhostClaw protects your AI conversations by detecting
and tokenizing PII before it reaches any LLM.

Enter your GhostAI API key (starts with gst_):
> gst_abc123...

Step 2/4: Validating...
✓ Connected to GhostAI (14 providers, 127 models available)

Step 3/4: Select your industry vertical
  [1] General (default)
  [2] Healthcare (HIPAA)
  [3] Financial (PCI-DSS, SOX)
  [4] Legal (privilege)
  [5] Government (CUI, ITAR)
  [6] Technology (source code)
> 1

Step 4/4: Test scan
Scanning: "Patient John Smith, MRN 12345, DOB 03/15/1985"

  👤 PERSON: "John Smith" → [PERSON_a1b2] (97%)
  ⚕️ MEDICAL_RECORD: "MRN 12345" → [MRN_c3d4] (95%)
  📅 DATE_OF_BIRTH: "03/15/1985" → [DOB_e5f6] (92%)
  Compliance: HIPAA §164.514

✓ GhostClaw is active. All messages are now PII-protected.
  Type /ghostclaw to see protection status anytime.

Step 7: Send a Test Message with PII ​

With GhostClaw active, send a message that contains sensitive data:

Can you summarize this customer record?
Name: Sarah Johnson
Email: sarah.johnson@acmecorp.com
Phone: (555) 867-5309
SSN: 234-56-7890
Credit Card: 4532-1234-5678-9012

The AI responds normally — it can reference "Sarah" and her details — but behind the scenes, GhostClaw replaced every PII entity with a reversible token before the LLM saw it. The LLM received something like:

Name: [PERSON_x7k2]
Email: [EMAIL_m3p9]
Phone: [PHONE_q1w4]
SSN: [SSN_r8t5]
Credit Card: [CC_n6j3]

Step 8: Verify PII Was Tokenized ​

Check what GhostClaw detected:

/ghostclaw status

Expected output:

🛡 GhostClaw Privacy Receipt
  ├─ 👤 person           ×1  (97%)  → tokenized
  ├─ ✉️  email address    ×1  (98%)  → tokenized
  ├─ 📞 phone number     ×1  (95%)  → tokenized
  ├─ 🔐 SSN              ×1  (99%)  → tokenized
  └─ 💳 credit card      ×1  (97%)  → tokenized
  Compliance: PCI-DSS Req 3, CCPA §1798.140
  Scan time: 23ms

For deeper inspection of any entity:

/ghostclaw explain

This shows the original value, replacement token, detector source, confidence factors, and relevant compliance regulations.


Step 9: Verify Response Restoration ​

Look at the AI's response. It should contain the original values ("Sarah Johnson", the real email, etc.) — not the tokens. GhostClaw automatically calls /v1/detokenize on the response to restore the original values before showing them to you.

The round-trip is:

  1. Your message → GhostClaw tokenizes PII → LLM sees tokens
  2. LLM responds with tokens → GhostClaw restores original values → You see real data

The LLM never saw "Sarah Johnson" or her SSN. But you see the full, readable response.


Step 10: Check the Privacy Receipt ​

After each message exchange where PII was detected, GhostClaw appends a glance badge:

🛡 GhostClaw: 5 items protected · PCI-DSS · 23ms

This is the Layer 1 feedback. For more detail, use /ghostclaw status (Layer 2) or /ghostclaw explain (Layer 3).

Configure verbosity:

/ghostclaw config feedback verbose

Options: auto (default — badge only when PII found), always, verbose, silent.


Step 11: Scan a File for PII ​

Create a test file with sensitive data:

bash
echo "Patient: John Smith, DOB: 03/15/1985, MRN: 12345, SSN: 123-45-6789" > test-patient.txt

Ask the agent to scan it:

Can you scan test-patient.txt for sensitive data?

The agent uses the ghostai_scan_file MCP tool and returns detected entities with types, locations, confidence scores, and compliance tags.

You can also use the slash command for a quick scan:

/ghostclaw scan Patient John Smith, DOB 03/15/1985, diagnosis: Type 2 Diabetes

Step 12: Configure NemoClaw Sandbox Policy ​

Now let's make GhostAI the mandatory inference gateway in your NemoClaw sandbox. Edit policies/network.yaml in your sandbox directory:

yaml
version: "1.0"
egress:
  default: deny
  allow:
    - host: "your-ghostai-instance.com"
      port: 443
      protocol: https
      paths:
        - "/v1/**"
        - "/api/detect"
        - "/api/pii/**"
      methods: [GET, POST]
      description: "GhostAI privacy proxy — all inference routes through here"

    - host: "registry.npmjs.org"
      port: 443
      protocol: https
      description: "npm registry for plugin updates"

This policy denies all outbound traffic except to your GhostAI instance. The agent cannot bypass GhostClaw — every LLM request must go through the privacy proxy.

Start the sandbox:

bash
nemoclaw start

Verify the policy is enforced:

bash
nemoclaw status

You should see:

Sandbox: my-secure-agent
Status: running
Network: restricted (2 allowed hosts)
Privacy: GhostClaw active via ghostai-instance.com

Troubleshooting ​

"Cannot connect to GhostAI" ​

  • Verify your API key: curl -H "Authorization: Bearer gst_your_key" https://your-ghostai-instance.com/v1/models
  • Check the base URL doesn't have a trailing slash
  • If self-hosted, ensure the GhostAI server is running: curl https://your-ghostai-instance.com/health

"Plugin not found" ​

  • Make sure OpenClaw is version 2026.3.2+: openclaw --version
  • Try installing from npm: npm install -g @ghostai/openclaw-plugin
  • Clear the plugin cache: openclaw plugins cache clear

"Docker not running" (NemoClaw) ​

  • Start Docker Desktop or the Docker daemon
  • On Linux: sudo systemctl start docker
  • Verify: docker info

"Network policy blocks everything" ​

  • The default NemoClaw policy is deny-all. You must explicitly allow GhostAI
  • Double-check the hostname and port in policies/network.yaml
  • Use nemoclaw logs to see blocked connection attempts

"PII not detected" ​

  • Check your vertical setting: /ghostclaw config vertical
  • Try increasing sensitivity: /ghostclaw config sensitivity high
  • Some entity types require specific detectors — check /ghostclaw explain for detector info

What's Next ​

You've built a fully protected AI agent stack. Here's where to go from here:

  • Configuration Guide — Deep dive into verticals, sensitivity, failMode, and advanced settings
  • Demo Script — Follow-along demos for showing GhostClaw to customers and stakeholders
  • GhostClaw Whitepaper — Technical deep dive into the architecture and compliance posture
  • GhostAI Docs — Full API reference and feature documentation at your-ghostai-instance.com/docs/

GhostClaw is free and open source. Privacy protection is powered by your GhostAI subscription.

SOC 2 Type II Certified | BAA Available | HIPAA-Ready