Appearance
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:
| Requirement | Version | Check |
|---|---|---|
| Node.js | 22.0 or later | node --version |
| npm | 10.0 or later | npm --version |
| Docker | 24.0 or later (for NemoClaw) | docker --version |
| Git | Any recent version | git --version |
| GhostAI account | Free tier or above | Sign 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 openclawVerify the installation:
bash
openclaw --versionYou should see version 2026.3.2 or later. If you're on an older version, upgrade:
bash
npm update -g openclawStart OpenClaw once to initialize its configuration directory:
bash
openclawPress 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-cliVerify:
bash
nemoclaw --versionNemoClaw requires Docker for running sandboxed containers. Make sure Docker is running:
bash
docker infoBootstrap a new sandbox environment:
bash
nemoclaw init my-secure-agent
cd my-secure-agentThis creates a project directory with:
nemoclaw.yaml— Sandbox configurationopenclaw.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
~/.zshrcor~/.bashrcso 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 entitiesghostai_sanitize— Tokenize PII in textghostai_restore— Restore tokenized valuesghostai_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 ghostclawOr via ClawHub:
bash
clawhub install ghostclawVerify it's installed:
bash
openclaw plugins listYou should see ghostclaw in the list with status active.
Step 6: Run the Onboarding Wizard
Start OpenClaw and run the setup command:
bash
openclawThen type:
/ghostclaw setupThe 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-9012The 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 statusExpected 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: 23msFor deeper inspection of any entity:
/ghostclaw explainThis 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:
- Your message → GhostClaw tokenizes PII → LLM sees tokens
- 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 · 23msThis is the Layer 1 feedback. For more detail, use /ghostclaw status (Layer 2) or /ghostclaw explain (Layer 3).
Configure verbosity:
/ghostclaw config feedback verboseOptions: 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.txtAsk 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 DiabetesStep 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 startVerify the policy is enforced:
bash
nemoclaw statusYou should see:
Sandbox: my-secure-agent
Status: running
Network: restricted (2 allowed hosts)
Privacy: GhostClaw active via ghostai-instance.comTroubleshooting
"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 logsto 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 explainfor 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.