
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
code-memory
Advanced tools
Persistent memory for AI coding — semantic search, git history analysis, and intelligent context preservation
Persistent memory for AI coding - Never lose context again
Code Memory is an MCP (Model Context Protocol) server that gives AI coding assistants long-term memory of your codebase through semantic search, git history analysis, and intelligent context preservation.
AI coding assistants forget:
Code Memory provides:
npm install -g code-memory
# Initialize in your project
cd your-project
code-memory init
# Index your codebase
code-memory reindex
# Start the MCP server
code-memory serve
# Search from CLI
code-memory search "authentication flow"
Add to your ~/.claude/config.json:
{
"mcpServers": {
"code-memory": {
"command": "code-memory",
"args": ["serve"]
}
}
}
Find code by meaning, not just keywords:
code-memory search "user authentication logic"
# Finds auth code even if it doesn't contain the word "user"
How it works:
fastembed for local embeddings (all-MiniLM-L6-v2)Fast keyword-based search powered by tantivy:
code-memory search --fulltext "async function"
Extract architectural decisions from your git history:
code-memory trace-decision "why microservices"
Finds:
Understand what depends on what:
code-memory find-related "UserService"
Analyzes:
Supported languages: Rust, TypeScript, JavaScript, Python, Go, Java, C++, C#, Ruby, PHP, Swift, Kotlin, Scala, Haskell, Elixir, Clojure
Learn from your coding sessions:
code-memory sessions
Extracts:
Remember important facts:
# Via MCP server
remember("We use JWT for auth because of scalability requirements")
Code Memory provides 7 MCP tools for AI assistants:
search_codeSearch codebase with semantic + full-text search:
search_code({
query: "authentication flow",
limit: 10
})
explain_codeGet detailed explanation of a symbol:
explain_code({
symbol: "UserService",
context_lines: 20
})
trace_decisionFind why a decision was made:
trace_decision({
topic: "why microservices",
max_results: 5
})
find_relatedFind related code and dependencies:
find_related({
symbol: "AuthController",
relationship_type: "both" // "depends_on" | "depended_by" | "both"
})
rememberStore persistent knowledge:
remember({
key: "auth-strategy",
value: "We use JWT for stateless auth across microservices"
})
index_projectManually trigger reindexing:
index_project({
force: true
})
get_session_patternsRetrieve learned patterns:
get_session_patterns({
pattern_type: "architecture", // or "errors", "refactoring", "testing"
min_confidence: 0.7
})
initInitialize Code Memory in a project:
code-memory init
Creates .code-memory/ directory with:
config.toml - Configurationindex/ - Search indexknowledge.json - Persistent knowledgeserveStart the MCP server:
code-memory serve
reindexRebuild the code index:
code-memory reindex # Incremental
code-memory reindex --force # Full rebuild
searchSearch from the command line:
code-memory search "query"
code-memory search "query" --lang rust
code-memory search "query" --limit 20
statsShow index statistics:
code-memory stats
sessionsView session patterns:
code-memory sessions
code-memory sessions -n 10 # Top 10
code-memory sessions -c 0.8 # Min confidence 0.8
code-memory sessions -f json # JSON output
export / importBackup and restore knowledge:
code-memory export knowledge.json
code-memory import knowledge.json
Configuration is stored in .code-memory/config.toml:
[indexing]
# File patterns to index
include = ["**/*.rs", "**/*.ts", "**/*.js", "**/*.py"]
# File patterns to ignore
exclude = ["**/node_modules/**", "**/target/**", "**/.git/**"]
# Maximum file size (in bytes)
max_file_size = 1048576 # 1MB
[search]
# Number of results to return by default
default_limit = 10
# Minimum relevance score (0.0-1.0)
min_score = 0.5
[git]
# Analyze git history for decisions
analyze_history = true
# How far back to look (in days)
history_depth = 365
[embedding]
# Embedding model (local, no API calls)
model = "all-MiniLM-L6-v2"
# Embedding dimension
dimension = 384
code-memory/
├── src/
│ ├── indexer/ # Code indexing with tantivy
│ │ ├── walker.rs # File system traversal
│ │ ├── parser.rs # Symbol extraction
│ │ └── code_index.rs
│ ├── search/ # Search engines
│ │ ├── fulltext.rs # Tantivy full-text search
│ │ ├── semantic.rs # Fastembed semantic search
│ │ └── hybrid.rs # Combined ranking
│ ├── git/ # Git history analysis
│ │ ├── history.rs # Commit parsing
│ │ └── decisions.rs # Decision extraction
│ ├── graph/ # Dependency graphs
│ │ ├── imports.rs # Import parsing
│ │ └── analyzer.rs # Graph analysis
│ ├── sessions/ # Session tracking
│ │ ├── tracker.rs # Event extraction
│ │ └── patterns.rs # Pattern learning
│ ├── mcp/ # MCP server
│ │ ├── server.rs # JSON-RPC server
│ │ ├── tools.rs # Tool handlers
│ │ └── protocol.rs # MCP protocol
│ └── cli.rs # CLI interface
└── .code-memory/
├── config.toml # Configuration
├── index/ # Search index
└── knowledge.json # Persistent facts
Full support (symbol extraction + imports):
Additional languages supported for full-text search only.
| Feature | Code Memory | grep/ripgrep | GitHub Copilot |
|---|---|---|---|
| Semantic search | ✅ | ❌ | ✅ (API) |
| Offline | ✅ | ✅ | ❌ |
| Git history | ✅ | ❌ | ❌ |
| Dependency graphs | ✅ | ❌ | ❌ |
| Session learning | ✅ | ❌ | ✅ |
| MCP integration | ✅ | ❌ | ❌ |
| Cost | Free/$20 | Free | $10+/mo |
Code Memory understands meaning, not just text:
No. Everything runs locally:
Approximately:
Yes! Code Memory is an MCP server, so it works with any MCP-compatible tool:
Code Memory only accesses files you explicitly index. It never:
# Check for errors
code-memory reindex --verbose
# Force rebuild
code-memory reindex --force
# Check config
cat .code-memory/config.toml
# Verify index exists
code-memory stats
# Rebuild index
code-memory reindex --force
# Check file patterns in config
# Check if port is in use
lsof -i :8080
# Start with verbose logging
code-memory serve --verbose
git clone https://github.com/mstuart/code-memory.git
cd code-memory
cargo build --release
cargo test # Run all tests
cargo test --lib # Unit tests only
cargo test --test mcp_tools # Integration tests
Contributions welcome! Please:
MIT License - see LICENSE for details
Built with:
Give your AI assistant a memory. Never lose context again. 🧠
npm install -g code-memory
FAQs
Persistent memory for AI coding — semantic search, git history analysis, and intelligent context preservation
The npm package code-memory receives a total of 10 weekly downloads. As such, code-memory popularity was classified as not popular.
We found that code-memory demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.