Agent skill
mem0-sync
Auto-sync session context, decisions, and patterns to Mem0 for cross-session continuity
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/mem0-sync
SKILL.md
Mem0 Auto-Sync
Automatically synchronize session context to Mem0 for seamless cross-session continuity. This skill executes MCP calls to persist decisions, patterns, and session summaries.
When to Use
- Automatically: Invoked at session end by
mem0-pre-compaction-sync.shhook - Manually: Run
/mem0-syncto force sync mid-session - After major decisions: Sync important architectural decisions immediately
Quick Sync
Execute these MCP calls based on the sync context provided:
1. Session Summary (Always)
mcp__mem0__add_memory({
text: "Session Summary: {task_summary}",
user_id: "{project}-continuity",
metadata: {
type: "session_summary",
status: "{status}",
has_blockers: {has_blockers},
has_next_steps: {has_next_steps}
},
enable_graph: true
})
2. Pending Decisions (If Any)
For each decision in the decision log that hasn't been synced:
mcp__mem0__add_memory({
text: "{decision_content}",
user_id: "{project}-decisions",
metadata: {
category: "{category}",
outcome: "success"
},
enable_graph: true
})
3. Agent Patterns (If Any)
For each agent pattern that was learned:
mcp__mem0__add_memory({
text: "{pattern_description}",
user_id: "{project}-agents",
agent_id: "skf:{agent_type}",
metadata: {
category: "{category}",
outcome: "{success|failed}"
},
enable_graph: true
})
4. Best Practices (If Generalizable)
For patterns that apply across projects:
mcp__mem0__add_memory({
text: "{best_practice}",
user_id: "skillforge-global-best-practices",
metadata: {
project: "{project}",
category: "{category}",
outcome: "success"
},
enable_graph: true
})
Sync Protocol
- Check availability: Verify Mem0 MCP is configured
- Read sync state: Load
.claude/coordination/.decision-sync-state.json - Execute MCP calls: Run add_memory for each item
- Update sync state: Mark synced items to prevent duplicates
- Confirm completion: Output sync summary
Key Patterns
Idempotent Sync
- Track synced decision IDs in sync state file
- Skip already-synced items
- Handle partial failures gracefully
Graph Memory
- Always use
enable_graph: truefor relationship extraction - Mem0 automatically creates entity/relation graphs
- Enables semantic search across related concepts
Scoped User IDs
{project}-continuity: Session summaries{project}-decisions: Architectural decisions{project}-agents: Agent-specific patternsskillforge-global-best-practices: Cross-project patterns
Related Skills
recall- Search and retrieve from Mem0context-compression- Compress context before syncbrainstorming- Generate decisions worth syncing
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?