{"slug": "slothvault-a-zero-effort-local-mcp-rag-agent-that-rewards-digital-laziness-true", "title": "SlothVault: A Zero-Effort Local MCP + RAG Agent That Rewards Digital Laziness published: true", "summary": "A developer built SlothVault, a local-first personal RAG utility that ingests unorganized notes into a vault and retrieves relevant entries via an open-weight agent. The project pairs the all-MiniLM-L6-v2 sentence-transformer embedding model with Qwen2.5-1.5B-Instruct for answer synthesis, exposing retrieve_from_vault and add_to_vault as Model Context Protocol tool functions behind a Gradio interface.", "body_md": "This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady\n\n**SlothVault** is a local-first personal RAG utility built for anyone too tired or busy to manually sort, tag, and organize digital clutter.\n\nEvery day, developers and researchers accumulate messy context fragments:\n\nMost productivity guides advise spending hours building complex databases in Notion or Obsidian. SlothVault takes the lazy approach: **dump your unorganized notes into a local vault and let an open-weight agent fetch what you need in seconds.**\n\n`.txt` files on the fly.`retrieve_from_vault` and `add_to_vault`).\n\n``` python\nimport json\nimport torch\nimport numpy as np\nimport gradio as gr\nfrom transformers import pipeline\nfrom sentence_transformers import SentenceTransformer\nfrom sklearn.metrics.pairwise import cosine_similarity\n\n# 1. Load Local Open-Weight Models\nembed_model = SentenceTransformer(\"all-MiniLM-L6-v2\")\n\ndevice = \"cuda\" if torch.cuda.is_available() else \"cpu\"\nllm_pipeline = pipeline(\n    \"text-generation\",\n    model=\"Qwen/Qwen2.5-1.5B-Instruct\",\n    torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,\n    device_map=\"auto\" if torch.cuda.is_available() else None\n)\n\n# 2. In-Memory Vault & Seed Data\nvault_docs = [\n    \"WiFi Password for Home Lab is 'lazy_sloth_42'. Do not share externally.\",\n    \"Invoice #8841 from Cloud hosting was $45.20, due on November 5th.\",\n    \"Doctor appointment rescheduled to Friday at 4:30 PM with Dr. Sharma.\",\n    \"Project roadmap milestone 2 requires TabPFN model benchmarking by next Tuesday.\"\n]\nvault_embeddings = embed_model.encode(vault_docs)\n\n# 3. Model Context Protocol (MCP) Tool Functions\ndef mcp_retrieve_from_vault(query: str, top_k: int = 2):\n    global vault_docs, vault_embeddings\n    if not vault_docs:\n        return []\n    q_vec = embed_model.encode([query])\n    scores = cosine_similarity(q_vec, vault_embeddings)[0]\n    top_indices = np.argsort(scores)[::-1][:top_k]\n    return [{\"text\": vault_docs[i], \"similarity_score\": round(float(scores[i]), 3)} for i in top_indices]\n\ndef mcp_add_to_vault(new_text: str):\n    global vault_docs, vault_embeddings\n    cleaned = new_text.strip()\n    if not cleaned:\n        return \"Empty note.\"\n    vault_docs.append(cleaned)\n    new_embedding = embed_model.encode([cleaned])\n    vault_embeddings = np.vstack([vault_embeddings, new_embedding])\n    return f\"Added to vault. Total items: {len(vault_docs)}\"\n\n# 4. Agent Synthesis\nSYSTEM_PROMPT = (\n    \"You are SlothVault. The user is exhausted. You have executed the MCP tool \"\n    \"'retrieve_from_vault' and received matching records. \"\n    \"Give the exact answer in 1-2 punchy sentences. \"\n    \"End with a short sloth remark like 'Now go back to resting. 🦥'.\"\n)\n\ndef sloth_agent_search(query: str):\n    if not query.strip():\n        return \"Ask something you're too lazy to search for!\"\n\n    retrieved = mcp_retrieve_from_vault(query, top_k=2)\n    context_str = \"\\n\".join([f\"- {r['text']} (Match: {r['similarity_score']})\" for r in retrieved])\n\n    messages = [\n        {\"role\": \"system\", \"content\": SYSTEM_PROMPT},\n        {\"role\": \"user\", \"content\": f\"Query: {query}\\n\\nContext:\\n{context_str}\"}\n    ]\n\n    res = llm_pipeline(messages, max_new_tokens=120, temperature=0.2)\n    answer = res[0][\"generated_text\"][-1][\"content\"].strip()\n\n    trace = (\n        f\"```\n{% endraw %}\njson\\n\"\n        f\"// MCP Tool Execution Trace\\n\"\n        f'{{\"tool\": \"retrieve_from_vault\", \"query\": \"{query}\", \"matches\": {len(retrieved)}}}\\n'\n        f\"\n{% raw %}\n```\n\n\\n\\n\"\n\n        f\"**Retrieved Context:**\\n{context_str}\\n\\n\"\n\n        f\"---\\n\"\n\n        f\"###  Sloth Answer\\n{answer}\"\n\n    )\n\n    return trace\n\ndef handle_upload(file_obj, raw_text):\n\n    count = 0\n\n    if file_obj is not None:\n\n        with open(file_obj.name, \"r\", encoding=\"utf-8\", errors=\"ignore\") as f:\n\n            for line in f.readlines():\n\n                if line.strip():\n\n                    mcp_add_to_vault(line.strip())\n\n                    count += 1\n\n    if raw_text and raw_text.strip():\n\n        mcp_add_to_vault(raw_text.strip())\n\n        count += 1\n\n    return f\"Successfully ingested {count} item(s) into vault.\"\n\nwith gr.Blocks(theme=gr.themes.Soft(), title=\"SlothVault\") as demo:\n\n    gr.Markdown(\"#  SlothVault: Zero-Effort Local MCP + RAG Agent\")\n\n    gr.Markdown(\"Stop organizing notes manually. Dump raw clutter and let an open-weight agent retrieve it.\")\n\n```\nwith gr.Tab(\" Ask the Sloth Agent\"):\n    query_in = gr.Textbox(label=\"Ask anything:\", value=\"What is my home lab wifi password and when is the cloud bill due?\")\n    search_btn = gr.Button(\" Find It For Me\", variant=\"primary\")\n    output_box = gr.Markdown()\n    search_btn.click(fn=sloth_agent_search, inputs=query_in, outputs=output_box)\n\nwith gr.Tab(\" Dump More Clutter (Add Notes)\"):\n    note_in = gr.Textbox(label=\"Paste note or snippet:\", placeholder=\"e.g., Gate code is 8842\")\n    file_in = gr.File(label=\"Upload .txt file\", file_types=[\".txt\"])\n    add_btn = gr.Button(\" Ingest Without Organizing\")\n    status_box = gr.Markdown()\n    add_btn.click(fn=handle_upload, inputs=[file_in, note_in], outputs=status_box)\n```\n\ndemo.launch(share=True)\n\nHow I Built It\n\nSlothVault combines open-weight models, dense semantic retrieval, and the Model Context Protocol (MCP):\n\nStandardized MCP Tool Contracts: Instead of building an ad-hoc search script, the data operations implement retrieve_from_vault and add_to_vault tool definitions, ensuring compatibility with standard agent frameworks.\n\nFast Local Vector Search: sentence-transformers/all-MiniLM-L6-v2 embeds text into 384-dimensional vectors. Cosine similarity matching retrieves the top-ranked context in milliseconds without a heavy external vector database.\n\nLocal Open-Weight Reasoning: Qwen/Qwen2.5-1.5B-Instruct synthesizes the retrieved chunks on-device, extracting precise facts and avoiding generative hallucinations.\n\nWhy Does Open Innovation Matter?\n\nAbsolute Privacy: Personal notes, Wi-Fi credentials, medical reminders, and invoices never leave the machine. Running inference locally keeps sensitive personal data off third-party servers.\n\nZero Operating Cost: Powered by open weights, the agent runs entirely free of token limits, monthly subscriptions, or cloud API paywalls.\n\nOffline Reliability: Because the models run on-device, the agent functions normally on a laptop even without an internet connection.\n\nPrize Categories\n\nTop Prize: Slow and Steady ($250 USD)", "url": "https://wpnews.pro/news/slothvault-a-zero-effort-local-mcp-rag-agent-that-rewards-digital-laziness-true", "canonical_source": "https://dev.to/adibshaikh9922/slothvault-a-zero-effort-local-mcp-rag-agent-that-rewards-digital-lazinesspublished-true-k1d", "published_at": "2026-10-25 16:42:04+00:00", "updated_at": "2026-10-25 16:44:37.311840+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "large-language-models", "ai-search"], "entities": ["SlothVault", "Qwen2.5-1.5B-Instruct", "all-MiniLM-L6-v2", "Model Context Protocol", "Gradio", "Hacktoberfest"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/slothvault-a-zero-effort-local-mcp-rag-agent-that-rewards-digital-laziness-true", "markdown": "https://wpnews.pro/news/slothvault-a-zero-effort-local-mcp-rag-agent-that-rewards-digital-laziness-true.md", "text": "https://wpnews.pro/news/slothvault-a-zero-effort-local-mcp-rag-agent-that-rewards-digital-laziness-true.txt", "jsonld": "https://wpnews.pro/news/slothvault-a-zero-effort-local-mcp-rag-agent-that-rewards-digital-laziness-true.jsonld"}}