Skip to content

Commit 3cc0434

Browse files
authored
Merge pull request #6 from multiagentcoordinationprotocol/update-modes
Add All the modes from the RFC into the Runtime
2 parents 1b6e82c + 3838488 commit 3cc0434

File tree

26 files changed

+6272
-78
lines changed

26 files changed

+6272
-78
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ jobs:
185185
for proto in \
186186
macp/v1/envelope.proto \
187187
macp/v1/core.proto \
188-
macp/modes/decision/v1/decision.proto; do
188+
macp/modes/decision/v1/decision.proto \
189+
macp/modes/proposal/v1/proposal.proto \
190+
macp/modes/task/v1/task.proto \
191+
macp/modes/handoff/v1/handoff.proto \
192+
macp/modes/quorum/v1/quorum.proto; do
189193
if ! diff -q "$TMPDIR/$proto" "proto/$proto" > /dev/null 2>&1; then
190194
echo "DRIFT: $proto"
191195
diff -u "$TMPDIR/$proto" "proto/$proto" || true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: setup build test fmt clippy check sync-protos sync-protos-local check-protos
22

33
SPEC_PROTO_DIR := ../multiagentcoordinationprotocol/schemas/proto
4-
PROTO_FILES := macp/v1/envelope.proto macp/v1/core.proto macp/modes/decision/v1/decision.proto
4+
PROTO_FILES := macp/v1/envelope.proto macp/v1/core.proto macp/modes/decision/v1/decision.proto macp/modes/proposal/v1/proposal.proto macp/modes/task/v1/task.proto macp/modes/handoff/v1/handoff.proto macp/modes/quorum/v1/quorum.proto
55

66
## First-time setup: configure git hooks
77
setup:

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ The MACP Runtime provides session-based message coordination between autonomous
99
- **RFC-0001 Compliant Protocol** — Structured protobuf schema with versioned envelope, typed errors, and capability negotiation
1010
- **Initialize Handshake** — Protocol version negotiation and capability discovery before any session work begins
1111
- **Pluggable Mode System** — Coordination logic is decoupled from runtime physics; ship new modes without touching the kernel
12-
- **Decision Mode (RFC Lifecycle)** — Full Proposal → Evaluation → Objection → Vote → Commitment workflow with phase tracking and mode-aware authorization
12+
- **Decision Mode** — Full Proposal → Evaluation → Objection → Vote → Commitment workflow with declared participant model and mode-aware authorization
13+
- **Proposal Mode** — Lightweight propose/accept/reject lifecycle with peer participant model
14+
- **Task Mode** — Orchestrated task assignment and completion tracking with structural-only determinism
15+
- **Handoff Mode** — Delegated context transfer between agents with context-frozen semantics
16+
- **Quorum Mode** — Threshold-based voting with quorum participant model and semantic-deterministic resolution
1317
- **Multi-Round Convergence Mode (Experimental)** — Participant-based `all_equal` convergence strategy with automatic resolution (not advertised via discovery RPCs)
1418
- **Session Cancellation** — Explicit `CancelSession` RPC to terminate sessions with a recorded reason
1519
- **Message Deduplication** — Idempotent message handling via `seen_message_ids` tracking
@@ -39,6 +43,10 @@ cargo run
3943
cargo run --bin client # basic decision mode demo
4044
cargo run --bin fuzz_client # all error paths + multi-round + new RPCs
4145
cargo run --bin multi_round_client # multi-round convergence demo
46+
cargo run --bin proposal_client # proposal mode demo
47+
cargo run --bin task_client # task mode demo
48+
cargo run --bin handoff_client # handoff mode demo
49+
cargo run --bin quorum_client # quorum mode demo
4250
```
4351

4452
## Build & Development Commands
@@ -71,9 +79,21 @@ runtime/
7179
│ │ ├── envelope.proto # Envelope, Ack, MACPError, SessionState
7280
│ │ └── core.proto # Full service definition + all message types
7381
│ └── modes/
74-
│ └── decision/
82+
│ ├── decision/
83+
│ │ └── v1/
84+
│ │ └── decision.proto # Decision mode payload types
85+
│ ├── proposal/
86+
│ │ └── v1/
87+
│ │ └── proposal.proto # Proposal mode payload types
88+
│ ├── task/
89+
│ │ └── v1/
90+
│ │ └── task.proto # Task mode payload types
91+
│ ├── handoff/
92+
│ │ └── v1/
93+
│ │ └── handoff.proto # Handoff mode payload types
94+
│ └── quorum/
7595
│ └── v1/
76-
│ └── decision.proto # Decision mode payload types
96+
│ └── quorum.proto # Quorum mode payload types
7797
├── src/
7898
│ ├── main.rs # Entry point — wires Runtime + gRPC server
7999
│ ├── lib.rs # Library root — proto modules + re-exports
@@ -85,12 +105,21 @@ runtime/
85105
│ ├── runtime.rs # Runtime kernel (dispatch + apply ModeResponse)
86106
│ ├── mode/
87107
│ │ ├── mod.rs # Mode trait + ModeResponse enum
108+
│ │ ├── util.rs # Shared mode utilities
88109
│ │ ├── decision.rs # DecisionMode (RFC lifecycle)
110+
│ │ ├── proposal.rs # ProposalMode (peer propose/accept/reject)
111+
│ │ ├── task.rs # TaskMode (orchestrated task tracking)
112+
│ │ ├── handoff.rs # HandoffMode (delegated context transfer)
113+
│ │ ├── quorum.rs # QuorumMode (threshold-based voting)
89114
│ │ └── multi_round.rs # MultiRoundMode (convergence)
90115
│ └── bin/
91116
│ ├── client.rs # Basic decision mode demo client
92117
│ ├── fuzz_client.rs # Comprehensive error-path test client
93-
│ └── multi_round_client.rs # Multi-round convergence demo client
118+
│ ├── multi_round_client.rs # Multi-round convergence demo client
119+
│ ├── proposal_client.rs # Proposal mode demo client
120+
│ ├── task_client.rs # Task mode demo client
121+
│ ├── handoff_client.rs # Handoff mode demo client
122+
│ └── quorum_client.rs # Quorum mode demo client
94123
├── build.rs # tonic-build proto compilation
95124
├── Cargo.toml # Dependencies and project config
96125
├── Makefile # Development shortcuts

build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
44
"macp/v1/envelope.proto",
55
"macp/v1/core.proto",
66
"macp/modes/decision/v1/decision.proto",
7+
"macp/modes/proposal/v1/proposal.proto",
8+
"macp/modes/task/v1/task.proto",
9+
"macp/modes/handoff/v1/handoff.proto",
10+
"macp/modes/quorum/v1/quorum.proto",
711
],
812
&["proto"],
913
)?;

docs/README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,16 @@ Sessions follow a strict state machine with three states:
102102

103103
**Modes** are pluggable coordination strategies. The runtime provides the "physics" — session invariants, logging, TTL enforcement, routing — while modes provide the "coordination logic" — when to resolve, what state to track, and what convergence criteria to apply.
104104

105-
Two modes are built in:
105+
Five standard modes are built in, plus one experimental mode:
106106

107-
| Mode Name | Aliases | Description |
108-
|-----------|---------|-------------|
109-
| `macp.mode.decision.v1` | `decision` | RFC-compliant decision lifecycle: Proposal → Evaluation → Objection → Vote → Commitment |
110-
| `macp.mode.multi_round.v1` | `multi_round` | Participant-based convergence using `all_equal` strategy (experimental, not on discovery surfaces) |
107+
| Mode Name | Aliases | Participant Model | Determinism | Description |
108+
|-----------|---------|-------------------|-------------|-------------|
109+
| `macp.mode.decision.v1` | `decision` | Declared | Semantic-deterministic | RFC-compliant decision lifecycle: Proposal → Evaluation → Objection → Vote → Commitment |
110+
| `macp.mode.proposal.v1` || Peer | Semantic-deterministic | Lightweight propose/accept/reject lifecycle for peer-to-peer coordination |
111+
| `macp.mode.task.v1` || Orchestrated | Structural-only | Task assignment and completion tracking with orchestrator-driven workflow |
112+
| `macp.mode.handoff.v1` || Delegated | Context-frozen | Context transfer between agents with frozen context semantics |
113+
| `macp.mode.quorum.v1` || Quorum | Semantic-deterministic | Threshold-based voting where resolution requires a configurable quorum |
114+
| `macp.mode.multi_round.v1` | `multi_round` | Participant-based | Convergence | Participant-based convergence using `all_equal` strategy (experimental, not on discovery surfaces) |
111115

112116
An empty `mode` field defaults to `macp.mode.decision.v1` for backward compatibility.
113117

@@ -166,6 +170,10 @@ This runtime consists of:
166170
2. **Basic Client** (`client`) — a demo client exercising the happy path: Initialize, ListModes, SessionStart, Message, Resolve, GetSession.
167171
3. **Fuzz Client** (`fuzz_client`) — a comprehensive test client exercising every error path, every new RPC, participant validation, signal messages, cancellation, and multi-round convergence.
168172
4. **Multi-Round Client** (`multi_round_client`) — a focused demo of multi-round convergence with two participants reaching agreement.
173+
5. **Proposal Client** (`proposal_client`) — a demo of the Proposal mode's peer-based propose/accept/reject workflow.
174+
6. **Task Client** (`task_client`) — a demo of the Task mode's orchestrated assignment and completion tracking.
175+
7. **Handoff Client** (`handoff_client`) — a demo of the Handoff mode's delegated context transfer between agents.
176+
8. **Quorum Client** (`quorum_client`) — a demo of the Quorum mode's threshold-based voting and resolution.
169177

170178
---
171179

0 commit comments

Comments
 (0)