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

# Blindfold Mode: Privacy-First AI Code Generation

> Blindfold Mode SHA-256 obfuscates your identifiers before any LLM sees them, then reverses the mapping on output to keep proprietary codebases private.

Every time you send code to a third-party LLM — even in a prompt — you are sending your variable names, function names, class names, type names, and the business logic they encode. For a startup, that might be acceptable. For a financial services firm, a medical software company, or any team with genuinely proprietary algorithms, handing identifier names to an external model is a real information security concern. Blindfold Mode solves this by making your code unreadable to the LLM while keeping Kode's output perfectly usable.

## How Blindfold Mode works

Blindfold Mode intercepts all code context before it is submitted to the LLM and replaces every identifier with a deterministic SHA-256-derived code. The mapping is kept entirely on your machine — the LLM never sees your real names.

<Steps>
  ### Obfuscation before submission

  When you run any Kode command with Blindfold Mode enabled, the `Obfuscator` scans every piece of code context using a regex that matches valid identifiers (`[a-zA-Z_][a-zA-Z0-9_]{0,63}`). Language keywords (`package`, `import`, `func`, `var`, `const`, `type`, `struct`, `interface`, and so on) are skipped — only your identifiers are replaced.

  Each identifier is hashed using the formula:

  ```
  ZK<4-digit-code> = SHA-256(salt + ":" + identifier)
  ```

  The first two bytes of the SHA-256 digest are combined to produce a zero-padded 4-digit number, giving codes in the range `ZK0000`–`ZK9999`. For example, your function `calculateMonthlyInterest` becomes something like `ZK4821`. Your class `CustomerLedger` becomes `ZK0934`. The LLM receives code that looks like:

  ```go theme={null}
  func ZK4821(ZK0934 *ZK7712) float64 {
      return ZK0934.ZK1102 * ZK0934.ZK5523
  }
  ```

  ### The mapping stays local

  The `forward` map (`identifier → ZK-code`) and `reverse` map (`ZK-code → identifier`) are held in memory by the `Obfuscator` struct and are never serialized or transmitted. The LLM has no way to reconstruct your original names from the codes it receives.

  ### LLM generates obfuscated patches

  The LLM sees the obfuscated code and generates patches using the same ZK-codes. Because the codes are consistently applied — the same identifier always maps to the same code within a session — the LLM can reason about the code's structure even without knowing what the names mean.

  ### Deobfuscation before verification and application

  After the LLM returns a patch, the `Obfuscator.Deobfuscate()` method reverses every ZK-code back to its original identifier using the reverse map. The restored patch then flows through the normal six-gate verification pipeline with your real identifiers intact. If the patch passes all gates, it is written to disk with your actual, meaningful names.
</Steps>

## Enable Blindfold Mode

Add `blindfold_mode` to the `engine` section of your `.kode/kode.json`:

```json theme={null}
{
  "engine": {
    "blindfold_mode": true
  }
}
```

Blindfold Mode is not currently available as a per-command flag. It is configured at the project level so that all Kode commands in that repository use it consistently.

## Trade-offs

Understanding the trade-offs helps you decide when Blindfold Mode is worth activating.

<CardGroup cols={2}>
  <Card title="Pros" icon="shield-check">
    **Identifiers never leave your machine.** The LLM has zero knowledge of your proprietary function names, class names, type names, or variable names. Even if a provider logs prompts, they contain only opaque ZK-codes.
  </Card>

  <Card title="Cons" icon="triangle-exclamation">
    **Reduced contextual awareness.** Semantic names help LLMs produce better suggestions. `ZK4821` conveys nothing about purpose. The LLM may produce slightly more generic or less idiomatic code compared to unobfuscated mode.
  </Card>
</CardGroup>

The quality reduction is typically small for well-structured code, because the LLM can still reason from structure (types, function signatures, call graphs) even without semantic names. It is most noticeable for tasks that require understanding domain logic, such as adding validation rules to a complex business object.

## Best for

Blindfold Mode is designed for codebases where the identifier names themselves carry material business value:

* **Financial services** — proprietary risk models, pricing algorithms, trading strategies
* **Medical software** — patient data models, clinical decision logic
* **Enterprise SaaS** — billing logic, subscription management, data retention policies
* **Any team with a competitor concern** — when you would not paste your code into a public forum

<Note>
  Comments and string literals are also obfuscated. Because the obfuscator processes your full file content — not just declarations — any identifier-like token inside a comment (e.g., `// Apply the Basel III formula for capital adequacy`) or a string literal is replaced with its ZK-code before LLM submission. This prevents inadvertent disclosure of proprietary methodologies through inline documentation.
</Note>

## Related pages

* [Configuration: `kode.json`](/configuration/kode-json) — full reference for all `.kode/kode.json` settings including `blindfold_mode`
