docs: add peer session persistence and MCP notification to vision

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-08 00:15:49 +01:00
parent 21cb6efced
commit b315b31cc9

View File

@@ -345,6 +345,32 @@ A structured logging system where peers report errors, warnings, and debug info
**Effort:** 1-2 days.
### 23. Peer session persistence ("welcome back")
When a peer disconnects, their state is lost (groups, profile, visibility, stats, summary). On reconnect they start blank. Persist peer state so returning peers resume where they left off.
**What persists (keyed by meshId + memberId):**
- Groups and roles
- Profile (avatar, title, bio, capabilities)
- Visibility setting
- Last summary
- Cumulative stats (messages, tool calls across all sessions)
- Last seen timestamp
**What resets:** status (always "idle" on connect), WebSocket/presenceId (ephemeral).
**Reconnect flow:**
1. Peer sends hello with same `memberId`
2. Broker looks up `peer_state` table for (meshId, memberId)
3. If found: restore groups, profile, visibility, stats — hello fields take precedence if explicitly set
4. Enriched `hello_ack` includes `restored: true` and previous summary
5. System notification: `"Welcome back, Alice! Last seen 2h ago. Restored: @frontend:lead, @devops:member"`
6. On disconnect: upsert current state to `peer_state`
**Why:** AI sessions restart often (context limits, crashes, new tasks). Without persistence, every reconnect requires manual group joins and profile setup. With it, the mesh remembers who you are.
**Effort:** Half day.
---
## Suggested build order
@@ -374,6 +400,7 @@ A structured logging system where peers report errors, warnings, and debug info
| 21 | SDK (@claudemesh/sdk) | 1 day | Non-Claude-Code clients | **DONE** `7e102a2` |
| 22 | Telegram connector | 1-2 days | Reach beyond Claude Code | **DONE** `fe92853` |
| 23 | Mesh telemetry + debugging | 1-2 days | Self-diagnosing mesh | |
| 24 | Peer session persistence | Half day | "Welcome back" on reconnect | |
---