memory-optimizer — Claude Code subagent: features and setup
memory-optimizer is a Claude Code, Codex, and Cursor subagent that merges similar ReasoningBank memories and removes stale or conflicting patterns. It also checks memory quality.
no license ★ 850 updated 2026-10-26
.claude/agents/memory-optimizer.mdWhat memory-optimizer does
The memory-optimizer subagent maintains ReasoningBank by combining similar patterns, pruning weak entries, and checking whether stored guidance is specific and actionable. Its instructions also describe domain indexing, embedding caches, and nearest-neighbor search to support retrieval as memory grows.
Hooks run npx agentic-flow@latest reasoningbank status before work and npx agentic-flow@latest reasoningbank consolidate --auto afterward. Those commands use npx and the agentic-flow package. For Claude Code, place the agent file at .claude/agents/memory-optimizer.md; Codex and Cursor use their own agent paths.
What it helps with
- merge similar memory patterns
- prune stale or contradictory entries
- assess the quality of stored guidance
Example prompts for the agent
- Check ReasoningBank and merge patterns that cover the same idea.
- Find outdated or conflicting entries and remove them from active memory.
- Review ReasoningBank patterns for quality and improve retrieval.
How to install memory-optimizer
Manually: put the files in place
.claude/agents/memory-optimizer.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/memory-optimizer.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/memory-optimizer.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about memory-optimizer
How do I install memory-optimizer in Claude Code?
Add the agent file at .claude/agents/memory-optimizer.md.
What does memory-optimizer do?
It consolidates similar ReasoningBank patterns, prunes outdated or conflicting entries, and checks the quality of stored memories. Its hooks also check status and run automatic consolidation.
What does memory-optimizer need to run?
The hook commands use npx and the agentic-flow package.