memsearch
CLAUDE.md2.7k starsChanged 9 months agoMITView on GitHub
memsearch is a semantic memory search engine for markdown knowledge bases, built on Milvus. The plugin is a first-class component of memsearch — it's the primary real-world application that demonstrates the library in action. It gives Claude Code automatic persistent memory across sessions with zero user intervention. Architecture: 4 shell hooks + 1 skill + 1 background watcher
Trending
More talk lately.about the whole repository
Who's talking about zilliztech/memsearch
- A Hacker News story“Memory Plugin for Claude Code”Hacker News · Feb 16, 2026 · 2 points
- yxtay/memsearch“fix: honor MEMSEARCH_DIR in opencode and openclaw plugins”GitHub · Jul 15, 2026 · 1 reactions
- sudosubin/agents.nix“claude-code-plugins.github.zilliztech.memsearch: init at 0.4.21”GitHub · Oct 4, 2026
- sudosubin/agents.nix“agent-skills.github.zilliztech.memsearch: 0.4.20 → 0.4.21”GitHub · Oct 4, 2026
- sudosubin/agents.nix“agent-skills.github.zilliztech.memsearch: init at 0.4.20”GitHub · Oct 3, 2026
The biggest 5 of 29 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 29
Talked about on GitHub and Hacker News (29 times).
On GitHub · 28
- Jul 15, 2026fix: honor MEMSEARCH_DIR in opencode and openclaw plugins — yxtay/memsearch1 reaction · 3 comments
- Oct 4, 2026claude-code-plugins.github.zilliztech.memsearch: init at 0.4.21 — sudosubin/agents.nix0 reactions
- Oct 4, 2026agent-skills.github.zilliztech.memsearch: 0.4.20 → 0.4.21 — sudosubin/agents.nix0 reactions
- Oct 3, 2026agent-skills.github.zilliztech.memsearch: init at 0.4.20 — sudosubin/agents.nix0 reactions
- Sep 22, 2026Add MemSearch Jev reranking — yibie/awesome-jev0 reactions
23 more on GitHub
- Sep 22, 2026[Project]: MemSearch — logicrw/awesome-jev-projects0 reactions · 2 comments
- Sep 10, 2026feat: chunking.min_chunk_size to merge undersized sections (upstream #609) — ativaone/memsearch-mini0 reactions · 1 comment
- Sep 10, 2026perf: raise the ONNX default batch size to 64 (upstream #608) — ativaone/memsearch-mini0 reactions · 1 comment
- Sep 10, 2026feat: ONNX execution provider selection with CPU fallback (upstream #606) — ativaone/memsearch-mini0 reactions · 2 comments
- Sep 10, 2026feat: optional hostname suffix on daily journal filenames (upstream #720) — ativaone/memsearch-mini0 reactions · 2 comments
- Sep 10, 2026feat: share memory across linked git worktrees (upstream #717) — ativaone/memsearch-mini0 reactions · 1 comment
- Sep 10, 2026fix: strip harness-injected blocks from Claude transcripts (upstream #227) — ativaone/memsearch-mini0 reactions · 1 comment
- Sep 10, 2026fix: reject summarizer output without bullet points (upstream #527) — ativaone/memsearch-mini0 reactions · 1 comment
- Aug 31, 2026Weekly discovery: new DeepSeek Harness ecosystem candidates — fendouai/awesome-deepseek-harness0 reactions · 2 comments
- Aug 30, 2026catalog: add zc277584121-memsearch-dsh (community curation, created by @zc277584121) — diegosouzapw/awesome-omni-dsh-plugins0 reactions
- Aug 25, 2026[New Service] August 26 OSS catalog additions — haoruilee/awesome-agent-native-services0 reactions
- Aug 24, 2026catalog: add MemSearch — imsai-sh/awesome-deepseek-harness-plugins0 reactions · 1 comment
- Aug 24, 2026docs: add MemSearch and dsh-milvus — Dominic789654/awesome-deepseek-harness0 reactions · 1 comment
- May 23, 2026[Bug] Openchamber starts with user home dir — openchamber/openchamber0 reactions · 1 comment
- May 3, 2026improve Summary — qaqland/vibe-commit-msg0 reactions · 1 comment
- Apr 25, 2026Three-tier progressive disclosure on recall (chunk → section → raw) — joshuaswarren/remnic0 reactions · 1 comment
- Apr 22, 2026Add memsearch skill https://github.com/zilliztech/memsearch/blob/main/plugins/claude-code/README.md — jellydn/my-ai-tools0 reactions
- Apr 18, 2026Audit candidate: zilliztech/memsearch — xiaolai/nlpm0 reactions · 1 comment
- Feb 15, 2026Replace custom key-value memory backend with MemSearch — elemarin/paw0 reactions
- Feb 14, 2026[Resource]: Add memsearch CC plugin, a CC memory plugin for users — hesreallyhim/awesome-claude-code0 reactions · 2 comments
- Feb 14, 2026[Resource]: memsearch — hesreallyhim/awesome-claude-code0 reactions · 1 comment
- Feb 14, 2026Add memsearch — markdown-first semantic memory for AI agents — topoteretes/awesome-ai-memory0 reactions · 2 comments
- Feb 14, 2026Add memsearch — hooks-based persistent memory plugin — hesreallyhim/awesome-claude-code0 reactions
On Hacker News · 1
- Feb 16, 2026Memory Plugin for Claude Code2 points
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 92
When modifying hooks/skills, keep in mind:
- Very specific: line 93
All hooks output JSON to stdout (additionalContext for context injection, systemMessage for visible hints, or empty {})
- Very specific: line 98
Leave model unset in the Claude Code skills' frontmatter so users can choose a default through CLAUDE_CODE_SUBAGENT_MODEL.
- Very specific: line 106
Hybrid search by default: Every collection has both dense vector and BM25 sparse fields.
- Very specific: line 108
Shared prompt template: All five plugins share a single summarize.txt template (maintained in plugins/_shared/prompts/, synced via …
- Very specific: line 109
Remote Milvus
query()requires a filter: Use chunk_hash != "" as a "match all" filter when no filter is provided (Milvus Lite doesn't … - Very specific: line 124
Use the repository-local $release-memsearch skill for release operations.
- Very specific: line 132
Always use uv run python -m pytest instead of uv run pytest to avoid system Python pytest conflicts.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
<!-- This file is for AI agents (Claude Code, Cursor, Copilot, etc.) working in this repository.
It also serves as a shared project memory — recording conventions, architecture decisions,
and common patterns that all contributors (human or AI) should follow.
Symlinked as AGENT.md and MEMORY.md for compatibility with other tools. -->This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build & Test Commands
# Install in development mode
uv sync --all-extras
# Run all tests (use python -m pytest to avoid system pytest conflicts)
uv run python -m pytest
# Run a single test file
uv run python -m pytest tests/test_chunker.py
# Run a specific test
uv run python -m pytest tests/test_store.py::test_upsert_and_search -v
# Serve docs locally
uv run mkdocs serve
# Run the CLI
uv run memsearch --helpArchitecture
memsearch is a semantic memory search engine for markdown knowledge bases, built on Milvus.
Data Flow
Markdown files → Scanner → Chunker → Embedder → MilvusStore
↓
User query → Embedder → Hybrid Search (dense + BM25 + RRF) → ResultsCore Library (src/memsearch/)
core.py—MemSearchclass: the public Python API that orchestrates everything. Entry point forindex(),search(),compact(),watch().store.py—MilvusStore: Milvus wrapper handling collection creation, upsert, hybrid search (dense cosine + BM25 sparse + RRF reranking), and cleanup. Thechunk_hash(composite ID of source+lines+content+model) is the VARCHAR primary key.chunker.py— Splits markdown by headings intoChunkdataclasses. SHA-256 content hash enables dedup.compute_chunk_id()generates composite IDs matching OpenClaw's format.embeddings/__init__.py—EmbeddingProviderprotocol + lazy-loading factory (get_provider()). Providers: openai (default), google, voyage, jina, mistral, ollama, local, onnx.scanner.py— Walks directories to find.md/.markdownfiles, returnsScannedFilelist.config.py— Layered TOML config: dataclass defaults →~/.memsearch/config.toml→.memsearch.toml→ CLI flags.cli.py— Click CLI wrapping the Python API. All commands resolve config viaresolve_config()then instantiateMemSearch.watcher.py—watchdog-based file watcher with debounce, used bymemsearch watchand the Claude Code plugin.compact.py— LLM-powered chunk summarization (OpenAI/Anthropic/Gemini).reranker.py— Optional cross-encoder reranking (ONNX or PyTorch backend). Disabled by default; enable viareranker.modelconfig.
Claude Code Plugin (plugins/claude-code/)
The plugin is a first-class component of memsearch — it's the primary real-world application that demonstrates the library in action. It gives Claude Code automatic persistent memory across sessions with zero user intervention.
Architecture: 4 shell hooks + 1 skill + 1 background watcher
plugins/claude-code/
├── hooks/
│ ├── common.sh # Shared setup: PATH, memsearch detection, collection name, watch PID
│ ├── session-start.sh # SessionStart: start watch and inject recent memories
│ ├── user-prompt-submit.sh # UserPromptSubmit: recall capability hint
│ ├── stop.sh # Stop: extract last turn → summarize → lazily create heading → append (async)
│ ├── session-end.sh # SessionEnd: stop watch process
│ └── parse-transcript.sh # Last-turn extractor: finds last user question → EOF, formats with role labels for LLM (Python 3, no jq)
├── scripts/
│ └── derive-collection.sh # Derive per-project collection name from project path
├── transcript.py # JSONL transcript parser for Claude Code conversation files (L3 deep drill)
└── skills/
└── memory-recall/
└── SKILL.md # Skill (context: fork): search → expand → transcript in subagentKey design: skill-based memory recall. Memory retrieval is handled by a memory-recall skill that runs in a forked subagent context (context: fork). Claude automatically invokes the skill when it judges the user's question could benefit from historical context. The subagent autonomously performs search, evaluates relevance, expands promising results, and returns a curated summary — all without polluting the main conversation context.
Three-layer progressive disclosure (all in subagent):
- L1 (search): Subagent runs
memsearch searchto find relevant chunks - L2 (expand): Subagent runs
memsearch expand <chunk_hash>to get full markdown sections - L3 (transcript): Subagent runs
memsearch transcript <jsonl> --turn <uuid> --context 3to drill into original conversations (core CLI auto-detects the format;transcript.pyremains as the plugin-local, Claude-specific parser exercised bytests/test_transcript.py)
Supporting hooks:
SessionStartinjects cold-start context (recent daily logs) so Claude knows history existsUserPromptSubmitreturns a lightweightsystemMessagecapability hint ("[memsearch] Recall available if needed") to increase skill trigger awarenessStophook is async and non-blocking — extracts last turn only, callsclaude -p --model haiku(withCLAUDECODE=to bypass nested session detection) to summarize as third-person notes, appends to daily.md
When modifying hooks/skills, keep in mind:
- All hooks output JSON to stdout (
additionalContextfor context injection,systemMessagefor visible hints, or empty{}) common.shis sourced by every hook — changes there affect all hooks. It derives a per-projectCOLLECTION_NAMEviaderive-collection.shand passes--collectionautomatically throughrun_memsearch()andstart_watch()- The watch process uses a PID file (
.memsearch/.watch.pid) for singleton behavior. Milvus Lite falls back to one-timeindex()at session start stop.shhas a recursion guard (stop_hook_active) since it callsclaude -pinternally, and setsMEMSEARCH_NO_WATCH=1to prevent the child process from interfering with the main session's watch- The
memory-recallskill usescontext: fork— the subagent has its own context window and does not see main conversation history - Leave
modelunset in the Claude Code skills' frontmatter so users can choose a default throughCLAUDE_CODE_SUBAGENT_MODEL. See skill model selection for precedence and overrides transcript.pylives in the plugin directory (not in core library) since it is entirely Claude Code JSONL-specific
Key Design Decisions
- Markdown is the source of truth. Milvus is a derived index, rebuildable anytime from
.mdfiles. - Composite chunk ID as PK.
hash(source:startLine:endLine:contentHash:model)— enables natural dedup without a separate cache. - ONNX bge-m3 as plugin default. The Claude Code plugin hooks default to
onnxprovider (bge-m3, CPU, no API key). The Python API still defaults toopenai. - Hybrid search by default. Every collection has both dense vector and BM25 sparse fields. Search uses RRF to combine them. RRF scores are normalized to
[0, 1](theoretical max =num_retrievers / (k + 1)). [llm]+[prompts]config. New config sections for LLM provider selection and custom prompt templates.[compact]is deprecated but still works (fallback:[llm]>[compact]> defaults). Plugins readprompts.summarizefor custom session summarization prompts. Migration plan:[compact]will be removed in the next major version (1.0). During the transition,resolve_config()emits aDeprecationWarningwhen user config files contain[compact]. The compact CLI command resolves LLM settings ascfg.llm.* or cfg.compact.*.- Shared prompt template. All five plugins share a single
summarize.txttemplate (maintained inplugins/_shared/prompts/, synced viascripts/sync-prompts.sh). Template uses{{AGENT_NAME}}placeholder. - Remote Milvus
query()requires a filter. Usechunk_hash != ""as a "match all" filter when no filter is provided (Milvus Lite doesn't enforce this, but Milvus Server does).
Versioning & Release
Six release components — bump only the versioned components that changed:
| Component | Version file | Publish channel |
| memsearch (PyPI) | pyproject.toml | PyPI (automated via GitHub Actions on tag push) |
| Claude Code plugin | plugins/claude-code/.claude-plugin/plugin.json | Marketplace (.claude-plugin/marketplace.json) |
| Codex plugin | (none) | install.sh (no version management) |
| DeepSeek Harness plugin | plugins/dsh/package.json | npm (@zilliz/memsearch-dsh, trusted publishing via release-dsh.yml) |
| OpenClaw plugin | plugins/openclaw/package.json | ClawHub (clawhub package publish) |
| OpenCode plugin | plugins/opencode/package.json | npm (@zilliz/memsearch-opencode, trusted publishing via release.yml) |
Use the repository-local $release-memsearch skill for release operations. See
CLAUDE.local.md for machine-specific development and published-artifact E2E rules.
Project Conventions
- Uses
uv+pyproject.tomlfor dependency management (not pip). - Optional deps via extras:
[google],[voyage],[ollama],[local],[onnx],[all]. The Claude Code plugin usesmemsearch[onnx]for zero-config ONNX embedding. - Docs at
docs/use mkdocs-material. Thesite/directory is build output — do not commit. - Always use
uv run python -m pytestinstead ofuv run pytestto avoid system Python pytest conflicts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

