skills/ai/persistent-memory/SKILL.md
Use when working on long-running projects or needing context across sessions. Covers memory architecture, privacy controls, efficient retrieval, and integration with claude-mem plugin. Apply when building features that span multiple sessions or need historical context.
npx skillsauth add liauw-media/codeassist persistent-memoryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Memory is context that survives sessions. Use it strategically—store what matters, retrieve efficiently, protect what's private.
MEMORY IS NOT FREE. RETRIEVE SELECTIVELY.
Every token of context costs. Don't dump entire history—search and fetch only what's relevant.
Benefits:
Without persistent memory:
┌─────────────────────────────────────────────────────────┐
│ MEMORY SYSTEM │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │
│ │ Capture │───▶│ Store │───▶│ Retrieve │ │
│ │ (Hooks) │ │ (SQLite + │ │ (Search) │ │
│ │ │ │ Vectors) │ │ │ │
│ └──────────────┘ └──────────────┘ └───────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │
│ │ Session │ │ Observations │ │ Summaries │ │
│ │ Lifecycle │ │ & Context │ │ & Answers │ │
│ └──────────────┘ └──────────────┘ └───────────┘ │
└─────────────────────────────────────────────────────────┘
# Install the plugin
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
# Restart Claude Code
# Memory automatically starts capturing
# Check the web UI
open http://localhost:37777
# Memory service should be running on port 37777
The plugin captures automatically via lifecycle hooks:
SessionStart - New session beginsUserPromptSubmit - User sends messagePostToolUse - Tool execution completeStop - Task completedSessionEnd - Session endsDO store:
DON'T store:
Use <private> tags to exclude sensitive content:
Here's the database config:
<private>
DATABASE_URL=postgres://user:password@host:5432/db
API_KEY=sk-secret-key-here
</private>
The schema uses PostgreSQL with these tables...
Content within <private> tags is NOT stored in memory.
Memory retrieval uses a three-layer workflow:
Layer 1: Search Index
└── Quick keyword/semantic match
└── Returns: observation IDs + snippets
└── Cost: ~100 tokens
Layer 2: Timeline Context
└── Fetch surrounding observations
└── Returns: chronological context
└── Cost: ~500 tokens
Layer 3: Full Details
└── Fetch complete observations
└── Returns: full content
└── Cost: varies (can be large)
Best practice: Start with Layer 1, only go deeper if needed.
# Good queries (specific)
"How did we implement authentication?"
"What was the decision on database schema?"
"Why did we choose React over Vue?"
# Poor queries (too broad)
"What did we do?"
"Show me everything"
"All past work"
Periodically review and clean:
# Access web UI to browse memory
open http://localhost:37777
# Review recent sessions
# Delete irrelevant observations
# Check storage usage
# At session start
"Check memory for our previous work on the authentication feature.
What was our approach and what's left to do?"
# Memory retrieves relevant context automatically
# When making architectural decisions
"Search memory for past discussions about state management.
What approaches did we consider and why did we choose Redux?"
# When debugging recurring issues
"Search memory for similar errors we've seen before.
How did we fix the authentication timeout issue last time?"
# When starting on existing project
"Retrieve memory summaries for this project.
What are the key architectural decisions and conventions?"
1. Claude automatically loads relevant memory
2. Review injected context (check token cost)
3. Ask clarifying questions if context seems incomplete
4. Proceed with task
1. Important decisions → explicitly note rationale
2. Sensitive data → use <private> tags
3. Complex solutions → document approach
4. Errors fixed → note root cause
1. Summarize what was accomplished
2. Note any pending work
3. Document blockers or questions
4. Memory auto-captures on session end
The web UI shows token costs for context injection:
| Context Type | Typical Tokens | When to Use | |--------------|----------------|-------------| | Session summary | 100-300 | Always (automatic) | | Search results | 200-500 | Specific queries | | Full observation | 500-2000 | Deep dive needed | | Timeline context | 300-800 | Understanding sequence |
1. Use specific queries
❌ "What do you know?"
✅ "What's our API rate limiting strategy?"
2. Progressive disclosure
- Start with summaries
- Drill down only if needed
- Don't fetch everything
3. Prune irrelevant results
- Skip old/outdated context
- Focus on recent sessions
- Filter by relevance
# Check if service is running
curl http://localhost:37777/health
# Verify plugin is installed
/plugin list
# Reinstall if needed
/plugin uninstall claude-mem
/plugin install claude-mem
1. Try different keywords
2. Use semantic queries (describe what you mean)
3. Check date range
4. Verify content wasn't marked <private>
1. Review what's being injected
2. Use more specific queries
3. Disable automatic context for trivial tasks
4. Clean old irrelevant observations
| Mistake | Impact | Fix |
|---------|--------|-----|
| Storing secrets | Security risk | Use <private> tags |
| Retrieving everything | Token explosion | Query specifically |
| Ignoring memory | Repeated work | Check memory first |
| No privacy tags | Credentials exposed | Tag sensitive content |
| Stale memory | Wrong context | Periodically clean |
Use with:
rag-architecture - Memory as knowledge sourceagentic-design - Long-term agent memoryllm-integration - Context managementsubagent-driven-development - Cross-task contextEnhances:
brainstorming - Recall past ideascode-review - Remember past issueswriting-plans - Build on previous plansBefore relying on memory:
During sessions:
Based on:
Bottom Line: Memory extends context across sessions. Store decisions, protect secrets, retrieve selectively. Every token costs—be strategic about what you recall.
development
Use when decomposing complex work. Dispatch fresh subagent per task, review between tasks. Flow: Load plan → Dispatch task → Review output → Apply feedback → Mark complete → Next task. No skipping reviews, no parallel dispatch.
development
# Server Documentation System Set up a documentation system that tracks changes and maintains server/project documentation with Claude Code hooks. ## When to Use - Setting up a new server or development environment - Need to track configuration changes over time - Want automatic documentation of work sessions - Maintaining changelog for infrastructure ## Directory Structure ``` ~/docs/ # User home directory (cross-platform) ├── changelog.md # Global over
development
Delegate tasks to remote Claude Code agent containers for parallel execution, long-running analysis, or resource-intensive operations.
development
Use when working on multiple features simultaneously. Creates isolated workspaces without branch switching, enabling parallel development.