Active memory management and maintenance for Claude Code framework. Keep project context fresh, organized, and relevant. The Memory plugin provides tools to manage Claude Code's persistent memory system. It helps you review memory state, update memory files interactively, and clean up stale entries. This ensures Claude maintains accurate, relevant context across sessions while avoiding outdated in
Add this skill
npx mdskills install applied-artificial-intelligence/memoryComprehensive memory management with garbage collection, interactive updates, and performance tracking
Active memory management and maintenance for Claude Code framework. Keep project context fresh, organized, and relevant.
The Memory plugin provides tools to manage Claude Code's persistent memory system. It helps you review memory state, update memory files interactively, and clean up stale entries. This ensures Claude maintains accurate, relevant context across sessions while avoiding outdated information.
Claude Code uses a file-based memory system located in .claude/memory/:
.claude/memory/
├── project_state.md # Current project status and structure
├── decisions.md # Architectural and design decisions
├── lessons_learned.md # Insights and patterns discovered
├── conventions.md # Code style and naming conventions
├── dependencies.md # External libraries and tools
└── [domain-specific].md # Custom memory files
How it works:
/memory-reviewDisplay current memory state with timestamps, sizes, and staleness indicators.
What it does:
.claude/memory/Usage:
/memory-review # Review all memory files
Output Example:
Memory Files Review
===================
project_state.md
Size: 3.2 KB (82 lines)
Modified: 2 days ago
Status: ✅ Current
decisions.md
Size: 5.4 KB (148 lines)
Modified: 1 week ago
Status: ✅ Current
lessons_learned.md
Size: 8.1 KB (210 lines)
Modified: 45 days ago
Status: ⚠️ Stale (consider reviewing)
conventions.md
Size: 1.8 KB (52 lines)
Modified: 3 days ago
Status: ✅ Current
---
Total Memory: 18.5 KB (492 lines)
Stale Files: 1
Recommendation: Review lessons_learned.md
When to use:
/memory-updateInteractive memory maintenance with add, update, remove, and relocate operations.
What it does:
Usage:
/memory-update # Interactive memory update workflow
Workflow:
Operations:
Add New Entry:
/memory-update
> Operation: add
> File: decisions.md
> Entry: "Use PostgreSQL for data persistence (MongoDB too complex for our use case)"
Update Existing Entry:
/memory-update
> Operation: update
> File: dependencies.md
> Find: "React 17.0.2"
> Replace: "React 18.2.0 (upgraded for concurrent features)"
Remove Outdated Entry:
/memory-update
> Operation: remove
> File: lessons_learned.md
> Entry: "Initial SQLite approach was too slow (replaced with PostgreSQL)"
Relocate Entry:
/memory-update
> Operation: relocate
> From: lessons_learned.md
> To: decisions.md
> Entry: "GraphQL adoption decision"
> Reason: "More appropriate in decisions.md"
When to use:
/memory-gcGarbage collection for stale memory entries - identify and clean up obsolete content.
What it does:
Usage:
/memory-gc # Analyze and suggest cleanup
/memory-gc --auto # Auto-clean with confirmation
/memory-gc --dry-run # Show what would be cleaned (no changes)
Staleness Criteria:
Output Example:
Memory Garbage Collection
=========================
Stale Entries Found: 8
decisions.md
⚠️ "Use MongoDB for persistence" (45 days old)
Superseded by: "Use PostgreSQL" (2 days ago)
Recommendation: Remove
lessons_learned.md
⚠️ "TypeScript strict mode causes too many issues" (60 days old)
Status: No longer relevant (now using strict mode successfully)
Recommendation: Remove or update
⚠️ "Initial API design with REST" (90 days old)
Superseded by: "GraphQL adoption" (10 days ago)
Recommendation: Archive
---
Suggested Removals: 3
Suggested Updates: 2
Suggested Archives: 3
Apply changes? [y/N]
Safety Features:
.claude/memory/.backup/)When to use:
/index [--update] [--refresh] [focus_area]Create and maintain persistent project understanding through comprehensive project mapping.
What it does:
Usage:
/index # Create initial project index
/index --update # Update existing index
/index --refresh # Rebuild index from scratch
/index backend # Focus on backend code
Output:
.claude/index/ - Project mapping and analysisWhen to use:
/handoffCreate transition documents with context analysis for session continuity.
What it does:
Usage:
/handoff # Create handoff document
Output:
.claude/transitions/YYYY-MM-DD_NNN/handoff.mdWhen to use:
Next step: Use /clear then /continue to resume from this handoff
/continueAuto-load and resume from the most recent handoff document with verification.
What it does:
.claude/transitions/latest/handoff.md symlinkUsage:
# After /clear, simply:
/continue # Auto-loads latest handoff
Output Example:
📋 Continuing from: .claude/transitions/2025-10-18_005/handoff.md
Session Focus: Plugin v1.0.0 delivery
Active Work: Completed work unit 009, shipped v1.0.0
Next Steps: Applied AI website work
Main Takeaways:
- Plugin architecture refactored to 6 focused plugins
- Web development plugin fixed and ready
Ready to continue. What would you like to work on?
When to use:
/clear to resume workWorkflow:
# End session
/handoff
# Clear conversation
/clear
# Resume in new session
/continue
/performanceView token usage and performance metrics across all components.
What it does:
Usage:
/performance # View current metrics
Output Example:
Token Usage Breakdown
=====================
Messages (conversation): 45,234 tokens (30%)
MCP Tools (servers): 18,500 tokens (12%)
Memory Files (context): 8,100 tokens (5%)
System (prompt): 12,000 tokens (8%)
Reserved (buffer): 15,000 tokens (10%)
Available: 51,166 tokens (35%)
Total: 150,000 / 200,000 (75%)
Status: ⚠️ Warning - Optimize proactively
Recommendations:
- Consider /clear after /handoff (free conversation tokens)
- Disable unused MCP servers (12K tokens)
- Review memory files for optimization
When to use:
The memory plugin integrates with other commands to suggest updates automatically:
After /ship:
Feature shipped: User authentication
Memory Update Suggestions:
1. Add to decisions.md:
"Use JWT for authentication (bcrypt for password hashing)"
2. Add to lessons_learned.md:
"Pre-hashing passwords before validation improves security"
3. Update dependencies.md:
"Added: jsonwebtoken v9.0.0, bcrypt v5.1.0"
Run /memory-update to apply? [y/N]
After /fix:
Fixed: Memory leak in data processing
Memory Update Suggestion:
Add to lessons_learned.md:
"Large datasets must be processed in streams, not loaded entirely into memory"
Run /memory-update to apply? [y/N]
After /review:
Code review completed: Found 12 issues
Memory Update Suggestion:
Add to conventions.md:
"Always validate input before processing (3 validation issues found today)"
Run /memory-update to apply? [y/N]
Purpose: Current project status and structure Update Frequency: Weekly or at major milestones Contents:
Example:
# Project State
## Overview
Building user authentication system for SaaS platform.
## Current Status
Phase: Implementation (Week 3 of 4)
Active Work: OAuth integration
Tests: 87% coverage
## Structure
- `/src/auth` - Authentication modules
- `/src/users` - User management
- `/tests/integration` - Integration tests
## Recent Changes
- 2024-10-15: Migrated from MongoDB to PostgreSQL
- 2024-10-12: Added JWT authentication
Purpose: Architectural and design decisions Update Frequency: When making decisions Contents:
Example:
# Architectural Decisions
## Database: PostgreSQL
**Decision**: Use PostgreSQL instead of MongoDB
**Rationale**:
- Need ACID transactions
- Complex relational data
- Team expertise in SQL
**Date**: 2024-10-15
## Authentication: JWT
**Decision**: JWT-based authentication
**Rationale**:
- Stateless (scales better)
- Standard format
- Easy client integration
**Date**: 2024-10-12
Purpose: Insights and patterns discovered Update Frequency: When learning something valuable Contents:
Example:
# Lessons Learned
## Stream Large Datasets
**Context**: Processing 10GB CSV files
**Problem**: Loading entire file into memory caused crashes
**Solution**: Use streaming with 100MB chunks
**Lesson**: Always stream data >1GB
**Date**: 2024-10-10
## Pre-hash Passwords
**Context**: User authentication implementation
**Problem**: Hashing during validation was slow
**Solution**: Hash passwords before storing
**Lesson**: Expensive operations should happen once
**Date**: 2024-10-12
Purpose: Code style and naming conventions Update Frequency: When establishing patterns Contents:
Example:
# Conventions
## Naming
- **Files**: kebab-case (user-service.js)
- **Classes**: PascalCase (UserService)
- **Functions**: camelCase (getUserById)
- **Constants**: UPPER_SNAKE (MAX_RETRIES)
## Testing
- Test files: `*.test.js`
- One describe block per function
- Test structure: Arrange, Act, Assert
- Coverage target: >80%
## File Organization
- One class per file
- Max 300 lines per file
- Group related functions
Purpose: External libraries and tools Update Frequency: When adding/updating dependencies Contents:
Example:
# Dependencies
## Core Libraries
- **express**: 4.18.2 (Web framework)
- **postgresql**: 14.5 (Database)
- **jsonwebtoken**: 9.0.0 (Authentication)
- **bcrypt**: 5.1.0 (Password hashing)
## Development Tools
- **jest**: 29.3.1 (Testing)
- **eslint**: 8.28.0 (Linting)
- **prettier**: 2.8.0 (Formatting)
## Services
- **GitHub**: Code hosting
- **AWS RDS**: PostgreSQL hosting
- **Sentry**: Error monitoring
Auto-reflection points:
/explore complete: Suggest project_state update/plan created: Suggest decisions.md entries/ship complete: Prompt for lessons_learnedAuto-reflection points:
/review complete: Suggest conventions updates/fix applied: Prompt for lessons_learned/test coverage: Update quality metrics/status shows memory state/cleanup can archive old memory/audit validates memory structure.claude/config.json){
"memory": {
"autoReflection": true,
"staleThresholdDays": 30,
"maxMemorySizeKB": 25,
"autoBackup": true,
"gcFrequency": "monthly"
}
}
{
"memory": {
"reflectionTriggers": {
"ship": true,
"fix": true,
"review": true,
"explore": false
}
}
}
{
"memory": {
"gc": {
"autoClean": false,
"requireConfirmation": true,
"createBackup": true,
"staleThresholdDays": 30
}
}
}
None - Memory plugin is standalone
Graceful Degradation: All commands work without MCP tools.
The memory plugin tracks:
View with:
/memory-review
/status verbose
.claude/memory/staleThresholdDays in config.claude/archives/autoReflection: true/memory-update directly# Review current memory (likely empty)
/memory-review
# Add initial project state
/memory-update
> add project_state.md
> "New SaaS authentication project, using Node.js + PostgreSQL"
# Document initial decisions
/memory-update
> add decisions.md
> "Technology stack: Node.js, Express, PostgreSQL, JWT"
# Ship feature
/ship --pr
# Auto-reflection suggests updates
Memory Update Suggestions:
1. Add decision: "Use JWT for authentication"
2. Add lesson: "Pre-hash passwords for performance"
# Apply suggestions
/memory-update
> (apply suggestions)
# Review updated state
/memory-review
# Review current state
/memory-review
# Shows: lessons_learned.md is 45 days old
# Run garbage collection
/memory-gc --dry-run
# Shows: 5 stale entries found
# Apply cleanup
/memory-gc
> Confirm cleanup? y
# Verify
/memory-review
# Shows: Memory optimized, all files current
MIT License - see LICENSE for details.
Version: 1.1.0 Category: Core Commands: 7 (memory-review, memory-update, memory-gc, index, handoff, continue, performance) Dependencies: None MCP Tools: Optional (sequential-thinking)
Best experience: Claude Code
/plugin marketplace add applied-artificial-intelligence/memoryThen /plugin menu → select skill → restart. Use /skill-name:init for first-time setup.
Other platforms
Install via CLI
npx mdskills install applied-artificial-intelligence/memoryMemory Plugin is a free, open-source AI agent skill. Active memory management and maintenance for Claude Code framework. Keep project context fresh, organized, and relevant. The Memory plugin provides tools to manage Claude Code's persistent memory system. It helps you review memory state, update memory files interactively, and clean up stale entries. This ensures Claude maintains accurate, relevant context across sessions while avoiding outdated in
Install Memory Plugin with a single command:
npx mdskills install applied-artificial-intelligence/memoryThis downloads the skill files into your project and your AI agent picks them up automatically.
Memory Plugin works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Codex, Gemini Cli, Amp, Roo Code, Goose, Opencode, Trae, Qodo, Command Code. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.