The Problem

AI coding agents (Claude Code, Codex, OpenClaw, OpenCode) each maintain isolated session context. Knowledge gained in one agent—project conventions, user preferences, resolved debugging paths—is lost when switching tools or starting a new session. Memsearch solves this by providing a persistent, unified memory layer that all agents can read and write, backed by human-readable Markdown files with a Milvus vector index for semantic retrieval.

What This Does

Memsearch indexes agent transcripts into Markdown memory files, then provides semantic search across them. The src/memsearch/ package contains the core engine: cli.py (entry points), core.py (indexing orchestration), store.py (Milvus vector store), chunker.py (Markdown chunking), and embeddings/ (multiple provider adapters: OpenAI, Google, Jina, Mistral, Ollama, ONNX, Voyage).

The plugins/ directory contains per-agent integrations. Each plugin (e.g., plugins/claude-code/, plugins/codex/) has hooks that capture conversation transcripts, scripts to run maintenance tasks, and skills for memory recall. A shared plugins/_shared/scripts/maintenance-runner.py handles background memory distillation across all agents.

How It Is Wired

Execution starts at src/memsearch/cli.py. The index command (line 186) reaches 67 functions; skills_distill (line 1178) reaches 108. The call graph shows MemSearchConfig is called from 31 places, resolve_config from 19, and chunk_markdown from 17—these are the highest-blast-radius functions. The MilvusStore is called from 11 places.

A typical index run traces: index -> _index_file -> chunk_markdown -> embed -> batched_embed (9 call sites), then writes to Milvus via MilvusStore. The compact command reaches _compact_openai via OpenAI's async client—a model inference call. watch (line 522) runs a filesystem watcher that triggers re-indexing on file changes.

The module graph shows src/memsearch/core has instability 0.82 (9 imports out, 2 in)—it's a hub that everything depends on but that depends on little itself. src/memsearch/embeddings/utils is the opposite: 8 modules import it, it imports nothing.

How To Use It

# Clone and install
git clone https://github.com/moses-y/memsearch
cd memsearch
pip install -e .  # from pyproject.toml

# Index your agent transcripts
memsearch index --path /path/to/transcripts

# Search across all memories
memsearch search "how did we handle the database migration?"

Configuration lives in src/memsearch/config.py—environment variable resolution and plugin config merging. Agent-specific installers exist in plugins/<agent>/install.sh. The CLI entry point is src/memsearch/__main__.py.

Real-World Use

A team runs Claude Code for day-to-day coding and Codex for one-off refactors. Each agent's transcripts are indexed into the same memory store. A developer asks Claude Code "what's the pattern for our API error handling?"—it retrieves the answer from a Codex session from three weeks ago. The skills_distill command turns repeated workflows into reusable skills (src/memsearch/skills.py), so the team's standard deployment procedure becomes an installable skill both agents can invoke.

Code Health & Issues

Static analysis found 50 issues (2 high, 48 medium). Key findings:

  • High - eval() over a runtime value in plugins/opencode/index.ts—executes arbitrary computed strings.
  • High - GitHub Actions pinned to mutable tags (astral-sh/setup-uv@v7) instead of commit SHAs—a supply-chain risk.
  • Medium - Broad exception handling across 9 files (src/memsearch/store.py, maintenance runners)—swallows errors indiscriminately.
  • Medium - 782 duplicated code blocks across 44 files, primarily in maintenance-runner.py variants. The _strip_jsonc/_read_jsonc_config functions are copy-pasted across plugins.
  • Medium - Deep nesting (max depth 6) in store.py, maintenance.py, and tests.
  • Medium - No dependency vulnerability scan in CI; no Dependabot/Renovate configured.
  • Low - No lockfile for Python or Node dependencies—non-reproducible builds.

The repo has 33 test files and GitHub Actions CI, but the duplicated maintenance runner logic across 44 files is the clearest refactoring target.

The Bottom Line

Memsearch is a well-architected solution to a real problem—cross-agent persistent memory. The Markdown-as-source-of-truth design is sensible, and the plugin ecosystem covers the main agents. The duplication in plugin maintenance scripts and the eval() usage need attention before production use. For teams running multiple AI coding agents, this is worth evaluating.