⚠️ WORKFLOW INITIALIZATION
If starting a new session, first read workflow initialization:
mcp__plugin_swe_serena__read_memory("WF_INIT")
Follow WF_INIT instructions before executing this skill.
/swe-sync
Synchronize Serena memories between plugin and local project using ruv-swarm coordination.
Usage
/swe-sync # Sync all memories plugin → local
/swe-sync --dry-run # Preview changes without syncing
/swe-sync category=wf # Sync only WF_ workflow files
/swe-sync category=ref # Sync only REF_ reference files
/swe-sync direction=local-to-plugin # Sync local changes back to plugin
Process
Step 1: Initialize Swarm
// Initialize ruv-swarm with mesh topology
mcp__ruv-swarm__swarm_init({ topology: "mesh", strategy: "balanced", maxAgents: 5 })
// NOTE: daa_init is NOT needed here - we use agent_spawn + task_orchestrate pattern
// DAA is only needed when using daa_agent_create + daa_workflow_execute pattern
Step 2: Spawn Comparison Agents
// Spawn agents for parallel comparison
mcp__ruv-swarm__agent_spawn({ type: "analyst", name: "plugin-scanner", capabilities: ["file_analysis"] })
mcp__ruv-swarm__agent_spawn({ type: "analyst", name: "local-scanner", capabilities: ["file_analysis"] })
mcp__ruv-swarm__agent_spawn({ type: "coordinator", name: "diff-reporter", capabilities: ["synthesis"] })
Step 3: Orchestrate Comparison Task
mcp__ruv-swarm__task_orchestrate({
task: "Compare memory files between plugin and local project",
strategy: "parallel",
priority: "high"
})
Step 4: Execute File Comparison
Plugin Path: .claude/plugins/serena-workflow-engine/memories/
Local Path: .serena/memories/
Categories:
| Category | Pattern | Description |
|---|---|---|
| wf | wf/WF_*.md | Workflow state files |
| ref | ref/REF_*.md | Reference documentation |
| all | */*.md | All memory files |
Comparison Logic:
# For each plugin file in category:
for file in plugin_path/category/*.md; do
local_file="local_path/category/$(basename $file)"
if [ ! -f "$local_file" ]; then
echo "MISSING: $file"
elif ! diff -q "$file" "$local_file"; then
echo "DIFF: $file"
fi
done
# Check for local-only files
for file in local_path/category/*.md; do
plugin_file="plugin_path/category/$(basename $file)"
if [ ! -f "$plugin_file" ]; then
echo "LOCAL_ONLY: $file"
fi
done
Step 5: Report Results
Output a structured table:
## Sync Report
| Category | File | Status | Action |
|----------|------|--------|--------|
| wf | WF_INIT.md | SYNCED | - |
| wf | WF_NEW.md | MISSING_LOCAL | Copy to local |
| ref | REF_WM.md | DIFF | Update local |
Step 6: Execute Sync (if not dry-run)
⚠️ CRITICAL: Preserve subdirectory structure!
Files MUST be copied to their matching subdirectory:
memories/wf/WF_*.md→.serena/memories/wf/WF_*.mdmemories/ref/REF_*.md→.serena/memories/ref/REF_*.mdmemories/claude/CLAUDE*.md→.serena/memories/claude/CLAUDE*.md
Direction: plugin-to-local (default)
# Create subdirectory if needed
mkdir -p .serena/memories/{category}
# Copy preserving subdirectory
cp -f .claude/plugins/serena-workflow-engine/memories/{category}/{file} .serena/memories/{category}/{file}
Direction: local-to-plugin
cp -f .serena/memories/{category}/{file} .claude/plugins/serena-workflow-engine/memories/{category}/{file}
Direction: bidirectional
- Plugin newer → copy to local (preserve subdir)
- Local newer → copy to plugin (preserve subdir)
- Same age, different content → CONFLICT (report, don't overwrite)
❌ WRONG - DO NOT flatten to root:
cp memories/wf/WF_START.md .serena/memories/WF_START.md # WRONG!
✅ CORRECT - Preserve subdirectory:
cp memories/wf/WF_START.md .serena/memories/wf/WF_START.md # CORRECT!
Step 7: Verify Sync
Re-run comparison to confirm all files synced.
Exit
Output sync summary:
✅ Sync complete: X files synced, Y unchanged, Z conflicts
Return to calling workflow or end if standalone.
Swarm Shutdown
mcp__ruv-swarm__swarm_shutdown()
