[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74216":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":47,"readmeContent":48,"aiSummary":49,"trendingCount":16,"starSnapshotCount":16,"syncStatus":50,"lastSyncTime":51,"discoverSource":52},74216,"memsearch","zilliztech\u002Fmemsearch","zilliztech","A persistent, unified memory layer for all your AI agents (e.g. Claude Code, Codex), backed by Markdown and Milvus.","https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002F",null,"Python",1957,179,8,20,0,38,81,299,114,104.77,"MIT License",false,"main",true,[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"agent","agent-memory","ai-agents","claude-code","claude-code-plugin","codex","codex-cli","embeddings","harness","hybrid-search","long-term-memory","memory","milvus","openclaw","opencode","progressive-disclosure","rag","reranker","semantic-search","skills","2026-06-12 04:01:13","\u003Ch1 align=\"center\">\n  \u003Cimg src=\"assets\u002Flogo-icon.jpg\" alt=\"\" width=\"100\" valign=\"middle\">\n  &nbsp;\n  memsearch\n\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Cross-platform semantic memory for AI coding agents.\u003C\u002Fstrong>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fmemsearch\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fmemsearch?style=flat-square&color=blue\" alt=\"PyPI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fclaude-code\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FClaude_Code-plugin-c97539?style=flat-square&logo=claude&logoColor=white\" alt=\"Claude Code\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fopenclaw\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FOpenClaw-plugin-4a9eff?style=flat-square\" alt=\"OpenClaw\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fopencode\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FOpenCode-plugin-22c55e?style=flat-square\" alt=\"OpenCode\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fcodex\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCodex_CLI-plugin-ff6b35?style=flat-square\" alt=\"Codex CLI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fmemsearch\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-%3E%3D3.10-blue?style=flat-square&logo=python&logoColor=white\" alt=\"Python\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fzilliztech\u002Fmemsearch\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fzilliztech\u002Fmemsearch?style=flat-square\" alt=\"License\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fzilliztech\u002Fmemsearch\u002Factions\u002Fworkflows\u002Ftest.yml\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fzilliztech\u002Fmemsearch\u002Ftest.yml?branch=main&style=flat-square\" alt=\"Tests\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdocs-memsearch-blue?style=flat-square\" alt=\"Docs\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fzilliztech\u002Fmemsearch\u002Fstargazers\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fzilliztech\u002Fmemsearch?style=flat-square\" alt=\"Stars\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fdiscord.com\u002Finvite\u002FFG6hMJStWu\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-chat-7289da?style=flat-square&logo=discord&logoColor=white\" alt=\"Discord\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fx.com\u002Fzilliz_universe\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ffollow-%40zilliz__universe-000000?style=flat-square&logo=x&logoColor=white\" alt=\"X (Twitter)\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F427b7152-bc16-408c-a8b0-59a2b05fd1e0\" alt=\"memsearch demo\" width=\"800\">\n\u003C\u002Fp>\n\n### Why memsearch?\n\n- 🌐 **All Platforms, One Memory** — memories flow across [Claude Code](plugins\u002Fclaude-code\u002FREADME.md), [OpenClaw](plugins\u002Fopenclaw\u002FREADME.md), [OpenCode](plugins\u002Fopencode\u002FREADME.md), and [Codex CLI](plugins\u002Fcodex\u002FREADME.md). A conversation in one agent becomes searchable context in all others — no extra setup\n- 👥 **For Agent Users**, install a plugin and get persistent memory with zero effort; **for Agent Developers**, use the full [CLI](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fcli\u002F) and [Python API](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fpython-api\u002F) to build memory and harness engineering into your own agents\n- 📄 **Markdown is the source of truth** — inspired by [OpenClaw](https:\u002F\u002Fgithub.com\u002Fopenclaw\u002Fopenclaw). Your memories are just `.md` files — human-readable, editable, version-controllable. Milvus is a \"shadow index\": a derived, rebuildable cache\n- 🔍 **Progressive retrieval, hybrid search, smart dedup, live sync** — 3-layer recall (search → expand → transcript); dense vector + BM25 sparse + RRF reranking; SHA-256 content hashing skips unchanged content; file watcher auto-indexes in real time\n\n---\n\n## 🧑‍💻 For Agent Users\n\nPick your platform, install the plugin, and you're done. Each plugin captures conversations automatically and provides semantic recall with zero configuration.\n\n\u003Cdetails open>\n\u003Csummary>\u003Ch3>For Claude Code Users\u003C\u002Fh3>\u003C\u002Fsummary>\n\n```bash\n# Install\n\u002Fplugin marketplace add zilliztech\u002Fmemsearch\n\u002Fplugin install memsearch\n# Restart Claude Code to activate the plugin\n```\n\nAfter restarting, just chat with Claude Code as usual. The plugin captures every conversation turn automatically.\n\n**Verify it's working** — after a few conversations, check your memory files:\n\n```bash\nls .memsearch\u002Fmemory\u002F          # you should see daily .md files\ncat .memsearch\u002Fmemory\u002F$(date +%Y-%m-%d).md\n```\n\n**Recall memories** — two ways to trigger:\n\n```\n\u002Fmemory-recall what did we discuss about Redis?\n```\nOr just ask naturally — Claude auto-invokes the skill when it senses the question needs history:\n```\nWe discussed Redis caching before, what was the TTL we chose?\n```\n\n> 📖 [Claude Code Plugin docs](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fclaude-code\u002F) · [Troubleshooting](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fclaude-code\u002Ftroubleshooting\u002F)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails open>\n\u003Csummary>\u003Ch3>For Codex CLI Users\u003C\u002Fh3>\u003C\u002Fsummary>\n\n```bash\n# Install\ngit clone --depth 1 https:\u002F\u002Fgithub.com\u002Fzilliztech\u002Fmemsearch.git\nbash memsearch\u002Fplugins\u002Fcodex\u002Fscripts\u002Finstall.sh\ncodex --yolo  # needed for ONNX model network access\n```\n\nAfter installing, chat as usual. Hooks capture and summarize each turn.\n\n**Verify it's working:**\n\n```bash\nls .memsearch\u002Fmemory\u002F\n```\n\n**Recall memories** — use the skill:\n\n```\n$memory-recall what did we discuss about deployment?\n```\n\n> 📖 [Codex CLI Plugin docs](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fcodex\u002F)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Ch3>For OpenClaw Users\u003C\u002Fh3>\u003C\u002Fsummary>\n\n```bash\n# Install from ClawHub\nopenclaw plugins install --force clawhub:memsearch\nopenclaw config set plugins.entries.memsearch.hooks.allowConversationAccess true\nopenclaw config set plugins.entries.memsearch.hooks.allowPromptInjection true\nopenclaw gateway restart\n```\n\nAfter installing, chat in TUI as usual. The plugin captures each turn automatically.\n\n**Verify it's working** — memory files are stored in your agent's workspace:\n\n```bash\n# For the main agent:\nls ~\u002F.openclaw\u002Fworkspace\u002F.memsearch\u002Fmemory\u002F\n# For other agents (e.g. work):\nls ~\u002F.openclaw\u002Fworkspace-work\u002F.memsearch\u002Fmemory\u002F\n```\n\n**Recall memories** — two ways to trigger:\n\n```\n\u002Fmemory-recall what was the batch size limit we set?\n```\nOr just ask naturally — the LLM auto-invokes memory tools when it senses the question needs history:\n```\nWe discussed batch size limits before, what did we decide?\n```\n\n> 📖 [OpenClaw Plugin docs](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fopenclaw\u002F) · [Browse on ClawHub](https:\u002F\u002Fclawhub.ai\u002Fplugins\u002Fmemsearch)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Ch3>For OpenCode Users\u003C\u002Fh3>\u003C\u002Fsummary>\n\n```json\n\u002F\u002F In ~\u002F.config\u002Fopencode\u002Fopencode.json\n{ \"plugin\": [\"@zilliz\u002Fmemsearch-opencode\"] }\n```\n\nAfter installing, chat in TUI as usual. A background daemon captures conversations.\n\n**Verify it's working:**\n\n```bash\nls .memsearch\u002Fmemory\u002F    # daily .md files appear after a few conversations\n```\n\n**Recall memories** — two ways to trigger:\n\n```\n\u002Fmemory-recall what did we discuss about authentication?\n```\nOr just ask naturally — the LLM auto-invokes memory tools when it senses the question needs history:\n```\nWe discussed the authentication flow before, what was the approach?\n```\n\n> 📖 [OpenCode Plugin docs](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002Fopencode\u002F)\n\n\u003C\u002Fdetails>\n\n### ⚙️ Configuration (all platforms)\n\nAll plugins share the same memsearch backend. Configure once, works everywhere.\n\n#### Embedding\n\nDefaults to **ONNX bge-m3** — runs locally on CPU, no API key, no cost. On first launch the model (~558 MB) is downloaded from HuggingFace Hub.\n\n```bash\nmemsearch config set embedding.provider onnx     # default — local, free\nmemsearch config set embedding.provider openai   # needs OPENAI_API_KEY\nmemsearch config set embedding.provider ollama   # local, any model\n```\n\n> All providers and models: [Configuration — Embedding Provider](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fhome\u002Fconfiguration\u002F#embedding-provider)\n\n#### Milvus Backend\n\nJust change `milvus_uri` (and optionally `milvus_token`) to switch between deployment modes:\n\n**Milvus Lite** (default) — zero config, single file. Great for getting started:\n\n```bash\n# Works out of the box, no setup needed\nmemsearch config get milvus.uri   # → ~\u002F.memsearch\u002Fmilvus.db\n```\n\n⭐ **Zilliz Cloud** (recommended) — fully managed, [free tier available](https:\u002F\u002Fcloud.zilliz.com\u002Fsignup?utm_source=github&utm_medium=referral&utm_campaign=memsearch-readme) — [sign up](https:\u002F\u002Fcloud.zilliz.com\u002Fsignup?utm_source=github&utm_medium=referral&utm_campaign=memsearch-readme) 👇:\n\n```bash\nmemsearch config set milvus.uri \"https:\u002F\u002Fin03-xxx.api.gcp-us-west1.zillizcloud.com\"\nmemsearch config set milvus.token \"your-api-key\"\n```\n\n\u003Cdetails>\n\u003Csummary>⭐ Sign up for a free Zilliz Cloud cluster\u003C\u002Fsummary>\n\nYou can [sign up](https:\u002F\u002Fcloud.zilliz.com\u002Fsignup?utm_source=github&utm_medium=referral&utm_campaign=memsearch-readme) on Zilliz Cloud to get a free cluster and API key.\n\n![Sign up and get API key](https:\u002F\u002Fraw.githubusercontent.com\u002Fzilliztech\u002Fclaude-context\u002Fmaster\u002Fassets\u002Fsignup_and_get_apikey.png)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Self-hosted Milvus Server (Docker) — for advanced users\u003C\u002Fsummary>\n\nFor multi-user or team environments with a dedicated Milvus instance. Requires Docker. See the [official installation guide](https:\u002F\u002Fmilvus.io\u002Fdocs\u002Finstall_standalone-docker-compose.md).\n\n```bash\nmemsearch config set milvus.uri http:\u002F\u002Flocalhost:19530\n```\n\n\u003C\u002Fdetails>\n\n> 📖 Full configuration guide: [Configuration](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fhome\u002Fconfiguration\u002F) · [Platform comparison](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002F)\n\n#### Capture Summarization Model\n\nEach plugin keeps its default capture summarization model unless you override it explicitly:\n\n```bash\nmemsearch config set plugins.codex.summarize.model gpt-5.1-codex-mini\nmemsearch config set plugins.opencode.summarize.model anthropic\u002Fclaude-haiku\n```\n\nPlugin-specific summarize settings do not fall back to `llm.model`; leave them empty or unset to preserve the default behavior.\n\n### What can you use it for?\n\n- **Resume debugging threads** — ask how a similar Redis, Docker, database, or deployment issue was fixed last time.\n- **Recover decision rationale** — find why the project chose one architecture, library, migration path, or API design over another.\n- **Trace feature history** — understand how a feature evolved across sessions, including the files changed and tradeoffs discussed.\n- **Do code archaeology** — ask when and why a module, config, or workflow was changed before touching it again.\n- **Find the right session to resume** — ask which previous conversation covered a topic, recover the relevant context, and continue from there.\n- **Carry context across agents** — keep Claude Code, Codex CLI, OpenClaw, and OpenCode working from the same project memory.\n\n---\n\n## 🛠️ For Agent Developers\n\nBeyond ready-to-use plugins, memsearch provides a complete **CLI and Python API** for building memory into your own agents. Whether you're adding persistent context to a custom agent, building a memory-augmented RAG pipeline, or doing harness engineering — the same core engine that powers the plugins is available as a library.\n\n### 🏗️ Architecture Overview\n\n```\n┌──────────────────────────────────────────────────────────────┐\n│                  🧑‍💻 For Agent Users (Plugins)                │\n│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐ ┌──────┐ │\n│  │ Claude   │ │ OpenClaw │ │ OpenCode │ │ Codex  │ │ Your │ │\n│  │ Code     │ │ Plugin   │ │ Plugin   │ │ Plugin │ │ App  │ │\n│  └────┬─────┘ └────┬─────┘ └────┬─────┘ └───┬────┘ └──┬───┘ │\n│       └─────────────┴────────────┴───────────┴────────┘     │\n├────────────────────────────┬─────────────────────────────────┤\n│  🛠️ For Agent Developers   │  Build your own with ↓          │\n│  ┌─────────────────────────┴──────────────────────────────┐  │\n│  │           memsearch CLI \u002F Python API                   │  │\n│  │      index · search · expand · watch · compact         │  │\n│  └─────────────────────────┬──────────────────────────────┘  │\n│  ┌─────────────────────────┴──────────────────────────────┐  │\n│  │           Core: Chunker → Embedder → Milvus            │  │\n│  │        Hybrid Search (BM25 + Dense + RRF)              │  │\n│  └────────────────────────────────────────────────────────┘  │\n├──────────────────────────────────────────────────────────────┤\n│  📄 Markdown Files (Source of Truth)                         │\n│  memory\u002F2026-03-27.md · memory\u002F2026-03-26.md · ...           │\n└──────────────────────────────────────────────────────────────┘\n```\n\nPlugins sit on top of the CLI\u002FAPI layer. The API handles indexing, searching, and Milvus sync. Markdown files are always the source of truth — Milvus is a rebuildable shadow index. Everything below the plugin layer is what you use as an agent developer.\n\n### How Plugins Work (Claude Code as example)\n\n**Capture — after each conversation turn:**\n\n```\nUser asks question → Agent responds → Stop hook fires\n                                          │\n                     ┌────────────────────┘\n                     ▼\n              Parse last turn\n                     │\n                     ▼\n         LLM summarizes (haiku)\n         \"- User asked about X.\"\n         \"- Claude did Y.\"\n                     │\n                     ▼\n         Append to memory\u002F2026-03-27.md\n         with \u003C!-- session:UUID --> anchor\n                     │\n                     ▼\n         memsearch index → Milvus\n```\n\n**Recall — 3-layer progressive search:**\n\n```\nUser: \"What did we discuss about batch size?\"\n                     │\n                     ▼\n  L1  memsearch search \"batch size\"    → ranked chunks\n                     │ (need more?)\n                     ▼\n  L2  memsearch expand \u003Cchunk_hash>    → full .md section\n                     │ (need original?)\n                     ▼\n  L3  parse-transcript \u003Csession.jsonl> → raw dialogue\n```\n\n### 📄 Markdown as Source of Truth\n\n```\n  Plugins append ──→  .md files  ←── human editable\n                          │\n                          ▼\n                  memsearch watch (live watcher)\n                          │\n                  detects file change\n                          │\n                          ▼\n                  re-chunk changed .md\n                          │\n                  hash each chunk (SHA-256)\n                          │\n              ┌───────────┴───────────┐\n              ▼                       ▼\n       hash unchanged?          hash is new\u002Fchanged?\n       → skip (no API call)     → embed → upsert to Milvus\n              │                       │\n              └───────────┬───────────┘\n                          ▼\n                ┌──────────────────┐\n                │  Milvus (shadow) │\n                │  always in sync  │\n                │  rebuildable     │\n                └──────────────────┘\n```\n\n### 📦 Installation\n\n```bash\n# Install as a global CLI tool — recommended when you mainly use the\n# `memsearch` command or any of the agent plugins (Claude Code, Codex,\n# OpenClaw, OpenCode), which all shell out to the CLI.\nuv tool install memsearch       # via uv\npipx install memsearch          # via pipx\npip install memsearch           # plain pip\n\n# Install as a project dependency — use this if you want to import\n# `memsearch` from your own Python code (e.g. via the MemSearch class).\nuv add memsearch                # via uv, adds to pyproject.toml\npip install memsearch           # into an activated venv\n```\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Optional embedding providers\u003C\u002Fb>\u003C\u002Fsummary>\n\n```bash\n# As a CLI tool (recommended — local ONNX, no API key)\nuv tool install \"memsearch[onnx]\"\npipx install \"memsearch[onnx]\"\npip install \"memsearch[onnx]\"\n\n# As a project dependency\nuv add \"memsearch[onnx]\"\n\n# Other options: [openai], [google], [voyage], [jina], [mistral], [ollama], [local], [all]\n```\n\n\u003C\u002Fdetails>\n\n### 🐍 Python API — Give Your Agent Memory\n\n```python\nfrom memsearch import MemSearch\n\nmem = MemSearch(paths=[\".\u002Fmemory\"])\n\nawait mem.index()                                      # index markdown files\nresults = await mem.search(\"Redis config\", top_k=3)    # semantic search\nscoped = await mem.search(\"pricing\", top_k=3, source_prefix=\".\u002Fmemory\u002Fproduct\")\nprint(results[0][\"content\"], results[0][\"score\"])       # content + similarity\n```\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Full example — agent with memory (OpenAI)\u003C\u002Fb> — click to expand\u003C\u002Fsummary>\n\n```python\nimport asyncio\nfrom datetime import date\nfrom pathlib import Path\nfrom openai import OpenAI\nfrom memsearch import MemSearch\n\nMEMORY_DIR = \".\u002Fmemory\"\nllm = OpenAI()                                        # your LLM client\nmem = MemSearch(paths=[MEMORY_DIR])                    # memsearch handles the rest\n\ndef save_memory(content: str):\n    \"\"\"Append a note to today's memory log (OpenClaw-style daily markdown).\"\"\"\n    p = Path(MEMORY_DIR) \u002F f\"{date.today()}.md\"\n    p.parent.mkdir(parents=True, exist_ok=True)\n    with open(p, \"a\") as f:\n        f.write(f\"\\n{content}\\n\")\n\nasync def agent_chat(user_input: str) -> str:\n    # 1. Recall — search past memories for relevant context\n    memories = await mem.search(user_input, top_k=3)\n    context = \"\\n\".join(f\"- {m['content'][:200]}\" for m in memories)\n\n    # 2. Think — call LLM with memory context\n    resp = llm.chat.completions.create(\n        model=\"gpt-4o-mini\",\n        messages=[\n            {\"role\": \"system\", \"content\": f\"You have these memories:\\n{context}\"},\n            {\"role\": \"user\", \"content\": user_input},\n        ],\n    )\n    answer = resp.choices[0].message.content\n\n    # 3. Remember — save this exchange and index it\n    save_memory(f\"## {user_input}\\n{answer}\")\n    await mem.index()\n\n    return answer\n\nasync def main():\n    # Seed some knowledge\n    save_memory(\"## Team\\n- Alice: frontend lead\\n- Bob: backend lead\")\n    save_memory(\"## Decision\\nWe chose Redis for caching over Memcached.\")\n    await mem.index()  # or mem.watch() to auto-index in the background\n\n    # Agent can now recall those memories\n    print(await agent_chat(\"Who is our frontend lead?\"))\n    print(await agent_chat(\"What caching solution did we pick?\"))\n\nasyncio.run(main())\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Anthropic Claude example\u003C\u002Fb> — click to expand\u003C\u002Fsummary>\n\n```bash\npip install memsearch anthropic\n```\n\n```python\nimport asyncio\nfrom datetime import date\nfrom pathlib import Path\nfrom anthropic import Anthropic\nfrom memsearch import MemSearch\n\nMEMORY_DIR = \".\u002Fmemory\"\nllm = Anthropic()\nmem = MemSearch(paths=[MEMORY_DIR])\n\ndef save_memory(content: str):\n    p = Path(MEMORY_DIR) \u002F f\"{date.today()}.md\"\n    p.parent.mkdir(parents=True, exist_ok=True)\n    with open(p, \"a\") as f:\n        f.write(f\"\\n{content}\\n\")\n\nasync def agent_chat(user_input: str) -> str:\n    # 1. Recall\n    memories = await mem.search(user_input, top_k=3)\n    context = \"\\n\".join(f\"- {m['content'][:200]}\" for m in memories)\n\n    # 2. Think — call Claude with memory context\n    resp = llm.messages.create(\n        model=\"claude-sonnet-4-5-20250929\",\n        max_tokens=1024,\n        system=f\"You have these memories:\\n{context}\",\n        messages=[{\"role\": \"user\", \"content\": user_input}],\n    )\n    answer = resp.content[0].text\n\n    # 3. Remember\n    save_memory(f\"## {user_input}\\n{answer}\")\n    await mem.index()\n    return answer\n\nasync def main():\n    save_memory(\"## Team\\n- Alice: frontend lead\\n- Bob: backend lead\")\n    await mem.index()\n    print(await agent_chat(\"Who is our frontend lead?\"))\n\nasyncio.run(main())\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Ollama (fully local, no API key)\u003C\u002Fb> — click to expand\u003C\u002Fsummary>\n\n```bash\npip install \"memsearch[ollama]\"\nollama pull nomic-embed-text          # embedding model\nollama pull llama3.2                  # chat model\n```\n\n```python\nimport asyncio\nfrom datetime import date\nfrom pathlib import Path\nfrom ollama import chat\nfrom memsearch import MemSearch\n\nMEMORY_DIR = \".\u002Fmemory\"\nmem = MemSearch(paths=[MEMORY_DIR], embedding_provider=\"ollama\")\n\ndef save_memory(content: str):\n    p = Path(MEMORY_DIR) \u002F f\"{date.today()}.md\"\n    p.parent.mkdir(parents=True, exist_ok=True)\n    with open(p, \"a\") as f:\n        f.write(f\"\\n{content}\\n\")\n\nasync def agent_chat(user_input: str) -> str:\n    # 1. Recall\n    memories = await mem.search(user_input, top_k=3)\n    context = \"\\n\".join(f\"- {m['content'][:200]}\" for m in memories)\n\n    # 2. Think — call Ollama locally\n    resp = chat(\n        model=\"llama3.2\",\n        messages=[\n            {\"role\": \"system\", \"content\": f\"You have these memories:\\n{context}\"},\n            {\"role\": \"user\", \"content\": user_input},\n        ],\n    )\n    answer = resp.message.content\n\n    # 3. Remember\n    save_memory(f\"## {user_input}\\n{answer}\")\n    await mem.index()\n    return answer\n\nasync def main():\n    save_memory(\"## Team\\n- Alice: frontend lead\\n- Bob: backend lead\")\n    await mem.index()\n    print(await agent_chat(\"Who is our frontend lead?\"))\n\nasyncio.run(main())\n```\n\n\u003C\u002Fdetails>\n\n> 📖 Full Python API reference: [Python API docs](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fpython-api\u002F)\n\n### ⌨️ CLI Usage\n\n**Setup:**\n\n```bash\nmemsearch config init                              # interactive setup wizard\nmemsearch config set embedding.provider onnx       # switch embedding provider\nmemsearch config set milvus.uri http:\u002F\u002Flocalhost:19530  # switch Milvus backend\n```\n\n**Index & Search:**\n\n```bash\nmemsearch index .\u002Fmemory\u002F                          # index markdown files\nmemsearch index .\u002Fmemory\u002F .\u002Fnotes\u002F --force         # re-embed everything\nmemsearch search \"Redis caching\"                   # hybrid search (BM25 + vector)\nmemsearch search \"auth flow\" --top-k 10 --json-output  # JSON for scripting\nmemsearch expand \u003Cchunk_hash>                      # show full section around a chunk\n```\n\n**Live Sync & Maintenance:**\n\n```bash\nmemsearch watch .\u002Fmemory\u002F                          # live file watcher (auto-index on change)\nmemsearch compact                                  # LLM-powered chunk summarization\nmemsearch stats                                    # show indexed chunk count\nmemsearch reset --yes                              # drop all indexed data and rebuild\n```\n\n> 📖 Full CLI reference with all flags: [CLI docs](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fcli\u002F)\n\n## ⚙️ Configuration\n\nEmbedding and Milvus backend settings → [Configuration (all platforms)](#️-configuration-all-platforms)\n\nSettings priority: Built-in defaults → `~\u002F.memsearch\u002Fconfig.toml` → `.memsearch.toml` → CLI flags.\n\n> 📖 Full config guide: [Configuration](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fhome\u002Fconfiguration\u002F)\n\n## 🔗 Links\n\n- 📖 [Documentation](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002F) — full guides, API reference, and architecture details\n- 🔌 [Platform Plugins](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fplatforms\u002F) — Claude Code, OpenClaw, OpenCode, Codex CLI\n- 💡 [Design Philosophy](https:\u002F\u002Fzilliztech.github.io\u002Fmemsearch\u002Fdesign-philosophy\u002F) — why markdown, why Milvus, competitor comparison\n- 🦞 [OpenClaw](https:\u002F\u002Fgithub.com\u002Fopenclaw\u002Fopenclaw) — the memory architecture that inspired memsearch\n- 🗄️ [Milvus](https:\u002F\u002Fmilvus.io\u002F) | [Zilliz Cloud](https:\u002F\u002Fcloud.zilliz.com\u002Fsignup?utm_source=github&utm_medium=referral&utm_campaign=memsearch-readme) — the vector database powering memsearch\n\n## 🤝 Contributing\n\nBug reports, feature requests, and pull requests are welcome! See the [Contributing Guide](CONTRIBUTING.md) for development setup, testing, and plugin development instructions. For questions and discussions, join us on [Discord](https:\u002F\u002Fdiscord.com\u002Finvite\u002FFG6hMJStWu).\n\n## 📄 License\n\n[MIT](LICENSE)\n","memsearch 是一个为各种AI代理（如Claude Code、Codex）提供持久化统一内存层的项目，支持Markdown和Milvus。其核心功能包括跨平台语义记忆共享、长期记忆存储以及基于向量的混合搜索技术，使得在一个AI代理中的对话可以在其他所有代理中作为可搜索上下文使用，无需额外配置。该项目特别适用于需要在多个AI编码助手之间保持一致性和连贯性的开发场景，同时也为开发者提供了强大的命令行接口以实现更灵活的记忆管理。",2,"2026-06-11 03:49:32","high_star"]