memory
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".
Best use case
memory is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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".
Teams using memory should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/memory/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How memory Compares
| Feature / Agent | memory | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# 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
1. **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.
2. **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.
3. **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.
4. **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.
5. **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.
6. **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:**
```bash
/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 timestampsRelated Skills
memory-kit
Persistent context management for Claude Code sessions. Save, load, update, share, and audit session memory via MEMORY.md. Prevents context loss on compaction or session restart. Use when starting a session, before compaction, syncing context across teammates, or pruning stale memory entries. Trigger with "save memory", "load memory", "memory audit", "memory share".
detecting-memory-leaks
Detect potential memory leaks and analyze memory usage patterns in code. Use when troubleshooting performance issues related to memory growth or identifying leak sources. Trigger with phrases like "detect memory leaks", "analyze memory usage", or "find memory issues".
memorystore-config
Memorystore Config - Auto-activating skill for GCP Skills. Triggers on: memorystore config, memorystore config Part of the GCP Skills skill category.
memory-profiler-setup
Memory Profiler Setup - Auto-activating skill for Performance Testing. Triggers on: memory profiler setup, memory profiler setup Part of the Performance Testing skill category.
schema-optimization-orchestrator
Multi-phase schema optimization workflow orchestrator. Creates session directories, spawns phase agents sequentially, validates outputs, aggregates results. Trigger: "run schema optimization", "optimize schema workflow", "execute schema phases"
test-skill
Test skill for E2E validation. Trigger with "run test skill" or "execute test". Use this skill when testing skill activation and tool permissions.
example-skill
Brief description of what this skill does and when the model should activate it. Use when [describe the user's intent or situation]. Trigger with "example phrase", "another trigger", "/example-skill".
testing-visual-regression
Detect visual changes in UI components using screenshot comparison. Use when detecting unintended UI changes or pixel differences. Trigger with phrases like "test visual changes", "compare screenshots", or "detect UI regressions".
generating-unit-tests
Test automatically generate comprehensive unit tests from source code covering happy paths, edge cases, and error conditions. Use when creating test coverage for functions, classes, or modules. Trigger with phrases like "generate unit tests", "create tests for", or "add test coverage".
generating-test-reports
Generate comprehensive test reports with metrics, coverage, and visualizations. Use when performing specialized testing. Trigger with phrases like "generate test report", "create test documentation", or "show test metrics".
orchestrating-test-execution
Test coordinate parallel test execution across multiple environments and frameworks. Use when performing specialized testing. Trigger with phrases like "orchestrate tests", "run parallel tests", or "coordinate test execution".
managing-test-environments
Test provision and manage isolated test environments with configuration and data. Use when performing specialized testing. Trigger with phrases like "manage test environment", "provision test env", or "setup test infrastructure".