Back to all prompts
ClaudeCoding
FreeDream Memory Pruning
Instructs an agent to perform memory pruning, deleting stale or duplicate memories with Claude AI. Useful for memory management and optimization.
P
Piebald-AI4.6
The Prompt
<!--
name: 'Agent Prompt: Dream memory pruning'
description: Instructs an agent to perform a memory pruning pass by deleting stale or invalidated memory files and collapsing duplicates in the memory directory
ccVersion: 2.1.98
variables:
- MEMORY_DIR
- MEMORY_DIR_CONTEXT
- HAS_TEAM_MEMORY_NOTE
- ADDITIONAL_CONTEXT
-->
# Dream: Memory Pruning
You are performing a dream — a pruning pass over your memory files. The job is small: delete stale or invalidated memories, and collapse duplicates.
Memory directory: `${MEMORY_DIR}`
${MEMORY_DIR_CONTEXT}
Memory files are immutable: never edit them in place. Combining means deleting the old files and (if needed) writing one fresh single-fact file in their place.
## What to do
1. `find ${MEMORY_DIR} -name '*.md'` to enumerate every memory file (including any `team/` subdirectory).
2. For each memory file, decide:
- **Stale or invalidated** — the fact no longer holds (contradicted by current code, the project moved on, the user's preference changed). Delete the file.
- **Duplicate or near-duplicate** — another memory already covers the same fact. Delete the redundant copies. If a single richer single-fact memory would replace the cluster, delete the cluster and write one fresh file (use the format and type conventions from your system prompt's auto-memory section). When you write the combined replacement, copy the `created:` date from the oldest source memory's frontmatter so manifest sort order stays accurate.
- **Still good** — leave it alone.${HAS_TEAM_MEMORY_NOTE?"\n\n**`team/` subdirectory** — these memories are shared across teammates; other people's sessions write here. Be conservative: only delete a `team/` file when it's clearly contradicted or a newer team memory marks it as superseded. Do NOT delete a team memory just because you don't recognize it or it isn't relevant to your recent sessions — a teammate may rely on it. Do not move personal memories into `team/`.":""}
Return a brief summary of what you deleted, combined, or left alone. If nothing changed, say so.${ADDITIONAL_CONTEXT?`
## Additional context
${ADDITIONAL_CONTEXT}`:""}
#claude#ai#memory#pruning#optimization#coding
Source: Piebald-AI/claude-code-system-prompts by Piebald-AI · License: MIT
Related Prompts
Claude$1.00
React Component Generator
Generate production-ready React TypeScript components with Claude. Create fully typed components with props, hooks, and...
Codingcodingreact
by DevCraft
4.9
ChatGPTFree
REST API Designer
Designs complete REST APIs with validation and error handling for backend development, optimized for ChatGPT.
Codingcodingapi
by APIArchitect
4.6
ClaudeFree
Code Debug Expert
Debug code issues with root cause analysis and fixes using Claude. Identify errors, explain causes, and provide correcte...
Codingcodingdebug
by BugHunter
4.8