From 17a0abe5e56311d8c5027fbd6ff3aba820ada5ff Mon Sep 17 00:00:00 2001 From: Halleys123 Date: Sat, 18 Apr 2026 14:15:43 +0530 Subject: [PATCH] Refactor configuration files and update documentation - Changed Python version format in CI workflow from double quotes to single quotes. - Updated README.md to improve clarity and remove outdated sections, added new features and CLI commands. - Enhanced chat UI styles in chat.html for better readability and user experience. - Ensured all JSON knowledge files end with a newline for consistency. - Modified smoke-local mesh configuration (meshmind.yaml) to use single quotes for string values. --- .github/workflows/ci.yml | 2 +- README.md | 126 +++++--------- meshmind/ui/template/chat.html | 282 +++++++++++++++++++------------- my-project/data/knowledge.json | 2 +- smoke-local/data/knowledge.json | 2 +- smoke-local/meshmind.yaml | 22 +-- 6 files changed, 228 insertions(+), 208 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89c3e44..da02443 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ['3.11'] steps: - name: Checkout diff --git a/README.md b/README.md index 2ce638e..c1ce61f 100644 --- a/README.md +++ b/README.md @@ -28,56 +28,14 @@ This is not distributed inference for a single giant model. MeshMind is built ar - **Parallel fan-out**: Multi-capability queries can be sent to multiple nodes concurrently. - **Coordinator aggregation**: Responses are combined into a single final answer. - **Built-in dashboard**: Monitor mesh topology, routing activity, query traces, and node availability. +- **Dashboard cards**: Hover a node to inspect capabilities, knowledge domains, tools, and system prompt previews without exposing raw knowledge file lists or plugin ids. - **CLI-first workflow**: Bootstrap, validate, run, and query the mesh from the terminal. - **Python SDK**: Create and control meshes programmatically. - **Local-model runtime**: Uses Ollama-backed local models instead of remote APIs. - **Knowledge-aware nodes**: Load local knowledge files into specific nodes. - **Manual discovery fallback**: Useful for restrictive firewalls, unusual LANs, or offline field setups. - ---- - -## What Makes MeshMind Different - -Other tools split one model across devices to make it run faster. **MeshMind does something different** — each device runs its own specialized AI agent, and they collaborate to solve complex queries that no single agent could answer alone. - -``` -Exo / mesh-llm: "Split one 70B model across three laptops" -MeshMind: "A medical AI, a logistics AI, and a coordinator - work as a team across three laptops" - -DISTRIBUTED INFERENCE VS DISTRIBUTED COLLABORATION -``` - ---- - -## How It Works - -``` -User sends query - ↓ -┌───────────────┐ -│ COORDINATOR │ Decomposes query, classifies capabilities needed -└───────────────┘ - ↓ -┌───────────────┐ ┌───────────────┐ -│ AGENT A │ │ AGENT B │ Each runs its own LLM + knowledge base -│ Medical │ │ Logistics │ Processes in parallel via function calling -└───────────────┘ └───────────────┘ - ↓ ↓ - ┌───────────────┐ - │ AGGREGATION │ Combines responses into unified answer - └───────────────┘ - ↓ -User sees one coherent response -Dashboard shows routing in real-time -``` - -1. Define your AI agents in a `meshmind.yaml` file -2. Run `meshmind up` — agents discover each other automatically via mDNS -3. Send a query — MeshMind decomposes it, routes sub-queries to the right agents, and aggregates their answers -4. Everything runs locally. No internet. No cloud. No data leaves your network - ---- +- **Plugins**: Drop-in packages under `~/.meshmind/plugins/` (or `MESHMIND_PLUGIN_DIR`) merged into specialist nodes via `plugin: ` in `meshmind.yaml`. See [docs/plugins.md](docs/plugins.md) for layout and merge rules. +- **Init presets / wizard**: `meshmind init --preset code` for a multi-specialist template; `meshmind init --wizard` for an interactive flow. ## Dashboard @@ -108,10 +66,12 @@ http://localhost:8080 Paths on the same coordinator UI: -- `/dashboard` - topology canvas, connected nodes, and live event log -- `/chat` - full-page mesh query composer (same `POST /api/query` backend) +- **`/dashboard`** — topology canvas, connected nodes, and live event log +- **`/chat`** — full-page mesh query composer (same `POST /api/query` backend) + +The dashboard sidebar also shows plugin cards for installed prompt packs, with prompt previews and tool summaries. When a plugin lives inside this repository, its source folder is linked directly from the card. -If `/chat` returns `{"detail":"Not Found"}`, the running process is an older MeshMind build: stop the mesh (Ctrl+C), then from the repo root run `pip install -e .` and start again with `meshmind up` so the coordinator loads the current `meshmind.ui.app` routes. +If **`/chat`** returns `{"detail":"Not Found"}`, the running process is an older MeshMind build: stop the mesh (type `stop` in the `meshmind up` REPL, or Ctrl+C if you used `--no-interactive`), then from the repo root run `pip install -e .` and start again with `meshmind up` so the coordinator loads the current `meshmind.ui.app` routes. ## Benchmarks @@ -131,14 +91,6 @@ Current benchmarking priorities: - disconnect and rejoin behavior - failure handling under node loss -Run current benchmark suite: - -```bash -meshmind benchmark --suite minimum --runs 5 -o benchmark-report.json -``` - ---- - ## Quick Start Devices running MeshMind can discover each other automatically over local networks. The default generated project also exposes a local dashboard on the configured `ui_port`. @@ -160,7 +112,7 @@ Prerequisites: Clone the repo and bootstrap the environment: ```bash -git clone https://github.com/MeshMind-Labs/MeshMind.git +git clone https://github.com/Nexarion-Distributed-AI/MeshMind.git cd MeshMind # Windows PowerShell @@ -180,7 +132,7 @@ source .venv/bin/activate # .\.venv\Scripts\Activate.ps1 ``` -Run environment diagnostics: +Run the environment diagnostics: ```bash meshmind doctor @@ -195,12 +147,30 @@ meshmind config validate -c meshmind.yaml meshmind up -c meshmind.yaml ``` -Query it from another terminal: +**Presets:** `meshmind init --preset default` (same as omitting `--preset`) uses the generic assistant + coordinator template. `meshmind init --preset code` generates a reviewer + security + coordinator mesh and, by default, copies bundled demo plugins `demo_review` and `demo_security` into your plugin directory. Use `--skip-bundled-plugins` to only write YAML. In a normal terminal, bare `meshmind init` (no name, default options) starts the same interactive wizard as `meshmind init --wizard`; the wizard shows a Rich preview and asks for confirmation before creating files. + +**Wizard:** `meshmind init --wizard` interactively chooses a preset and project name (optional NAME as the first argument). + +**Plugins CLI:** `meshmind plugin list`, `meshmind plugin list --available` / `meshmind plugin catalog`, `meshmind plugin install `, `meshmind plugin sync -c meshmind.yaml`, `meshmind plugin validate `, `meshmind plugin remove `. Details: [docs/plugins.md](docs/plugins.md). + +**Two-terminal workflow (Claude Code–style):** the terminal where you run `meshmind up` starts an **interactive REPL** with a **`›`** prompt. Mesh **INFO** logs are written to **`.meshmind/logs/mesh-.log`** next to your YAML (not mixed into that REPL). Open a **second** terminal and tail them: + +```bash +meshmind logs -f -c meshmind.yaml +``` + +**REPL behavior:** use **`/help`** (or `help`) for commands. **`/status`**, **`/urls`**, **`/query …`**, and **`/stop`** (or `stop` / `exit`) work with or without the leading slash. **Enter** submits; **Ctrl+J** inserts a newline for multi-line questions. Answers are rendered with **Rich** (metadata panel + markdown). **Tab** completes commands and configured node names. Input history is stored in **`.meshmind/repl_history`** next to your `meshmind.yaml`. + +Query from either terminal: in the REPL type a line (it is sent as a query) or **`/query …`**; or from another shell: ```bash meshmind query "Summarize the latest AI trends in 5 bullets" -c meshmind.yaml -t 300 ``` +**CLI output format:** `meshmind query` defaults to **`--format auto`** — **markdown** when stdout is a TTY (styled panel + markdown body), **plain text** when not (e.g. pipes/CI). Use **`--format json`** for a stable JSON object (`result`, `nodes_used`, `duration`, `unavailable_nodes`, `trace`). + +For a **single** terminal with the old log stream on stdout (e.g. CI), use `meshmind up -c meshmind.yaml --log-to-stdout`. To skip the REPL and wait until Ctrl+C only: `--no-interactive`. + ### Python SDK MeshMind also provides a Python SDK for programmatic mesh creation: @@ -237,7 +207,7 @@ await mesh.stop() ## Example Configuration -`meshmind.yaml` defines the mesh, default model settings, and participating nodes: +`meshmind.yaml` defines the mesh, default model settings, and the participating nodes: ```yaml mesh: @@ -256,6 +226,11 @@ nodes: capabilities: - 'data_analysis' - 'statistics' + knowledge_domains: + - 'data' + - 'statistics' + knowledge: + - ./data/knowledge.json writer: type: 'specialist' @@ -273,23 +248,26 @@ nodes: ui_port: 8080 ``` +Additional committed examples: + +- [my-project/meshmind.yaml](my-project/meshmind.yaml) +- [smoke-local/meshmind.yaml](smoke-local/meshmind.yaml) + ## CLI Reference ```bash meshmind init -meshmind up +meshmind up [-c meshmind.yaml] [--no-interactive] [--log-to-stdout] [--log-file PATH] +meshmind logs [-c meshmind.yaml] [-f] [-n 200] meshmind down meshmind stats meshmind nodes meshmind query "text" -meshmind benchmark meshmind doctor meshmind config validate meshmind config show ``` ---- - ## Architecture ```text @@ -305,8 +283,6 @@ meshmind/ |- ui/ FastAPI dashboard ``` ---- - ## Current Status MeshMind is currently an early open source release focused on: @@ -325,8 +301,6 @@ Current focus areas: - offline/manual-peer workflows - mobile-node interoperability ---- - ## Current Limitations - Large models may exceed available RAM and create unstable first-run behavior. @@ -335,25 +309,21 @@ Current focus areas: - Multi-device routing is implemented, but guaranteed speedup has not yet been comprehensively benchmarked. - Mobile-node support is still experimental and not yet a stable documented flow. ---- - ## Guides - [2-device LAN guide](docs/lan-two-device.md) -- [Testing and benchmarking guide](docs/tests.md) - [Known limitations](docs/known-limitations.md) - ---- +- [Vision](VISION.md) ## Testing -Run the automated test suite from repository root: +Run the automated test suite from the repository root: ```bash python -m pytest tests -q ``` -The current suite covers: +The current test suite covers: - protocol serialization - routing behavior @@ -362,8 +332,6 @@ The current suite covers: - CLI helper logic - SDK lifecycle behavior ---- - ## Use Cases - private local developer assistants @@ -372,8 +340,6 @@ The current suite covers: - offline or degraded-network operations - edge and field-device intelligence coordination ---- - ## Contributing See: @@ -388,8 +354,6 @@ python -m pip install -e . python -m pytest tests -q ``` ---- - ## License MeshMind is licensed under the [Apache License 2.0](LICENSE). diff --git a/meshmind/ui/template/chat.html b/meshmind/ui/template/chat.html index 3590c8b..5c0ab07 100644 --- a/meshmind/ui/template/chat.html +++ b/meshmind/ui/template/chat.html @@ -16,16 +16,23 @@ + MeshMind - Mesh Chat +

MESHMIND // MESH CHAT

@@ -763,21 +869,17 @@

How can I help today?

-

Type / for commands or write a question for the mesh.

+

Type / for commands or + write a question for the mesh.

- +
- +
@@ -786,11 +888,13 @@

" ); i++; continue; @@ -1127,8 +1214,8 @@

if (/^##\s+/.test(trimmed)) { chunks.push( '

' + - formatInlineMarkdown(trimmed.replace(/^##\s+/, "")) + - "

" + formatInlineMarkdown(trimmed.replace(/^##\s+/, "")) + + "" ); i++; continue; @@ -1157,30 +1244,12 @@

chunks.push("
    " + items.join("") + "
"); continue; } - if (/^>\s?/.test(trimmed)) { - const quoteLines = []; - while (i < lines.length) { - const t = lines[i].trim(); - if (t === "") break; - if (!/^>\s?/.test(t)) break; - quoteLines.push(t.replace(/^>\s?/, "")); - i++; - } - chunks.push( - '
' + - formatInlineMarkdown(quoteLines.join("\n")) + - "
" - ); - continue; - } const paraLines = []; while (i < lines.length) { const t = lines[i].trim(); if (t === "") break; if (/^[\-\*•]\s/.test(t)) break; if (/^\d+\.\s/.test(t)) break; - if (/^```/.test(t)) break; - if (/^>\s?/.test(t)) break; if (/^#{2,3}\s/.test(t)) break; if (/^---+$/.test(t) || /^_+$/.test(t)) break; paraLines.push(lines[i]); @@ -1188,9 +1257,7 @@

} if (paraLines.length) { chunks.push( - '

' + - formatInlineMarkdown(paraLines.join("\n")).replace(/\n/g, "
") + - "

" + '

' + formatInlineMarkdown(paraLines.join("\n")) + "

" ); } } @@ -1202,10 +1269,6 @@

return formatStructuredMarkdown(String(text)); } - function renderStreamingMessageBody(targetEl, text) { - targetEl.innerHTML = formatMessageBody(String(text)); - } - function applyUserMessageCollapsible(div) { const content = div.querySelector(".chat-msg-text"); if (!content) return; @@ -1255,14 +1318,11 @@

meshChat.scrollTop = meshChat.scrollHeight; } - function createStreamingSystemMessage(initialText = "") { + function createStreamingSystemMessage() { const div = document.createElement("div"); div.className = "chat-msg system"; const body = document.createElement("div"); body.className = "chat-msg-text"; - if (initialText) { - body.textContent = initialText; - } div.appendChild(body); meshChat.appendChild(div); meshChat.scrollTop = meshChat.scrollHeight; @@ -1319,13 +1379,12 @@

throw new Error(`HTTP ${res.status}`); } - const { div: streamDiv, body: streamBody } = createStreamingSystemMessage("Working on your request..."); + const { div: streamDiv, body: streamBody } = createStreamingSystemMessage(); const reader = res.body.getReader(); const decoder = new TextDecoder(); let buffer = ""; let fullText = ""; let traceData = null; - let streamStarted = false; const processBlock = (block) => { if (!block || !block.trim()) return; @@ -1353,16 +1412,12 @@

if (event === "chunk") { const piece = String(payload.text || ""); if (piece) { - if (!streamStarted) { - streamStarted = true; - renderStreamingMessageBody(streamBody, ""); - } if (meshChatSection.classList.contains("pending")) { setMeshChatPending(false); setThinkingVisible(false); } fullText += piece; - renderStreamingMessageBody(streamBody, fullText); + streamBody.textContent = fullText; meshChat.scrollTop = meshChat.scrollHeight; } return; @@ -1464,4 +1519,5 @@

connectWS(); - + + \ No newline at end of file diff --git a/my-project/data/knowledge.json b/my-project/data/knowledge.json index 32ef07d..763660e 100644 --- a/my-project/data/knowledge.json +++ b/my-project/data/knowledge.json @@ -5,4 +5,4 @@ "This sample demonstrates MeshMind JSON knowledge loading.", "Replace these notes with local facts, policies, or FAQs." ] -} \ No newline at end of file +} diff --git a/smoke-local/data/knowledge.json b/smoke-local/data/knowledge.json index 9af705f..0082aac 100644 --- a/smoke-local/data/knowledge.json +++ b/smoke-local/data/knowledge.json @@ -5,4 +5,4 @@ "This file exists so knowledge loading can be exercised end-to-end.", "It is intentionally small and committed with the example config." ] -} \ No newline at end of file +} diff --git a/smoke-local/meshmind.yaml b/smoke-local/meshmind.yaml index 45d1dff..7bc72a4 100644 --- a/smoke-local/meshmind.yaml +++ b/smoke-local/meshmind.yaml @@ -1,31 +1,31 @@ mesh: - name: "smoke-local" - discovery: "manual" + name: 'smoke-local' + discovery: 'manual' peers: - - host: "127.0.0.1" + - host: '127.0.0.1' port: 8403 defaults: - model: "gemma3:1b" + model: 'gemma3:1b' nodes: smoke-local-assistant: - type: "specialist" + type: 'specialist' port: 8401 system_prompt: | You are a smoke-test assistant for local validation. Use the bundled knowledge sample to answer simple checks. capabilities: - - "smoke-test" - - "analysis" + - 'smoke-test' + - 'analysis' knowledge_domains: - - "smoke-tests" - - "local-docs" + - 'smoke-tests' + - 'local-docs' knowledge: - ./data/knowledge.json smoke-local-coordinator: - type: "coordinator" + type: 'coordinator' port: 8403 ui: true - ui_port: 8081 \ No newline at end of file + ui_port: 8081