Skip to main content
command CX Codex

memory-compress — Claude Code command: compress the memory tree

memory-compress shrinks the semantic memory tree by merging near-identical nodes and dropping duplicates, while key checkpoints stay put.

no license ★ 1,357 updated 2026-03-01

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/memory-compress.md
Open on GitHub

What memory-compress does

The command opens the active tree at .wfgy/trees/active_tree.json and measures it first: node count, mean ΔS, how tightly nodes cluster. From those numbers it picks what to squeeze — pairs below ΔS 0.2, repeated insights, dead-end branches.

Four moves do the work. Close nodes merge into one with a combined insight. Intermediate steps drop out of a path so its ends link directly. A cluster folds into a summary node, and duplicates or loops get deleted. Checkpoints, branch points, nodes above ΔS 0.7 and anything marked important are held back.

Rollback runs through /memory:restore and a checkpoint, so /memory:checkpoint comes first — a compression without one leaves nothing to return to. Strength is set with --level (light in the examples), and --dry-run shows the plan without writing. The log lands in .wfgy/logs/compression.log.

What it helps with

  • shrink a memory tree before a new session
  • merge nodes that say nearly the same thing
  • strip duplicate insights and circular links
  • cut the tree down to a set node count
  • preview the compression before writing anything

Example prompts for the agent

  • Compress the memory tree, but just show me the plan first: /memory:compress --dry-run.
  • Compress down to 500 nodes with /memory:compress --target-nodes 500.
  • Only compress the stretch from node_100 to node_500: /memory:compress --from "node_100" --to "node_500".

How to install memory-compress

Manually: put the files in place

.claude/commands/memory-compress.md

Call it with /memory-compress. For all projects use ~/.claude/commands/

Questions about memory-compress

How do I install memory-compress in Claude Code?

Copy the command file into your project at .claude/commands/memory-compress.md, then call /memory:compress from the session.

What does memory-compress do?

It merges similar nodes in the semantic tree, simplifies redundant paths and removes duplicates, keeping checkpoints and branch points intact.

Can I undo a compression?

Yes, with /memory:restore pointed at a checkpoint taken beforehand. Without a pre-compression checkpoint there is nothing to restore.

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →

From the same set112

The whole set →
task-from-pr task-from-pr is a Claude Code command that transfers GitHub pull request details to a Linear task, linking PR work with project tasks. CX Codex +1 ★ 1,357repo stars memory-merge The memory-merge command consolidates multiple semantic tree nodes into one, removing duplicates and grouping related concepts under a single node. CX Codex +1 ★ 1,357repo stars sync-conflict-resolver The sync-conflict-resolver command for Claude Code identifies and resolves data conflicts between GitHub issues and Linear tasks, merging non-conflicting fields or applying a chosen strategy. CX Codex +1 ★ 1,357repo stars standup-report standup-report builds daily standup updates from Git, GitHub, and Linear, with output suited to a team summary, Slack, or email. CX Codex +1 ★ 1,357repo stars memory-prune memory-prune cleans low-value, broken, and outdated nodes from your semantic memory tree. Keeps project context lean and responsive. CX Codex +1 ★ 1,357repo stars elevenlabs-transcribe elevenlabs-transcribe is a Claude Code skill that sends audio and video files to ElevenLabs Scribe v2 and returns a transcript. Set the language, output file, or speaker count. CX Codex +1 ★ 1,357repo stars bigcommerce-api Skill for BigCommerce API: REST, GraphQL Storefront, webhooks, OAuth. Guides through integrations, headless storefronts, and marketplace app development. CX Codex +1 ★ 1,357repo stars devops-incident-responder The devops-incident-responder subagent for Claude Code investigates production outages, analyzes pod errors, and drafts rollback plans during service degradation. CX Codex ★ 1,357repo stars

Project sponsors

Companies that keep this analytics open