| name | memory-compress |
| description | Fact-dense rewrite of agent memory prose (tier-0 notes, digests) without
losing technical substance. Companion to /memory-distill. Zero external deps.
|
Memory Compress
Optional brevity pass for memory content — not a full distillation (no
tier promotion). Goal: same facts, fewer tokens, so session loads stay lean.
When
| Caller | When |
|---|
/memory-distill | Optional pre-step on raw tier-0 rows before digest LLM (if user asks, or MEMORY_COMPRESS=1) |
| Manual | User asks to compress cortex/lessons/memory prose |
Skip when MEMORY_COMPRESS=0 or content is already bullet-dense.
Rules (MUST)
- Preserve every technical fact — names, paths, IDs, versions, constraints,
decisions, “do not” rules
- Prefer bullets over paragraphs; one fact per line when possible
- Drop greetings, hedges, restatements, “as discussed”, process narration
- Keep code snippets, commands, and error strings byte-exact
- Do not invent facts or change meaning
- Do not delete archived markers or tier semantics — this is prose only
Output shape
- Fact one (path/to/file: detail)
- Fact two — constraint
- DO NOT: <rule>
Target: roughly 40–60% fewer tokens on verbose narrative; already-tight
bullets may stay near 100%.
Protocol snippet
_gc=$(git rev-parse --git-common-dir 2>/dev/null) \
&& MROOT=$(cd "$(dirname "$_gc")" && pwd) \
|| MROOT=$(pwd)
MEMDB="$MROOT/.claude/memory/memory.db"
When rewriting .md fallback files (cortex.md / memory.md / lessons.md),
preserve headers; compress body sections only.