Never-Leak Protocol

The open standard for
AI agent secret governance.

Agents request actions, not secrets.

$ pip install nl-protocol
Quick Example
# Agent requests an action — never sees the secret
request = ActionRequest(
    agent_uri="nl://acme/deployer/1.0.0",
    action=ActionPayload(
        type=ActionType.HTTP,
        template="curl -H 'Auth: Bearer {{nl:api/TOKEN}}' https://api.example.com/deploy",
        purpose="Trigger production deployment",
    ),
)

# System: verify → resolve → isolate → execute → sanitize
response = await provider.process_action(request)
response.status    # → "success"
response.result    # → {exit_code: 0, stdout: "deployed!"}
response.audit_ref # → "sha256:a1b2c3..."
How It Works

Multi-agent governance in action

Watch how the NL Protocol protects secrets across multi-agent pipelines. Agents delegate, execute, and audit — without ever seeing a secret value.

Agent A orchestrator Agent B delegated worker delegation token 1 {{nl:api-key}} {{nl:db-pass}} 2 NL Protocol Boundary 3 Identity Scope Grant Pre-Defense Audit Record Isolation Boundary subprocess - no context leaks {{nl:api-key}} sk-**** {{nl:db-pass}} p@$$*** ⚡ executed in sandbox 4 Vault resolve Clean Result {"status":"success"} {"stdout":"(1 row)"} ✕ secret: NEVER exposed 5 Audit sha256:a1b2 sha256:c3d4 sha256:e5f6 latest result ✓ result ✓
0 Zero-Knowledge

Agents use opaque handles {{nl:...}}, never see secret values. Prompt injection can't exfiltrate what isn't there.

Isolated Execution

Secrets resolved inside sandboxed subprocesses. Memory wiped on exit. No shell expansion, no core dumps.

Immutable Audit

Every action hash-chained with SHA-256. HMAC-signed, tamper-evident. Cryptographically verifiable by anyone.

// The agent sees a handle, never the secret value
action_request({
  "type": "exec",
  "template": "curl -H 'Authorization: Bearer {{nl:api-key}}' https://api.example.com",
  "purpose": "Fetch user profile"
})

// The system resolves, injects, executes in isolation
// Agent receives only the result — never the secret
action_response({
  "status": "success",
  "stdout": "{\"user\": \"alice\", \"plan\": \"enterprise\"}"
})
The Problem

The agent's context is
adversarial territory.

AI agents are gaining the ability to read files, execute code, call APIs, and manage infrastructure. Each capability requires secrets.

Current practice treats agents like human users: secrets are retrieved and placed into the agent's working memory. This is fundamentally unsafe.

  • Any data in an LLM context can be memorized or exfiltrated via prompt injection
  • Agents inherit ambient authority with no per-task scoping
  • Multi-agent delegation multiplies the exfiltration surface
  • Audit trails are mutable, unsigned, and missing agent metadata
The Solution

A protocol where secrets are
architecturally invisible.

NL Protocol shifts the paradigm: agents work with opaque handles ({{nl:...}}), never values.

The system resolves, injects, and executes inside an isolation boundary. The agent gets only the result.

  • Zero-knowledge: secrets never enter the context window
  • Per-agent, per-secret, time-bounded scope grants
  • Delegation tokens with bounded lifetime and use count
  • SHA-256 hash-chained, HMAC-signed, tamper-evident audit
Braincol Vault NL Standard (L1-L5)

The first open-source implementation. Local-first secret manager with MCP server.

vault.braincol.com →
Get Started

Find your path through the protocol

Select your role for a tailored introduction to the Never-Leak Protocol.

Defense in Depth

Seven independent layers of protection

Each level addresses a distinct threat surface. Adopt incrementally — a failure at one layer does not compromise the system if other layers are intact.

1
Agent Identity
Level 1

Cryptographic identity with attestation, lifecycle management, and trust levels (L0-L3).

2
Action-Based Access
Level 2

Agents request actions, not secrets. Scoped grants with time bounds, usage limits, and conditions.

3
Execution Isolation
Level 3

Secrets live only inside isolated subprocesses. No shell expansion, no core dumps, memory wiped on exit.

4
Pre-Execution Defense
Level 4

Command interception, pattern analysis, and anomaly detection before any secret is resolved.

5
Audit Integrity
Level 5

SHA-256 hash-chained, HMAC-signed, tamper-evident audit records for every agent-secret interaction.

6
Attack Detection
Level 6

Real-time behavioral analysis, prompt injection detection, and automated response to threats.

7
Cross-Agent Trust
Level 7

Delegation tokens, trust federation, and result-only propagation across multi-agent pipelines.

Conformance

Adopt incrementally, certify progressively

Three conformance tiers let implementations start simple and grow. Each tier is a strict superset of the previous.

Basic

Levels 1 – 3

Identity, action-based access, and execution isolation. The foundation for any NL-compliant system.

  • Agent Identity Documents (AID)
  • Opaque handle resolution
  • Scope grants with conditions
  • Isolated subprocess execution
  • Result sanitization
Recommended

Standard

Levels 1 – 5

Adds pre-execution defense and immutable audit trails. Required for production environments.

  • Everything in Basic
  • Command interception & analysis
  • Pattern-based anomaly detection
  • SHA-256 hash-chained audit log
  • HMAC-signed audit records
  • Tamper-evident verification

Advanced

Levels 1 – 7

Full protocol with attack detection and cross-agent trust. For enterprise and multi-agent orchestration.

  • Everything in Standard
  • Real-time behavioral analysis
  • Prompt injection detection
  • Delegation tokens
  • Trust federation
  • Result-only propagation
Aligned with OWASP Top 10OWASP LLM Top 10OWASP MCP Top 10OWASP Agentic Top 10RFC 2119RFC 7519 (JWT)RFC 9180 (HPKE)
Wire Protocol

Simple JSON messages,
powerful guarantees

The wire protocol uses JSON over standard transports (HTTP, stdio, WebSocket). Every message is structured, typed, and carries the agent's identity context.

1
Agent sends action request

Template contains opaque handles ({{nl:...}}), typed action, purpose string, and scope context.

2
System resolves and executes

Identity verified, scope evaluated, secrets resolved inside isolation boundary, output sanitized.

3
Agent receives result only

stdout, stderr, exit code — never secret values. Audit record written to hash chain.

Action Request
{
  "version": "1.0",
  "type": "action_request",
  "agent_id": "nl://anthropic/claude-code/4.0",
  "action": {
    "type": "exec",
    "template": "psql postgresql://{{nl:db/user}}:{{nl:db/pass}}@host/mydb -c 'SELECT 1'",
    "purpose": "Health check on production database"
  },
  "scope": {
    "project": "myapp",
    "environment": "production"
  }
}
Action Response
{
  "version": "1.0",
  "type": "action_response",
  "status": "success",
  "result": {
    "exit_code": 0,
    "stdout": "(1 row)\\n 1",
    "stderr": ""
  },
  "audit_ref": "sha256:a1b2c3..."
}
Principles

Built on eight design principles

Zero Trust

No agent, tool, or message is trusted without explicit verification.

Secrets Are Opaque

Agents interact with references, never values. The handle carries no information.

Least Privilege

Agents receive only the permissions necessary to complete a specific task.

Defense in Depth

Security at seven independent layers. One failure doesn't compromise the system.

Auditability

Every action produces an immutable, cryptographically chained record.

Governance First

Who can do what, when, under what conditions — as a first-class concern.

Interoperability

Works across frameworks, model providers, cloud platforms, and topologies.

Correct by Default

Secure behavior is default. Insecure configurations require explicit opt-in.

Join the standard.

NL Protocol is open-source under Apache 2.0. Read the specification, build a conformant implementation, or contribute to the standard.