
Code Memory
io.github.kapillamba4由 GitHub 帳號 kapillamba4 發布v1.0.33更新於 Oct 25, 2026
Local semantic code search with Git history. Works offline, no API key needed.
發布方自己的服務:Memory.fit
概覽
一個本機 MCP 伺服器,為程式碼庫建立索引,讓助理離線進行程式碼、文件與 Git 歷史的語意搜尋。
- 可以做什麼
- 為指定目錄中的原始碼與文件建立索引,使用 tree-sitter 解析與本機嵌入產生 SQLite 向量索引,並在變更或更換模型後重新索引。以語意或結構化方式搜尋程式碼,尋找定義、參照、呼叫關係與檔案結構,採用 BM25 與向量混合檢索。搜尋文件、README 與擷取出的 docstring,協助理解架構與工作流程。搜尋 Git 歷史中的提交、單一檔案歷史與 blame,用於排查回歸並理解變更意圖。
- 適用情境
- 適合助理需要在大型或不熟悉的程式碼庫中工作、希望精準檢索而非貼上整個檔案的情境,也適合程式碼必須留在本機、包括離線或隔離環境的情境。
- 執行需求
- 以 stdio 在本機執行。需要 Python 3.13 或更新版本並搭配 uv 或 pip,或使用 GitHub Releases 提供的獨立二進位檔。首次執行會下載約 600MB 的嵌入模型到 Hugging Face 快取,載入模型約需 1GB 記憶體。可選環境變數 CODE_MEMORY_LOG_LEVEL 與 EMBEDDING_MODEL。Git 歷史搜尋需要 Git 儲存庫。無需 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Code Memory,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
code-memory
[code-memory logo][Zero Telemetry] [No API Key] [Offline First]
A deterministic, high-precision code intelligence layer exposed as a Model Context Protocol (MCP) server.
- Zero telemetry — your code never leaves your machine
- No API key required — runs entirely locally with sentence-transformers
- 1 min setup — just
uvx code-memoryand you're ready - Token saving by 50% — precise code retrieval instead of dumping entire files
Please help star code-memory if you like this project!
Why code-memory?
Finding the right context from a large codebase is expensive, inaccurate, and limited by context windows. Dumping files into prompts wastes tokens, and LLMs lose track of the actual task as context fills up.
Instead of manually hunting with grep/find or dumping raw file text, code-memory runs semantic searches against a locally indexed codebase. Inspired by claude-context, but designed from the ground up for large-scale local search.
Supported Languages
Full AST Support (structural parsing with symbol extraction): Python, JavaScript/TypeScript, Java, Go, Rust, C/C++, Ruby, Kotlin
Fallback Support (whole-file indexing): C#, Swift, Scala, Lua, Shell, Config (yaml/toml/json), Web (html/css), SQL, Markdown
Files matching
.gitignorepatterns are automatically skipped.
Architecture: Progressive Disclosure
Instead of a single monolithic search, code-memory routes queries through three purpose-built tools:
This forces the LLM to pick the right retrieval strategy before any data is fetched.
Installation
From PyPI (Recommended)
From Source
Pre-built Binaries (Standalone)
Download standalone executables from GitHub Releases — no Python installation required.
Note: The first run will download the embedding model (~600MB) to ~/.cache/huggingface/. Subsequent runs use the cached model.
Quickstart
Prerequisites
- Python ≥ 3.13
uvpackage manager (recommended) or pip
Install uv if you don't have it:
Install & Run
Development
Configure Your MCP Host
You can use either uvx (requires Python) or the standalone binary (no dependencies).
Using uvx (Python required)
Gemini CLI / Gemini Code Assist
Add to your MCP settings (e.g. ~/.gemini/settings.json):
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
Claude Code (CLI)
Add to .mcp.json in your project root or ~/.mcp.json for global access:
VS Code (Copilot / Continue)
Add to .vscode/mcp.json in your workspace:
Using Standalone Binary (No Python required)
Replace the path with the location of your downloaded binary:
For Windows:
Shared SSE Server (Reduce Memory Usage)
By default, each MCP host project launches its own code-memory process, which loads the embedding model (~1–2 GB) once per project. To avoid this, you can run a single shared instance over SSE (Server-Sent Events) and point all your MCP hosts at it.
Start the shared server
The server listens on http://127.0.0.1:8765/sse by default.
Configure MCP hosts to use the shared server
Instead of launching a new process, point your MCP host at the running SSE endpoint.
Claude Desktop
VS Code (Copilot / Continue)
Claude Code (CLI) — .mcp.json
Tip: Configure
uvx code-memory --transport sseto start via a single-instance service manager (e.g. systemd user service, launchd agent, or another one-time login/startup mechanism) so the shared server starts automatically.
Security: The SSE endpoint is unauthenticated. Keep the default
--host 127.0.0.1so only local processes can connect; do not bind to0.0.0.0or a public interface unless you've put authentication in front of it.
Configuration
CLI Options
Environment Variables
Example:
Custom Embedding Model
You can use a different embedding model by setting the EMBEDDING_MODEL environment variable:
For MCP hosts, add the environment variable to your configuration:
Note: Changing the embedding model will invalidate existing indexes. You'll need to re-run
index_codebaseafter switching models.
Tools
index_codebase
Indexes or re-indexes source files and documentation in the given directory. Run this before using search_code or search_docs to ensure the database is up to date. Uses tree-sitter for language-agnostic structural extraction and generates dense vector embeddings using sentence-transformers (runs locally, in-process) for semantic search.
search_code
Perform semantic search and find structural code definitions, locate where functions/classes are defined, or map out dependency references (call graphs). Uses hybrid retrieval (BM25 + vector embeddings) to find exact matches and semantic similarities.
search_docs
Understand the codebase conceptually — how things work, architectural patterns, SOPs. Searches markdown documentation, READMEs, and docstrings extracted from code.
search_history
Debug regressions and understand developer intent through Git history.
Project Structure
Troubleshooting
"Git repository not found" error
Make sure you're running search_history from within a git repository. The tool searches upward from the current directory to find .git.
Empty search results
Run index_codebase(directory=".") first to index your code and documentation. The index is stored locally in code_memory.db.
Slow indexing
Indexing generates embeddings using a local sentence-transformers model. The first run downloads the model (~600MB for jina-code-embeddings-0.5b). Subsequent runs are faster.
Embedding model errors
Ensure you have enough disk space and memory. The jina-code-embeddings-0.5b model requires ~1GB RAM when loaded.
Privacy & Security
Your code never leaves your machine. Unlike cloud-based code intelligence tools, code-memory runs entirely locally:
- Zero telemetry — no usage data, analytics, or tracking
- Zero external API calls — all processing happens in-process
- Zero cloud dependencies — works without internet (after initial setup)
- Your data stays local — indexes stored in local SQLite database
This makes code-memory ideal for:
- Proprietary and confidential codebases
- Security-conscious organizations
- Air-gapped development environments
- Privacy-focused developers
See COMPARISON.md for a detailed comparison with cloud-based alternatives.
Air-gapped & Offline Support
code-memory works in completely isolated environments:
Method 1: Pre-built Binary + Cached Model
-
On a connected machine, run code-memory once to cache the embedding model:
-
Transfer to air-gapped machine:
- Standalone binary from GitHub Releases
- Model cache directory (
~/.cache/huggingface/hub/models--*)
-
Run on air-gapped machine — no network required.
Method 2: Offline pip Install
- Download the wheel from PyPI on a connected machine
- Transfer and install:
pip install code-memory-*.whl - Pre-cache the model as above
- Run offline
Roadmap
- Milestone 1 — Project scaffolding & MCP protocol wiring
- Milestone 2 — Implement
search_codewith AST parsing + SQLite +sqlite-vec - Milestone 3 — Implement
search_historywith Git integration - Milestone 4 — Implement
search_docswith semantic search - Milestone 5 — Production hardening & packaging
Contributing
See CONTRIBUTING.md for development setup and guidelines.
Changelog
See CHANGELOG.md for version history.
License
MIT
來源:README.md,提交 5a8db16
工具
0版本歷史
1- v1.0.33最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Memory 整合

Memory.fit
fit.memory官方發布者
託管式 Memory.fit 伺服器,讓 AI 讀取你的訓練、睡眠、恢復與飲食資料,並寫回每週計畫、每日目標和飲食計畫。
pg.ddx.io: the PostgreSQL community's memory
io.ddx.pg官方發布者
pg.ddx.io: the PostgreSQL community's memory 的託管 MCP 服務,由 pg.ddx.io 發布;無需登入;Streamable HTTP;29 個工具。
var.gg Naming Memory
gg.var官方發布者
遠端 MCP 伺服器,可依領域概念推薦並檢索韓、日、中、越、英多語言的程式識別字名稱,並提供 ERD 結構查詢。

Counterparts
ai.counterparts
為 Claude Code 與 Claude Desktop 提供的本地優先長期記憶:助理自行寫下關於你與專案的筆記,並在之後的對話中回想起來。

LAHZE - Persian AI Memory Platform
由 GitHub 帳號 pedramgholizadeh 發布
以波斯語為先的地理記憶平臺:發現地點,起草併發布僅限波斯語的記憶。AI 翻譯