A simple guide for using Memory Layer with Claude Code and other AI coding assistants.
Memory Layer gives Claude Code (and other AI coding assistants) a persistent memory. Instead of forgetting everything when you close a session, Claude remembers:
- Your project conventions ("we use tabs, not spaces")
- Past decisions ("we chose PostgreSQL because...")
- Gotchas ("the CI server needs Node 18, not 20")
- What advice actually helped you
Over time, it learns which memories are actually useful based on your feedback.
# 1. Install from GitHub
pip install git+https://github.com/runtimenoteslabs/memory-layer.git
# 2. Go to your project
cd your-project
# 3. Enable for Claude Code
mem install-plugin
# 4. Start Claude Code as usual
claudeThat's it. Memory Layer now works automatically.
You don't need to do anything special. Claude will:
- Automatically load relevant memories at session start
- Remember things from your conversations
- Learn which advice actually helped
Just tell Claude naturally:
"Remember that we always run tests before committing"
"Remember: the API rate limits to 100 requests per minute"
Or use the slash command:
/remember We use React 18 with TypeScript
With a category:
/remember category:gotcha The staging server resets every night at 2am
Ask Claude naturally:
"What's our convention for error handling?"
"What did we decide about the database?"
Or use the slash command:
/recall database setup
When Claude's advice helps (or doesn't), tell it:
"Thanks, that worked!"
"That didn't work, the tests still fail"
"That partially helped, but I also needed to restart the server"
This helps Claude learn which memories are actually useful. Good advice gets boosted, bad advice gets penalized.
Use these directly in Claude Code:
| Command | What it does |
|---|---|
/remember <content> |
Store a new memory |
/remember category:gotcha <content> |
Store with specific category |
/recall <query> |
Search for memories |
/memories |
List all stored memories |
/outcome <id> worked |
Mark advice as helpful |
/outcome <id> failed |
Mark advice as unhelpful |
/forget <id> |
Archive a memory |
/memory-context |
Get summary of project knowledge |
Most users never need these, but they're available if you prefer the command line:
# See all memories
mem list
# Search memories
mem search "keyword"
# Add a memory
mem add "Always use async/await" -c convention
# Get project summary
mem context
# View statistics
mem stats
# Give feedback
mem outcome <id> workedWhen storing memories, you can specify a category to help organize them:
| Category | Use for | Example |
|---|---|---|
convention |
Team coding standards | "Use snake_case for Python variables" |
architecture |
System design decisions | "Microservices communicate via RabbitMQ" |
decision |
Why we chose X over Y | "Using PostgreSQL for ACID compliance" |
pattern |
Reusable code patterns | "Repository pattern for data access" |
gotcha |
Things that trip people up | "CI requires Node 18, not Node 20" |
workaround |
Temporary fixes | "Restart Redis if connections timeout" |
troubleshooting |
How to debug issues | "Clear cache if tests fail randomly" |
command |
Useful commands | "npm run test:coverage for coverage report" |
preference |
Personal/team preferences | "Prefer functional style over classes" |
general |
Everything else | Default if not specified |
Good: "Use async/await for all database calls in this project"
Less useful: "use async"
Good: "We use PostgreSQL because we need ACID transactions for payment processing"
Less useful: "We use PostgreSQL"
The more you say "that worked!" or "that didn't help", the smarter the system gets. It takes just a second and makes a real difference.
You don't need to categorize everything perfectly. The search is smart enough to find relevant memories even if they're in different categories.
Close Claude, come back tomorrow, next week, or next month - your memories are still there. That's the whole point!
-
Storage: Memories are stored locally in a SQLite database (
~/.memory-layer/memories.db) -
Retrieval: When you ask questions, relevant memories are automatically searched using a hybrid approach:
- Semantic similarity (what you're asking about)
- Outcome scores (what actually helped before)
- Recency (recent memories weighted higher)
- Usage frequency (popular memories rise)
-
Smart Boosting: When you ask about errors, troubleshooting memories are automatically prioritized. Ask "what's our convention...", and convention memories get boosted. The system detects your intent.
-
Learning: Each memory has a score starting at 0.0
- "worked" → +0.2 (max 1.0)
- "failed" → -0.3 (min -1.0)
- "partial" → +0.05
Higher-scored memories appear first in search results. Over time, good advice rises and bad advice sinks.
-
Privacy: Everything stays on your machine. No data is sent anywhere.
The first time you use Memory Layer, a few things happen that may make it seem slow:
-
Embedding model download (~100MB): On first search, the system downloads a sentence embedding model for semantic search. This happens once and is cached.
-
Database creation: The SQLite database is created on first use at
~/.memory-layer/memories.db. -
Index building: As you add memories, they get indexed for fast retrieval.
What to expect:
- First run: 5-30 seconds (model download)
- Subsequent operations: <100ms
If the first run seems stuck, it's likely downloading the embedding model. You can verify with:
mem checkMemory Layer integrates with task trackers to automatically learn from task outcomes.
| Source | Location | Auto-detected |
|---|---|---|
| Beads | .beads/ in project |
Yes |
| Claude Code Tasks | ~/.claude/todos/ |
Yes |
- When you work on a task, Claude searches for relevant memories
- Those memories get linked to your task
- When you mark the task as done, the memories that helped are automatically boosted
Task completed
→ Memories used during this task get +0.2 boost
→ Good advice rises to the top over time
# List tasks from all sources
mem tasks
# Filter by source
mem tasks --source beads # Beads tasks only
mem tasks --source claude # Claude Code tasks only
# Sync outcomes for completed tasks
mem tasks-sync
# Get context with relevant memories
mem tasks-context
# View statistics
mem tasks-statsmem beads-sync
mem beads-context
mem beads-stats
mem beads-link <memory_id>| Task Status | Memory Outcome | Score Change |
|---|---|---|
| completed/done | worked | +0.2 |
| cancelled | failed (if enabled) | -0.3 |
| blocked | partial | +0.05 |
| Variable | Description |
|---|---|
CLAUDE_CODE_TASK_LIST_ID |
Filter to specific task list |
CLAUDE_CODE_TODOS_DIR |
Custom todos directory |
Memory Layer includes a web interface for browsing and managing memories.
# Start the server
mem serve --rest --port 8080
# Open in browser
# http://localhost:8080- Dashboard: Statistics with color-coded category bars
- Memories: Sortable list with filters (category, project, search)
- Search: Semantic (related concepts) or Keyword (exact match) modes
- Tasks: View tasks from Beads and Claude Code with context
- Add Memory: Form with category selection
- Outcomes: Record feedback on memories
- Theme: Light/dark mode toggle
Make sure memory-layer is installed and your PATH includes pip's bin directory:
pip install git+https://github.com/runtimenoteslabs/memory-layer.git
# or
python -m pip install git+https://github.com/runtimenoteslabs/memory-layer.gitRe-run the plugin installation:
cd your-project
mem install-pluginThen restart Claude Code.
Delete the database:
rm ~/.memory-layer/memories.db- Report issues: https://github.com/runtimenoteslabs/memory-layer/issues
- See all CLI options:
mem --help - See command help:
mem <command> --help