Feature Request: Advanced Memory Tool for Claude Code

Status Closed — not planned
Maintainer reply ✓ Yes — bcherny
Activity 12 comments · opened Feb 25, 2025 · closed Feb 1, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Description

Claude Code already supports a basic form of memory through CLAUDE.md files, but this feature could be significantly enhanced to provide a more sophisticated memory system for code assistants. This would allow Claude to save and retrieve important information about codebases across sessions.

Current Implementation

Currently, Claude Code can read from a CLAUDE.md file if it exists, which serves as a rudimentary memory. However, this requires:

  • Manual creation and maintenance of the file by users
  • Explicit assistance from Claude to suggest additions

Proposed Enhancements

1. Persistent Memory Tool

Add a dedicated memory tool that allows Claude to:

  • Store and retrieve information about the codebase without modifying files
  • Maintain a structured database of codebase knowledge
  • Access this knowledge across different sessions with the same repository

2. Automatic Learning

Enable Claude to automatically:

  • Identify important patterns, conventions, and structures in the codebase
  • Remember frequently used commands and workflows
  • Learn user preferences for code style, naming conventions, etc.
  • Store location of important files and their purposes

3. Memory Management Interface

Provide users with:

  • Commands to view what Claude has remembered about their codebase
  • Options to correct or update Claude's understanding
  • Ability to explicitly teach Claude about codebase specifics
  • Export/import memory for sharing with team members

4. Context-Aware Retrieval

Implement smart retrieval that:

  • Prioritizes relevant information based on current task
  • Surfaces similar patterns from elsewhere in the codebase
  • Suggests best practices based on observed patterns

Benefits

  • Reduced onboarding time for Claude to understand a codebase
  • More consistent code generation matching project conventions
  • Better assistance with complex codebases where context is spread across many files
  • Improved project-specific recommendations without constant retraining

Technical Considerations

  • The memory could be stored locally within the repository (e.g., in .claude/ directory)
  • Provide user controls for privacy (what is/isn't remembered)
  • Optional git-ignore patterns for teams who don't want to share memories

Use Cases

  1. Remember build/test/lint commands used in the project
  2. Store project architecture knowledge for better code navigation suggestions
  3. Remember user's preferred patterns for implementing specific features
  4. Track domain model and design patterns across the codebase

View original on GitHub ↗

12 Comments

bcherny collaborator · 1 year ago

Let me noodle on this!

travelingflwr · 1 year ago

It would be really nice if this persistent memory could be shared with Claude desktop somehow.

I currently use a memory MCP server for this but built in would be nice.

gianpaj · 1 year ago

It would be great to have a memory, for example, for a computer-wide AI assistant.

It will know where my projects are, what my preferred programming language is, and where to push code to. What libraries do I prefer for Node.js, Python, etc?

Thinking in these terms after reading this blog post https://steipete.me/posts/2025/claude-code-is-my-computer

anuramat · 1 year ago

what about updating CLAUDE.md more often for starters? e.g.:

  • add a new slash command, that essentially runs /init, prepending to the context the output of git diff so that only the changes have to be in the context: git diff $(git log -1 --format=%H CLAUDE.md)
  • wrap that in a tool, instruct the the model to use it after finishing a task
  • hardcode a periodic diff (--numstat/--shortstat) check?
PaulRBerg · 12 months ago

This feature would be incredibly helpful and I urge the Anthropic team to consider implementing this soon - it will be a massive QoL improvement and it will boost productivity for CC users.

My problem: having to selectively import some files in CLAUDE.md based on some environment variables. At the moment, I have some custom scripts that override my root CLAUDE.md, but this is bad UX.

It would great if I could add <!-- claude-ignore --> comments in CLAUDE.md and have Claude ignore the sections embedded within tags like that.

RobEasthope · 9 months ago

Closed via PR #292

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

PaulRBerg · 8 months ago

please keep active

RodrigoLuglio · 8 months ago

Please, take a look at this, it really works for me, in case anyone look, I would love to hear some feedback.
memory-ts
Only three commands, the first time, then one single command and use Claude Code normally. The memory system is fully autonomous, no overhead for the user or for Claude, no tools, no slash command, nothing. All memories are saved in markdown format, git and grep search compatible and can be edited using any text editor, the embeddings are auto updated when this happens. It uses a new database kind that for the 10 - 20 K records has a competitive performance (better in some cases) with the giants in the field, but all records are human readable markdown files.
No context bloating, no dumping everything when the session start. Only a very brief last session summary and project snapshot. Then, for each message sent the memory system searches for relevant memories to the context of that single message and inject's into the prompt if any, the whole process takes less than ~150ms. Everything is local, just need to run a bun http server and it serves for all concurrent sessions in the same or different projects. Not a single command, tool or intervention from both Claude or the user. The memories are extracted at the end of each session or before context compression by resuming the session in the background. The whole cost of the memory system is only one extra message per session. For retrieval it uses a 10 dimensional algorithm with relevance gatekeeping mechanism. The retrieval is ultra fast because of the work Claude does when extracting the memories with a rich set of metadata used at the retrieval moment.

The memories are auto organized par project, concurrent sessions in the same project can access all memories. It really worth be looked at. In case you want to skip looking at the repository, to try is just:
bun install -g @rlabs-inc/memory
memory install (install Claude Code hooks)
memory serve
Then use Claude Code as usual. Nothing else to learn about it.

Fully editable and totally invisible. Give it a try and let me know what you think.

github-actions[bot] · 7 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

marcindulak · 7 months ago

This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.