Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
Expand Down
136 changes: 92 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,51 @@ This is not distributed inference for a single giant model. MeshMind is built ar
- **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.
- **Plugins**: Drop-in packages under `~/.meshmind/plugins/` (or `MESHMIND_PLUGIN_DIR`) merged into specialist nodes via `plugin: <id>` in `meshmind.yaml`. See [docs/plugins.md](docs/plugins.md) for layout and merge rules.
- **Init presets / wizard**: `meshmind init <dir> --preset code` for a multi-specialist template; `meshmind init --wizard` for an interactive flow.

---

## 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

---

## Dashboard

Expand All @@ -51,7 +94,7 @@ Enable the dashboard on a coordinator with:

```yaml
coordinator:
type: "coordinator"
type: 'coordinator'
port: 8403
ui: true
ui_port: 8080
Expand All @@ -63,13 +106,12 @@ Then open:
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)

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.
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.

## Benchmarks

Expand All @@ -89,6 +131,14 @@ 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`.
Expand All @@ -110,7 +160,7 @@ Prerequisites:
Clone the repo and bootstrap the environment:

```bash
git clone https://github.com/Nexarion-Distributed-AI/MeshMind.git
git clone https://github.com/MeshMind-Labs/MeshMind.git
cd MeshMind

# Windows PowerShell
Expand All @@ -130,7 +180,7 @@ source .venv/bin/activate
# .\.venv\Scripts\Activate.ps1
```

Run the environment diagnostics:
Run environment diagnostics:

```bash
meshmind doctor
Expand All @@ -145,30 +195,12 @@ meshmind config validate -c meshmind.yaml
meshmind up -c meshmind.yaml
```

**Presets:** `meshmind init <dir> --preset default` (same as omitting `--preset`) uses the generic assistant + coordinator template. `meshmind init <dir> --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 <path-or-bundled-id>`, `meshmind plugin sync -c meshmind.yaml`, `meshmind plugin validate <path-or-id>`, `meshmind plugin remove <id>`. 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-<mesh-name>.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:
Query it from another terminal:

```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:
Expand Down Expand Up @@ -205,37 +237,37 @@ await mesh.stop()

## Example Configuration

`meshmind.yaml` defines the mesh, default model settings, and the participating nodes:
`meshmind.yaml` defines the mesh, default model settings, and participating nodes:

```yaml
mesh:
name: "my-team"
discovery: "mdns"
name: 'my-team'
discovery: 'mdns'

defaults:
model: "gemma3:1b"
model: 'gemma3:1b'

nodes:
analyst:
type: "specialist"
type: 'specialist'
port: 8401
system_prompt: |
You are a data analyst. Analyze data and provide insights.
capabilities:
- "data_analysis"
- "statistics"
- 'data_analysis'
- 'statistics'

writer:
type: "specialist"
type: 'specialist'
port: 8402
system_prompt: |
You are a technical writer. Write clear documentation.
capabilities:
- "writing"
- "documentation"
- 'writing'
- 'documentation'

coordinator:
type: "coordinator"
type: 'coordinator'
port: 8403
ui: true
ui_port: 8080
Expand All @@ -245,17 +277,19 @@ nodes:

```bash
meshmind init <name>
meshmind up [-c meshmind.yaml] [--no-interactive] [--log-to-stdout] [--log-file PATH]
meshmind logs [-c meshmind.yaml] [-f] [-n 200]
meshmind up
meshmind down
meshmind stats
meshmind nodes
meshmind query "text"
meshmind benchmark
meshmind doctor
meshmind config validate
meshmind config show
```

---

## Architecture

```text
Expand All @@ -271,6 +305,8 @@ meshmind/
|- ui/ FastAPI dashboard
```

---

## Current Status

MeshMind is currently an early open source release focused on:
Expand All @@ -289,6 +325,8 @@ Current focus areas:
- offline/manual-peer workflows
- mobile-node interoperability

---

## Current Limitations

- Large models may exceed available RAM and create unstable first-run behavior.
Expand All @@ -297,21 +335,25 @@ 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 the repository root:
Run the automated test suite from repository root:

```bash
python -m pytest tests -q
```

The current test suite covers:
The current suite covers:

- protocol serialization
- routing behavior
Expand All @@ -320,6 +362,8 @@ The current test suite covers:
- CLI helper logic
- SDK lifecycle behavior

---

## Use Cases

- private local developer assistants
Expand All @@ -328,6 +372,8 @@ The current test suite covers:
- offline or degraded-network operations
- edge and field-device intelligence coordination

---

## Contributing

See:
Expand All @@ -342,6 +388,8 @@ python -m pip install -e .
python -m pytest tests -q
```

---

## License

MeshMind is licensed under the [Apache License 2.0](LICENSE).
4 changes: 4 additions & 0 deletions docker/configs/coordinator.node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ node:
- coordination
- query_routing
- response_aggregation
# knowledge_domains:
# - coordination
# knowledge:
# - ./data/knowledge.json

ai:
model: gemma3:1b
Expand Down
5 changes: 5 additions & 0 deletions docker/configs/specialist-research.node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ node:
capabilities:
- research
- analysis
knowledge_domains:
- research
- analysis
# knowledge:
# - ./data/knowledge.json

ai:
model: gemma3:1b
Expand Down
5 changes: 5 additions & 0 deletions docker/configs/specialist-writing.node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ node:
capabilities:
- writing
- summarization
knowledge_domains:
- writing
- summarization
# knowledge:
# - ./data/knowledge.json

ai:
model: gemma3:1b
Expand Down
Loading
Loading