| airlock_read_fileA | Read a local UTF-8 text file and replace secrets and PII with reversible <ENTITY_N> placeholders. Purpose & Behavior:
Reads up to 1 MB of text from `path`, runs two-stage secret/PII detection (deterministic regex plus
contextual NER), stores raw values in the local in-memory session vault, and returns sanitized text
containing session-consistent placeholders such as `<API_KEY_1>`, `<AUTH_TOKEN_1>`, or `<PERSON_1>`.
Does not modify the file on disk.
When to Use:
- Use this instead of native file-read or `cat` commands for `.env`, configuration, log, or source files
that may contain credentials or PII.
- Pair with `airlock_write_file` to update the file on disk with real secrets automatically restored.
- For in-memory strings rather than files, use `airlock_dehydrate` or `airlock_scrub_text`.
Returns:
A JSON-serializable object with `{"path": str, "sanitized_text": str, "redacted_count": int,
"latency_ms": float, "tokens": list[str]}`. Raises a tool error if the file is missing, binary,
exceeds 1 MB, or violates workspace or system-directory guardrails.
|
| airlock_write_fileA | Write UTF-8 text to a local file after restoring every <ENTITY_N> placeholder to its original secret. Purpose & Behavior:
Replaces every `<ENTITY_N>` placeholder in `content` (matching case-insensitively and tolerating inner
whitespace) with its original raw value from the local session vault, creates parent directories if
needed, and overwrites or creates the file at `path`. If `content` contains an unknown or hallucinated
placeholder such as `<API_KEY_999>`, the write is aborted and the target file is left untouched.
When to Use:
- Use after `airlock_read_file` or `airlock_dehydrate` when saving refactored configs, `.env` files, or
code so real credentials are restored on disk without exposing them to the model.
- Do not invent new `<ENTITY_N>` numbers that were not returned earlier in the session. Call
`airlock_vault_status` if unsure which tokens exist.
Returns:
A JSON-serializable object with `{"status": "written", "path": str, "restored_tokens": list[str]}` on
success, or `{"status": "error", "error": "unresolved_tokens", "unresolved_tokens": list[str],
"path": str}` when the write is blocked. Raises a tool error for path or workspace guardrail violations.
|
| airlock_execA | Run a local subprocess with .env credentials injected and scrub secrets/PII from its output. Purpose & Behavior:
Executes `command` directly via `subprocess.run(..., shell=False)` with a 30-second timeout inside the
allowed workspace. If `env_file` is provided, parses `KEY=VALUE` pairs, injects the real unmasked values
into the child process environment, and registers those secrets in the session vault. Before returning,
both `stdout` and `stderr` are scrubbed so printed secrets and stack-trace leaks become `<ENTITY_N>`
placeholders.
When to Use:
- Use this instead of native bash/terminal execution whenever running tests (`pytest`), migrations, or
scripts that need live `.env` credentials or may print sensitive values.
- Pass commands as a tokenized list of strings (`["pytest", "tests/"]`), never as a single shell string.
- Use `airlock_scrub_text` when you only need to sanitize already-captured output without running anything.
Returns:
A JSON-serializable object with `{"exit_code": int, "stdout": str, "stderr": str}` where both streams have
secrets replaced by `<ENTITY_N>` placeholders. Timeouts and launch failures return `exit_code: -1` with a
scrubbed explanatory `stderr`. Raises a tool error for disallowed executables or invalid commands.
|
| airlock_scrub_textA | 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.
|
| airlock_dehydrateA | Convert raw text containing secrets and contextual PII into reversible <ENTITY_N> placeholders. Purpose & Behavior:
Runs both deterministic pattern matching (API keys, JWTs, URI passwords, cards, SSNs, emails, IPs) and
contextual ONNX GLiNER entity recognition (person names, organizations, locations) on `text`. Every
detected span is stored in the local session vault and replaced with a deterministic placeholder such as
`<PERSON_1>` or `<API_KEY_1>`.
When to Use:
- Use `airlock_dehydrate` when you need full-coverage PII plus secret redaction on raw text and plan to
restore original values later via `airlock_rehydrate`.
- Choose `airlock_scrub_text(text, use_ner=False)` instead for sub-millisecond credential/regex scrubbing
of code or logs without loading the neural NER model.
- Choose `airlock_read_file` instead when reading directly from a local file path.
Returns:
A JSON-serializable object with `{"sanitized_text": str, "redacted_count": int, "latency_ms": float,
"tokens": list[str]}`.
|
| airlock_rehydrateA | Restore <ENTITY_N> placeholders in an in-memory string to their original values from the session vault. Purpose & Behavior:
Looks up each `<ENTITY_N>` token in `text` (matching case-insensitively and tolerating extra inner
whitespace such as `< api_key_1 >`) against the current in-memory session vault and substitutes the
original raw string. Tokens that do not exist in the vault are left unchanged. Does not modify the vault.
When to Use:
- Use after `airlock_dehydrate` or `airlock_scrub_text` when an in-memory payload needs its original
values restored.
- WARNING: The response contains raw unmasked secrets. Never call this on `.env` or credential file
contents that should stay hidden from model context. Use `airlock_write_file` instead to restore
secrets directly onto disk without returning them to the agent.
Returns:
A JSON-serializable object with `{"rehydrated_text": str, "restored_count": int}`.
|
| airlock_vault_statusA | Inspect the session vault's token inventory and entity counts without exposing raw secret values. Purpose & Behavior:
Queries the current in-memory `VaultSession` and returns active placeholder token names (e.g.,
`["<API_KEY_1>", "<AUTH_TOKEN_1>"]`), total stored token count, and a breakdown by entity category.
Raw secret strings are never included in the response.
When to Use:
- Call before `airlock_write_file` or `airlock_rehydrate` to verify which `<ENTITY_N>` placeholders are
currently registered, so you do not reference tokens that do not exist.
- Use this instead of `airlock_rehydrate` when you only need token metadata, not raw values.
Returns:
A JSON-serializable object with `{"tokens": list[str], "counts": dict[str, int], "total": int}`.
|