<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!DOCTYPE rfc [
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     category="std"
     docName="draft-ruvalcaba-hctp-01"
     ipr="trust200902"
     submissionType="IETF"
     consensus="true"
     obsoletes=""
     updates=""
     xml:lang="en"
     tocInclude="true"
     tocDepth="3"
     symRefs="true"
     sortRefs="true"
     version="3">

  <front>
    <title abbrev="HCTP">The Hash-Chain Context Transfer Protocol (HCTP)</title>
    <seriesInfo name="Internet-Draft" value="draft-ruvalcaba-hctp-01"/>

    <author fullname="Cristian Xavier Ruvalcaba" initials="C.X." surname="Ruvalcaba">
      <organization>Saluca LLC</organization>
      <address>
        <email>cristian@saluca.com</email>
      </address>
    </author>

    <date year="2026" month="November" day="26"/>

    <area>Applications and Real-Time</area>
    <workgroup>Individual Submission</workgroup>

    <keyword>context</keyword>
    <keyword>hash chain</keyword>
    <keyword>synchronization</keyword>
    <keyword>large language model</keyword>
    <keyword>agent</keyword>
    <keyword>delta transfer</keyword>

    <abstract>
      <t>The Hash-Chain Context Transfer Protocol (HCTP) is a payload format and
      synchronization protocol for incrementally transferring an ordered,
      append-only sequence of conversational context between two endpoints over a
      bandwidth-constrained channel. Acknowledged history is represented by a
      single fixed-size rolling hash commitment (the "static root"); only
      not-yet-acknowledged context blocks (the "dynamic window") are transmitted.
      As a result, the per-message wire overhead attributable to history is
      constant and independent of the total number of previously acknowledged
      turns. HCTP is transport-agnostic and carries no confidentiality or peer
      authentication of its own; it is intended to run over a secure transport.
      This document specifies the HCTP data model, wire format, rolling-root
      computation, and synchronization state machine.</t>
    </abstract>
  </front>

  <middle>

    <section anchor="introduction" numbered="true">
      <name>Introduction</name>
      <t>Conversational and agentic systems increasingly need to share an
      evolving record of interaction ("context") between components: between a
      client and a service, between cooperating agents, or between a live process
      and a resumable checkpoint. The naive approach retransmits the entire
      conversation on every exchange, so the wire cost grows without bound as the
      conversation lengthens. This is wasteful on any channel and prohibitive on a
      constrained one.</t>

      <t>HCTP addresses this by partitioning the context into two parts:</t>
      <ul>
        <li>a <strong>static section</strong> of blocks both endpoints have
        acknowledged, represented on the wire by a single 32-octet rolling hash
        (the static root); and</li>
        <li>a <strong>dynamic window</strong> of pending blocks that have not yet
        been acknowledged, which is the only part transmitted.</li>
      </ul>

      <t>Each context block commits to the raw text of one turn via a content
      hash and additionally carries a short semantic summary, so that an endpoint
      may operate on the summary as context without ever receiving the raw text,
      while retaining the ability to verify the block against the raw text if it
      later obtains it (<xref target="verifiable-summary"/>).</t>

      <t>HCTP provides ordering and tamper-evidence through a hash chain. It does
      <strong>not</strong> provide confidentiality, peer authentication, or
      non-repudiation, and its integrity guarantees are meaningful only when it is
      carried over a transport that authenticates the peer and protects the
      payload (<xref target="security"/>). HCTP is deliberately independent of any
      particular transport: it defines the payload octets, and any datagram or
      stream transport MAY carry them.</t>

      <section anchor="scope" numbered="true">
        <name>Scope and Non-Goals</name>
        <t>This document specifies only the transport-agnostic core: the block
        format, the rolling-root commitment, the SYNC/ACK exchange, and the rules
        for advancing the chain. Mechanisms for peer authentication, key
        establishment, message confidentiality, and the specific method by which
        a summary is produced are out of scope and are expected to be supplied by
        the surrounding system.</t>
      </section>
    </section>

    <section anchor="terminology" numbered="true">
      <name>Conventions and Terminology</name>
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
      "OPTIONAL" in this document are to be interpreted as described in BCP 14
      <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
      appear in all capitals, as shown here.</t>

      <dl>
        <dt>Context block:</dt>
        <dd>The unit of context corresponding to one conversational turn
        (<xref target="context-block"/>).</dd>
        <dt>Static root:</dt>
        <dd>A 32-octet rolling hash committing to the ordered sequence of
        acknowledged context blocks.</dd>
        <dt>Dynamic window:</dt>
        <dd>The ordered set of pending context blocks not yet acknowledged by the
        peer.</dd>
        <dt>SYNC:</dt>
        <dd>A packet sent to convey the dynamic window and the current static
        root.</dd>
        <dt>ACK:</dt>
        <dd>A packet sent to acknowledge a SYNC and report the acknowledged
        static root.</dd>
        <dt>Fold:</dt>
        <dd>The operation that advances the static root by incorporating one
        context block (<xref target="rolling-root"/>).</dd>
        <dt>Sender / Receiver:</dt>
        <dd>Roles with respect to a single SYNC exchange. An endpoint MAY act in
        both roles; see <xref target="bidirectional"/>.</dd>
        <dt>Scope instance:</dt>
        <dd>The instance, defined by the layer beneath HCTP, to which one HCTP
        session and all of its state are bound: either one underlying transport
        connection, or one enclosing session defined by the protocol that carries
        HCTP and that can outlive a single connection, for example a session that
        resumes on a new connection (<xref target="transport"/>).</dd>
      </dl>

      <t>All multi-octet integers in this document are unsigned and encoded in
      network byte order (big-endian). Octet strings written as hexadecimal are
      shown for illustration only; on the wire they are raw octets.</t>
    </section>

    <section anchor="data-model" numbered="true">
      <name>Data Model</name>

      <section anchor="context-block" numbered="true">
        <name>Context Block</name>
        <t>A context block is a logical record with the following fields:</t>
        <dl>
          <dt>seq:</dt>
          <dd>An unsigned 32-bit sequence number identifying the block's position
          in the ordered context. Numbering starts at 0, and the block at position
          n carries seq n. The sequence space is per directional chain
          (<xref target="bidirectional"/>): in a bidirectional session each of the
          two chains starts at 0 and is numbered independently, and a one-way
          session has a single chain, which also starts at 0.</dd>
          <dt>role:</dt>
          <dd>A UTF-8 label identifying the originator of the turn (for example
          "user" or "agent"), whose UTF-8 encoding is 1 to MAX_ROLE_LEN
          (<xref target="constants"/>) octets in length. Its interpretation is
          application-defined, and it does not select the chain to which a block
          belongs (<xref target="bidirectional"/>).</dd>
          <dt>content_hash:</dt>
          <dd>The SHA-256 <xref target="RFC6234"/> digest of the UTF-8 encoding of
          the raw turn text, written as exactly 64 ASCII lowercase hexadecimal
          digits.</dd>
          <dt>summary:</dt>
          <dd>A UTF-8 semantic summary of the turn, of at most MAX_SUMMARY_LEN
          (<xref target="constants"/>) Unicode code points, counted after UTF-8
          decoding; a character outside the Basic Multilingual Plane counts as
          one code point.</dd>
        </dl>

        <t>For hashing and for on-the-wire serialization, a context block MUST be
        encoded as the canonical encoding of the block, denoted canonical(B) for a
        block B. canonical(B) is the JSON Canonicalization Scheme
        <xref target="RFC8785"/> serialization of B, and B MUST be a JSON object
        <xref target="RFC8259"/> containing exactly the members "content_hash",
        "role", "seq", and "summary", each present exactly once. Neither
        <xref target="RFC8785"/> nor <xref target="RFC8259"/> assigns a meaning to
        an object with duplicate member names, so a block that repeats a member
        name has no canonical encoding and is not a valid block.</t>

        <t><xref target="RFC8785"/> already fixes the member order, the absence of
        insignificant whitespace, the separators, and the serialization of strings
        and numbers. This document restates those properties, for the specific
        case of a block, in this section and the paragraphs that follow: member
        names in ascending Unicode code point order, which for these four names is
        the same order as the UTF-16 code unit order that <xref target="RFC8785"/>
        uses; no insignificant whitespace; no separators other than a single ","
        between members and a single ":" between a member name and its value; and
        the string and number forms given below. Those restatements introduce no
        requirement that <xref target="RFC8785"/> does not already impose. Should
        a restatement and <xref target="RFC8785"/> ever appear to differ,
        <xref target="RFC8785"/> governs.</t>

        <t>An encoder that produces canonical(B) MUST serialize strings as
        specified in <xref target="RFC8785" section="3.2.2.2"/>: only the
        quotation mark (U+0022), the reverse solidus (U+005C), and the code points
        U+0000 through U+001F are escaped. U+0008, U+0009, U+000A, U+000C, and
        U+000D are written as "\b", "\t", "\n", "\f", and "\r" respectively; every
        other code point in the range U+0000 through U+001F is written as "\u00xx"
        with lowercase hexadecimal digits; every other character appears as its
        UTF-8 octets. In particular, the characters "&lt;", "&gt;", and "&amp;",
        the code points U+2028 and U+2029, and U+007F MUST NOT be escaped, and the
        ASCII-escaped form that writes every character outside U+0020 through
        U+007E as "\uXXXX" MUST NOT be used. These are requirements on the
        encoder. The matching requirement on a receiver, that it reject a received
        SYNC whose octets are not exactly canonical, is stated once in
        <xref target="ingest"/> and is not restated here.</t>

        <t>The value of "seq" MUST be serialized as a JSON number written as
        ASCII digits only: no sign, no leading zeros except for the value 0
        itself, no fraction, and no exponent. This is the form that the number
        serialization of <xref target="RFC8785" section="3.2.2.3"/> gives for a
        value in the range 0 to 4294967295, which is the range of every seq value;
        <xref target="RFC8785"/> is cited as the source of the rule. A spelling
        that departs from that form is not canonical; non-canonical spellings
        include a JSON string, "0.0", "1e0", "-0", and "00".</t>

        <t>The value of "content_hash" MUST be exactly 64 ASCII lowercase
        hexadecimal digits. Any other spelling, including uppercase digits, is
        not canonical.</t>

        <t>No Unicode normalization is applied to "role", "summary", or the raw
        turn text that is hashed into "content_hash". Canonically equivalent but
        octet-different text therefore yields different "content_hash" values
        and, through them, different static roots
        (<xref target="rolling-root"/>); an application that requires
        equivalence MUST normalize before constructing a block.</t>

        <t>All strings in a block MUST be well-formed UTF-8; a string containing
        an unpaired surrogate is not well-formed UTF-8 and is therefore excluded.
        A block is not valid if its "role" is not well-formed UTF-8, if the UTF-8
        encoding of its "role" is shorter than 1 octet or longer than
        MAX_ROLE_LEN octets, or if its "summary" exceeds MAX_SUMMARY_LEN Unicode
        code points. These conditions, together with the spelling rules above,
        are among the conditions on which a received SYNC is rejected, and they
        are applied at the ingest step of <xref target="ingest"/>.</t>

        <t>When blocks are carried together, they form a JSON array: "[" followed
        by the canonical encodings of the blocks separated by single commas,
        closed by "]", with no whitespace. A receiver MUST fold canonical(B)
        rather than the octets it received. The requirement that the received
        octets be exactly the canonical encoding of the array and of each block
        it parses, and every other condition on which a received SYNC is
        rejected, are specified in <xref target="ingest"/>. It follows from that
        requirement, and is not a separate rule, that the octets received for an
        accepted SYNC are the canonical octets of its array, and that a receiver
        which retains a digest of those received octets retains a digest of the
        canonical encoding (<xref target="ingest"/>).</t>
      </section>

      <section anchor="sections" numbered="true">
        <name>Static and Dynamic Sections</name>
        <t>An endpoint maintains, per directional chain
        (<xref target="bidirectional"/>):</t>
        <ul>
          <li>a static root: a 32-octet value initialized to the genesis root
          (<xref target="rolling-root"/>) and advanced only as blocks are
          acknowledged; and</li>
          <li>when it acts as sender on that chain, a dynamic window: an ordered
          list of pending context blocks.</li>
        </ul>
        <t>In a bidirectional session the endpoint pair maintains two chains, one
        per direction, each with its own static root and its own dynamic window,
        and the requirement to maintain both chains applies to such a session
        only. A one-way session has a single chain. An endpoint that only
        receives on a chain keeps no dynamic window for it.</t>
        <t>Acknowledged blocks are never retransmitted; they are represented
        solely by the static root, whose size is constant and independent of the
        number of blocks it commits to.</t>
      </section>
    </section>


    <section anchor="rolling-root" numbered="true">
      <name>Rolling-Root Computation</name>
      <t>The static root is a SHA-256 hash chain over acknowledged blocks. Let
      "||" denote octet-string concatenation and SHA256(x) denote the 32-octet
      SHA-256 digest of x.</t>

      <t>The genesis root is defined as:</t>
      <artwork type="ascii-art"><![CDATA[
  root_0 = SHA256(GENESIS_SEED)
]]></artwork>
      <t>where GENESIS_SEED is the ASCII octet string "hctp-genesis-v1" (15
      octets, no trailing NUL).</t>

      <t>Given a current root R and a block B, folding B advances the root:</t>
      <artwork type="ascii-art"><![CDATA[
  fold(R, B) = SHA256( R || SHA256(canonical(B)) )
]]></artwork>
      <t>The static root after acknowledging blocks B_1, ..., B_n (in order) is
      therefore:</t>
      <artwork type="ascii-art"><![CDATA[
  root_n = fold( fold( ... fold(root_0, B_1) ..., B_{n-1}), B_n )
]]></artwork>

      <t>Because each root embeds every prior acknowledged root, any modification,
      reordering, insertion, or deletion of acknowledged history produces a
      different static root, and the mismatch is detected at the next SYNC
      (<xref target="ingest"/>).</t>
    </section>

    <section anchor="wire-format" numbered="true">
      <name>Wire Format</name>
      <t>HCTP defines two packet types, SYNC and ACK. Every packet begins with a
      1-octet version and a 1-octet packet type. The version specified by this
      document is 0x01.</t>

      <t>This section defines the format of each packet type together with the
      obligations that follow from it for a sender. It defines formats only. The
      conditions under which a receiver rejects a received SYNC are defined once,
      in the single ordered list of <xref target="ingest"/>, and a receiver
      applies them there and nowhere else.</t>

      <section anchor="sync-packet" numbered="true">
        <name>SYNC Packet</name>
        <artwork type="ascii-art"><![CDATA[
  0        1        2        3        4        5        6
  +--------+--------+--------------------------+
  |version | ptype  |          seq             |
  | 0x01   | 0x53   |     (uint32, 4 octets)   |
  +--------+--------+--------------------------+
  |                 static_root                |
  |                 (32 octets)                |
  +--------------------------------------------+
  |               dynamic_len                  |
  |            (uint32, 4 octets)              |
  +--------------------------------------------+
  |         dynamic_data (dynamic_len octets)  |
  |                    ...                     |
  +--------------------------------------------+
  |               combined_hash                |
  |                (32 octets)                 |
  +--------------------------------------------+
]]></artwork>
        <dl>
          <dt>version (1 octet):</dt>
          <dd>MUST be 0x01. The receiver checks this field as part of the framing
          and version check of <xref target="ingest"/>.</dd>
          <dt>ptype (1 octet):</dt>
          <dd>MUST be 0x53 (ASCII 'S') for SYNC. The receiver checks this field in
          the same check.</dd>
          <dt>seq (4 octets):</dt>
          <dd>The sequence number of the last block in the dynamic window carried
          by this SYNC. A sender MUST set it to the seq member of the last block
          encoded in dynamic_data.</dd>
          <dt>static_root (32 octets):</dt>
          <dd>The sender's current static root, i.e., the root over all blocks the
          sender has acknowledged prior to this SYNC.</dd>
          <dt>dynamic_len (4 octets):</dt>
          <dd>The length in octets of dynamic_data. A sender MUST NOT emit a SYNC
          in which dynamic_len is zero.</dd>
          <dt>dynamic_data (dynamic_len octets):</dt>
          <dd>A single zlib <xref target="RFC1950"/> stream, compressed with
          DEFLATE <xref target="RFC1951"/>, whose uncompressed content is the
          array [E_1, ..., E_n] of the canonical block encodings defined in
          <xref target="context-block"/>, in ascending seq order. The array MUST
          contain at least one block. The array MUST be encoded exactly as the
          canonical block array of <xref target="context-block"/>: an opening "[",
          the canonical blocks separated by single commas, and a closing "]", with
          no insignificant whitespace, and no other octets. The compressed stream
          MUST have the FDICT flag (<xref target="RFC1950" section="2.2"/>) clear,
          and it MUST consist of exactly one complete zlib stream that ends at the
          last octet of dynamic_data, so that a truncated stream, a stream
          followed by octets that are not part of it, and two or more concatenated
          streams are all excluded by this definition.</dd>
          <dt>combined_hash (32 octets):</dt>
          <dd>SHA256(static_root || dynamic_data), computed over the static_root
          field and the compressed dynamic_data octets exactly as they appear on
          the wire.</dd>
        </dl>

        <t>The fixed fields of a SYNC total 74 octets, independent of the
        acknowledged-history depth, and the total size of the packet is 74 octets
        plus dynamic_len. The 42 octets that precede dynamic_data are the fixed
        header prefix that a receiver reads first in order to learn dynamic_len
        (<xref target="transport"/>); the 74-octet and 42-octet figures describe
        the same fields and differ only in where they stop. Both values are listed
        in <xref target="constants"/>.</t>

        <t>A sender MUST derive the seq field from the final block of
        dynamic_data, and a retransmission MUST be an octet-identical copy of the
        SYNC it repeats (<xref target="retransmission"/>). Every format
        requirement stated in this subsection is enforced as a rejection condition
        by the receiver at the ingest validation step of <xref target="ingest"/>,
        which is the sole ordered list of the conditions under which a received
        SYNC is rejected.</t>
      </section>

      <section anchor="ack-packet" numbered="true">
        <name>ACK Packet</name>
        <artwork type="ascii-art"><![CDATA[
  0        1        2        3        4        5        6
  +--------+--------+--------------------------+
  |version | ptype  |          seq             |
  | 0x01   | 0x41   |     (uint32, 4 octets)   |
  +--------+--------+--------------------------+
  |                  new_root                  |
  |                 (32 octets)                |
  +--------------------------------------------+
]]></artwork>
        <dl>
          <dt>version (1 octet):</dt>
          <dd>MUST be 0x01.</dd>
          <dt>ptype (1 octet):</dt>
          <dd>MUST be 0x41 (ASCII 'A') for ACK.</dd>
          <dt>seq (4 octets):</dt>
          <dd>The seq of the SYNC being acknowledged, echoed unchanged.</dd>
          <dt>new_root (32 octets):</dt>
          <dd>The receiver's static root after folding in the acknowledged blocks
          (<xref target="ingest"/>).</dd>
        </dl>
        <t>An ACK packet is exactly 38 octets.</t>
      </section>
    </section>


    <section anchor="protocol-operation" numbered="true">
      <name>Protocol Operation</name>

      <section anchor="per-role-state" numbered="true">
        <name>Per-Role State</name>
        <t>The SYNC/ACK exchange is asymmetric, and sender state MUST NOT be
        conflated with receiver state. State is maintained per directional
        chain. A one-way session has a single chain. A bidirectional session has
        two independent chains, and an endpoint pair MUST maintain both for the
        lifetime of the session (<xref target="bidirectional"/>). The chain to
        which a SYNC belongs is determined solely by the channel on which it is
        received, that is, by the direction of transfer within the scope instance
        as established by the layer beneath; the role label never determines the
        chain. For a given directional chain an endpoint
        maintains:</t>
        <t>Receiver state:</t>
        <ul>
          <li>local_root: the current static root;</li>
          <li>last_seen_seq: the seq of the most recently accepted SYNC;</li>
          <li>last_block_seq: the seq of the last block folded into local_root,
          absent if no block has yet been folded;</li>
          <li>has_seen: a boolean, initially false, set to true when the first
          SYNC is accepted;</li>
          <li>ack_cache: a single entry holding the cached ACK, the pre-fold
          root over which that ACK was computed, and the SHA-256 digest of the
          received octets of the SYNC to which that ACK responds. The digest is
          over those octets exactly as received, and those octets are the raw
          received octets. The entry is stored only on the accept path, after
          the ingest validation of <xref target="ingest"/> has established that
          the octets are canonical. The entry is of fixed size, and the
          receiver does not retain the SYNC octets themselves.</li>
        </ul>
        <t>Sender state:</t>
        <ul>
          <li>static_root: the current static root;</li>
          <li>dynamic: the ordered list of pending blocks, frozen while a SYNC
          is outstanding (<xref target="sending"/>);</li>
          <li>a queue holding blocks originated while the dynamic window is
          frozen;</li>
          <li>next_seq: the seq to assign to the next block the sender
          originates. A block receives its seq when it is originated, whether
          it enters the dynamic window at once or waits in the queue, so
          queued blocks already carry consecutive seq values when they are
          promoted;</li>
          <li>pending_seq: the seq of the outstanding, unacknowledged SYNC, if
          any;</li>
          <li>last_acked_seq: the seq of the most recently acknowledged SYNC,
          undefined until the first ACK is accepted;</li>
          <li>the last transmitted SYNC octets, retained for octet-identical
          retransmission (<xref target="retransmission"/>);</li>
          <li>a retransmit timer and a bounded retransmit counter.</li>
        </ul>
        <t>last_acked_seq is undefined until the first ACK is accepted. An
        implementation MAY track that definedness with a separate boolean but
        MUST NOT initialize last_acked_seq to a numeric sentinel. The sender
        holds no cached ACK; an ACK cache is receiver state only.</t>
        <t>The queue is discarded when the outstanding SYNC is abandoned, when a
        fatal session error is declared (<xref target="errors"/>), or when the
        session ends. The sender state is likewise discarded when a session ends
        or a session error is declared (<xref target="errors"/>).</t>
        <t>Sequence numbers are scoped to a single directional chain and start
        at 0, so the chains of a bidirectional session number their blocks
        independently.</t>
      </section>

      <section anchor="sending" numbered="true">
        <name>Sending a SYNC</name>
        <t>To transmit pending context, the sender first determines the part of
        the dynamic window that the SYNC will carry. If the frozen dynamic
        window W fits in a single SYNC within the baselines of
        <xref target="constants"/>, the part is W. Otherwise the part is the
        first part of W that has not yet been acknowledged, as specified by the
        splitting rule below. The sender then:</t>
        <ol>
          <li>computes dynamic_data by serializing the blocks of the part to be
          sent, in ascending seq order, as the canonical block array of
          <xref target="context-block"/> and compressing the result with zlib
          <xref target="RFC1950"/>, with the FDICT flag clear as required by
          <xref target="sync-packet"/>;</li>
          <li>sets combined_hash to SHA256(static_root || dynamic_data),
          computed over the static_root field and the compressed dynamic_data
          octets exactly as they are sent;</li>
          <li>sets seq to the seq of the last block in dynamic_data and records
          that value as pending_seq;</li>
          <li>emits the SYNC packet and starts the retransmit timer when the
          packet is emitted.</li>
        </ol>
        <t>The sender MUST NOT advance its static_root at send time; the root is
        advanced only upon receiving a valid ACK (<xref target="on-ack"/>).</t>
        <t>While pending_seq is set, the sender MUST NOT add, remove, or reorder
        blocks in the dynamic window, except to remove an acknowledged part as
        specified below. Blocks originated during that period MUST be queued
        and admitted to the window only after the ACK for the last part of the
        frozen window is accepted or the outstanding SYNC is abandoned.</t>
        <t>When the frozen dynamic window W does not fit in a single SYNC within
        the baselines of <xref target="constants"/>, the sender MUST divide W,
        in ascending seq order, into consecutive parts P_1, ..., P_k, each
        within those baselines. It sends a SYNC carrying exactly P_1 over the
        current static_root, with pending_seq set to the seq of the last block
        of P_1. On accepting the ACK for that SYNC, the sender folds exactly the
        blocks of P_1 into static_root, removes them from W, sets last_acked_seq,
        clears pending_seq, and then sends the SYNC for P_2 over the new
        static_root, and so on. W stays frozen, with no block added, removed, or
        reordered other than the removal of an acknowledged part, until the ACK
        for P_k is accepted; only then are queued blocks promoted into the
        window. Each part is retransmitted, if needed, under the ordinary rule
        of <xref target="retransmission"/>. The receiver treats each part as an
        ordinary SYNC and never reassembles blocks across SYNC packets.</t>
        <t>The usable size of the underlying channel is the sender's choice and
        is not part of conformance. A sender MAY choose a part smaller than the
        baselines, but it MUST NOT exceed the baselines in a single SYNC.</t>
      </section>

      <section anchor="ingest" numbered="true">
        <name>Receiving a SYNC</name>
        <t>Reject, as used in this document, means that the packet is discarded,
        no state changes, and no response is sent. A rejection is fatal only
        where this section states that it is. Where this section says that a
        packet is discarded without state change, the packet is not processed
        further and no response is sent.</t>
        <t>On receiving a candidate SYNC packet P, the receiver applies the
        following checks in order:</t>
        <ol>
          <li>
            <t>Framing and version. The transport unit MUST satisfy the framing
            rules of <xref target="transport"/>: it MUST contain exactly one
            HCTP packet, and that packet MUST occupy the full length of the
            transport unit. version MUST be 0x01 and ptype MUST be 0x53.
            The receiver MUST compare dynamic_len with its local bound
            (<xref target="constants"/>) before it allocates for or reads
            dynamic_data, and a value above that bound fails this check. A
            packet that fails any part of this check is discarded without any
            state change.</t>
          </li>
          <li>
            <t>Integrity. The receiver MUST recompute
            SHA256(P.static_root || P.dynamic_data) over the fields exactly as
            received and MUST reject the packet if the result does not equal
            P.combined_hash. This rejection is not fatal.</t>
          </li>
          <li>
            <t>Replay. If has_seen is true and P.seq is less than last_seen_seq,
            the SYNC is a replay of already-superseded state and MUST be
            silently discarded.</t>
          </li>
          <li>
            <t>Duplicate. If has_seen is true and P.seq equals last_seen_seq, the
            receiver MUST compute SHA256 over the complete received SYNC octets
            exactly as received and compare the result with the digest recorded
            in ack_cache. If they are equal, the SYNC is a retransmission of an
            already-processed SYNC whose ACK was lost: the receiver MUST resend
            the cached ACK and MUST NOT fold again. If they differ, the SYNC MUST
            be silently discarded. The digest is over the raw received octets;
            canonicality of those octets is not established on this path and is
            not needed for the comparison. Canonicality is established only on
            the accept path, at ingest validation, before the digest is stored.
            The receiver does not compare dynamic_data on this path, and it does
            not retain the SYNC octets themselves.</t>
          </li>
          <li>
            <t>Alignment. If P.static_root does not equal local_root, the
            endpoints disagree on acknowledged history and the receiver MUST
            treat this as a fatal session error (<xref target="errors"/>). This
            is the only check in this list that is fatal.</t>
          </li>
          <li>
            <t>Ingest validation. The receiver decompresses P.dynamic_data
            within the bounds of <xref target="constants"/> and
            <xref target="security"/> and validates the result. The receiver's
            accepted decompressed bound MUST be at least
            MAX_DECOMPRESSED_LEN_BASE and its accepted block bound MUST be at
            least MAX_BLOCKS_PER_SYNC_BASE; the receiver MUST abort
            decompression that exceeds its accepted bounds. The checks are:</t>
            <ul>
              <li>P.dynamic_len MUST be non-zero, and P.dynamic_data MUST contain
              exactly one complete zlib stream, with FDICT zero, that ends at the
              last octet of dynamic_data (<xref target="RFC1950"/>);</li>
              <li>the decompressed octets MUST be exactly the canonical encoding
              of a non-empty array of blocks as defined in
              <xref target="context-block"/>; the receiver MUST produce the
              canonical encoding of the blocks it parses and MUST reject octets
              that differ from that encoding;</li>
              <li>every element MUST be an object carrying exactly the members
              content_hash, role, seq, and summary, each present exactly
              once. A block with duplicate member names has no canonical
              encoding and is invalid;</li>
              <li>each block MUST satisfy <xref target="context-block"/> and
              the limits of <xref target="constants"/>: content_hash MUST be
              exactly 64 ASCII lowercase hexadecimal digits; role MUST be
              well-formed UTF-8 whose encoding is 1 to MAX_ROLE_LEN octets;
              summary MUST be at most MAX_SUMMARY_LEN Unicode code points; and
              seq MUST be serialized as decimal ASCII digits, with no sign, no
              leading zeros except for the value 0 itself, no fraction, and no
              exponent (<xref target="RFC8785" section="3.2.2.3"/>). A receiver
              MUST reject any other spelling of seq, including a JSON string and
              a number with a sign, a leading zero other than the value 0, a
              fraction, or an exponent;</li>
              <li>the seq values MUST be strictly ascending and contiguous,
              starting at last_block_seq + 1, or at 0 when no block has yet been
              folded;</li>
              <li>the seq of the last block MUST equal P.seq.</li>
            </ul>
            <t>Any failure of this step means reject: no fold, no ACK, and no
            state change. The format rules of <xref target="sync-packet"/> are
            enforced here. The ordered list of this section is the sole set of
            SYNC rejection conditions in this document.</t>
          </li>
          <li>
            <t>Accept. The receiver records pre_fold_root = local_root, folds
            each accepted block into local_root in order, folding canonical(B)
            rather than the received octets (<xref target="rolling-root"/>),
            sets last_block_seq to the seq of the last accepted block, sets
            last_seen_seq = P.seq, sets has_seen = true, constructs an ACK with
            new_root = local_root, replaces ack_cache with the entry
            (ACK, pre_fold_root, digest), where digest is SHA256 of the complete
            received SYNC octets exactly as received and is computed after the
            ingest validation above has confirmed that those octets are
            canonical, and sends the ACK. On this accept path last_seen_seq
            equals last_block_seq, because the ingest validation requires the
            packet seq to equal the seq of the last block; the two are kept
            separate because a rejected SYNC may have a packet seq that differs
            from the seq of the last folded block.</t>
          </li>
        </ol>
        <t>Integrity is checked before the duplicate step so that the cached-ACK
        path is never reached with a body that is inconsistent with its own
        combined_hash. The duplicate step compares a digest of the complete
        received SYNC, taken over the octets exactly as received, with the
        cached digest, so the cached-ACK path answers only an exact
        retransmission. A well-formed injected SYNC that carries the cached seq
        but different octets therefore receives silence, not a cached ACK. The
        replay and duplicate checks precede alignment because a retransmission
        carries the pre-fold root, which by construction no longer equals
        local_root. All non-fatal rejections are silent because HCTP/1 defines
        no error packet. A static-root mismatch is fatal and is therefore the
        one observable outcome at the HCTP layer.</t>
        <t>A receiver whose state has just been reset has has_seen false and
        local_root equal to the fixed genesis root. Such a receiver cannot
        distinguish an old first SYNC of a prior session from a new one, and it
        accepts the first SYNC that satisfies the remaining checks however old
        that SYNC may be. This guarantee is wholly the transport's; a receiver
        cannot check it, and a static-root mismatch is the only outcome the
        HCTP layer exposes.</t>
      </section>

      <section anchor="on-ack" numbered="true">
        <name>Receiving an ACK</name>
        <t>On receiving an ACK packet A, the sender:</t>
        <ol>
          <li>discards A without state change if A.seq does not equal
          pending_seq (a stale or duplicate ACK), or if last_acked_seq is
          defined and A.seq is less than or equal to last_acked_seq. When
          last_acked_seq is undefined, the second condition does not apply, so
          an ACK for the first SYNC is processed;</li>
          <li>otherwise computes a candidate root by folding, in ascending seq
          order, each block of the part carried by the outstanding SYNC, which
          is exactly the set of blocks carried by that SYNC, into static_root,
          without modifying any state;</li>
          <li>MUST treat A as a fatal divergence if A.new_root does not equal the
          candidate root (<xref target="errors"/>). The candidate root is not
          committed, and the sender MUST end the session as required by
          <xref target="errors"/> immediately: it MUST NOT send another SYNC or
          process another ACK on that session first. No state is retained after
          the session ends;</li>
          <li>on success commits the candidate root as static_root, removes
          exactly the blocks of the acknowledged part from the dynamic window,
          sets last_acked_seq = A.seq, clears pending_seq, cancels the
          retransmit timer. If the acknowledged part was P_k, so that no part of
          the frozen window remains, it promotes queued blocks into the dynamic
          window; otherwise it sends the SYNC for the next part over the new
          static_root.</li>
        </ol>
      </section>

      <section anchor="retransmission" numbered="true">
        <name>Retransmission and Loss</name>
        <t>If the retransmit timer expires before an ACK is accepted, the sender
        MUST retransmit an octet-for-octet identical SYNC, bearing the
        <strong>unchanged</strong> seq and the <strong>unchanged</strong>
        pre-fold static_root, up to a bounded retransmit count. A single lost ACK
        MUST NOT cause session re-establishment or re-keying: because the
        retransmission is octet-identical, the duplicate rule of
        <xref target="ingest"/> re-elicits the cached ACK without double-folding.
        If a retransmission is corrupted in transit so that its octets differ
        from the cached SYNC, the receiver silently discards it as specified by
        the duplicate check of <xref target="ingest"/>, and recovery from that
        corruption is the responsibility of the transport: TLS and QUIC, for
        example, reject corrupted records before HCTP sees them. HCTP does not
        repair a corrupted packet. Only after the bounded retransmit count is
        exhausted without acknowledgment does the sender signal transport
        failure to the application, at which point it MUST discard all session
        state, including the retained SYNC octets, the retransmit timer and
        counter, the dynamic window, the queue, pending_seq, and
        last_acked_seq. The sender holds no cached ACK.</t>
      </section>

      <section anchor="errors" numbered="true">
        <name>Error Handling and Re-establishment</name>
        <t>A static-root mismatch, whether detected by a receiver at the
        alignment check (<xref target="ingest"/>) or by a sender comparing
        A.new_root against its candidate root (<xref target="on-ack"/>), means
        the endpoints no longer agree on the acknowledged history or on the fold
        of the outstanding window, and cannot be reconciled within HCTP.
        Implementations MUST treat this as a fatal session error and re-establish
        a new session from the fixed genesis root
        (<xref target="rolling-root"/>). HCTP/1 always resets to that fixed root
        and defines no session-specific genesis. HCTP does not define
        reconciliation of divergent chains; such divergence indicates loss,
        reordering that escaped detection at a lower layer, or tampering.</t>
        <t>Session state is scoped to one scope instance
        (<xref target="transport"/>). An endpoint MUST NOT reset HCTP state while
        the scope instance continues; it resets HCTP state only together with the
        end of that instance. Where the scope instance is an enclosing session
        that moves to a new connection, the HCTP session and all of its state
        continue across that move unchanged, and an outstanding SYNC is
        retransmitted octet-for-octet on the new connection
        (<xref target="retransmission"/>). A fatal session error, or exhaustion of
        the retransmit count, ends the HCTP session; where the scope instance is
        an enclosing session, HCTP MUST NOT continue within that instance, and the
        protocol that defines it determines whether that instance is ended or a
        new one is established. A receiver whose state has just been reset cannot
        distinguish an old first SYNC of a prior session from a new one, and
        session freshness, including prevention of whole-session replay,
        therefore rests wholly on the layer beneath
        (<xref target="security"/>). A static-root mismatch is the one
        observable outcome at the HCTP layer.</t>
        <t>When an HCTP session ends, each endpoint MUST discard all sender and receiver state it
        holds for every chain, including local_root, last_seen_seq,
        last_block_seq, has_seen, ack_cache, static_root, dynamic, the queue,
        next_seq, pending_seq, last_acked_seq, the retained SYNC octets, the
        retransmit timer, and the retransmit counter. A later exchange MUST start
        a new session from the fixed genesis root.</t>
        <t>The seq field is a 32-bit unsigned integer. An endpoint MUST NOT assign
        a seq greater than 2^32 - 1 on a chain and MUST end the session before it
        would do so. Chains exceeding 2^32 blocks are not supported. A reset forced by
        seq exhaustion is not caused by loss and does not conflict with the
        single-lost-ACK rule of <xref target="retransmission"/>.</t>
      </section>
    </section>


    <section anchor="bidirectional" numbered="true">
      <name>Bidirectional Synchronization</name>
      <t>When both endpoints originate context concurrently, a single shared
      static root can diverge, because each endpoint would fold blocks in an order
      the other cannot reproduce. HCTP resolves this with per-direction chains:
      the endpoint pair maintains two independent rolling-root chains, one
      advanced solely by folding blocks originated by the first endpoint and
      acknowledged by the second, and the other advanced solely by folding blocks
      originated by the second endpoint and acknowledged by the first. Because
      opposite-direction SYNCs fold into disjoint chains, they cannot diverge.</t>

      <t>The chain to which a SYNC belongs is determined solely by the transport
      direction on which that SYNC is received. Each directional chain
      corresponds to one direction of the underlying transport, and an endpoint
      associates each received SYNC with the chain of the direction in which it
      arrived. The "role" member of a block is an application-defined label
      (<xref target="context-block"/>) and MUST NOT be used to select a chain:
      two implementations that read that label differently would place the same
      block on different chains, and the two chains would then advance over
      different block sequences.</t>

      <t>The seq space is per directional chain, not per session. Each chain
      numbers its blocks independently from 0 (<xref target="context-block"/>), so
      the two chains of a bidirectional session each begin at seq 0, and the
      receiver maintains a separate local_root, last_seen_seq, last_block_seq,
      has_seen and ack_cache for each chain (<xref target="per-role-state"/>).
      Because exactly one endpoint originates the blocks of a given chain, every
      seq value within that chain has a single writer.</t>

      <t>The number of chains a session maintains is the number of directions in
      which context flows. A session in which only one endpoint originates context
      is one-way and has a single chain: the originating endpoint holds sender
      state for it and the other endpoint holds receiver state for it
      (<xref target="per-role-state"/>), and no second chain is instantiated. A
      session in which both endpoints originate context is bidirectional, and the
      endpoint pair MUST maintain both chains for the lifetime of that session;
      each chain is advanced only when the endpoint that receives it accepts a
      SYNC on that chain and acknowledges it, and neither chain substitutes for
      the other. Because the two chains of a bidirectional session must be told
      apart by the direction in which a SYNC arrives, a transport that cannot
      distinguish the two directions cannot carry a bidirectional session
      (<xref target="transport"/>).</t>

      <t>The chains of a session are scoped to one scope instance
      (<xref target="errors"/>). Where several requests or streams are carried
      within one scope instance, they share that single session and its chains
      rather than each starting its own. A new session, and with it new chains
      that start from the genesis root (<xref target="rolling-root"/>), begins
      only when the scope instance ends.</t>

      <t>Per-direction chains are the only synchronization strategy defined by
      HCTP/1. The remainder of this paragraph records a design choice rather than
      a requirement, and it constrains neither an implementation of HCTP/1 nor a
      future version. Serializing all folds onto a single shared chain with a
      single-writer turn-token is deliberately not specified: under such a token,
      the token changes hands when an ACK is transmitted, so a single lost ACK
      transfers it to a peer that has not yet advanced its root, and recovering
      from that state would require the session re-establishment that
      <xref target="retransmission"/> requires a single lost ACK not to cause. A
      future version that reintroduces a token would need to specify its own
      recovery rule.</t>
    </section>


    <section anchor="verifiable-summary" numbered="true">
      <name>Verifiable Summaries (Optional)</name>
      <t>An endpoint that lacks the raw turn text MAY operate using the block's
      summary as its working context. If the endpoint later obtains the raw text,
      it can verify the block by recomputing content_hash from the raw text and
      comparing it to the block's content_hash field.</t>
      <t>Implementations MAY additionally make the summary itself reproducible and
      thus verifiable, rather than merely asserted, by computing it with a fixed,
      pre-agreed deterministic summarization function -- for example a summarizer
      identified by name and version, applied with a fixed prompt or template and a
      deterministic decoding configuration -- such that any party holding the raw
      text and the agreed configuration recomputes the identical summary. This
      document does not mandate any particular summarization function; when
      determinism across heterogeneous implementations cannot be guaranteed, an
      endpoint MAY instead verify a summary under a pre-agreed equivalence
      predicate (for example a canonicalization or a distance threshold). Absent
      such a mechanism, the summary MUST be treated as an unverified assertion.</t>
    </section>

    <section anchor="constants" numbered="true">
      <name>Protocol Constants</name>
      <dl>
        <dt>PROTO_VERSION:</dt><dd>0x01</dd>
        <dt>PTYPE_SYNC:</dt><dd>0x53</dd>
        <dt>PTYPE_ACK:</dt><dd>0x41</dd>
        <dt>GENESIS_SEED:</dt><dd>the ASCII octets "hctp-genesis-v1" (15 octets,
        no trailing NUL)</dd>
        <dt>Hash function:</dt><dd>SHA-256 <xref target="RFC6234"/></dd>
        <dt>Compression:</dt><dd>zlib <xref target="RFC1950"/> / DEFLATE
        <xref target="RFC1951"/>, with the zlib FDICT flag clear
        (<xref target="sync-packet"/>)</dd>
        <dt>MAX_SUMMARY_LEN:</dt><dd>120 Unicode code points, counted after
        UTF-8 decoding and before any normalization, with a non-BMP character
        counting once (<xref target="context-block"/>)</dd>
        <dt>MAX_ROLE_LEN:</dt><dd>64 octets, the maximum length of the UTF-8
        encoding of role; that encoding MUST be well-formed UTF-8 and MUST be at
        least 1 octet (<xref target="context-block"/>)</dd>
        <dt>MAX_BLOCKS_PER_SYNC_BASE:</dt><dd>64 blocks</dd>
        <dt>MAX_DECOMPRESSED_LEN_BASE:</dt><dd>65536 octets</dd>
        <dt>SYNC fixed overhead:</dt><dd>74 octets, being the fixed header
        prefix of 42 octets followed by the 32-octet combined_hash
        (<xref target="sync-packet"/>); the total size of a SYNC is 74 octets
        plus dynamic_len</dd>
        <dt>SYNC fixed header prefix:</dt><dd>42 octets, the fields a receiver
        reads first in order to learn dynamic_len (<xref target="transport"/>)</dd>
        <dt>ACK size:</dt><dd>38 octets (<xref target="ack-packet"/>)</dd>
      </dl>

      <t>MAX_SUMMARY_LEN and MAX_ROLE_LEN are fixed limits on the corresponding
      block members. The format of those members, and the conditions under which
      a received block or SYNC is rejected, are defined once in
      <xref target="context-block"/> and <xref target="ingest"/>; this section
      only fixes their values.</t>

      <t>MAX_BLOCKS_PER_SYNC_BASE and MAX_DECOMPRESSED_LEN_BASE are minimum
      capacities, not maxima. Both apply to a single SYNC packet. Every receiver
      MUST accept at least MAX_BLOCKS_PER_SYNC_BASE blocks and at least
      MAX_DECOMPRESSED_LEN_BASE octets of decompressed output in one SYNC, and
      MAY accept more. The finite bound that a receiver actually enforces MUST
      be at least these baselines, and the receiver MUST abort decompression
      that exceeds that bound (<xref target="security"/>). A sender MUST NOT
      exceed either baseline in a single SYNC; when the pending blocks do not fit
      within them, it MUST divide them into consecutive parts and send each part
      in its own SYNC (<xref target="sending"/>). The usable size of the
      underlying channel is the sender's own choice: it is not a protocol
      constant, and conformance is assessed against the baselines above rather
      than against any particular channel size.</t>

      <t>MAX_DECOMPRESSED_LEN_BASE bounds decompressed output and does not bound
      the length of dynamic_data. No protocol constant bounds dynamic_len: a
      receiver MUST bound it before allocation, that bound is a local matter, and
      a value above the receiver's bound is rejected without allocation
      (<xref target="ingest"/> and <xref target="security"/>).</t>
    </section>


    <section anchor="transport" numbered="true">
      <name>Transport Considerations</name>
      <t>HCTP is transport-agnostic; it defines only the octets of SYNC and ACK
      packets. A SYNC is self-delimiting, since its length is fully determined by
      its fixed fields plus dynamic_len (<xref target="sync-packet"/>), and an ACK
      is a fixed 38 octets (<xref target="ack-packet"/>). A packet MAY be carried
      as a single datagram, a length-framed record on a stream, a WebSocket
      <xref target="RFC6455"/> binary message, or the body of an HTTP request or
      response.</t>

      <t>Each transport unit MUST carry exactly one HCTP packet and no other
      octets. On a datagram transport, one packet per datagram. On a stream
      transport, one packet per length-framed record, the length being that of the
      packet as defined by its fixed fields plus dynamic_len for a SYNC, and 38
      octets for an ACK. A receiver reads the 42-octet fixed header prefix of a
      SYNC first (version, ptype, seq, static_root and dynamic_len), then reads
      exactly dynamic_len octets of dynamic_data followed by the 32 octets of
      combined_hash, and requires the transport unit to end at that octet. The
      42-octet prefix and the 74-octet fixed overhead of
      <xref target="sync-packet"/> measure different spans: 42 octets precede
      dynamic_data, and 74 octets is that prefix plus the 32-octet combined_hash.
      A transport unit that is shorter than the length so derived, or that carries
      octets after combined_hash, does not carry exactly one packet and therefore
      fails the framing and version check of <xref target="ingest"/>. This section
      defines the format of a transport unit; the conditions under which a
      received packet is rejected, and the consequence of each rejection, are
      stated once in <xref target="ingest"/> and are not restated here.</t>

      <t>The directional chain to which a SYNC belongs is determined by the
      transport channel on which it is received, and never by the role member of a
      block, which is application data (<xref target="bidirectional"/>). A
      transport that carries both chains of a bidirectional session therefore MUST
      provide a distinguishable channel for each direction, for example a
      separate connection per direction or an explicit stream mapping. A
      transport that cannot distinguish the two directions, such as a single
      HTTP/1.1 connection carrying requests in both directions, MUST NOT carry
      a bidirectional session; over such a transport a session is necessarily
      one-way and has the single chain described in
      <xref target="bidirectional"/>.</t>

      <t>An HCTP session is scoped to exactly one scope instance. All sender
      state and receiver state is scoped to that instance, and an endpoint
      discards that state only together with the end of the instance
      (<xref target="errors"/>). A reset of HCTP state while the scope instance
      continues is not permitted. Unless the protocol carrying HCTP defines an
      enclosing session and states that HCTP is scoped to it, the scope instance
      is one underlying transport connection. A protocol that scopes HCTP to an
      enclosing session MUST state how the instance is identified, how the
      direction of each SYNC within it is established, and what ends it, and that
      session MUST provide the freshness required by
      <xref target="security"/>. Such a session may move between connections,
      for example by resumption; HCTP state then continues on the new connection
      (<xref target="errors"/>). The session layer of the Agent Transfer Protocol
      <xref target="AGTP-SESSION"/>, which binds a session to its participants
      rather than to a connection, is an example of an enclosing session.</t>

      <t>When HCTP is carried over HTTP and no enclosing session is defined, the
      connection is the scope instance: all requests and all streams carried on
      one connection share one HCTP session and its state, and a new connection
      starts a new session from the fixed genesis root
      (<xref target="rolling-root"/>). A connection that carries requests in both
      directions is limited to a one-way session, for the reason given in the
      preceding paragraph.</t>

      <t>HCTP performs no fragmentation of its own. A sender MUST NOT exceed
      MAX_BLOCKS_PER_SYNC_BASE blocks or MAX_DECOMPRESSED_LEN_BASE octets of
      decompressed output in a single SYNC (<xref target="constants"/>), and when
      the pending blocks would exceed either baseline it MUST split them across
      successive SYNC packets as specified in <xref target="sending"/>. A sender
      MAY additionally cap the size of a SYNC to the usable size of the underlying
      channel. That cap is the sender's own choice: no value for it is defined by
      this document, and it is not part of conformance.</t>

      <t>Each SYNC is validated, folded, and acknowledged on its own. The receiver
      MUST NOT reassemble blocks across SYNC packets (<xref target="ingest"/>),
      and reassembly of a dynamic window spanning more than one SYNC is out of
      scope for HCTP/1.</t>

      <t>Because HCTP supplies no confidentiality or peer authentication, it MUST
      be carried over a transport that provides them where those properties are
      required (<xref target="security"/>).</t>
    </section>


    <section anchor="security" numbered="true">
      <name>Security Considerations</name>
      <t><strong>HCTP is not a secure channel by itself.</strong> The static root,
      combined_hash, and content_hash are computed with an unkeyed hash function.
      They provide tamper-evidence against accidental corruption and against a
      party that cannot forge packets, but they provide <strong>no</strong>
      cryptographic authentication: an active attacker who can inject packets can
      recompute a consistent combined_hash and a consistent chain for any payload
      of the attacker's choosing. Authenticity, integrity against active
      attackers, and confidentiality MUST be provided by the underlying transport
      (for example TLS 1.3 <xref target="RFC8446"/> or QUIC
      <xref target="RFC9000"/>) or by an authenticated-encryption layer that wraps
      the HCTP packet. Absent such a layer, HCTP's integrity guarantees are
      meaningless.</t>
      <t><strong>No non-repudiation.</strong> Either endpoint can construct a
      valid-looking chain from genesis; the chain proves internal consistency, not
      origin. Binding context to a long-term identity requires signatures and is
      out of scope.</t>
      <t><strong>Replay within a session.</strong> The receiver verifies
      combined_hash before it consults any cached state
      (<xref target="ingest"/>), so the cached-ACK path is never reached with a
      body that is inconsistent with its own combined_hash. That ordering does not
      make the digest comparison redundant: an attacker who injects a well-formed
      SYNC carrying the cached seq and a combined_hash recomputed over the
      attacker's own body passes the integrity check and reaches the duplicate
      check, and because its octets differ from those of the accepted SYNC its
      digest differs and the packet is silently discarded. Such an injection
      elicits silence, not the cached ACK. Once integrity holds, a SYNC whose seq
      is lower than last_seen_seq is silently discarded. A SYNC whose seq equals
      last_seen_seq is treated as a retransmission only if the SHA-256 digest of
      its received octets equals the digest recorded in ack_cache; in that case
      the cached ACK is resent and no block is folded twice, and in every other
      case the SYNC is silently discarded. The digest is taken over the octets
      exactly as received. Canonicality of those octets is established only on the
      accept path, where the digest that is stored was computed after the ingest
      validation of <xref target="ingest"/> had confirmed it, so the duplicate
      check on the earlier path compares raw received octets against a digest of
      raw received octets. The cache holds the pre-fold root, the ACK, and that
      digest, so its size is constant and does not grow with the size of the SYNC
      that was accepted, and the receiver does not retain the SYNC octets
      themselves. Because the comparison covers the whole received packet,
      dynamic_data included, the receiver itself verifies the property on which
      the cached-ACK path depends instead of assuming that the peer retransmits
      faithfully. A retransmission that is corrupted in transit yields a different
      digest and is silently discarded; recovery from such corruption is the
      responsibility of the transport, since TLS and QUIC reject corrupted records
      before HCTP sees them. The static-root alignment check then rejects
      out-of-context injection. Every non-fatal rejection is silent and leaves
      state unchanged, so an injected packet elicits no response at the HCTP layer
      that could be used as an oracle. The fatal case is not silent: a static-root
      mismatch tears down the session, and an attacker able to observe that
      teardown learns that the injected packet reached the alignment check.
      Silence is not a substitute for transport authentication either, and an
      attacker able to observe the legitimate peer's traffic can still correlate
      its responses with the packets it sent.</t>
      <t><strong>Session freshness.</strong> HCTP/1 defines one fixed genesis root
      and no session identifier and no session-specific genesis. Whole-session
      replay is therefore not detectable at the HCTP layer, and freshness is the
      responsibility of the layer beneath. An endpoint resets HCTP state only
      together with the end of the scope instance (<xref target="transport"/>); a
      reset while that instance continues is not permitted. A receiver whose state has just been reset has
      has_seen false and so skips the replay and duplicate checks entirely, and it
      accepts the first SYNC that satisfies the remaining checks however old that
      SYNC may be. Such a receiver cannot tell an old first SYNC of a previous
      session from a new one: after the reset, local_root is the fixed genesis
      root, and the first SYNC of any prior session also carries that root, so the
      alignment check does not separate the two. The guarantee against that replay
      is wholly supplied by the layer beneath, and it is bounded only by the
      freshness of the scope instance; the one outcome a receiver can observe at
      the HCTP layer is a static-root mismatch. Endpoints MUST carry HCTP within a
      scope instance whose layer provides freshness, for example a fresh TLS
      session or an enclosing session bound to authenticated participants, and
      MUST discard all session state, both the sender state and the receiver state
      enumerated in <xref target="per-role-state"/>, when the scope instance ends
      (<xref target="errors"/>). A later exchange MUST start a new session from
      the fixed genesis root. Because state continues while an enclosing session
      moves between connections, a SYNC replayed onto a new connection of the same
      instance meets the replay and duplicate checks of
      <xref target="ingest"/> rather than a reset receiver.</t>
      <t><strong>Decompression resource exhaustion.</strong> dynamic_data is
      attacker-influenced compressed input. A receiver MUST bound the maximum
      accepted decompressed size and the maximum number of blocks per SYNC, and
      MUST abort decompression that exceeds those bounds, to avoid a decompression
      "bomb" denial of service. dynamic_len itself MUST be bounded before
      allocation, against the same accepted bound the receiver enforces on
      decompressed output. Every receiver MUST accept at least the baseline limits
      MAX_BLOCKS_PER_SYNC_BASE (64 blocks) and MAX_DECOMPRESSED_LEN_BASE (65536
      octets) per SYNC and MAY accept more (<xref target="constants"/>); the
      accepted bound a receiver enforces MUST be at least those baselines, and a
      bound below them does not conform to this document. A sender MUST NOT exceed
      those baseline limits, and when the pending blocks would exceed them it MUST
      send them as successive SYNC packets under the sequential-part procedure of
      <xref target="sending"/>. A receiver MUST reject dynamic_data that is
      truncated, that sets FDICT, or that carries octets past the end of the zlib
      stream (<xref target="ingest"/>). Those checks bound the input octets the
      decompressor consumes; they do not bound its output, and the output bound is
      enforced separately during decompression by aborting once the decompressed
      octets exceed the receiver's accepted limit or the block count exceeds its
      accepted maximum.</t>
      <t><strong>Confidentiality of summaries.</strong> A block's summary may
      reveal the semantic content of a turn even though the raw text is not sent.
      Where the summary is sensitive, the transport MUST encrypt the packet. The
      content_hash likewise permits confirmation of a guessed plaintext; where raw
      texts are low-entropy or guessable, this MUST be considered.</t>
      <t><strong>Hash agility.</strong> This version fixes SHA-256 and a fixed
      genesis seed. Collision resistance of the chain rests entirely on SHA-256. A
      future version of the protocol (indicated by the version octet) may specify
      an alternative hash; endpoints MUST reject versions they do not implement.</t>
    </section>


    <section anchor="iana" numbered="true">
      <name>IANA Considerations</name>

      <section anchor="iana-ptype" numbered="true">
        <name>HCTP Packet Type Registry</name>
        <t>IANA is requested to create a new registry, "HCTP Packet Types", with a
        1-octet unsigned integer identifier space, under a to-be-assigned
        HCTP-protocol registry group. The registration policy is "Specification
        Required" <xref target="RFC8126"/>. The initial contents are:</t>
        <table>
          <thead>
            <tr><th>Value</th><th>Name</th><th>Reference</th></tr>
          </thead>
          <tbody>
            <tr><td>0x41</td><td>ACK</td><td>This document</td></tr>
            <tr><td>0x53</td><td>SYNC</td><td>This document</td></tr>
            <tr><td>0x00, 0x02-0x40, 0x42-0x52, 0x54-0xFF</td><td>Unassigned</td><td></td></tr>
          </tbody>
        </table>
      </section>

      <section anchor="iana-version" numbered="true">
        <name>HCTP Version Registry</name>
        <t>IANA is requested to create a registry "HCTP Versions" with a 1-octet
        identifier space, registration policy "Specification Required", initially
        containing value 0x01 ("HCTP/1", this document).</t>
      </section>

      <section anchor="iana-media-type" numbered="true">
        <name>Media Type Registration</name>
        <t>IANA is requested to register the "application/hctp" media type for
        HCTP packets carried over media-type-aware transports, per the procedures
        of <xref target="RFC6838"/>. Type name: application; Subtype name: hctp;
        Required parameters: none; Optional parameters: none; Encoding
        considerations: binary; Security considerations: see
        <xref target="security"/> of this document.</t>
      </section>
    </section>

  </middle>

  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author initials="S." surname="Bradner" fullname="S. Bradner"/>
          <date year="1997" month="March"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author initials="B." surname="Leiba" fullname="B. Leiba"/>
          <date year="2017" month="May"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
      </reference>
      <reference anchor="RFC6234" target="https://www.rfc-editor.org/info/rfc6234">
        <front>
          <title>US Secure Hash Algorithms (SHA and SHA-based HMAC and HKDF)</title>
          <author initials="D." surname="Eastlake 3rd" fullname="D. Eastlake 3rd"/>
          <author initials="T." surname="Hansen" fullname="T. Hansen"/>
          <date year="2011" month="May"/>
        </front>
        <seriesInfo name="RFC" value="6234"/>
      </reference>
      <reference anchor="RFC1950" target="https://www.rfc-editor.org/info/rfc1950">
        <front>
          <title>ZLIB Compressed Data Format Specification version 3.3</title>
          <author initials="P." surname="Deutsch" fullname="P. Deutsch"/>
          <author initials="J-L." surname="Gailly" fullname="J-L. Gailly"/>
          <date year="1996" month="May"/>
        </front>
        <seriesInfo name="RFC" value="1950"/>
      </reference>
      <reference anchor="RFC1951" target="https://www.rfc-editor.org/info/rfc1951">
        <front>
          <title>DEFLATE Compressed Data Format Specification version 1.3</title>
          <author initials="P." surname="Deutsch" fullname="P. Deutsch"/>
          <date year="1996" month="May"/>
        </front>
        <seriesInfo name="RFC" value="1951"/>
      </reference>
      <reference anchor="RFC8126" target="https://www.rfc-editor.org/info/rfc8126">
        <front>
          <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
          <author initials="M." surname="Cotton" fullname="M. Cotton"/>
          <author initials="B." surname="Leiba" fullname="B. Leiba"/>
          <author initials="T." surname="Narten" fullname="T. Narten"/>
          <date year="2017" month="June"/>
        </front>
        <seriesInfo name="BCP" value="26"/>
        <seriesInfo name="RFC" value="8126"/>
      </reference>
      <reference anchor="RFC6838" target="https://www.rfc-editor.org/info/rfc6838">
        <front>
          <title>Media Type Specifications and Registration Procedures</title>
          <author initials="N." surname="Freed" fullname="N. Freed"/>
          <author initials="J." surname="Klensin" fullname="J. Klensin"/>
          <author initials="T." surname="Hansen" fullname="T. Hansen"/>
          <date year="2013" month="January"/>
        </front>
        <seriesInfo name="BCP" value="13"/>
        <seriesInfo name="RFC" value="6838"/>
      </reference>
    <reference anchor="RFC8785" target="https://www.rfc-editor.org/info/rfc8785"><front><title>JSON Canonicalization Scheme (JCS)</title><author initials="A." surname="Rundgren"/><author initials="B." surname="Jordan"/><author initials="S." surname="Erdtman"/><date year="2020" month="June"/></front><seriesInfo name="RFC" value="8785"/></reference>
<reference anchor="RFC8259" target="https://www.rfc-editor.org/info/rfc8259"><front><title>The JavaScript Object Notation (JSON) Data Interchange Format</title><author initials="T." surname="Bray" role="editor"/><date year="2017" month="December"/></front><seriesInfo name="STD" value="90"/><seriesInfo name="RFC" value="8259"/></reference>
</references>

    <references>
      <name>Informative References</name>
      <reference anchor="RFC8446" target="https://www.rfc-editor.org/info/rfc8446">
        <front>
          <title>The Transport Layer Security (TLS) Protocol Version 1.3</title>
          <author initials="E." surname="Rescorla" fullname="E. Rescorla"/>
          <date year="2018" month="August"/>
        </front>
        <seriesInfo name="RFC" value="8446"/>
      </reference>
      <reference anchor="RFC9000" target="https://www.rfc-editor.org/info/rfc9000">
        <front>
          <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
          <author initials="J." surname="Iyengar" fullname="J. Iyengar" role="editor"/>
          <author initials="M." surname="Thomson" fullname="M. Thomson" role="editor"/>
          <date year="2021" month="May"/>
        </front>
        <seriesInfo name="RFC" value="9000"/>
      </reference>
      <reference anchor="RFC6455" target="https://www.rfc-editor.org/info/rfc6455">
        <front>
          <title>The WebSocket Protocol</title>
          <author initials="I." surname="Fette" fullname="I. Fette"/>
          <author initials="A." surname="Melnikov" fullname="A. Melnikov"/>
          <date year="2011" month="December"/>
        </front>
        <seriesInfo name="RFC" value="6455"/>
      </reference>
      <reference anchor="AGTP-SESSION" target="https://datatracker.ietf.org/doc/draft-hood-agtp-session/">
        <front>
          <title>AGTP Session Protocol</title>
          <author initials="C." surname="Hood" fullname="Chris Hood"/>
          <date year="2026" month="October" day="30"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-hood-agtp-session-01"/>
      </reference>
    </references>

    <section anchor="test-vectors" numbered="true">
  <name>Test Vectors</name>
  <t>This appendix gives a subset of the test vectors for this revision. The complete set is the file vectors-01.json, which also covers the escaped and unescaped characters of <xref target="data-model"/>, a character outside the Basic Multilingual Plane, NFC and NFD forms of the same text, a summary of exactly MAX_SUMMARY_LEN code points, and 21 decompressed SYNC contents that a receiver MUST reject. Its SHA-256 digest, over the file as distributed by the author (UTF-8, LF line endings), is given below; a copy whose line endings have been changed will not match.</t>
<artwork><![CDATA[
  c452fd2400f8dfd74d3d3b4c9fc8c217e5528017366fa50cd358391a31d17b99
]]></artwork>
  <t>Every octet string below is hexadecimal, so that no line break or space in the display can be mistaken for part of a value. Each canonical(B) is also given in vectors-01.json as JSON text.</t>
  <section anchor="tv-genesis" numbered="true"><name>Genesis Root</name>
    <t>root_0 = SHA256("hctp-genesis-v1"), the 15 ASCII octets with no trailing NUL:</t>
    <artwork><![CDATA[
  adf23ff0aaf06a7edceac586462522c16ba7869f5c122515032bb7f8a8181db9
]]></artwork>
  </section>
  <section anchor="tv-ascii" numbered="true"><name>Three ASCII Blocks</name>
    <t>Folding three blocks from root_0. These roots are unchanged from draft-ruvalcaba-hctp-00, because the blocks contain only ASCII.</t>
    <artwork><![CDATA[
seq 0, raw text:
  Hello, agent.

canonical(B) octets (126):
  7b22636f6e74656e745f68617368223a22663134373538346161663136313932
  3230653635626232343739313531613963643365396636306136316262333966
  3833356132653135313135313031323463222c22726f6c65223a227573657222
  2c22736571223a302c2273756d6d617279223a226772656574696e67227d

root after fold:
  b83c934e3064759521013688ce3424284d6bdaa391706d8d9111148dc6645be0
]]></artwork>
    <artwork><![CDATA[
seq 1, raw text:
  Hello. What do you need?

canonical(B) octets (133):
  7b22636f6e74656e745f68617368223a22383931346135376466353933373863
  3539306333636565653435383131636561643631346430623465636534366663
  3431366139343238323433343162306332222c22726f6c65223a226167656e74
  222c22736571223a312c2273756d6d617279223a226772656574696e67207265
  706c79227d

root after fold:
  9aa6829d8d6dac9ca8db70cb6f1ec593009de2cabb381ce81f8a9082468ed134
]]></artwork>
    <artwork><![CDATA[
seq 2, raw text:
  Summarise RFC 6234.

canonical(B) octets (143):
  7b22636f6e74656e745f68617368223a22386461303965326633393764383538
  6438306137343535346431363564643037656436383930663266386238386339
  3563303363373032353336333062336466222c22726f6c65223a227573657222
  2c22736571223a322c2273756d6d617279223a2261736b7320666f7220524643
  20363233342073756d6d617279227d

root after fold:
  e2354b7bf5555847e57e5de40146b02c3deeafc616860576bd51fa1e07adbf01
]]></artwork>
  </section>
  <section anchor="tv-non-ascii" numbered="true"><name>Non-ASCII Block</name>
    <t>A block whose raw text and summary contain Latin and CJK characters, folded from root_0. canonical(B) carries them as raw UTF-8. Under the ASCII-escaped form, which <xref target="data-model"/> prohibits, the root would differ.</t>
    <artwork><![CDATA[
canonical(B) octets (134):
  7b22636f6e74656e745f68617368223a22353566323761363130613136653463
  3666633661653161326131333064616536303632343631376562613761356230
  3338653738626132336330316532323739222c22726f6c65223a227573657222
  2c22736571223a302c2273756d6d617279223a22636166c3a920696e2054c58d
  6b79c58d227d

root after fold:
  e5c13f98509eea497a337e4caa0239d8da270db6d2a7df786b7c964cddeb2b36
]]></artwork>
  </section>
  <section anchor="tv-packets" numbered="true"><name>SYNC and ACK</name>
    <t>A SYNC carrying the three ASCII blocks over root_0, and the ACK a receiver returns. The uncompressed content of dynamic_data is "[", the three canonical(B) encodings of <xref target="tv-ascii"/> separated by ",", and "]". DEFLATE output differs between implementations, so dynamic_data is given literally; a receiver checks combined_hash over the octets it receives. dynamic_len is 246, so the SYNC is 320 octets (74 + 246); the ACK is 38 octets.</t>
    <artwork><![CDATA[
uncompressed content of dynamic_data (406):
  5b7b22636f6e74656e745f68617368223a226631343735383461616631363139
  3232306536356262323437393135316139636433653966363061363162623339
  663833356132653135313135313031323463222c22726f6c65223a2275736572
  222c22736571223a302c2273756d6d617279223a226772656574696e67227d2c
  7b22636f6e74656e745f68617368223a22383931346135376466353933373863
  3539306333636565653435383131636561643631346430623465636534366663
  3431366139343238323433343162306332222c22726f6c65223a226167656e74
  222c22736571223a312c2273756d6d617279223a226772656574696e67207265
  706c79227d2c7b22636f6e74656e745f68617368223a22386461303965326633
  3937643835386438306137343535346431363564643037656436383930663266
  3862383863393563303363373032353336333062336466222c22726f6c65223a
  2275736572222c22736571223a322c2273756d6d617279223a2261736b732066
  6f722052464320363233342073756d6d617279227d5d

SYNC (320):
  015300000002adf23ff0aaf06a7edceac586462522c16ba7869f5c122515032b
  b7f8a8181db9000000f678da6d904b6a43310c45b7f2f038034996fcc9b49005
  745a4a916d3929cda77d2f198492bdd793d0420302210edc73d1cbb7aba7e3d9
  8ee7b79d2e3bb7761d394a62d58e01331158905288634641cdb579cb3d80062c
  c5e79ebc28d940630089ab5bb9f9b4b79174596c1ed7625f6e0d635f0e079daf
  036c67b3f3fb71eb6eab7ffa94915562eb927d4c5532545fcd8c252156d31690
  1b14b66a1c7a650c9a9912b1672c50e957afdb117bf7e323ff34dbe7fefab045
  53c846dde7d892a49640238b70c320ad41b41652864e3d95946a960abe4620f1
  c143f1ad3f7e02fd2da1cbc732f5d33c3d6f9ea6409ea73bbbbdfe009ede790c
  8f17a3c6d3932a515f9ce4f7139ba6c7033c718d66cd8c31fe128aeaaf05fcff

ACK (38):
  014100000002e2354b7bf5555847e57e5de40146b02c3deeafc616860576bd51
  fa1e07adbf01
]]></artwork>
  </section>
</section>

    <section anchor="changes-since-00" numbered="true">
  <name>Changes since draft-ruvalcaba-hctp-00</name>

  <t>
    This revision responds to review by an independent implementer whose
    Rust implementation, built from the <tt>-00</tt> text alone,
    reproduced every value in the first test-vector set. The
    changes below address the questions that review raised and the
    ambiguities it identified. Test vectors are added as <xref
    target="test-vectors"/>; every value there, and in the complete
    vectors-01.json file it summarizes, is generated by code from the
    text of this revision.
  </t>

  <section anchor="changes-canonical" numbered="false">
    <name>Canonical encoding</name>
    <ul spacing="normal">
      <li>
        <tt>canonical(B)</tt> is now defined as the JSON Canonicalization
        Scheme <xref target="RFC8785"/> serialization of the block, with
        <xref target="RFC8259"/> and <xref target="RFC8785"/> added as
        normative references; the standalone term "canonical JSON" is no
        longer used (<xref target="data-model"/>).
      </li>
      <li>
        The string serialization rule is stated explicitly, including
        the prohibition on escaping <tt>&lt;</tt>, <tt>&gt;</tt>,
        <tt>&amp;</tt>, U+2028, U+2029, and U+007F, and the prohibition on
        the ASCII-escaped form (<xref target="data-model"/>).
      </li>
      <li>
        The spelling of <tt>seq</tt> is fixed to ASCII decimal digits
        with no sign, leading zeros, fraction, or exponent, and the
        spelling of <tt>content_hash</tt> to exactly 64 ASCII lowercase
        hexadecimal digits (<xref target="data-model"/>).
      </li>
      <li>
        The document now states that no Unicode normalization is applied
        to <tt>role</tt>, <tt>summary</tt>, or the raw turn text, and that
        canonically equivalent but octet-different text yields different
        roots (<xref target="data-model"/>).
      </li>
      <li>
        A <tt>role</tt> is now bounded by the new constant
        <tt>MAX_ROLE_LEN</tt> of 64 octets of well-formed UTF-8, replacing
        the untestable adjective "short" (<xref
        target="data-model"/> and <xref target="constants"/>).
      </li>
    </ul>
  </section>

  <section anchor="changes-validation" numbered="false">
    <name>Packet validation and the receiver procedure</name>
    <ul spacing="normal">
      <li>
        The conditions under which a received SYNC is rejected are now
        stated once, in a single ordered list in <xref
        target="protocol-operation"/>; <xref target="data-model"/>,
        <xref target="wire-format"/>, and <xref target="transport"/> define
        formats and point to that list.
      </li>
      <li>
        The integrity check on <tt>combined_hash</tt> now precedes the
        cached-ACK path, so that path is never reached with a body
        inconsistent with its own <tt>combined_hash</tt> (<xref
        target="protocol-operation"/>).
      </li>
      <li>
        The single replay step of <tt>-00</tt> is split into a strict
        replay check for a lower <tt>seq</tt> and a duplicate check for an
        equal <tt>seq</tt>; the duplicate check answers only an exact
        retransmission, identified by a digest of the received octets
        held in <tt>ack_cache</tt>, and silently discards any other
        equal-<tt>seq</tt> packet (<xref target="protocol-operation"/>).
      </li>
      <li>
        Ingest validation now covers the packet <tt>seq</tt> cross-check
        against the last block, strictly ascending and contiguous block
        <tt>seq</tt> values, the prohibition on an empty array, the
        member set, the field forms, and the zlib stream rules including
        a clear FDICT flag and full consumption of <tt>dynamic_data</tt>
        (<xref target="protocol-operation"/>).
      </li>
      <li>
        "Reject" is defined as discard with no state change and no
        response, and the static-root alignment check is identified as
        the only fatal check (<xref target="protocol-operation"/>).
      </li>
      <li>
        The receiver now keeps <tt>last_block_seq</tt>, the <tt>seq</tt>
        of the last block folded into <tt>local_root</tt>, and folds
        <tt>canonical(B)</tt> rather than the received octets (<xref target="protocol-operation"/> and <xref target="data-model"/>).
      </li>
    </ul>
  </section>

  <section anchor="changes-sender" numbered="false">
    <name>Sender procedure</name>
    <ul spacing="normal">
      <li>
        The dynamic window is frozen while a SYNC is outstanding, and
        blocks originated during that period are queued and admitted only
        after the outstanding SYNC is acknowledged or abandoned (<xref target="protocol-operation"/> and <xref target="protocol-operation"/>).
      </li>
      <li>
        <tt>last_acked_seq</tt> is undefined until the first ACK is
        accepted, and an implementation is prohibited from initializing
        it to a numeric sentinel (<xref target="protocol-operation"/>).
      </li>
      <li>
        On an ACK, the sender computes a candidate root over the frozen
        window without modifying state, and commits it only if it equals
        <tt>new_root</tt>; on mismatch the ACK is a fatal divergence and the
        sender tears the session down at once, retaining no state (<xref
        target="on-ack"/>).
      </li>
      <li>
        Retransmission is now required to be octet-for-octet identical,
        and recovery from a retransmission corrupted in transit is
        assigned to the transport (<xref target="protocol-operation"/>).
      </li>
      <li>
        After the bounded retransmit count is exhausted, the sender
        reports failure and discards all session state, including the
        queued blocks and the cached ACK (<xref
        target="protocol-operation"/>).
      </li>
    </ul>
  </section>

  <section anchor="changes-bidirectional" numbered="false">
    <name>Bidirectional operation</name>
    <ul spacing="normal">
      <li>
        The chain to which a SYNC belongs is determined solely by the
        transport direction on which it is received; the <tt>role</tt>
        member is application data and is prohibited from selecting a
        chain (<xref target="protocol-operation"/> and <xref
        target="bidirectional"/>).
      </li>
      <li>
        The <tt>seq</tt> space is per directional chain, each chain
        numbering independently from 0, and a one-way session has a
        single chain (<xref target="data-model"/> and <xref
        target="bidirectional"/>).
      </li>
      <li>
        Per-direction chains are the only synchronization strategy in
        this version; the text records why the turn-token alternative is
        not specified (<xref target="bidirectional"/>).
      </li>
    </ul>
  </section>

  <section anchor="changes-limits" numbered="false">
    <name>Limits</name>
    <ul spacing="normal">
      <li>
        New constants <tt>MAX_BLOCKS_PER_SYNC_BASE</tt> (64 blocks) and
        <tt>MAX_DECOMPRESSED_LEN_BASE</tt> (65536 octets) are defined as
        minimum capacities per SYNC, with every receiver required to
        accept at least those baselines and permitted to accept more
        (<xref target="constants"/>).
      </li>
      <li>
        A sender is prohibited from exceeding either baseline in a single
        SYNC and must split the pending blocks across successive SYNCs
        when they do not fit (<xref target="constants"/> and
        <xref target="protocol-operation"/>).
      </li>
      <li>
        The receiver's accepted bound is required to be at least the
        baselines, and decompression is aborted once the accepted bound
        is exceeded (<xref target="protocol-operation"/> and <xref
        target="security"/>).
      </li>
    </ul>
  </section>

  <section anchor="changes-transport" numbered="false">
    <name>Transport mapping</name>
    <ul spacing="normal">
      <li>
        Each transport unit must carry exactly one HCTP packet and no
        other octets, and the receiver reads the 42-octet fixed header
        prefix of a SYNC before reading <tt>dynamic_data</tt> and
        <tt>combined_hash</tt> (<xref target="transport"/>).
      </li>
      <li>
        Splitting is now sequential: each part carries the
        <tt>static_root</tt> resulting from the ACK of the preceding
        part, at most one part is outstanding, and the receiver is
        prohibited from reassembling blocks across SYNC packets
        (<xref target="protocol-operation"/> and <xref
        target="transport"/>).
      </li>
      <li>
        A session is scoped to one scope instance: one underlying
        connection by default, or an enclosing session, such as
        <xref target="AGTP-SESSION"/>, that can move between connections.
        State is reset only when that instance ends. Over HTTP with no
        enclosing session, all requests and streams on one connection share
        one session, and a new connection starts a new session from the
        fixed genesis root (<xref target="protocol-operation"/> and <xref
        target="transport"/>).
      </li>
    </ul>
  </section>

  <section anchor="changes-security" numbered="false">
    <name>Security considerations</name>
    <ul spacing="normal">
      <li>
        The replay discussion now describes the integrity-first ordering,
        the digest-based duplicate check, and the constant size of
        <tt>ack_cache</tt>, and notes that every rejection other than a
        static-root mismatch is silent and leaves state unchanged
        (<xref target="security"/>).
      </li>
      <li>
        The text now states that this version defines one fixed genesis
        root and no session identifier, that whole-session replay is not
        detectable at the HCTP layer, and that freshness is the
        responsibility of the transport (<xref
        target="security"/>).
      </li>
      <li>
        The decompression discussion now states the baseline limits, the
        requirement that the accepted bound be at least those baselines,
        and the separate bounding of <tt>dynamic_len</tt> before
        allocation (<xref target="security"/>).
      </li>
    </ul>
  </section>

  <section anchor="changes-removed" numbered="false">
    <name>Removed</name>
    <ul spacing="normal">
      <li>
        The turn-token alternative in Section 7 of <tt>-00</tt> is
        removed (<xref target="bidirectional"/>).
      </li>
      <li>
        The same-<tt>static_root</tt> receiver-reassembly sentence in
        Section 10 of <tt>-00</tt> is removed and replaced by the
        sequential-part procedure (<xref target="transport"/>).
      </li>
      <li>
        The phrase "fresh genesis root" and the claim that starting from
        a fresh genesis prevents cross-session replay are removed and
        replaced by the fixed genesis root and the transport-freshness
        statement (<xref target="protocol-operation"/> and <xref
        target="security"/>).
      </li>
      <li>
        The literal "folds each pending block" and "clears the dynamic
        window" in Section 6.4 of <tt>-00</tt> are removed and replaced by
        the frozen window, the explicit acknowledged set, and the
        tentative candidate root (<xref target="protocol-operation"/>).
      </li>
    </ul>
  </section>

  <section anchor="design-choices" numbered="false">
    <name>Design choices made in this revision</name>
    <t>
      The following are settled in this revision. Comment is welcome, but
      each is fully specified in the text.
    </t>
    <ul spacing="normal">
      <li>String serialization follows <xref target="RFC8785"/>: raw UTF-8,
      with the ASCII-escaped form prohibited (<xref target="data-model"/>).
      For a block that -00 also accepted and that is written the same way,
      this is the only change to its octets, and it affects only non-ASCII
      text: a history whose roles and summaries are all ASCII keeps its
      roots.</li>
      <li>No Unicode normalization is applied (<xref target="data-model"/>).</li>
      <li>The <tt>seq</tt> space is per directional chain, starting at 0
      (<xref target="bidirectional"/>).</li>
      <li>An empty SYNC is prohibited (<xref target="wire-format"/>).</li>
      <li>A window too large for one SYNC is sent as sequential parts;
      cross-SYNC reassembly is not part of this version (<xref
      target="transport"/>).</li>
      <li>The duplicate check compares a SHA-256 digest of the received
      octets of the accepted SYNC (<xref target="protocol-operation"/>).</li>
      <li>No error packet is defined; a rejection is silent and non-fatal
      except for a static-root mismatch (<xref target="protocol-operation"/>).</li>
      <li>A corrupted retransmission is discarded silently; recovery from
      corruption is the job of the transport (<xref target="retransmission"/>).</li>
      <li>The chain of a SYNC is determined by the direction of transfer within
      the scope instance, never by the role of a block
      (<xref target="bidirectional"/>).</li>
      <li>HCTP state is bound to a scope instance defined by the layer beneath,
      one connection by default or an enclosing session that can survive
      reconnection, and is reset only when that instance ends
      (<xref target="transport"/>). This replaces a proposal to tie state to one
      connection, which would have restarted HCTP from genesis on every
      reconnection of an enclosing session.</li>
    </ul>
  </section>

  <section anchor="open-questions" numbered="false">
    <name>Open questions</name>
    <t>
      The author has taken a provisional position on each of the following
      and invites comment.
    </t>
    <ul spacing="normal">
      <li>The baseline limits of 64 blocks and 65536 octets per SYNC
      (<xref target="constants"/>) have not yet been checked against a
      target MTU budget. Should a later version let peers signal larger
      limits?</li>
      <li><tt>MAX_ROLE_LEN</tt> is 64 octets (<xref target="constants"/>);
      the alternative is to bound <tt>role</tt> only by the size limits of
      <xref target="security"/>.</li>
      <li>The single-writer turn-token strategy of -00 is removed rather than
      repaired (<xref target="bidirectional"/>). Is there a use case that
      needs one agreed fold order across both directions?</li>
      <li>Session freshness rests on the transport, with one fixed genesis
      root (<xref target="security"/>). A session-specific genesis would need
      a nonce or a transport exporter and a new version.</li>
    </ul>
  </section>
</section>

    <section anchor="acknowledgments" numbered="false">
      <name>Acknowledgments</name>
      <t>The rolling-root delta-transfer design and the verifiable-summary block
      derive from an earlier reference implementation of the protocol.</t>
    </section>
  </back>
</rfc>
