From 9b80a6b2e60c714594fb7171919de13e8cece22c Mon Sep 17 00:00:00 2001 From: Markus Mayer Date: Sat, 28 Nov 2026 10:48:36 +0100 Subject: [PATCH 1/8] Bump the dependency floors to the latest releases criterion 0.8.2, proptest 1.12 and libfuzzer-sys 0.4.13 are the newest releases; the requirements now name them so a fresh resolve cannot pick an older one. Cargo.lock is not tracked, so the resolved versions were already current. The pinned GitHub Actions and pre-commit hooks are already the latest releases outside the seven-day cooldown. proptest 1.12 needs Rust 1.88. Only tests use it, and the MSRV job checks the library alone, so the comment there now names proptest instead of criterion. The docs.rs mermaid script moves from 11.17.2 to 12.3.0 (12.4.0 is inside the cooldown). Mermaid 12 switches the default layout to ELK and the default look to "neo"; the script sets the dagre layout and the classic look so the existing diagrams keep their shape. Checked by rendering the multiagent module page in a browser. --- .github/instructions/ci.instructions.md | 2 +- .github/workflows/ci.yml | 2 +- Cargo.toml | 4 ++-- docs/mermaid.html | 11 +++++++++-- fuzz/Cargo.toml | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/instructions/ci.instructions.md b/.github/instructions/ci.instructions.md index 6c32302..50e0861 100644 --- a/.github/instructions/ci.instructions.md +++ b/.github/instructions/ci.instructions.md @@ -31,7 +31,7 @@ applyTo: ".github/workflows/**,Taskfile.dist.yaml,**/Taskfile.dist.yaml,.pre-com under a 12 GB cap (`docs/design.md`, section 8). Reject a CI job or task that runs `cargo kani` without `--harness`. - `msrv` checks the library only (`cargo hack check --rust-version --all-features`, no - `--all-targets`): dev-dependencies may need a newer Rust (criterion 0.8 needs 1.86). Do not + `--all-targets`): dev-dependencies may need a newer Rust (proptest 1.12 needs 1.88). Do not add `--all-targets` back. - `fuzz/` is a separate nightly workspace. Its tasks live in `fuzz/Taskfile.dist.yaml`, included as `fuzz:`; CI's `fuzz` job mirrors `task fuzz:build` and `task fuzz:lint`. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50b1705..399ea41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -185,7 +185,7 @@ jobs: - uses: taiki-e/install-action@25f51f6b1bf4e18876107cece836f4f77ac17c8c # v2.90.7 with: tool: cargo-hack - # Library only: dev-dependencies (criterion 0.8 needs 1.86) may need a newer Rust than users do. + # Library only: dev-dependencies (proptest 1.12 needs 1.88) may need a newer Rust than users do. - run: cargo hack check --rust-version --workspace --ignore-private --all-features # Baseline: the latest release on crates.io. diff --git a/Cargo.toml b/Cargo.toml index fb73f4f..4ce6f77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,8 +34,8 @@ alloc = [] [dependencies] [dev-dependencies] -criterion = { version = "0.8", default-features = false, features = ["cargo_bench_support"] } -proptest = { version = "1", default-features = false, features = ["std"] } +criterion = { version = "0.8.2", default-features = false, features = ["cargo_bench_support"] } +proptest = { version = "1.12", default-features = false, features = ["std"] } [[bench]] name = "dispatch" diff --git a/docs/mermaid.html b/docs/mermaid.html index e7f1b15..9c84367 100644 --- a/docs/mermaid.html +++ b/docs/mermaid.html @@ -2,7 +2,7 @@ rustdoc emits ```mermaid blocks as
 (not doctested);
      this turns them into diagrams, following the rustdoc light/dark theme. -->
 
diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index a9f696a..dec49cb 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
 cargo-fuzz = true
 
 [dependencies]
-libfuzzer-sys = { version = "0.4", features = ["arbitrary-derive"] }
+libfuzzer-sys = { version = "0.4.13", features = ["arbitrary-derive"] }
 temporal-control = { path = ".." }
 
 # Standalone: not a member of any workspace.

From 6ffd95f981a448bf63df23b5c54562ff36b9e82c Mon Sep 17 00:00:00 2001
From: Markus Mayer 
Date: Sat, 28 Nov 2026 10:50:09 +0100
Subject: [PATCH 2/8] Decouple multi-agent temporal networks

Several agents (rovers, an orbiter) share timing constraints but can
rarely communicate. The new `multiagent` module (alloc only) gives each
agent a part of the plan it can dispatch alone:

- `MultiAgentStn::decouple` adds reference-relative cuts on both sides of
  every shared distance-graph edge, chosen greedily at the midpoint of
  the feasible interval on an incremental minimal network. Any family of
  locally consistent schedules then combines into a schedule of the plan.
  Cuts are kept even for edges the joint windows already imply: those
  windows may come from other agents' constraints.
- `Agent::add_constraint` accepts a local change inside the cuts without
  communication; `Agent::propose` records one that does not fit for the
  next communication window.
- `Agent::summary` projects an agent onto its shared points (minimal
  network bounds, exact by decomposability), and `AgentGroup` builds the
  same joint network on every member. `AgentGroup::check_consistency`
  decides the group's consistency without a central solver, and
  `Agent::redecouple` adopts the proposals and redistributes the slack,
  keeping cuts towards agents outside the group. Summaries carry the
  group and the agent's revision; mismatched or stale sets are refused
  with the new `Error::MismatchedSummaries`, unknown agents with
  `Error::UnknownAgent`.
- Communication windows are contingent links of an STNU; the module docs
  show the pattern and a deadline that breaks controllability.

Property tests check that independently chosen local schedules combine,
that the distributed check and an all-agent re-decoupling equal the
central check and decoupling, and that a partial re-decoupling stays
sound. Dropping the cuts of implied edges, or choosing cuts outside the
feasible interval, makes them fail.

Closes #7
---
 README.md               |  11 +-
 docs/design.md          |  77 ++++++
 src/budget.rs           |   9 +
 src/error.rs            |   8 +
 src/lib.rs              |  11 +
 src/multiagent.rs       | 355 +++++++++++++++++++++++++++
 src/multiagent/agent.rs | 406 +++++++++++++++++++++++++++++++
 src/multiagent/cuts.rs  | 264 ++++++++++++++++++++
 src/multiagent/group.rs | 401 ++++++++++++++++++++++++++++++
 tests/it/main.rs        |   1 +
 tests/it/multiagent.rs  | 526 ++++++++++++++++++++++++++++++++++++++++
 11 files changed, 2068 insertions(+), 1 deletion(-)
 create mode 100644 src/multiagent.rs
 create mode 100644 src/multiagent/agent.rs
 create mode 100644 src/multiagent/cuts.rs
 create mode 100644 src/multiagent/group.rs
 create mode 100644 tests/it/multiagent.rs

diff --git a/README.md b/README.md
index 886bbf7..574a83d 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,9 @@ Part of the [planning and search crates](https://sunsided.github.io/planning-and
 - Flight software and robotics engineers who schedule activities with uncertain durations on a
   spacecraft, rover or robot and need the timing checked before uplink and executed onboard
   without a heap. The design targets adoption by an existing executive such as F Prime or cFS.
+- Teams of vehicles (rovers, landers, orbiters) that share one plan but rarely talk: each
+  gets a part it can execute and change alone, and the parts are merged and rebalanced when
+  they can communicate, without a central solver.
 - Planners that emit temporal plans and need to know whether the plan stays executable under
   duration uncertainty, with an explanation when it does not.
 - Researchers comparing dynamic controllability algorithms: Morris 2014, RUL⁻, RUL2021, the
@@ -68,6 +71,11 @@ temporal-control = { version = "0.1", default-features = false }
   and Rizzi 2018), RUL2021 (Hunsberger and Posenato 2022), and per-label backpropagation
   (cross-check).
 - Explanations of non-controllability (semi-reducible negative cycles).
+- Multi-agent STNs: temporal decoupling into per-agent local networks that execute
+  independently (greedy cuts relative to a shared reference point), local changes checked
+  by the agent alone, distributed consistency checks and re-decoupling from exchanged
+  summaries of each agent's shared points, and communication windows (relay passes) modelled
+  as contingent links.
 - Onboard dispatcher, `no_std` without `alloc`, fixed capacity, loaded in place from a
   `const EMPTY`, with `u16`/`u32`/`usize` index types for its internal handles.
 - Compact checksummed encoding (CRC-32) of dispatchable networks, with a no-`alloc` decoder.
@@ -81,7 +89,8 @@ temporal-control = { version = "0.1", default-features = false }
 Reaction-time semantics: an observation at tick `t` may trigger executions at the same tick.
 Next-tick reaction is supported by transforming the network (`Stnu::with_reaction`).
 
-Not yet implemented: differential tests against CSTNU-Tool.
+Not yet implemented: differential tests against CSTNU-Tool, and optimal (flexibility-maximising)
+decoupling.
 
 ## Cargo features
 
diff --git a/docs/design.md b/docs/design.md
index c1510ba..eb0f6d3 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -197,6 +197,63 @@ loading fails with `DispatchError::IndexTypeTooSmall`. Measured per point and pe
 24 with `usize`. The saving on 32-bit targets is small because windows and entries hold
 8-byte-aligned `i64` ticks.
 
+### 3.4 Multi-agent STNs
+
+A multi-agent STN is an STN with a reference point `z` and an owner `own(t)` in a set of
+agents for every other point. A constraint is *local* to agent `a` if each endpoint is `z`
+or owned by `a`, and *shared* if its endpoints have different owners.
+
+A *decoupling* adds unary constraints (*cuts*) `t - z >= c` or `t - z <= c` on points of
+shared constraints, each given to the owner of its point, such that
+
+1. for every shared distance-graph edge `u -> v` with weight `w`, the owner of `u` has a cut
+   `t_u - z >= c` and the owner of `v` a cut `t_v - z <= c + w` (so every schedule of both
+   sides satisfies `t_v - t_u <= w`), and
+2. the plan with all cuts added is consistent.
+
+Then every agent's *local network* (its local constraints and its cuts) is consistent, and
+any family of schedules, one per local network, with `z = 0` in each, combines into a
+schedule of the whole plan: local constraints hold by construction and shared ones by (1).
+This is Hunsberger's temporal decoupling problem (AAAI 2002). Cuts are kept for every shared
+edge, even where the windows of the joint minimal network already imply it: those windows
+may owe their tightness to other agents' constraints, which the local network does not see.
+
+**Choice of the cuts** (`multiagent/cuts.rs`). Shared edges are processed in constraint order
+on an `IncrementalStn` of the plan. With the current windows `[L(x), U(x)]` relative to `z`,
+`c` is the midpoint (rounded down) of `max(L(u), L(v) - w)` and `min(U(u), U(v) - w)`; an
+infinite side is replaced by the other, and `0` is used if both are infinite. Any `c` in
+`[L(v) - w, U(u)]` keeps the network consistent (proof in the module docs), and both
+operands lie in that interval. If the edge still has slack, the midpoint splits it evenly;
+if the windows already imply it, the midpoint tightens neither window. The choice is a
+greedy heuristic: it does not maximise the total flexibility (an optimal decoupling needs a
+linear program), and the order of the shared constraints matters.
+
+**Summaries.** For a group `G` of agents, agent `a` summarises its local network, plus its
+proposals, with the cuts of shared constraints towards members of `G` removed: the minimal
+bounds between every pair of `z` and the points of `a`'s shared constraints with members.
+Because a consistent STN's minimal network is decomposable, these bounds describe exactly
+the projections of `a`'s feasible schedules onto those points. So the *joint network* of a
+group (all summaries plus the members' shared constraints) is consistent iff the members'
+networks plus their shared constraints are, and it has the same minimal bounds on the
+shared points. With every agent in the group, that is the consistency of the plan with
+every proposal, and the cuts computed on the joint network equal those of a central
+decoupling. A negative verdict names the shared constraints and the agents whose summaries
+are on the negative cycle, not their own constraints, which the summaries do not carry.
+
+**Re-decoupling.** Every member builds the same joint network from the same summaries (they
+are sorted by agent, so the order of arrival does not matter), computes the cuts of the
+group's shared constraints on it, and replaces its own cuts towards members with its side of
+the new ones; cuts towards non-members stay, and they are part of every member's summary.
+On a positive verdict proposals become local constraints; on a negative one they are
+dropped and the cuts stay. The result stays a decoupling only if all members switch: the
+protocol must ensure every member holds the full set of summaries before any member applies
+them. A summary carries the agent's revision, and an agent refuses a group whose summary of
+it is older than its current state.
+
+**Communication windows.** A communication opportunity whose time is uncertain is a
+contingent link in an STNU (it opens `lo..hi` after its activation and is observed when it
+happens). Dynamic controllability then covers every opening time; no new rules are needed.
+
 ## 4. Algorithm choices
 
 | Problem | Algorithm | Cost | Status |
@@ -214,6 +271,9 @@ loading fails with `DispatchError::IndexTypeTooSmall`. Measured per point and pe
 | STNU DC check, cross-check | per-label backpropagation: Morris-style, one propagation per kind of negative in-edge, no normalisation | `O(n (k + 1) (m + n^2) log n)` | done |
 | Non-DC explanation | semi-reducible negative cycle collected while Morris's nested propagations unwind, in compact form (each derived edge once, lazily expandable) | `O(n^3)` compact; expansion up to `3 * 2^k - 2` edges | done |
 | Dispatchable STN | minimal network + dominated-edge filtering (MMT 1998) | `O(n^3)` | done |
+| Temporal decoupling | greedy midpoint cuts per shared edge on an incremental minimal network (section 3.4) | `O(n^3 + (m + s) n^2)` for `s` shared constraints, `n^2` cells | done |
+| Distributed consistency check | per-agent minimal-network summaries on the shared points (Floyd-Warshall), then Bellman-Ford on the joint network | `O(n_a^3)` per agent `a`, `O(p b)` for the joint network of `p` points and `b` bounds | done |
+| Re-decoupling | the decoupling, run by every member on the joint network | as decoupling, on the joint network | done |
 
 Two independent algorithms per question are a deliberate choice: they cross-check each other
 in tests and, on the ground, at runtime. `Stn::minimal_network` already does this: if
@@ -247,6 +307,7 @@ graph LR
 | STN, STNU, DC checking, explanations, dispatchable generation | `alloc` (default feature) | ground side; may also run onboard on a capable processor |
 | Compact dispatchable encoding (decoder, validator, `encode_into`), dispatcher | none | const-generic capacity, in-place loading from a `const EMPTY`; `O(degree)` work per event |
 | `DispatchableNetwork::encode` / `decode` | `alloc` | ground side; `decode` runs exactly the onboard checks |
+| Multi-agent decoupling, summaries, group checks | `alloc` | ground side, or on an agent's own processor; each agent dispatches its local network with the dispatcher |
 
 The onboard side works without `alloc`: `Dispatcher::load_encoded` validates a received
 encoding (framing, length, CRC-32, canonical form, indices, bounds, structural invariants such
@@ -382,6 +443,7 @@ Total length `24 + 21 n + 16 (e + w)`, which must match the buffer exactly. Desi
 | Encoding | Round trips of dispatchable STNs and ESTNUs (decode equals the original, re-encoding is byte-identical, simulated dispatch from decoded `usize` and `u16` dispatchers matches the original run); every single-bit flip and every truncation of a sample encoding is rejected and leaves a busy dispatcher unchanged; each `DecodeError`; random bytes and random records behind a valid header and CRC never panic | done |
 | Fuzzing | Standalone `fuzz/` crate (not a workspace member): `decode` (raw bytes and framed random records; onboard and ground decoders agree), `dispatch` (arbitrary networks and call sequences, `usize` and `u16` dispatchers agree, rejected loads change nothing), `dc_checkers` (STNUs up to 8 points: all checkers and the closure agree, DC networks load and round-trip), `stn` (STNs up to 8 points with extreme bounds: Bellman-Ford schedules hold, Floyd-Warshall, P³C and the dispatchable filter agree with Bellman-Ford, P³C bounds equal the minimal network's, the incremental STN accepts exactly the consistent constraints and matches the minimal network after every step). Run with `cargo +nightly fuzz run  -- -max_total_time=60` or `task fuzz:smoke`; 60 s each found nothing. CI builds and lints the targets | done; fuzzing runs in CI open |
 | Model checking | Kani harnesses for the dispatcher calls and the decoder on small fixed capacities: no panic, no overflow, windows respected | done: 11 harnesses verified under Kani 0.68, each under 12 GB (bounds and results below); also run on concrete inputs in unit tests |
+| Multi-agent | Schedules picked by each agent alone (earliest, latest, random) from its local network combine into a schedule of the plan; decoupling succeeds exactly on consistent plans; the group check with all agents equals the central check of the plan with the proposals; re-decoupling with all agents equals the central decoupling, agent by agent; after a re-decoupling of two of three agents the third is unchanged and independent schedules still combine; mismatched, incomplete or stale summaries are refused. Mutations (run by hand) must make it fail: skipping the cuts of already implied edges, and cuts outside the feasible interval | done; fuzzing open |
 | Simulation | deterministic replay with injected contingent durations and resets: DC network plus dispatcher never violates a requirement constraint | open |
 
 **Kani harnesses.** `src/dispatch/proofs.rs` holds bounded no-panic checks as ordinary
@@ -443,6 +505,9 @@ harness in one process.
   CI.
 - A deterministic simulator with injected durations, resets and overruns.
 - Adapters: F Prime (WebAssembly sequencing) and cFS demonstrators, in separate crates.
+- Multi-agent: an optimal (flexibility-maximising) decoupling, decoupling of STNUs with
+  contingent links across agents, a wire encoding for summaries, the acknowledgement round
+  that makes re-decoupling all-or-none, and a fuzz target for the group operations.
 
 ## 10. Cross-crate needs
 
@@ -482,6 +547,10 @@ harness in one process.
   built-in policies (as late as possible, preferred times) or leaves that to the executive via
   `can_execute`/`execute`.
 - Whether onboard incremental re-checking is required, and its budget.
+- Multi-agent decoupling: which flexibility measure missions care about (sum of window
+  widths, the narrowest window, or the windows of chosen points), and whether that justifies
+  an LP-based optimal decoupling instead of the greedy midpoint. Default: greedy midpoint, in
+  constraint order.
 - Whether contingent links with `l = 0` must be supported. Morris 2014 allows `0 <= l < u`
   (its normal form has `l = 0`); MMV 2001 and Hunsberger 2009 require `0 < l < u`. Default:
   reject `l = 0`, accept `l = u` (see section 12).
@@ -652,3 +721,11 @@ read:
   1193-1198 (labelled distance graph; restated in Morris 2014).
 - L. Hunsberger. Magic loops in simple temporal networks with uncertainty. ICAART 2013 (2),
   157-170.
+
+Cited as background for section 3.4, content not read and not compared with the code:
+
+- L. Hunsberger. Algorithms for a temporal decoupling problem in multi-agent planning. AAAI
+  2002, 468-475 (the temporal decoupling problem; the cut rule of section 3.4 is this
+  crate's own).
+- J. C. Boerkoel Jr. and E. H. Durfee. Distributed reasoning for multiagent simple temporal
+  problems. JAIR 47 (2013) 95-156 (agent-local subnetworks with shared points).
diff --git a/src/budget.rs b/src/budget.rs
index 17040da..4765d62 100644
--- a/src/budget.rs
+++ b/src/budget.rs
@@ -82,4 +82,13 @@ impl Meter {
 
         Ok(())
     }
+
+    /// Steps still available.
+    #[cfg_attr(
+        not(feature = "alloc"),
+        expect(dead_code, reason = "used by alloc algorithms")
+    )]
+    pub(crate) const fn remaining(&self) -> u64 {
+        self.remaining
+    }
 }
diff --git a/src/error.rs b/src/error.rs
index 973f166..c90241b 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -11,6 +11,12 @@ use core::fmt;
 pub enum Error {
     /// A time point does not belong to this network.
     UnknownTimePoint,
+    /// An agent does not belong to this multi-agent network.
+    UnknownAgent,
+    /// The summaries handed to a group operation do not form one complete, current set: an
+    /// agent is missing or duplicated, the groups or revisions disagree, or a shared
+    /// constraint refers to a point its owner did not report.
+    MismatchedSummaries,
     /// A contingent link needs `0 < lo <= hi`.
     InvalidContingentLink,
     /// A checked arithmetic operation on [`Ticks`](crate::Ticks) or a size overflowed.
@@ -29,6 +35,8 @@ impl fmt::Display for Error {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         let msg = match self {
             Self::UnknownTimePoint => "time point does not belong to this network",
+            Self::UnknownAgent => "agent does not belong to this network",
+            Self::MismatchedSummaries => "summaries do not form one complete, current set",
             Self::InvalidContingentLink => "contingent link bounds must satisfy 0 < lo <= hi",
             Self::Overflow => "tick arithmetic overflowed",
             Self::BudgetExhausted => "step budget exhausted",
diff --git a/src/lib.rs b/src/lib.rs
index 3a44696..43e9566 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,6 +13,10 @@
 //!   [`Stnu::check_controllability`], Morris's `O(n^3)` algorithm; and the others in
 //!   [`DcAlgorithm`]). A negative verdict carries a [`SemiReducibleCycle`] naming the
 //!   requirements and contingent extremes that conflict.
+//! - Multi-agent STNs ([`MultiAgentStn`]): temporal decoupling into one [`Agent`] per agent
+//!   that dispatches alone, consistency checks and re-decoupling from exchanged [`Summary`]s
+//!   without a central solver, and communication windows as contingent links (see
+//!   [`multiagent`]).
 //! - An onboard [`Dispatcher`] with fixed capacity that needs no `alloc`, loads in place from
 //!   a `const` [`Dispatcher::EMPTY`], and stores handles in a chosen [`Index`] type.
 //! - A compact, versioned, CRC-32-checked encoding of dispatchable networks
@@ -55,6 +59,8 @@ mod budget;
 pub mod dispatch;
 mod error;
 #[cfg(feature = "alloc")]
+pub mod multiagent;
+#[cfg(feature = "alloc")]
 pub mod stn;
 #[cfg(feature = "alloc")]
 pub mod stnu;
@@ -69,6 +75,11 @@ pub use dispatch::{
 };
 pub use error::Error;
 #[cfg(feature = "alloc")]
+pub use multiagent::{
+    Agent, AgentGroup, AgentId, Cut, GroupConflict, GroupVerdict, MultiAgentStn, SharedConstraint,
+    Summary,
+};
+#[cfg(feature = "alloc")]
 pub use stn::{
     Bound, ChordalNetwork, Constraint, ConstraintId, CycleEdge, IncrementalStn, MinimalNetwork,
     NegativeCycle, Schedule, Stn, Verdict,
diff --git a/src/multiagent.rs b/src/multiagent.rs
new file mode 100644
index 0000000..fe28c01
--- /dev/null
+++ b/src/multiagent.rs
@@ -0,0 +1,355 @@
+//! Multi-agent STNs: temporal decoupling, distributed consistency checking and re-decoupling.
+//!
+//! Several agents (rovers, a lander, an orbiter) share one plan, but they can talk to each
+//! other only now and then. Each time point other than the common reference belongs to exactly
+//! one agent. A constraint is *shared* when its endpoints belong to different agents; every
+//! other constraint is local to one agent.
+//!
+//! # Temporal decoupling
+//!
+//! [`MultiAgentStn::decouple`] gives every point of a shared constraint a bound relative to
+//! the reference point `z`, its *cut*, so that the cuts on both sides imply the shared
+//! constraint. For a shared distance-graph edge `u -> v` with weight `w` (`t_v - t_u <= w`), it
+//! picks a value `c` and adds `t_u - z >= c` to the owner of `u` and `t_v - z <= c + w` to the
+//! owner of `v`. Each agent then dispatches its own [`Agent::local_network`] alone: every
+//! combination of locally consistent schedules is consistent with the whole plan. This is the
+//! temporal decoupling problem of Hunsberger (AAAI 2002); agents holding subnetworks joined by
+//! shared points are also the setting of Boerkoel and Durfee (JAIR 2013).
+//!
+//! The cuts are chosen greedily, one shared edge at a time in constraint order, on the
+//! incrementally maintained minimal network. `c` is the midpoint between
+//! `max(lower(u), lower(v) - w)` and `min(upper(u), upper(v) - w)`, so the slack the edge
+//! still has is split evenly between both sides. Each choice keeps the network consistent, so
+//! decoupling succeeds whenever the plan is consistent. It is a heuristic: it does not
+//! maximise the total flexibility left to the agents (an optimal decoupling needs a linear
+//! program).
+//!
+//! # Distributed checking and re-decoupling
+//!
+//! Each [`Agent`] keeps its local constraints and its cuts. A change inside its cuts it
+//! accepts alone ([`Agent::add_constraint`]); a change beyond them it records as a proposal
+//! ([`Agent::propose`]) for the next communication window. When agents can communicate, each
+//! one sends a [`Summary`]: its minimal network restricted to the reference and the points of
+//! its shared constraints with the other agents of the group. Because the minimal network of
+//! an STN is decomposable, these summaries plus the shared constraints are consistent iff the
+//! agents' combined networks are ([`AgentGroup::check_consistency`]), and they have the same
+//! minimal bounds on the shared points. No agent needs another's private points, and no
+//! central solver is involved: every member builds the same [`AgentGroup`] from the same
+//! summaries.
+//!
+//! The summaries include the proposals, so this check tells the group whether they fit the
+//! plan. [`Agent::redecouple`] then adopts the proposals (or drops them if they do not fit)
+//! and recomputes the cuts of the group's shared constraints from that [`AgentGroup`],
+//! keeping the cuts towards agents outside the group. The new cuts are a pure
+//! function of the summaries, so every member derives the same ones; with all agents in the
+//! group they equal those of [`MultiAgentStn::decouple`] on the current constraints.
+//!
+//! ```mermaid
+//! graph LR
+//!     plan["MultiAgentStn (ground)"] -->|"decouple"| agents["Agent per rover"]
+//!     agents -->|"local_network"| local["Stn: dispatch alone"]
+//!     agents -->|"add_constraint (local check), propose"| agents
+//!     agents -->|"summary (in a window)"| msg["Summary"]
+//!     msg -->|"AgentGroup::new"| group["AgentGroup"]
+//!     group -->|"check_consistency"| verdict["GroupVerdict"]
+//!     group -->|"Agent::redecouple"| agents
+//! ```
+//!
+//! **Protocol requirement.** Re-decoupling is safe only if every member of the group adopts
+//! its new cuts, and none keeps the old ones. Exchange the summaries, make sure every member
+//! holds the full set (for example with an acknowledgement round), and only then call
+//! [`Agent::redecouple`] on each member. A member that missed the exchange keeps its old cuts,
+//! and then every other member must keep theirs too.
+//!
+//! # Communication windows
+//!
+//! A relay pass or another communication opportunity whose time is not known in advance is a
+//! contingent link in an [`Stnu`](crate::Stnu): it opens between `lo` and `hi` ticks after its
+//! activation, and the agent learns the actual time only when it happens. Dynamic
+//! controllability then guarantees that the plan works however the window falls:
+//!
+//! ```
+//! use temporal_control::{Budget, Controllability, Stnu, Ticks};
+//!
+//! // The pass opens 30..50 ticks after the epoch and lasts 10 ticks.
+//! let mut stnu = Stnu::new();
+//! let epoch = stnu.add_time_point().expect("fits");
+//! let open = stnu.add_contingent_link(epoch, Ticks(30), Ticks(50)).expect("valid");
+//! let send = stnu.add_time_point().expect("fits");
+//! stnu.add_constraint(open, send, Some(Ticks(0)), Some(Ticks(10))).expect("exists");
+//!
+//! // Sending during the pass, whenever it opens, is controllable.
+//! let verdict = stnu.check_controllability(&Budget::UNLIMITED).expect("within budget");
+//! assert_eq!(verdict, Controllability::Controllable(()));
+//!
+//! // A send deadline before the latest opening plus the pass length is not.
+//! stnu.add_constraint(epoch, send, None, Some(Ticks(45))).expect("exists");
+//! let verdict = stnu.check_controllability(&Budget::UNLIMITED).expect("within budget");
+//! assert!(matches!(verdict, Controllability::Uncontrollable(_)));
+//! ```
+//!
+//! Decoupling and the group operations work on STNs; uncertain durations inside one agent's
+//! plan are checked on that agent's own STNU.
+
+mod agent;
+mod cuts;
+mod group;
+
+use alloc::vec::Vec;
+
+pub use agent::Agent;
+pub use group::{AgentGroup, GroupConflict, GroupVerdict, Summary};
+
+use crate::stn::{Bound, Constraint, ConstraintId, Stn, Verdict};
+use crate::{Budget, Error, Ticks, TimePoint};
+
+/// The reference point `z` shared by all agents: index zero in every network of this module.
+const REFERENCE: TimePoint = TimePoint(0);
+
+/// Handle of an agent inside one [`MultiAgentStn`], from zero to the agent count.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub struct AgentId(pub usize);
+
+/// A constraint between points of two different agents.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct SharedConstraint {
+    /// Its handle in the [`MultiAgentStn`] that defined it.
+    pub id: ConstraintId,
+    /// The constraint, on the time points of the [`MultiAgentStn`].
+    pub constraint: Constraint,
+    /// Owner of [`Constraint::from`].
+    pub from_agent: AgentId,
+    /// Owner of [`Constraint::to`]. Never equal to `from_agent`.
+    pub to_agent: AgentId,
+}
+
+impl SharedConstraint {
+    /// The agent on the other side of this constraint from `agent`, or `None` if `agent` is on
+    /// neither side.
+    #[must_use]
+    pub fn peer(&self, agent: AgentId) -> Option {
+        if agent == self.from_agent {
+            Some(self.to_agent)
+        } else if agent == self.to_agent {
+            Some(self.from_agent)
+        } else {
+            None
+        }
+    }
+}
+
+/// One bound a decoupling puts on a point of a shared constraint, relative to the reference.
+///
+/// [`Bound::Lower`] means `t_point - z >= value`, [`Bound::Upper`] means `t_point - z <=
+/// value`. Every shared distance-graph edge `u -> v` with weight `w` yields one lower cut on
+/// `u` and one upper cut on `v` whose values differ by exactly `w`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct Cut {
+    /// The shared constraint this cut helps imply.
+    pub shared: ConstraintId,
+    /// The bounded point, a point of the [`MultiAgentStn`].
+    pub point: TimePoint,
+    /// Which side of the point's window the cut bounds.
+    pub bound: Bound,
+    /// The bound, in ticks after the reference.
+    pub value: Ticks,
+}
+
+impl Cut {
+    /// The cut as the constraint `z -> point` it stands for.
+    const fn constraint(&self) -> Constraint {
+        let (lo, hi) = match self.bound {
+            Bound::Lower => (Some(self.value), None),
+            Bound::Upper => (None, Some(self.value)),
+        };
+
+        Constraint {
+            from: REFERENCE,
+            to: self.point,
+            lo,
+            hi,
+        }
+    }
+}
+
+/// A temporal plan shared by several agents, built on the ground.
+///
+/// Time point `0` is the reference `z` (for example the mission epoch) that every agent
+/// knows; every other point belongs to one agent.
+///
+/// # Examples
+///
+/// ```
+/// use temporal_control::{AgentId, Budget, MultiAgentStn, Ticks, Verdict};
+///
+/// // Rover 0 drills, rover 1 images the site 5..20 ticks later.
+/// let mut plan = MultiAgentStn::new(2);
+/// let z = plan.reference();
+/// let drill = plan.add_time_point(AgentId(0)).expect("known agent");
+/// let image = plan.add_time_point(AgentId(1)).expect("known agent");
+/// plan.add_constraint(z, drill, Some(Ticks(0)), Some(Ticks(30))).expect("exists");
+/// plan.add_constraint(z, image, Some(Ticks(0)), Some(Ticks(60))).expect("exists");
+/// plan.add_constraint(drill, image, Some(Ticks(5)), Some(Ticks(20))).expect("exists");
+///
+/// let Verdict::Consistent(agents) = plan.decouple(&Budget::UNLIMITED).expect("fits") else {
+///     panic!("consistent");
+/// };
+/// // Each rover now has a window for its own point, and any choice inside both windows
+/// // keeps 5 <= image - drill <= 20.
+/// assert_eq!(agents[0].cuts().len(), 2);
+/// assert_eq!(agents[1].cuts().len(), 2);
+/// ```
+#[derive(Debug, Clone)]
+pub struct MultiAgentStn {
+    /// All points and constraints; point `0` is the reference.
+    stn: Stn,
+    /// Owner of each point, indexed by point; `None` only for the reference.
+    owners: Vec>,
+    /// Number of agents.
+    agents: usize,
+}
+
+impl MultiAgentStn {
+    /// Creates a plan for `agents` agents with only the reference point.
+    #[must_use]
+    pub fn new(agents: usize) -> Self {
+        let mut stn = Stn::new();
+        // The first point of an empty network cannot overflow the count.
+        let reference = stn.add_time_point();
+        debug_assert_eq!(reference, Ok(REFERENCE));
+
+        Self {
+            stn,
+            owners: alloc::vec![None],
+            agents,
+        }
+    }
+
+    /// The reference point every agent shares.
+    #[must_use]
+    pub const fn reference(&self) -> TimePoint {
+        REFERENCE
+    }
+
+    /// Number of agents.
+    #[must_use]
+    pub const fn agent_count(&self) -> usize {
+        self.agents
+    }
+
+    /// Adds a time point owned by `agent`.
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::UnknownAgent`] if `agent` is not below [`Self::agent_count`].
+    /// - [`Error::Overflow`] if the number of time points would exceed `usize::MAX`.
+    pub fn add_time_point(&mut self, agent: AgentId) -> Result {
+        if agent.0 >= self.agents {
+            return Err(Error::UnknownAgent);
+        }
+
+        let tp = self.stn.add_time_point()?;
+        self.owners.push(Some(agent));
+        Ok(tp)
+    }
+
+    /// Adds the constraint `lo <= t_to - t_from <= hi`, local or shared.
+    ///
+    /// # Errors
+    ///
+    /// As for [`Stn::add_constraint`].
+    pub fn add_constraint(
+        &mut self,
+        from: TimePoint,
+        to: TimePoint,
+        lo: Option,
+        hi: Option,
+    ) -> Result {
+        self.stn.add_constraint(from, to, lo, hi)
+    }
+
+    /// Owner of `tp`; `None` for the reference and for unknown points.
+    #[must_use]
+    pub fn owner(&self, tp: TimePoint) -> Option {
+        self.owners.get(tp.0).copied().flatten()
+    }
+
+    /// All points and constraints as one plain [`Stn`], for central checks and explanations.
+    #[must_use]
+    pub const fn stn(&self) -> &Stn {
+        &self.stn
+    }
+
+    /// The constraints between points of different agents, in constraint order.
+    pub fn shared_constraints(&self) -> impl Iterator + '_ {
+        self.stn
+            .constraints()
+            .iter()
+            .enumerate()
+            .filter_map(|(i, &constraint)| {
+                let from_agent = self.owner(constraint.from)?;
+                let to_agent = self.owner(constraint.to)?;
+
+                (from_agent != to_agent).then_some(SharedConstraint {
+                    id: ConstraintId(i),
+                    constraint,
+                    from_agent,
+                    to_agent,
+                })
+            })
+    }
+
+    /// Decouples the plan into one [`Agent`] per agent.
+    ///
+    /// Every combination of schedules that are consistent with the agents'
+    /// [`Agent::local_network`]s is consistent with the whole plan. Runs in `O(n^3 + (m + s)
+    /// n^2)` steps for `n` points, `m` constraints and `s` shared constraints, with `n^2`
+    /// cells; see the [module docs](self) for the choice of the cuts. An inconsistent plan
+    /// yields its [`NegativeCycle`](crate::NegativeCycle) over [`Self::stn`].
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::MemoryBudgetExceeded`] if `n^2` exceeds [`Budget::max_cells`].
+    /// - [`Error::OutOfMemory`] if the allocator refuses the matrix.
+    /// - [`Error::BudgetExhausted`] if the step budget runs out.
+    /// - [`Error::Overflow`] if a path weight or a cut overflows `i64`.
+    /// - [`Error::Internal`] if a cut makes the network inconsistent (a bug).
+    pub fn decouple(&self, budget: &Budget) -> Result>, Error> {
+        let shared: Vec = self.shared_constraints().collect();
+        let cuts = match cuts::choose(&self.stn, &shared, budget)? {
+            Verdict::Consistent(cuts) => cuts,
+            Verdict::Inconsistent(cycle) => return Ok(Verdict::Inconsistent(cycle)),
+        };
+
+        let agents = (0..self.agents)
+            .map(|a| self.agent(AgentId(a), &shared, &cuts))
+            .collect();
+        Ok(Verdict::Consistent(agents))
+    }
+
+    /// Builds the view of `id`: its points, local constraints, shared constraints and cuts.
+    fn agent(&self, id: AgentId, shared: &[SharedConstraint], cuts: &[Cut]) -> Agent {
+        let owns = |tp: TimePoint| self.owner(tp) == Some(id);
+        let local = |tp: TimePoint| tp == REFERENCE || owns(tp);
+
+        let points = (1..self.owners.len())
+            .map(TimePoint)
+            .filter(|&tp| owns(tp))
+            .collect();
+        let constraints = self
+            .stn
+            .constraints()
+            .iter()
+            .filter(|c| local(c.from) && local(c.to))
+            .copied()
+            .collect();
+        let shared = shared
+            .iter()
+            .filter(|s| s.peer(id).is_some())
+            .copied()
+            .collect();
+        let cuts = cuts.iter().filter(|c| owns(c.point)).copied().collect();
+
+        Agent::new(id, points, constraints, shared, cuts)
+    }
+}
diff --git a/src/multiagent/agent.rs b/src/multiagent/agent.rs
new file mode 100644
index 0000000..205e4b1
--- /dev/null
+++ b/src/multiagent/agent.rs
@@ -0,0 +1,406 @@
+//! One agent's view of a decoupled plan.
+
+use alloc::vec::Vec;
+
+use super::group::{AgentGroup, GroupVerdict, Summary};
+use super::{AgentId, Cut, REFERENCE, SharedConstraint, cuts};
+use crate::stn::{Constraint, Stn, Verdict};
+use crate::{Budget, Error, Ticks, TimePoint};
+
+/// The part of a multi-agent plan one agent holds: its points, local constraints, shared
+/// constraints and the cuts that decouple them.
+///
+/// Every point is named by its handle in the [`MultiAgentStn`](super::MultiAgentStn). Its
+/// [`Self::local_network`] is always consistent, and every schedule of it combines with any
+/// schedules of the other agents' local networks into a schedule of the whole plan, as long
+/// as the agents adopt re-decouplings together (see the [module docs](super)).
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct Agent {
+    /// This agent's handle.
+    id: AgentId,
+    /// The points this agent owns, sorted ascending; the reference is not among them.
+    points: Vec,
+    /// Constraints among the reference and [`Self::points`], in the order they were added.
+    constraints: Vec,
+    /// Proposed constraints, among the same points, that the next re-decoupling adopts or
+    /// drops. Not part of the local network.
+    pending: Vec,
+    /// The shared constraints with a point of this agent, sorted by id.
+    shared: Vec,
+    /// The cuts on this agent's points.
+    cuts: Vec,
+    /// Counts changes to `constraints`, `pending` and `cuts`, starting at zero.
+    revision: u64,
+}
+
+impl Agent {
+    /// Creates the view; `points` and `shared` come sorted from the plan.
+    pub(super) const fn new(
+        id: AgentId,
+        points: Vec,
+        constraints: Vec,
+        shared: Vec,
+        cuts: Vec,
+    ) -> Self {
+        Self {
+            id,
+            points,
+            constraints,
+            pending: Vec::new(),
+            shared,
+            cuts,
+            revision: 0,
+        }
+    }
+
+    /// This agent's handle.
+    #[must_use]
+    pub const fn id(&self) -> AgentId {
+        self.id
+    }
+
+    /// The points this agent owns, sorted ascending, without the reference.
+    #[must_use]
+    pub fn points(&self) -> &[TimePoint] {
+        &self.points
+    }
+
+    /// The local constraints, among the reference and [`Self::points`].
+    #[must_use]
+    pub fn constraints(&self) -> &[Constraint] {
+        &self.constraints
+    }
+
+    /// The proposed constraints the next re-decoupling adopts or drops.
+    #[must_use]
+    pub fn pending(&self) -> &[Constraint] {
+        &self.pending
+    }
+
+    /// The shared constraints with a point of this agent, sorted by id.
+    #[must_use]
+    pub fn shared_constraints(&self) -> &[SharedConstraint] {
+        &self.shared
+    }
+
+    /// The cuts on this agent's points.
+    #[must_use]
+    pub fn cuts(&self) -> &[Cut] {
+        &self.cuts
+    }
+
+    /// Counts the changes to the local and proposed constraints and the cuts. A [`Summary`]
+    /// carries the revision it was made from.
+    #[must_use]
+    pub const fn revision(&self) -> u64 {
+        self.revision
+    }
+
+    /// The point of [`Self::local_network`] that stands for `tp`: the reference is `0`, and
+    /// `points()[i]` is `i + 1`. `None` if this agent does not own `tp`.
+    #[must_use]
+    pub fn local_point(&self, tp: TimePoint) -> Option {
+        if tp == REFERENCE {
+            return Some(REFERENCE);
+        }
+
+        self.points
+            .binary_search(&tp)
+            .ok()
+            .map(|i| TimePoint(i + 1))
+    }
+
+    /// The plan's point for a point of [`Self::local_network`]; the inverse of
+    /// [`Self::local_point`].
+    #[must_use]
+    pub fn plan_point(&self, local: TimePoint) -> Option {
+        match local.0 {
+            0 => Some(REFERENCE),
+            i => self.points.get(i - 1).copied(),
+        }
+    }
+
+    /// The network this agent dispatches alone: its local constraints, then its cuts.
+    /// Proposed constraints are not part of it.
+    ///
+    /// Points are numbered as in [`Self::local_point`]. Dispatch it with
+    /// [`Stn::dispatchable`], with the reference executed at the plan's epoch.
+    ///
+    /// # Errors
+    ///
+    /// [`Error::Overflow`] if the point count overflows (not reachable from a plan).
+    pub fn local_network(&self) -> Result {
+        self.network(false, |_| true)
+    }
+
+    /// Adds the local constraint `lo <= t_to - t_from <= hi` if the local network stays
+    /// consistent, without talking to any other agent.
+    ///
+    /// The cuts guarantee that a locally consistent change cannot break the plan. A rejected
+    /// constraint leaves the agent unchanged; its explanation refers to the constraints of
+    /// [`Self::local_network`] with the rejected one appended last. A rejected constraint may
+    /// still fit the plan with other cuts: [`Self::propose`] it for the next re-decoupling.
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::UnknownTimePoint`] if `from` or `to` is neither the reference nor a point of
+    ///   this agent.
+    /// - [`Error::Overflow`] if `lo` is `i64::MIN` or a path weight overflows.
+    /// - [`Error::BudgetExhausted`] if the consistency check runs out of steps.
+    pub fn add_constraint(
+        &mut self,
+        from: TimePoint,
+        to: TimePoint,
+        lo: Option,
+        hi: Option,
+        budget: &Budget,
+    ) -> Result, Error> {
+        let (local_from, local_to) = self.local_pair(from, to)?;
+        let mut candidate = self.local_network()?;
+        candidate.add_constraint(local_from, local_to, lo, hi)?;
+
+        if let Verdict::Inconsistent(cycle) = candidate.check_consistency(budget)? {
+            return Ok(Verdict::Inconsistent(cycle));
+        }
+
+        self.constraints.push(Constraint { from, to, lo, hi });
+        self.revision = self.revision.saturating_add(1);
+        Ok(Verdict::Consistent(()))
+    }
+
+    /// Proposes the local constraint `lo <= t_to - t_from <= hi` for the next re-decoupling.
+    ///
+    /// Use this for a change the cuts do not admit ([`Self::add_constraint`] rejected it).
+    /// The proposal does not constrain [`Self::local_network`]. It enters this agent's next
+    /// [`Self::summary`], so the group can check whether it fits the plan
+    /// ([`AgentGroup::check_consistency`]); [`Self::redecouple`] then adopts it, or drops it if
+    /// the group's plan is inconsistent.
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::UnknownTimePoint`] if `from` or `to` is neither the reference nor a point of
+    ///   this agent.
+    /// - [`Error::Overflow`] if `lo` is `i64::MIN`, whose negation is not representable.
+    pub fn propose(
+        &mut self,
+        from: TimePoint,
+        to: TimePoint,
+        lo: Option,
+        hi: Option,
+    ) -> Result<(), Error> {
+        self.local_pair(from, to)?;
+
+        if lo.is_some_and(|l| l.checked_neg().is_none()) {
+            return Err(Error::Overflow);
+        }
+
+        self.pending.push(Constraint { from, to, lo, hi });
+        self.revision = self.revision.saturating_add(1);
+        Ok(())
+    }
+
+    /// Summarises this agent for a re-decoupling or a joint check with the agents of `group`.
+    ///
+    /// The summary covers the local and proposed constraints. It keeps the cuts of shared
+    /// constraints with agents outside `group` and drops those with members, whose slack the
+    /// group may redistribute. It holds the minimal bounds between the reference and every
+    /// point of a shared constraint with a member, plus those shared constraints. Costs
+    /// `O(n^3)` steps and `n^2` cells for the `n` local points.
+    ///
+    /// A negative verdict means the proposals conflict with the local constraints and the
+    /// kept cuts; its explanation refers to the constraints, then the proposals, then the kept
+    /// cuts, on the points of [`Self::local_point`]. Without proposals it is always positive.
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::UnknownAgent`] if `group` does not contain this agent.
+    /// - [`Error::MemoryBudgetExceeded`], [`Error::OutOfMemory`], [`Error::BudgetExhausted`],
+    ///   [`Error::Overflow`] or [`Error::Internal`] as for [`Stn::minimal_network`].
+    pub fn summary(&self, group: &[AgentId], budget: &Budget) -> Result, Error> {
+        let mut group = group.to_vec();
+        group.sort_unstable();
+        group.dedup();
+
+        if group.binary_search(&self.id).is_err() {
+            return Err(Error::UnknownAgent);
+        }
+
+        let member = |s: &SharedConstraint| {
+            s.peer(self.id)
+                .is_some_and(|p| group.binary_search(&p).is_ok())
+        };
+        let shared: Vec =
+            self.shared.iter().filter(|s| member(s)).copied().collect();
+        let network = self.network(true, |cut| !self.shared_with(cut, member))?;
+
+        let minimal = match network.minimal_network(budget)? {
+            Verdict::Consistent(minimal) => minimal,
+            Verdict::Inconsistent(cycle) => return Ok(Verdict::Inconsistent(cycle)),
+        };
+
+        let interface = self.interface(&shared);
+        let bounds = interface_bounds(
+            &interface,
+            |tp| self.local_point(tp),
+            |a, b| (minimal.lower(a, b), minimal.upper(a, b)),
+        );
+
+        Ok(Verdict::Consistent(Summary::new(
+            self.id,
+            group,
+            self.revision,
+            interface,
+            bounds,
+            shared,
+        )))
+    }
+
+    /// Replaces the cuts of the group's shared constraints with the group's new decoupling.
+    ///
+    /// Every member that calls this with the same `group` gets its side of the same cuts, and
+    /// adopts its proposals into its local constraints. A negative verdict means the group's
+    /// plan, proposals included and with the cuts towards other agents fixed, is inconsistent;
+    /// the agent then drops its proposals and keeps its cuts. Read the protocol requirement in
+    /// the [module docs](super) before using this.
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::MismatchedSummaries`] if this agent is not a member of `group`, or its
+    ///   summary in `group` is older than [`Self::revision`].
+    /// - Any error of [`MultiAgentStn::decouple`](super::MultiAgentStn::decouple) on the
+    ///   group's network.
+    pub fn redecouple(
+        &mut self,
+        group: &AgentGroup,
+        budget: &Budget,
+    ) -> Result {
+        if group.revision(self.id) != Some(self.revision) {
+            return Err(Error::MismatchedSummaries);
+        }
+
+        let new_cuts = match cuts::choose(group.stn(), group.shared(), budget)? {
+            Verdict::Consistent(cuts) => cuts,
+            Verdict::Inconsistent(cycle) => {
+                self.pending.clear();
+                self.revision = self.revision.saturating_add(1);
+                return Ok(GroupVerdict::Inconsistent(group.conflict(&cycle)));
+            }
+        };
+
+        self.constraints.append(&mut self.pending);
+
+        let member =
+            |s: &SharedConstraint| s.peer(self.id).is_some_and(|p| group.revision(p).is_some());
+        let mut cuts = core::mem::take(&mut self.cuts);
+        cuts.retain(|cut| !self.shared_with(cut, member));
+        self.cuts = cuts;
+
+        for cut in new_cuts {
+            let point = group.plan_point(cut.point).ok_or(Error::Internal)?;
+
+            if self.local_point(point).is_some_and(|tp| tp != REFERENCE) {
+                self.cuts.push(Cut { point, ..cut });
+            }
+        }
+
+        self.revision = self.revision.saturating_add(1);
+        Ok(GroupVerdict::Consistent)
+    }
+
+    /// The local points of `from` and `to`.
+    ///
+    /// # Errors
+    ///
+    /// [`Error::UnknownTimePoint`] if either is neither the reference nor a point of this agent.
+    fn local_pair(&self, from: TimePoint, to: TimePoint) -> Result<(TimePoint, TimePoint), Error> {
+        let local = |tp| self.local_point(tp).ok_or(Error::UnknownTimePoint);
+        Ok((local(from)?, local(to)?))
+    }
+
+    /// Whether `cut` belongs to a shared constraint for which `pick` holds.
+    fn shared_with(&self, cut: &Cut, pick: impl Fn(&SharedConstraint) -> bool) -> bool {
+        self.shared
+            .binary_search_by_key(&cut.shared, |s| s.id)
+            .is_ok_and(|i| pick(&self.shared[i]))
+    }
+
+    /// The own points of `shared`, sorted ascending and without duplicates.
+    fn interface(&self, shared: &[SharedConstraint]) -> Vec {
+        let mut points: Vec = shared
+            .iter()
+            .flat_map(|s| [s.constraint.from, s.constraint.to])
+            .filter(|&tp| tp != REFERENCE && self.points.binary_search(&tp).is_ok())
+            .collect();
+        points.sort_unstable();
+        points.dedup();
+        points
+    }
+
+    /// The local network with the local constraints, the proposals if `pending`, and the cuts
+    /// for which `keep` holds, in that order.
+    ///
+    /// # Errors
+    ///
+    /// [`Error::Overflow`] if the point count overflows; [`Error::Internal`] if a stored
+    /// constraint names a point this agent does not own.
+    fn network(&self, pending: bool, keep: impl Fn(&Cut) -> bool) -> Result {
+        let mut stn = Stn::new();
+
+        for _ in 0..=self.points.len() {
+            stn.add_time_point()?;
+        }
+
+        let cuts = self
+            .cuts
+            .iter()
+            .filter(|cut| keep(cut))
+            .map(Cut::constraint);
+
+        let proposals = self.pending.iter().filter(|_| pending);
+
+        for c in self
+            .constraints
+            .iter()
+            .chain(proposals)
+            .copied()
+            .chain(cuts)
+        {
+            let from = self.local_point(c.from).ok_or(Error::Internal)?;
+            let to = self.local_point(c.to).ok_or(Error::Internal)?;
+            stn.add_constraint(from, to, c.lo, c.hi)?;
+        }
+
+        Ok(stn)
+    }
+}
+
+/// The bounds between every pair of the reference and `interface`, as plan constraints.
+///
+/// `local` maps a plan point to the network `bounds` reads; pairs without any finite bound
+/// are left out.
+fn interface_bounds(
+    interface: &[TimePoint],
+    local: impl Fn(TimePoint) -> Option,
+    bounds: impl Fn(TimePoint, TimePoint) -> (Option, Option),
+) -> Vec {
+    let points: Vec = core::iter::once(REFERENCE)
+        .chain(interface.iter().copied())
+        .collect();
+    let mut out = Vec::new();
+
+    for (i, &from) in points.iter().enumerate() {
+        for &to in &points[i + 1..] {
+            let (Some(a), Some(b)) = (local(from), local(to)) else {
+                continue;
+            };
+
+            let (lo, hi) = bounds(a, b);
+
+            if lo.is_some() || hi.is_some() {
+                out.push(Constraint { from, to, lo, hi });
+            }
+        }
+    }
+
+    out
+}
diff --git a/src/multiagent/cuts.rs b/src/multiagent/cuts.rs
new file mode 100644
index 0000000..c7884ae
--- /dev/null
+++ b/src/multiagent/cuts.rs
@@ -0,0 +1,264 @@
+//! Choosing the cuts of a temporal decoupling.
+//!
+//! The network is loaded into an [`IncrementalStn`], so the windows `[lower(x), upper(x)]` of
+//! every point relative to the reference are always those of the current minimal network.
+//! For each shared distance-graph edge `u -> v` with weight `w`, a value `c` is chosen and the
+//! cuts `t_u - z >= c` and `t_v - z <= c + w` are added, in that order.
+//!
+//! Both additions keep the network consistent whenever `lower(v) - w <= c <= upper(u)`:
+//!
+//! - `t_u - z >= c` with `c <= upper(u)` leaves a schedule with `t_u >= c`.
+//! - If `c >= lower(u)`, some schedule of the minimal network has `t_u = c`, and in it
+//!   `t_v <= c + w`. Otherwise the first cut changed nothing, and `lower(v) <= c + w` holds by
+//!   assumption. Either way the second cut leaves a schedule.
+//!
+//! `c` is the midpoint of `lo_c = max(lower(u), lower(v) - w)` and `hi_c = min(upper(u),
+//! upper(v) - w)`, rounded down. Both lie in `[lower(v) - w, upper(u)]` (the minimal network
+//! has `lower(v) - w <= upper(u)`), so the midpoint does too. When `lo_c <= hi_c`, the edge
+//! still has slack and the midpoint splits it evenly. When `lo_c > hi_c`, the edge is already
+//! implied by the windows, and the midpoint lies in `[upper(v) - w, lower(u)]`, so neither
+//! cut tightens the global network. The cuts are still recorded: the windows may owe their
+//! tightness to other agents' constraints, and each agent's local network must imply its side
+//! on its own. An unbounded `lo_c` (or `hi_c`) is replaced by the other value, and `0` is used
+//! when both are unbounded.
+
+use alloc::vec::Vec;
+
+use super::{Cut, REFERENCE, SharedConstraint};
+use crate::budget::Meter;
+use crate::stn::{Bound, IncrementalStn, Stn, Verdict, steps};
+use crate::{Budget, Error, Ticks, TimePoint};
+
+/// Chooses the cuts of every shared constraint in `shared`, in order, on `stn`.
+///
+/// `shared` refers to the points of `stn`, whose point `0` is the reference. Cuts on the
+/// same point accumulate; none is dropped.
+///
+/// # Errors
+///
+/// - [`Error::MemoryBudgetExceeded`] if `n^2` exceeds [`Budget::max_cells`].
+/// - [`Error::OutOfMemory`] if the allocator refuses the matrix.
+/// - [`Error::BudgetExhausted`] if the steps of the whole computation exceed the budget.
+/// - [`Error::Overflow`] if a path weight or a cut overflows `i64`.
+/// - [`Error::Internal`] if a cut is rejected, or the explanation search disagrees (a bug).
+pub(super) fn choose(
+    stn: &Stn,
+    shared: &[SharedConstraint],
+    budget: &Budget,
+) -> Result>, Error> {
+    let mut meter = budget.meter();
+    let Some(mut inc) = load(stn, budget, &mut meter)? else {
+        return explain(stn, &mut meter);
+    };
+
+    let edge_steps = steps(stn.time_point_count())?
+        .saturating_pow(2)
+        .saturating_mul(2);
+    let mut cuts = Vec::new();
+
+    for s in shared {
+        for (u, v, w) in distance_edges(s) {
+            meter.spend(edge_steps)?;
+            cut_edge(&mut inc, s, u, v, w, budget, &mut cuts)?;
+        }
+    }
+
+    Ok(Verdict::Consistent(cuts))
+}
+
+/// Loads `stn` into an incremental network; `None` if a constraint is rejected.
+///
+/// Charges `meter` with an upper bound of the steps each insertion costs.
+///
+/// # Errors
+///
+/// As for [`IncrementalStn::add_time_point`] and [`IncrementalStn::add_constraint`], with the
+/// steps of all insertions metered together.
+fn load(stn: &Stn, budget: &Budget, meter: &mut Meter) -> Result, Error> {
+    let n = stn.time_point_count();
+    let mut inc = IncrementalStn::new();
+
+    for k in 1..=n {
+        meter.spend(steps(k)?.saturating_pow(2))?;
+        inc.add_time_point(budget)?;
+    }
+
+    let edge_steps = steps(n)?.saturating_pow(2).saturating_mul(2);
+
+    for c in stn.constraints() {
+        meter.spend(edge_steps)?;
+
+        if let Verdict::Inconsistent(_) = inc.add_constraint(c.from, c.to, c.lo, c.hi, budget)? {
+            return Ok(None);
+        }
+    }
+
+    Ok(Some(inc))
+}
+
+/// Explains why `stn` is inconsistent, with the steps left in `meter`.
+///
+/// # Errors
+///
+/// [`Error::BudgetExhausted`] or [`Error::Overflow`] from Bellman-Ford, or [`Error::Internal`]
+/// if it finds `stn` consistent.
+fn explain(stn: &Stn, meter: &mut Meter) -> Result>, Error> {
+    let remaining = Budget {
+        max_steps: meter.remaining(),
+        max_cells: usize::MAX,
+    };
+
+    match stn.check_consistency(&remaining)? {
+        Verdict::Inconsistent(cycle) => Ok(Verdict::Inconsistent(cycle)),
+        Verdict::Consistent(_) => Err(Error::Internal),
+    }
+}
+
+/// The distance-graph edges `(u, v, w)`, meaning `t_v - t_u <= w`, of a shared constraint.
+fn distance_edges(s: &SharedConstraint) -> impl Iterator {
+    let c = s.constraint;
+    let upper = c.hi.map(|hi| (c.from, c.to, hi));
+    let lower = c.lo.and_then(Ticks::checked_neg).map(|w| (c.to, c.from, w));
+
+    upper.into_iter().chain(lower)
+}
+
+/// Adds the two cuts of the shared edge `u -> v` with weight `w` and records them in `cuts`.
+///
+/// `u`, `v` and `w` keep the names of the module docs.
+///
+/// # Errors
+///
+/// - [`Error::Overflow`] if `c` or `c + w` does not fit `i64`, or an update overflows.
+/// - [`Error::BudgetExhausted`] if an update does not fit the step budget.
+/// - [`Error::Internal`] if a cut is rejected (a bug: see the module docs).
+#[expect(
+    clippy::many_single_char_names,
+    reason = "u, v, w and c are the names of the module docs"
+)]
+fn cut_edge(
+    inc: &mut IncrementalStn,
+    s: &SharedConstraint,
+    u: TimePoint,
+    v: TimePoint,
+    w: Ticks,
+    budget: &Budget,
+    cuts: &mut Vec,
+) -> Result<(), Error> {
+    let window = |x| (inc.lower(REFERENCE, x), inc.upper(REFERENCE, x));
+    let c = split(window(u), window(v), w)?;
+    let lower = Cut {
+        shared: s.id,
+        point: u,
+        bound: Bound::Lower,
+        value: c,
+    };
+    let upper = Cut {
+        shared: s.id,
+        point: v,
+        bound: Bound::Upper,
+        value: c.checked_add(w).ok_or(Error::Overflow)?,
+    };
+
+    for cut in [lower, upper] {
+        let constraint = cut.constraint();
+
+        if let Verdict::Inconsistent(_) = inc.add_constraint(
+            constraint.from,
+            constraint.to,
+            constraint.lo,
+            constraint.hi,
+            budget,
+        )? {
+            return Err(Error::Internal);
+        }
+
+        cuts.push(cut);
+    }
+
+    Ok(())
+}
+
+/// The cut value `c` of a shared edge `u -> v` with weight `w`, given both windows.
+///
+/// # Errors
+///
+/// [`Error::Overflow`] if the midpoint does not fit `i64`.
+fn split(
+    (lower_u, upper_u): (Option, Option),
+    (lower_v, upper_v): (Option, Option),
+    w: Ticks,
+) -> Result {
+    let shift = |t: Option| t.map(|t| i128::from(t.0) - i128::from(w.0));
+    let lo_c = max_present(lower_u.map(|t| i128::from(t.0)), shift(lower_v));
+    let hi_c = min_present(upper_u.map(|t| i128::from(t.0)), shift(upper_v));
+
+    let c = match (lo_c, hi_c) {
+        (Some(lo), Some(hi)) => (lo + hi).div_euclid(2),
+        (Some(bound), None) | (None, Some(bound)) => bound,
+        (None, None) => 0,
+    };
+
+    i64::try_from(c).map(Ticks).map_err(|_| Error::Overflow)
+}
+
+/// The larger of the present values; `None` if neither is (both bounds at `-infinity`).
+fn max_present(a: Option, b: Option) -> Option {
+    a.into_iter().chain(b).max()
+}
+
+/// The smaller of the present values; `None` if neither is (both bounds at `+infinity`).
+fn min_present(a: Option, b: Option) -> Option {
+    a.into_iter().chain(b).min()
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    /// Slack on both sides is split at the midpoint.
+    #[test]
+    fn split_halves_slack() {
+        // u in [0, 10], v in [0, 30], v - u <= 10: c in [0, 10] -> 5.
+        let c = split(
+            (Some(Ticks(0)), Some(Ticks(10))),
+            (Some(Ticks(0)), Some(Ticks(30))),
+            Ticks(10),
+        );
+        assert_eq!(c, Ok(Ticks(5)));
+    }
+
+    /// An already implied edge gets a cut that tightens neither window.
+    #[test]
+    fn split_implied_edge_keeps_windows() {
+        // u in [20, 30], v in [0, 25], v - u <= 10: implied; c in [15, 20].
+        let c = split(
+            (Some(Ticks(20)), Some(Ticks(30))),
+            (Some(Ticks(0)), Some(Ticks(25))),
+            Ticks(10),
+        )
+        .expect("fits");
+        assert!(Ticks(15) <= c && c <= Ticks(20));
+    }
+
+    /// Unbounded windows fall back to the finite side, or to zero.
+    #[test]
+    fn split_unbounded() {
+        assert_eq!(split((None, None), (None, None), Ticks(3)), Ok(Ticks(0)));
+        assert_eq!(
+            split((None, None), (None, Some(Ticks(9))), Ticks(3)),
+            Ok(Ticks(6))
+        );
+        assert_eq!(
+            split((Some(Ticks(4)), None), (None, None), Ticks(3)),
+            Ok(Ticks(4))
+        );
+    }
+
+    /// A midpoint beyond `i64` is an overflow, not a wrap.
+    #[test]
+    fn split_overflow() {
+        let c = split((None, None), (Some(Ticks(i64::MIN)), None), Ticks(1));
+        assert_eq!(c, Err(Error::Overflow));
+    }
+}
diff --git a/src/multiagent/group.rs b/src/multiagent/group.rs
new file mode 100644
index 0000000..ab7034e
--- /dev/null
+++ b/src/multiagent/group.rs
@@ -0,0 +1,401 @@
+//! Summaries exchanged between agents, and the joint network a group builds from them.
+
+use alloc::vec::Vec;
+
+use super::{AgentId, REFERENCE, SharedConstraint};
+use crate::stn::{Constraint, ConstraintId, NegativeCycle, Stn, Verdict};
+use crate::{Budget, Error, TimePoint};
+
+/// What one agent tells the others of a group: its plan projected onto the points they share.
+///
+/// Made by [`Agent::summary`](super::Agent::summary). Points and constraints are named by
+/// their handles in the [`MultiAgentStn`](super::MultiAgentStn).
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct Summary {
+    /// The agent that made the summary.
+    agent: AgentId,
+    /// The members of the group it was made for, sorted ascending, `agent` included.
+    group: Vec,
+    /// The agent's [`Agent::revision`](super::Agent::revision) when it made the summary.
+    revision: u64,
+    /// The agent's points on shared constraints with members, sorted ascending.
+    points: Vec,
+    /// The minimal bounds between every pair of the reference and `points`.
+    bounds: Vec,
+    /// The shared constraints with members, sorted by id.
+    shared: Vec,
+}
+
+impl Summary {
+    /// Assembles a summary; the caller sorts every list.
+    pub(super) const fn new(
+        agent: AgentId,
+        group: Vec,
+        revision: u64,
+        points: Vec,
+        bounds: Vec,
+        shared: Vec,
+    ) -> Self {
+        Self {
+            agent,
+            group,
+            revision,
+            points,
+            bounds,
+            shared,
+        }
+    }
+
+    /// The agent that made the summary.
+    #[must_use]
+    pub const fn agent(&self) -> AgentId {
+        self.agent
+    }
+
+    /// The members of the group it was made for, sorted ascending.
+    #[must_use]
+    pub fn group(&self) -> &[AgentId] {
+        &self.group
+    }
+
+    /// The agent's revision when it made the summary.
+    #[must_use]
+    pub const fn revision(&self) -> u64 {
+        self.revision
+    }
+
+    /// The agent's points on shared constraints with members, sorted ascending.
+    #[must_use]
+    pub fn points(&self) -> &[TimePoint] {
+        &self.points
+    }
+
+    /// The minimal bounds between the reference and [`Self::points`], pairwise.
+    #[must_use]
+    pub fn bounds(&self) -> &[Constraint] {
+        &self.bounds
+    }
+
+    /// The shared constraints with members, sorted by id.
+    #[must_use]
+    pub fn shared_constraints(&self) -> &[SharedConstraint] {
+        &self.shared
+    }
+}
+
+/// Outcome of a group operation that answered the question.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum GroupVerdict {
+    /// The group's combined plan is consistent.
+    Consistent,
+    /// The group's combined plan is inconsistent.
+    Inconsistent(GroupConflict),
+}
+
+/// Which shared constraints and which agents' plans conflict in a group.
+///
+/// Summaries hold derived bounds, not the agents' own constraints, so the conflict names the
+/// agents whose plans take part rather than their constraints. The plan's own
+/// [`Stn::check_consistency`] on [`MultiAgentStn::stn`](super::MultiAgentStn::stn) names the
+/// constraints, where the whole plan is available.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct GroupConflict {
+    /// The shared constraints on the negative cycle, sorted by id.
+    pub shared: Vec,
+    /// The agents whose summarised plans are on the negative cycle, sorted ascending.
+    pub agents: Vec,
+}
+
+/// Where a constraint of the joint network comes from.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+enum Origin {
+    /// A bound of this agent's summary.
+    Summary(AgentId),
+    /// This shared constraint.
+    Shared(ConstraintId),
+}
+
+/// The joint network of a group, built from one summary per member.
+///
+/// Every member that builds it from the same summaries gets the same network, whatever the
+/// order of the summaries. Its points are the reference and the points of the summaries.
+///
+/// # Examples
+///
+/// ```
+/// use temporal_control::{AgentGroup, AgentId, Budget, GroupVerdict, MultiAgentStn, Ticks, Verdict};
+///
+/// let mut plan = MultiAgentStn::new(2);
+/// let z = plan.reference();
+/// let a = plan.add_time_point(AgentId(0)).expect("known agent");
+/// let b = plan.add_time_point(AgentId(1)).expect("known agent");
+/// plan.add_constraint(z, a, Some(Ticks(0)), Some(Ticks(10))).expect("exists");
+/// plan.add_constraint(a, b, Some(Ticks(5)), None).expect("exists");
+/// let Verdict::Consistent(agents) = plan.decouple(&Budget::UNLIMITED).expect("fits") else {
+///     panic!("consistent");
+/// };
+///
+/// let members = [AgentId(0), AgentId(1)];
+/// let summaries: Vec<_> = agents
+///     .iter()
+///     .map(|agent| match agent.summary(&members, &Budget::UNLIMITED).expect("fits") {
+///         Verdict::Consistent(summary) => summary,
+///         Verdict::Inconsistent(_) => panic!("no proposals"),
+///     })
+///     .collect();
+/// let group = AgentGroup::new(&summaries).expect("complete");
+/// assert_eq!(group.check_consistency(&Budget::UNLIMITED), Ok(GroupVerdict::Consistent));
+/// ```
+#[derive(Debug, Clone)]
+pub struct AgentGroup {
+    /// The members and their summary revisions, sorted by agent.
+    members: Vec<(AgentId, u64)>,
+    /// The plan's points in the joint network, sorted; `points[0]` is the reference.
+    points: Vec,
+    /// The joint network: every summary bound, then every shared constraint.
+    stn: Stn,
+    /// The origin of each constraint of `stn`.
+    origins: Vec,
+    /// The members' shared constraints on the points of `stn`, sorted by id.
+    shared: Vec,
+}
+
+impl AgentGroup {
+    /// Builds the joint network of one summary per member.
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::MismatchedSummaries`] if `summaries` is empty, two come from the same agent,
+    ///   their groups differ from each other or from the set of their agents, two report the
+    ///   same point or the same shared constraint differently, or a shared constraint refers
+    ///   to a point its owner did not report.
+    /// - [`Error::Overflow`] as for [`Stn::add_constraint`].
+    pub fn new(summaries: &[Summary]) -> Result {
+        let mut sorted: Vec<&Summary> = summaries.iter().collect();
+        sorted.sort_unstable_by_key(|s| s.agent);
+        let members = members(&sorted)?;
+        let points = joint_points(&sorted)?;
+        let shared = joint_shared(&sorted, &points)?;
+
+        let mut group = Self {
+            members,
+            points,
+            stn: Stn::new(),
+            origins: Vec::new(),
+            shared: Vec::new(),
+        };
+        group.build(&sorted, shared)?;
+        Ok(group)
+    }
+
+    /// The members, sorted ascending.
+    pub fn members(&self) -> impl Iterator + '_ {
+        self.members.iter().map(|&(agent, _)| agent)
+    }
+
+    /// The revision of `agent`'s summary, or `None` if `agent` is not a member.
+    #[must_use]
+    pub fn revision(&self, agent: AgentId) -> Option {
+        self.members
+            .binary_search_by_key(&agent, |&(a, _)| a)
+            .ok()
+            .map(|i| self.members[i].1)
+    }
+
+    /// Checks whether the members' plans, with their cuts towards other agents, are jointly
+    /// consistent. With every agent of the plan in the group, this is the consistency of the
+    /// whole plan.
+    ///
+    /// Runs Bellman-Ford on the joint network, `O(p * b)` steps for `p` shared points and `b`
+    /// bounds.
+    ///
+    /// # Errors
+    ///
+    /// As for [`Stn::check_consistency`].
+    pub fn check_consistency(&self, budget: &Budget) -> Result {
+        Ok(match self.stn.check_consistency(budget)? {
+            Verdict::Consistent(_) => GroupVerdict::Consistent,
+            Verdict::Inconsistent(cycle) => GroupVerdict::Inconsistent(self.conflict(&cycle)),
+        })
+    }
+
+    /// The joint network, on points numbered by their position in the sorted point list.
+    pub(super) const fn stn(&self) -> &Stn {
+        &self.stn
+    }
+
+    /// The members' shared constraints on the points of [`Self::stn`].
+    pub(super) fn shared(&self) -> &[SharedConstraint] {
+        &self.shared
+    }
+
+    /// The plan's point for a point of [`Self::stn`].
+    pub(super) fn plan_point(&self, joint: TimePoint) -> Option {
+        self.points.get(joint.0).copied()
+    }
+
+    /// Names the shared constraints and agents behind a negative cycle of [`Self::stn`].
+    pub(super) fn conflict(&self, cycle: &NegativeCycle) -> GroupConflict {
+        let mut shared = Vec::new();
+        let mut agents = Vec::new();
+
+        for edge in cycle.edges() {
+            match self.origins.get(edge.constraint.0) {
+                Some(&Origin::Shared(id)) => shared.push(id),
+                Some(&Origin::Summary(agent)) => agents.push(agent),
+                None => {}
+            }
+        }
+
+        shared.sort_unstable();
+        shared.dedup();
+        agents.sort_unstable();
+        agents.dedup();
+        GroupConflict { shared, agents }
+    }
+
+    /// Fills the joint network: the points, every summary bound, then every shared constraint.
+    ///
+    /// # Errors
+    ///
+    /// [`Error::MismatchedSummaries`] if a bound names a point no summary reported;
+    /// [`Error::Overflow`] as for [`Stn::add_constraint`].
+    fn build(&mut self, sorted: &[&Summary], shared: Vec) -> Result<(), Error> {
+        for _ in 0..self.points.len() {
+            self.stn.add_time_point()?;
+        }
+
+        for summary in sorted {
+            for bound in &summary.bounds {
+                let joint = self.to_joint(bound)?;
+                self.push(joint, Origin::Summary(summary.agent))?;
+            }
+        }
+
+        for s in &shared {
+            self.push(s.constraint, Origin::Shared(s.id))?;
+        }
+
+        self.shared = shared;
+        Ok(())
+    }
+
+    /// Adds one constraint on joint points and records its origin.
+    ///
+    /// # Errors
+    ///
+    /// As for [`Stn::add_constraint`].
+    fn push(&mut self, c: Constraint, origin: Origin) -> Result<(), Error> {
+        self.stn.add_constraint(c.from, c.to, c.lo, c.hi)?;
+        self.origins.push(origin);
+        Ok(())
+    }
+
+    /// Renames the points of a plan constraint to joint points.
+    ///
+    /// # Errors
+    ///
+    /// [`Error::MismatchedSummaries`] if a point is not in the joint network.
+    fn to_joint(&self, c: &Constraint) -> Result {
+        Ok(Constraint {
+            from: joint_point(&self.points, c.from)?,
+            to: joint_point(&self.points, c.to)?,
+            ..*c
+        })
+    }
+}
+
+/// The members and their revisions, checking that the summaries form one group.
+///
+/// # Errors
+///
+/// [`Error::MismatchedSummaries`] if there are no summaries, two share an agent, or a
+/// summary's group is not exactly the set of agents.
+fn members(sorted: &[&Summary]) -> Result, Error> {
+    let members: Vec<(AgentId, u64)> = sorted.iter().map(|s| (s.agent, s.revision)).collect();
+    let agents: Vec = members.iter().map(|&(a, _)| a).collect();
+    let distinct = agents.windows(2).all(|w| w[0] < w[1]);
+
+    if agents.is_empty() || !distinct || sorted.iter().any(|s| s.group != agents) {
+        return Err(Error::MismatchedSummaries);
+    }
+
+    Ok(members)
+}
+
+/// The reference and every reported point, sorted.
+///
+/// # Errors
+///
+/// [`Error::MismatchedSummaries`] if two summaries report the same point, or one reports the
+/// reference.
+fn joint_points(sorted: &[&Summary]) -> Result, Error> {
+    let mut points: Vec = core::iter::once(REFERENCE)
+        .chain(sorted.iter().flat_map(|s| s.points.iter().copied()))
+        .collect();
+    let reported = points.len();
+    points.sort_unstable();
+    points.dedup();
+
+    if points.len() != reported {
+        return Err(Error::MismatchedSummaries);
+    }
+
+    Ok(points)
+}
+
+/// The members' shared constraints, once each, sorted by id and renamed to joint points.
+///
+/// # Errors
+///
+/// [`Error::MismatchedSummaries`] if two summaries report one id differently, a constraint's
+/// agents are not both members, an endpoint is unreported, or a member summarised a shared
+/// constraint its peer left out.
+fn joint_shared(sorted: &[&Summary], points: &[TimePoint]) -> Result, Error> {
+    let mut all: Vec = sorted
+        .iter()
+        .flat_map(|s| s.shared.iter().copied())
+        .collect();
+    all.sort_unstable_by_key(|s| s.id);
+
+    let mut shared: Vec = Vec::new();
+
+    for (i, s) in all.iter().enumerate() {
+        let same_as_previous = i > 0 && all[i - 1].id == s.id;
+
+        if same_as_previous {
+            if all[i - 1] != *s {
+                return Err(Error::MismatchedSummaries);
+            }
+
+            continue;
+        }
+
+        let both_report = all.get(i + 1).is_some_and(|next| next.id == s.id);
+
+        if !both_report {
+            return Err(Error::MismatchedSummaries);
+        }
+
+        let constraint = Constraint {
+            from: joint_point(points, s.constraint.from)?,
+            to: joint_point(points, s.constraint.to)?,
+            ..s.constraint
+        };
+        shared.push(SharedConstraint { constraint, ..*s });
+    }
+
+    Ok(shared)
+}
+
+/// The joint point of a plan point.
+///
+/// # Errors
+///
+/// [`Error::MismatchedSummaries`] if no summary reported `tp`.
+fn joint_point(points: &[TimePoint], tp: TimePoint) -> Result {
+    points
+        .binary_search(&tp)
+        .map(TimePoint)
+        .map_err(|_| Error::MismatchedSummaries)
+}
diff --git a/tests/it/main.rs b/tests/it/main.rs
index 9dbb1e7..3c8480e 100644
--- a/tests/it/main.rs
+++ b/tests/it/main.rs
@@ -5,6 +5,7 @@ mod encoding;
 mod examples;
 mod generators;
 mod incremental;
+mod multiagent;
 mod oracle;
 mod papers;
 mod properties;
diff --git a/tests/it/multiagent.rs b/tests/it/multiagent.rs
new file mode 100644
index 0000000..38dccc9
--- /dev/null
+++ b/tests/it/multiagent.rs
@@ -0,0 +1,526 @@
+//! Multi-agent STNs: decoupling soundness, distributed checks and re-decoupling against the
+//! central plan.
+
+use proptest::prelude::*;
+use temporal_control::{
+    Agent, AgentGroup, AgentId, Budget, Constraint, GroupVerdict, IncrementalStn, MultiAgentStn,
+    Stn, Summary, Ticks, TimePoint, Verdict,
+};
+
+use crate::generators::ConstraintSpec;
+
+/// A multi-agent plan as plain data. Point `0` is the reference; point `i > 0` belongs to
+/// agent `owners[i - 1]`.
+#[derive(Debug, Clone)]
+struct PlanSpec {
+    /// Number of agents. At least one.
+    agents: usize,
+    /// Owner of each non-reference point, below `agents`.
+    owners: Vec,
+    /// Constraints on points below `owners.len() + 1`.
+    constraints: Vec,
+    /// Further constraints the agents propose later; only those local to one agent are used.
+    extras: Vec,
+}
+
+impl PlanSpec {
+    /// Builds the plan with the base constraints and the given extra constraints.
+    fn build(&self, extras: &[ConstraintSpec]) -> MultiAgentStn {
+        let mut plan = MultiAgentStn::new(self.agents);
+
+        for &owner in &self.owners {
+            plan.add_time_point(AgentId(owner)).unwrap();
+        }
+
+        for &(from, to, lo, hi) in self.constraints.iter().chain(extras) {
+            plan.add_constraint(TimePoint(from), TimePoint(to), lo.map(Ticks), hi.map(Ticks))
+                .unwrap();
+        }
+
+        plan
+    }
+
+    /// The agent an extra constraint is local to, or `None` if it spans two agents or touches
+    /// only the reference.
+    fn local_agent(&self, (from, to, _, _): ConstraintSpec) -> Option {
+        let owner = |p: usize| p.checked_sub(1).map(|i| self.owners[i]);
+
+        match (owner(from), owner(to)) {
+            (Some(a), Some(b)) if a != b => None,
+            (Some(a), _) | (_, Some(a)) => Some(a),
+            // A plan gives reference-only constraints to every agent; no single agent proposes them.
+            (None, None) => None,
+        }
+    }
+
+    /// The extra constraints local to an agent in `members`, with that agent.
+    fn proposals(&self, members: &[usize]) -> Vec<(usize, ConstraintSpec)> {
+        self.extras
+            .iter()
+            .filter_map(|&c| self.local_agent(c).map(|a| (a, c)))
+            .filter(|(a, _)| members.contains(a))
+            .collect()
+    }
+}
+
+/// Plans with `agents` agents and up to 6 owned points. If `consistent`, every bound contains the
+/// difference of a hidden schedule; otherwise bounds are random and often conflict.
+fn plan(
+    consistent: bool,
+    agents: std::ops::RangeInclusive,
+) -> impl Strategy {
+    (agents, 0usize..=6).prop_flat_map(move |(agents, points)| {
+        let n = points + 1;
+        let owners = proptest::collection::vec(0..agents, points);
+        let schedule = proptest::collection::vec(-40i64..=40, n);
+        let raw = (
+            0..n,
+            0..n,
+            proptest::option::weighted(0.8, -20i64..=20),
+            proptest::option::weighted(0.8, -20i64..=20),
+        );
+        let constraints = proptest::collection::vec(raw.clone(), 0..12);
+        let extras = proptest::collection::vec(raw, 0..4);
+
+        (owners, schedule, constraints, extras).prop_map(
+            move |(owners, schedule, constraints, extras)| {
+                let fit = |(from, to, lo, hi): ConstraintSpec| -> ConstraintSpec {
+                    if !consistent {
+                        return (from, to, lo, hi);
+                    }
+
+                    let time = |p: usize| if p == 0 { 0 } else { schedule[p] };
+                    let diff = time(to) - time(from);
+                    (
+                        from,
+                        to,
+                        lo.map(|l| diff - l.abs()),
+                        hi.map(|h| diff + h.abs()),
+                    )
+                };
+
+                PlanSpec {
+                    agents,
+                    owners,
+                    constraints: constraints.into_iter().map(fit).collect(),
+                    extras: extras.into_iter().map(fit).collect(),
+                }
+            },
+        )
+    })
+}
+
+/// How an agent picks its own schedule from its local network.
+#[derive(Debug, Clone, Copy)]
+enum Policy {
+    /// Every point at the start of its window.
+    Earliest,
+    /// Every point at the end of its window.
+    Latest,
+    /// Every point anywhere in its window, from this seed.
+    Random(u64),
+}
+
+/// Every agent's policy, by agent.
+fn policies() -> impl Strategy> {
+    let policy = prop_oneof![
+        Just(Policy::Earliest),
+        Just(Policy::Latest),
+        any::().prop_map(Policy::Random),
+    ];
+    proptest::collection::vec(policy, 3)
+}
+
+/// Picks a value in `[lo, hi]`; infinite ends are taken 30 ticks beyond the other end.
+fn pick(lo: Option, hi: Option, policy: Policy, state: &mut u64) -> Ticks {
+    let lo = lo.map_or_else(|| hi.map_or(-30, |h| h.0 - 30), |l| l.0);
+    let hi = hi.map_or(lo + 30, |h| h.0);
+
+    Ticks(match policy {
+        Policy::Earliest => lo,
+        Policy::Latest => hi,
+        Policy::Random(_) => {
+            *state = state
+                .wrapping_mul(6_364_136_223_846_793_005)
+                .wrapping_add(1_442_695_040_888_963_407);
+            let span = u64::try_from(hi - lo).unwrap() + 1;
+            lo + i64::try_from((*state >> 33) % span).unwrap()
+        }
+    })
+}
+
+/// One schedule of `agent`'s local network chosen by `policy`, as `(plan point, time)` pairs,
+/// with the reference at zero.
+fn local_schedule(agent: &Agent, policy: Policy) -> Vec<(TimePoint, Ticks)> {
+    let budget = Budget::UNLIMITED;
+    let local = agent.local_network().unwrap();
+    let mut inc = IncrementalStn::new();
+    let mut state = match policy {
+        Policy::Random(seed) => seed,
+        _ => 0,
+    };
+
+    for _ in 0..local.time_point_count() {
+        inc.add_time_point(&budget).unwrap();
+    }
+
+    for c in local.constraints() {
+        let verdict = inc
+            .add_constraint(c.from, c.to, c.lo, c.hi, &budget)
+            .unwrap();
+        assert!(
+            matches!(verdict, Verdict::Consistent(_)),
+            "local network inconsistent"
+        );
+    }
+
+    let z = TimePoint(0);
+    let mut out = Vec::new();
+
+    for p in (1..local.time_point_count()).map(TimePoint) {
+        let t = pick(inc.lower(z, p), inc.upper(z, p), policy, &mut state);
+        let verdict = inc.add_constraint(z, p, Some(t), Some(t), &budget).unwrap();
+        assert!(
+            matches!(verdict, Verdict::Consistent(_)),
+            "window value rejected"
+        );
+        out.push((agent.plan_point(p).unwrap(), t));
+    }
+
+    out
+}
+
+/// Merges every agent's own schedule and checks every constraint of `stn` on the result.
+fn assert_combined_schedule_holds(stn: &Stn, agents: &[Agent], policies: &[Policy]) {
+    let mut times = vec![None; stn.time_point_count()];
+    times[0] = Some(Ticks(0));
+
+    for (agent, &policy) in agents.iter().zip(policies.iter().cycle()) {
+        for (p, t) in local_schedule(agent, policy) {
+            times[p.0] = Some(t);
+        }
+    }
+
+    for c in stn.constraints() {
+        assert_holds(c, ×);
+    }
+}
+
+/// Asserts `lo <= t_to - t_from <= hi` on the merged times.
+fn assert_holds(c: &Constraint, times: &[Option]) {
+    let diff = times[c.to.0].unwrap().0 - times[c.from.0].unwrap().0;
+    assert!(c.lo.is_none_or(|lo| lo.0 <= diff), "{c:?} violated: {diff}");
+    assert!(c.hi.is_none_or(|hi| diff <= hi.0), "{c:?} violated: {diff}");
+}
+
+/// Decouples a plan known to be consistent.
+fn decouple(plan: &MultiAgentStn) -> Vec {
+    match plan.decouple(&Budget::UNLIMITED).unwrap() {
+        Verdict::Consistent(agents) => agents,
+        Verdict::Inconsistent(cycle) => panic!("inconsistent: {cycle:?}"),
+    }
+}
+
+/// Lets every agent in `members` propose its extras, then collects the members' summaries;
+/// `None` if a summary is already inconsistent.
+fn propose_and_summarise(
+    spec: &PlanSpec,
+    agents: &mut [Agent],
+    members: &[usize],
+) -> Option> {
+    for (a, (from, to, lo, hi)) in spec.proposals(members) {
+        agents[a]
+            .propose(TimePoint(from), TimePoint(to), lo.map(Ticks), hi.map(Ticks))
+            .unwrap();
+    }
+
+    let ids: Vec = members.iter().map(|&a| AgentId(a)).collect();
+    members
+        .iter()
+        .map(
+            |&a| match agents[a].summary(&ids, &Budget::UNLIMITED).unwrap() {
+                Verdict::Consistent(summary) => Some(summary),
+                Verdict::Inconsistent(_) => None,
+            },
+        )
+        .collect()
+}
+
+/// The proposed extras of `members`, as plan constraint specs.
+fn proposed(spec: &PlanSpec, members: &[usize]) -> Vec {
+    spec.proposals(members)
+        .into_iter()
+        .map(|(_, c)| c)
+        .collect()
+}
+
+proptest! {
+    /// Decoupling succeeds exactly on consistent plans, and an inconsistent plan is explained.
+    #[test]
+    fn decouple_verdict_matches_central(spec in plan(false, 1..=3)) {
+        let plan = spec.build(&[]);
+        let central = plan.stn().check_consistency(&Budget::UNLIMITED).unwrap();
+        let decoupled = plan.decouple(&Budget::UNLIMITED).unwrap();
+
+        match (central, decoupled) {
+            (Verdict::Consistent(_), Verdict::Consistent(agents)) => prop_assert_eq!(agents.len(), spec.agents),
+            (Verdict::Inconsistent(_), Verdict::Inconsistent(cycle)) => prop_assert!(cycle.weight() < Ticks(0)),
+            (c, d) => prop_assert!(false, "central {c:?}, decoupled {d:?}"),
+        }
+    }
+
+    /// Schedules each agent picks alone from its local network combine into a schedule of
+    /// the plan, however the agents pick.
+    #[test]
+    fn local_schedules_combine(spec in plan(true, 1..=3), policies in policies()) {
+        let plan = spec.build(&[]);
+        let agents = decouple(&plan);
+        assert_combined_schedule_holds(plan.stn(), &agents, &policies);
+    }
+
+    /// With every agent in the group, the summaries decide the consistency of the plan with
+    /// the proposals, as the central check does.
+    #[test]
+    fn distributed_check_matches_central(spec in plan(true, 1..=3)) {
+        let members: Vec = (0..spec.agents).collect();
+        let mut agents = decouple(&spec.build(&[]));
+        let central = spec.build(&proposed(&spec, &members)).stn().check_consistency(&Budget::UNLIMITED).unwrap();
+        let distributed = propose_and_summarise(&spec, &mut agents, &members)
+            .map(|summaries| AgentGroup::new(&summaries).unwrap().check_consistency(&Budget::UNLIMITED).unwrap());
+
+        let consistent = matches!(central, Verdict::Consistent(_));
+        prop_assert_eq!(distributed == Some(GroupVerdict::Consistent), consistent);
+    }
+
+    /// Re-decoupling with every agent gives each agent the view a central decoupling of the
+    /// plan with the proposals gives it.
+    #[test]
+    fn redecouple_all_matches_central(spec in plan(true, 1..=3)) {
+        let members: Vec = (0..spec.agents).collect();
+        let mut agents = decouple(&spec.build(&[]));
+        let Some(summaries) = propose_and_summarise(&spec, &mut agents, &members) else {
+            return Ok(());
+        };
+
+        let group = AgentGroup::new(&summaries).unwrap();
+        let before = agents.clone();
+        let verdicts: Vec = agents
+            .iter_mut()
+            .map(|agent| agent.redecouple(&group, &Budget::UNLIMITED).unwrap())
+            .collect();
+
+        match spec.build(&proposed(&spec, &members)).decouple(&Budget::UNLIMITED).unwrap() {
+            Verdict::Consistent(central) => {
+                for (agent, expected) in agents.iter().zip(¢ral) {
+                    prop_assert!(verdicts.iter().all(|v| *v == GroupVerdict::Consistent));
+                    prop_assert_eq!(agent.cuts(), expected.cuts());
+                    prop_assert_eq!(agent.constraints(), expected.constraints());
+                    prop_assert!(agent.pending().is_empty());
+                }
+            }
+            Verdict::Inconsistent(_) => {
+                for (agent, old) in agents.iter().zip(&before) {
+                    prop_assert!(matches!(verdicts[agent.id().0], GroupVerdict::Inconsistent(_)));
+                    prop_assert_eq!(agent.cuts(), old.cuts());
+                    prop_assert!(agent.pending().is_empty());
+                }
+            }
+        }
+    }
+
+    /// Two of three agents re-decouple alone; the third keeps its cuts, and schedules picked
+    /// alone afterwards still combine into a schedule of the plan with the adopted proposals.
+    #[test]
+    fn partial_redecouple_stays_sound(spec in plan(true, 3..=3), policies in policies()) {
+        let members = [0, 1];
+        let mut agents = decouple(&spec.build(&[]));
+        let Some(summaries) = propose_and_summarise(&spec, &mut agents, &members) else {
+            return Ok(());
+        };
+
+        let group = AgentGroup::new(&summaries).unwrap();
+        let third = agents[2].clone();
+        let mut adopted = true;
+
+        for agent in &mut agents[..2] {
+            adopted &= agent.redecouple(&group, &Budget::UNLIMITED).unwrap() == GroupVerdict::Consistent;
+        }
+
+        prop_assert_eq!(&agents[2], &third);
+        let extras = if adopted { proposed(&spec, &members) } else { Vec::new() };
+        assert_combined_schedule_holds(spec.build(&extras).stn(), &agents, &policies);
+    }
+}
+
+/// Summaries from different groups, a missing member or a stale revision are refused.
+#[test]
+fn mismatched_summaries_refused() {
+    let mut plan = MultiAgentStn::new(2);
+    let z = plan.reference();
+    let a = plan.add_time_point(AgentId(0)).unwrap();
+    let b = plan.add_time_point(AgentId(1)).unwrap();
+    plan.add_constraint(z, a, Some(Ticks(0)), Some(Ticks(10)))
+        .unwrap();
+    plan.add_constraint(a, b, Some(Ticks(1)), Some(Ticks(5)))
+        .unwrap();
+    let mut agents = decouple(&plan);
+
+    let summary = |agent: &Agent, group: &[AgentId]| match agent
+        .summary(group, &Budget::UNLIMITED)
+        .unwrap()
+    {
+        Verdict::Consistent(s) => s,
+        Verdict::Inconsistent(_) => unreachable!("no proposals"),
+    };
+    let both = [AgentId(0), AgentId(1)];
+    let s0 = summary(&agents[0], &both);
+    let s1 = summary(&agents[1], &both);
+    let alone = summary(&agents[1], &[AgentId(1)]);
+
+    assert_eq!(
+        AgentGroup::new(&[]).unwrap_err(),
+        temporal_control::Error::MismatchedSummaries
+    );
+    assert_eq!(
+        AgentGroup::new(std::slice::from_ref(&s0)).unwrap_err(),
+        temporal_control::Error::MismatchedSummaries
+    );
+    assert_eq!(
+        AgentGroup::new(&[s0.clone(), alone]).unwrap_err(),
+        temporal_control::Error::MismatchedSummaries
+    );
+    assert_eq!(
+        AgentGroup::new(&[s0.clone(), s0.clone()]).unwrap_err(),
+        temporal_control::Error::MismatchedSummaries
+    );
+
+    let group = AgentGroup::new(&[s1, s0]).unwrap();
+    agents[0]
+        .add_constraint(z, a, None, Some(Ticks(9)), &Budget::UNLIMITED)
+        .unwrap();
+    assert_eq!(
+        agents[0].redecouple(&group, &Budget::UNLIMITED),
+        Err(temporal_control::Error::MismatchedSummaries)
+    );
+    assert_eq!(
+        agents[1].summary(&[AgentId(0)], &Budget::UNLIMITED),
+        Err(temporal_control::Error::UnknownAgent)
+    );
+}
+
+/// The window of `tp` relative to the reference in `agent`'s local network.
+fn window(agent: &Agent, tp: TimePoint) -> (Option, Option) {
+    let network = agent.local_network().unwrap();
+    let Verdict::Consistent(min) = network.minimal_network(&Budget::UNLIMITED).unwrap() else {
+        panic!("a local network is consistent");
+    };
+    let local = agent.local_point(tp).unwrap();
+    (
+        min.lower(TimePoint(0), local),
+        min.upper(TimePoint(0), local),
+    )
+}
+
+/// Every agent's summary for the group of all agents.
+fn summaries(agents: &[Agent]) -> Vec {
+    let members: Vec = agents.iter().map(Agent::id).collect();
+    agents
+        .iter()
+        .map(
+            |agent| match agent.summary(&members, &Budget::UNLIMITED).unwrap() {
+                Verdict::Consistent(s) => s,
+                Verdict::Inconsistent(_) => panic!("fits the agent alone"),
+            },
+        )
+        .collect()
+}
+
+/// A change inside the cuts is accepted locally; one beyond them is rejected locally, fits the
+/// plan as a proposal, and is adopted by re-decoupling.
+#[test]
+fn proposal_beyond_cuts_adopted_by_redecoupling() {
+    let budget = Budget::UNLIMITED;
+    let mut plan = MultiAgentStn::new(2);
+    let z = plan.reference();
+    let drill = plan.add_time_point(AgentId(0)).unwrap();
+    let image = plan.add_time_point(AgentId(1)).unwrap();
+    plan.add_constraint(z, drill, Some(Ticks(0)), Some(Ticks(100)))
+        .unwrap();
+    plan.add_constraint(z, image, Some(Ticks(0)), Some(Ticks(100)))
+        .unwrap();
+    plan.add_constraint(drill, image, Some(Ticks(10)), None)
+        .unwrap();
+    let mut agents = decouple(&plan);
+
+    // The cut splits the slack: drill <= 45, image >= 55.
+    assert_eq!(window(&agents[0], drill), (Some(Ticks(0)), Some(Ticks(45))));
+    assert_eq!(
+        window(&agents[1], image),
+        (Some(Ticks(55)), Some(Ticks(100)))
+    );
+
+    let inside = agents[0]
+        .add_constraint(z, drill, Some(Ticks(40)), None, &budget)
+        .unwrap();
+    assert_eq!(inside, Verdict::Consistent(()));
+    let beyond = agents[0]
+        .add_constraint(z, drill, Some(Ticks(60)), None, &budget)
+        .unwrap();
+    assert!(matches!(beyond, Verdict::Inconsistent(_)));
+
+    agents[0].propose(z, drill, Some(Ticks(60)), None).unwrap();
+    let group = AgentGroup::new(&summaries(&agents)).unwrap();
+    assert_eq!(
+        group.check_consistency(&budget),
+        Ok(GroupVerdict::Consistent)
+    );
+
+    for agent in &mut agents {
+        assert_eq!(
+            agent.redecouple(&group, &budget),
+            Ok(GroupVerdict::Consistent)
+        );
+    }
+
+    assert_eq!(
+        window(&agents[0], drill),
+        (Some(Ticks(60)), Some(Ticks(75)))
+    );
+    assert_eq!(
+        window(&agents[1], image),
+        (Some(Ticks(85)), Some(Ticks(100)))
+    );
+}
+
+/// A proposal the other agent's plan cannot absorb is named by the group and dropped.
+#[test]
+fn conflicting_proposal_dropped() {
+    let budget = Budget::UNLIMITED;
+    let mut plan = MultiAgentStn::new(2);
+    let z = plan.reference();
+    let drill = plan.add_time_point(AgentId(0)).unwrap();
+    let image = plan.add_time_point(AgentId(1)).unwrap();
+    plan.add_constraint(z, image, None, Some(Ticks(100)))
+        .unwrap();
+    let shared = plan
+        .add_constraint(drill, image, Some(Ticks(10)), None)
+        .unwrap();
+    let mut agents = decouple(&plan);
+
+    agents[0].propose(z, drill, Some(Ticks(95)), None).unwrap();
+    let group = AgentGroup::new(&summaries(&agents)).unwrap();
+
+    let GroupVerdict::Inconsistent(conflict) = group.check_consistency(&budget).unwrap() else {
+        panic!("drill at 95 leaves no room for image by 100");
+    };
+    assert_eq!(conflict.shared, vec![shared]);
+    assert_eq!(conflict.agents, vec![AgentId(0), AgentId(1)]);
+
+    let cuts = agents[0].cuts().to_vec();
+    assert!(matches!(
+        agents[0].redecouple(&group, &budget),
+        Ok(GroupVerdict::Inconsistent(_))
+    ));
+    assert_eq!(agents[0].pending(), &[]);
+    assert_eq!(agents[0].cuts(), cuts.as_slice());
+}

From 15babd5792203539cf4dd6179d6b3a5ebb60fd1f Mon Sep 17 00:00:00 2001
From: Markus Mayer 
Date: Sat, 28 Nov 2026 10:50:09 +0100
Subject: [PATCH 3/8] Show the algorithms in runnable examples

Three examples, each asserting its own results and run as a test
(`test = true`), so CI keeps them working:

- rover_relay: two rovers and an orbiter decouple a plan, execute it
  without talking, absorb a delay locally, rebalance in a relay pass, and
  reject a conflicting proposal naming the shared constraint.
- relay_pass: a lander downlinks through a relay pass with an uncertain
  opening: controllability, the explanation of a deadline that cannot
  hold, the checksummed uplink rejecting a flipped bit, and the heap-free
  u16 dispatcher reacting to each combination of contingent outcomes.
- observation_campaign: a telescope night planned request by request on
  the incremental STN with a named conflict, a 200-field survey checked
  with P3C against Floyd-Warshall, and the filtered dispatchable night.

The README lists them.
---
 Cargo.toml                       |  16 ++
 README.md                        |  21 ++
 examples/observation_campaign.rs | 258 +++++++++++++++++++++++++
 examples/relay_pass.rs           | 226 ++++++++++++++++++++++
 examples/rover_relay.rs          | 322 +++++++++++++++++++++++++++++++
 5 files changed, 843 insertions(+)
 create mode 100644 examples/observation_campaign.rs
 create mode 100644 examples/relay_pass.rs
 create mode 100644 examples/rover_relay.rs

diff --git a/Cargo.toml b/Cargo.toml
index 4ce6f77..9035a5a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -37,6 +37,22 @@ alloc = []
 criterion = { version = "0.8.2", default-features = false, features = ["cargo_bench_support"] }
 proptest = { version = "1.12", default-features = false, features = ["std"] }
 
+# Examples also run as tests (`test = true`), so their assertions are checked in CI.
+[[example]]
+name = "rover_relay"
+required-features = ["alloc"]
+test = true
+
+[[example]]
+name = "relay_pass"
+required-features = ["alloc"]
+test = true
+
+[[example]]
+name = "observation_campaign"
+required-features = ["alloc"]
+test = true
+
 [[bench]]
 name = "dispatch"
 harness = false
diff --git a/README.md b/README.md
index 574a83d..95d9dc9 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,27 @@ Next-tick reaction is supported by transforming the network (`Stnu::with_reactio
 Not yet implemented: differential tests against CSTNU-Tool, and optimal (flexibility-maximising)
 decoupling.
 
+## Examples
+
+Each example asserts its own results and runs as a test (`cargo test --examples`).
+
+- [`rover_relay`](https://github.com/sunsided/temporal-control/blob/main/examples/rover_relay.rs):
+  two rovers and an orbiter decouple a joint plan, execute it without talking, absorb a delay
+  locally, rebalance the slack in a relay pass when a delay does not fit, and reject a
+  conflicting change with the shared constraint it breaks.
+- [`relay_pass`](https://github.com/sunsided/temporal-control/blob/main/examples/relay_pass.rs):
+  a lander downlinks through a relay pass whose opening is uncertain. Dynamic
+  controllability, the explanation of a deadline that cannot hold, the checksummed uplink and
+  the heap-free dispatcher reacting to the actual analysis end and pass opening.
+- [`observation_campaign`](https://github.com/sunsided/temporal-control/blob/main/examples/observation_campaign.rs):
+  a telescope night planned request by request with the incremental STN (a rejected request
+  names the constraints it conflicts with), a 200-field survey checked with P³C instead of
+  the full matrix, and the dispatchable network of the night.
+
+```sh
+cargo run --example rover_relay
+```
+
 ## Cargo features
 
 | Feature | Default | Enables |
diff --git a/examples/observation_campaign.rs b/examples/observation_campaign.rs
new file mode 100644
index 0000000..eca2055
--- /dev/null
+++ b/examples/observation_campaign.rs
@@ -0,0 +1,258 @@
+//! A telescope night planned interactively, then a long survey checked without the full
+//! all-pairs matrix.
+//!
+//! Operators add the constraints of a night one by one; the incremental network keeps every
+//! window current after each one and rejects a request that cannot fit, naming the
+//! constraints it conflicts with. A 200-field survey is then checked with P³C, which only
+//! computes the bounds of constrained pairs, and the night is compiled into a dispatchable
+//! network that a fixed-capacity dispatcher executes.
+//!
+//! Run with `cargo run --example observation_campaign`. Times are minutes after dusk.
+
+use temporal_control::{
+    Budget, ConstraintId, Dispatcher, IncrementalStn, NegativeCycle, Stn, Ticks, TimePoint, Verdict,
+};
+
+/// Number of survey fields.
+const FIELDS: usize = 200;
+
+fn main() {
+    let night = plan_night();
+    survey();
+    dispatch_night(&night);
+}
+
+/// Dusk, the reference of the night.
+const DUSK: usize = 0;
+/// The opening calibration.
+const CALIB: usize = 1;
+/// Target 1 exposure starts.
+const T1_START: usize = 2;
+/// Target 1 exposure ends.
+const T1_END: usize = 3;
+/// Target 2 exposure starts.
+const T2_START: usize = 4;
+/// Target 2 exposure ends.
+const T2_END: usize = 5;
+/// Dawn.
+const DAWN: usize = 6;
+
+/// One operator request: `lo <= t_to - t_from <= hi`, in minutes.
+type Request = (&'static str, usize, usize, Option, Option);
+
+/// The operators' requests, in the order they arrive.
+const REQUESTS: [Request; 9] = [
+    ("night lasts 600 minutes", DUSK, DAWN, Some(600), Some(600)),
+    (
+        "calibrate within 30 minutes of dusk",
+        DUSK,
+        CALIB,
+        Some(0),
+        Some(30),
+    ),
+    (
+        "target 1 after calibration",
+        CALIB,
+        T1_START,
+        Some(10),
+        None,
+    ),
+    (
+        "target 1 exposes 120..180",
+        T1_START,
+        T1_END,
+        Some(120),
+        Some(180),
+    ),
+    ("slew to target 2", T1_END, T2_START, Some(15), None),
+    (
+        "target 2 exposes 200..240",
+        T2_START,
+        T2_END,
+        Some(200),
+        Some(240),
+    ),
+    (
+        "closing calibration before dawn",
+        T2_END,
+        DAWN,
+        Some(30),
+        None,
+    ),
+    (
+        "PI: target 1 after minute 240",
+        DUSK,
+        T1_START,
+        Some(240),
+        None,
+    ),
+    (
+        "PI: target 1 after minute 200",
+        DUSK,
+        T1_START,
+        Some(200),
+        None,
+    ),
+];
+
+/// Adds the night's constraints one at a time and returns the accepted plan.
+fn plan_night() -> Stn {
+    let budget = Budget::UNLIMITED;
+    let mut inc = IncrementalStn::new();
+
+    for _ in 0..=DAWN {
+        inc.add_time_point(&budget).expect("fits");
+    }
+
+    let mut names: Vec<&str> = Vec::new();
+
+    for (name, from, to, lo, hi) in REQUESTS {
+        let verdict = inc
+            .add_constraint(
+                TimePoint(from),
+                TimePoint(to),
+                lo.map(Ticks),
+                hi.map(Ticks),
+                &budget,
+            )
+            .expect("within budget");
+
+        match verdict {
+            Verdict::Consistent(id) => {
+                assert_eq!(id.0, names.len());
+                names.push(name);
+                let (dusk, end) = (TimePoint(DUSK), TimePoint(T2_END));
+                println!(
+                    "accepted {name:<38} target 2 ends in {}",
+                    window(inc.lower(dusk, end), inc.upper(dusk, end))
+                );
+            }
+            Verdict::Inconsistent(cycle) => explain_rejection(name, &cycle, &names),
+        }
+    }
+
+    assert_eq!(
+        inc.lower(TimePoint(DUSK), TimePoint(T1_START)),
+        Some(Ticks(200))
+    );
+    inc.stn().clone()
+}
+
+/// Prints the accepted requests a rejected one conflicts with.
+fn explain_rejection(name: &str, cycle: &NegativeCycle, names: &[&str]) {
+    println!("rejected {name}: conflicts with");
+    let mut ids: Vec = cycle.edges().iter().map(|e| e.constraint).collect();
+    ids.sort_unstable();
+    ids.dedup();
+
+    for id in &ids {
+        // The rejected request gets the next id.
+        println!("  - {}", names.get(id.0).copied().unwrap_or(name));
+    }
+
+    assert!(
+        ids.contains(&ConstraintId(names.len())),
+        "names the request"
+    );
+    assert_eq!(name, "PI: target 1 after minute 240");
+}
+
+/// Formats a window; missing bounds are infinite.
+fn window(lo: Option, hi: Option) -> String {
+    let lo = lo.map_or_else(|| "-inf".into(), |t| t.0.to_string());
+    let hi = hi.map_or_else(|| "inf".into(), |t| t.0.to_string());
+    format!("[{lo}, {hi}]")
+}
+
+/// Checks a long, sparse survey with P³C and compares it with the full minimal network.
+fn survey() {
+    let budget = Budget::UNLIMITED;
+    let mut stn = Stn::new();
+    let points: Vec = (0..=FIELDS)
+        .map(|_| stn.add_time_point().expect("fits"))
+        .collect();
+
+    for pair in points.windows(2) {
+        // Expose and slew to the next field.
+        stn.add_constraint(pair[0], pair[1], Some(Ticks(8)), Some(Ticks(12)))
+            .expect("exists");
+    }
+
+    for i in (0..FIELDS - 25).step_by(25) {
+        // Revisit the standard star: at most 280 minutes per block of 25 fields.
+        stn.add_constraint(points[i], points[i + 25], None, Some(Ticks(280)))
+            .expect("exists");
+    }
+
+    let Verdict::Consistent(sparse) = stn.partial_path_consistency(&budget).expect("fits") else {
+        panic!("the survey is consistent");
+    };
+    let Verdict::Consistent(full) = stn.minimal_network(&budget).expect("fits") else {
+        panic!("the survey is consistent");
+    };
+
+    let pairs: Vec<(TimePoint, TimePoint)> = sparse.pairs().collect();
+
+    for &(a, b) in &pairs {
+        assert_eq!(
+            (sparse.lower(a, b), sparse.upper(a, b)),
+            (full.lower(a, b), full.upper(a, b))
+        );
+    }
+
+    let cells = points.len() * points.len();
+    println!(
+        "\nSurvey of {FIELDS} fields: P³C computed {} pairs, Floyd-Warshall {cells} cells; bounds agree.",
+        pairs.len()
+    );
+    assert!(pairs.len() * 10 < cells);
+
+    let last = points[FIELDS];
+    println!(
+        "  the survey takes {} minutes",
+        window(full.lower(points[0], last), full.upper(points[0], last))
+    );
+}
+
+/// Compiles the night into a dispatchable network and runs it as soon as possible.
+fn dispatch_night(night: &Stn) {
+    let n = night.time_point_count();
+    let Verdict::Consistent(net) = night.dispatchable(&Budget::UNLIMITED).expect("fits") else {
+        panic!("the night is consistent");
+    };
+    println!(
+        "\nNight: {} dispatchable edges instead of {} in the minimal network.",
+        net.edges().len(),
+        n * (n - 1)
+    );
+    assert!(net.edges().len() < n * (n - 1));
+
+    let mut dispatcher: Dispatcher<7, 64> = net.dispatcher().expect("fits");
+    let mut out = [TimePoint(0); 7];
+    let mut t = 0;
+
+    while !dispatcher.is_complete() {
+        dispatcher
+            .step(Ticks(t), &[], &mut out)
+            .expect("dispatchable");
+        t = dispatcher.next_wakeup().map_or(t, |w| w.0.max(t + 1));
+    }
+
+    let times: Vec = (0..n)
+        .map(|i| dispatcher.time(TimePoint(i)).expect("complete").0)
+        .collect();
+    println!("  executed at {times:?}");
+    assert!(night.constraints().iter().all(|c| {
+        let diff = times[c.to.0] - times[c.from.0];
+        c.lo.is_none_or(|lo| lo.0 <= diff) && c.hi.is_none_or(|hi| diff <= hi.0)
+    }));
+}
+
+#[cfg(test)]
+mod tests {
+    /// The example runs to completion; every assertion in it holds.
+    #[test]
+    fn runs() {
+        super::main();
+    }
+}
diff --git a/examples/relay_pass.rs b/examples/relay_pass.rs
new file mode 100644
index 0000000..06403f8
--- /dev/null
+++ b/examples/relay_pass.rs
@@ -0,0 +1,226 @@
+//! A lander downlinks a sample analysis through a relay pass whose time is uncertain.
+//!
+//! Neither the analysis duration nor the pass opening is known in advance: both are
+//! contingent links. The ground checks that the plan is dynamically controllable (it works
+//! however both turn out), sees an explanation when a mission rule makes it fail, compiles the
+//! plan into a dispatchable network, and uplinks it as a checksummed byte string. Onboard, a
+//! fixed-capacity dispatcher without heap allocation loads the bytes in place and executes
+//! the plan tick by tick, reacting to the analysis end and the pass opening as they happen.
+//!
+//! Run with `cargo run --example relay_pass`. Times are minutes after the epoch.
+
+use temporal_control::{
+    Budget, Controllability, DispatchableNetwork, Dispatcher, PointKind, Stnu, Ticks, TimePoint,
+};
+
+/// Point capacity of the onboard dispatcher.
+const POINTS: usize = 6;
+/// Edge-entry capacity of the onboard dispatcher.
+const ENTRIES: usize = 64;
+/// The onboard dispatcher type: fixed capacity, `u16` handles, no heap.
+type Onboard = Dispatcher;
+
+/// The plan's time points, by role.
+struct Points {
+    /// The epoch every other time refers to.
+    epoch: TimePoint,
+    /// The analysis starts.
+    analysis_start: TimePoint,
+    /// The analysis ends (contingent: 20..35 minutes after its start).
+    analysis_end: TimePoint,
+    /// The relay pass opens (contingent: 60..90 minutes after the epoch).
+    pass_open: TimePoint,
+    /// The lander sends the results.
+    send: TimePoint,
+    /// The lander switches the radio heater off.
+    heater_off: TimePoint,
+}
+
+fn main() {
+    let budget = Budget::UNLIMITED;
+    let (stnu, p) = build_plan();
+
+    let net = match stnu.dispatchable(&budget).expect("small plan") {
+        Controllability::Controllable(net) => net,
+        Controllability::Uncontrollable(cycle) => panic!("not controllable: {cycle:?}"),
+    };
+    println!(
+        "Controllable: {} edges and {} waits to uplink.",
+        net.edges().len(),
+        net.waits().len()
+    );
+
+    explain_tight_deadline(&stnu, &p);
+
+    let bytes = net.encode().expect("small network");
+    println!("Uplink: {} bytes, CRC-32 checked.", bytes.len());
+    assert_eq!(DispatchableNetwork::decode(&bytes).as_ref(), Ok(&net));
+
+    for (analysis, open) in [(20, 60), (35, 60), (20, 90), (35, 90), (28, 75)] {
+        let mut onboard = Onboard::EMPTY;
+        onboard.load_encoded(&bytes).expect("valid uplink");
+        reject_corrupted_uplink(&mut onboard, &bytes);
+
+        let times = execute(&mut onboard, &net, &p, analysis, open);
+        check(×, &p, open);
+        println!(
+            "  analysis {analysis:>2} min, pass opens at {open:>2}: sent at {:>3}, heater off at {:>3}",
+            times[p.send.0].0, times[p.heater_off.0].0
+        );
+    }
+}
+
+/// Builds the lander plan as an STNU.
+fn build_plan() -> (Stnu, Points) {
+    let mut stnu = Stnu::new();
+    let epoch = stnu.add_time_point().expect("fits");
+    let analysis_start = stnu.add_time_point().expect("fits");
+    let analysis_end = stnu
+        .add_contingent_link(analysis_start, Ticks(20), Ticks(35))
+        .expect("valid link");
+    // The communication window: its opening is a contingent point of the epoch.
+    let pass_open = stnu
+        .add_contingent_link(epoch, Ticks(60), Ticks(90))
+        .expect("valid link");
+    let send = stnu.add_time_point().expect("fits");
+    let heater_off = stnu.add_time_point().expect("fits");
+    let p = Points {
+        epoch,
+        analysis_start,
+        analysis_end,
+        pass_open,
+        send,
+        heater_off,
+    };
+
+    let requirements = [
+        (p.epoch, p.analysis_start, Some(0), Some(10)),
+        // Package the results first.
+        (p.analysis_end, p.send, Some(2), None),
+        // Send while the pass lasts: 12 minutes after it opens.
+        (p.pass_open, p.send, Some(0), Some(12)),
+        (p.send, p.heater_off, Some(1), Some(5)),
+    ];
+
+    for (from, to, lo, hi) in requirements {
+        stnu.add_constraint(from, to, lo.map(Ticks), hi.map(Ticks))
+            .expect("exists");
+    }
+
+    (stnu, p)
+}
+
+/// A mission rule "results down by minute 80" fails when the pass opens late, and the
+/// explanation names the pass's contingent link.
+fn explain_tight_deadline(stnu: &Stnu, p: &Points) {
+    let mut tight = stnu.clone();
+    tight
+        .add_constraint(p.epoch, p.send, None, Some(Ticks(80)))
+        .expect("exists");
+
+    let verdict = tight
+        .check_controllability(&Budget::UNLIMITED)
+        .expect("small plan");
+    let Controllability::Uncontrollable(cycle) = verdict else {
+        panic!("a pass opening at 90 misses the deadline at 80");
+    };
+
+    let links = cycle.contingent_links();
+    let pass_link = tight
+        .links()
+        .iter()
+        .position(|l| l.contingent == p.pass_open)
+        .expect("pass link");
+    println!(
+        "With 'send by minute 80': not controllable; cycle of weight {} through contingent links {links:?}.",
+        cycle.weight().0
+    );
+    assert!(links.iter().any(|l| l.0 == pass_link));
+}
+
+/// Loading corrupted bytes fails and leaves the loaded plan as it was.
+fn reject_corrupted_uplink(onboard: &mut Onboard, bytes: &[u8]) {
+    let before = onboard.window(TimePoint(0));
+    let mut corrupted = bytes.to_vec();
+    corrupted[bytes.len() / 2] ^= 0x10;
+
+    assert!(onboard.load_encoded(&corrupted).is_err());
+    assert_eq!(onboard.window(TimePoint(0)), before);
+}
+
+/// Runs the dispatcher tick by tick with the given contingent durations.
+///
+/// Returns the time of every point.
+fn execute(
+    onboard: &mut Onboard,
+    net: &DispatchableNetwork,
+    p: &Points,
+    analysis: i64,
+    open: i64,
+) -> Vec {
+    let duration = |c: TimePoint| if c == p.analysis_end { analysis } else { open };
+    let mut due: Vec> = vec![None; net.points().len()];
+    let mut out = [TimePoint(0); POINTS];
+
+    for t in 0..=200 {
+        let observed: Vec = (0..due.len())
+            .filter(|&c| due[c] == Some(t))
+            .map(TimePoint)
+            .collect();
+        let executed = onboard
+            .step(Ticks(t), &observed, &mut out)
+            .expect("a dispatchable network never fails");
+
+        for &started in out[..executed].iter().chain(&observed) {
+            start_contingents(net, started, t, duration, &mut due);
+        }
+
+        if onboard.is_complete() {
+            return (0..net.points().len())
+                .map(|i| onboard.time(TimePoint(i)).expect("complete"))
+                .collect();
+        }
+    }
+
+    panic!("the plan did not complete");
+}
+
+/// Schedules nature's contingent points that `started` activates at `t`.
+fn start_contingents(
+    net: &DispatchableNetwork,
+    started: TimePoint,
+    t: i64,
+    duration: impl Fn(TimePoint) -> i64,
+    due: &mut [Option],
+) {
+    for (c, kind) in net.points().iter().enumerate() {
+        if matches!(*kind, PointKind::Contingent { activation, .. } if activation == started) {
+            due[c] = Some(t + duration(TimePoint(c)));
+        }
+    }
+}
+
+/// Checks the requirements on the executed times.
+fn check(times: &[Ticks], p: &Points, open: i64) {
+    let at = |tp: TimePoint| times[tp.0].0;
+
+    assert!(
+        open <= at(p.send) && at(p.send) <= open + 12,
+        "sent outside the pass"
+    );
+    assert!(
+        at(p.analysis_end) + 2 <= at(p.send),
+        "sent before packaging"
+    );
+    assert!((1..=5).contains(&(at(p.heater_off) - at(p.send))));
+    assert!((0..=10).contains(&(at(p.analysis_start) - at(p.epoch))));
+}
+
+#[cfg(test)]
+mod tests {
+    /// The example runs to completion; every assertion in it holds.
+    #[test]
+    fn runs() {
+        super::main();
+    }
+}
diff --git a/examples/rover_relay.rs b/examples/rover_relay.rs
new file mode 100644
index 0000000..7a94646
--- /dev/null
+++ b/examples/rover_relay.rs
@@ -0,0 +1,322 @@
+//! Two rovers and an orbiter share one plan but rarely talk to each other.
+//!
+//! Rover A drives and drills, rover B images the drill site while the dust settles, and both
+//! hand their data to an orbiter during its relay pass. The ground decouples the plan once;
+//! each vehicle then executes, and absorbs small changes, without asking anybody. A change
+//! beyond its decoupled window waits for the next communication window, where the vehicles
+//! exchange summaries, check the change together and redistribute the slack, still without a
+//! central solver.
+//!
+//! Run with `cargo run --example rover_relay`. Times are minutes after the start of the sol.
+
+use temporal_control::{
+    Agent, AgentGroup, AgentId, Budget, GroupVerdict, MultiAgentStn, Stn, Summary, Ticks,
+    TimePoint, Verdict,
+};
+
+/// Rover A: drives, drills, sends its sample data.
+const ROVER_A: AgentId = AgentId(0);
+/// Rover B: images the drill site, sends the images.
+const ROVER_B: AgentId = AgentId(1);
+/// The orbiter: points its relay antenna at the site for one pass.
+const ORBITER: AgentId = AgentId(2);
+
+/// The plan's time points, by role.
+struct Points {
+    /// Rover A arrives at the drill site.
+    drive_end: TimePoint,
+    /// Rover A starts drilling.
+    drill_start: TimePoint,
+    /// Rover A stops drilling; the dust starts to settle.
+    drill_end: TimePoint,
+    /// Rover A sends its data to the orbiter.
+    a_send: TimePoint,
+    /// Rover B images the drill site.
+    image: TimePoint,
+    /// Rover B sends its images to the orbiter.
+    b_send: TimePoint,
+    /// The orbiter's relay pass starts.
+    pass: TimePoint,
+}
+
+fn main() {
+    let budget = Budget::UNLIMITED;
+    let (plan, p) = build_plan();
+
+    let Verdict::Consistent(mut agents) = plan.decouple(&budget).expect("small plan") else {
+        panic!("the plan is consistent");
+    };
+
+    println!("Decoupled windows (minutes after sol start):");
+    print_windows(&agents, &p);
+    report_flexibility(&plan, &agents);
+
+    println!("\nEach vehicle executes alone: rover A as early as it can, the others late.");
+    execute_independently(&plan, &agents);
+
+    println!("\nRover A runs late.");
+    absorb_locally(&mut agents[ROVER_A.0], &p);
+
+    println!("\nRelay pass: the vehicles exchange summaries.");
+    redecouple_with_proposal(&mut agents, &p);
+    print_windows(&agents, &p);
+
+    let mut grown = plan.clone();
+    let z = grown.reference();
+    grown
+        .add_constraint(p.drill_start, p.drill_end, Some(Ticks(30)), None)
+        .expect("exists");
+    grown
+        .add_constraint(z, p.drill_start, Some(Ticks(80)), None)
+        .expect("exists");
+    execute_independently(&grown, &agents);
+
+    println!("\nRover B proposes imaging before the drill can be done.");
+    reject_conflicting_proposal(&mut agents, &p);
+}
+
+/// Builds the joint plan of all three vehicles.
+fn build_plan() -> (MultiAgentStn, Points) {
+    let mut plan = MultiAgentStn::new(3);
+    let z = plan.reference();
+    let mut point = |agent| plan.add_time_point(agent).expect("known agent");
+    let p = Points {
+        drive_end: point(ROVER_A),
+        drill_start: point(ROVER_A),
+        drill_end: point(ROVER_A),
+        a_send: point(ROVER_A),
+        image: point(ROVER_B),
+        b_send: point(ROVER_B),
+        pass: point(ORBITER),
+    };
+
+    let constraints = [
+        // Rover A: drive, drill, compress the data.
+        (z, p.drive_end, Some(30), Some(60)),
+        (p.drive_end, p.drill_start, Some(5), Some(30)),
+        (p.drill_start, p.drill_end, Some(20), Some(40)),
+        (p.drill_end, p.a_send, Some(5), None),
+        // Rover B: image during daylight, then compress.
+        (z, p.image, Some(0), Some(240)),
+        (p.image, p.b_send, Some(5), None),
+        // The orbiter's pass geometry.
+        (z, p.pass, Some(150), Some(200)),
+        // Shared: image once the dust settled, before the shadows move.
+        (p.drill_end, p.image, Some(15), Some(45)),
+        // Shared: rover A's relay slot, then rover B's.
+        (p.pass, p.a_send, Some(0), Some(10)),
+        (p.pass, p.b_send, Some(10), Some(20)),
+    ];
+
+    for (from, to, lo, hi) in constraints {
+        plan.add_constraint(from, to, lo.map(Ticks), hi.map(Ticks))
+            .expect("exists");
+    }
+
+    (plan, p)
+}
+
+/// The window `(earliest, latest)` of `tp` in `agent`'s local network.
+fn window(agent: &Agent, tp: TimePoint) -> (Option, Option) {
+    let local = agent.local_network().expect("fits");
+    let Verdict::Consistent(min) = local.minimal_network(&Budget::UNLIMITED).expect("fits") else {
+        panic!("a local network is always consistent");
+    };
+    let z = TimePoint(0);
+    let tp = agent.local_point(tp).expect("own point");
+    (min.lower(z, tp), min.upper(z, tp))
+}
+
+/// Prints every vehicle's window for each of its points.
+fn print_windows(agents: &[Agent], p: &Points) {
+    let named = [
+        (ROVER_A, "drive end", p.drive_end),
+        (ROVER_A, "drill start", p.drill_start),
+        (ROVER_A, "drill end", p.drill_end),
+        (ROVER_A, "A send", p.a_send),
+        (ROVER_B, "image", p.image),
+        (ROVER_B, "B send", p.b_send),
+        (ORBITER, "pass start", p.pass),
+    ];
+
+    for (agent, name, tp) in named {
+        let (lo, hi) = window(&agents[agent.0], tp);
+        println!("  {name:<12} [{:>4}, {:>4}]", show(lo), show(hi));
+    }
+}
+
+/// Formats an optional bound.
+fn show(t: Option) -> String {
+    t.map_or_else(|| "inf".into(), |t| t.0.to_string())
+}
+
+/// Compares the flexibility the agents keep with that of the undivided plan.
+///
+/// Flexibility is the sum of the window widths of all points. The undivided plan's windows
+/// cannot all be used at once (choosing one point narrows the others); the decoupled ones can.
+fn report_flexibility(plan: &MultiAgentStn, agents: &[Agent]) {
+    let Verdict::Consistent(min) = plan
+        .stn()
+        .minimal_network(&Budget::UNLIMITED)
+        .expect("fits")
+    else {
+        panic!("consistent");
+    };
+    let z = plan.reference();
+    let width = |(lo, hi): (Option, Option)| hi.zip(lo).map_or(0, |(h, l)| h.0 - l.0);
+
+    let joint: i64 = (1..plan.stn().time_point_count())
+        .map(|i| width((min.lower(z, TimePoint(i)), min.upper(z, TimePoint(i)))))
+        .sum();
+    let kept: i64 = agents
+        .iter()
+        .flat_map(|agent| {
+            agent
+                .points()
+                .iter()
+                .map(move |&tp| width(window(agent, tp)))
+        })
+        .sum();
+
+    println!("Flexibility: {kept} of {joint} window-minutes, usable independently.");
+    assert!(0 < kept && kept <= joint);
+}
+
+/// Lets every vehicle fix its own times alone and checks the combination against `plan`.
+fn execute_independently(plan: &MultiAgentStn, agents: &[Agent]) {
+    let mut times = vec![Ticks(0); plan.stn().time_point_count()];
+
+    for agent in agents {
+        let earliest = agent.id() == ROVER_A;
+
+        for &tp in agent.points() {
+            // The earliest (or latest) end of every window together is a schedule of an STN.
+            let (lo, hi) = window(agent, tp);
+            times[tp.0] = if earliest { lo } else { hi }.expect("bounded window");
+        }
+    }
+
+    assert!(satisfies(plan.stn(), ×), "decoupling is unsound");
+    let shown: Vec = times[1..].iter().map(|t| t.0).collect();
+    println!("  times {shown:?}: every constraint of the plan holds");
+}
+
+/// Whether `times` satisfies every constraint of `stn`.
+fn satisfies(stn: &Stn, times: &[Ticks]) -> bool {
+    stn.constraints().iter().all(|c| {
+        let diff = times[c.to.0].0 - times[c.from.0].0;
+        c.lo.is_none_or(|lo| lo.0 <= diff) && c.hi.is_none_or(|hi| diff <= hi.0)
+    })
+}
+
+/// Rover A absorbs a slower drill inside its window, but not a late drill start.
+fn absorb_locally(rover: &mut Agent, p: &Points) {
+    let budget = Budget::UNLIMITED;
+    let z = TimePoint(0);
+    let slower = rover
+        .add_constraint(p.drill_start, p.drill_end, Some(Ticks(30)), None, &budget)
+        .expect("own points");
+    println!("  drilling takes 30+ minutes:      {}", verdict(&slower));
+    assert_eq!(slower, Verdict::Consistent(()));
+
+    let late = rover
+        .add_constraint(z, p.drill_start, Some(Ticks(80)), None, &budget)
+        .expect("own points");
+    println!("  drilling starts after minute 80: {}", verdict(&late));
+    assert!(matches!(late, Verdict::Inconsistent(_)));
+
+    rover
+        .propose(z, p.drill_start, Some(Ticks(80)), None)
+        .expect("own point");
+    println!("  proposed for the next relay pass");
+}
+
+/// Describes a local verdict.
+fn verdict(v: &Verdict<()>) -> &'static str {
+    match v {
+        Verdict::Consistent(()) => "accepted locally, nobody asked",
+        Verdict::Inconsistent(_) => "beyond the decoupled window",
+    }
+}
+
+/// Every vehicle summarises itself for the whole group.
+fn summaries(agents: &[Agent]) -> Vec {
+    let group = [ROVER_A, ROVER_B, ORBITER];
+    agents
+        .iter()
+        .map(
+            |agent| match agent.summary(&group, &Budget::UNLIMITED).expect("fits") {
+                Verdict::Consistent(summary) => summary,
+                Verdict::Inconsistent(_) => panic!("proposals fit each vehicle alone"),
+            },
+        )
+        .collect()
+}
+
+/// The group accepts rover A's proposal and every vehicle adopts the new cuts.
+fn redecouple_with_proposal(agents: &mut [Agent], p: &Points) {
+    let budget = Budget::UNLIMITED;
+    let summaries = summaries(agents);
+    let shared: usize = summaries.iter().map(|s| s.bounds().len()).sum();
+    println!("  {} summaries, {shared} bounds in total", summaries.len());
+
+    // Every vehicle builds the same group from the same messages.
+    let group = AgentGroup::new(&summaries).expect("complete set");
+    assert_eq!(
+        group.check_consistency(&budget),
+        Ok(GroupVerdict::Consistent)
+    );
+
+    for agent in agents.iter_mut() {
+        assert_eq!(
+            agent.redecouple(&group, &budget),
+            Ok(GroupVerdict::Consistent)
+        );
+    }
+
+    let rover = &agents[ROVER_A.0];
+    assert_eq!(rover.pending(), &[]);
+    let (lo, _) = window(rover, p.drill_end);
+    println!("  adopted; drill end now from minute {}", show(lo));
+}
+
+/// The group rejects a proposal that conflicts with the other rover's plan.
+fn reject_conflicting_proposal(agents: &mut [Agent], p: &Points) {
+    let budget = Budget::UNLIMITED;
+    let z = TimePoint(0);
+    agents[ROVER_B.0]
+        .propose(z, p.image, None, Some(Ticks(70)))
+        .expect("own point");
+
+    let group = AgentGroup::new(&summaries(agents)).expect("complete set");
+    let GroupVerdict::Inconsistent(conflict) = group.check_consistency(&budget).expect("fits")
+    else {
+        panic!("the drill cannot end before minute 55");
+    };
+    println!(
+        "  conflict: shared constraints {:?}, plans of agents {:?}",
+        conflict.shared, conflict.agents
+    );
+    assert!(conflict.agents.contains(&ROVER_A) && conflict.agents.contains(&ROVER_B));
+
+    let cuts = agents[ROVER_B.0].cuts().to_vec();
+    for agent in agents.iter_mut() {
+        assert!(matches!(
+            agent.redecouple(&group, &budget),
+            Ok(GroupVerdict::Inconsistent(_))
+        ));
+    }
+
+    assert_eq!(agents[ROVER_B.0].pending(), &[]);
+    assert_eq!(agents[ROVER_B.0].cuts(), cuts.as_slice());
+    println!("  proposal dropped; every vehicle keeps its cuts");
+}
+
+#[cfg(test)]
+mod tests {
+    /// The example runs to completion; every assertion in it holds.
+    #[test]
+    fn runs() {
+        super::main();
+    }
+}

From 9aec33d9c8db507165e20ab02b9f6beb753fcfe7 Mon Sep 17 00:00:00 2001
From: Markus Mayer 
Date: Sat, 28 Nov 2026 10:57:39 +0100
Subject: [PATCH 4/8] Move agents and summaries between processes as plain data

An agent lives on its own vehicle and a summary travels over a radio
link, but both could only be built inside this crate. `AgentParts` with
`Agent::from_parts` / `Agent::into_parts`, and `Summary::from_parts`,
rebuild them from plain data and validate the structure (sorted points
without the reference, constraints and cuts on own points, shared
constraints that involve the agent); `Agent::from_parts` also checks the
local network and explains an inconsistency. The wire format stays the
integrator's.

The docs now spell out the rest of the re-decoupling protocol: no member
may change between sending its summary and adopting, a single refusal
returns every member to its old cuts (a clone is the rollback), and
points that already happened are pinned as local constraints before
summarising. The rover example uplinks each part through `AgentParts`,
and its re-decoupling happens at a contact before the sol starts, when
nothing has executed yet.
---
 README.md               |   2 +-
 docs/design.md          |  12 ++--
 examples/rover_relay.rs |  45 +++++++++----
 src/lib.rs              |   4 +-
 src/multiagent.rs       |  17 +++--
 src/multiagent/agent.rs | 146 +++++++++++++++++++++++++++++++++++++++-
 src/multiagent/group.rs |  56 +++++++++++++++
 tests/it/multiagent.rs  | 114 +++++++++++++++++++++++++++++++
 8 files changed, 371 insertions(+), 25 deletions(-)

diff --git a/README.md b/README.md
index 95d9dc9..446e2e4 100644
--- a/README.md
+++ b/README.md
@@ -98,7 +98,7 @@ Each example asserts its own results and runs as a test (`cargo test --examples`
 
 - [`rover_relay`](https://github.com/sunsided/temporal-control/blob/main/examples/rover_relay.rs):
   two rovers and an orbiter decouple a joint plan, execute it without talking, absorb a delay
-  locally, rebalance the slack in a relay pass when a delay does not fit, and reject a
+  locally, rebalance the slack at the next contact when a delay does not fit, and reject a
   conflicting change with the shared constraint it breaks.
 - [`relay_pass`](https://github.com/sunsided/temporal-control/blob/main/examples/relay_pass.rs):
   a lander downlinks through a relay pass whose opening is uncertain. Dynamic
diff --git a/docs/design.md b/docs/design.md
index eb0f6d3..af5356b 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -225,8 +225,8 @@ infinite side is replaced by the other, and `0` is used if both are infinite. An
 `[L(v) - w, U(u)]` keeps the network consistent (proof in the module docs), and both
 operands lie in that interval. If the edge still has slack, the midpoint splits it evenly;
 if the windows already imply it, the midpoint tightens neither window. The choice is a
-greedy heuristic: it does not maximise the total flexibility (an optimal decoupling needs a
-linear program), and the order of the shared constraints matters.
+greedy heuristic: it does not maximise the total flexibility (an optimal decoupling can be
+posed as a linear program), and the order of the shared constraints matters.
 
 **Summaries.** For a group `G` of agents, agent `a` summarises its local network, plus its
 proposals, with the cuts of shared constraints towards members of `G` removed: the minimal
@@ -247,7 +247,11 @@ the new ones; cuts towards non-members stay, and they are part of every member's
 On a positive verdict proposals become local constraints; on a negative one they are
 dropped and the cuts stay. The result stays a decoupling only if all members switch: the
 protocol must ensure every member holds the full set of summaries before any member applies
-them. A summary carries the agent's revision, and an agent refuses a group whose summary of
+them, that no member changes between sending its summary and adopting, and that a single
+refusal returns every member to its old cuts. Points that already happened are pinned as
+local constraints (`z -> t` in `[t, t]`) before summarising, so new cuts respect the past.
+Agents and summaries cross process boundaries as plain data (`AgentParts`,
+`Summary::from_parts`, both validated); the wire format is left to the integrator. A summary carries the agent's revision, and an agent refuses a group whose summary of
 it is older than its current state.
 
 **Communication windows.** A communication opportunity whose time is uncertain is a
@@ -506,7 +510,7 @@ harness in one process.
 - A deterministic simulator with injected durations, resets and overruns.
 - Adapters: F Prime (WebAssembly sequencing) and cFS demonstrators, in separate crates.
 - Multi-agent: an optimal (flexibility-maximising) decoupling, decoupling of STNUs with
-  contingent links across agents, a wire encoding for summaries, the acknowledgement round
+  contingent links across agents, a wire encoding for agents and summaries, the acknowledgement round
   that makes re-decoupling all-or-none, and a fuzz target for the group operations.
 
 ## 10. Cross-crate needs
diff --git a/examples/rover_relay.rs b/examples/rover_relay.rs
index 7a94646..9ac0417 100644
--- a/examples/rover_relay.rs
+++ b/examples/rover_relay.rs
@@ -1,17 +1,18 @@
 //! Two rovers and an orbiter share one plan but rarely talk to each other.
 //!
 //! Rover A drives and drills, rover B images the drill site while the dust settles, and both
-//! hand their data to an orbiter during its relay pass. The ground decouples the plan once;
-//! each vehicle then executes, and absorbs small changes, without asking anybody. A change
-//! beyond its decoupled window waits for the next communication window, where the vehicles
-//! exchange summaries, check the change together and redistribute the slack, still without a
-//! central solver.
+//! hand their data to an orbiter during its relay pass. The ground decouples the plan once and
+//! uplinks each vehicle its part; each vehicle then executes, and absorbs small changes,
+//! without asking anybody. A change beyond its decoupled window waits for the next contact
+//! between the vehicles (here a short UHF contact before the sol starts), where they exchange
+//! summaries, check the change together and redistribute the slack, still without a central
+//! solver.
 //!
 //! Run with `cargo run --example rover_relay`. Times are minutes after the start of the sol.
 
 use temporal_control::{
-    Agent, AgentGroup, AgentId, Budget, GroupVerdict, MultiAgentStn, Stn, Summary, Ticks,
-    TimePoint, Verdict,
+    Agent, AgentGroup, AgentId, AgentParts, Budget, GroupVerdict, MultiAgentStn, Stn, Summary,
+    Ticks, TimePoint, Verdict,
 };
 
 /// Rover A: drives, drills, sends its sample data.
@@ -43,21 +44,24 @@ fn main() {
     let budget = Budget::UNLIMITED;
     let (plan, p) = build_plan();
 
-    let Verdict::Consistent(mut agents) = plan.decouple(&budget).expect("small plan") else {
+    let Verdict::Consistent(decoupled) = plan.decouple(&budget).expect("small plan") else {
         panic!("the plan is consistent");
     };
+    let mut agents = uplink(decoupled);
 
     println!("Decoupled windows (minutes after sol start):");
     print_windows(&agents, &p);
     report_flexibility(&plan, &agents);
 
-    println!("\nEach vehicle executes alone: rover A as early as it can, the others late.");
+    println!("\nIf each vehicle executed alone: rover A as early as it can, the others late.");
     execute_independently(&plan, &agents);
 
-    println!("\nRover A runs late.");
+    println!("\nBefore the sol starts, rover A's arm check delays drilling.");
     absorb_locally(&mut agents[ROVER_A.0], &p);
 
-    println!("\nRelay pass: the vehicles exchange summaries.");
+    println!(
+        "\nContact before the sol starts (nothing has executed): the vehicles exchange summaries."
+    );
     redecouple_with_proposal(&mut agents, &p);
     print_windows(&agents, &p);
 
@@ -75,6 +79,23 @@ fn main() {
     reject_conflicting_proposal(&mut agents, &p);
 }
 
+/// Sends every vehicle its part as plain data and rebuilds it there.
+///
+/// The fields of [`AgentParts`] are what a wire format would carry; the vehicle validates
+/// them and checks its local network on arrival.
+fn uplink(agents: Vec) -> Vec {
+    agents
+        .into_iter()
+        .map(|agent| {
+            let parts: AgentParts = agent.into_parts();
+            match Agent::from_parts(parts, &Budget::UNLIMITED).expect("well formed") {
+                Verdict::Consistent(agent) => agent,
+                Verdict::Inconsistent(_) => panic!("a decoupled part is consistent"),
+            }
+        })
+        .collect()
+}
+
 /// Builds the joint plan of all three vehicles.
 fn build_plan() -> (MultiAgentStn, Points) {
     let mut plan = MultiAgentStn::new(3);
@@ -228,7 +249,7 @@ fn absorb_locally(rover: &mut Agent, p: &Points) {
     rover
         .propose(z, p.drill_start, Some(Ticks(80)), None)
         .expect("own point");
-    println!("  proposed for the next relay pass");
+    println!("  proposed for the next contact");
 }
 
 /// Describes a local verdict.
diff --git a/src/lib.rs b/src/lib.rs
index 43e9566..7390c74 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -76,8 +76,8 @@ pub use dispatch::{
 pub use error::Error;
 #[cfg(feature = "alloc")]
 pub use multiagent::{
-    Agent, AgentGroup, AgentId, Cut, GroupConflict, GroupVerdict, MultiAgentStn, SharedConstraint,
-    Summary,
+    Agent, AgentGroup, AgentId, AgentParts, Cut, GroupConflict, GroupVerdict, MultiAgentStn,
+    SharedConstraint, Summary,
 };
 #[cfg(feature = "alloc")]
 pub use stn::{
diff --git a/src/multiagent.rs b/src/multiagent.rs
index fe28c01..7539c6f 100644
--- a/src/multiagent.rs
+++ b/src/multiagent.rs
@@ -21,8 +21,8 @@
 //! `max(lower(u), lower(v) - w)` and `min(upper(u), upper(v) - w)`, so the slack the edge
 //! still has is split evenly between both sides. Each choice keeps the network consistent, so
 //! decoupling succeeds whenever the plan is consistent. It is a heuristic: it does not
-//! maximise the total flexibility left to the agents (an optimal decoupling needs a linear
-//! program).
+//! maximise the total flexibility left to the agents (an optimal decoupling can be posed as
+//! a linear program).
 //!
 //! # Distributed checking and re-decoupling
 //!
@@ -58,8 +58,15 @@
 //! **Protocol requirement.** Re-decoupling is safe only if every member of the group adopts
 //! its new cuts, and none keeps the old ones. Exchange the summaries, make sure every member
 //! holds the full set (for example with an acknowledgement round), and only then call
-//! [`Agent::redecouple`] on each member. A member that missed the exchange keeps its old cuts,
-//! and then every other member must keep theirs too.
+//! [`Agent::redecouple`] on each member. No member may change between sending its summary and
+//! adopting (it would refuse the group as stale). If any member misses the exchange or
+//! refuses the group, every member stays on, or returns to, its old cuts; keep a clone of each
+//! agent until all have adopted. Points that already happened must be pinned as local
+//! constraints before summarising.
+//!
+//! Agents and summaries move between processes as plain data: [`AgentParts`] with
+//! [`Agent::from_parts`], and [`Summary::from_parts`]. The wire format is the
+//! integrator's.
 //!
 //! # Communication windows
 //!
@@ -97,7 +104,7 @@ mod group;
 
 use alloc::vec::Vec;
 
-pub use agent::Agent;
+pub use agent::{Agent, AgentParts};
 pub use group::{AgentGroup, GroupConflict, GroupVerdict, Summary};
 
 use crate::stn::{Bound, Constraint, ConstraintId, Stn, Verdict};
diff --git a/src/multiagent/agent.rs b/src/multiagent/agent.rs
index 205e4b1..33269e9 100644
--- a/src/multiagent/agent.rs
+++ b/src/multiagent/agent.rs
@@ -33,7 +33,143 @@ pub struct Agent {
     revision: u64,
 }
 
+/// The stored state of an [`Agent`], as plain data, for moving an agent between processes.
+///
+/// The ground decouples a plan and sends each agent its part; the agent's own computer
+/// rebuilds it with [`Agent::from_parts`]. Every field mirrors the accessor of the same name.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct AgentParts {
+    /// The agent's handle.
+    pub id: AgentId,
+    /// The points it owns, sorted ascending, without the reference.
+    pub points: Vec,
+    /// Its local constraints, among the reference and `points`.
+    pub constraints: Vec,
+    /// Its proposed constraints, among the same points.
+    pub pending: Vec,
+    /// The shared constraints with one of its points, sorted by id.
+    pub shared: Vec,
+    /// The cuts on its points, each of a constraint in `shared`.
+    pub cuts: Vec,
+    /// Its revision.
+    pub revision: u64,
+}
+
 impl Agent {
+    /// Rebuilds an agent from its parts, as received from the ground or another process.
+    ///
+    /// Checks the structure, then that the local network is consistent; a negative verdict
+    /// explains the inconsistency over the constraints of [`Self::local_network`].
+    ///
+    /// # Errors
+    ///
+    /// - [`Error::UnknownTimePoint`] if `points` is not sorted without duplicates or contains
+    ///   the reference, or a constraint, proposal, shared constraint or cut names a point the
+    ///   agent does not own.
+    /// - [`Error::UnknownAgent`] if a shared constraint does not involve the agent, `shared` is
+    ///   not sorted by id without duplicates, or a cut refers to a constraint not in `shared`.
+    /// - [`Error::Overflow`] if a lower bound is `i64::MIN`; otherwise any error of
+    ///   [`Stn::check_consistency`].
+    pub fn from_parts(parts: AgentParts, budget: &Budget) -> Result, Error> {
+        let agent = Self {
+            id: parts.id,
+            points: parts.points,
+            constraints: parts.constraints,
+            pending: parts.pending,
+            shared: parts.shared,
+            cuts: parts.cuts,
+            revision: parts.revision,
+        };
+        agent.validate()?;
+
+        Ok(match agent.local_network()?.check_consistency(budget)? {
+            Verdict::Consistent(_) => Verdict::Consistent(agent),
+            Verdict::Inconsistent(cycle) => Verdict::Inconsistent(cycle),
+        })
+    }
+
+    /// The stored state as plain data; the inverse of [`Self::from_parts`].
+    #[must_use]
+    pub fn into_parts(self) -> AgentParts {
+        AgentParts {
+            id: self.id,
+            points: self.points,
+            constraints: self.constraints,
+            pending: self.pending,
+            shared: self.shared,
+            cuts: self.cuts,
+            revision: self.revision,
+        }
+    }
+
+    /// Checks the structural invariants [`Self::from_parts`] documents.
+    ///
+    /// # Errors
+    ///
+    /// As for [`Self::from_parts`], without the consistency check.
+    fn validate(&self) -> Result<(), Error> {
+        let sorted_points = self.points.windows(2).all(|w| w[0] < w[1]);
+
+        if !sorted_points || self.points.first() == Some(&REFERENCE) {
+            return Err(Error::UnknownTimePoint);
+        }
+
+        for c in self.constraints.iter().chain(&self.pending) {
+            self.local_pair(c.from, c.to)?;
+
+            if c.lo.is_some_and(|l| l.checked_neg().is_none()) {
+                return Err(Error::Overflow);
+            }
+        }
+
+        self.validate_shared()?;
+
+        for cut in &self.cuts {
+            if self.local_point(cut.point).is_none_or(|tp| tp == REFERENCE) {
+                return Err(Error::UnknownTimePoint);
+            }
+
+            if self
+                .shared
+                .binary_search_by_key(&cut.shared, |s| s.id)
+                .is_err()
+            {
+                return Err(Error::UnknownAgent);
+            }
+        }
+
+        Ok(())
+    }
+
+    /// Checks that every shared constraint involves this agent at one of its own points.
+    ///
+    /// # Errors
+    ///
+    /// As for [`Self::from_parts`].
+    fn validate_shared(&self) -> Result<(), Error> {
+        if !self.shared.windows(2).all(|w| w[0].id < w[1].id) {
+            return Err(Error::UnknownAgent);
+        }
+
+        for s in &self.shared {
+            let own = if s.from_agent == self.id {
+                s.constraint.from
+            } else if s.to_agent == self.id {
+                s.constraint.to
+            } else {
+                return Err(Error::UnknownAgent);
+            };
+
+            let foreign = self.local_point(own).is_none_or(|tp| tp == REFERENCE);
+
+            if s.from_agent == s.to_agent || foreign {
+                return Err(Error::UnknownTimePoint);
+            }
+        }
+
+        Ok(())
+    }
+
     /// Creates the view; `points` and `shared` come sorted from the plan.
     pub(super) const fn new(
         id: AgentId,
@@ -211,6 +347,12 @@ impl Agent {
     /// kept cuts; its explanation refers to the constraints, then the proposals, then the kept
     /// cuts, on the points of [`Self::local_point`]. Without proposals it is always positive.
     ///
+    /// Pin every point that has already happened with a local constraint `z -> tp` in
+    /// `[t, t]` ([`Self::add_constraint`]) before summarising, so that no new cut contradicts
+    /// the past. Do not change the agent between sending the summary and
+    /// [`Self::redecouple`]: a change bumps [`Self::revision`], and the agent then refuses the
+    /// group.
+    ///
     /// # Errors
     ///
     /// - [`Error::UnknownAgent`] if `group` does not contain this agent.
@@ -261,7 +403,9 @@ impl Agent {
     /// adopts its proposals into its local constraints. A negative verdict means the group's
     /// plan, proposals included and with the cuts towards other agents fixed, is inconsistent;
     /// the agent then drops its proposals and keeps its cuts. Read the protocol requirement in
-    /// the [module docs](super) before using this.
+    /// the [module docs](super) before using this: if any member refuses the group, every
+    /// member must stay on (or return to) its old cuts, for example from a clone taken
+    /// before the call.
     ///
     /// # Errors
     ///
diff --git a/src/multiagent/group.rs b/src/multiagent/group.rs
index ab7034e..0ce1a32 100644
--- a/src/multiagent/group.rs
+++ b/src/multiagent/group.rs
@@ -46,6 +46,62 @@ impl Summary {
         }
     }
 
+    /// Rebuilds a summary received from another agent, as plain data.
+    ///
+    /// The fields mirror the accessors of the same names. [`AgentGroup::new`] checks that the
+    /// summaries of a group fit each other.
+    ///
+    /// # Errors
+    ///
+    /// [`Error::MismatchedSummaries`] if `group` is not sorted without duplicates or lacks
+    /// `agent`; `points` is not sorted without duplicates or contains the reference; a bound
+    /// names a point other than the reference and `points`; or `shared` is not sorted by id
+    /// without duplicates, or one of them does not join `agent`, at one of `points`, to
+    /// another member of `group`.
+    pub fn from_parts(
+        agent: AgentId,
+        group: Vec,
+        revision: u64,
+        points: Vec,
+        bounds: Vec,
+        shared: Vec,
+    ) -> Result {
+        let summary = Self::new(agent, group, revision, points, bounds, shared);
+
+        if summary.is_well_formed() {
+            Ok(summary)
+        } else {
+            Err(Error::MismatchedSummaries)
+        }
+    }
+
+    /// Whether the structure [`Self::from_parts`] documents holds.
+    fn is_well_formed(&self) -> bool {
+        let known = |tp: TimePoint| tp == REFERENCE || self.points.binary_search(&tp).is_ok();
+        let member = |a: AgentId| self.group.binary_search(&a).is_ok();
+        let joins_member = |s: &SharedConstraint| {
+            let own = if s.from_agent == self.agent {
+                s.constraint.from
+            } else {
+                s.constraint.to
+            };
+
+            s.peer(self.agent)
+                .is_some_and(|p| p != self.agent && member(p))
+                && own != REFERENCE
+                && known(own)
+        };
+
+        let group_ok = self.group.windows(2).all(|w| w[0] < w[1]) && member(self.agent);
+        let points_ok =
+            self.points.windows(2).all(|w| w[0] < w[1]) && self.points.first() != Some(&REFERENCE);
+        let bounds_ok = self.bounds.iter().all(|b| known(b.from) && known(b.to));
+        let shared_ok = self.shared.windows(2).all(|w| w[0].id < w[1].id)
+            && self.shared.iter().all(joins_member);
+
+        group_ok && points_ok && bounds_ok && shared_ok
+    }
+
     /// The agent that made the summary.
     #[must_use]
     pub const fn agent(&self) -> AgentId {
diff --git a/tests/it/multiagent.rs b/tests/it/multiagent.rs
index 38dccc9..1c46e6c 100644
--- a/tests/it/multiagent.rs
+++ b/tests/it/multiagent.rs
@@ -524,3 +524,117 @@ fn conflicting_proposal_dropped() {
     assert_eq!(agents[0].pending(), &[]);
     assert_eq!(agents[0].cuts(), cuts.as_slice());
 }
+
+/// Rebuilds a summary from its accessors.
+fn rebuild(s: &Summary) -> Result {
+    Summary::from_parts(
+        s.agent(),
+        s.group().to_vec(),
+        s.revision(),
+        s.points().to_vec(),
+        s.bounds().to_vec(),
+        s.shared_constraints().to_vec(),
+    )
+}
+
+proptest! {
+    /// Agents and summaries survive a round trip through their plain parts.
+    #[test]
+    fn parts_round_trip(spec in plan(true, 1..=3)) {
+        let members: Vec = (0..spec.agents).collect();
+        let mut agents = decouple(&spec.build(&[]));
+        let summaries = propose_and_summarise(&spec, &mut agents, &members);
+
+        for agent in &agents {
+            let rebuilt = Agent::from_parts(agent.clone().into_parts(), &Budget::UNLIMITED).unwrap();
+            prop_assert_eq!(rebuilt, Verdict::Consistent(agent.clone()));
+        }
+
+        for s in summaries.iter().flatten() {
+            prop_assert_eq!(&rebuild(s).unwrap(), s);
+        }
+    }
+}
+
+/// Malformed parts are refused, and an inconsistent local network is explained.
+#[test]
+fn malformed_parts_refused() {
+    use temporal_control::Error;
+
+    let mut plan = MultiAgentStn::new(2);
+    let z = plan.reference();
+    let a = plan.add_time_point(AgentId(0)).unwrap();
+    let b = plan.add_time_point(AgentId(1)).unwrap();
+    plan.add_constraint(z, a, Some(Ticks(0)), Some(Ticks(10)))
+        .unwrap();
+    plan.add_constraint(a, b, Some(Ticks(1)), Some(Ticks(5)))
+        .unwrap();
+    let agents = decouple(&plan);
+    let parts = agents[0].clone().into_parts();
+    let rebuild_agent = |parts| Agent::from_parts(parts, &Budget::UNLIMITED);
+
+    let mut unsorted = parts.clone();
+    unsorted.points.insert(0, b);
+    let mut stranger = parts.clone();
+    stranger.id = AgentId(5);
+    stranger.points = vec![b];
+    stranger.constraints.clear();
+    stranger.cuts.clear();
+    let mut bad_cut = parts.clone();
+    bad_cut.shared.clear();
+    let mut contradiction = parts.clone();
+    contradiction.constraints.push(Constraint {
+        from: z,
+        to: a,
+        lo: Some(Ticks(11)),
+        hi: None,
+    });
+
+    assert_eq!(
+        rebuild_agent(parts.clone()).unwrap(),
+        Verdict::Consistent(agents[0].clone())
+    );
+    assert!(matches!(
+        rebuild_agent(unsorted),
+        Err(Error::UnknownTimePoint)
+    ));
+    assert!(matches!(rebuild_agent(stranger), Err(Error::UnknownAgent)));
+    assert!(matches!(rebuild_agent(bad_cut), Err(Error::UnknownAgent)));
+    assert!(matches!(
+        rebuild_agent(contradiction),
+        Ok(Verdict::Inconsistent(_))
+    ));
+}
+
+/// Malformed summary parts are refused.
+#[test]
+fn malformed_summary_parts_refused() {
+    use temporal_control::Error;
+
+    let mut plan = MultiAgentStn::new(2);
+    let z = plan.reference();
+    let a = plan.add_time_point(AgentId(0)).unwrap();
+    let b = plan.add_time_point(AgentId(1)).unwrap();
+    plan.add_constraint(a, b, Some(Ticks(1)), Some(Ticks(5)))
+        .unwrap();
+    let s = summaries(&decouple(&plan)).remove(0);
+    let missing_member = Summary::from_parts(
+        s.agent(),
+        vec![s.agent()],
+        s.revision(),
+        s.points().to_vec(),
+        s.bounds().to_vec(),
+        s.shared_constraints().to_vec(),
+    );
+    let reference_point = Summary::from_parts(
+        s.agent(),
+        s.group().to_vec(),
+        s.revision(),
+        vec![z],
+        Vec::new(),
+        Vec::new(),
+    );
+    assert_eq!(rebuild(&s).as_ref(), Ok(&s));
+    assert_eq!(missing_member, Err(Error::MismatchedSummaries));
+    assert_eq!(reference_point, Err(Error::MismatchedSummaries));
+}

From 9950f6d72b5c26f353f477cf584c98414b790816 Mon Sep 17 00:00:00 2001
From: Markus Mayer 
Date: Sat, 28 Nov 2026 11:01:25 +0100
Subject: [PATCH 5/8] Keep the existing Error discriminants

UnknownAgent and MismatchedSummaries were inserted after
UnknownTimePoint, which shifted the discriminants of every later
variant. cargo-semver-checks reports that as a major change, because
code casting a variant with `as` would see a different value. The new
variants now come last, with a comment saying why.
---
 src/error.rs | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/error.rs b/src/error.rs
index c90241b..6e98684 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -11,12 +11,6 @@ use core::fmt;
 pub enum Error {
     /// A time point does not belong to this network.
     UnknownTimePoint,
-    /// An agent does not belong to this multi-agent network.
-    UnknownAgent,
-    /// The summaries handed to a group operation do not form one complete, current set: an
-    /// agent is missing or duplicated, the groups or revisions disagree, or a shared
-    /// constraint refers to a point its owner did not report.
-    MismatchedSummaries,
     /// A contingent link needs `0 < lo <= hi`.
     InvalidContingentLink,
     /// A checked arithmetic operation on [`Ticks`](crate::Ticks) or a size overflowed.
@@ -29,6 +23,13 @@ pub enum Error {
     OutOfMemory,
     /// Two independent checks disagreed, or an internal invariant broke. This is a bug.
     Internal,
+    // New variants go last: reordering changes the discriminants (a semver break).
+    /// An agent does not belong to this multi-agent network.
+    UnknownAgent,
+    /// The summaries handed to a group operation do not form one complete, current set: an
+    /// agent is missing or duplicated, the groups or revisions disagree, or a shared
+    /// constraint refers to a point its owner did not report.
+    MismatchedSummaries,
 }
 
 impl fmt::Display for Error {

From 0bf5485a522ffe2abab533ead01d3aaa9b278eac Mon Sep 17 00:00:00 2001
From: Markus Mayer 
Date: Sat, 28 Nov 2026 11:02:02 +0100
Subject: [PATCH 6/8] Report a cycle edge without an origin as an internal
 error

AgentGroup::conflict skipped a negative-cycle edge whose constraint had
no recorded origin. Every constraint of the joint network gets one when
it is added, so a miss means a broken invariant, and skipping it would
hand back a conflict that silently leaves out part of the cycle. It is
now Error::Internal, as elsewhere in the crate. redecouple computes the
conflict before it drops the proposals, so the error leaves the agent
unchanged.
---
 src/multiagent/agent.rs |  3 ++-
 src/multiagent/group.rs | 16 +++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/multiagent/agent.rs b/src/multiagent/agent.rs
index 33269e9..4640f1c 100644
--- a/src/multiagent/agent.rs
+++ b/src/multiagent/agent.rs
@@ -425,9 +425,10 @@ impl Agent {
         let new_cuts = match cuts::choose(group.stn(), group.shared(), budget)? {
             Verdict::Consistent(cuts) => cuts,
             Verdict::Inconsistent(cycle) => {
+                let conflict = group.conflict(&cycle)?;
                 self.pending.clear();
                 self.revision = self.revision.saturating_add(1);
-                return Ok(GroupVerdict::Inconsistent(group.conflict(&cycle)));
+                return Ok(GroupVerdict::Inconsistent(conflict));
             }
         };
 
diff --git a/src/multiagent/group.rs b/src/multiagent/group.rs
index 0ce1a32..99dfd74 100644
--- a/src/multiagent/group.rs
+++ b/src/multiagent/group.rs
@@ -267,11 +267,12 @@ impl AgentGroup {
     ///
     /// # Errors
     ///
-    /// As for [`Stn::check_consistency`].
+    /// As for [`Stn::check_consistency`], and [`Error::Internal`] if a cycle edge has no
+    /// recorded origin (a bug).
     pub fn check_consistency(&self, budget: &Budget) -> Result {
         Ok(match self.stn.check_consistency(budget)? {
             Verdict::Consistent(_) => GroupVerdict::Consistent,
-            Verdict::Inconsistent(cycle) => GroupVerdict::Inconsistent(self.conflict(&cycle)),
+            Verdict::Inconsistent(cycle) => GroupVerdict::Inconsistent(self.conflict(&cycle)?),
         })
     }
 
@@ -291,7 +292,12 @@ impl AgentGroup {
     }
 
     /// Names the shared constraints and agents behind a negative cycle of [`Self::stn`].
-    pub(super) fn conflict(&self, cycle: &NegativeCycle) -> GroupConflict {
+    ///
+    /// # Errors
+    ///
+    /// [`Error::Internal`] if a cycle edge names a constraint without a recorded origin (a
+    /// bug: every constraint of [`Self::stn`] gets one).
+    pub(super) fn conflict(&self, cycle: &NegativeCycle) -> Result {
         let mut shared = Vec::new();
         let mut agents = Vec::new();
 
@@ -299,7 +305,7 @@ impl AgentGroup {
             match self.origins.get(edge.constraint.0) {
                 Some(&Origin::Shared(id)) => shared.push(id),
                 Some(&Origin::Summary(agent)) => agents.push(agent),
-                None => {}
+                None => return Err(Error::Internal),
             }
         }
 
@@ -307,7 +313,7 @@ impl AgentGroup {
         shared.dedup();
         agents.sort_unstable();
         agents.dedup();
-        GroupConflict { shared, agents }
+        Ok(GroupConflict { shared, agents })
     }
 
     /// Fills the joint network: the points, every summary bound, then every shared constraint.

From 2508296590ac3b861070275ac99380049b27e78f Mon Sep 17 00:00:00 2001
From: Markus Mayer 
Date: Sat, 28 Nov 2026 11:32:52 +0100
Subject: [PATCH 7/8] Fail the night dispatch instead of spinning when no point
 can run

The example's tick loop kept `t` unchanged when `next_wakeup` returned
None. A dispatcher left with points it can never execute would then
spin forever, and since the example runs as a test, CI would time out
instead of failing. The loop now stops once the plan is complete and
otherwise expects a wakeup.
---
 examples/observation_campaign.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/examples/observation_campaign.rs b/examples/observation_campaign.rs
index eca2055..7e94288 100644
--- a/examples/observation_campaign.rs
+++ b/examples/observation_campaign.rs
@@ -231,11 +231,19 @@ fn dispatch_night(night: &Stn) {
     let mut out = [TimePoint(0); 7];
     let mut t = 0;
 
-    while !dispatcher.is_complete() {
+    loop {
         dispatcher
             .step(Ticks(t), &[], &mut out)
             .expect("dispatchable");
-        t = dispatcher.next_wakeup().map_or(t, |w| w.0.max(t + 1));
+
+        if dispatcher.is_complete() {
+            break;
+        }
+
+        let wakeup = dispatcher
+            .next_wakeup()
+            .expect("an unexecuted point can still run");
+        t = wakeup.0.max(t + 1);
     }
 
     let times: Vec = (0..n)

From e2217d20dfaa60c1d592d748ae6de3ad94ceb83b Mon Sep 17 00:00:00 2001
From: Markus Mayer 
Date: Sat, 28 Nov 2026 11:32:52 +0100
Subject: [PATCH 8/8] Reuse the simulation Rng in the multi-agent tests

pick() carried its own LCG next to the xorshift Rng in tests/it/sim.rs
that does the same job. It now draws from that Rng; the seed's low bit
is forced on because xorshift never leaves zero.
---
 tests/it/multiagent.rs | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/tests/it/multiagent.rs b/tests/it/multiagent.rs
index 1c46e6c..2304789 100644
--- a/tests/it/multiagent.rs
+++ b/tests/it/multiagent.rs
@@ -8,6 +8,7 @@ use temporal_control::{
 };
 
 use crate::generators::ConstraintSpec;
+use crate::sim::Rng;
 
 /// A multi-agent plan as plain data. Point `0` is the reference; point `i > 0` belongs to
 /// agent `owners[i - 1]`.
@@ -132,20 +133,14 @@ fn policies() -> impl Strategy> {
 }
 
 /// Picks a value in `[lo, hi]`; infinite ends are taken 30 ticks beyond the other end.
-fn pick(lo: Option, hi: Option, policy: Policy, state: &mut u64) -> Ticks {
+fn pick(lo: Option, hi: Option, policy: Policy, rng: &mut Rng) -> Ticks {
     let lo = lo.map_or_else(|| hi.map_or(-30, |h| h.0 - 30), |l| l.0);
     let hi = hi.map_or(lo + 30, |h| h.0);
 
     Ticks(match policy {
         Policy::Earliest => lo,
         Policy::Latest => hi,
-        Policy::Random(_) => {
-            *state = state
-                .wrapping_mul(6_364_136_223_846_793_005)
-                .wrapping_add(1_442_695_040_888_963_407);
-            let span = u64::try_from(hi - lo).unwrap() + 1;
-            lo + i64::try_from((*state >> 33) % span).unwrap()
-        }
+        Policy::Random(_) => rng.range(lo, hi),
     })
 }
 
@@ -155,10 +150,11 @@ fn local_schedule(agent: &Agent, policy: Policy) -> Vec<(TimePoint, Ticks)> {
     let budget = Budget::UNLIMITED;
     let local = agent.local_network().unwrap();
     let mut inc = IncrementalStn::new();
-    let mut state = match policy {
-        Policy::Random(seed) => seed,
-        _ => 0,
-    };
+    // xorshift never leaves zero, so the low bit is forced on.
+    let mut rng = Rng(match policy {
+        Policy::Random(seed) => seed | 1,
+        _ => 1,
+    });
 
     for _ in 0..local.time_point_count() {
         inc.add_time_point(&budget).unwrap();
@@ -178,7 +174,7 @@ fn local_schedule(agent: &Agent, policy: Policy) -> Vec<(TimePoint, Ticks)> {
     let mut out = Vec::new();
 
     for p in (1..local.time_point_count()).map(TimePoint) {
-        let t = pick(inc.lower(z, p), inc.upper(z, p), policy, &mut state);
+        let t = pick(inc.lower(z, p), inc.upper(z, p), policy, &mut rng);
         let verdict = inc.add_constraint(z, p, Some(t), Some(t), &budget).unwrap();
         assert!(
             matches!(verdict, Verdict::Consistent(_)),