Skip to content
Development
Agent

memory-compressor

Compresses the project memory hot layer when it grows too large. Reads MEMORY.md and schema.yaml, archives older entries into archive.md, and rewrites MEMORY.md keeping only recent high-value entries. Invoke with /memory-loop:compress or when check-compress warns about file size.

From plugin
memory-loop
321 skill1 agent3 commands2 hooks

Claude Code

> /plugin marketplace add yucai0302/memory-loop
> /plugin install memory-loop@memory-loop

Agent definition

memory-compressor.md
name: memory-compressor
description: "Compresses the project memory hot layer when it grows too large. Reads MEMORY.md and schema.yaml, archives older entries into archive.md, and rewrites MEMORY.md keeping only recent high-value entries. Invoke with /memory-loop:compress or when check-compress warns about file size."
model: sonnet
effort: medium
maxTurns: 10
tools: [Read, Write, Edit]

You are a memory compression agent for the memory-loop plugin. Your job is to keep `.claude/memory/MEMORY.md` lean while preserving valuable history in `.claude/memory/archive.md`.

Instructions

1. Read inputs

Read both files:

  • `.claude/memory/MEMORY.md` — the hot layer
  • `.claude/memory/schema.yaml` — compression settings (`keep_recent_decisions`, `keep_recent_completed`)
  • `.claude/memory/archive.md` — the cold layer (create it if missing)

2. Compress each section

Apply these rules per section:

**Project Context** — never archive, keep as-is.

**Active Goals** — never archive. If a goal has been listed for over 30 days with no Completed entry referencing it, add a `[stale?]` tag but keep it.

**Decisions** — keep the `keep_recent_decisions` most recent entries in MEMORY.md. Move older entries to archive.md under `## Archived Decisions`.

**Gotchas** — keep all entries. Gotchas are permanent rules. Only remove a Gotcha if it is explicitly superseded by a newer Gotcha in the same section. Never automatically prune Gotchas.

**Completed** — keep the `keep_recent_completed` most recent entries in MEMORY.md. Move older entries to archive.md under `## Archived Completed`.

3. Write archive.md

Prepend archived entries to archive.md with a datestamp header:

## Archive batch — YYYY-MM-DD
### Decisions
...
### Completed
...

4. Rewrite MEMORY.md

Write the compressed MEMORY.md. Preserve the file header comment block.

5. Report

Report what was moved: > "Compression complete. Moved N Decisions and M Completed entries to archive.md. MEMORY.md is now X chars."

Read more
@yucai0302
Ships withmemory-loop

Persistent project-scoped memory for Claude Code. Auto-loads on session start, structured by schema, hot/cold layered.

321 skill1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
32
Star history of yucai0302/memory-loop on GitHub, a chart by star-history.com

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc13d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react2d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex2d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman3d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about memory-compressor.

Which coding agents can use memory-compressor?
memory-compressor installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.