memory-merge — Claude Code command: merge semantic nodes
The memory-merge command consolidates multiple semantic tree nodes into one, removing duplicates and grouping related concepts under a single node.
no license ★ 1,357 updated 2026-03-01
.claude/commands/memory-merge.mdWhat memory-merge does
It operates on the project's semantic tree (WFGY-based): calculates pairwise ΔS compatibility, checks topic and insight overlap, then builds a new node with averaged metrics and merged context. Under the hood: semantic similarity scoring, conflict resolution, and index rebuilds.
The command takes a comma-separated list of node IDs. If ΔS exceeds 0.5 or insights contradict, the merge is blocked unless you pass --force. Drop the command file into .claude/commands/memory-merge.md.
What it helps with
- merge duplicate semantic tree nodes into a single entry
- consolidate closely related concepts without losing relationships
- remove memory redundancy while preserving context
- resolve contradictions between nodes during consolidation
Example prompts for the agent
- Merge nodes
auth_jwt_001andauth_oauth_002into one - Consolidate nodes from list
node_a, node_b, node_cand show what gets lost - Run
/memory:merge "user_model_v1,user_model_v2" --preview
How to install memory-merge
Manually: put the files in place
.claude/commands/memory-merge.mdCall it with /memory-merge. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/memory-merge.mdCall it with /prompts:memory-merge. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/memory-merge.prompt.mdManually: put the files in place
.gemini/commands/memory-merge.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about memory-merge
How to install memory-merge in Claude Code?
Place the file in .claude/commands/memory-merge.md — the command becomes available as /memory:merge.
What does memory-merge do?
It merges semantic tree nodes: computes pairwise similarity, synthesizes a shared insight, averages metrics, and updates all references to the merged nodes.
When will memory-merge refuse to merge nodes?
When ΔS between nodes exceeds 0.5, insights conflict, or a node is marked protected. The --force flag overrides these checks.