{"slug": "docs-pipe-turn-your-docs-into-a-searchable-question-answering-ai", "title": "🧠 docs-pipe — Turn Your Docs Into a Searchable, Question-Answering AI", "summary": "Pipe has released docs-pipe, a documentation-native RAG module and web dashboard that turns Markdown documentation into a searchable, question-answering AI with heading-aware chunking, hybrid search, cited answers, and a one-command UI. The module indexes 28 files into 317 chunks, supports incremental re-indexing via SHA-256 hashing, and works offline with local embeddings, with doc_ask costing about $0.0002 per answer. The dashboard, served on :8090, includes live search, filters, cited answers, and stats, and can also run as an MCP server exposing search_docs, ask_docs, and read_doc tools.", "body_md": "[← All posts← Alle Beiträge](../blog.html)\n\n# 🧠 docs-pipe — Turn Your Docs Into a Searchable, Question-Answering AI\n\n**A documentation-native RAG module and a web dashboard — heading-aware chunking, hybrid search, cited answers, and a one-command UI. All in pure Pipe.**\n\n> **Related:** [RAG in ~10 lines](tutorial-local-rag.html) · [Your first MCP server](tutorial-first-mcp-server.html)\n\nYour `docs/`\n\nfolder is the most underused asset in the repo. It has the answers — but nobody *searches* it, because classic RAG means standing up a stack: a vector database, an embedding SDK, a chunking library, and glue code to wire it together. Then you maintain all of it.\n\n`docs-pipe`\n\ncollapses that into **one module** (pure Pipe, zero native dependencies) and **one example** that turns it into a dashboard.\n\n## The module: six functions\n\nInstall it like any Pipe module:\n\n```\npipe -get sqlite\npipe -get docs-pipe\n```\n\nThen index a Markdown tree, search it by *meaning + keywords*, and ask questions with cited answers:\n\n```\nai_provider \"deepseek\"\nimport \"sqlite.pipe\"\nimport \"docs-pipe\"\n\nidx: doc_index \"docs/en\" {lang: \"en\", db: \"pipe_docs.db\"}\nprint (to_str (doc_index_status idx))     -- {files: 28, chunks: 317, lang: en}\n\n-- Hybrid retrieval: keywords + semantics, fused\nfor r in (doc_search idx \"How does the bytecode VM work?\" 3)\n    print ((get r \"path\") ++ \":\" ++ (to_str (get r \"line_start\")) ++ \" — \" ++ (get r \"heading\"))\n\n-- Grounded answer, with sources\nres: doc_ask idx \"What is MCP?\" 3\nprint (get res \"answer\")                  -- answers and cites [1], [2], [3]\n\ndoc_close idx                              -- persist to pipe_docs.db\n```\n\nThe full API is six functions: `doc_index`\n\n, `doc_index_status`\n\n, `doc_search`\n\n, `doc_ask`\n\n, `doc_reindex`\n\n, `doc_close`\n\n.\n\n**What it does that a naive \"embed everything\" script doesn't:**\n\n**Heading-aware chunking.** Documents are split on`#`\n\n/`##`\n\n/`###`\n\nboundaries, fenced code blocks stay intact, and every chunk remembers its file, line range, and heading path (`Bytecode VM > Components > Compiler`\n\n). Indexing`docs/en`\n\nyields**28 files → 317 chunks**.** Hybrid search.**A TF-IDF keyword score and a cosine-similarity score are fused — and the weights adapt automatically: local 128-dim embeddings lean on keywords, OpenAI's 1536-dim embeddings lean on semantics.**Cited answers.**`doc_ask`\n\nreturns the answer *and* the sources (`path:line — heading`\n\n), so you can always trace a claim back to the doc.**Incremental re-indexing.** Each file is hashed with SHA-256;`doc_reindex`\n\nre-chunks and re-embeds only what changed.**Works offline.** DeepSeek has no embedding API, so`embed`\n\nfalls back to a built-in local embedding — indexing and search run with**no API key**. Only`doc_ask`\n\nneeds one, and a full answer costs about**$0.0002**.\n\n## The dashboard: docs-pipe with a face\n\n`docs-pipe`\n\nis the engine; `examples/docs_pipe_dashboard.pipe`\n\nis the product. One command:\n\n```\nmake docs-dashboard\n```\n\nIt builds, indexes `docs/en`\n\n, serves on `:8090`\n\n, and opens your browser. What you get:\n\n**Live search**— type and results appear, debounced, with matched terms highlighted and every hit linking to a** source viewer**that scrolls to the exact line.** Filters**— by file and language (`en`\n\n/`de`\n\n), with a result count and millisecond latency.**Ask**— a cited answer with the sources rendered below it, each one clickable.** Stats**— files, chunks, vector dimension, AI call count, and cost, plus a log of your recent queries.** A real menu**— sticky nav, burger menu on mobile, progress bar on every request, copy-to-clipboard buttons.\n\nThe same file doubles as an **MCP server**. Run it with `PIPE_MODE=mcp`\n\nand it exposes three tools — `search_docs`\n\n, `ask_docs`\n\n, `read_doc`\n\n— so Claude Desktop, Cursor, or any MCP client can query your documentation directly, in the editor.\n\n```\nPIPE_MODE=mcp DEEPSEEK_API_KEY=... ./bin/pipe examples/docs_pipe_dashboard.pipe\n```\n\n## Honest limits\n\n**Local embeddings are weaker** than OpenAI's. Semantic recall is *fine* for a docs folder, but if you want best-in-class retrieval, set`ai_provider \"openai\"`\n\n.**Search is brute-force** over the in-memory index. It's a few milliseconds for a few hundred chunks and stays snappy into the low thousands — it is *not* a FAISS replacement for a hundred thousand documents.- The dashboard is a demo, not a multi-tenant service: one process, one index, one query at a time.\n\n## Try it\n\n- Module:\n— 418 lines of pure Pipe.`pipe-modules/docs-pipe`\n\n- Example:\n.`examples/docs_pipe_dashboard.pipe`\n\n```\ngit clone https://github.com/MachuraHarry/pipe\ngit clone https://github.com/MachuraHarry/pipe-modules   # sibling directory\ncd pipe && make docs-dashboard                            # opens http://localhost:8090\n```\n\n# 🧠 docs-pipe — Verwandle deine Doku in eine durchsuchbare, Frage-beantwortende KI\n\n**Ein dokumentations-natives RAG-Modul und ein Web-Dashboard — heading-bewusstes Chunking, hybride Suche, zitierte Antworten und ein Ein-Befehl-UI. Alles in reinem Pipe.**\n\n> **Verwandt:** [RAG in ~10 Zeilen](tutorial-local-rag.html) · [Dein erster MCP-Server](tutorial-first-mcp-server.html)\n\nDein `docs/`\n\n-Ordner ist der am meisten unterschätzte Schatz im Repo. Er hat die Antworten — aber niemand *sucht* darin, weil klassisches RAG einen ganzen Stack bedeutet: eine Vektor-DB, ein Embedding-SDK, eine Chunking-Bibliothek und Kleber-Code. Und dann pflegst du das alles.\n\n`docs-pipe`\n\nreduziert das auf **ein Modul** (reines Pipe, null native Abhängigkeiten) und **ein Beispiel**, das daraus ein Dashboard macht.\n\n## Das Modul: sechs Funktionen\n\nInstallieren wie jedes Pipe-Modul:\n\n```\npipe -get sqlite\npipe -get docs-pipe\n```\n\nDann einen Markdown-Baum indexieren, nach *Bedeutung + Keywords* durchsuchen und Fragen mit zitierten Antworten stellen:\n\n```\nai_provider \"deepseek\"\nimport \"sqlite.pipe\"\nimport \"docs-pipe\"\n\nidx: doc_index \"docs/en\" {lang: \"en\", db: \"pipe_docs.db\"}\nprint (to_str (doc_index_status idx))     -- {files: 28, chunks: 317, lang: en}\n\n-- Hybride Suche: Keywords + Semantik, fusioniert\nfor r in (doc_search idx \"Wie funktioniert die Bytecode-VM?\" 3)\n    print ((get r \"path\") ++ \":\" ++ (to_str (get r \"line_start\")) ++ \" — \" ++ (get r \"heading\"))\n\n-- Fundierte Antwort, mit Quellen\nres: doc_ask idx \"Was ist MCP?\" 3\nprint (get res \"answer\")                  -- antwortet und zitiert [1], [2], [3]\n\ndoc_close idx                              -- in pipe_docs.db persistieren\n```\n\nDie komplette API besteht aus sechs Funktionen: `doc_index`\n\n, `doc_index_status`\n\n, `doc_search`\n\n, `doc_ask`\n\n, `doc_reindex`\n\n, `doc_close`\n\n.\n\n**Was es besser macht als ein naives „alles einbetten\"-Skript:**\n\n**Heading-bewusstes Chunking.** Dokumente werden an`#`\n\n/`##`\n\n/`###`\n\n-Grenzen geteilt, umschlossene Code-Blöcke bleiben intakt, und jeder Chunk merkt sich Datei, Zeilenbereich und Überschriftenpfad (`Bytecode VM > Komponenten > Compiler`\n\n).`docs/en`\n\nergibt**28 Dateien → 317 Chunks**.** Hybride Suche.**Ein TF-IDF-Keyword-Score und ein Kosinus-Ähnlichkeits-Score werden fusioniert — und die Gewichtung passt sich automatisch an: lokale 128-dim-Embeddings setzen auf Keywords, OpenAIs 1536-dim-Embeddings auf Semantik.**Zitierte Antworten.**`doc_ask`\n\nliefert die Antwort *und* die Quellen (`path:line — heading`\n\n), damit jede Behauptung nachvollziehbar ist.**Inkrementelles Indexieren.** Jede Datei wird per SHA-256 gehasht;`doc_reindex`\n\nzerlegt und bettet nur Geändertes neu ein.**Läuft offline.** DeepSeek hat keine Embedding-API, daher fällt`embed`\n\nauf ein eingebautes lokales Embedding zurück — Indexieren und Suchen laufen**ohne API-Key**. Nur`doc_ask`\n\nbraucht einen, und eine volle Antwort kostet rund**$0,0002**.\n\n## Das Dashboard: docs-pipe mit Gesicht\n\n`docs-pipe`\n\nist der Motor; `examples/docs_pipe_dashboard.pipe`\n\nist das Produkt. Ein Befehl:\n\n```\nmake docs-dashboard\n```\n\nEr baut, indexiert `docs/en`\n\n, startet auf `:8090`\n\nund öffnet den Browser. Was du bekommst:\n\n**Live-Suche**— tippen und Ergebnisse erscheinen (debounced), Trefferbegriffe markiert, jeder Treffer verlinkt auf einen** Quelltext-Viewer**, der zur exakten Zeile scrollt.** Filter**— nach Datei und Sprache (`en`\n\n/`de`\n\n), mit Trefferzahl und Latenz in Millisekunden.**Ask**— eine zitierte Antwort mit den darunter gerenderten, klickbaren Quellen.** Stats**— Dateien, Chunks, Vektor-Dimension, KI-Aufrufe und Kosten, plus ein Log deiner letzten Suchen.** Ein echtes Menü**— Sticky-Navigation, Burger-Menü auf Mobile, Fortschrittsbalken bei jeder Anfrage, Copy-to-Clipboard-Buttons.\n\nDieselbe Datei ist zugleich ein **MCP-Server**. Mit `PIPE_MODE=mcp`\n\nstellt sie drei Tools bereit — `search_docs`\n\n, `ask_docs`\n\n, `read_doc`\n\n— sodass Claude Desktop, Cursor oder jeder MCP-Client deine Dokumentation direkt im Editor befragen kann.\n\n```\nPIPE_MODE=mcp DEEPSEEK_API_KEY=... ./bin/pipe examples/docs_pipe_dashboard.pipe\n```\n\n## Ehrliche Grenzen\n\n**Lokale Embeddings sind schwächer** als die von OpenAI. Semantisches Retrieval ist *in Ordnung* für einen Doku-Ordner, aber für beste Qualität setze`ai_provider \"openai\"`\n\n.**Die Suche ist Brute-Force**über den In-Memory-Index. Das sind wenige Millisekunden bei ein paar hundert Chunks und bleibt bis in den niedrigen Tausenderbereich flott — ein FAISS-Ersatz für hunderttausend Dokumente ist es *nicht*.- Das Dashboard ist eine Demo, kein Multi-Tenant-Service: ein Prozess, ein Index, eine Anfrage gleichzeitig.\n\n## Ausprobieren\n\n- Modul:\n— 418 Zeilen reines Pipe.`pipe-modules/docs-pipe`\n\n- Beispiel:\n.`examples/docs_pipe_dashboard.pipe`\n\n```\ngit clone https://github.com/MachuraHarry/pipe\ngit clone https://github.com/MachuraHarry/pipe-modules   # Geschwister-Ordner\ncd pipe && make docs-dashboard                            # öffnet http://localhost:8090\n```\n\n", "url": "https://wpnews.pro/news/docs-pipe-turn-your-docs-into-a-searchable-question-answering-ai", "canonical_source": "https://pipe-lang.com/blog/docs-pipe-dashboard.html", "published_at": "2026-08-15 14:40:43.607650+00:00", "updated_at": "2026-08-15 14:40:45.888896+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "generative-ai", "ai-tools", "ai-products"], "entities": ["Pipe", "docs-pipe", "DeepSeek", "OpenAI", "Claude Desktop", "Cursor", "MCP"], "alternates": {"html": "https://wpnews.pro/news/docs-pipe-turn-your-docs-into-a-searchable-question-answering-ai", "markdown": "https://wpnews.pro/news/docs-pipe-turn-your-docs-into-a-searchable-question-answering-ai.md", "text": "https://wpnews.pro/news/docs-pipe-turn-your-docs-into-a-searchable-question-answering-ai.txt", "jsonld": "https://wpnews.pro/news/docs-pipe-turn-your-docs-into-a-searchable-question-answering-ai.jsonld"}}