RFC-MACP-0003
RFC-MACP-0003
Multi-Agent Coordination Protocol (MACP) — Determinism and Replay Integrity
Document: RFC-MACP-0003
Version: 1.1.0-draft
Status: Community Standards Track
Updates: RFC-MACP-0001
Changelog — 1.1.0-draft: New §3.2 defines the per-session semantics revision. The RFC-MACP-0009 1.1.0-draft and RFC-MACP-0010 1.2.0-draft changelogs already told runtimes to gate tightened rules "on a per-session semantics revision recorded at
SessionStart", but no RFC defined one. §3.2 says when an implementation MUST record one, what replay does with it, and what compatibility a later release owes a history recorded under an earlier revision: it MUST replay it under that revision's rules, and it MUST refuse a history whose revision it does not know. The revision is scoped to the implementation, or to the library for an embedded runtime; it is not an Envelope field and is not comparable across implementations. Source: Seam embedder review of the adoption roadmap (Wave E, unit E0). Replay: no new exposure. §3.2 states how an implementation keeps replay faithful across its own releases. A runtime that already records such a revision (the reference runtime'sCURRENT_SEMANTICS_REV) conforms without change.
Changelog — 1.0.1-draft: §1's terminal-state list now reads "(RESOLVED, EXPIRED, or CANCELLED)", and §5's structural-only lifecycle list now reads "(OPEN, SUSPENDED, RESOLVED, EXPIRED, CANCELLED)". RFC-MACP-0001 §7.2 defines five states, three of them terminal. These two sites still listed the earlier two-terminal lifecycle, although §2 of this document already named
CANCELLED(seam-embedder-findings proposal S10, issue #185). Editorial: RFC-MACP-0001 §7.2 was always normative for the state set, and no implementation obligation changes.make prose-checknow holds both lists to RFC-MACP-0001 §7.2 and theSessionStateenum inenvelope.proto. Replay: no exposure. A replay that reproducedSUSPENDEDtransitions or aCANCELLEDterminal state was already required to by RFC-MACP-0001; this text now says so too.
Abstract
This document defines MACP replay semantics, structural determinism guarantees, semantic determinism classes for Modes, and recommended patterns for external side effects.
1. Structural Replay Integrity
MACP Core guarantees structural replay integrity.
Replaying identical accepted Envelope sequences under identical:
- negotiated protocol version,
- schema namespace major version,
- Mode identifier and Mode version,
- configuration and policy version(s)
MUST reproduce identical session state transitions and acceptance/rejection behavior.
Specifically, replay MUST:
- accept the same messages in the same order,
- produce the same acceptance/rejection decisions for each envelope, given identical validation rules and bound versions (operational rejections such as rate limiting or transient authentication failures are outside the replay determinism boundary),
- produce the same terminal state (RESOLVED, EXPIRED, or CANCELLED) and terminal message,
- produce the same
Ackaccept/reject decisions for each envelope.
Replay does NOT guarantee identical external side effects (see Section 4). Replay also does not guarantee identical error message text — only identical accept/reject outcomes.
2. What Core Guarantees
Core guarantees determinism for:
- session lifecycle transitions,
- within-session acceptance order,
- idempotent handling of duplicate
message_idvalues, - the terminal lifecycle state (RESOLVED, EXPIRED, or CANCELLED) when the accepted history is identical.
Core does not guarantee semantic determinism unless the Mode claims it.
timestamp_unix_ms is informational for ordering and display purposes and MUST NOT be used for message acceptance decisions. However, timestamp_unix_ms on the SessionStart envelope is normative for TTL computation: the session's initial absolute expiration deadline is computed as SessionStart_envelope.timestamp_unix_ms + SessionStartPayload.ttl_ms. During replay, the runtime MUST derive the deadline from the original session timeline, not wall-clock time. If the TTL has elapsed before a terminal condition is accepted, the session transitions to EXPIRED.
TTL under suspension (RFC-MACP-0001 §7.5). Suspension banks the remaining TTL rather than letting the deadline keep running, so the deadline depends on the suspend/resume timeline. This is deterministic precisely because suspend and resume are accepted, recorded events on the session's append-only history: each SessionSuspend/SessionResume envelope carries the timestamp_unix_ms Core uses for accounting. On suspend at time t_s, the runtime banks banked = deadline − t_s; on resume at time t_r, it sets deadline = t_r + banked (recorded in SessionResumePayload.banked_ms). A SUSPENDED session MUST NOT expire on its pre-suspension deadline. To bound indefinite pauses, the runtime MUST enforce a maximum-suspension cap: if cumulative suspended duration exceeds the cap, the session transitions SUSPENDED → EXPIRED. The cap is a deterministic replay input and therefore MUST be session-bound: it is resolved at SessionStart from SessionStartPayload.max_suspend_ms (0 or absent selects the runtime's configured default) and the resolved value MUST be recorded with the session (RFC-MACP-0001 §7.5). Replay MUST use the recorded cap, never the runtime's live configuration — a config-only cap would let two conformant runtimes (or one runtime reconfigured between runs) produce different terminal states on identical history, violating §1 of this document and RFC-MACP-0001 §7.5. With the cap bound, every input to this computation (the recorded cap and the suspend/resume event timestamps) is on the replayed timeline, so replay reconstructs the identical adjusted deadline and the identical terminal state — the determinism guarantee above holds for suspended-then-resumed sessions.
3. Version Binding
Sessions MUST bind these immutable values at SessionStart:
- Mode version,
- configuration version,
- policy version (MUST be bound and non-empty when any governance policy is in effect; see RFC-MACP-0012).
- any context freeze identifiers required by the Mode.
Replay MUST use the same bound versions. Replaying under a newer policy or Mode version is not historical reconstruction.
3.1 Worked Example: Correct and Incorrect Replay
Original session (mode_version=1.0.0, configuration_version=org-2026.01):
SessionStart (session_id=abc, mode=macp.mode.decision.v1,
mode_version=1.0.0, configuration_version=org-2026.01)
→ Proposal (option A)
→ Vote (approve A)
→ Vote (approve A)
→ Commitment (selected: A, mode_version=1.0.0)
→ RESOLVEDCorrect replay — same bound versions produce identical outcome:
Replay with mode_version=1.0.0, configuration_version=org-2026.01
→ Same messages in same order
→ Commitment (selected: A) ✓ identical
→ RESOLVED ✓ identicalIncorrect replay — different mode_version violates version binding:
Replay with mode_version=2.0.0, configuration_version=org-2026.01
→ mode_version=2.0.0 may alter voting thresholds or message validation
→ Commitment outcome may differ ✗ not historical reconstructionThis is not a valid historical replay. It is a what-if analysis under different semantics.
3.2 Semantics Revisions
The bound versions in this section do not capture every rule a runtime applies. A Mode RFC can tighten a validation rule without changing mode_version (see the RFC-MACP-0009 1.1.0-draft and RFC-MACP-0010 1.2.0-draft changelogs), and an implementation can correct its own acceptance behaviour between releases. Either change can make a later release reject an envelope that a stored history accepted, and §1 then no longer holds for that history. A semantics revision is the mechanism that keeps it holding.
- Definition. A semantics revision is a non-negative integer that identifies the set of acceptance rules an implementation applied to a Session. Revisions increase monotonically across an implementation's releases. Revision
0denotes a Session recorded before the implementation recorded revisions. - Recording. An implementation that has ever changed acceptance behaviour for an unchanged Mode version MUST record, when it accepts a
SessionStart, the revision it accepted the Session under. The revision is bound with the Session like the values in §3 and the suspension cap in §2, and MUST NOT change for the life of the Session. A stored Session with no recorded revision MUST be treated as revision0. - When a new revision is required. A change that makes the implementation reject an envelope its previous release accepted, or that changes the state or outcome an accepted history produces, MUST be introduced under a new revision, and MUST apply only to Sessions recorded under that revision or a later one. A change that only accepts envelopes the previous release rejected MAY apply to every revision without a new one, because the rejected envelopes never entered any history. Mode RFC changelogs SHOULD say which of the two a normative change is, in a Replay: note.
- Replay. Replay MUST apply the rules of the Session's recorded revision, never the implementation's current revision. Replaying a Session under a different revision is a what-if analysis, like the incorrect replay in §3.1, not historical reconstruction.
- Compatibility across releases. A release of an implementation MUST be able to replay every revision that the same implementation issued in an earlier release with the same major version. An implementation MAY drop an old revision only in a new major version, and MUST document the drop.
- Unknown revisions. An implementation MUST refuse to replay a Session whose recorded revision is higher than any revision it knows, and MUST NOT reinterpret it under its own current rules.
- Scope. A revision is scoped to the implementation that recorded it. For a runtime that embeds an implementation as a library, the scope is that library: the embedder records the library's revision with each Session and supplies it on replay. Revisions are not comparable across independent implementations, and the revision is not an Envelope field. A different implementation replaying the same history is bound by §1 and §3, not by another implementation's revision numbers.
A change large enough to alter the outcome of histories that comply with the published Mode RFC SHOULD be a new mode_version instead (RFC-MACP-0002). Semantics revisions are for tightenings and corrections under an unchanged Mode version.
4. External Side Effects
Modes that touch the external world SHOULD use one of these patterns:
- Plan then execute — session emits a Commitment that describes a side-effect plan; execution occurs afterward with idempotency keys.
- Log external results — side-effect results are recorded as accepted session messages so replay can reuse recorded outputs.
- Idempotent external transactions — external systems accept transaction identifiers and de-duplicate repeat attempts.
5. Determinism Classes
The determinism classes defined by RFC-MACP-0002 are normative for descriptors and manifests. Each class provides the following replay guarantees:
-
structural-only: Replay reproduces identical lifecycle transitions (OPEN, SUSPENDED, RESOLVED, EXPIRED, CANCELLED) and identical accept/reject decisions for each envelope. Semantic outcomes (e.g., which proposal wins a decision) are NOT guaranteed to be identical.
-
semantic-deterministic: Replay reproduces identical lifecycle transitions AND the same semantic outcome — the terminal action, committed values, and resolution are identical given the same accepted envelope sequence.
-
context-frozen: Same guarantees as semantic-deterministic, but ONLY when the external context bound at
SessionStart(viacontext_id,extensions, androots) is replayed exactly. If bound context differs from the original session, replay outcomes are undefined. -
non-deterministic: Replay reproduces identical lifecycle transitions and accept/reject decisions, but semantic outcomes may differ due to runtime state or external side effects. Runtimes SHOULD NOT attempt semantic replay for non-deterministic modes.
Modes SHOULD state which inputs are inside the determinism boundary and which are excluded.
6. Cryptographic Integrity (Optional)
High-assurance deployments MAY add:
- signed Envelopes,
- hash-chained session logs,
- final session hashes embedded in terminal records.
7. Testing Requirements
Implementations SHOULD test determinism through:
- replay tests,
- terminal race tests,
- fuzzing of message sequences,
- failover and rehydration tests.