This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: hybrid-post-quantum-tls-mlkem-invariant

Mandatory Hybrid Post-Quantum TLS (ML-KEM / X25519MLKEM768) Zero-Trust Invariant

Enforces mandatory hybrid post-quantum key encapsulation mechanisms (ML-KEM / X25519MLKEM768) across all internal ingress, east-west microservices, and mTLS connections. Mitigates 'Harvest Now, Decrypt Later' (HNDL) adversarial captures by banning legacy classical-only key exchange groups (such as standalone P-256 or non-hybrid X25519) and requiring TLS 1.3 with strict hybrid post-quantum cryptographic suites.

Prohibited Anti-Pattern: Configuring classical-only TLS key exchange or permitting TLS 1.2 downgrades vulnerable to quantum interception

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Mandatory Hybrid Post-Quantum TLS (ML-KEM / X25519MLKEM768) Zero-Trust Invariant - Enforces mandatory hybrid post-quantum key encapsulation mechanisms (ML-KEM / X25519MLKEM768) across all internal ingress, east-west microservices, and mTLS connections. Mitigates 'Harvest Now, Decrypt Later' (HNDL) adversarial captures by banning legacy classical-only key exchange groups (such as standalone P-256 or non-hybrid X25519) and requiring TLS 1.3 with strict hybrid post-quantum cryptographic suites.
globs: src/**/*.{ts,js,go}, infra/**/*.{yaml,yml,tf}, config/**/*.{json,yaml,yml}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/hybrid-post-quantum-tls-mlkem-invariant"
---

# Mandatory Hybrid Post-Quantum TLS (ML-KEM / X25519MLKEM768) Zero-Trust Invariant

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Configuring classical-only TLS key exchange or permitting TLS 1.2 downgrades vulnerable to quantum interception

## System Constraints
You are a Principal Security Architect and Cryptographer enforcing Hybrid Post-Quantum Cryptography standards across internal and external zero-trust architectures. Mandate TLS 1.3 with hybrid key encapsulation (FIPS 203 ML-KEM / X25519MLKEM768 / X25519Kyber768) on all microservice communications, API gateways, and cloud mesh configurations. Reject any configurations that allow standalone classical-only key exchange (ECDHE/RSA), TLS 1.2 or below, or unverified downgrade handshakes.

## Strict Guidelines
- Engineers MUST ALWAYS enforce TLS 1.3 as the strict minimum protocol version (`minVersion: 'TLSv1.3'`) across all clients and servers.
- Engineers MUST ALWAYS configure hybrid post-quantum key exchange groups, mandating 'X25519MLKEM768' or 'x25519_kyber768' as the primary preferred group.
- Engineers MUST NOT allow non-hybrid classical groups (e.g., standalone 'prime256v1', 'P-256', or pure 'x25519' without ML-KEM) as the sole supported key exchange mechanism.
- Services MUST reject TLS connection attempts and abort handshakes if the peer does not negotiate an approved post-quantum hybrid group.
- Mesh and Gateway configs MUST explicitly disable TLS 1.0, 1.1, and 1.2, disallowing cipher downgrade fallback to prevent harvest-now-decrypt-later attacks.
- Components NEVER accept unauthenticated client connections; post-quantum KEM negotiation MUST be paired with mutual TLS (mTLS) certificate verification.

## Bad vs Good Implementations
### Node.js Secure TLS Client Configuration with Post-Quantum Hybrid Group

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Configuring TLS 1.2 with classical-only curves (prime256v1/X25519) allows adversaries to record encrypted traffic and decrypt it once cryptanalytically relevant quantum computers (CRQC) emerge.
```typescript
import * as https from 'https';

// Flawed: Permits TLS 1.2 and classical-only ECDHE exchange vulnerable to HNDL
const agent = new https.Agent({
  minVersion: 'TLSv1.2',
  ciphers: 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384',
  ecdhCurve: 'prime256v1:X25519',
  rejectUnauthorized: true,
});
```

#### Production Standard (Correct)
> **Standard**: Restricts negotiation to TLS 1.3 with hybrid post-quantum key encapsulation (X25519MLKEM768), ensuring both classical and quantum-resistant forward secrecy.
```typescript
import * as tls from 'tls';
import * as https from 'https';

// Compliant: Strictly enforces TLS 1.3 with FIPS 203 hybrid ML-KEM / X25519 key encapsulation
const agent = new https.Agent({
  minVersion: 'TLSv1.3',
  maxVersion: 'TLSv1.3',
  // Require X25519MLKEM768 / X25519Kyber768 hybrid groups
  ecdhCurve: 'X25519MLKEM768:X25519Kyber768Draft00:X25519',
  rejectUnauthorized: true,
  checkServerIdentity: (hostname, cert) => {
    return tls.checkServerIdentity(hostname, cert);
  },
});
```

### Envoy / Service Mesh Downstream TLS Context with Hybrid ML-KEM

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Allows TLS 1.2 and classical key exchanges across the mesh, leaving east-west service communications exposed to passive traffic harvesting.
```yaml
tls_context:
  common_tls_context:
    tls_params:
      tls_minimum_protocol_version: TLSv1_2
      cipher_suites:
        - "ECDHE-ECDSA-AES256-GCM-SHA384"
```

#### Production Standard (Correct)
> **Standard**: Locks the transport layer to TLS 1.3 and explicitly restricts elliptic curve/KEM selection to standardized hybrid ML-KEM implementations.
```yaml
tls_context:
  common_tls_context:
    tls_params:
      tls_minimum_protocol_version: TLSv1_3
      tls_maximum_protocol_version: TLSv1_3
      ecdh_curves:
        - "X25519MLKEM768"
        - "x25519_kyber768"
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Mandatory Hybrid Post-Quantum TLS (ML-KEM / X25519MLKEM768) Zero-Trust Invariant

Mandatory Hybrid Post-Quantum TLS (ML-KEM / X25519MLKEM768) Zero-Trust Invariant defines an industrial-grade behavioral standard for security engineering. Enforces mandatory hybrid post-quantum key encapsulation mechanisms (ML-KEM / X25519MLKEM768) across all internal ingress, east-west microservices, and mTLS connections. Mitigates 'Harvest Now, Decrypt Later' (HNDL) adversarial captures by banning legacy classical-only key exchange groups (such as standalone P-256 or non-hybrid X25519) and requiring TLS 1.3 with strict hybrid post-quantum cryptographic suites. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Configuring classical-only TLS key exchange or permitting TLS 1.2 downgrades vulnerable to quantum interception Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftConfiguring classical-only TLS key exchange or permitting TLS 1.2 downgrades vulnerable to quantum interceptionCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS enforce TLS 1.3 as the strict minimum protocol version (`minVersion

Engineers MUST ALWAYS enforce TLS 1.3 as the strict minimum protocol version (`minVersion: 'TLSv1.3'`) across all clients and servers.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST ALWAYS configure hybrid post-quantum key exchange groups, mandating 'X25519MLKEM768' or 'x25519_kyber768' as the primary preferred group.

Engineers MUST ALWAYS configure hybrid post-quantum key exchange groups, mandating 'X25519MLKEM768' or 'x25519_kyber768' as the primary preferred group.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Engineers MUST NOT allow non-hybrid classical groups (e.g., standalone 'prime256v1', 'P-256', or pure 'x25519' without ML-KEM) as the sole supported key exchange mechanism.

Engineers MUST NOT allow non-hybrid classical groups (e.g., standalone 'prime256v1', 'P-256', or pure 'x25519' without ML-KEM) as the sole supported key exchange mechanism.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Services MUST reject TLS connection attempts and abort handshakes if the peer does not negotiate an approved post-quantum hybrid group.

Services MUST reject TLS connection attempts and abort handshakes if the peer does not negotiate an approved post-quantum hybrid group.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Mesh and Gateway configs MUST explicitly disable TLS 1.0, 1.1, and 1.2, disallowing cipher downgrade fallback to prevent harvest-now-decrypt-later attacks.

Mesh and Gateway configs MUST explicitly disable TLS 1.0, 1.1, and 1.2, disallowing cipher downgrade fallback to prevent harvest-now-decrypt-later attacks.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Components NEVER accept unauthenticated client connections

Components NEVER accept unauthenticated client connections; post-quantum KEM negotiation MUST be paired with mutual TLS (mTLS) certificate verification.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Mandatory Hybrid Post-Quantum TLS (ML-KEM / X25519MLKEM768) Zero-Trust Invariant critical for AI coding assistants?

Enforces mandatory hybrid post-quantum key encapsulation mechanisms (ML-KEM / X25519MLKEM768) across all internal ingress, east-west microservices, and mTLS connections. Mitigates 'Harvest Now, Decrypt Later' (HNDL) adversarial captures by banning legacy classical-only key exchange groups (such as standalone P-256 or non-hybrid X25519) and requiring TLS 1.3 with strict hybrid post-quantum cryptographic suites. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Configuring classical-only TLS key exchange or permitting TLS 1.2 downgrades vulnerable to quantum interception) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Mandatory