<?xml version="1.0" encoding="utf-8"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     category="std"
     docName="draft-durga-mcp-a2a-semantic-metering-00"
     ipr="trust200902"
     submissionType="IETF"
     version="3"
     xml:lang="en">
  <front>
    <title abbrev="Cross-Protocol Semantic Equivalence &amp; Metering">Cross-Protocol Semantic Equivalence Proofs and Commit-Bound Metering Receipts for Multi-Vendor Agentic Exchanges</title>
    <seriesInfo name="Internet-Draft" value="draft-durga-mcp-a2a-semantic-metering-00"/>
    <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga">
      <organization>Microsoft Corporation</organization>
      <address>
        <postal>
          <country>US</country>
        </postal>
        <email>rdurga@microsoft.com</email>
      </address>
    </author>
    <date year="2026" month="November" day="2"/>
    <area>Security</area>
    <workgroup>DISPATCH / HTTPAPI Working Group</workgroup>
    <keyword>Agentic AI</keyword>
    <keyword>MCP</keyword>
    <keyword>A2A</keyword>
    <keyword>JCS</keyword>
    <keyword>Ed25519</keyword>
    <keyword>Zero Trust</keyword>
    <abstract>
      <t>Enterprise agent ecosystems routinely bridge tool invocations and task delegations across heterogeneous protocols, including Model Context Protocol (MCP), Agent-to-Agent (A2A), and OpenAPI/REST. During protocol translation, safety invariants, schema constraints, and mutability flags are frequently stripped—enabling cross-protocol capability downgrade attacks—while commercial settlement gateways erroneously bill on HTTP 200 transport responses rather than verified state-commit durability. This document specifies a cryptographic Cross-Protocol Semantic Equivalence Proof (CPSEP) and an 8-state Commit-Bound Metering Receipt (CBMR) protocol.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="introduction" numbered="true">
      <name>Introduction and Problem Statement</name>
      <t>When an A2A task is translated by a proxy into an MCP tool call and subsequently into a REST request, no cryptographic proof exists that the translated request preserved the tighter permission bounds, rate limits, and JSON Schema invariants of the originating envelope. Furthermore, inter-organization agent exchanges lack a non-repudiable, commit-bound metering receipt tied to Write-Ahead Log (WAL) finality, leading to billing disputes on aborted or rolled-back agent invocations.</t>
      <t>This specification complements the foundational execution-trace verification architecture defined in <tt>draft-durga-agenttrust-trace-verification-00</tt> by introducing deterministic, fail-closed wire semantics specifically addressing Cross-Protocol Semantic Equivalence &amp; Metering.</t>
    </section>
    <section anchor="conventions" numbered="true">
      <name>Conventions and Definitions</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>
    </section>
    <section anchor="wire-format" numbered="true">
      <name>Semantic Equivalence Proof and Commit-Bound Metering Receipt Envelope</name>
      <t>Protocol translation proxies and settlement gateways MUST emit and verify a JCS-canonicalized Semantic Metering Envelope carried in the Agent-Semantic-Metering HTTP header or JSON-RPC _meta block:</t>
      <sourcecode type="json"><![CDATA[
{
  "cpsep_version": "1.0",
  "exchange_tx_id": "urn:uuid:550e8400-e29b-41d4-a716-446655440000",
  "protocol_bridge_path": ["A2A_1.0", "MCP_2025_11", "OPENAPI_3_1"],
  "source_ast_merkle_root": "sha256:ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d",
  "target_ast_merkle_root": "sha256:e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683",
  "downgrade_bitmask": 0,
  "wal_commit_state": "COMMITTED_VERIFIED",
  "prev_receipt_hash": "sha256:7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451",
  "signature": {
    "alg": "Ed25519",
    "kid": "sha256:b600306cfa76723fdec395e53a9b3d9fdb78b1e2d7a23c32fcbcd2dc6d0c4092",
    "sig": "RpG18aHMw9iEfGEoM76MQSEqr2dOKh-tnLfgVKmFmEHgI5yJ4VUlHFHXUmZwooBPrhkpdan6R-n1ELDaST7vBw"
  }
}
]]></sourcecode>
    </section>
    <section anchor="verification-rules" numbered="true">
      <name>Normative Fail-Closed Verification Rules</name>
      <t>Conforming verifiers and relying-party gateways MUST enforce the following deterministic invariants before releasing any downstream side effect:</t>
      <ol spacing="normal">
        <li>ZERO_DOWNGRADE_INVARIANT: Any translation across A2A, MCP, or REST that widens parameter bounds, drops a readOnly/idempotent constraint, or strips a required human-approval flag MUST set the corresponding bit in downgrade_bitmask, and the receiving endpoint MUST reject any envelope where downgrade_bitmask != 0.</li>
        <li>COMMIT_BOUND_SETTLEMENT_FINALITY: A commercial metering gateway MUST NOT transition a billable agent transaction to SETTLED unless wal_commit_state equals COMMITTED_VERIFIED and is backed by a countersigned receipt from the target execution engine.</li>
        <li>AUTOMATIC_COMPENSATION_ZERO_BILLING: Transactions terminating in ABORTED_PRE_COMMIT, TIMED_OUT, or COMPENSATED_ROLLED_BACK MUST settle to zero billable units.</li>
      </ol>
    </section>
    <section anchor="strict-parser-determinism" numbered="true">
      <name>Strict Parser Determinism and Wire-Level Input Hardening</name>
      <t>When bridging requests across Model Context Protocol (MCP), Agent-to-Agent (A2A), and OpenAPI/REST gateways, parser differentials between TypeScript, Python, and Rust runtimes create exploitable semantic gaps. Conforming CPSEP proxies and CBMR settlement verifiers MUST enforce five pre-canonicalization parser invariants:</t>
      <ol spacing="normal">
        <li>DUPLICATE_KEY_REJECTION: The JSON parser MUST reject any CPSEP/CBMR envelope or translated tool-argument payload containing duplicate member names prior to AST construction, preventing cross-protocol parameter smuggling where an upstream MCP proxy inspects the first key while a downstream REST service executes the second.</li>
        <li>IEEE754_FINITE_SAFE_INTEGER_BOUNDS: The <tt>downgrade_bitmask</tt> and all metered token/unit counters MUST be exact JSON integers within <tt>[0, 2^53 - 1]</tt>. Boolean values (<tt>true</tt>/<tt>false</tt> coerced to <tt>1</tt>/<tt>0</tt> in Python), negative values, and non-finite IEEE-754 floats (<tt>NaN</tt>, <tt>Infinity</tt>, <tt>-Infinity</tt>, or <tt>1e1000</tt> exponent overflow) MUST cause immediate fail-closed rejection.</li>
        <li>CANONICAL_LOWERCASE_HEX_AND_SAFE_LONE_SURROGATES: All <tt>sha256:</tt> digests (<tt>source_ast_merkle_root</tt>, <tt>target_ast_merkle_root</tt>, <tt>prev_receipt_hash</tt>, <tt>kid</tt>) MUST match <tt>^sha256:[0-9a-f]{64}$</tt>, and strings containing unpaired UTF-16 surrogates (<tt>U+D800..U+DFFF</tt>) MUST be rejected prior to RFC 8785 JCS serialization.</li>
        <li>MINIMAL_BASE64URL_AND_PUBLIC_JWK_HYGIENE: Signatures MUST use canonical unpadded Base64url encoding, and any verification key catalog MUST reject JWKs containing private key parameters (<tt>d</tt>, <tt>p</tt>, <tt>q</tt>, <tt>k</tt>).</li>
        <li>EVIDENCE_TO_RULE_BYTE_BINDING: When a CBMR receipt is evaluated inside an external Verdict Record (<xref target="I-D.wright-verdict-record"/>) for commercial settlement or dispute resolution, the settlement rule MUST bind directly to the digest-verified CBMR envelope bytes rather than unverified summary claims.</li>
      </ol>
    </section>
    <section anchor="implementation-status" numbered="true">
      <name>Implementation Status and Empirical Benchmark Evaluation</name>
      <t>The cross-protocol semantic equivalence and commit-bound metering mechanisms specified in this document are backed by open-source reference implementations and reproducible benchmark datasets:</t>
      <ul spacing="normal">
        <li>Open-Source MCP/A2A &amp; Telemetry Verifiers: Strict canonicalization, duplicate-key rejection, safe-integer metering bounds, and cross-protocol transport verification are implemented across <tt>agentrust-io/cmcp</tt>, <tt>agentrust-io/ca2a</tt>, <tt>agentrust-io/agentrust-telemetry</tt>, and <tt>GenAI-Security-Project/agent-control-standard</tt> (<xref target="AGENTIC-GOV-BENCHMARKS"/>).</li>
        <li>Core Rust Evidence Engine: Deterministic RFC 8785 JCS receipt hashing and isotonic confidence scoring are implemented in Rust in <tt>xerj-org/xerj</tt> (<tt>engine/crates/xerj-common/src/hub_evidence.rs</tt>, <xref target="XERJ-HUB-EVIDENCE"/>).</li>
        <li>Empirical Benchmark Results: In reproducible evaluations over the 100-scenario OWASP ASI01-ASI10 benchmark (<xref target="OWASP-ASI-BENCHMARK-DOI"/>) and the companion Technical Report (<xref target="ZENODO-TR-2026-02"/>), Merkle-DAG delta proofs reduce cross-version re-verification overhead by 65.9%, the CPSEP downgrade gate blocks 100% of capability-widening translations across MCP/A2A/REST, and the 8-state WAL commit-bound metering machine achieves 0.0% over-billing across aborted and rolled-back transactions.</li>
      </ul>
    </section>
    <section anchor="security" numbered="true">
      <name>Security Considerations</name>
      <t>All pre-image objects MUST be canonicalized using RFC 8785 JSON Canonicalization Scheme (JCS) prior to signature generation or verification under RFC 8032 Ed25519. Any clock skew exceeding 60 seconds, digest mismatch, or missing cryptographic binding MUST cause the verifier to fail closed and emit an auditable security rejection receipt. For the normative test vector in <xref target="wire-format"/>, the Ed25519 test key seed is <tt>2a2a...2a</tt> (32 bytes of <tt>0x2a</tt>), yielding raw 32-byte public key <tt>197f6b23e16c8532c6abc838facd5ea789be0c76b2920334039bfa8b3d368d61</tt> (<tt>kid</tt> = <tt>sha256:b600306cfa76723fdec395e53a9b3d9fdb78b1e2d7a23c32fcbcd2dc6d0c4092</tt>), and the full RFC 8785 JCS-canonicalized envelope (<tt>710</tt> bytes) hashes to SHA-256 <tt>c3c30e610159c85b7ea4c29c7e70ea278373e646fe618b596447279b1c74e611</tt>. This specification cross-references the companion Internet-Drafts (<xref target="I-D.durga-agenttrust-trace-verification"/>, <xref target="I-D.durga-wimse-ctx-isolation"/>, <xref target="I-D.durga-pquip-pqc-agentic-delegation"/>, <xref target="I-D.durga-agent-tx-compensation-lease"/>), external Verdict Record evidence binding (<xref target="I-D.wright-verdict-record"/>), Remote Attestation (<xref target="RFC9334"/>), Merkle Tree domain separation (<xref target="RFC9162"/>), and the 100-scenario OWASP ASI01-ASI10 benchmark (<xref target="OWASP-ASI-BENCHMARK-DOI"/>).</t>
    </section>
    <section anchor="iana" numbered="true">
      <name>IANA Considerations</name>
      <t>This document requests IANA registration of the media type <tt>application/agent-metering-receipt+json</tt> and the registry <tt>IETF Agent Metering Commit States (RESERVED, VALIDATED, EXECUTING, COMMITTED_VERIFIED, ABORTED_PRE_COMMIT, TIMED_OUT, COMPENSATED_ROLLED_BACK, SETTLED)</tt>, alongside the following header fields:</t>
      <ul spacing="normal">
        <li>HTTP/MCP Header Field: <tt>Agent-Semantic-Proof</tt></li>
        <li>HTTP/MCP Header Field: <tt>Agent-Metering-Receipt</tt></li>
      </ul>
    </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 fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
        </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 fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
      </reference>
      <reference anchor="RFC8785" target="https://www.rfc-editor.org/info/rfc8785">
        <front>
          <title>JSON Canonicalization Scheme (JCS)</title>
          <author fullname="A. Rundgren" initials="A." surname="Rundgren"/>
          <author fullname="B. Jordan" initials="B." surname="Jordan"/>
          <author fullname="S. Erdtman" initials="S." surname="Erdtman"/>
          <date month="June" year="2020"/>
        </front>
        <seriesInfo name="RFC" value="8785"/>
      </reference>
      <reference anchor="RFC8032" target="https://www.rfc-editor.org/info/rfc8032">
        <front>
          <title>Edwards-Curve Digital Signature Algorithm (EdDSA)</title>
          <author fullname="S. Josefsson" initials="S." surname="Josefsson"/>
          <author fullname="I. Liusvaara" initials="I." surname="Liusvaara"/>
          <date month="January" year="2017"/>
        </front>
        <seriesInfo name="RFC" value="8032"/>
      </reference>
    </references>
    <references>
      <name>Informative References</name>
      <reference anchor="RFC9162" target="https://www.rfc-editor.org/info/rfc9162">
        <front>
          <title>Certificate Transparency Version 2.0</title>
          <author fullname="B. Laurie" initials="B." surname="Laurie"/>
          <author fullname="E. Messeri" initials="E." surname="Messeri"/>
          <author fullname="R. Stradling" initials="R." surname="Stradling"/>
          <date month="December" year="2021"/>
        </front>
        <seriesInfo name="RFC" value="9162"/>
      </reference>
      <reference anchor="RFC9334" target="https://www.rfc-editor.org/info/rfc9334">
        <front>
          <title>Remote ATtestation procedureS (RATS) Architecture</title>
          <author fullname="H. Birkholz" initials="H." surname="Birkholz"/>
          <author fullname="D. Thaler" initials="D." surname="Thaler"/>
          <author fullname="M. Richardson" initials="M." surname="Richardson"/>
          <author fullname="N. Smith" initials="N." surname="Smith"/>
          <author fullname="W. Pan" initials="W." surname="Pan"/>
          <date month="January" year="2023"/>
        </front>
        <seriesInfo name="RFC" value="9334"/>
      </reference>
      <reference anchor="I-D.durga-agenttrust-trace-verification" target="https://datatracker.ietf.org/doc/html/draft-durga-agenttrust-trace-verification-00">
        <front>
          <title>Cryptographic Execution-Trace Verification, JCS Canonicalization, and Fail-Closed Delegation Chains for Autonomous AI Agents</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="October" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-durga-agenttrust-trace-verification-00"/>
      </reference>
      <reference anchor="I-D.durga-wimse-ctx-isolation" target="https://datatracker.ietf.org/doc/html/draft-durga-wimse-ctx-isolation-00">
        <front>
          <title>Cryptographic Context Isolation and Instruction-Data Plane Separation for Autonomous Agent Tool Invocations</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="October" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-durga-wimse-ctx-isolation-00"/>
      </reference>
      <reference anchor="I-D.durga-pquip-pqc-agentic-delegation" target="https://datatracker.ietf.org/doc/html/draft-durga-pquip-pqc-agentic-delegation-00">
        <front>
          <title>Post-Quantum Hybrid Cryptographic Delegation Chains and Merkle-Aggregated Execution Receipts for Autonomous AI Agents</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="October" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-durga-pquip-pqc-agentic-delegation-00"/>
      </reference>
      <reference anchor="I-D.durga-agent-tx-compensation-lease" target="https://datatracker.ietf.org/doc/html/draft-durga-agent-tx-compensation-lease-00">
        <front>
          <title>Pre-Release Transactional Compensation Leases and CAS Fencing Receipts for Autonomous Agents Over Systems of Record</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="November" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-durga-agent-tx-compensation-lease-00"/>
      </reference>
      <reference anchor="I-D.wright-verdict-record" target="https://datatracker.ietf.org/doc/html/draft-wright-verdict-record-01">
        <front>
          <title>Verdict Records: Results on Claims that Cite Receipts as Evidence</title>
          <author fullname="Darren Wright" initials="D." surname="Wright"/>
          <date month="November" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-wright-verdict-record-01"/>
      </reference>
      <reference anchor="OWASP-ASI-BENCHMARK-DOI" target="https://doi.org/10.57967/hf/11352">
        <front>
          <title>OWASP ASI01-ASI10 Enterprise Agentic AI Security Regression Benchmark Dataset (N=100 Scenarios)</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="October" year="2026"/>
        </front>
        <seriesInfo name="DOI" value="10.57967/hf/11352"/>
      </reference>
      <reference anchor="XERJ-HUB-EVIDENCE" target="https://github.com/xerj-org/xerj/pull/2857">
        <front>
          <title>XERJ Common Rust Engine: Deterministic JCS TraceEvidenceReport, PinnedCitation, and Isotonic Confidence Verification</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="November" year="2026"/>
        </front>
        <seriesInfo name="GitHub" value="xerj-org/xerj#2857"/>
      </reference>
      <reference anchor="AGENTIC-GOV-BENCHMARKS" target="https://github.com/drk-ram/enterprise-agentic-governance-benchmarks/releases/tag/v1.0.0">
        <front>
          <title>Enterprise Agentic Governance Benchmarks and Reference Verifier Suite v1.0.0</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="November" year="2026"/>
        </front>
        <seriesInfo name="Version" value="1.0.0"/>
      </reference>
      <reference anchor="ZENODO-TR-2026-02" target="https://doi.org/10.5281/zenodo.23735276">
        <front>
          <title>Cross-Protocol Semantic Equivalence Proofs and Commit-Bound Metering Receipts for Multi-Vendor Agentic Exchanges</title>
          <author fullname="Raghuvar Karthik Durga" initials="R. K." surname="Durga"/>
          <date month="October" year="2026"/>
        </front>
        <seriesInfo name="DOI" value="10.5281/zenodo.23735276"/>
      </reference>
    </references>
  </back>
</rfc>
