# memory-optimizer

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.

- subagent · `type=agent` · Claude Code, Codex, Cursor · ★ 850 repo stars
- Author: ruvnet
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/ruvnet/agentic-flow/tree/HEAD/.claude/agents/reasoning/memory-optimizer.md
- Updated: 2026-10-26
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/agents/memory-optimizer

## What it 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.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/agents/memory-optimizer.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/memory-optimizer.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/memory-optimizer.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/ruvnet/agentic-flow/tree/HEAD/.claude/agents/reasoning/memory-optimizer.md

## When to use it
- merge similar memory patterns
- prune stale or contradictory entries
- assess the quality of stored guidance

## Example prompts
- 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.

## Similar
- [ReasoningBank with AgentDB](https://affpapa.org/en/nevibecode/skills/reasoningbank-with-agentdb.md) — skill · 1100 installs
- [tool-design](https://affpapa.org/en/nevibecode/skills/tool-design.md) — skill · 299 installs
- [deep-agents-memory](https://affpapa.org/en/nevibecode/skills/deep-agents-memory.md) — skill · 20000 installs
- [memory-discipline](https://affpapa.org/en/nevibecode/skills/memory-discipline.md) — skill · 4900 installs
- [memory-md-management](https://affpapa.org/en/nevibecode/skills/memory-md-management.md) — skill · 3700 installs
- [parallel-memory](https://affpapa.org/en/nevibecode/skills/parallel-memory.md) — skill · 2900 installs

From the same set: [ruvnet/agentic-flow](https://affpapa.org/en/nevibecode/by/ruvnet/agentic-flow.md) — 76 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
