---
id: TASK-118.6
title: Add Automerge persistence to rnetwork CRM data
status: Done
assignee: []
created_date: '2026-03-16 00:06'
updated_date: '2026-03-16 00:50'
labels:
  - multiplayer
  - tier-2
milestone: Multiplayer Everything
dependencies: []
parent_task_id: TASK-118
priority: medium
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
rnetwork currently uses server-stored CRM data with WebSocket visualization. Add Automerge doc for persistent CRM relationship data that syncs via local-first stack alongside the existing WebSocket graph updates.

## New files:
- `modules/rnetwork/schemas.ts` — NetworkDoc with contacts, relationships, delegations
- `modules/rnetwork/local-first-client.ts` — CRUD for CRM data

## Schema:
```
NetworkDoc {
  meta: { module: 'network', collection: 'crm', version: 1 }
  contacts: Record<string, { did, name, role, tags[], addedBy, addedAt }>
  relationships: Record<string, { fromDid, toDid, type, weight, note }>
  graphLayout: { positions: Record<did, {x,y}>, zoom, pan }
}
```

Note: Delegations already in PostgreSQL (trust-engine) — this is for CRM metadata only.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 CRM contact metadata syncs via Automerge between space members
- [ ] #2 Graph layout positions persist and sync
- [ ] #3 Existing WebSocket delegation UI still works unchanged
- [ ] #4 Demo mode works with local-only data
<!-- AC:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
schemas.ts + local-first-client.ts created
<!-- SECTION:NOTES:END -->
