| 1 | # Multi-agent write v1 |
| 2 | |
| 3 | Тело секции `multi-agent-write-protocol-v1` из `agent-notes.md`. Hub оркестрации: `knowledge/worlds/agent-orchestration/`. |
| 4 | |
| 5 | <!-- section:multi-agent-write-protocol-v1 --> |
| 6 | ## Multi-Agent Write Protocol v1 |
| 7 | - Context: Auto mode may rotate models/agents inside one long-running workflow. |
| 8 | - Goal: prevent note corruption, overwrite races, and context drift under parallel writes. |
| 9 | |
| 10 | - Write roles: |
| 11 | - append-only channel: default for concurrent agents (safe by design). |
| 12 | - section-upsert channel: only for owned sections with lock metadata. |
| 13 | |
| 14 | - Lock metadata contract (for upsert-capable writes): |
| 15 | - owner_agent: <agent label> |
| 16 | - lease_started_at: <ISO datetime> |
| 17 | - lease_ttl_sec: <integer> |
| 18 | - base_revision: <latest known revision id or timestamp> |
| 19 | |
| 20 | - Safe write sequence: |
| 21 | 1) read hot context, |
| 22 | 2) acquire section lease (owner + ttl), |
| 23 | 3) perform minimal upsert, |
| 24 | 4) release lease marker, |
| 25 | 5) append short write-log entry. |
| 26 | |
| 27 | - Conflict policy: |
| 28 | - if lease active by another agent -> fallback to append-only note with "pending-merge" tag. |
| 29 | - if base revision changed during write -> do not force overwrite; append diff-intent and retry merge. |
| 30 | - never delete unknown sections during conflict resolution. |
| 31 | |
| 32 | - Merge policy: |
| 33 | - prefer additive merge first, |
| 34 | - if semantic conflict remains: keep both variants with conflict tags and resolve in next compaction pass. |
| 35 | |
| 36 | - Compaction policy: |
| 37 | - run periodic compact pass to merge duplicates and clear resolved conflict tags. |
| 38 | - preserve decision records and source anchors during compaction. |
| 39 | |
| 40 | - Reliability invariants: |
| 41 | - no blind overwrite, |
| 42 | - no destructive conflict resolution, |
| 43 | - every write traceable by owner and timestamp. |
| 44 | <!-- /section:multi-agent-write-protocol-v1 --> |
| 45 | |
| 46 | |