AI Initiative logoAI Initiative
Reading room / Manthan

G-005 — Specify MWP Safely

G-005 — Specify MWP Safely. Covers 1. The job of this gate; 2. Wire format overview; 3. The handshake; 3.1 HELO (initiator → responder).

Platform design / acceptance contract
This is the retained source text, not a new validation of its claims. Numerical results and comparative claims require the accompanying source review before public reuse.

Read the connected case study or article →

driver-claude · 2026-05-06

Provenance, authorship and editorial notes

G-005 — Specify MWP Safely

Id

manthan-manthan-platform-gates-g-005-mwp-handshake

Project

Manthan

Source path

manthan/manthan-platform/gates/G-005-mwp-handshake.md

Source sha256

99c846eba01e433e895f1928b984a0cc9e9ea5e262248c42c4aeb40f5018c6d5

Local copy sha256

99c846eba01e433e895f1928b984a0cc9e9ea5e262248c42c4aeb40f5018c6d5

Repo head

3a94084024a3434cef331fecac91c2c3b43f0313

Date

2026-05-06

Date basis

Explicit document metadata

Author

driver-claude

Author basis

Author

Last source commit

8b75d1b0157c20a0a463f0e31008ef9f73099beb

Last source commit date

2026-06-08T07:40:14Z

Document status

Platform design / acceptance contract

Summary

G-005 — Specify MWP Safely. Covers 1. The job of this gate; 2. Wire format overview; 3. The handshake; 3.1 HELO (initiator → responder).

Topics
  • From protocol to platform
  • 1. The job of this gate
  • 2. Wire format overview
  • 3. The handshake
Theme

From protocol to platform

Priority

deep

Related ids
  • manthan-manthan-platform-gates-g-001-mvp-workflow
Evidence concerns
  • Recovered source text is preserved verbatim. Assertions, comparisons, commands and results belong to its original context; they were not re-executed or externally re-verified during this corpus review.
Word count

1304

Bytes

10146

Source relative

manthan-platform/gates/G-005-mwp-handshake.md

Remote mirror

manthan/manthan-platform/gates/G-005-mwp-handshake.md

Full text preserved

True

G-005 — Specify MWP Safely

Status: drafted → reviewed → accepted → closed.
Author: driver-claude
Date: 2026-05-06


1. The job of this gate

The original platform plan §3.2 named "MWP" but specified only three message types and no handshake transcript discipline. Per audits/manthan-platform-review.md §7-F2 and §8-F4: this allows replay, downgrade, transcript-splicing, and eclipse attacks.

G-005 produces a canonical MWP handshake spec with:

MWP is NOT used by the MVP wedge (G-001). The MVP uses HTTP. MWP is required only for Phase 3 (Controlled Gossip Test) and beyond. G-005 closes the design gate; implementation is Phase 3.

2. Wire format overview

MWP runs over WebSockets-over-TLS (wss://). Frames are binary, length-prefixed, CBOR-deterministic-encoded per [SPEC §3.5]. Each frame is a MwpFrame:

MwpFrame := {
  "type":          MwpFrameType,
  "session_id":    <bytes, 16 bytes>,        # established at HELO
  "seq":           <uint64>,                  # monotonic per session, per direction
  "payload":       <Cbor>                     # frame-type-specific
}

Where MwpFrameType ∈ { "HELO", "HELO_ACK", "PEER_EXCHANGE", "ENVELOPE_GOSSIP", "GET_ENVELOPES", "INVENTORY", "PING", "PONG", "BYE" }.

Frames are deterministically serialised. seq MUST be strictly monotonic. Out-of-order or repeated seq → connection drop.

3. The handshake

3.1 HELO (initiator → responder)

HELO.payload := {
  "mwp_version":         "1",                          # registry pinned; bump only on breaking
  "herald_core_version": "0.2",                        # pin to envelope/SPEC version
  "initiator_sigil":     "<sigil:...>",
  "initiator_nonce":     <bytes, 16, CSPRNG>,
  "supported_envelopes": [ "herald.envelope.v1", ... ],   # registered domain tags this peer accepts
  "supported_artifacts": [ "research_finding", ... ],     # per G-007 typed artifacts
  "advertised_roles":    [ "agent", "conduit", "scribe", "herald" ],   # role tags
  "ct_policy":           {
    "log_ids_pinned":  [ "<log_id_bytes>", ... ],
    "min_sth_freshness_seconds": 86400
  },
  "max_frame_bytes":     <uint, ≥ 65536, ≤ 1048576>,
  "compress":            "none" | "deflate-raw",
  "tls_exporter":        <bytes, 32, optional>,        # RFC 5705 keying material if TLS endpoint exposes it
  "ts":                  <Unix seconds>
}

3.2 HELO_ACK (responder → initiator)

Mirror structure with the responder's sigil, fresh nonce, and intersection of supported sets:

HELO_ACK.payload := {
  "mwp_version":         "1",
  "responder_sigil":     "<sigil:...>",
  "responder_nonce":     <bytes, 16, CSPRNG>,
  "agreed_envelopes":    [ ... intersection of supported_envelopes ... ],
  "agreed_artifacts":    [ ... intersection ... ],
  "agreed_roles":        [ ... intersection of role tags both peers offer/want ... ],
  "ct_policy":           { responder's policy },
  "max_frame_bytes":     min(initiator's, responder's),
  "compress":            chosen,
  "tls_exporter":        <bytes, optional, must equal initiator's if both report it>,
  "ts":                  <Unix seconds>,
  "session_id":          <bytes, 16 = SHA-256(transcript)[0..16]>,   # see §3.4
  "transcript_signature": {
    "signer":  "<responder_sigil>",
    "alg":     "ed25519",
    "scope":   "mwp_session_init",
    "sig":     <bytes, 64, Ed25519 sig over canonical transcript>
  }
}

3.3 HELO_ACK_2 (initiator → responder)

The initiator counter-signs the transcript:

HELO_ACK_2.payload := {
  "session_id":           <copied from HELO_ACK>,
  "ts":                   <Unix seconds>,
  "transcript_signature": {
    "signer":  "<initiator_sigil>",
    "alg":     "ed25519",
    "scope":   "mwp_session_init",
    "sig":     <bytes, 64, Ed25519 sig over the same canonical transcript>
  }
}

After HELO_ACK_2 is received and its signature verifies, the session is established. Any prior frame is treated as part of the handshake transcript; subsequent frames (PEER_EXCHANGE, ENVELOPE_GOSSIP, etc.) are session-bound.

3.4 The transcript

The transcript is the canonical concatenation:

transcript := dom_sep || cbor_canonical(HELO.payload)
                      || cbor_canonical(HELO_ACK.payload_without_signature)

where dom_sep := b"manthan.mwp.handshake.v1" (registered in [EXT §13] per G-008) and HELO_ACK.payload_without_signature is the HELO_ACK payload with the transcript_signature field stripped (just like envelope canonical body excludes its own signature).

Both peers compute the same transcript bytes. The session_id is SHA-256(transcript)[0..16] — content-addressed, mutually-derivable, used to bind subsequent frames.

3.5 What the handshake does NOT include

4. Anti-patterns the handshake defends against

4.1 Replay

Test vector R-1. Replay an old HELO_ACK against a new HELO → handshake fails on transcript-mismatch.

4.2 Downgrade

Test vector R-2. Mid-flight rewrite of mwp_version → handshake fails.

4.3 Transcript splicing

Test vector R-3. Splice HELO_A + HELO_ACK_B → both transcript signatures fail (each peer signed a different transcript).

4.4 MITM

Test vector R-4. MITM with separate TLS terminations → tls_exporter mismatch flags MITM.

4.5 Eclipse / peer-set capture

(Eclipse defence is mostly G-006's concern; MWP just makes the role declaration cryptographically verifiable.)

5. Test vectors required for Phase-3 conformance

A Phase-3 implementation MUST pass these vectors (tests/conformance/mwp/):

IDScenarioExpected
MWP-V1Healthy handshake with both sigils having birth + endorsementsession established
MWP-V2HELO_ACK signed by wrong sigilrejected at transcript_signature.signer != HELO_ACK.responder_sigil
MWP-V3Mid-handshake replay (above R-1)rejected at transcript-mismatch
MWP-V4Downgrade attempt (above R-2)rejected at transcript-mismatch
MWP-V5Transcript splicing (above R-3)rejected on both sides
MWP-V6TLS exporter mismatch (above R-4)rejected with "MITM-suspected" reason code
MWP-V7mwp_version not "1"rejected with "unsupported-version" reason code
MWP-V8seq non-monotonic during data phaseconnection dropped
MWP-V9Frame > max_frame_bytesconnection dropped
MWP-V10BYE frameclean shutdown; both peers stop accepting frames in this session

6. Domain tag registration

A new domain tag is required:

herald.mwp.handshake.v1   — MWP handshake transcript signatures

Add to [EXT §13] domain-separation registry. This is a G-008 deliverable.

7. What this gate does NOT cover

8. Acceptance criteria

9. Sign-off


— G-005 closed, 2026-05-06.

Continue exploring