Scope: OpenClaw distributed orchestration (3–100 nodes across AlphaClaw L1, Perpetua-Tools L2, orama-system L3). Goal: map Phase 0 threat model (T1–T7) to battle-tested P2P security patterns, identify gaps, and plan Phase 1b enhancements.
Validation basis: Phase 0 design (D1–D4), 20 P2P security patterns (P1–P20), and production systems (DHT 25M nodes, SWIM 1000+ clusters, BFT in Ethereum).
Layer 3 (L3) — orama-system (stateless orchestration, planning)
↓ (MCP calls, observes)
Layer 2 (L2) — Perpetua-Tools (state authority: job queue, model routing, LAN discovery)
↓ (REST/HTTP, heartbeats)
Layer 1 (L1) — AlphaClaw (infra: CLI, HTTP endpoints, inference workers)
↓ (direct probes via TCP/UDP)
Hardware: Mac (L2 + L3 mainly), Win RTX3080 (L1 inference), transient peers (docker containers, cloud APIs)
| Layer | Role | Node count | Trust level | Failure impact |
|---|---|---|---|---|
| L3 | Orchestrator (orama-system) | 1–3 | Core; stateless | Planning halt; no state corruption |
| L2 | State authority (PT) | 2–5 | Core; state-owning | State divergence; quorum loss |
| L1 | Inference workers (AlphaClaw) | 10–100 | Mixed; transient-capable | Work delay; no state authority |
| Transient | Observers, probes, relays | 0–50 | Low; untrusted | Observable malice via contradiction |
- Direct path (L1 → L2): AlphaClaw heartbeat → PT, latency ~10–50ms, high confidence (direct proof).
- Gossip relay (L1 → L2 via L3): AlphaClaw → orama → PT, latency ~100–500ms, medium confidence (relayed proof).
- Intra-L2 (PT observer → PT state machine): observation aggregation, latency ~1–5ms, highest confidence (local).
P2P analogue: Kademlia relay fabricating peers; PBFT node issuing false state proposals.
OpenClaw scenario: Compromised AlphaClaw L1 relay node lies about LM Studio status (claims REACHABLE when actually OFFLINE) to L2 PT observer.
Attack vector:
- Relay modifies observation:
{status: REACHABLE, timestamp: now}from{status: UNREACHABLE, timestamp: past}. - Attaches proof that looks legitimate but isn't verified by L2.
- L2 consumer marks LM Studio ACTIVE, sends task, times out.
Current Phase 0 defenses:
- ✅ Proof requirement (D1): Observation must carry relay_proof signed by target peer (LM Studio). Relay cannot re-sign.
- ✅ Multiplicative gate (D1): Unproven observations (proof_score ≈ 0) → confidence = 0, cannot cross threshold.
- ✅ Witness quorum (D4): Relay alone cannot satisfy quorum; needs ≥2 independent witnesses.
⚠️ Signature verification: D1 assumes proof signature is verified; implementation detail TBD.
P2P patterns covering T1:
- P1 (Proof-Anchored Identity): ✅ Implemented implicitly; formalize in phase-1b.
- P3 (Challenge-Response Liveness): ✅ Implemented (heartbeat); enhance with nonce binding.
- P5 (Witness Quorum + Provenance Dedup):
⚠️ Designed, not implemented; GAP CRITICAL. - P13 (Equivocation Detection): ❌ Missing; if relay issues contradictory claims, no detection mechanism.
- P19 (Immutable Audit Log):
⚠️ Implicit in D1; needs specification.
Gap severity: CRITICAL. Relay fabrication is detectable only if another observer directly probes target and reports contradiction. If all observers rely on same relay, malice is undetected.
P2P analogue: SWIM old incarnation numbers; Bitcoin stale chain history.
OpenClaw scenario: LM Studio crashed and restarted with new IP (same peer_id). Relay caches old observation with old IP. L2 observer accepts stale IP, routes work to dead address.
Attack vector:
- Observation O1:
{peer_id: LM-Studio-1, ip: <YOUR_LAN_IP>, epoch: 5, timestamp: T}is valid and cached. - LM Studio restarts, updates IP to
<YOUR_LAN_IP>, sends heartbeat to L2. - Relay (caching O1) delays processing; sends O1 to another observer.
- Observer has no way to know O1 is superseded without comparing epoch + timestamp.
Current Phase 0 defenses:
- ✅ Epoch monotonicity (D1): Each peer endpoint change increments endpoint_epoch. Higher epoch always supersedes.
- ✅ Dual freshness (D4 T2): Compare BOTH epoch AND timestamp. Observation is fresh only if
epoch ≥ known_epochANDtimestampwithin acceptance window. - ✅ Signed timestamp tie-break (D1): Within same epoch, newer timestamp wins.
⚠️ Reorder buffer (D1): Mentioned for T7 (out-of-order), not explicit for T2.
P2P patterns covering T2:
- P3 (Challenge-Response Liveness): ✅ Implemented; verifies current IP/state.
- P8 (Monotonic Sequence Numbering):
⚠️ Designed, not explicitly scoped to per-epoch sequences; gap-medium. - P9 (Reorder Buffer): ❌ Not implemented; T7 defense incomplete without it.
Gap severity: MEDIUM. Epoch monotonicity is strong; timestamp tie-break handles most cases. Reorder buffer would eliminate any residual risk.
P2P analogue: TCP sequence number attacks; blockchain double-spend within same block.
OpenClaw scenario: Observer A probes LM Studio at T1, records O1 = {status: REACHABLE, nonce: N1}. Attacker captures O1, re-injects it at T2 when LM Studio has gone OFFLINE. Naive consumer sees two observations of REACHABLE, counts as two independent witnesses.
Attack vector:
- O1 generated at T=100s, nonce N1, valid signature.
- Attacker injects same O1 bytes at T=200s.
- Consumer's dedup check: is (observer_id, nonce) in seen cache? If cache evicted, yes, duplicate accepted.
- Confidence boosted by "two witnesses" when it's really one.
Current Phase 0 defenses:
- ✅ Per-observation nonce (D4 T3): Each observation carries nonce unique per (peer, epoch). Duplicates collapsed to one vote in quorum.
- ✅ Monotonic sequence (D4 T3): Scoped to (peer, epoch); incoming obs with duplicate seq is discarded.
- ✅ Bounded replay cache (D4): Consumers cache seen (witness_id, nonce) tuples; discard on replay.
⚠️ Cache eviction policy: D4 says "cache seen (witness_id, nonce)" but doesn't specify eviction; implicit TTL.
P2P patterns covering T3:
- P8 (Monotonic Sequence Numbering): ✅ Implemented (nonce + sequence); formalize in phase-1b.
- P18 (Bounded-TTL Caches):
⚠️ Designed, not specified; gap-low (easy add).
Gap severity: LOW. Nonce + sequence are strong. Replay cache eviction policy needed (explicit TTL or epoch boundary).
P2P analogue: Kademlia distance-based sybil resistance; Ethereum validator diversity; Bitcoin ASN-based peer selection.
OpenClaw scenario: Attacker spins up 5 fake AlphaClaw instances (all on same Docker host). Each sends independent heartbeat claiming LM Studio is online. L2 observer counts 5 witnesses, thinks quorum favors REACHABLE.
Attack vector:
- Five sybil identities: AC-sybil-1, AC-sybil-2, ..., AC-sybil-5.
- All on same machine (same IP prefix, same AS number if cloud).
- Each sends "LM Studio REACHABLE" heartbeat.
- Naive quorum: 5 witnesses agree → high confidence.
- Reality: one attacker with 5 identities.
Current Phase 0 defenses:
- ✅ Witness quorum ≥2 (D4): Requires ≥2 independent witnesses; 1 attacker alone cannot satisfy.
⚠️ Provenance deduplication (D4 T4): "Distinct network provenance" mentioned but not formalized. Relayed to phase-1b implementation.- ❌ Distance-based bucketing: No Kademlia-style distance metric for peer IDs; Sybils with arbitrary IDs can bypass provenance check if not rigorous.
P2P patterns covering T4:
- P2 (Distance-Metric Bucketing): ❌ Missing; Sybils with correlated IDs are invisible.
- P5 (Witness Quorum + Provenance Dedup):
⚠️ Designed, not implemented; gap-critical. - P6 (Reputation-Decay Scoring): ❌ Missing; no per-witness accuracy tracking.
Gap severity: CRITICAL. Sybil resistance currently relies on "distinct network provenance" which is not formalized. Attacker on same subnet can bypass if provenance is IP-only (IPv4 has 16.7M addresses per /8; attacker gets many for free).
P2P analogue: Bitcoin mempool transaction flooding; SWIM gossip amplification attacks; Memcached key explosion.
OpenClaw scenario: Attacker floods L2 observer with 10,000 observations per second (forged heartbeats from fake AlphaClaw identities). Observer CPU pegged on proof verification; legitimate heartbeats queue for 10+ seconds; timeouts trigger false SUSPECT states.
Attack vector:
- Attacker sends rapid-fire heartbeats:
{peer_id: random, status: REACHABLE, proof: [junk]}. - Proof verification is expensive (~100µs per signature verification).
- Observer ingests all 10k obs, spends 1 second in verification.
- Legitimate heartbeat from real LM Studio is queued, delayed.
- Heartbeat times out → L2 marks LM Studio SUSPECT → work halts.
Current Phase 0 defenses:
- ✅ Per-source token bucket (D4): Sustained R obs/sec, burst B. Over-budget dropped before verification.
- ✅ Cost-ordered pipeline (D4): Syntax → rate/quota → dedup → freshness → expensive proof. Malformed/duplicate/stale floods shed early.
- ✅ Bounded caches (D4): Replay and witness caches are size-capped with eviction.
⚠️ Backpressure (D4): Explicit backpressure mechanism when buckets saturate mentioned but not detailed.
P2P patterns covering T5:
- P16 (Token-Bucket Rate Limiting): ✅ Implemented (conceptual); formalize per-source limits per tier (core vs. transient).
- P17 (Cost-Ordered Validation Pipeline): ✅ Implemented (conceptual); instrument and log drop reasons.
- P18 (Bounded-TTL Caches): ✅ Implemented (conceptual); add Bloom filter first pass.
Gap severity: MEDIUM. Rate limiting and pipeline are designed but not implemented. Adaptive rate limiting (P16 enhancement) would boost resilience.
P2P analogue: Bitcoin eclipse attacks; Ethereum network partitions; Cassandra gossip eclipse.
OpenClaw scenario: Attacker (running on compromised L1 relay) intercepts all observations to target L2 observer. Attacker forwards only low-quality observations from fake peers ("LM Studio is occasionally REACHABLE") while suppressing high-quality direct observations. L2's confidence in LM Studio is artificially inflated because attacker controls the entire intake path.
Attack vector:
- Attacker controls network path from source → target observer.
- Attacker: drops direct probes (L1 → L2), forwards only gossip (via L3, under attacker control).
- Gossip: "LM Studio status = unknown, freshness=0.5, 1 witness." Confidence barely crosses threshold.
- Attacker: repeats gossip N times from different sybil identities; freshness score updated to 0.6 by timestamp.
- Multiplicative formula:
confidence = proof × 0.4 + (0.6 × 0.6) × 0.95 ≈ 0.34— below DIRECT threshold but RELAY threshold. - L2 makes routing decision based on marginal confidence.
Current Phase 0 defenses:
- ✅ Multiplicative formula (D1): Extra low-quality observations cannot inflate confidence past ceiling set by weakest factor.
⚠️ Intake-path diversity (D4 T6): "Require ≥2 disjoint paths" mentioned; not formalized.⚠️ Marginal contribution cap (D4 T6): "Cap marginal contribution of same-origin observations" mentioned; no implementation.- ❌ Path-diverse peer sampling: No explicit mechanism to ensure two disjoint paths (direct + relay).
P2P patterns covering T6:
- P4 (Multi-Path Probe Diversity):
⚠️ Designed, not implemented; gap-high. If direct path contradicts relay path, should trigger quorum arbitration. - P7 (Asynchronous Member Notification):
⚠️ Partial; gossip fan-out not explicitly log(N). - P10 (Cryptographic Merkle Commit): ❌ Missing; isolated observer's state divergence not detectable.
Gap severity: HIGH. Multi-path diversity is explicitly scoped in D4 but not mechanized. Single-path eclipse is theoretically prevented by quorum logic (✅) but only if direct path is available. If attacker controls ALL paths, current design doesn't defend.
P2P analogue: TCP out-of-order segments; blockchain fork resolution via longest chain rule; RAFT log replication with out-of-order commits.
OpenClaw scenario: L1 sends two observations in sequence: O1 (epoch=5, seq=10, status=REACHABLE, T=100s) then O2 (epoch=6, seq=11, status=UNREACHABLE, T=101s). Relay via L3 processes them in reverse due to queuing delay. L2 applies O2 first (UNREACHABLE), then O1 (REACHABLE), ending in wrong state.
Attack vector:
- Observation O1 generated at T1, O2 at T2 > T1, both in sequence.
- Relay queues O1, then O2, but queue is LIFO (last-in-first-out) — unrealistic but illustrates the principle.
- L2 ingests O2 first, applies UNREACHABLE state for epoch=6.
- L2 ingests O1 (late), timestamp T1 < T2, but epoch=5 < 6, so comparison is
(5,10,100) < (6,11,101)— O1 is stale. - L2 should reject O1 as superseded, but reorder buffer is not implemented; O1 might clobber O2 depending on apply logic.
Current Phase 0 defenses:
- ✅ Monotonic apply gate (D4 T7): Only apply if
(epoch, sequence, timestamp)strictly > last applied. Out-of-order older observations are logged but not applied. - ✅ Reorder buffer (D4 T7, mentioned): "Hold observations in short bounded window; release in canonical order once watermark passes." Concept introduced but implementation TBD.
⚠️ Idempotent, order-independent aggregation (D4 T7): "Confidence for an epoch computed from set of observations, not arrival order." Intended but not formalized.- ❌ Reorder buffer implementation: No code or pseudocode for reorder buffer logic in D1.
P2P patterns covering T7:
- P8 (Monotonic Sequence Numbering): ✅ Designed (nonce + sequence); formalize in phase-1b.
- P9 (Epoch-Scoped Reorder Buffer): ❌ Missing; this is the key T7 defense. Gap-critical.
Gap severity: CRITICAL. T7 is new in Phase 0 (iteration 2). Monotonic apply gate is designed, but reorder buffer is not implemented. Without reorder buffer, observations waiting for watermark advancement can be applied out-of-order if they arrive while previous epoch is still being decided.
| Gap ID | Pattern | Threat(s) | Description | Impact | Phase 1b effort |
|---|---|---|---|---|---|
| G1 | P5 Witness Quorum + Provenance Dedup | T4 (Sybil), T1 | ASN/subnet deduplication mentioned but not formalized. Without it, Sybils on same subnet bypass quorum. | Sybil attacks viable on local network | High (GeoIP lookup, ASN mapping) |
| G2 | P4 Multi-Path Probe Diversity | T6 (Eclipse) | Designed (D4 mentions ≥2 disjoint paths) but not mechanized. Single-path eclipse possible if direct path is unavailable. | Attacker controlling relay path can eclipse observer | High (refactor confidence tracking) |
| G3 | P9 Epoch-Scoped Reorder Buffer | T7 (Out-of-order) | T7 defense requires bounded reorder buffer; D1 mentions concept but no implementation. | Out-of-order observations can regress state | High (data structure + apply logic) |
| G4 | P13 Equivocation Detection | T1 (Malicious relay) | No mechanism to log contradictory signed observations as proof of malice. | Malice is inferred only if both contradictions reach quorum | Medium (log equivocation, automated detection) |
| Gap ID | Pattern | Threat(s) | Description | Impact | Phase 1b effort |
|---|---|---|---|---|---|
| G5 | P6 Reputation-Decay Witness Scoring | T1, T4 | No per-witness accuracy tracking. Malicious witness is not progressively penalized; only discovered if quorum contradicts. | Malicious witnesses remain in quorum longer than necessary | Medium (reputation ledger, daily scoring) |
| G6 | P2 Distance-Metric Bucketing | T4 (Sybil), T1 | No Kademlia-style distance metric for peer IDs. Sybils with diverse IDs can bypass provenance clustering check. | Sybils harder to detect via correlation | Medium (implement XOR distance, bucketing) |
| G7 | P7 Asynchronous Member Notification | T5, T6 | Gossip fan-out is broadcast-style, not explicit log(N). Can amplify gossip load. | High-fanout gossip on large swarms could become DoS vector itself | Low (change fan-out logic) |
| G8 | P19 Immutable Append-Only Audit Log | T1, forensics | Audit logging is implicit in D1 but not specified. No hash-chaining or signature commitment. | Audit logs can be mutated; no forensic trail for disputes | Medium (hash-chain log, signing) |
| Gap ID | Pattern | Threat(s) | Description | Impact | Phase 1b effort |
|---|---|---|---|---|---|
| G9 | P1 Proof-Anchored Identity | T1, T4 | Implemented conceptually (D1 requires relay_proof signature), but nonce binding not explicit. Relay could forward same observation with reinterpreted nonce. | Proof authenticity relies on signature verification implementation | Low (formalize signature checks) |
| G10 | P8 Monotonic Sequence Numbering | T3, T7 | Sequence number for dedup (T3) is designed; sequence for causal ordering (T7) is not formalized per-observation schema. | Out-of-order observations can cause state regression if sequence not enforced | Low (add seq field to schema) |
| G11 | P18 Bounded-TTL Caches | T3, T5, T4 | Cache eviction policy is implicit (mentioned "epoch-scoped eviction"); no TTL or LRU formalization. | Cache can grow unbounded if eviction not implemented | Low (add cache size cap, eviction logic) |
| G12 | P16 Token-Bucket Rate Limiting | T5 | Per-source rate limits designed (D4); adaptive limits (P16 enhancement) not in scope. | DoS resilience is static, not adaptive to load | Low (add load monitoring, dynamic limits) |
| Gap ID | Pattern | Threat(s) | Description | Rationale | Estimated v2 effort |
|---|---|---|---|---|---|
| G13 | P11 Atomic Multi-Writer Consensus | T1, T7 | Full BFT consensus (RAFT-lite leader election, quorum-driven decisions) not in Phase 0. D1 uses witness quorum but no leader-elected final state machine. | Architectural redesign needed; Phase 0 single-observer trusted path sufficient. | 3–6 weeks (implement RAFT) |
| G14 | P15 Threshold Homomorphic Encryption | T1, data exfil | Threshold encryption for sensitive state (credentials, weights) not in scope. | Crypto research-only; Phase 0 focuses on integrity, not confidentiality. | 2–3 months (crypto implementation) |
| G15 | P20 Merkle-Proof Observability | Censorship, revisionism | Merkle-proof transparency log not in scope. | Enhancement for accountability; Phase 0 focus on correctness. | 1 month (prototype) |
| G16 | P14 Accusation & Slashing Protocol | T1, T4 | Multi-phase accusation + slashing not in Phase 0 (reputation decay in G5 is lighter). | Adds strong economic incentive against malice; Phase 0 relies on detection + quorum exclusion. | 2 weeks (protocol) |
Implementation tracks for the gaps below are detailed in PATTERN-MULTIAGENT-EXECUTION-PLAN.md.
G1 + G3 + G4: Witness Quorum + Reorder Buffer + Equivocation Detection
- Effort: 2–3 weeks
- Tasks:
- P5 Provenance Dedup: Integrate MaxMind GeoIP for ASN lookups; implement ASN-indexed witness table; reject observations where >50% witnesses share ASN. (1 week)
- P9 Reorder Buffer: Implement per-peer reorder buffer (SortedDict by (epoch, sequence)); release in canonical order; size-cap at 10 entries. (3 days)
- P13 Equivocation Detection: Maintain per-peer-per-epoch observation set; compare all pairs for contradictions (status != status); log contradictions as evidence of malice. (2 days)
- Testing: Unit tests for dedup logic, reorder buffer ordering, equivocation pairs. (2 days)
- Checkpoint: All 3 mechanisms integrated; no CRITICAL gaps remain.
G2 + G5 + G6: Multi-Path Probe Diversity + Reputation Scoring + Distance Bucketing
- Effort: 1–2 weeks (3 weeks if all three)
- Tasks:
- P4 Multi-Path Probe Diversity: Refactor confidence tracking to maintain separate confidence scores for direct vs. relay path; require both paths to agree before active-view promotion. (1 week)
- P6 Reputation Scoring: Implement per-witness reputation ledger; compute daily accuracy (correct_predictions - 5 × incorrect); weight quorum votes by rep/10. (4 days)
- P2 Distance Bucketing: Implement XOR distance metric for peer_id space; partition peers into k-buckets (k=20 default); bucket ordering by last-seen time. (3 days)
- Optional (defer if time short): P6 reputation scoring is standalone; P4 requires refactoring confidence formula (high risk); P2 bucketing can be added post-Phase-1.
- Checkpoint: Path diversity reduces eclipse risk; reputation scoring enables adaptive quorum; bucketing improves Sybil visibility.
G8 + G9 + G10 + G11 + G12: Audit Logging, Signature Binding, Sequence Schema, Cache Eviction, Adaptive Rate Limiting
- Effort: 1 week (distributed across Phase 1 + Phase 1b)
- Tasks:
- P19 Audit Log (Phase 1 scope, Phase 1b refinement): Implement append-only log; add hash-chaining + signature per epoch in Phase 1b. (2 days Phase 1 + 2 days Phase 1b)
- P1 + P8 Signature Binding + Sequence Schema (Phase 1 scope): Add
sequence_numberandnonce_hashfields to observation schema; verify both in apply path. (2 days) - P18 Cache Eviction (Phase 1 scope): Implement size caps and LRU eviction for replay cache; add Bloom filter first-pass in Phase 1b. (2 days)
- P16 Adaptive Rate Limiting (Phase 1b scope): Monitor system load (CPU, memory); adjust per-source rate limits based on load + per-source accuracy. (2 days)
- Checkpoint: Observation schema is complete; audit trail is persisted and hash-chained; caches are bounded; rate limiting is adaptive.
Week 1:
- P5 (Provenance Dedup): implement ASN lookup + witness table [Day 1–2]
- P9 (Reorder Buffer): SortedDict, watermark logic, tests [Day 3–4]
- P13 (Equivocation Detection): log contradictions, automated detection [Day 5]
Week 2:
- P4 (Multi-Path Probe): refactor confidence tracking [Day 1–3]
- P6 (Reputation Scoring): reputation ledger + daily update [Day 4–5]
Week 3:
- P2 (Distance Bucketing): XOR metric, k-bucket logic, tests [Day 1–3]
- P19 (Audit Log hash-chaining): sign epoch + recompute verification [Day 4–5]
Week 4 (if needed):
- P18 (Cache Eviction + Bloom filter): refactor cache, add Bloom [Day 1–2]
- P16 (Adaptive Rate Limiting): load monitoring, dynamic limits [Day 3–4]
- Integration + end-to-end tests [Day 5]
TOTAL: 2–4 weeks depending on parallelism and whether P4 refactoring is included.
- G13 (P11 Multi-Writer Consensus): RAFT-lite leader election for critical state changes. Estimated 3–6 weeks; defer pending Phase 1b validation of current quorum logic.
- G14 (P15 Threshold Encryption): Confidentiality for sensitive state. Estimated 2–3 months; defer to v2 unless regulatory requirement drives earlier.
- G15 (P20 Merkle-Proof Observability): Transparency log for censorship-resistance. Estimated 1 month prototype; defer to v2 unless accountability audit required.
- G16 (P14 Slashing Protocol): Formal accusation + slashing mechanism. Estimated 2 weeks; defer pending reputation scoring rollout (G5).
Rows: T1–T7 (Phase 0 threats). Columns: P2P patterns P1–P20. Entry: ✅ (Phase 0 implemented),
| Threat | P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12 | P13 | P14 | P15 | P16 | P17 | P18 | P19 | P20 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| T1 — Malicious relay | ✅ | ✅ | — | — | — | — | ✅ | ❌ | — | — | — | — | — | |||||||
| T2 — Stale peer | — | — | ✅ | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | ||
| T3 — Replay | — | — | — | — | — | — | — | ✅ | — | — | — | — | — | — | — | — | — | ✅ | — | — |
| T4 — Sybil witnesses | — | — | — | — | — | — | — | ✅ | — | — | — | — | — | — | ||||||
| T5 — Flooding / DoS | — | — | — | — | — | — | ✅ | — | — | — | — | — | — | — | — | ✅ | ✅ | ✅ | — | — |
| T6 — Inflation / eclipse | — | — | — | — | — | ✅ | — | — | — | — | — | — | — | — | — | — | — | — | ||
| T7 — Out-of-order | — | — | — | — | — | — | — | ✅ | — | — | — | — | — | — | — | — | — | — | — |
Key:
- ✅ = Phase 0 implemented or designed sufficiently
⚠️ = Phase 1b planned or partial implementation- ❌ = Out of scope for Phase 1
- — = Pattern not applicable to threat
Gap visualization: Rows with
Conclusion: Phase 0 covers ~60% of threats robustly (✅). Phase 1b targets gaps (
| Risk | Likelihood | Impact | Phase 1b mitigation |
|---|---|---|---|
| Sybil witness quorum bypass | Medium (ASN diversity not enforced) | High (false state adoption) | G1: Implement P5 provenance dedup |
| Multi-path eclipse attack | Medium (single path possible) | High (observer starved of honest obs) | G2: Implement P4 path diversity |
| Out-of-order state regression | Low (monotonic apply gate present) | High (peer state corrupted) | G3: Implement P9 reorder buffer |
| Undetected relay malice | Medium (contradictions not logged) | Medium (malice inferred late) | G4: Implement P13 equivocation detection |
| DoS via proof verification | Low (rate limiting present) | Medium (work delay, timeouts) | G5: Implement P6 reputation to identify/deprioritize malicious sources |
-
Must-do (CRITICAL):
- Implement G1 (P5 provenance dedup) — Sybil resistance is foundational.
- Implement G3 (P9 reorder buffer) — State machine correctness depends on it.
- Implement G4 (P13 equivocation detection) — Enables forensic audit trail.
-
Should-do (HIGH):
- Implement G2 (P4 multi-path diversity) — Significantly reduces eclipse risk.
- Implement G5 (P6 reputation scoring) — Enables adaptive defenses.
-
Nice-to-have (MEDIUM):
- Implement G6 (P2 distance bucketing) — Improves Sybil visibility; can be added post-Phase-1b.
- Implement G8 (P19 audit log hash-chaining) — Forensic value; low urgency if G4 (equivocation log) is done.
-
Defer to v2:
- G13–G16: Research-only patterns; integrate after Phase 1 stability proven.
- All CRITICAL gaps (G1, G3, G4) implemented and tested.
- All 4 threats T1, T4, T7 show ≥85% pattern coverage in threat matrix.
- Adversarial unit tests pass for each gap (e.g., Sybil quorum bypass rejected, out-of-order regression prevented).
- Audit log captures all equivocations; manual forensics workflow established.
- Reputation ledger tracks per-witness accuracy; reputation < 0 drops witness from active view.
Sources:
- Kademlia DHT: Maymounkov & Mazières, "Kademlia: A Peer-to-Peer Information System Based on the XOR Metric" (2002).
- SWIM: Das, Gupta, Motivala, "SWIM: Scalable Weakly-consistent Infection-style Membership Protocol" (2002).
- RAFT: Ongaro & Ousterhout, "In Search of an Understandable Consensus Algorithm" (2014).
- BFT: HotStuff (Yin et al., 2019), PBFT (Castro & Liskov, 1999).
- Bitcoin: Nakamoto, "Bitcoin: A Peer-to-Peer Electronic Cash System" (2008).
- mTLS / Zero-Trust: NIST Cybersecurity Framework, Forrester Zero-Trust Architecture.
Validation: Each pattern has been deployed in production systems with 10M+ nodes (BitTorrent DHT), 1000+ node clusters (SWIM), or billions of transactions (Bitcoin, Ethereum). Patterns are derived from first-principles protocol design, not speculative research.
PATTERN-MULTIAGENT-EXECUTION-PLAN.md— Concrete discovery and implementation tracks that execute the G1–G16 gaps and P1–P20 patterns identified in this analysis.- Canonical orama-system cross-reference (progressive disclosure — read on demand):
orama-system/docs/v2/03-safety-v2.5.md§ "Related implementation patterns (Perpetua-Tools)" maps these P2P patterns to MAESTRO/SWARM's v2.5 enforcement concepts (SWARM's risk-scoring ↔ P5/P6, contradiction-detection ↔ P13, audit-replay ↔ P19);orama-system/docs/v2/45-single-operator-lan-threat-model-descope.md(D23) generalizes this analysis's own threat-model descope (see Addendum below) into a reusable principle for any P2P-derived adversarial pattern elsewhere in the stack.
Why this exists: the PR #205 CEO quad-review (docs/phase-0-specifications/2026-07-12-ceo-review-quad-voices/) and the STM remediation plan (docs/phase-0-specifications/2026-07-12-stm-remediation-plan.md) both flagged that Sections 1-6 above assume an adversarial, multi-tenant network (P2P patterns sourced from Kademlia/PBFT/Bitcoin, designed for strangers with economic incentive to attack). This addendum re-derives the premise against the actual current deployment, not the aspirational 3–100 node table in Section 1, per the gate recorded in PATTERN-SYNTHESIS.md § "GATE on P5/P6/P13" — it does not replace Sections 1-6, which remain the record of the original design reasoning.
None currently exist. The only live reachability-checking code is _probe() in orchestrator/connectivity.py:9-14, called once per backend from backend_health_map() (connectivity.py:130-143) — a single observer directly probing its own configured endpoints. There is no second, independent process anywhere in this repo that also probes the same backend and reports in. P5 (witness quorum), P6 (reputation-decay), and P13 (equivocation detection) all presume ≥2 independent, potentially-adversarial witnesses whose reports can be compared — that comparison has no data to operate on today, because there is only ever one witness. This matches the remediation plan's independent finding that no production code anywhere constructs a PeerObservation at all.
Two machines, one operator, one administrative identity. Per this repo's own CLAUDE-instru.md hardware section and orama-system CLAUDE.md § 8, the live topology is Mac (Ollama + qwen3.5:9b-nvfp4 + bge-m3, L2/L3 roles) + one Windows RTX3080 (LM Studio, L1 inference) — not the aspirational L3=1-3/L2=2-5/L1=10-100 range in Section 1's table, which describes a future scale that hasn't materialized. Both machines are configured, administered, and physically controlled by the same single person. If the operator's own Mac (the primary node) is compromised, a witness quorum spanning Mac+Win provides no real defense — the same operator's credentials/access already control both halves of any quorum. Per-pattern verdict at current scale:
- P5 (witness quorum): negligible real defense — quorum among 2 self-owned, co-administered machines does not resist a compromise of either.
- P6 (reputation-decay): negligible real defense — there is no population of distinct, independently-operated witnesses for reputation to differentiate between.
- P13 (equivocation detection): negligible real defense today — equivocation detection catches a witness contradicting itself, but with one witness and no adversarial second party, "contradiction" degrades to "this node's own state changed," which is already handled by the existing monotonic-epoch/sequence gate, not by equivocation logic.
Grepped docs/LESSONS.md for real incident history (DHCP/network/crash/timeout/offline keywords, 60+ matches reviewed). Every incident found is self-inflicted operational flakiness, not adversarial behavior:
- DHCP reassignment moved the Win node's IP, breaking
openclaw.jsonconfig until re-discovery (docs/LESSONS.md:1323,:1956). - GPU crash recovery, rapid-model-reload-burns-GPU, 30s cooldown enforcement (
docs/LESSONS.md:770-808). - Network probe timeouts/hangs (
ncwith no-wflag hanging startup,docs/LESSONS.md:1243;git statustimeouts,:1380-1407). - Process/gateway crashes, "Not onboarded" bugs, Node version mismatches, port collisions (
docs/LESSONS.md:1355,:1929,:1939).
Zero incidents resembling a forged observation, a detected Sybil identity, an equivocating adversary, or any malicious third party. This is decisive, not merely suggestive: the actual failure population this system has generated to date is 100% "my own flaky/buggy node," 0% "an attacker forged an identity to fool my quorum."
Descope P5/P6/P13 from the next increment. The BFT/Sybil-resistant machinery these patterns implement solves a threat (adversarial strangers with economic incentive to attack a quorum they have no stake in) that does not match this deployment's actual trust boundary (two machines, one operator, zero observed adversarial incidents in the project's full operational history). Wiring evaluate_observation() as scoped would ship "working" code against a pipeline that structurally has nothing to detect at current scale — P5/P6/P13's own gates would sit permanently dormant (single-witness inputs never trigger quorum/reputation/equivocation logic in any meaningful way).
Recommended alternative for the actual problem (per the remediation plan's own framing — "the risk is bugs/crashes, not Byzantine attackers"): a lean reachability/liveness model matched to the real failure mode — retry-with-backoff, a monotonic epoch/sequence gate (already implemented and useful regardless of this decision), and a health-check consumer that treats _probe() results as authoritative without needing a quorum to trust its own configured backend. If Fleet Mode later introduces genuinely external, untrusted tenants (a real change in trust boundary, not just more self-owned nodes), P5/P6/P13 should be revisited from this addendum's Q1/Q2 questions, not resumed by default.
Not touched by this verdict: P9 (reorder buffer), P18 (bounded caches), P2 (k-bucket maintenance) — already shipped in PR #205, useful regardless of the threat model (they protect against out-of-order/memory-growth issues that occur even with zero adversaries), not contingent on this addendum.
PATTERN-MULTIAGENT-EXECUTION-PLAN.md— Deep-research-driven execution plan for the 20 P2P security patterns (P1–P20) and 16 gaps (G1–G16) analyzed here.2026-07-11-state-transition-manager-integration-plan.md— Concrete Perpetua-Tools milestone that wires P2/P5/P6/P13/P19 into a singlePeerObservationsecurity-decision pipeline and unblocks Track D (Fleet Mode Integration).
End of Multiagent Swarm Security Analysis. Ready for Phase 1b roadmap execution.