electron-rare/mascarade

Mascarade — multi-machine agentic LLM orchestration platform (P2P mesh, 8 providers, fine-tuning, MCP tools)

3

stars

1,166

commits

Python

primary language

Sep 2, 2026

updated

agents
fastapi
fine-tuning
llm
mcp
multi-machine
orchestration
p2p

README

Mascarade

Python 3.11+ License MIT Version v0.3.0 1100+ commits

"The machine is us, our processes, an aspect of our embodiment." — Donna Haraway

Multi-machine agentic LLM orchestration platform. Mascarade routes prompts across 8+ providers (Claude, Mistral, OpenAI, Ollama, llama.cpp, MLX, Bedrock, and more), runs a decentralized P2P mesh across 5 physical nodes, fine-tunes domain-specific mini-models that beat HuggingFace baselines by +162%, and exposes MCP tools for hardware engineering workflows. Not a framework — a distributed organism running in production.

Documentation


Architecture

graph TD
    Client["Clients (curl, SDK, MCP, Xcode)"] --> API["API Gateway\nHono :3100\nAuth, Rate Limit, OpenAI compat"]
    API --> Core["Core Engine\nFastAPI :8100\nRouter, Agents, Orchestrator"]
    Core --> Providers["8+ LLM Providers\nClaude, Mistral, OpenAI, Google\nOllama, llama.cpp, MLX, Bedrock"]
    Core <--> P2P["P2P Mesh :4001\nEd25519 auth, DHT, PubSub"]
    P2P --- N1["GrosMac\nApple M5"]
    P2P --- N2["Tower\nCPU inference"]
    P2P --- N3["KXKM-AI\nRTX 4090"]
    P2P --- N4["VM\nDocker host"]
    P2P --- N5["CILS\nOllama inference"]
    Core <--> RAG["RAG Pipeline\nbge-m3 + Qdrant + SearXNG"]
    Core <--> MCP["MCP Server + Client\nKiCad, SPICE, FreeCAD"]

Key Features

Routing

  • 8+ LLM providers with strategy-based selection (BEST / CHEAPEST / FASTEST)
  • Fallback chains, ML router (softmax classifier, 17 features), Ollama multi-machine routing

P2P Mesh

  • Ed25519 authentication, DHT discovery, PubSub messaging
  • Capability-based task routing, NAT relay traversal, 5 active nodes

Agents

  • 10+ builtin agents, domain agents (KiCad, SPICE, FreeCAD, component search)
  • Plan-and-execute orchestrator with task decomposition and dependency management

Fine-tuning

  • Teacher-to-student distillation pipeline: CPT, SFT, RLVR
  • Unsloth + SimPO + LoRA/QLoRA, 29 domain-specific models on HuggingFace
  • +162% vs HuggingFace #1 electronics model on 130-prompt benchmark

RAG

  • bge-m3 embeddings, Qdrant hybrid search (dense + BM25 + RRF)
  • LLM reranking, CRAG fallback, SearXNG web search

MCP

  • Server: 5 tools exposed via Model Context Protocol
  • Client: KiCad (5 tools), SPICE (28 tools), FreeCAD, n8n, ERPNext

Observability

  • Langfuse (LLM traces), Prometheus + Grafana (metrics), OpenTelemetry (distributed tracing)

API Compatibility

  • OpenAI /v1/chat/completions, Ollama /api/chat, Xcode Intelligence
  • Drop-in replacement for Continue.dev, Open WebUI, LM Studio

Quickstart

git clone https://github.com/electron-rare/mascarade.git
cd mascarade
cp .env.example .env          # add your API keys
docker compose --profile core up -d
curl http://localhost:3100/v1/models

Fine-tuned Models

29 domain-specific models published on HuggingFace (clemsail), trained on 498K+ curated examples across electronics engineering domains.

ModelDomainExamplesBase
mascarade-spice-v3SPICE simulation13,723Qwen2.5-3B
mascarade-verilog-v1Verilog / RTL26,532Qwen2.5-3B
mascarade-emc-v2EMC/EMI compliance3,016Qwen2.5-3B
mascarade-kicad-v4KiCad 10 PCB design1,931Qwen2.5-3B
mascarade-embedded-v3Embedded systems1,669Qwen2.5-3B
mascarade-dsp-v2DSP (ARM CMSIS)2,015Qwen2.5-3B

Data quality pipeline: SemDeDup, IFD scoring, multi-judge (3 LLMs), capability scoring. Full list on HuggingFace.


Benchmarks

Evaluated by Codestral judge on 130 prompts (100 standard + 30 adversarial), electronics engineering domain:

ModelSizeScore /10vs phi2-EE (HF #1)
mascarade-emc2.5 GB7.14+162%
mascarade-power2.5 GB7.10+161%
mascarade-dsp2.5 GB7.07+160%
mascarade-spice-v12.5 GB6.89+153%
qwen2.5-7b (base)4.7 GB6.89+153%
phi2-ee (HF #1 EE)1.7 GB2.72baseline

Mascarade fine-tunes outperform the top HuggingFace electronics model by +162% while being smaller than the base model.


RepositoryDescription
Kill_LIFESpec-first agentic methodology for embedded systems (ESP32, STM32)
crazy_lifeReact cockpit and workflow editor for Mascarade
prima-cppDistributed multi-node LLM inference (ring topology, NAT relay)
KiC-AIAI-powered PCB design assistant for KiCad

Services

ServiceURL / PortDescription
Mascarade Core:8100Moteur Python (FastAPI), agents, routeur, P2P
Mascarade API:3100Passerelle Node.js (Hono), auth, OpenAI compat, routage Ollama multi-machine
mascarade.saillant.ccHTTPSPoint d'entree public (via Traefik sur photon)
Grafana:3000Tableaux de bord, metriques, logs
Langfuse:3001Observabilite LLM, traces, couts
Argilla:6900Labeling de donnees pour fine-tuning
Qdrant:6333Base vectorielle (RAG + embeddings bge-m3)
SearXNG:4000Meta-moteur de recherche (fallback CRAG)
Docling:5010Extraction et traitement de documents
Browser-Use:8910Automatisation navigateur par agents
n8n:5678Automatisation de workflows
Drive:8086Frontend gestionnaire de fichiers, connecte aux editeurs de la Suite Numerique
Nextcloud:8088Backend stockage / WebDAV pour Drive et les synchronisations Mascarade
Neo4j + Graphiti:7474Graphe de connaissances
Ollama (Tower):11434Inference CPU (modeles legers : qwen3:4b)
Ollama (KXKM-AI)tunnel SSHInference GPU RTX 4090 (albert, mistral:7b, devstral, qwen3:8b, bge-m3)
LiteLLM:4000Proxy multi-provider
train.saillant.ccHTTPSInterface d'entrainement

Agents production (9)

AgentRole
ops-monitorSurveillance infrastructure et alertes
ops-deployerDeploiement automatise des services
ops-incidentGestion des incidents et escalade
ops-healthcheckVerification de sante des services
ops-securityAudit de securite et conformite
web-researcherRecherche web via SearXNG + Browser-Use
lead-scorerScoring et qualification de leads
dolibarr-assistantAssistant ERP Dolibarr
grist-dataGestion de donnees Grist

La Suite Numerique (DINUM) -- 8 services

Integration avec l'ecosysteme souverain francais. SSO unifie via Keycloak (auth.saillant.cc, realm electron_rare), avec callback OAuth partage sur https://auth.saillant.cc/_oauth.

ServiceDescriptionPort
Conversations (Albert)Messagerie IA souveraine, base Mistral:8082
MeetVisioconference (LiveKit):8084
ImpressDocuments collaboratifs (Y.js):8073
Keycloak (ProConnect)SSO unifie, auth.saillant.cc:8085
DriveFrontend gestionnaire des fichiers, avec ouverture vers les editeurs de la suite:8086
GristTableur collaboratif:8484
DolibarrERP / CRM:8488
MatrixMessagerie federee:8008
data.gouv.fr MCP74 000+ datasets publics via MCP--

Repos de reference : numerique-gouv, suitenumerique

Pour l'integration applicative, Open Buro expose POST /openburo/files/resolve-open afin de preferer une ouverture dans l'editeur adapte quand le type de fichier est editable dans la suite, sinon basculer vers Drive, puis seulement vers un telechargement explicite. Cette route est le point de passage obligatoire pour l'ouverture documentaire; l'UI ne doit pas ouvrir des URLs brutes. Le repo expose aussi GET /openburo/files/resolve-open, GET /openburo/files/by-business-object, l'alias GET /files/by-business-object, ainsi que POST /dolibarr/sync/customer, POST /dolibarr/sync/invoice et POST /dolibarr/sync/proposal pour garder Dolibarr comme referentiel metier et deleguer la resolution documentaire a Mascarade.


License

MIT — Copyright (c) 2026 L'Electron Rare


"The cyborg does not dream of community on the model of the organic family. It is not made of mud and cannot dream of returning to dust."

Contributors

electron-rare

1,165 commits

electron-rare/mascarade

Mascarade — multi-machine agentic LLM orchestration platform (P2P mesh, 8 providers, fine-tuning, MCP tools)

3

stars

1,166

commits

Python

primary language

Sep 2, 2026

updated

agents
fastapi
fine-tuning
llm
mcp
multi-machine
orchestration
p2p

README

Mascarade

Python 3.11+ License MIT Version v0.3.0 1100+ commits

"The machine is us, our processes, an aspect of our embodiment." — Donna Haraway

Multi-machine agentic LLM orchestration platform. Mascarade routes prompts across 8+ providers (Claude, Mistral, OpenAI, Ollama, llama.cpp, MLX, Bedrock, and more), runs a decentralized P2P mesh across 5 physical nodes, fine-tunes domain-specific mini-models that beat HuggingFace baselines by +162%, and exposes MCP tools for hardware engineering workflows. Not a framework — a distributed organism running in production.

Documentation


Architecture

graph TD
    Client["Clients (curl, SDK, MCP, Xcode)"] --> API["API Gateway\nHono :3100\nAuth, Rate Limit, OpenAI compat"]
    API --> Core["Core Engine\nFastAPI :8100\nRouter, Agents, Orchestrator"]
    Core --> Providers["8+ LLM Providers\nClaude, Mistral, OpenAI, Google\nOllama, llama.cpp, MLX, Bedrock"]
    Core <--> P2P["P2P Mesh :4001\nEd25519 auth, DHT, PubSub"]
    P2P --- N1["GrosMac\nApple M5"]
    P2P --- N2["Tower\nCPU inference"]
    P2P --- N3["KXKM-AI\nRTX 4090"]
    P2P --- N4["VM\nDocker host"]
    P2P --- N5["CILS\nOllama inference"]
    Core <--> RAG["RAG Pipeline\nbge-m3 + Qdrant + SearXNG"]
    Core <--> MCP["MCP Server + Client\nKiCad, SPICE, FreeCAD"]

Key Features

Routing

  • 8+ LLM providers with strategy-based selection (BEST / CHEAPEST / FASTEST)
  • Fallback chains, ML router (softmax classifier, 17 features), Ollama multi-machine routing

P2P Mesh

  • Ed25519 authentication, DHT discovery, PubSub messaging
  • Capability-based task routing, NAT relay traversal, 5 active nodes

Agents

  • 10+ builtin agents, domain agents (KiCad, SPICE, FreeCAD, component search)
  • Plan-and-execute orchestrator with task decomposition and dependency management

Fine-tuning

  • Teacher-to-student distillation pipeline: CPT, SFT, RLVR
  • Unsloth + SimPO + LoRA/QLoRA, 29 domain-specific models on HuggingFace
  • +162% vs HuggingFace #1 electronics model on 130-prompt benchmark

RAG

  • bge-m3 embeddings, Qdrant hybrid search (dense + BM25 + RRF)
  • LLM reranking, CRAG fallback, SearXNG web search

MCP

  • Server: 5 tools exposed via Model Context Protocol
  • Client: KiCad (5 tools), SPICE (28 tools), FreeCAD, n8n, ERPNext

Observability

  • Langfuse (LLM traces), Prometheus + Grafana (metrics), OpenTelemetry (distributed tracing)

API Compatibility

  • OpenAI /v1/chat/completions, Ollama /api/chat, Xcode Intelligence
  • Drop-in replacement for Continue.dev, Open WebUI, LM Studio

Quickstart

git clone https://github.com/electron-rare/mascarade.git
cd mascarade
cp .env.example .env          # add your API keys
docker compose --profile core up -d
curl http://localhost:3100/v1/models

Fine-tuned Models

29 domain-specific models published on HuggingFace (clemsail), trained on 498K+ curated examples across electronics engineering domains.

ModelDomainExamplesBase
mascarade-spice-v3SPICE simulation13,723Qwen2.5-3B
mascarade-verilog-v1Verilog / RTL26,532Qwen2.5-3B
mascarade-emc-v2EMC/EMI compliance3,016Qwen2.5-3B
mascarade-kicad-v4KiCad 10 PCB design1,931Qwen2.5-3B
mascarade-embedded-v3Embedded systems1,669Qwen2.5-3B
mascarade-dsp-v2DSP (ARM CMSIS)2,015Qwen2.5-3B

Data quality pipeline: SemDeDup, IFD scoring, multi-judge (3 LLMs), capability scoring. Full list on HuggingFace.


Benchmarks

Evaluated by Codestral judge on 130 prompts (100 standard + 30 adversarial), electronics engineering domain:

ModelSizeScore /10vs phi2-EE (HF #1)
mascarade-emc2.5 GB7.14+162%
mascarade-power2.5 GB7.10+161%
mascarade-dsp2.5 GB7.07+160%
mascarade-spice-v12.5 GB6.89+153%
qwen2.5-7b (base)4.7 GB6.89+153%
phi2-ee (HF #1 EE)1.7 GB2.72baseline

Mascarade fine-tunes outperform the top HuggingFace electronics model by +162% while being smaller than the base model.


RepositoryDescription
Kill_LIFESpec-first agentic methodology for embedded systems (ESP32, STM32)
crazy_lifeReact cockpit and workflow editor for Mascarade
prima-cppDistributed multi-node LLM inference (ring topology, NAT relay)
KiC-AIAI-powered PCB design assistant for KiCad

Services

ServiceURL / PortDescription
Mascarade Core:8100Moteur Python (FastAPI), agents, routeur, P2P
Mascarade API:3100Passerelle Node.js (Hono), auth, OpenAI compat, routage Ollama multi-machine
mascarade.saillant.ccHTTPSPoint d'entree public (via Traefik sur photon)
Grafana:3000Tableaux de bord, metriques, logs
Langfuse:3001Observabilite LLM, traces, couts
Argilla:6900Labeling de donnees pour fine-tuning
Qdrant:6333Base vectorielle (RAG + embeddings bge-m3)
SearXNG:4000Meta-moteur de recherche (fallback CRAG)
Docling:5010Extraction et traitement de documents
Browser-Use:8910Automatisation navigateur par agents
n8n:5678Automatisation de workflows
Drive:8086Frontend gestionnaire de fichiers, connecte aux editeurs de la Suite Numerique
Nextcloud:8088Backend stockage / WebDAV pour Drive et les synchronisations Mascarade
Neo4j + Graphiti:7474Graphe de connaissances
Ollama (Tower):11434Inference CPU (modeles legers : qwen3:4b)
Ollama (KXKM-AI)tunnel SSHInference GPU RTX 4090 (albert, mistral:7b, devstral, qwen3:8b, bge-m3)
LiteLLM:4000Proxy multi-provider
train.saillant.ccHTTPSInterface d'entrainement

Agents production (9)

AgentRole
ops-monitorSurveillance infrastructure et alertes
ops-deployerDeploiement automatise des services
ops-incidentGestion des incidents et escalade
ops-healthcheckVerification de sante des services
ops-securityAudit de securite et conformite
web-researcherRecherche web via SearXNG + Browser-Use
lead-scorerScoring et qualification de leads
dolibarr-assistantAssistant ERP Dolibarr
grist-dataGestion de donnees Grist

La Suite Numerique (DINUM) -- 8 services

Integration avec l'ecosysteme souverain francais. SSO unifie via Keycloak (auth.saillant.cc, realm electron_rare), avec callback OAuth partage sur https://auth.saillant.cc/_oauth.

ServiceDescriptionPort
Conversations (Albert)Messagerie IA souveraine, base Mistral:8082
MeetVisioconference (LiveKit):8084
ImpressDocuments collaboratifs (Y.js):8073
Keycloak (ProConnect)SSO unifie, auth.saillant.cc:8085
DriveFrontend gestionnaire des fichiers, avec ouverture vers les editeurs de la suite:8086
GristTableur collaboratif:8484
DolibarrERP / CRM:8488
MatrixMessagerie federee:8008
data.gouv.fr MCP74 000+ datasets publics via MCP--

Repos de reference : numerique-gouv, suitenumerique

Pour l'integration applicative, Open Buro expose POST /openburo/files/resolve-open afin de preferer une ouverture dans l'editeur adapte quand le type de fichier est editable dans la suite, sinon basculer vers Drive, puis seulement vers un telechargement explicite. Cette route est le point de passage obligatoire pour l'ouverture documentaire; l'UI ne doit pas ouvrir des URLs brutes. Le repo expose aussi GET /openburo/files/resolve-open, GET /openburo/files/by-business-object, l'alias GET /files/by-business-object, ainsi que POST /dolibarr/sync/customer, POST /dolibarr/sync/invoice et POST /dolibarr/sync/proposal pour garder Dolibarr comme referentiel metier et deleguer la resolution documentaire a Mascarade.


License

MIT — Copyright (c) 2026 L'Electron Rare


"The cyborg does not dream of community on the model of the organic family. It is not made of mud and cannot dream of returning to dust."

Contributors

electron-rare

1,165 commits

Languages

Python

60.8%

TypeScript

12.8%

JavaScript

12.4%

Shell

10.1%

Swift

2.8%