Memory
Overview
Memory provides persistent context across Claude Code sessions by storing and retrieving project decisions, user preferences, and coding conventions from a local JSON file. When a new session starts, stored memories load automatically so previously established patterns carry forward without re-explanation.
Prerequisites
- Project memory file at
.claude/memories/project_memory.json (created automatically on first memory save)
- Read and Write permissions for the
.claude/memories/ directory
- Claude Never Forgets plugin installed (
/plugin install yldrmahmet/claude-never-forgets)
Instructions
- Access stored memories. On session start, locate and read the memory file at
.claude/memories/project_memory.json using the Read tool. Parse the JSON structure containing timestamped memory entries. See ${CLAUDE_SKILL_DIR}/references/implementation.md for the full retrieval workflow.
- Match memories to current context. Scan memory entries for keywords and topics relevant to the current task. Extract applicable decisions (e.g., "use pnpm instead of npm"), architectural patterns, library choices, and coding style preferences.
- Apply memories silently. Incorporate remembered preferences into responses and tool usage without announcing them. When a memory dictates a package manager, testing framework, or naming convention, follow it automatically.
- Store new memories. When significant decisions occur -- library selections, architectural choices, user-stated preferences, or tool rejections -- write them to the memory file with a timestamp. Add entries via the
/remember command or through automatic capture of conversation signals.
- Resolve conflicts. When a stored memory contradicts a current explicit request, prioritize the current request. Flag the conflict if appropriate and update the memory entry to reflect the new decision. Remove outdated memories that no longer apply.
- Handle cleanup. When memory entries exceed 10, consolidate by removing noise (greetings, acknowledgments) and preserving high-value entries (preferences, decisions, corrections). The cleanup threshold is configurable in
hooks/stop_cleanup.py.
Output
- Automatic loading of stored memories at session start
- Silent application of remembered preferences to tool usage and responses
- New memory entries written with timestamps for significant decisions
- Consolidated memory file after cleanup (preserves important entries, removes noise)
- Explicit memory listing via
/memories command
Error Handling
| Error |
Cause |
Solution |
| Memory file not found |
First session or file deleted |
Initialize a new memory file at .claude/memories/project_memory.json with an empty JSON structure |
| Conflicting memories |
Multiple entries contradict each other |
Apply the most recent memory; suggest cleanup via /forget to remove outdated entries |
| Invalid memory format |
File corrupted or manually edited with syntax errors |
Back up the existing file, recreate with valid JSON structure, restore recoverable entries |
| Permission denied |
File or directory lacks read/write permissions |
Check file permissions on .claude/memories/; request necessary access or use an alternative storage location |
Examples
Automatic preference recall across sessions:
Session 1:
User: "Always use Vitest instead of Jest for this project"
→ Stored to project_memory.json
Session 2:
User: "Add tests for the auth module"
→ Memory loaded: "use Vitest instead of Jest"
→ Test files created with Vitest syntax automatically
Manual memory management:
/remember "This project uses Tailwind CSS v4 with the Vite plugin"
/remember "Deploy to Cloudflare Workers, not Vercel"
/memories # Lists all stored memories with timestamps
/forget "Vercel" # Removes the Vercel-related memory
Tool rejection captured as correction:
set -euo pipefail
User declines a suggested `npm install` action
→ Memory stored: "User prefers pnpm over npm"
→ Future sessions use pnpm automatically
Resources
${CLAUDE_SKILL_DIR}/references/implementation.md -- Step-by-step guide for accessing, applying, updating, and resolving memory conflicts
${CLAUDE_SKILL_DIR}/references/errors.md -- Detailed error scenarios with recovery procedures
/remember [text] -- Add a new memory entry manually
/forget [text] -- Remove a matching memory from storage
/memories -- Display all currently stored memories with timestamps
Source: jeremylongshore/claude-code-plugins-plus-skills → skills/.curated/memory/SKILL.md
Also appears in: jeremylongshore/claude-code-plugins-plus-skills/plugins/community/claude-never-forgets/skills/memory/SKILL.md
1---
2name: memory
3description: "'Execute extract and use project memories from previous sessions for context-aware assistance. Use when recalling past decisions, checking project conventions, or understanding user preferences. Trigger with phrases like \"remember when\", \"like before\", or \"what was our decision about\". '"
4allowed-tools: "Read, Write"
5category: rag-memory-knowledge
6source_repo: jeremylongshore/claude-code-plugins-plus-skills
7source_path: "skills/.curated/memory/SKILL.md"
8source_url: https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/HEAD/skills/.curated/memory/SKILL.md
9metadata:
10 source: https://skillmd.com/skills/thedixitjain/memory
11---
12
13# Memory
14
15## Overview
16
17Memory provides persistent context across Claude Code sessions by storing and retrieving project decisions, user preferences, and coding conventions from a local JSON file. When a new session starts, stored memories load automatically so previously established patterns carry forward without re-explanation.
18
19## Prerequisites
20
21- Project memory file at `.claude/memories/project_memory.json` (created automatically on first memory save)
22- Read and Write permissions for the `.claude/memories/` directory
23- Claude Never Forgets plugin installed (`/plugin install yldrmahmet/claude-never-forgets`)
24
25## Instructions
26
271. **Access stored memories.** On session start, locate and read the memory file at `.claude/memories/project_memory.json` using the Read tool. Parse the JSON structure containing timestamped memory entries. See `${CLAUDE_SKILL_DIR}/references/implementation.md` for the full retrieval workflow.
282. **Match memories to current context.** Scan memory entries for keywords and topics relevant to the current task. Extract applicable decisions (e.g., "use pnpm instead of npm"), architectural patterns, library choices, and coding style preferences.
293. **Apply memories silently.** Incorporate remembered preferences into responses and tool usage without announcing them. When a memory dictates a package manager, testing framework, or naming convention, follow it automatically.
304. **Store new memories.** When significant decisions occur -- library selections, architectural choices, user-stated preferences, or tool rejections -- write them to the memory file with a timestamp. Add entries via the `/remember` command or through automatic capture of conversation signals.
315. **Resolve conflicts.** When a stored memory contradicts a current explicit request, prioritize the current request. Flag the conflict if appropriate and update the memory entry to reflect the new decision. Remove outdated memories that no longer apply.
326. **Handle cleanup.** When memory entries exceed 10, consolidate by removing noise (greetings, acknowledgments) and preserving high-value entries (preferences, decisions, corrections). The cleanup threshold is configurable in `hooks/stop_cleanup.py`.
33
34## Output
35
36- Automatic loading of stored memories at session start
37- Silent application of remembered preferences to tool usage and responses
38- New memory entries written with timestamps for significant decisions
39- Consolidated memory file after cleanup (preserves important entries, removes noise)
40- Explicit memory listing via `/memories` command
41
42## Error Handling
43
44| Error | Cause | Solution |
45|-------|-------|----------|
46| Memory file not found | First session or file deleted | Initialize a new memory file at `.claude/memories/project_memory.json` with an empty JSON structure |
47| Conflicting memories | Multiple entries contradict each other | Apply the most recent memory; suggest cleanup via `/forget` to remove outdated entries |
48| Invalid memory format | File corrupted or manually edited with syntax errors | Back up the existing file, recreate with valid JSON structure, restore recoverable entries |
49| Permission denied | File or directory lacks read/write permissions | Check file permissions on `.claude/memories/`; request necessary access or use an alternative storage location |
50
51## Examples
52
53**Automatic preference recall across sessions:**
54
55```
56Session 1:
57User: "Always use Vitest instead of Jest for this project"
58→ Stored to project_memory.json
59
60Session 2:
61User: "Add tests for the auth module"
62→ Memory loaded: "use Vitest instead of Jest"
63→ Test files created with Vitest syntax automatically
64```
65
66**Manual memory management:**
67
68```bash
69/remember "This project uses Tailwind CSS v4 with the Vite plugin"
70/remember "Deploy to Cloudflare Workers, not Vercel"
71/memories # Lists all stored memories with timestamps
72/forget "Vercel" # Removes the Vercel-related memory
73```
74
75**Tool rejection captured as correction:**
76
77```
78set -euo pipefail
79User declines a suggested `npm install` action
80→ Memory stored: "User prefers pnpm over npm"
81→ Future sessions use pnpm automatically
82```
83
84## Resources
85
86- `${CLAUDE_SKILL_DIR}/references/implementation.md` -- Step-by-step guide for accessing, applying, updating, and resolving memory conflicts
87- `${CLAUDE_SKILL_DIR}/references/errors.md` -- Detailed error scenarios with recovery procedures
88- `/remember [text]` -- Add a new memory entry manually
89- `/forget [text]` -- Remove a matching memory from storage
90- `/memories` -- Display all currently stored memories with timestamps
91
92---
93
94**Source:** [`jeremylongshore/claude-code-plugins-plus-skills`](https://github.com/jeremylongshore/claude-code-plugins-plus-skills) → `skills/.curated/memory/SKILL.md`
95
96**Also appears in:** `jeremylongshore/claude-code-plugins-plus-skills/plugins/community/claude-never-forgets/skills/memory/SKILL.md`