{"id":44418289,"url":"https://github.com/zilliztech/memsearch","last_synced_at":"2026-04-03T00:23:08.244Z","repository":{"id":337768805,"uuid":"1153190876","full_name":"zilliztech/memsearch","owner":"zilliztech","description":"A Markdown-first memory system, a standalone library for any AI agent. Inspired by OpenClaw.","archived":false,"fork":false,"pushed_at":"2026-02-12T11:34:41.000Z","size":25389,"stargazers_count":127,"open_issues_count":2,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-12T16:39:29.932Z","etag":null,"topics":["agent","agent-memory","claude-code","claude-code-plugin","clawdbot","embeddings","memory","milvus","openclaw","progressive-disclosure","rag","semantic-search"],"latest_commit_sha":null,"homepage":"https://zilliztech.github.io/memsearch/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zilliztech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-09T02:29:16.000Z","updated_at":"2026-02-12T16:30:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zilliztech/memsearch","commit_stats":null,"previous_names":["zilliztech/memsearch"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/zilliztech/memsearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilliztech%2Fmemsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilliztech%2Fmemsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilliztech%2Fmemsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilliztech%2Fmemsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zilliztech","download_url":"https://codeload.github.com/zilliztech/memsearch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilliztech%2Fmemsearch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29401074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","agent-memory","claude-code","claude-code-plugin","clawdbot","embeddings","memory","milvus","openclaw","progressive-disclosure","rag","semantic-search"],"created_at":"2026-02-12T09:05:53.801Z","updated_at":"2026-04-03T00:23:08.227Z","avatar_url":"https://github.com/zilliztech.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"assets/logo-icon.jpg\" alt=\"\" width=\"100\" valign=\"middle\"\u003e\n  \u0026nbsp;\n  memsearch\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eCross-platform semantic memory for AI coding agents.\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pypi.org/project/memsearch/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/memsearch?style=flat-square\u0026color=blue\" alt=\"PyPI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://zilliztech.github.io/memsearch/platforms/claude-code/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Claude_Code-plugin-c97539?style=flat-square\u0026logo=claude\u0026logoColor=white\" alt=\"Claude Code\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://zilliztech.github.io/memsearch/platforms/openclaw/\"\u003e\u003cimg src=\"https://img.shields.io/badge/OpenClaw-plugin-4a9eff?style=flat-square\" alt=\"OpenClaw\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://zilliztech.github.io/memsearch/platforms/opencode/\"\u003e\u003cimg src=\"https://img.shields.io/badge/OpenCode-plugin-22c55e?style=flat-square\" alt=\"OpenCode\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://zilliztech.github.io/memsearch/platforms/codex/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Codex_CLI-plugin-ff6b35?style=flat-square\" alt=\"Codex CLI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/memsearch/\"\u003e\u003cimg src=\"https://img.shields.io/badge/python-%3E%3D3.10-blue?style=flat-square\u0026logo=python\u0026logoColor=white\" alt=\"Python\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/zilliztech/memsearch/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/zilliztech/memsearch?style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/zilliztech/memsearch/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/zilliztech/memsearch/test.yml?branch=main\u0026style=flat-square\" alt=\"Tests\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://zilliztech.github.io/memsearch/\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-memsearch-blue?style=flat-square\" alt=\"Docs\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/zilliztech/memsearch/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/zilliztech/memsearch?style=flat-square\" alt=\"Stars\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://discord.com/invite/FG6hMJStWu\"\u003e\u003cimg src=\"https://img.shields.io/badge/Discord-chat-7289da?style=flat-square\u0026logo=discord\u0026logoColor=white\" alt=\"Discord\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://x.com/zilliz_universe\"\u003e\u003cimg src=\"https://img.shields.io/badge/follow-%40zilliz__universe-000000?style=flat-square\u0026logo=x\u0026logoColor=white\" alt=\"X (Twitter)\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/427b7152-bc16-408c-a8b0-59a2b05fd1e0\" alt=\"memsearch demo\" width=\"800\"\u003e\n\u003c/p\u003e\n\n### Why memsearch?\n\n- 🌐 **All Platforms, One Memory** — memories flow across [Claude Code](plugins/claude-code/README.md), [OpenClaw](plugins/openclaw/README.md), [OpenCode](plugins/opencode/README.md), and [Codex CLI](plugins/codex/README.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://zilliztech.github.io/memsearch/cli/) and [Python API](https://zilliztech.github.io/memsearch/python-api/) to build memory and harness engineering into your own agents\n- 📄 **Markdown is the source of truth** — inspired by [OpenClaw](https://github.com/openclaw/openclaw). 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### For Claude Code Users\n\n```bash\n# Install\n/plugin marketplace add zilliztech/memsearch\n/plugin 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/memory/          # you should see daily .md files\ncat .memsearch/memory/$(date +%Y-%m-%d).md\n```\n\n**Recall memories** — two ways to trigger:\n\n```\n/memory-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\u003e 📖 [Claude Code Plugin docs](https://zilliztech.github.io/memsearch/platforms/claude-code/) · [Troubleshooting](https://zilliztech.github.io/memsearch/platforms/claude-code-troubleshooting/)\n\n### For OpenClaw Users\n\n```bash\n# Install from ClawHub\nopenclaw plugins install clawhub:memsearch\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 ~/.openclaw/workspace/.memsearch/memory/\n# For other agents (e.g. work):\nls ~/.openclaw/workspace-work/.memsearch/memory/\n```\n\n**Recall memories** — two ways to trigger:\n\n```\n/memory-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\u003e 📖 [OpenClaw Plugin docs](https://zilliztech.github.io/memsearch/platforms/openclaw/)\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e🔧 For OpenCode Users\u003c/b\u003e\u003c/summary\u003e\n\n```json\n// In ~/.config/opencode/opencode.json\n{ \"plugin\": [\"@zilliz/memsearch-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/memory/    # daily .md files appear after a few conversations\n```\n\n**Recall memories** — two ways to trigger:\n\n```\n/memory-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\u003e 📖 [OpenCode Plugin docs](https://zilliztech.github.io/memsearch/platforms/opencode/)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e🔧 For Codex CLI Users\u003c/b\u003e\u003c/summary\u003e\n\n```bash\n# Install\nbash memsearch/plugins/codex/scripts/install.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/memory/\n```\n\n**Recall memories** — use the skill:\n\n```\n$memory-recall what did we discuss about deployment?\n```\n\n\u003e 📖 [Codex CLI Plugin docs](https://zilliztech.github.io/memsearch/platforms/codex/)\n\n\u003c/details\u003e\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\u003e All providers and models: [Configuration — Embedding Provider](https://zilliztech.github.io/memsearch/home/configuration/#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   # → ~/.memsearch/milvus.db\n```\n\n⭐ **Zilliz Cloud** (recommended) — fully managed, [free tier available](https://cloud.zilliz.com/signup?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=memsearch-readme) — [sign up](https://cloud.zilliz.com/signup?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=memsearch-readme) 👇:\n\n```bash\nmemsearch config set milvus.uri \"https://in03-xxx.api.gcp-us-west1.zillizcloud.com\"\nmemsearch config set milvus.token \"your-api-key\"\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e⭐ Sign up for a free Zilliz Cloud cluster\u003c/summary\u003e\n\nYou can [sign up](https://cloud.zilliz.com/signup?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=memsearch-readme) on Zilliz Cloud to get a free cluster and API key.\n\n![Sign up and get API key](https://raw.githubusercontent.com/zilliztech/CodeIndexer/master/assets/signup_and_get_apikey.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSelf-hosted Milvus Server (Docker) — for advanced users\u003c/summary\u003e\n\nFor multi-user or team environments with a dedicated Milvus instance. Requires Docker. See the [official installation guide](https://milvus.io/docs/install_standalone-docker-compose.md).\n\n```bash\nmemsearch config set milvus.uri http://localhost:19530\n```\n\n\u003c/details\u003e\n\n\u003e 📖 Full configuration guide: [Configuration](https://zilliztech.github.io/memsearch/home/configuration/) · [Platform comparison](https://zilliztech.github.io/memsearch/platforms/)\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 / 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/2026-03-27.md · memory/2026-03-26.md · ...           │\n└──────────────────────────────────────────────────────────────┘\n```\n\nPlugins sit on top of the CLI/API 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/2026-03-27.md\n         with \u003c!-- session:UUID --\u003e 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\u003e    → full .md section\n                     │ (need original?)\n                     ▼\n  L3  parse-transcript \u003csession.jsonl\u003e → 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/changed?\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# pip\npip install memsearch\n\n# or uv (recommended)\nuv add memsearch\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOptional embedding providers\u003c/b\u003e\u003c/summary\u003e\n\n```bash\npip install \"memsearch[onnx]\"    # Local ONNX (recommended, no API key)\n# or: uv add \"memsearch[onnx]\"\n\n# Other options: [openai], [google], [voyage], [ollama], [local], [all]\n```\n\n\u003c/details\u003e\n\n### 🐍 Python API — Give Your Agent Memory\n\n```python\nfrom memsearch import MemSearch\n\nmem = MemSearch(paths=[\"./memory\"])\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=\"./memory/product\")\nprint(results[0][\"content\"], results[0][\"score\"])       # content + similarity\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eFull example — agent with memory (OpenAI)\u003c/b\u003e — click to expand\u003c/summary\u003e\n\n```python\nimport asyncio\nfrom datetime import date\nfrom pathlib import Path\nfrom openai import OpenAI\nfrom memsearch import MemSearch\n\nMEMORY_DIR = \"./memory\"\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) / 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) -\u003e 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/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eAnthropic Claude example\u003c/b\u003e — click to expand\u003c/summary\u003e\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 = \"./memory\"\nllm = Anthropic()\nmem = MemSearch(paths=[MEMORY_DIR])\n\ndef save_memory(content: str):\n    p = Path(MEMORY_DIR) / 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) -\u003e 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/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOllama (fully local, no API key)\u003c/b\u003e — click to expand\u003c/summary\u003e\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 = \"./memory\"\nmem = MemSearch(paths=[MEMORY_DIR], embedding_provider=\"ollama\")\n\ndef save_memory(content: str):\n    p = Path(MEMORY_DIR) / 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) -\u003e 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/details\u003e\n\n\u003e 📖 Full Python API reference: [Python API docs](https://zilliztech.github.io/memsearch/python-api/)\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://localhost:19530  # switch Milvus backend\n```\n\n**Index \u0026 Search:**\n\n```bash\nmemsearch index ./memory/                          # index markdown files\nmemsearch index ./memory/ ./notes/ --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\u003e                      # show full section around a chunk\n```\n\n**Live Sync \u0026 Maintenance:**\n\n```bash\nmemsearch watch ./memory/                          # 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\u003e 📖 Full CLI reference with all flags: [CLI docs](https://zilliztech.github.io/memsearch/cli/)\n\n## ⚙️ Configuration\n\nEmbedding and Milvus backend settings → [Configuration (all platforms)](#️-configuration-all-platforms)\n\nSettings priority: Built-in defaults → `~/.memsearch/config.toml` → `.memsearch.toml` → CLI flags.\n\n\u003e 📖 Full config guide: [Configuration](https://zilliztech.github.io/memsearch/home/configuration/)\n\n## 🔗 Links\n\n- 📖 [Documentation](https://zilliztech.github.io/memsearch/) — full guides, API reference, and architecture details\n- 🔌 [Platform Plugins](https://zilliztech.github.io/memsearch/platforms/) — Claude Code, OpenClaw, OpenCode, Codex CLI\n- 💡 [Design Philosophy](https://zilliztech.github.io/memsearch/design-philosophy/) — why markdown, why Milvus, competitor comparison\n- 🦞 [OpenClaw](https://github.com/openclaw/openclaw) — the memory architecture that inspired memsearch\n- 🗄️ [Milvus](https://milvus.io/) | [Zilliz Cloud](https://cloud.zilliz.com/signup?utm_source=github\u0026utm_medium=referral\u0026utm_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://discord.com/invite/FG6hMJStWu).\n\n## 📄 License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilliztech%2Fmemsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzilliztech%2Fmemsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilliztech%2Fmemsearch/lists"}