This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
backendcritical PriorityID: hyper-v1-h3-zero-copy-dynamic-flow-control

Hyper 1.0 Zero-Copy HTTP/3 Dynamic Flow Control Framing Architecture

Mandates zero-copy chunk framing and dynamic QUIC flow control orchestration across Hyper 1.0 and HTTP/3 streaming pipelines. Eliminates socket buffer amplification, stream starvation, and head-of-line blocking by propagating transport-level backpressure directly into frame encoders without intermediate vector allocations.

Prohibited Anti-Pattern: Naive Vector Buffering and Unbounded Stream Spooling Leading to Bufferbloat and Out-of-Memory Cascade During QUIC Congestion

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Hyper 1.0 Zero-Copy HTTP/3 Dynamic Flow Control Framing Architecture - Mandates zero-copy chunk framing and dynamic QUIC flow control orchestration across Hyper 1.0 and HTTP/3 streaming pipelines. Eliminates socket buffer amplification, stream starvation, and head-of-line blocking by propagating transport-level backpressure directly into frame encoders without intermediate vector allocations.
globs: **/*.rs
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/hyper-v1-h3-zero-copy-dynamic-flow-control"
---

# Hyper 1.0 Zero-Copy HTTP/3 Dynamic Flow Control Framing Architecture

> **Severity**: CRITICAL | **Category**: backend
> **Anti-Pattern Warning**: Naive Vector Buffering and Unbounded Stream Spooling Leading to Bufferbloat and Out-of-Memory Cascade During QUIC Congestion

## System Constraints
You are a Principal Rust Systems Architect specializing in zero-copy I/O, Hyper 1.0, and HTTP/3 transport invariants. Enforce strict memory-bounded streaming, explicit backpressure propagation via QUIC flow-control frames, and zero-allocation frame slicing.

## Strict Guidelines
- Engineers MUST ALWAYS yield reference-counted slices (`bytes::Bytes`) directly through `http_body::Body` and HTTP/3 send streams without re-allocating into intermediate buffers or `Vec<u8>`.
- Engineers MUST NOT decouple consumer read consumption from QUIC stream window grants (`MAX_STREAM_DATA`/`MAX_DATA`); downstream capacity exhaustion must proactively stall upstream producers via `poll_capacity` or async backpressure.
- Services MUST configure explicit QUIC transport flow control windows based on Bandwidth-Delay Product (BDP) rather than relying on unbounded default driver buffering.
- Components NEVER bridge streaming bodies using unbounded channels (`tokio::sync::mpsc::unbounded_channel`); bounded channels sized to the maximum transport frame segment size are required.
- Pipelines MUST intercept QUIC stream cancellations (`STOP_SENDING`, `RESET_STREAM`, and `H3_REQUEST_CANCELLED`) immediately to abort upstream payload generation and recycle memory buffers.

## Bad vs Good Implementations
### HTTP/3 Streaming Body: Unbounded Allocating Reader vs. Zero-Copy Backpressured Stream

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Buffering incoming QUIC payload frames into a reallocating vector decouples transport-layer flow control from service processing. If the network experiences packet loss or jitter, memory usage balloons exponentially (bufferbloat) and upstream senders are never instructed to halt transmission via QUIC window exhaustion.
```rust
use bytes::Bytes;
use http_body_util::combinators::BoxBody;
use http_body_util::{BodyExt, Full};
use hyper::body::Incoming;
use tokio::io::AsyncReadExt;

// ANTI-PATTERN: Ingests the entire stream into dynamic heap allocations,
// breaking QUIC flow-control boundaries and inducing socket buffer amplification.
async fn handle_request(mut incoming: Incoming) -> Result<Full<Bytes>, hyper::Error> {
    let mut aggregated_buffer = Vec::new();
    while let Some(frame) = incoming.frame().await {
        let frame = frame?;
        if let Some(data) = frame.data_ref() {
            // Allocates and copies bytes repeatedly, ignoring stream credit exhaustion
            aggregated_buffer.extend_from_slice(data);
        }
    }
    Ok(Full::new(Bytes::from(aggregated_buffer)))
}
```

#### Production Standard (Correct)
> **Standard**: Passes atomic `Bytes` references directly to the HTTP/3 transport implementation without copying. Backpressure is strictly maintained because chunks are dispatched only when transport flow control capacity is confirmed, preventing memory explosion and enforcing transport-level window updates.
```rust
use bytes::Bytes;
use futures_util::StreamExt;
use h3::quic::SendStream;
use h3_quinn::OpenStreams;
use hyper::body::{Body, Frame};
use std::pin::Pin;
use std::task::{Context, Poll};

// PRODUCTION FIX: Zero-copy chunk streaming preserving QUIC flow control windows
pub struct ZeroCopyH3Stream<S> {
    stream: S,
}

impl<S> ZeroCopyH3Stream<S>
where
    S: SendStream<Bytes> + Unpin,
{
    pub fn new(stream: S) -> Self {
        Self { stream }
    }

    pub async fn send_frame_with_backpressure(
        &mut self,
        chunk: Bytes,
    ) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
        // Await explicit stream credit from the QUIC transport layer
        // before releasing the payload frame, enforcing dynamic flow control
        self.stream.poll_ready(&mut Context::from_waker(futures_util::task::noop_waker_ref()))?;
        self.stream.send_data(chunk)?;
        Ok(())
    }
}
```

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: Hyper 1.0 Zero-Copy HTTP/3 Dynamic Flow Control Framing Architecture

Hyper 1.0 Zero-Copy HTTP/3 Dynamic Flow Control Framing Architecture defines an industrial-grade behavioral standard for backend engineering. Mandates zero-copy chunk framing and dynamic QUIC flow control orchestration across Hyper 1.0 and HTTP/3 streaming pipelines. Eliminates socket buffer amplification, stream starvation, and head-of-line blocking by propagating transport-level backpressure directly into frame encoders without intermediate vector allocations. 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: Naive Vector Buffering and Unbounded Stream Spooling Leading to Bufferbloat and Out-of-Memory Cascade During QUIC Congestion 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 DriftNaive Vector Buffering and Unbounded Stream Spooling Leading to Bufferbloat and Out-of-Memory Cascade During QUIC CongestionCritical
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 yield reference-counted slices (`bytes

Engineers MUST ALWAYS yield reference-counted slices (`bytes::Bytes`) directly through `http_body::Body` and HTTP/3 send streams without re-allocating into intermediate buffers or `Vec<u8>`.

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 NOT decouple consumer read consumption from QUIC stream window grants (`MAX_STREAM_DATA`/`MAX_DATA`)

Engineers MUST NOT decouple consumer read consumption from QUIC stream window grants (`MAX_STREAM_DATA`/`MAX_DATA`); downstream capacity exhaustion must proactively stall upstream producers via `poll_capacity` or async backpressure.

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

Services MUST configure explicit QUIC transport flow control windows based on Bandwidth-Delay Product (BDP) rather than relying on unbounded default driver buffering.

Services MUST configure explicit QUIC transport flow control windows based on Bandwidth-Delay Product (BDP) rather than relying on unbounded default driver buffering.

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

Components NEVER bridge streaming bodies using unbounded channels (`tokio

Components NEVER bridge streaming bodies using unbounded channels (`tokio::sync::mpsc::unbounded_channel`); bounded channels sized to the maximum transport frame segment size are required.

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

Pipelines MUST intercept QUIC stream cancellations (`STOP_SENDING`, `RESET_STREAM`, and `H3_REQUEST_CANCELLED`) immediately to abort upstream payload generation and recycle memory buffers.

Pipelines MUST intercept QUIC stream cancellations (`STOP_SENDING`, `RESET_STREAM`, and `H3_REQUEST_CANCELLED`) immediately to abort upstream payload generation and recycle memory buffers.

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 Hyper 1.0 Zero-Copy HTTP/3 Dynamic Flow Control Framing Architecture critical for AI coding assistants?

Mandates zero-copy chunk framing and dynamic QUIC flow control orchestration across Hyper 1.0 and HTTP/3 streaming pipelines. Eliminates socket buffer amplification, stream starvation, and head-of-line blocking by propagating transport-level backpressure directly into frame encoders without intermediate vector allocations. 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 (Naive Vector Buffering and Unbounded Stream Spooling Leading to Bufferbloat and Out-of-Memory Cascade During QUIC Congestion) 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

Hyper