airlock_write_file
Writes UTF-8 text to a local file by restoring <ENTITY_N> placeholders from the session vault. Creates parent directories and blocks the write if any placeholder is unknown.
Instructions
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.
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": {
"path": "<path>",
"content": "<content>"
},
"name": "airlock_write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Destination filesystem path where the rehydrated UTF-8 file will be created or overwritten. Parent directories are created automatically; sensitive system directories (.ssh, .aws, .gnupg, .kube) and out-of-workspace paths are blocked. | |
| content | Yes | Full UTF-8 file content to write, containing <ENTITY_N> placeholders (e.g., <API_KEY_1>, <AUTH_TOKEN_1>) from the active session vault that will be restored to their original secret values before writing to disk. |