<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" docName="draft-efstathiou-samp-agent-management-00" category="exp" ipr="trust200902" submissionType="IETF" xml:lang="en">
  <front>
    <title abbrev="SAMP">Simple Agent Management Protocol (SAMP)</title>
    <seriesInfo name="Internet-Draft" value="draft-efstathiou-samp-agent-management-00"/>
    <author fullname="Stelios E. Efstathiou" initials="S. E." surname="Efstathiou">
      <organization>Independent</organization>
      <address>
        <email>ietf@samp-protocol.org</email>
      </address>
    </author>
    <date year="2026" month="August" day="17"/>
    <area>Operations and Management</area>
    <workgroup>Individual Submission</workgroup>
    <keyword>SAMP</keyword>
    <keyword>agent management</keyword>
    <keyword>AI agent</keyword>
    <keyword>management protocol</keyword>
    <abstract>
      <t>The Simple Agent Management Protocol (SAMP) defines a lightweight management-plane protocol for heterogeneous AI agents. SAMP allows a management system to discover agents, query their state, receive events, subscribe to event streams, and optionally configure or execute explicitly exposed operations under policy control.</t>
      <t>SAMP is inspired by operational management protocols such as SNMP, but it is designed for AI-agent-specific concepts such as dynamic profiles, autonomy classes, enrollment, trust states, and policy-gated execution. It is not an agent-to-agent communication protocol, an agent tool-use protocol, or an agent framework specification.</t>
      <t>This document defines SAMP version 0.1 as an Experimental protocol suitable for controlled environments and independent interoperability testing.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="introduction"><name>Introduction</name>
      <t>AI agents are increasingly deployed as long-running services, assistants, automation workers, coding agents, operational copilots, and autonomous or semi-autonomous control loops. These agents are commonly built with different frameworks, runtime environments, model providers, memory systems, and tool interfaces. Operators need a consistent way to observe and manage these agents without depending on framework-specific APIs.</t>
      <t>SAMP defines a management-plane interface between a SAMP Manager and a SAMP Agent. The protocol covers discovery, enrollment, heartbeat, state query, asynchronous event notification, subscription, configuration, and controlled execution.</t>
      <t>SAMP deliberately does not define how agents reason, how models are selected, how tools are invoked, or how agents communicate with each other. Those concerns belong to other layers.</t>
      <t>This document specifies SAMP version 0.1, intended for controlled environments such as private data centers, research labs, and operator networks where a management system needs visibility into and control of AI agents. SAMP v0.1 is not intended for untrusted networks without additional security mechanisms.</t>
      <section><name>Scope</name>
        <t>SAMP v0.1 defines:</t>
        <ul>
          <li>A JSON-based message format and common PDU envelope.</li>
          <li>Nine PDU types covering discovery, heartbeat, query, event notification, subscription, configuration, and execution.</li>
          <li>A profile model for agent identity, exposed fields, and policy declarations.</li>
          <li>Trust states and an enrollment model.</li>
          <li>Autonomy classes as advisory metadata for manager policy.</li>
          <li>HMAC-SHA256 message authentication.</li>
          <li>HTTP(S) as the baseline transport.</li>
          <li>Conformance tiers.</li>
          <li>IANA registry framework.</li>
        </ul>
        <t>SAMP v0.1 does NOT define:</t>
        <ul>
          <li>Federation or multi-manager coordination.</li>
          <li>Fleet-wide bulk or transactional operations.</li>
          <li>Role-based access control (RBAC).</li>
          <li>Mandatory mutual TLS (mTLS).</li>
          <li>A formal profile schema language (e.g., JSON Schema, YANG).</li>
          <li>Agent-to-agent communication.</li>
          <li>Agent tool-use interfaces.</li>
          <li>Model selection or inference protocols.</li>
        </ul>
      </section>
      <section><name>Relationship to Existing Protocols</name>
        <t>SAMP occupies the AI agent management plane. It is intended to coexist with existing management, telemetry, tool, and agent-communication protocols.</t>
        <dl>
          <dt>SNMP</dt>
          <dd>SAMP is SNMP-inspired, but not SNMP-compatible. SNMP <xref target="RFC3411"/>/<xref target="RFC3416"/> is device-centric and based on MIB objects <xref target="RFC2578"/>/<xref target="RFC2579"/>/<xref target="RFC2580"/> and GET/SET/TRAP operations. SAMP adds AI-agent concepts such as dynamic profiles, autonomy classes, enrollment, trust states, and policy-gated execution.</dd>
          <dt>NETCONF/YANG</dt>
          <dd>NETCONF <xref target="RFC6241"/> and YANG <xref target="RFC7950"/> provide strong configuration and modeling facilities for network devices. SAMP targets agent lifecycle, discovery, trust, and runtime management. A future SAMP profile model could be mapped to YANG, but that is outside this document.</dd>
          <dt>OpenTelemetry</dt>
          <dd>OpenTelemetry provides observability for traces, metrics, and logs. SAMP can export or correlate events with observability systems, but it defines management operations that observability systems do not provide.</dd>
          <dt>OpenTelemetry OpAMP</dt>
          <dd>The Open Agent Management Protocol (OpAMP) <xref target="OPAMP"/> manages telemetry and data-collection agents. SAMP addresses autonomous and semi-autonomous AI agents as operational entities. The two protocols are complementary and can coexist in the same management architecture. A deployment may use OpAMP for its telemetry collectors and SAMP for its AI agents, with a unified management dashboard.</dd>
          <dt>MCP</dt>
          <dd>MCP <xref target="MCP"/> is a tool-use interface for applications and agents. SAMP is a management interface for operators and management systems.</dd>
          <dt>A2A and ACP</dt>
          <dd>Agent-to-agent protocols <xref target="A2A"/> define peer communication and collaboration. SAMP defines manager-to-agent management.</dd>
        </dl>
        <table><name>Protocol Layer Comparison</name>
          <thead><tr><th>Layer</th><th>Protocol</th><th>Purpose</th></tr></thead>
          <tbody>
            <tr><td>Tool use</td><td>MCP</td><td>Agent-to-tool invocation</td></tr>
            <tr><td>Agent communication</td><td>A2A / ACP</td><td>Agent-to-agent collaboration</td></tr>
            <tr><td>Observability</td><td>OpenTelemetry</td><td>Traces, metrics, logs</td></tr>
            <tr><td>Telemetry agent management</td><td>OpAMP</td><td>Manage data-collection agents</td></tr>
            <tr><td>AI agent management</td><td>SAMP</td><td>Manage autonomous/semi-autonomous AI agents</td></tr>
          </tbody>
        </table>
      </section>
    </section>
    <section anchor="terminology"><name>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>
      <t>The following terms are defined for use in this document:</t>
      <dl>
        <dt>SAMP Agent</dt><dd>An AI agent that exposes a SAMP management interface.</dd>
        <dt>SAMP Manager</dt><dd>A system that manages one or more SAMP Agents using SAMP.</dd>
        <dt>SAMP Profile</dt><dd>A structured document that declares the identity, exposed categories, fields, capabilities, and policy-relevant properties of a SAMP Agent.</dd>
        <dt>PDU</dt><dd>Protocol Data Unit. A SAMP message envelope and its payload.</dd>
        <dt>Autonomy Class</dt><dd>A profile attribute that describes the operational risk class of an agent. It is used as an input to manager policy, but does not by itself grant authority.</dd>
        <dt>Enrollment</dt><dd>The process by which a manager evaluates an announced agent and assigns an initial trust state.</dd>
        <dt>Trust State</dt><dd>The manager's state for an agent, such as discovered, pending, trusted, quarantined, rejected, offline, stale, or revoked.</dd>
        <dt>Conformance Tier</dt><dd>A defined level of protocol support that an implementation may claim. See <xref target="conformance"/>.</dd>
      </dl>
    </section>
    <section><name>Architecture</name>
      <t>The basic SAMP architecture contains a manager and one or more agents:</t>
      <artwork><![CDATA[
+--------------+        SAMP         +--------------+
| SAMP Manager | <-----------------> |  SAMP Agent |
|              |                     |              |
| Registry     |                     | Profile      |
| Policy       |                     | State        |
| Scheduler    |                     | Capabilities |
+--------------+                     +--------------+
]]></artwork>
      <t>A SAMP Agent maintains a SAMP Profile and exposes SAMP operations. A SAMP Manager maintains a registry, evaluates trust, applies policy, and initiates management operations.</t>
      <t>SAMP is a management protocol. It does not require a specific agent framework, model provider, orchestration system, memory backend, or tool protocol.</t>
      <section><name>Roles</name>
        <t>SAMP Manager:</t>
        <ul>
          <li>Maintains a registry of known agents.</li>
          <li>Evaluates agent trust and applies policy.</li>
          <li>Initiates QUERY, CONFIG, EXEC, SUBSCRIBE, and UNSUBSCRIBE operations.</li>
          <li>Receives PING, DISCOVER, and PUSH from agents.</li>
          <li>Returns DISCOVER_ACK in response to DISCOVER.</li>
        </ul>
        <t>SAMP Agent:</t>
        <ul>
          <li>Maintains a SAMP Profile describing its identity and capabilities.</li>
          <li>Sends DISCOVER to announce itself to a manager.</li>
          <li>Sends periodic PING heartbeats.</li>
          <li>Responds to QUERY requests.</li>
          <li>Emits PUSH events.</li>
          <li>Accepts or rejects CONFIG and EXEC based on profile and local policy.</li>
          <li>Manages event subscriptions for SUBSCRIBE/UNSUBSCRIBE.</li>
        </ul>
      </section>
    </section>
    <section><name>Agent Lifecycle and Trust States</name>
      <t>An agent announces itself with DISCOVER. The manager validates the identity, profile, authentication material, and any pre-registration data before assigning a trust state.</t>
      <t>The following trust states are defined:</t>
      <dl>
        <dt>discovered</dt><dd>The agent has announced itself, but has not yet been evaluated.</dd>
        <dt>pending</dt><dd>The manager is aware of the agent and awaits a trust decision.</dd>
        <dt>trusted</dt><dd>The manager has accepted the agent. This is a prerequisite for management operations, but does not automatically enable CONFIG or EXEC.</dd>
        <dt>quarantined</dt><dd>The agent is isolated for read-only observation or investigation.</dd>
        <dt>rejected</dt><dd>The manager refuses the agent.</dd>
        <dt>offline</dt><dd>The agent is known, but is not currently reachable.</dd>
        <dt>stale</dt><dd>The agent has missed expected heartbeats beyond the configured threshold.</dd>
        <dt>revoked</dt><dd>The manager has explicitly revoked trust.</dd>
      </dl>
      <section><name>Trust Transitions</name>
        <t>Trust transitions are controlled by the manager. Agents <bcp14>MUST NOT</bcp14> self-promote to trusted.</t>
        <t>The following transitions are normative:</t>
        <ul>
          <li>discovered to pending: Manager begins evaluation.</li>
          <li>pending to trusted: Manager approves the agent.</li>
          <li>pending to rejected: Manager refuses the agent.</li>
          <li>pending to quarantined: Manager isolates for investigation.</li>
          <li>trusted to quarantined: Manager isolates a previously trusted agent.</li>
          <li>trusted to revoked: Manager revokes trust.</li>
          <li>trusted to offline: Agent becomes unreachable.</li>
          <li>offline to trusted: Agent returns and re-authenticates.</li>
          <li>offline to stale: Agent has been offline beyond the stale threshold.</li>
          <li>stale to revoked: Manager gives up on the agent.</li>
          <li>Any state to revoked: Manager explicitly revokes.</li>
        </ul>
        <t>CONFIG and EXEC <bcp14>MUST NOT</bcp14> be accepted before trusted state is established. QUERY and PUSH <bcp14>MAY</bcp14> be accepted from quarantined agents at manager discretion.</t>
      </section>
      <section><name>Enrollment</name>
        <t>Enrollment is the process by which a manager evaluates an announced agent and assigns an initial trust state. SAMP v0.1 supports the following enrollment methods:</t>
        <dl>
          <dt>Manual approval</dt><dd>The manager operator manually approves or rejects each discovered agent.</dd>
          <dt>Pre-shared token</dt><dd>The agent includes a pre-shared enrollment token in its DISCOVER payload. The manager validates the token against a pre-registration list.</dd>
          <dt>Public key thumbprint</dt><dd>The agent includes a public key or thumbprint in its DISCOVER payload. The manager validates it against a pre-registration list. This method is preparatory for future per-agent public key signing.</dd>
        </dl>
        <t>The enrollment method is a manager-side policy decision. The agent supplies authentication material; the manager decides.</t>
      </section>
      <section><name>Agent Bootstrap and Manager Location</name>
        <t>Agents need to locate a manager before sending DISCOVER. SAMP v0.1 supports the following bootstrap methods:</t>
        <dl>
          <dt>Configuration file</dt><dd>The agent reads the manager URL from a local configuration file.</dd>
          <dt>Environment variable</dt><dd>The agent reads the manager URL from an environment variable.</dd>
          <dt>Command-line argument</dt><dd>The agent receives the manager URL as a startup argument.</dd>
          <dt>DNS SRV record</dt><dd>The agent resolves a DNS SRV record to discover the manager endpoint.</dd>
          <dt>Manager pre-provisioning</dt><dd>The manager URL is pre-provisioned in the agent's deployment environment (e.g., container orchestration config).</dd>
          <dt>Manual specification</dt><dd>The operator manually provides the manager URL at agent startup.</dd>
        </dl>
        <t>Bootstrap method selection is an implementation decision. The protocol does not mandate a specific bootstrap mechanism.</t>
      </section>
    </section>
    <section><name>SAMP Profile</name>
      <t>A SAMP Profile describes the agent as a managed entity. It includes:</t>
      <ul>
        <li><strong>Identity fields</strong>: agent_id, agent_version, profile_version, agent_type, autonomy_class, and optional framework metadata.</li>
        <li><strong>Categories and fields</strong>: Named groups of exposed state or configuration fields.</li>
        <li><strong>Capabilities</strong>: Event subscriptions, executable commands, or other advertised capabilities.</li>
        <li><strong>Policy declarations</strong>: exec_policy and config_policy controlling CONFIG and EXEC behavior.</li>
        <li><strong>Implementation metadata</strong>: Fields needed by the manager for registration and registry maintenance.</li>
      </ul>
      <section><name>Required Identity Fields</name>
        <t>The following fields <bcp14>MUST</bcp14> be present in every SAMP Profile:</t>
        <table><name>Required Profile Identity Fields</name>
          <thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead>
          <tbody>
            <tr><td>agent_id</td><td>string</td><td>Unique agent identifier</td></tr>
            <tr><td>name</td><td>string</td><td>Human-readable agent name</td></tr>
            <tr><td>agent_version</td><td>string</td><td>Agent software version</td></tr>
            <tr><td>profile_version</td><td>string</td><td>SAMP profile schema version</td></tr>
            <tr><td>agent_type</td><td>string</td><td>Framework type (e.g., openclaw, hermes, custom)</td></tr>
            <tr><td>autonomy_class</td><td>string</td><td>Autonomy classification (see <xref target="autonomy-classes"/>)</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>Category and Field Model</name>
        <t>A profile organizes exposed data into categories. Each category contains named fields with declared types.</t>
        <t>Supported field types in SAMP v0.1:</t>
        <table><name>Profile Field Types</name>
          <thead><tr><th>Type</th><th>JSON representation</th></tr></thead>
          <tbody>
            <tr><td>string</td><td>JSON string</td></tr>
            <tr><td>int</td><td>JSON number (integer)</td></tr>
            <tr><td>float</td><td>JSON number</td></tr>
            <tr><td>boolean</td><td>JSON boolean</td></tr>
            <tr><td>timestamp</td><td>JSON string in RFC 3339 format</td></tr>
            <tr><td>object</td><td>JSON object</td></tr>
            <tr><td>array</td><td>JSON array</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>Minimal Required Category</name>
        <t>Every profile <bcp14>MUST</bcp14> include a system category with at least the following fields:</t>
        <table><name>Required System Category Fields</name>
          <thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead>
          <tbody>
            <tr><td>system.status</td><td>string</td><td>Current operational status</td></tr>
            <tr><td>system.uptime</td><td>int</td><td>Uptime in seconds</td></tr>
            <tr><td>system.version</td><td>string</td><td>Agent software version</td></tr>
            <tr><td>system.last_seen</td><td>timestamp</td><td>Last heartbeat or interaction time</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>Profile Validation</name>
        <t>Managers <bcp14>MUST</bcp14> validate a profile before trusting an agent. Validation includes:</t>
        <ul>
          <li>Presence of all required identity fields.</li>
          <li>Presence of the system category with all required fields.</li>
          <li>Valid autonomy_class value (see <xref target="autonomy-classes"/>).</li>
          <li>Valid field type declarations.</li>
          <li>Presence and validity of policy declarations if CONFIG or EXEC capabilities are advertised.</li>
        </ul>
        <t>Managers <bcp14>MUST NOT</bcp14> fetch arbitrary external profile URLs from untrusted DISCOVER payloads. Profiles <bcp14>SHOULD</bcp14> be sent inline or retrieved only from manager-approved locations.</t>
      </section>
      <section><name>Profile Format</name>
        <t>Profiles are authored as TOML in SAMP version 0.1 for human readability. Implementations <bcp14>MAY</bcp14> represent the profile internally as structured JSON or another equivalent data model. The on-the-wire encoding of profile data in SAMP PDUs is JSON.</t>
      </section>
    </section>
    <section anchor="autonomy-classes"><name>Autonomy Classes</name>
      <t>Every SAMP Agent declares an autonomy_class in its profile. The following initial classes are defined:</t>
      <dl>
        <dt>advisory</dt><dd>Read-only observation and reporting only. Agent does not accept CONFIG or EXEC.</dd>
        <dt>operational-readonly</dt><dd>Observation and limited local or self-configuration. No execution.</dd>
        <dt>operational-write</dt><dd>Configuration is allowed. Execution is limited to an explicit allow-list defined in the profile.</dd>
        <dt>critical-write</dt><dd>Configuration and execution are allowed only under strict policy.</dd>
      </dl>
      <t>The autonomy class is an input to policy. It <bcp14>MUST NOT</bcp14> grant permission by itself. Manager policy remains authoritative.</t>
      <t>An agent with advisory autonomy class <bcp14>SHOULD NOT</bcp14> advertise CONFIG or EXEC capabilities. A manager <bcp14>SHOULD</bcp14> reject CONFIG or EXEC attempts targeting an advisory agent.</t>
    </section>
    <section anchor="protocol-operations"><name>Protocol Operations</name>
      <t>SAMP version 0.1 defines the following PDU types:</t>
      <dl>
        <dt>PING</dt><dd>Agent-to-manager heartbeat. The manager responds with a PING response (a PING PDU with direction: "response").</dd>
        <dt>DISCOVER</dt><dd>Agent-to-manager self-announcement and profile advertisement. The manager responds with DISCOVER_ACK.</dd>
        <dt>DISCOVER_ACK</dt><dd>Manager response to DISCOVER, including the assigned trust state and optional manager-assigned metadata.</dd>
        <dt>QUERY</dt><dd>Manager-to-agent request for state, metadata, or profile fields. The agent responds with a QUERY PDU with direction: "response".</dd>
        <dt>PUSH</dt><dd>Agent-to-manager asynchronous event notification. No response is expected unless the manager explicitly requests acknowledgment.</dd>
        <dt>SUBSCRIBE</dt><dd>Manager-to-agent request to subscribe to an event stream. The agent responds with a subscription_id.</dd>
        <dt>UNSUBSCRIBE</dt><dd>Manager-to-agent request to cancel a subscription.</dd>
        <dt>CONFIG</dt><dd>Manager-to-agent configuration change. The agent responds with success or error.</dd>
        <dt>EXEC</dt><dd>Manager-to-agent request to execute an explicitly exposed operation. The agent responds with a result or error.</dd>
      </dl>
      <section><name>PDU Directions</name>
        <t>Each PDU has a direction field indicating its role:</t>
        <table><name>PDU Directions</name>
          <thead><tr><th>Direction</th><th>Meaning</th></tr></thead>
          <tbody>
            <tr><td>request</td><td>Initiates an operation</td></tr>
            <tr><td>response</td><td>Responds to a request</td></tr>
            <tr><td>notification</td><td>Unsolicited asynchronous message</td></tr>
            <tr><td>error</td><td>Error response to a request</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>PDU Exchange Patterns</name>
        <table><name>PDU Exchange Patterns</name>
          <thead><tr><th>PDU Type</th><th>Pattern</th><th>Initiator</th></tr></thead>
          <tbody>
            <tr><td>PING</td><td>request - response</td><td>Agent</td></tr>
            <tr><td>DISCOVER</td><td>request - response (DISCOVER_ACK)</td><td>Agent</td></tr>
            <tr><td>QUERY</td><td>request - response</td><td>Manager</td></tr>
            <tr><td>PUSH</td><td>notification (no response)</td><td>Agent</td></tr>
            <tr><td>SUBSCRIBE</td><td>request - response</td><td>Manager</td></tr>
            <tr><td>UNSUBSCRIBE</td><td>request - response</td><td>Manager</td></tr>
            <tr><td>CONFIG</td><td>request - response</td><td>Manager</td></tr>
            <tr><td>EXEC</td><td>request - response</td><td>Manager</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>Authentication Requirements by PDU</name>
        <t>All PDUs exchanged between a manager and an agent <bcp14>MUST</bcp14> be authenticated when authentication is enabled. See <xref target="authentication"/> for details.</t>
      </section>
      <section><name>DISCOVER Rate Limiting</name>
        <t>Managers <bcp14>SHOULD</bcp14> rate-limit DISCOVER messages from unknown agents to prevent discovery flooding. A manager <bcp14>MAY</bcp14> maintain a pending-agent quota and reject excess discoveries with a rate_limited error.</t>
      </section>
      <section><name>SUBSCRIBE and UNSUBSCRIBE Semantics</name>
        <t>When a manager sends SUBSCRIBE, the agent allocates a subscription and returns a subscription_id in the response. Subsequent PUSH PDUs related to that subscription include the subscription_id in the envelope.</t>
        <t>Subscriptions have a manager-defined or agent-defined time-to-live (TTL). A subscription that is not renewed within its TTL expires automatically. Managers <bcp14>SHOULD</bcp14> renew subscriptions before expiry.</t>
        <t>UNSUBSCRIBE cancels an active subscription. The agent stops sending PUSH PDUs for the cancelled subscription.</t>
        <t>Subscription persistence across agent restarts is NOT required in SAMP v0.1. Subscriptions do not survive agent reconnect unless the agent implementation explicitly supports persistence.</t>
      </section>
    </section>
    <section anchor="message-format"><name>Message Format</name>
      <t>All SAMP messages use a common PDU envelope encoded as UTF-8 JSON <xref target="RFC8259"/> in SAMP version 0.1.</t>
      <section><name>Common PDU Envelope</name>
        <t>The following table defines the envelope fields:</t>
        <table><name>Common PDU Envelope Fields</name>
          <thead><tr><th>Field</th><th>Type</th><th>Presence</th><th>Description</th></tr></thead>
          <tbody>
            <tr><td>version</td><td>string</td><td>Required</td><td>Protocol version, e.g., "0.1"</td></tr>
            <tr><td>type</td><td>string</td><td>Required</td><td>PDU type (see <xref target="protocol-operations"/>)</td></tr>
            <tr><td>direction</td><td>string</td><td>Required</td><td>One of request, response, notification, error</td></tr>
            <tr><td>agent_id</td><td>string</td><td>Required</td><td>Identifier of the managed agent</td></tr>
            <tr><td>timestamp</td><td>string</td><td>Required</td><td>UTC timestamp in RFC 3339 format <xref target="RFC3339"/></td></tr>
            <tr><td>request_id</td><td>string</td><td>Required</td><td>UUID for correlation and replay protection <xref target="RFC9562"/></td></tr>
            <tr><td>payload</td><td>object</td><td>Required</td><td>PDU-specific JSON object. Empty payloads encode as {}.</td></tr>
            <tr><td>signature</td><td>string</td><td>Conditional</td><td>HMAC-SHA256 signature (see <xref target="authentication"/>). Required when authentication is enabled.</td></tr>
            <tr><td>sequence</td><td>int</td><td>Optional</td><td>Sequence number for ordered streams</td></tr>
            <tr><td>subscription_id</td><td>string</td><td>Optional</td><td>Subscription identifier for SUBSCRIBE/UNSUBSCRIBE/PUSH</td></tr>
          </tbody>
        </table>
        <section><name>Field Validation Rules</name>
          <ul>
            <li>version <bcp14>MUST</bcp14> be "0.1" for this version of the protocol.</li>
            <li>type <bcp14>MUST</bcp14> be one of the PDU types listed in <xref target="protocol-operations"/>, expressed in lowercase (e.g., "ping", "discover", "query").</li>
            <li>direction <bcp14>MUST</bcp14> be one of request, response, notification, error.</li>
            <li>agent_id <bcp14>MUST</bcp14> be a non-empty string.</li>
            <li>timestamp <bcp14>MUST</bcp14> be a valid RFC 3339 UTC timestamp with timezone designator Z.</li>
            <li>request_id <bcp14>MUST</bcp14> be a valid UUID as defined by <xref target="RFC9562"/>. Implementations <bcp14>SHOULD</bcp14> use UUID version 4 or another version with equivalent uniqueness properties.</li>
            <li>payload <bcp14>MUST</bcp14> be a JSON object. Empty payloads are encoded as {}.</li>
            <li>Unknown envelope fields <bcp14>MUST</bcp14> be ignored by receivers. This ensures forward compatibility.</li>
            <li>Unknown PDU types <bcp14>MUST</bcp14> return an unknown_type error.</li>
          </ul>
        </section>
        <section><name>Request/Response Correlation</name>
          <t>A response or error PDU <bcp14>MUST</bcp14> include the same request_id as the request it corresponds to. This allows both parties to correlate requests and responses without relying on transport-level correlation.</t>
        </section>
        <section><name>Timestamp Validation</name>
          <t>Receivers <bcp14>SHOULD</bcp14> validate that timestamps are within an acceptable clock skew window (e.g., plus or minus 300 seconds). PDUs with timestamps outside the window <bcp14>SHOULD</bcp14> be rejected with a replay_detected error when replay protection is enabled.</t>
        </section>
        <section><name>Sequence Numbers</name>
          <t>The sequence field is <bcp14>OPTIONAL</bcp14>. When present, it provides ordering for streams of PDUs (e.g., subscription event streams). Sequence numbers are per-subscription and start at 1. Receivers <bcp14>MAY</bcp14> detect gaps but <bcp14>MUST NOT</bcp14> reject PDUs solely for sequence gaps in SAMP v0.1.</t>
        </section>
      </section>
      <section><name>PDU-Specific Payloads</name>
        <section><name>PING</name>
          <t>Request payload:</t>
          <artwork><![CDATA[{}]]></artwork>
          <t>Response payload:</t>
          <artwork><![CDATA[{"status": "operational"}]]></artwork>
          <t>The status field in the response is a free-form string indicating the agent's self-reported status (e.g., "operational", "degraded").</t>
        </section>
        <section><name>DISCOVER</name>
          <t>Request payload:</t>
          <artwork><![CDATA[{
  "profile": { /* full SAMP Profile object */ },
  "endpoint": "https://agent.example/samp",
  "capabilities": ["query", "push", "exec"]
}]]></artwork>
          <t>The profile field contains the full SAMP Profile. The endpoint field contains the agent's SAMP endpoint URL. The capabilities array lists the PDU operations the agent supports.</t>
          <t>Response (DISCOVER_ACK) payload:</t>
          <artwork><![CDATA[{
  "state": "trusted",
  "manager_version": "0.1",
  "assigned_id": "agent-001"
}]]></artwork>
          <t>The state field contains the manager-assigned trust state. The manager_version field contains the manager's SAMP version. The assigned_id field is optional and <bcp14>MAY</bcp14> be used when the manager assigns or overrides the agent identifier.</t>
          <t>If enrollment is rejected, the response payload contains:</t>
          <artwork><![CDATA[{
  "state": "rejected",
  "reason": "profile_invalid"
}]]></artwork>
        </section>
        <section><name>QUERY</name>
          <t>Request payload:</t>
          <artwork><![CDATA[{
  "fields": ["system.status", "system.uptime", "model.primary"]
}]]></artwork>
          <t>The fields array contains one or more dotted-path field identifiers from the agent's profile categories. The agent returns values for fields it supports and reports unknown_field for unsupported fields.</t>
          <t>Response payload:</t>
          <artwork><![CDATA[{
  "values": {
    "system.status": "operational",
    "system.uptime": 86400
  },
  "unknown": ["model.primary"]
}]]></artwork>
          <t>The values object contains the resolved field values. The unknown array lists requested fields that the agent does not expose. If all requested fields are unknown, the response is an error with code unknown_field.</t>
        </section>
        <section><name>PUSH</name>
          <t>Notification payload:</t>
          <artwork><![CDATA[{
  "event": "status_change",
  "data": {
    "old_status": "operational",
    "new_status": "degraded"
  },
  "category": "system"
}]]></artwork>
          <t>The event field is the event type. The data field is an arbitrary JSON object with event-specific content. The category field indicates the profile category the event relates to.</t>
          <t>PUSH PDUs use direction: "notification". No response is expected unless the manager explicitly requests acknowledgment.</t>
        </section>
        <section><name>SUBSCRIBE</name>
          <t>Request payload:</t>
          <artwork><![CDATA[{
  "event_types": ["status_change", "alert"],
  "category": "system",
  "ttl_seconds": 300
}]]></artwork>
          <t>The event_types array filters the subscription to specific event types. An empty array or omitted field subscribes to all events in the specified category. The ttl_seconds field requests a subscription time-to-live.</t>
          <t>Response payload:</t>
          <artwork><![CDATA[{
  "subscription_id": "sub-abc123",
  "ttl_seconds": 300,
  "renew_before": "2026-08-14T09:05:00Z"
}]]></artwork>
        </section>
        <section><name>UNSUBSCRIBE</name>
          <t>Request payload:</t>
          <artwork><![CDATA[{"subscription_id": "sub-abc123"}]]></artwork>
          <t>Response payload:</t>
          <artwork><![CDATA[{"cancelled": true}]]></artwork>
        </section>
        <section><name>CONFIG</name>
          <t>Request payload:</t>
          <artwork><![CDATA[{
  "fields": {
    "model.fallback": "kimi-k2.6",
    "system.log_level": "debug"
  },
  "scope": "agent"
}]]></artwork>
          <t>The fields object contains the configuration key-value pairs to apply. Keys are dotted-path identifiers. The scope field is either "agent" (agent-wide) or "session" (current session only). The default scope is "agent".</t>
          <t>Response payload:</t>
          <artwork><![CDATA[{
  "applied": ["model.fallback", "system.log_level"],
  "rejected": []
}]]></artwork>
          <t>The applied array lists fields that were successfully changed. The rejected array lists fields that were rejected, with optional reasons:</t>
          <artwork><![CDATA[{
  "applied": ["system.log_level"],
  "rejected": [
    {"field": "model.fallback", "reason": "read_only"}
  ]
}]]></artwork>
          <t>CONFIG is disabled unless explicitly supported by the agent profile and allowed by manager policy. The agent <bcp14>MUST</bcp14> validate each field against its profile-declared writable fields.</t>
        </section>
        <section><name>EXEC</name>
          <t>Request payload:</t>
          <artwork><![CDATA[{
  "command": "session_reset",
  "params": {
    "session_id": "sess-001"
  }
}]]></artwork>
          <t>The command field names an executable operation from the agent's profile exec_policy.allowed_commands. The params object contains typed parameters matching the command's declared schema.</t>
          <t>Response payload:</t>
          <artwork><![CDATA[{
  "result": "success",
  "output": {
    "reset": true
  }
}]]></artwork>
          <t>If the command is rejected, the response contains:</t>
          <artwork><![CDATA[{
  "result": "exec_disabled",
  "detail": "EXEC is not enabled for this agent"
}]]></artwork>
          <t>EXEC is disabled by default. It <bcp14>MUST</bcp14> be explicitly enabled per agent and per command in the profile. Parameters <bcp14>MUST</bcp14> have typed schemas; free-form arguments are not allowed.</t>
        </section>
      </section>
      <section><name>Error Envelope</name>
        <t>When an error occurs, the response PDU has direction: "error" and the payload contains an error object:</t>
        <artwork><![CDATA[{
  "version": "0.1",
  "type": "query",
  "direction": "error",
  "agent_id": "agent-001",
  "timestamp": "2026-08-14T09:00:01Z",
  "request_id": "24f8587c-4c4b-4e41-9f47-222c0f5f8b8b",
  "payload": {
    "error": {
      "code": "unknown_field",
      "detail": "Field 'model.primary' is not exposed",
      "timestamp": "2026-08-14T09:00:01Z"
    }
  }
}]]></artwork>
        <t>The error payload object has the following fields:</t>
        <table><name>Error Payload Fields</name>
          <thead><tr><th>Field</th><th>Type</th><th>Presence</th><th>Description</th></tr></thead>
          <tbody>
            <tr><td>code</td><td>string</td><td>Required</td><td>Error code (see <xref target="error-codes"/>)</td></tr>
            <tr><td>detail</td><td>string</td><td>Optional</td><td>Human-readable error detail</td></tr>
            <tr><td>timestamp</td><td>string</td><td>Required</td><td>UTC timestamp in RFC 3339 format</td></tr>
          </tbody>
        </table>
      </section>
      <section anchor="error-codes"><name>Error Codes</name>
        <t>The following error codes are defined for SAMP v0.1:</t>
        <table><name>SAMP Error Codes</name>
          <thead><tr><th>Code</th><th>Description</th></tr></thead>
          <tbody>
            <tr><td>malformed_pdu</td><td>The PDU is not valid JSON or is missing required envelope fields</td></tr>
            <tr><td>unknown_type</td><td>The PDU type is not recognized</td></tr>
            <tr><td>invalid_value</td><td>A field value is invalid (e.g., wrong type, out of range)</td></tr>
            <tr><td>schema_mismatch</td><td>The payload does not match the expected schema for the PDU type</td></tr>
            <tr><td>version_unsupported</td><td>The protocol version is not supported</td></tr>
            <tr><td>profile_invalid</td><td>The profile is missing required fields or is otherwise invalid</td></tr>
            <tr><td>auth_failed</td><td>Authentication failed (missing or invalid signature)</td></tr>
            <tr><td>replay_detected</td><td>The request_id was previously seen with different request content, or the PDU violates the replay-window policy</td></tr>
            <tr><td>unknown_field</td><td>A requested field is not exposed by the agent</td></tr>
            <tr><td>exec_disabled</td><td>EXEC is not enabled for this agent or command</td></tr>
            <tr><td>config_disabled</td><td>CONFIG is not enabled for this agent</td></tr>
            <tr><td>policy_denied</td><td>Manager policy denies the requested operation</td></tr>
            <tr><td>rate_limited</td><td>The receiver is rate-limiting requests</td></tr>
            <tr><td>back_pressure</td><td>The receiver is overloaded and cannot process the request</td></tr>
            <tr><td>bootstrap_failed</td><td>Agent bootstrap or enrollment failed</td></tr>
            <tr><td>internal_error</td><td>An internal error occurred on the receiver side</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>JSON Encoding Requirements</name>
        <ul>
          <li>All SAMP JSON <bcp14>MUST</bcp14> be encoded as UTF-8 <xref target="RFC8259"/>.</li>
          <li>Implementations <bcp14>MUST NOT</bcp14> include byte-order marks (BOM).</li>
          <li>Implementations <bcp14>MUST NOT</bcp14> use non-standard JSON extensions (e.g., trailing commas, comments).</li>
          <li>Field names in the envelope and in defined payloads are lowercase with underscores (e.g., request_id, agent_id).</li>
          <li>Timestamps <bcp14>MUST</bcp14> use RFC 3339 UTC format with the Z designator <xref target="RFC3339"/>.</li>
          <li>UUIDs <bcp14>MUST</bcp14> be in canonical string form <xref target="RFC9562"/>.</li>
          <li>Unknown envelope fields <bcp14>MUST</bcp14> be ignored (forward compatibility).</li>
          <li>Unknown PDU types <bcp14>MUST</bcp14> return unknown_type error.</li>
        </ul>
      </section>
      <section><name>Behavior for Unknown Fields and Unknown PDU Types</name>
        <ul>
          <li>Unknown envelope fields: <bcp14>MUST</bcp14> be ignored. This enables forward compatibility.</li>
          <li>Unknown PDU types: <bcp14>MUST</bcp14> return an unknown_type error.</li>
          <li>Unknown payload fields within a known PDU type: <bcp14>MUST</bcp14> be ignored, unless the PDU type explicitly defines strict validation.</li>
          <li>Unknown profile fields: <bcp14>MUST</bcp14> be ignored by the manager during validation, but <bcp14>SHOULD</bcp14> be logged.</li>
        </ul>
      </section>
    </section>
    <section anchor="authentication"><name>Authentication</name>
      <t>SAMP v0.1 uses shared-secret authentication with HMAC-SHA256 <xref target="RFC2104"/> <xref target="RFC6234"/>.</t>
      <section><name>Authentication Model</name>
        <t>SAMP distinguishes between:</t>
        <ul>
          <li><strong>Mandatory implementation support</strong>: All conformant SAMP v0.1 implementations <bcp14>MUST</bcp14> support HMAC-SHA256 message authentication.</li>
          <li><strong>Mandatory deployment use</strong>: Deployments on non-localhost networks <bcp14>MUST</bcp14> enable authentication and <bcp14>MUST</bcp14> use HTTPS for transport confidentiality.</li>
          <li><strong>Localhost/lab exception</strong>: Authentication <bcp14>MAY</bcp14> be disabled for loopback (127.0.0.1/localhost) development and testing only.</li>
          <li><strong>Message authentication</strong>: HMAC-SHA256 over the canonical form of the PDU (see <xref target="canonical-json"/>).</li>
          <li><strong>Transport confidentiality</strong>: Provided by TLS 1.3 <xref target="RFC8446"/> for HTTPS. SAMP does not define its own transport encryption.</li>
          <li><strong>Authorization policy</strong>: Enforced by the manager based on trust state, autonomy class, and local policy. Authentication is a prerequisite for authorization, not a substitute.</li>
        </ul>
      </section>
      <section><name>HMAC-SHA256 Signing</name>
        <t>When authentication is enabled:</t>
        <ol>
          <li>The sender computes a canonical JSON representation of the PDU (see <xref target="canonical-json"/>).</li>
          <li>The sender computes HMAC-SHA256 over the canonical bytes using the shared secret.</li>
          <li>The resulting signature is placed in the signature envelope field as a lowercase hex-encoded string.</li>
          <li>The receiver recomputes the HMAC over the canonical form (excluding the signature field) and compares it to the received signature.</li>
          <li>If the signature is missing or does not match, the receiver returns an auth_failed error.</li>
        </ol>
      </section>
      <section><name>Key Identification</name>
        <t>SAMP v0.1 uses a single shared secret per manager-agent pair. Key identification (e.g., key IDs) is not defined in v0.1. Future versions <bcp14>MAY</bcp14> introduce key identification for multi-key support.</t>
        <t>Key distribution is out of band. Implementations <bcp14>SHOULD</bcp14> store shared secrets in a secrets manager, not in plaintext configuration files.</t>
      </section>
      <section anchor="canonical-json"><name>Canonical JSON</name>
        <t>SAMP v0.1 uses the JSON Canonicalization Scheme (JCS) defined in <xref target="RFC8785"/> for computing HMAC signatures.</t>
        <section><name>Canonicalization Procedure</name>
          <ol>
            <li>Take the PDU as a JSON object.</li>
            <li>Remove the signature field from the object.</li>
            <li>Apply RFC 8785 canonicalization to the resulting object: Sort object keys lexicographically (as defined by RFC 8785); serialize numbers according to RFC 8785 rules; escape strings according to RFC 8785 rules; remove insignificant whitespace.</li>
            <li>Encode the canonical string as UTF-8.</li>
            <li>Compute HMAC-SHA256 over the UTF-8 bytes.</li>
          </ol>
        </section>
        <section><name>Signature Representation</name>
          <t>The signature field contains the lowercase hex-encoded HMAC-SHA256 digest.</t>
          <t>Example signature value: a1b2c3d4e5f6... (64 hex characters).</t>
        </section>
        <section><name>Verification Procedure</name>
          <ol>
            <li>Extract the signature field from the received PDU.</li>
            <li>Remove the signature field from the PDU object.</li>
            <li>Apply RFC 8785 canonicalization to the modified object.</li>
            <li>Encode as UTF-8.</li>
            <li>Compute HMAC-SHA256 using the shared secret.</li>
            <li>Compare the computed digest with the received signature using a constant-time comparison.</li>
            <li>If they match, authentication succeeds. If not, return auth_failed.</li>
          </ol>
        </section>
        <section><name>Failure Behavior</name>
          <ul>
            <li>Missing signature field when authentication is enabled: auth_failed error.</li>
            <li>Invalid signature: auth_failed error.</li>
            <li>Malformed signature (not a valid hex string): auth_failed error.</li>
          </ul>
        </section>
        <section><name>Unicode Normalization</name>
          <t>SAMP does not apply Unicode normalization during signing or verification. JSON strings are preserved exactly as they appear in the PDU object. The sender <bcp14>MUST NOT</bcp14> modify or normalize JSON string values before applying JCS canonicalization. The receiver <bcp14>MUST NOT</bcp14> modify or normalize JSON string values before verifying the signature.</t>
          <t>Different Unicode code-point sequences produce different canonical bytes and therefore different HMAC signatures. If an implementation needs a specific normalization form (e.g., NFC) for application-level consistency, it <bcp14>MUST</bcp14> apply normalization before constructing the PDU object, not as a signing step.</t>
        </section>
      </section>
    </section>
    <section anchor="transport"><name>Transport Mapping</name>
      <t>SAMP defines protocol semantics and message envelopes independently from the underlying transport.</t>
      <section><name>HTTP Transport</name>
        <t>SAMP v0.1 requires HTTP <xref target="RFC9110"/> as the baseline transport.</t>
        <section><name>HTTP Method</name>
          <t>All SAMP PDUs are sent as HTTP POST requests with a JSON body containing the PDU envelope. Responses are returned in the HTTP response body.</t>
          <t>For agent-to-manager PDUs (PING, DISCOVER, PUSH), the agent sends an HTTP POST to the manager's SAMP endpoint.</t>
          <t>For manager-to-agent PDUs (QUERY, CONFIG, EXEC, SUBSCRIBE, UNSUBSCRIBE), the manager sends an HTTP POST to the agent's SAMP endpoint.</t>
        </section>
        <section><name>Content-Type</name>
          <t>The Content-Type header <bcp14>MUST</bcp14> be application/json.</t>
        </section>
        <section><name>Endpoint Path</name>
          <t>Implementations <bcp14>MAY</bcp14> choose any endpoint path. The agent's SAMP endpoint URL is advertised in the DISCOVER payload's endpoint field. The manager's SAMP endpoint URL is configured during agent bootstrap.</t>
          <t>Recommended conventional paths: Manager: POST /samp (accepts all PDU types); Agent: POST /samp (accepts all PDU types).</t>
        </section>
        <section><name>HTTP Status Codes</name>
          <t>SAMP uses HTTP status codes as follows:</t>
          <table><name>HTTP Status Code Mapping</name>
            <thead><tr><th>HTTP Status</th><th>Meaning</th></tr></thead>
            <tbody>
              <tr><td>200 OK</td><td>Successful request or response</td></tr>
              <tr><td>400 Bad Request</td><td>Malformed PDU or invalid JSON</td></tr>
              <tr><td>401 Unauthorized</td><td>Authentication failed</td></tr>
              <tr><td>403 Forbidden</td><td>Policy denied</td></tr>
              <tr><td>404 Not Found</td><td>Unknown agent or endpoint</td></tr>
              <tr><td>409 Conflict</td><td>Replay detected or state conflict</td></tr>
              <tr><td>429 Too Many Requests</td><td>Rate limited</td></tr>
              <tr><td>500 Internal Server Error</td><td>Internal error</td></tr>
              <tr><td>503 Service Unavailable</td><td>Back-pressure or overload</td></tr>
            </tbody>
          </table>
          <t>The SAMP error envelope in the response body provides the precise error code. The HTTP status code is a transport-level indicator; the SAMP error code is authoritative.</t>
        </section>
        <section><name>HTTPS Requirements</name>
          <ul>
            <li>Plain HTTP is suitable ONLY for localhost (127.0.0.1) development and testing. It <bcp14>MUST NOT</bcp14> be used for non-localhost deployments.</li>
            <li>HTTPS is <bcp14>REQUIRED</bcp14> for all non-localhost deployments, including isolated management networks.</li>
            <li>TLS 1.3 <xref target="RFC8446"/> is <bcp14>RECOMMENDED</bcp14>. TLS 1.2 <bcp14>MAY</bcp14> be used for compatibility but TLS 1.3 is preferred.</li>
            <li>Certificate validation <bcp14>MUST</bcp14> be enforced for HTTPS connections. Disabling certificate validation is <bcp14>NOT RECOMMENDED</bcp14> outside development.</li>
          </ul>
        </section>
      </section>
      <section><name>WebSocket Transport</name>
        <t>WebSocket support is <bcp14>OPTIONAL</bcp14> in SAMP v0.1. WebSocket is primarily useful for:</t>
        <ul>
          <li>Persistent event streams (subscription delivery).</li>
          <li>Frequent heartbeats (reducing HTTP overhead).</li>
          <li>Bidirectional communication without polling.</li>
        </ul>
        <t>When WebSocket is used:</t>
        <ul>
          <li>The connection upgrade follows the WebSocket protocol <xref target="RFC6455"/>.</li>
          <li>SAMP PDUs are sent as WebSocket text frames containing the JSON envelope.</li>
          <li>The same PDU envelope format and authentication rules apply.</li>
          <li>A WebSocket connection does not change the request-response semantics of individual PDUs.</li>
        </ul>
        <t>WebSocket transport is NOT required for any conformance tier in v0.1.</t>
      </section>
      <section><name>Retry and Backoff</name>
        <t>Implementations <bcp14>MAY</bcp14> retry failed requests with exponential backoff. Retries of the same request <bcp14>MUST</bcp14> use the same request_id as the original attempt. The receiver <bcp14>SHOULD</bcp14> cache the request digest and the corresponding response for a limited time period.</t>
        <t>The request digest is SHA-256 over the RFC 8785 canonical bytes of the PDU with the signature field removed. This is the same canonicalization used for HMAC signing (see <xref target="canonical-json"/>), with the addition of a SHA-256 hash over the canonical bytes.</t>
        <ul>
          <li>If the receiver sees the same request_id with the same request digest, it returns the cached response without re-executing the operation.</li>
          <li>If the receiver sees the same request_id with a different request digest, it rejects the PDU with a replay_detected error.</li>
        </ul>
        <t>Non-idempotent operations, especially EXEC, <bcp14>SHOULD NOT</bcp14> be retried unless the receiver supports safe cached-response behavior for that operation type.</t>
      </section>
    </section>
    <section anchor="conformance"><name>Conformance</name>
      <t>SAMP version 0.1 defines four conformance tiers:</t>
      <dl>
        <dt>SAMP-Observe</dt><dd>Supports PING, DISCOVER, DISCOVER_ACK, QUERY, and PUSH. Does not send CONFIG or EXEC.</dd>
        <dt>SAMP-Subscribe</dt><dd>Supports SAMP-Observe plus SUBSCRIBE and UNSUBSCRIBE.</dd>
        <dt>SAMP-Configure</dt><dd>Supports SAMP-Subscribe plus CONFIG.</dd>
        <dt>SAMP-Execute</dt><dd>Supports SAMP-Configure plus EXEC.</dd>
      </dl>
      <section><name>Mandatory Implementation Requirements</name>
        <t>All tiers <bcp14>MUST</bcp14> support:</t>
        <ul>
          <li>JSON encoding <xref target="RFC8259"/>.</li>
          <li>HTTP transport.</li>
          <li>Profile parsing and validation.</li>
          <li>HMAC-SHA256 authentication support (implementation <bcp14>MUST</bcp14> support it; deployment <bcp14>MAY</bcp14> disable it for localhost only).</li>
          <li>Standard error envelopes and error codes.</li>
          <li>PDU envelope parsing with all required fields.</li>
        </ul>
      </section>
      <section><name>Conformance Testing</name>
        <t>Implementations claiming a conformance tier <bcp14>SHOULD</bcp14> be validated against a test suite covering:</t>
        <ul>
          <li>All required PDUs for the claimed tier.</li>
          <li>Profile validation.</li>
          <li>Authentication (enable/disable, valid/invalid signatures).</li>
          <li>Error handling for all defined error codes.</li>
          <li>HTTP transport compliance.</li>
        </ul>
        <t>A reference test suite is planned but not yet available. Implementers <bcp14>SHOULD</bcp14> publish interoperability test results.</t>
      </section>
    </section>
    <section anchor="security"><name>Security Considerations</name>
      <section><name>Threat Model</name>
        <t>SAMP v0.1 is designed for controlled environments. The following threats are identified:</t>
        <section><name>Rogue Managers</name>
          <t>A rogue manager could send unauthorized QUERY, CONFIG, or EXEC PDUs to an agent.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>Agents <bcp14>SHOULD</bcp14> maintain an allow-list of authorized manager addresses.</li>
            <li>Agents <bcp14>MUST</bcp14> validate HMAC signatures.</li>
            <li>Agents <bcp14>MUST</bcp14> reject CONFIG and EXEC from untrusted or unauthorized managers.</li>
          </ul>
          <t>Future: Per-agent public key authentication and mTLS.</t>
        </section>
        <section><name>Rogue Agents</name>
          <t>A rogue agent could announce itself with DISCOVER and provide false profile information.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>Managers <bcp14>MUST</bcp14> validate profiles before trusting.</li>
            <li>Managers <bcp14>SHOULD</bcp14> use pre-registration or enrollment tokens.</li>
            <li>Managers <bcp14>SHOULD</bcp14> rate-limit DISCOVER from unknown agents.</li>
          </ul>
          <t>Future: Signed profiles and certificate-based identity.</t>
        </section>
        <section><name>Credential Theft</name>
          <t>The shared secret used for HMAC authentication could be stolen.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>Shared secrets <bcp14>SHOULD</bcp14> be stored in a secrets manager.</li>
            <li>Secrets <bcp14>SHOULD</bcp14> be distributed out of band.</li>
            <li>Secrets <bcp14>SHOULD</bcp14> be rotated periodically.</li>
          </ul>
          <t>Future: Per-agent public key authentication (Ed25519).</t>
        </section>
        <section><name>Replay Attacks</name>
          <t>An attacker could capture and replay a valid PDU.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>request_id and request digest checked against a replay cache. The request digest is SHA-256 over the RFC 8785 canonical bytes of the PDU with the signature field removed. Same request_id with same digest returns cached response; same request_id with different digest is rejected as replay_detected.</li>
            <li>Timestamp validation with clock-skew window.</li>
            <li>Replay cache is <bcp14>REQUIRED</bcp14> for CONFIG and EXEC operations.</li>
            <li>Replay cache is <bcp14>RECOMMENDED</bcp14> for all authenticated PDUs.</li>
          </ul>
          <t>Limitations: Replay cache is in-memory in v0.1; persistence is future work. Cache size is implementation-defined.</t>
        </section>
        <section><name>Profile Spoofing</name>
          <t>An agent could advertise a profile with false capabilities or autonomy class to gain elevated permissions.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>Autonomy class does not grant permission; manager policy is authoritative.</li>
            <li>CONFIG and EXEC require explicit profile exposure AND manager policy authorization.</li>
            <li>Managers <bcp14>SHOULD</bcp14> cross-check advertised capabilities against pre-registration data.</li>
          </ul>
        </section>
        <section><name>Unauthorized CONFIG and EXEC</name>
          <t>A manager with valid credentials could send unauthorized CONFIG or EXEC to an agent.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>EXEC is disabled by default.</li>
            <li>CONFIG and EXEC require explicit profile exposure.</li>
            <li>Agents <bcp14>SHOULD</bcp14> enforce local policy in addition to manager policy.</li>
            <li>EXEC parameters <bcp14>MUST</bcp14> have typed schemas; free-form arguments are not allowed.</li>
            <li>exec_policy in the profile <bcp14>MAY</bcp14> define: allowed_commands, dangerous_commands, require_ack, cooldown, max_per_minute, scope, and audit fields.</li>
          </ul>
        </section>
        <section><name>Version Downgrade</name>
          <t>An attacker could attempt to force use of a weaker protocol version.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>v0.1 is the only defined version.</li>
            <li>Receivers <bcp14>MUST</bcp14> reject unsupported versions with version_unsupported.</li>
            <li>Future versions <bcp14>MUST</bcp14> define backward compatibility rules.</li>
          </ul>
        </section>
        <section><name>Event and Discovery Flooding</name>
          <t>An agent could flood a manager with PUSH events or DISCOVER messages.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>Managers <bcp14>SHOULD</bcp14> rate-limit DISCOVER from unknown agents.</li>
            <li>Managers <bcp14>MAY</bcp14> apply back-pressure with rate_limited or back_pressure errors.</li>
            <li>Managers <bcp14>MAY</bcp14> maintain a pending-agent quota.</li>
          </ul>
        </section>
        <section><name>Registry Poisoning</name>
          <t>A rogue agent could attempt to overwrite or evict legitimate agent entries in the manager's registry.</t>
          <t>Mitigations in v0.1:</t>
          <ul>
            <li>Registry updates require successful authentication.</li>
            <li>DISCOVER from unauthenticated agents <bcp14>MUST NOT</bcp14> modify the registry beyond creating a discovered or pending entry.</li>
          </ul>
        </section>
      </section>
      <section><name>Audit Requirements</name>
        <t>Implementations <bcp14>SHOULD</bcp14> log all CONFIG and EXEC operations, including: Timestamp, Agent ID, Manager ID (if identifiable), Operation details (field changes, command, parameters), and Result (success/failure).</t>
        <t>Audit logs <bcp14>SHOULD</bcp14> be tamper-evident and stored separately from the system being managed.</t>
      </section>
      <section><name>Rate Limiting and Back-Pressure</name>
        <t>Managers and agents <bcp14>SHOULD</bcp14> implement rate limiting for incoming PDUs. Rate limiting <bcp14>MAY</bcp14> be applied per-agent, per-PDU-type, or globally. Excess requests <bcp14>SHOULD</bcp14> be rejected with rate_limited or back_pressure errors.</t>
      </section>
      <section><name>Trust Bootstrap</name>
        <t>The initial trust establishment between a manager and an agent is a critical moment. SAMP v0.1 supports: Manual approval by the operator, Pre-shared enrollment tokens, and Public key thumbprint matching.</t>
        <t>Future versions <bcp14>MAY</bcp14> support certificate-based enrollment and automated trust establishment.</t>
      </section>
      <section><name>Token Rotation and Storage</name>
        <t>Shared secrets <bcp14>SHOULD</bcp14> be rotated periodically. Rotation frequency is a deployment decision. Tokens <bcp14>SHOULD</bcp14> be stored in a secrets manager (e.g., HashiCorp Vault, AWS Secrets Manager) rather than plaintext files.</t>
        <t>Token rotation in v0.1 requires out-of-band coordination between the manager and agent. Automated rotation is future work.</t>
      </section>
      <section><name>Summary: Current Requirements vs Future Work</name>
        <table><name>Security Mitigations: v0.1 vs Future</name>
          <thead><tr><th>Threat</th><th>v0.1 Mitigation</th><th>Future Enhancement</th></tr></thead>
          <tbody>
            <tr><td>Rogue managers</td><td>Manager allow-list, HMAC</td><td>mTLS, per-agent keys</td></tr>
            <tr><td>Rogue agents</td><td>Profile validation, enrollment</td><td>Signed profiles, cert identity</td></tr>
            <tr><td>Credential theft</td><td>Secrets manager, rotation</td><td>Per-agent Ed25519 keys</td></tr>
            <tr><td>Replay</td><td>request_id cache, timestamp</td><td>Persistent cache, sequence validation</td></tr>
            <tr><td>Profile spoofing</td><td>Manager policy authoritative</td><td>Signed profiles</td></tr>
            <tr><td>Unauthorized EXEC/CONFIG</td><td>Disabled by default, policy</td><td>RBAC, OPA integration</td></tr>
            <tr><td>Version downgrade</td><td>Reject unsupported versions</td><td>Version negotiation</td></tr>
            <tr><td>Flooding</td><td>Rate limiting, back-pressure</td><td>Flow-control protocol</td></tr>
            <tr><td>Registry poisoning</td><td>Auth-required updates</td><td>Signed registrations</td></tr>
          </tbody>
        </table>
      </section>
    </section>
    <section anchor="privacy"><name>Privacy Considerations</name>
      <section><name>Sensitive Metadata Exposure</name>
        <t>SAMP profiles and query responses can expose sensitive information about an agent, including: Framework details and version, Model names and provider information, Configuration values, Active sessions, Tool availability, Memory backends, Operational state, and Uptime and availability patterns.</t>
        <t>Managers and agents <bcp14>SHOULD</bcp14> minimize exposed fields. Profiles <bcp14>SHOULD</bcp14> include only fields necessary for management. QUERY responses <bcp14>SHOULD</bcp14> not include secrets, credentials, prompt contents, private user data, or tool outputs unless explicitly required and authorized.</t>
      </section>
      <section><name>Event Data Sensitivity</name>
        <t>PUSH events can contain operationally sensitive information, including: Status changes revealing operational patterns, Error details exposing internal architecture, Performance metrics revealing capacity or load, and Configuration changes revealing business logic.</t>
        <t>Operators <bcp14>SHOULD</bcp14> classify and filter events before exporting them to telemetry, logging, or ticketing systems. Events containing user data <bcp14>MUST</bcp14> be handled according to applicable data protection regulations.</t>
      </section>
      <section><name>Data Minimization</name>
        <t>Agents <bcp14>SHOULD</bcp14> expose the minimum profile data necessary for management. Managers <bcp14>SHOULD</bcp14> query only the fields they need. Bulk profile export or full-state queries <bcp14>SHOULD</bcp14> be restricted to authorized operators.</t>
      </section>
      <section><name>Log Protection</name>
        <t>SAMP audit logs and event stores may contain sensitive operational data. Logs <bcp14>SHOULD</bcp14> be: Access-controlled, Retained according to a defined policy, Protected against tampering, and Sanitized before sharing or export.</t>
      </section>
    </section>
    <section anchor="operations"><name>Operational Considerations</name>
      <section><name>Network Placement</name>
        <t>SAMP deployments <bcp14>SHOULD</bcp14> place managers and agents on a dedicated management network or equivalent restricted trust boundary. Firewall rules <bcp14>SHOULD</bcp14> limit SAMP traffic to known managers and agents.</t>
        <t>Agents <bcp14>SHOULD</bcp14> maintain an allow-list of authorized manager addresses. Managers <bcp14>SHOULD</bcp14> maintain an allow-list or pre-registration registry for expected agents.</t>
      </section>
      <section><name>Scaling</name>
        <t>SAMP v0.1 targets single-agent interactions. A single manager <bcp14>MAY</bcp14> manage multiple agents, but fleet-scale bulk operations are not defined in v0.1. Deployments needing fleet-scale operations <bcp14>SHOULD</bcp14> use external orchestration (e.g., scripts, configuration management) layered on top of SAMP.</t>
        <t>Scaling approaches compatible with v0.1:</t>
        <ul>
          <li><strong>HTTP-only polling</strong>: Agents are polled by the manager at intervals. Suitable for moderate agent counts.</li>
          <li><strong>Hierarchical managers</strong>: A tier of intermediate managers collects from agents and reports to a central manager. Requires out-of-band coordination.</li>
          <li><strong>Queue-based ingestion</strong>: PUSH events are sent to a message queue rather than directly to the manager. Requires agent-side queue configuration.</li>
        </ul>
        <t>Federation, multi-manager conflict resolution, and transactional configuration are future work.</t>
      </section>
      <section><name>Observability</name>
        <t>SAMP management traffic <bcp14>SHOULD</bcp14> itself be observable. Implementations <bcp14>SHOULD</bcp14> log: PDU counts and types, Error rates, Authentication failures, Latency metrics, and Agent registration and trust transitions.</t>
        <t>This metadata <bcp14>MAY</bcp14> be exported to OpenTelemetry or similar observability systems.</t>
      </section>
      <section><name>Error Handling in Practice</name>
        <ul>
          <li>Transient errors (rate_limited, back_pressure): Retry with backoff.</li>
          <li>Authentication errors (auth_failed): Alert operator; do not retry with same credentials.</li>
          <li>Protocol errors (malformed_pdu, unknown_type, schema_mismatch): Log for debugging; likely indicates implementation bug.</li>
          <li>Policy errors (policy_denied, exec_disabled, config_disabled): Log; do not retry without policy change.</li>
          <li>State errors (replay_detected): Log; may indicate misconfiguration or attack.</li>
        </ul>
      </section>
    </section>
    <section anchor="iana"><name>IANA Considerations</name>
      <t>This document requests the creation of a SAMP registry group under the "IANA Considerations" framework of <xref target="RFC8126"/>.</t>
      <section><name>SAMP PDU Types Registry</name>
        <t>Registry Name: SAMP PDU Types</t>
        <t>Registration Policy: Specification Required</t>
        <t>Expert Review Guidelines: The designated expert <bcp14>SHOULD</bcp14> verify that new PDU types include a clear name, description, payload schema, direction semantics, error handling, and security considerations.</t>
        <t>Initial assignments:</t>
        <table><name>Initial SAMP PDU Type Assignments</name>
          <thead><tr><th>Value</th><th>Description</th><th>Reference</th></tr></thead>
          <tbody>
            <tr><td>ping</td><td>Agent heartbeat</td><td>This document</td></tr>
            <tr><td>discover</td><td>Agent self-announcement</td><td>This document</td></tr>
            <tr><td>discover_ack</td><td>Manager response to DISCOVER</td><td>This document</td></tr>
            <tr><td>query</td><td>State query</td><td>This document</td></tr>
            <tr><td>push</td><td>Asynchronous event notification</td><td>This document</td></tr>
            <tr><td>subscribe</td><td>Event subscription</td><td>This document</td></tr>
            <tr><td>unsubscribe</td><td>Cancel subscription</td><td>This document</td></tr>
            <tr><td>config</td><td>Configuration change</td><td>This document</td></tr>
            <tr><td>exec</td><td>Execute operation</td><td>This document</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>SAMP Error Codes Registry</name>
        <t>Registry Name: SAMP Error Codes</t>
        <t>Registration Policy: Specification Required</t>
        <t>Expert Review Guidelines: The designated expert <bcp14>SHOULD</bcp14> verify that new error codes include a clear name, description, and handling guidance.</t>
        <t>Initial assignments:</t>
        <table><name>Initial SAMP Error Code Assignments</name>
          <thead><tr><th>Value</th><th>Description</th><th>Reference</th></tr></thead>
          <tbody>
            <tr><td>malformed_pdu</td><td>Invalid JSON or missing required fields</td><td>This document</td></tr>
            <tr><td>unknown_type</td><td>Unrecognized PDU type</td><td>This document</td></tr>
            <tr><td>invalid_value</td><td>Invalid field value</td><td>This document</td></tr>
            <tr><td>schema_mismatch</td><td>Payload schema validation failure</td><td>This document</td></tr>
            <tr><td>version_unsupported</td><td>Unsupported protocol version</td><td>This document</td></tr>
            <tr><td>profile_invalid</td><td>Invalid or incomplete profile</td><td>This document</td></tr>
            <tr><td>auth_failed</td><td>Authentication failure</td><td>This document</td></tr>
            <tr><td>replay_detected</td><td>Replay attack detected</td><td>This document</td></tr>
            <tr><td>unknown_field</td><td>Unknown field requested</td><td>This document</td></tr>
            <tr><td>exec_disabled</td><td>EXEC not enabled</td><td>This document</td></tr>
            <tr><td>config_disabled</td><td>CONFIG not enabled</td><td>This document</td></tr>
            <tr><td>policy_denied</td><td>Manager policy denies operation</td><td>This document</td></tr>
            <tr><td>rate_limited</td><td>Rate limiting in effect</td><td>This document</td></tr>
            <tr><td>back_pressure</td><td>Receiver overloaded</td><td>This document</td></tr>
            <tr><td>bootstrap_failed</td><td>Enrollment/bootstrap failure</td><td>This document</td></tr>
            <tr><td>internal_error</td><td>Internal receiver error</td><td>This document</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>SAMP Autonomy Classes Registry</name>
        <t>Registry Name: SAMP Autonomy Classes</t>
        <t>Registration Policy: Specification Required</t>
        <table><name>Initial SAMP Autonomy Class Assignments</name>
          <thead><tr><th>Value</th><th>Description</th><th>Reference</th></tr></thead>
          <tbody>
            <tr><td>advisory</td><td>Read-only observation only</td><td>This document</td></tr>
            <tr><td>operational-readonly</td><td>Observation and self-configuration</td><td>This document</td></tr>
            <tr><td>operational-write</td><td>Configuration allowed, limited execution</td><td>This document</td></tr>
            <tr><td>critical-write</td><td>Configuration and execution under strict policy</td><td>This document</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>SAMP Trust States Registry</name>
        <t>Registry Name: SAMP Trust States</t>
        <t>Registration Policy: Specification Required</t>
        <table><name>Initial SAMP Trust State Assignments</name>
          <thead><tr><th>Value</th><th>Description</th><th>Reference</th></tr></thead>
          <tbody>
            <tr><td>discovered</td><td>Agent announced, not yet evaluated</td><td>This document</td></tr>
            <tr><td>pending</td><td>Manager awaiting trust decision</td><td>This document</td></tr>
            <tr><td>trusted</td><td>Manager accepted agent</td><td>This document</td></tr>
            <tr><td>quarantined</td><td>Isolated for observation</td><td>This document</td></tr>
            <tr><td>rejected</td><td>Manager refused agent</td><td>This document</td></tr>
            <tr><td>offline</td><td>Agent unreachable</td><td>This document</td></tr>
            <tr><td>stale</td><td>Agent missed heartbeats beyond threshold</td><td>This document</td></tr>
            <tr><td>revoked</td><td>Trust explicitly revoked</td><td>This document</td></tr>
          </tbody>
        </table>
      </section>
      <section><name>SAMP Profile Namespaces Registry</name>
        <t>Registry Name: SAMP Profile Namespaces</t>
        <t>Registration Policy: Specification Required</t>
        <t>No initial assignments are made. The system category is defined in this document but is not a registry entry; it is a required profile category. Future profile namespaces (e.g., model, tools, memory) <bcp14>MAY</bcp14> be registered as implementations define them.</t>
      </section>
      <section><name>Media Type Registration</name>
        <t>This document does NOT request a media type registration. SAMP PDUs use application/json <xref target="RFC8259"/> as the content type. A dedicated SAMP media type (e.g., application/samp+json) <bcp14>MAY</bcp14> be requested in a future version if warranted.</t>
      </section>
    </section>
    <section><name>Implementation Status</name>
      <t>This section records implementation status for early review and will be removed before publication as an RFC.</t>
      <t>At the time of writing, the following implementations exist:</t>
      <ul>
        <li><strong>Rust SAMP Core and SAMP Module</strong>: Part of the AgMS reference implementation. Provides PDU encoding/decoding, profile management, authentication scaffolding, and an embeddable agent-side module.</li>
        <li><strong>Python PoC</strong>: A SAMP Collector (AgMS-lite) and an OpenClaw SAMP Adapter demonstrating DISCOVER, DISCOVER_ACK, PING, PING_ACK, QUERY, PUSH, and disabled-by-default EXEC flows over HTTP. 20 tests passing.</li>
      </ul>
      <t>The Python PoC signs raw request body bytes rather than canonical JSON. This is a known deviation from the specification in this document. The PoC <bcp14>SHOULD</bcp14> be updated to use RFC 8785 canonicalization for interoperability.</t>
      <t>SUBSCRIBE and UNSUBSCRIBE are defined in this specification but are not implemented in either the Rust or Python PoC as of the time of writing.</t>
    </section>
  </middle>
  <back>
    <references><name>Normative References</name>
      <reference anchor="RFC2104" target="https://www.rfc-editor.org/rfc/rfc2104"><front><title>HMAC: Keyed-Hashing for Message Authentication</title><author initials="H." surname="Krawczyk" fullname="Hugo Krawczyk"><organization/></author><author initials="M." surname="Bellare" fullname="Mihir Bellare"><organization/></author><author initials="R." surname="Canetti" fullname="Ran Canetti"><organization/></author><date year="1997" month="February"/></front><seriesInfo name="RFC" value="2104"/></reference>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/rfc/rfc2119"><front><title>Key words for use in RFCs to Indicate Requirement Levels</title><author initials="S." surname="Bradner" fullname="Scott Bradner"><organization/></author><date year="1997" month="March"/></front><seriesInfo name="BCP" value="14"/><seriesInfo name="RFC" value="2119"/></reference>
      <reference anchor="RFC3339" target="https://www.rfc-editor.org/rfc/rfc3339"><front><title>Date and Time on the Internet: Timestamps</title><author initials="G." surname="Klyne" fullname="Graham Klyne"><organization/></author><author initials="C." surname="Newman" fullname="Chris Newman"><organization/></author><date year="2002" month="July"/></front><seriesInfo name="RFC" value="3339"/></reference>
      <reference anchor="RFC6234" target="https://www.rfc-editor.org/rfc/rfc6234"><front><title>US Secure Hash Algorithms (SHA and SHA-based HMAC and HKDF)</title><author initials="D." surname="Eastlake" fullname="Donald Eastlake"><organization/></author><author initials="T." surname="Hansen" fullname="Tony Hansen"><organization/></author><date year="2011" month="September"/></front><seriesInfo name="RFC" value="6234"/></reference>
      <reference anchor="RFC6455" target="https://www.rfc-editor.org/rfc/rfc6455"><front><title>The WebSocket Protocol</title><author initials="I." surname="Fette" fullname="Alexey Melnikov"><organization/></author><author initials="A." surname="Melnikov" fullname="Ian Fette"><organization/></author><date year="2011" month="December"/></front><seriesInfo name="RFC" value="6455"/></reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/rfc/rfc8174"><front><title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title><author initials="B." surname="Leiba" fullname="Barry Leiba"><organization/></author><date year="2017" month="May"/></front><seriesInfo name="BCP" value="14"/><seriesInfo name="RFC" value="8174"/></reference>
      <reference anchor="RFC8259" target="https://www.rfc-editor.org/rfc/rfc8259"><front><title>The JavaScript Object Notation (JSON) Data Interchange Format</title><author initials="T." surname="Bray" fullname="Tim Bray"><organization/></author><date year="2017" month="December"/></front><seriesInfo name="STD" value="90"/><seriesInfo name="RFC" value="8259"/></reference>
      <reference anchor="RFC8446" target="https://www.rfc-editor.org/rfc/rfc8446"><front><title>The Transport Layer Security (TLS) Protocol Version 1.3</title><author initials="E." surname="Rescorla" fullname="Eric Rescorla"><organization/></author><date year="2018" month="August"/></front><seriesInfo name="RFC" value="8446"/></reference>
      <reference anchor="RFC8785" target="https://www.rfc-editor.org/rfc/rfc8785"><front><title>JSON Canonicalization Scheme (JCS)</title><author initials="A." surname="Rundgren" fullname="Anders Rundgren"><organization/></author><author initials="B." surname="Jordan" fullname="Bret Jordan"><organization/></author><date year="2020" month="June"/></front><seriesInfo name="RFC" value="8785"/></reference>
      <reference anchor="RFC9110" target="https://www.rfc-editor.org/rfc/rfc9110"><front><title>HTTP Semantics</title><author initials="R." surname="Fielding" fullname="Roy Fielding"><organization/></author><author initials="M." surname="Nottingham" fullname="Mark Nottingham"><organization/></author><author initials="J." surname="Reschke" fullname="Julian Reschke"><organization/></author><date year="2022" month="June"/></front><seriesInfo name="STD" value="97"/><seriesInfo name="RFC" value="9110"/></reference>
      <reference anchor="RFC9562" target="https://www.rfc-editor.org/rfc/rfc9562"><front><title>Universally Unique IDentifiers (UUIDs)</title><author initials="K." surname="Davis" fullname="Kyzer Davis"><organization/></author><date year="2024" month="May"/></front><seriesInfo name="RFC" value="9562"/></reference>
    </references>
    <references><name>Informative References</name>
      <reference anchor="RFC3411" target="https://www.rfc-editor.org/rfc/rfc3411"><front><title>An Architecture for Describing Simple Network Management Protocol (SNMP) Management Frameworks</title><author initials="D." surname="Harrington"><organization/></author><date year="2002"/></front></reference>
      <reference anchor="RFC3416" target="https://www.rfc-editor.org/rfc/rfc3416"><front><title>Version 2 of the Protocol Operations for the Simple Network Management Protocol (SNMP)</title><author initials="R." surname="Presuhn"><organization/></author><date year="2002"/></front></reference>
      <reference anchor="RFC2578" target="https://www.rfc-editor.org/rfc/rfc2578"><front><title>Structure of Management Information Version 2 (SMIv2)</title><author initials="K." surname="McCloghrie"><organization/></author><date year="1999"/></front></reference>
      <reference anchor="RFC2579" target="https://www.rfc-editor.org/rfc/rfc2579"><front><title>Textual Conventions for SMIv2</title><author initials="K." surname="McCloghrie"><organization/></author><date year="1999"/></front></reference>
      <reference anchor="RFC2580" target="https://www.rfc-editor.org/rfc/rfc2580"><front><title>Conformance Statements for SMIv2</title><author initials="K." surname="McCloghrie"><organization/></author><date year="1999"/></front></reference>
      <reference anchor="RFC6241" target="https://www.rfc-editor.org/rfc/rfc6241"><front><title>Network Configuration Protocol (NETCONF)</title><author initials="R." surname="Enns"><organization/></author><date year="2011"/></front></reference>
      <reference anchor="RFC7950" target="https://www.rfc-editor.org/rfc/rfc7950"><front><title>The YANG 1.1 Data Modeling Language</title><author initials="M." surname="Bjorklund"><organization/></author><date year="2016"/></front></reference>
      <reference anchor="RFC8126" target="https://www.rfc-editor.org/rfc/rfc8126"><front><title>Guidelines for Writing an IANA Considerations Section in RFCs</title><author initials="M." surname="Cotton"><organization/></author><date year="2017"/></front></reference>
      <reference anchor="OPAMP" target="https://opentelemetry.io/docs/specs/opamp/"><front><title>Open Agent Management Protocol (OpAMP)</title><author><organization>OpenTelemetry SIG</organization></author><date/></front></reference>
      <reference anchor="MCP" target="https://modelcontextprotocol.io/"><front><title>Model Context Protocol</title><author><organization>Anthropic</organization></author><date/></front></reference>
      <reference anchor="A2A" target="https://a2a-protocol.org/"><front><title>Agent-to-Agent Protocol</title><author><organization>Linux Foundation</organization></author><date/></front></reference>
    </references>
    <section anchor="open-issues"><name>Open Issues</name>
      <t>This initial draft leaves the following questions open:</t>
      <ol>
        <li><strong>Profile schema format</strong>: TOML is the authoring format for v0.1. Should the machine-readable validation schema use JSON Schema, CUE, YANG mapping, or another formalism? This remains open/deferred for v0.1.</li>
        <li><strong>Subscription persistence</strong>: Should subscriptions survive agent reconnect in v0.1? Currently, they do not. This is deferred but may be revisited.</li>
        <li><strong>Multi-manager conflict resolution</strong>: Last-write-wins vs. policy-based vs. ownership-based. Deferred to future work.</li>
        <li><strong>Media type</strong>: Should SAMP register a dedicated media type (e.g., application/samp+json) instead of using application/json?</li>
      </ol>
      <t>The following items are definitively deferred for v0.1:</t>
      <ul>
        <li><strong>EXEC confirmation tokens</strong>: Deferred for a later version. SAMP v0.1 relies on profile policy, require_ack, cooldown, max_per_minute, and audit fields for EXEC safety.</li>
        <li><strong>Endpoint path standardization</strong>: The endpoint path is advertised by the agent in the DISCOVER payload and configured at the manager during bootstrap. /samp is a recommended convention. No mandatory path is defined for v0.1.</li>
        <li><strong>Unicode normalization</strong>: SAMP does not apply Unicode normalization during signing or verification. JSON strings are preserved exactly as they appear. See <xref target="canonical-json"/> for details.</li>
      </ul>
    </section>
    <section><name>Example SAMP Profile (TOML)</name>
      <artwork><![CDATA[
agent_id = "selefkos-jr"
name = "Selefkos Junior"
agent_version = "2026.5.20"
profile_version = "0.1"
agent_type = "openclaw"
autonomy_class = "operational-readonly"

[system]
status = "operational"
uptime = 86400
version = "2026.5.20"
last_seen = "2026-08-14T09:00:00Z"

[model]
primary = "glm-5.2"
fallback = "kimi-k2.6"

[exec_policy]
enabled = false
allowed_commands = []
dangerous_commands = []
require_ack = true
cooldown = 60
max_per_minute = 5
scope = "agent"
audit = true
]]></artwork>
    </section>
    <section><name>Example PDU Flows</name>
      <section><name>Discovery Flow</name>
        <artwork><![CDATA[
Agent                          Manager
  |                               |
  |--- DISCOVER (request) ------->|
  |    {profile, endpoint,        |
  |     capabilities}             |
  |                               |
  |<-- DISCOVER_ACK (response) ---|
  |    {state: "trusted",         |
  |     manager_version: "0.1"}   |
  |                               |
]]></artwork>
      </section>
      <section><name>Query Flow</name>
        <artwork><![CDATA[
Manager                        Agent
  |                               |
  |--- QUERY (request) ---------->|
  |    {fields: [                 |
  |     "system.status",          |
  |     "system.uptime"]}         |
  |                               |
  |<-- QUERY (response) ---------|
  |    {values: {                 |
  |     "system.status": "ok",    |
  |     "system.uptime": 3600},   |
  |     unknown: []}              |
  |                               |
]]></artwork>
      </section>
      <section><name>Event Subscription Flow</name>
        <artwork><![CDATA[
Manager                        Agent
  |                               |
  |--- SUBSCRIBE (request) ------>|
  |    {event_types: ["alert"],   |
  |     category: "system",       |
  |     ttl_seconds: 300}         |
  |                               |
  |<-- SUBSCRIBE (response) ------|
  |    {subscription_id: "sub-1", |
  |     ttl_seconds: 300}         |
  |                               |
  |<-- PUSH (notification) -------|
  |    {event: "alert",           |
  |     subscription_id: "sub-1", |
  |     data: {...}}              |
  |                               |
  |--- UNSUBSCRIBE (request) ---->|
  |    {subscription_id: "sub-1"} |
  |                               |
  |<-- UNSUBSCRIBE (response) ----|
  |    {cancelled: true}          |
  |                               |
]]></artwork>
      </section>
    </section>
    <section><name>Glossary</name>
      <table><name>Glossary</name>
        <thead><tr><th>Term</th><th>Definition</th></tr></thead>
        <tbody>
          <tr><td>SAMP</td><td>Simple Agent Management Protocol</td></tr>
          <tr><td>PDU</td><td>Protocol Data Unit</td></tr>
          <tr><td>Manager</td><td>System that manages agents via SAMP</td></tr>
          <tr><td>Agent</td><td>AI agent exposing a SAMP interface</td></tr>
          <tr><td>Profile</td><td>Structured declaration of agent identity and capabilities</td></tr>
          <tr><td>Trust State</td><td>Manager-assigned state for an agent</td></tr>
          <tr><td>Autonomy Class</td><td>Advisory risk classification for an agent</td></tr>
          <tr><td>Enrollment</td><td>Process of evaluating and accepting an agent</td></tr>
          <tr><td>Conformance Tier</td><td>Level of protocol support claimed by an implementation</td></tr>
        </tbody>
      </table>
    </section>
  </back>
</rfc>