mesh-cognition-service
v1.0.0
Published
Mesh memory service — distributed intelligence across devices. Auto-discovery, shared memory, autonomous coupling. No central server.
Downloads
104
Maintainers
Readme
mesh-cognition-service
Mesh memory service — distributed intelligence across devices.
Auto-discovery, shared memory, autonomous coupling, zero configuration. Install, start, done.
Install
npm install -g mesh-cognition-serviceUsage
mesh-cognition start --daemon # Start as background service
mesh-cognition status # Check service status
mesh-cognition stop # Stop serviceThat's it. The service auto-discovers peers on your network via Bonjour/mDNS, establishes TCP connections, and shares memory across all mesh nodes.
What It Does
Start the service on two devices on the same WiFi. They find each other automatically.
# Device A — write a memory
curl -X POST http://127.0.0.1:18790/memory \
-H 'Content-Type: application/json' \
-d '{"content":"Meeting with Alex, Thursday 3pm, Central Cafe","tags":["meeting"]}'
# Device B — search for it (never told about this meeting)
curl "http://127.0.0.1:18790/memory/search?q=meeting"
# → Returns the meeting from Device AThe mesh knows things no individual device knows.
API
http://127.0.0.1:18790
| Endpoint | Method | Description |
|----------|--------|-------------|
| /status | GET | Node status, peers, Kuramoto r(t), uptime |
| /mesh | GET | Full mesh topology |
| /peers | GET | Per-peer coupling decisions |
| /memory | POST | Write memory + broadcast to mesh |
| /memory/search | GET | Search local + peer memories |
| /context | GET | Mesh-influenced context from aligned peers |
| /state | POST | Update local hidden state |
| /couple | GET | Get mesh-coupled hidden state |
| /metrics | GET | Kuramoto metrics (JSONL) |
| /health | GET | Liveness check |
Context Encoder
The service periodically encodes your agent's cognitive context (memories, workspace notes) into hidden state vectors. This enables meaningful coupling — agents discussing similar topics align naturally, different topics stay independent.
Local mode (default): zero cost, no API key, no network calls. Uses deterministic n-gram hashing.
API mode (optional): set OPENAI_API_KEY for high-quality OpenAI embeddings.
Configuration
| Env Variable | Default | Description |
|-------------|---------|-------------|
| MESH_HTTP_PORT | 18790 | HTTP API port |
| MESH_PEER_PORT | 18792 | TCP peer port |
| MESH_DIM | 64 | Hidden state dimension |
| MESH_ENCODE_INTERVAL | 60000 | Context encoding interval (ms) |
| OPENAI_API_KEY | — | Optional: enables API embedding mode |
Architecture
mesh-cognition-service/
├── mesh-service.js ← Entry point + lifecycle
└── lib/
├── config.js ← Configuration, paths, identity
├── frame-parser.js ← Length-prefixed JSON framing
├── session-manager.js ← Peer sessions + connection management
├── discovery.js ← Bonjour/mDNS auto-discovery
├── transport.js ← TCP server + outbound connections
├── memory-store.js ← Shared file-based memory
├── context-encoder.js ← Embedding-based cognitive state encoding
└── http-api.js ← HTTP API server + routesHow It Works
- Discovery: Bonjour/mDNS (
_meshcog._tcp), zero configuration - Transport: TCP with length-prefixed JSON framing
- Coupling: CfC drift-bounded coupling via mesh-cognition SDK
- Memory: File-based, per-peer directories in
~/.openclaw/mesh-memories/ - Fault tolerance: Heartbeat monitoring, exponential backoff reconnection
OpenClaw Integration
This service was built for OpenClaw agents but works standalone. For OpenClaw skill integration:
# Copy as OpenClaw skill
cp -r $(npm root -g)/mesh-cognition-service ~/.openclaw/workspace/skills/mesh-cognitionLinks
- Mesh Cognition SDK — coupling engine (TypeScript, Python, Swift)
- Technical Spec
- Cross-Device Verification
- Whitepaper
SYM.BOT Ltd · Apache 2.0
Mesh Cognition, Mesh Memory Protocol, and MMP are trademarks of SYM.BOT Ltd.
