airlock_scrub_text
Sanitizes in-memory text by replacing secrets and PII with reversible <ENTITY_N> placeholders. Use fast regex rules for logs and code, or enable NER to redact names, organizations, and locations.
Instructions
Sanitize in-memory text with reversible <ENTITY_N> placeholders using fast or full detection.
Purpose & Behavior:
Scans `text` for sensitive values, stores original values in the session vault, and replaces them with
`<ENTITY_N>` tokens (e.g., `<API_KEY_1>`). By default (`use_ner=False`), runs deterministic regex and
key-value rules in ~0.2ms for high-speed log/code scrubbing. With `use_ner=True`, also runs the local
ONNX GLiNER model to redact unstructured `PERSON`, `ORGANIZATION`, and `LOCATION` entities.
When to Use:
- Use `airlock_scrub_text(text, use_ner=False)` for fast sub-millisecond scrubbing of terminal logs,
stack traces, or code snippets where credential/token/email/IP redaction is enough.
- Use `airlock_dehydrate(text)` (or `airlock_scrub_text(text, use_ner=True)`) for natural-language
prompts or documents that also contain human names, organizations, or locations.
- Use `airlock_read_file` instead when the text lives in a file on disk.
Returns:
A JSON-serializable object with `{"sanitized_text": str, "redacted_count": int, "latency_ms": float,
"tokens": list[str]}` listing the generated `<ENTITY_N>` placeholders.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"text": "<text>"
},
"name": "airlock_scrub_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Raw in-memory text, log output, or code snippet to sanitize by replacing detected secrets and PII with reversible <ENTITY_N> placeholders. | |
| use_ner | No | When False (default), runs fast deterministic regex and key-value heuristics only (~0.2ms) to catch API keys, tokens, passwords, emails, and IPs. Set to True to also run the ONNX GLiNER neural model (~55ms) for contextual person, organization, and location names. |