Skip to content

feat(shared-memory): Cross-agent shared memory system — Master Plan (issue #382)#396

Closed
quangdang46 wants to merge 1 commit into
masterfrom
feature/shared-memory-382-v2
Closed

feat(shared-memory): Cross-agent shared memory system — Master Plan (issue #382)#396
quangdang46 wants to merge 1 commit into
masterfrom
feature/shared-memory-382-v2

Conversation

@quangdang46
Copy link
Copy Markdown
Owner

Summary

Master implementation plan for cross-agent shared memory — enabling all agents in a swarm to read/write shared data during coordinated workflows.

Closes #382

What This Adds

  1. SharedMemoryPool — swarm-scoped memory graph accessible by all agents
  2. SharedMemoryEntry — extends MemoryEntry with agent identity + provenance
  3. 5 shared memory tools — write, read, list, delete, cleanup
  4. SQLite persistence — shared memory survives server restarts
  5. Conflict resolution — optimistic locking + merge strategy
  6. MemoryUpdate notifications — broadcast to swarm via channel system
  7. Integration — with SharedContext, mempalace, team system, bus

Key Design Decisions

  • SQLite storage with embedding index for semantic search
  • Optimistic locking with version check for concurrent writes
  • Merge strategy for similar content (cosine similarity > 0.8)
  • Advisory locks with auto-expiry (5 min default)
  • MemoryUpdate notifications via existing channel system
  • SharedContext bridge for backward compatibility

New Crate: jcode-shared-memory (~2,470 lines)

crates/jcode-shared-memory/src/
├── lib.rs, entry.rs, pool.rs, store.rs
├── tools.rs, conflict.rs, notifications.rs
├── sync.rs, tests.rs

Tools

Tool Description
shared_memory_write Store memory visible to all swarm agents
shared_memory_read Read by ID or semantic search
shared_memory_list List with filters (category, author, tags)
shared_memory_delete Remove (author or coordinator only)
shared_memory_cleanup Clean stale/old memories

New Memory Categories

Category Use Case
Decision Architectural/design decisions
Finding Code review / analysis findings
Blocker Blocking issues
Learning Lessons learned during task
Requirement Confirmed requirements

Estimate

~2,587 lines new/modified code across 10 new files + 8 modified files.

Full Plan

docs/shared-memory-master-plan.md (1,072 lines)

Comprehensive 1,072-line implementation plan for cross-agent shared memory:
- SharedMemoryPool: swarm-scoped memory graph accessible by all agents
- SharedMemoryEntry: extends MemoryEntry with agent identity + provenance
- 5 tools: write/read/list/delete/cleanup
- SQLite persistence with embedding index
- Optimistic locking + merge strategy for conflict resolution
- MemoryUpdate notifications via channel system
- Integration with SharedContext, mempalace, team system, bus

Research: oh-my-claudecode, oh-my-openagent, oh-my-codex, jcode existing infra

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@quangdang46
Copy link
Copy Markdown
Owner Author

Closed — superseded by new approach. mempalace_rust already has coordination/ module with signals, leases, team sharing, mesh sync, actions, checkpoints, routines. New plan extends mempalace with 6 missing features instead of creating separate crate. See PR #397.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WIP] feat: Shared memory for multi-agent (cross-agent)

1 participant