{"slug": "magpie-search-a-federated-search-engine-for-llm-s-agents", "title": "Magpie-search – a federated search engine for LLM's/agents", "summary": "Magpie-search, a federated search engine for AI agents and LLMs, indexes local conversation history, files, knowledge graphs, vector stores, and the web into a single ranked answer with trust tiers. It runs entirely on-device with no telemetry, uses MCP to connect to AI systems, and supports five search modes including grep, lexical, semantic, hybrid, and rerank. The tool ensures AI agents can recover lost context after crashes and provides trustworthy, deduplicated results without data leaving the machine.", "body_md": "**A federated search engine — the search engine an AI agent or LLM reaches for when it needs to find something true to reason over.**\n\nEver had your computer reboot on you, or a power outage hit mid-session? Every\nthread your agent was holding — gone. Now you have the tool to get it back.\n**Never forget what your agent lost again.** Magpie indexes everything your AI\nhas ever worked through, locally, so a crash is a hiccup instead of amnesia.\n\nA normal search engine looks in one place. Magpie takes one question and fans it\nacross everything that matters at once — the AI's entire conversation history,\nthe files on the machine, a structured knowledge graph, a vector store, and the live\nweb — and pulls the answer back from wherever it actually lives.\n**Five sources, one call.**\n\nAnd it searches each one the right way. It can grep for an exact string or regex when you know the precise token — a file path, an error, a line of code. It can search by keyword. It can search by meaning, so it finds the thing even when the words don't match. It can do all of that at once.\n\nThen it does the part that makes it trustworthy: it fuses everything into a\nsingle ranked answer, and every result carries a **trust tier** — `fact > reference > lead > stale`\n\n. The solid sources rise, the loose ones are marked as\nleads to verify, duplicates collapse, and it's all trimmed to fit so it never\nfloods the AI's context. Ask it to go deep and it expands one question into many,\nreads the pages, and tells you how many independent sources agree — a full\nresearch sweep without an army of agents.\n\nIt runs **entirely on the machine**. No server, no account, and no telemetry\nunless you turn it on. The AI's transcripts and files never leave. It plugs into\nwhatever AI is running over **MCP**, so the agent can reach all six sources the\ninstant it needs them.\n\nIt is a tool for an AI — an agent or an LLM.\n\nAt its core is a local index of the AI's transcripts: a SQLite database with two structures built side by side —\n\n- an\n**FTS5** full-text index (BM25 keyword ranking), and - a\n**vector index**(`sqlite-vec`\n\n) of 384-dim embeddings produced locally by a small`all-MiniLM-L6-v2`\n\nmodel.\n\nEverything is **redacted at ingest** — a scrubber strips ~30 classes of secrets\n(keys, tokens, private keys, connection strings) before a single byte hits the\nindex.\n\nOn top of that index sit the **five search modes**:\n\n| Mode | What it does |\n|---|---|\n`grep` |\nliteral / regex match (exact tokens: paths, errors, code) |\n`lexical` |\nFTS5 / BM25 keyword |\n`semantic` |\nembedding K-NN, cosine distance in the vector index |\n`hybrid` |\nlexical + semantic fused by RRF |\n`rerank` |\nhybrid, then a cross-encoder (jina-reranker) re-scores each candidate |\n\nAround that sits the **federation layer** — the part that makes it federated:\n\n- A\n**provider plugin system.** Five backends (transcripts, files, knowledge graph, vector, web), each returns`Hit`\n\nobjects tagged with a trust tier. - A\n**fan-out**: one query goes to all providers concurrently (≤8 workers), each with a 5-second timeout that** fails open**— a slow source contributes nothing rather than blocking the call. **Trust-weighted RRF fusion**— Reciprocal Rank Fusion where each source's rank is multiplied by its trust weight (`fact ×3, reference ×2, lead ×1, stale ×0.3`\n\n), damping constant 60. This is the math that merges six heterogeneous sources into one honest ranking.**Cross-source dedup** by content hash — the same fact found in three places collapses to one hit, tagged with where else it appeared (corroboration).- A\n**token-budget trim**, so the merged set never overflows the calling AI's context.\n\nAnd it exposes all of this to an AI over an **MCP server** — the tools it hands\nan agent are exactly: `search`\n\n, `recent`\n\n, `session`\n\n, `list_sessions`\n\n, `stats`\n\n,\n`reindex`\n\n. Note what's *not* in that list: nothing that writes an answer.\n\nRAG = Retrieval-Augmented **Generation**. It's a two-stage pipeline, and the\ndefining stage is the second one: a retriever finds chunks → they're stuffed into\na prompt → a language model **generates** the prose answer. The \"G\" is the whole\npoint of the name; without a generator writing the answer, it isn't RAG.\n\nMagpie has no G:\n\n**There is no generator anywhere in the search path.** Nothing in Magpie composes a natural-language answer. The closest thing to a model — the cross-encoder reranker — outputs a relevance number per result and reorders the list. It scores; it never writes a sentence.**It stops at \"here are the ranked hits.\"** A RAG owns the prompt assembly and the model call. Magpie returns the fused, trust-ranked results and hands them back through MCP. What the AI does next — whether it even generates anything — is the AI's job, outside Magpie.**Its retriever is more than a RAG's retriever, not less.** A textbook RAG retriever is one vector store: embed the query, top-k by cosine, done. Magpie's retrieval is six sources, five modes, trust-weighted fusion, cross-source dedup. It's a far more capable \"R\" — but it's still only the R.\n\nPlug Magpie into an AI and the pair can form a RAG — Magpie is the R, the AI you bring is the G. But Magpie by itself ships only the R, and a stronger R than usual. It finds and ranks the truth; it never generates the answer.\n\nThe expensive part of \"deep research\" is **reasoning**, and the multi-agent\napproach pays for it N times over — one full LLM context per agent, often\n*millions* of tokens for a single question. But reasoning doesn't need to fan\nout; one capable model already in context can synthesize. Only the **searching**\nneeds breadth — and searching the web is pure retrieval, **zero LLM tokens**.\n\n`magpie-search deepweb`\n\nis built on that asymmetry. It fires several sub-queries\nat the web in parallel, fuses them by trust-weighted RRF + dedup-by-URL into one\ncompact, token-budget-trimmed source set, optionally reads the top pages' text\n(still token-free), and reports how many independent domains corroborate the\nresult — an agent-free version of the verification a research swarm pays agents\nto do.\n\nSo you get the breadth, page-reading, and corroboration of a multi-agent deep\nsearch, but your model only pays for a **single synthesis pass** over a trimmed\nresult set.\n\n**Token cost, measured — one deep question:**\n\n| Approach | Tokens the model pays |\n|---|---|\n| Multi-agent deep-research swarm (N agents each read pages into their own context) | ~2,000,000 |\n`magpie-search deepweb --thorough` (6 angles → 12 sources, 12 full pages read) |\n~1,050 |\n\nThat's **~2,000× fewer tokens** — about 1/2000th the cost — because the searching\nand page-reading are pure retrieval (**zero model tokens**); your model only does\nthe final synthesis pass over the trimmed, corroborated set.\n\n```\n# one question, several angles, read the top pages — all token-free retrieval\nmagpie-search deepweb \"the question\" --q \"another angle\" --q \"a third angle\" --thorough\n```\n\nThe model in your loop then does one synthesis pass over the merged, corroborated set. That's the whole saving: the breadth is free, you pay only for the answer.\n\n```\npip install magpie-search\n```\n\nOr install the latest straight from source (pulls all dependencies):\n\n```\npip install \"git+https://github.com/xfloukiex-lab/magpie-search.git\"\n```\n\nOptional — add the local-LLM features (the cross-encoder reranker runs on the base install; the session summarizer needs Ollama):\n\n```\n# 1. Install Ollama (free, runs entirely locally) — https://ollama.com/download\n# 2. Pull the model magpie-search uses\nollama pull phi3.5\n```\n\nPython 3.10+ on Windows, macOS, and Linux.\n\n```\nmagpie-search index                               # build the index (incremental)\nmagpie-search search \"that retry backoff thing\"   # keyword search\nmagpie-search search --mode hybrid \"...\"          # keyword + semantic, fused\nmagpie-search search --mode rerank \"...\"          # + cross-encoder rerank\nmagpie-search stats                               # sanity-check the index\n```\n\nMagpie speaks the Model Context Protocol, so any MCP-capable agent can call it. Point your client at the bundled server:\n\n```\n// e.g. an MCP client config\n{\n  \"mcpServers\": {\n    \"magpie\": { \"command\": \"magpie-search-mcp\" }\n  }\n}\n```\n\nThe agent then has `search`\n\n, `recent`\n\n, `session`\n\n, `list_sessions`\n\n, `stats`\n\n, and\n`reindex`\n\navailable — federated, trust-ranked, context-budgeted.\n\n| Command | What |\n|---|---|\n`magpie-search index` |\nIncremental indexing pass over `~/.claude/projects/` |\n`magpie-search search \"q\"` |\nSearch — `--mode grep|lexical|semantic|hybrid|rerank` |\n`magpie-search recent --n 30` |\nLatest 30 messages of the newest session |\n`magpie-search session SESSION-ID` |\nFull transcript of one session |\n`magpie-search list` |\nRecent sessions |\n`magpie-search stats` |\nIndex size, last-indexed time, row counts |\n`magpie-search backup` |\nBack up `~/.claude/projects/` to a configurable destination |\n\nAdd `--help`\n\nto any command for full options.\n\n``` python\nimport magpie_search\n\nresults = magpie_search.search(\"retry backoff\", mode=\"hybrid\", k=5)\nfor h in results[\"hits\"]:\n    print(h[\"trust\"], h[\"source\"], h[\"snippet\"])\n\n# LLM features (needs Ollama + phi3.5)\nimport magpie_search.llm\nranked  = magpie_search.llm.search_rerank(query=\"retry backoff\", k=3, pool=10)\nsummary = magpie_search.llm.summarize(session_id=\"abc-123\", n_messages=80)\n```\n\n`magpie-search backup`\n\ncopies your transcript tree to a destination of your\nchoice — a local folder (default, zero config), a remote SSH target (NAS / home\nserver), or a remote SSH target with VM boot/suspend. Configure it in\n`~/.magpie-search/backup.env`\n\n:\n\n```\nMAGPIE_SEARCH_BACKUP_SSH_HOST=user@nas.local\nMAGPIE_SEARCH_BACKUP_SSH_DEST=~/claude-transcripts/\n```\n\nUseful flags: `--dry-run`\n\n, `--no-suspend`\n\n, `--show-config`\n\n. Backup copies; it\nnever deletes originals.\n\nEverything is environment-variable driven with sensible defaults.\n\n| Var | Default | What |\n|---|---|---|\n`MAGPIE_SEARCH_HOME` |\n`~/.magpie-search` |\nData directory (DB, models, logs) |\n`MAGPIE_SEARCH_MODELS_DIR` |\n`$MAGPIE_SEARCH_HOME/models` |\nfastembed model cache |\n`MAGPIE_SEARCH_OLLAMA_HOST` |\n`http://localhost:11434` |\nOllama server URL |\n`MAGPIE_SEARCH_TOKENIZER` |\nheuristic | Set to `tiktoken` for precise budget counting |\n`MAGPIE_SEARCH_AUDIT_LOG` |\n`$MAGPIE_SEARCH_HOME/llm-audit.jsonl` |\nPer-call audit log |\n\nThe summarizer passes through a 6-probe guardrail stack (length,\nproper-noun-safety, identifier-safety, refusal-drift, semantic-grounding,\nself-verify); all six must pass for `trust: clean`\n\n. Any failure suppresses the\nsummary and returns `trust: degraded`\n\n— quiet over wrong. Raw messages stay\naccessible via `magpie-search session SESSION-ID`\n\n.\n\nMagpie Search is a local tool. No server, no account, no auto-update, no crash\nreporter, and **no telemetry unless you explicitly opt in** (see below). Your\ntranscripts, the index, the audit log, the model cache, and the backups all live\non your machine.\n\n**Opt-in telemetry.** Telemetry is **off by default** — magpie sends nothing\nuntil you run `magpie-search telemetry enable`\n\n(or set\n`MAGPIE_SEARCH_TELEMETRY=1`\n\n). When on, it sends only **anonymous usage**: which\ncommand ran, search mode, result/hit counts, latency, error class, and your\nmagpie/python/OS versions, tagged with a random install id. It **never** sends\nyour queries, file paths, results, transcript content, username, or IP — a\nhard content firewall in `telemetry.py`\n\ndrops anything that isn't a number or a\nshort enum token. Disable anytime with `magpie-search telemetry disable`\n\n; check\nstate with `magpie-search telemetry status`\n\n. The only\nnetwork calls it ever makes are: your local Ollama server (LLM features), your\nown backup target (only when you run `backup`\n\n), and a one-time model download\nfrom Hugging Face on first run. Verify it yourself with `tcpdump`\n\n, Wireshark, or\na network-blocked sandbox.\n\nRun `magpie-search index`\n\n(and optionally `backup`\n\n) on a schedule. Ready-made\nunits live in [ installers/](/xfloukiex-lab/magpie-search/blob/main/installers) for systemd (Linux), launchd (macOS),\nand Task Scheduler (Windows).\n\n**\"rsync not on PATH\"**— falls back to`scp -r`\n\n. On Windows, install[Git for Windows](https://git-scm.com/download/win), which ships rsync.**Search returns nothing**— run`magpie-search stats`\n\n; if`last_indexed_at`\n\nis null, run`magpie-search index`\n\n.**Summarizer always**— that's the false-positive guard working as designed. Raw transcripts remain available via`degraded`\n\n`session SESSION-ID`\n\n.\n\n**Magpie Search is built by VektorGeist LLC.**\n\nWe build local-first tools for people who run their own AI. Magpie is the search\ncore; our agent platform is at ** vektorgeist.com**.\n\n- Website:\n[vektorgeist.com](https://vektorgeist.com) - Contact:\n[floukie@vektorgeist.com](mailto:floukie@vektorgeist.com) - Issues & contributions: open an issue or PR on this repository.\n\nLicensed under the **Apache License 2.0** — see [LICENSE](/xfloukiex-lab/magpie-search/blob/main/LICENSE).\nCopyright © 2026 VektorGeist LLC.\n\n*\"Magpie Search\" and the magpie mark are trademarks of VektorGeist LLC. The code\nis open under Apache-2.0; the brand and name are reserved.*", "url": "https://wpnews.pro/news/magpie-search-a-federated-search-engine-for-llm-s-agents", "canonical_source": "https://github.com/xfloukiex-lab/magpie-search", "published_at": "2026-06-22 04:03:44+00:00", "updated_at": "2026-06-22 04:09:57.978065+00:00", "lang": "en", "topics": ["large-language-models", "ai-agents", "ai-tools", "ai-infrastructure", "ai-research"], "entities": ["Magpie-search", "SQLite", "FTS5", "sqlite-vec", "all-MiniLM-L6-v2", "jina-reranker", "MCP"], "alternates": {"html": "https://wpnews.pro/news/magpie-search-a-federated-search-engine-for-llm-s-agents", "markdown": "https://wpnews.pro/news/magpie-search-a-federated-search-engine-for-llm-s-agents.md", "text": "https://wpnews.pro/news/magpie-search-a-federated-search-engine-for-llm-s-agents.txt", "jsonld": "https://wpnews.pro/news/magpie-search-a-federated-search-engine-for-llm-s-agents.jsonld"}}