> ## Documentation Index
> Fetch the complete documentation index at: https://docs.curtly.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Safe Vault

> Deterministic preservation mechanics for code blocks, JSON schemas, and templating tags.

The **Safe Vault** isolates structured syntax, data schemas, and variable placeholders before any compression algorithms run. This guarantees that code syntax, keys, values, and interpolation tags remain byte-for-byte identical in the output.

***

## Processing Flow

```mermaid theme={"dark"}
sequenceDiagram
    participant Input as Input Text
    participant Vault as Safe Vault (Memory)
    participant Pipeline as Cleaning Pipeline
    participant Output as Final Output

    Input->>Vault: 1. Extract Code, JSON, Variables, URLs
    Vault->>Pipeline: 2. Replace with Unique Tokens (__NP_VAULT_N__)
    Pipeline->>Pipeline: 3. Clean Natural Language Scaffolding
    Pipeline->>Vault: 4. Match Vault Placeholders
    Vault->>Output: 5. Rehydrate Exact Original Bytes
```

***

## Protected Token Classes

* **Code Fences & Inline Backticks**: Code blocks (including indentation and language identifiers) and inline code elements are protected.
* **JSON Objects & Schemas**: Valid JSON objects, arrays, and parameter definitions remain structurally intact.
* **Template Variables**: Mustache placeholders (`{{user_id}}`), Jinja2 tags, and custom interpolation markers are isolated from token splitting.
* **URLs & Regular Expressions**: HTTP/HTTPS URLs, query parameters, and regex patterns are preserved without modification.

***

## Verification Example

### Input Text

```text theme={"dark"}
You are a backend engineer. Please note that you must write the following SQL statement:
SELECT id, email, created_at FROM users WHERE active = true ORDER BY id DESC;
Return the result strictly as JSON: {"status": "success", "count": 100}
```

### Compressed Output

```text theme={"dark"}
Role: backend engineer. Write SQL statement:
SELECT id, email, created_at FROM users WHERE active = true ORDER BY id DESC;
Return result as JSON: {"status": "success", "count": 100}
```

The SQL query and JSON payload remain unaltered, while the natural language wrapping is condensed.
