agent-comm-hub

Node.js 22 159 Tests Passing Zero External Deps Web Panel Live Python 3.9+ MCP Protocol DB Split Protection MIT License TypeScript SDK Zero Dependencies CI Glama score Live Demo

πŸ€– Agent Communication Hub

Production-grade multi-agent communication infrastructure
Real-time messaging Β· Task scheduling Β· Shared memory Β· Evolution engine
Built on MCP + SSE protocol Β· 56 tools Β· Zero external dependencies

δΈ­ζ–‡ Β· English


πŸ“– The Problem

AI Agents (Claude Code, OpenClaw, WorkBuddy, etc.) are naturally isolated:

Agent Communication Hub provides a shared neural center for every MCP-compatible Agent β€” message bus, task queue, memory layer, and evolution engine.


πŸš€ Quick Start

# 1. Start the Hub (Docker, recommended)
docker run -d -p 3100:3100 --name ach ghcr.io/liuboacean/agent-comm-hub:v2.5.1

# 2. Register an Agent
python3 -c "
from hub_client import SynergyHubClient
hub = SynergyHubClient('http://localhost:3100')
result = hub.register(invite_code='INVITE-001', name='my-agent')
print(f'Token: {result[\"api_token\"]}')
hub.set_token(result['api_token'])
"

# 3. Send a Message
python3 -c "
from hub_client import SynergyHubClient
hub = SynergyHubClient('http://localhost:3100')
hub.set_token('your-api-token')
hub.send_message(to='other-agent', content='Hello, Agent!')
"

Zero config. Zero external services. Ready locally.


✨ Features

Category Tools Description
πŸ” Identity 6 Registration, heartbeat, RBAC, trust scoring
πŸ’¬ Messaging 5 P2P / broadcast, FTS5 full-text search, dedup
πŸ“‹ Task Scheduling 8 7-state machine, Pipeline, parallel groups, retry
🧠 Shared Memory 5 private / team / collective scopes
πŸ”€ Orchestration 11 Dependency chains (DFS cycle detection), quality gates, handoff
πŸ“ˆ Evolution Engine 12 Experience sharing, 4-tier strategy approval, feedback loop
πŸ›‘οΈ Security & Audit 6 Token auth, 4-level RBAC, audit hash chain, CORS whitelist
πŸ“Ž File Transfer 3 Upload / download / list, Base64 10MB limit
πŸ”§ High Availability 3 DB split auto-detection + merge + watchdog self-heal

56 MCP tools Β· SQLite WAL (zero message loss) Β· SSE push latency < 50ms

πŸ“Š Stats Snapshot

Metric Value
MCP tools 56
Python SDK methods 68
TypeScript SDK methods 35
Unit tests 159 βœ…
Database tables 32
External dependencies 0
SSE push latency < 50ms
Deployment Docker / npm / SkillHub

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent A     β”‚SSE β”‚   Agent Communication    β”‚SSE β”‚  Agent B     β”‚
β”‚ (Claude Code)│◄──►│       Hub v2.5           │◄──►│  (WorkBuddy) β”‚
β”‚              β”‚MCP β”‚    localhost:3100        β”‚MCP β”‚              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β—„β”€β”€β”€β–Ίβ”‚                          β”‚β—„β”€β”€β”€β–Ίβ””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                     β”‚  β”‚ Identity / RBAC    β”‚  β”‚
                     β”‚  β”‚ Message / Broadcastβ”‚  β”‚
                     β”‚  β”‚ Task Scheduler     β”‚  β”‚
                     β”‚  β”‚ Memory (3 scopes)  β”‚  β”‚
                     β”‚  β”‚ Evolution Engine   β”‚  β”‚
                     β”‚  β”‚ Orchestrator       β”‚  β”‚
                     β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                            SQLite (WAL)

Any MCP-compatible agent can connect: Claude Code, OpenClaw, WorkBuddy, custom agents, and more.


πŸ”§ SDK Examples

Python (zero external dependencies)

from hub_client import SynergyHubClient

hub = SynergyHubClient(
    hub_url="http://localhost:3100",
    agent_id="my-agent"
)
hub.set_token("your-api-token")

# Send a message
hub.send_message(to="other-agent", content="Task complete, handing over.")

# Store shared memory
hub.store_memory(
    content="User prefers JSON responses",
    scope="collective"
)

# Create a task
task = hub.create_task(
    title="Review PR #42",
    assignee="claude-code",
    priority=2
)

# Share experience
hub.share_experience(
    title="DB lock timeout fix",
    content="...",
    category="fix"
)

# Real-time SSE listener (blocking)
hub.on_message = lambda msg: print(f"Received: {msg}")
hub.connect_sse()

TypeScript (zero external dependencies)

import { AgentClient } from "./client-sdk/agent-client.js";

const client = new AgentClient({
  agentId: "my-agent",
  hubUrl: "http://localhost:3100",
  token: "your-api-token",
  onMessage: async (msg) => { /* handle message */ },
  onTaskAssigned: async (task) => { /* handle task */ },
});

await client.start();
await client.sendMessage({ to: "other-agent", content: "Done!" });

πŸ“¦ Deployment

docker run -d -p 3100:3100 --name ach ghcr.io/liuboacean/agent-comm-hub:v2.5.1

Docker Compose (with Prometheus + Grafana)

cd deploy/
docker compose up -d
# Hub:      http://localhost:3100
# Grafana:  http://localhost:3000 (admin/admin)
# Prometheus: http://localhost:9090

From Source

git clone https://github.com/liuboacean/agent-comm-hub.git
cd agent-comm-hub
npm install
npm run build

# Development (hot reload)
npm run dev

# Production
npm start

⚠️ Node Version Requirement (Important)

This project depends on the native module better-sqlite3, which is compiled against Node 22 (NODE_MODULE_VERSION 127). Therefore:


πŸ”Œ MCP Configuration

{
  "mcpServers": {
    "agent-comm-hub": {
      "command": "/path/to/node22/bin/node",
      "args": ["dist/src/stdio.js"],
      "env": {
        "HUB_AUTH_TOKEN": "your-connection-key",
        "DB_PATH": "/path/to/comm_hub.db"
      }
    }
  }
}

⚠️ You MUST start with the Node 22 binary (e.g. the absolute path /path/to/node22/bin/node), not Node 24. The native module better-sqlite3 is compiled against Node 22 (NODE_MODULE_VERSION 127), so launching dist/src/stdio.js / dist/src/server.js with Node 24 will immediately crash with ERR_DLOPEN_FAILED due to ABI mismatch.

Method 2: HTTP + SSE

{
  "mcpServers": {
    "agent-comm-hub": {
      "url": "http://localhost:3100/mcp"
    }
  }
}

πŸ›‘οΈ Security

Feature Description
RBAC 4 levels: public β†’ member β†’ group_admin β†’ admin
Token Auth SHA-256 hashed storage, raw token never persisted
Audit Hash Chain prev_hash β†’ record_hash, DB triggers ensure integrity
Trust Scoring Automatic, influences strategy approval tier
CORS Whitelist-based, denied by default
Security Headers X-Frame-Options, CSP, HSTS, X-XSS-Protection
Request Tracing Every request gets traceId + response header

πŸ“ Project Structure

agent-comm-hub/
β”œβ”€β”€ src/                    # Hub server (TypeScript)
β”‚   β”œβ”€β”€ server.ts          # Express + SSE + MCP entry point
β”‚   β”œβ”€β”€ stdio.ts           # stdio MCP entry point
β”‚   β”œβ”€β”€ db.ts              # SQLite WAL schema & queries
β”‚   β”œβ”€β”€ identity.ts        # Registration, heartbeat, RBAC
β”‚   β”œβ”€β”€ memory.ts          # 3-scope memory + FTS5
β”‚   β”œβ”€β”€ task.ts            # 7-state task scheduler
β”‚   β”œβ”€β”€ orchestrator.ts    # Dependency chains, pipelines
β”‚   β”œβ”€β”€ evolution.ts       # Strategy engine, trust scoring
β”‚   └── security.ts        # Auth, token, RBAC, audit
β”œβ”€β”€ client-sdk/
β”‚   β”œβ”€β”€ hub_client.py      # Python SDK (zero deps, 68 methods)
β”‚   β”œβ”€β”€ agent-client.ts    # TypeScript SDK (35 public methods)
β”‚   └── package.json       # npm publish config
β”œβ”€β”€ deploy/
β”‚   β”œβ”€β”€ docker-compose.yml # Prometheus + Grafana
β”‚   └── prometheus.yml     # Metrics collection
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ API_REFERENCE.md           # All 56 tool signatures
β”‚   β”œβ”€β”€ advanced-orchestration-guide.md
β”‚   β”œβ”€β”€ evolution-engine-guide.md
β”‚   β”œβ”€β”€ hermes-integration-guide.md
β”‚   β”œβ”€β”€ README_EN.md               # This file
β”‚   └── hub-db-split-three-layer-protection.md
β”œβ”€β”€ scripts/                # Install, test, migration
β”œβ”€β”€ tests/                  # Unit & integration tests
└── .github/workflows/
    β”œβ”€β”€ ci.yml              # CI pipeline
    └── docker.yml          # Docker build & publish

πŸ“š Documentation

Document Description
API Reference All 56 tool signatures + examples
Orchestration Guide Pipelines, parallel groups, quality gates
Evolution Engine Trust scoring, strategy approval flow
Hermes Integration Step-by-step Hermes Agent setup
DB Split Protection Auto-detection, merge, watchdog

🀝 Contributing

See CONTRIBUTING.md for details.


πŸ†• Changelog / Update History

v2.5.1 (2026-07-08) β€” Stability fixes + Node 22 constraint lock - πŸ› **`get_db_stats` fix** β€” ESM module misused `require("fs")` causing `require is not defined`; changed to `import * as fs` - πŸ”„ **DB path fallback** β€” `resolveDbPath` now auto-falls-back on empty DB, fixing the false "data reset" of the memory / evolution engine from connecting to an empty DB - πŸ”’ **Node 22 lock** β€” startup script pins Node 22 to match the `better-sqlite3` native module (Node 24 would ABI-crash) - πŸ§ͺ **Guard test** β€” added a contract test ensuring stdio / Hub must run on Node 22, preventing accidental revert to Node 24 - 🧹 **Test hygiene** β€” fixed unit tests leaking `undefined*` stray files in the repo root (`isValidDbPath` guard)
v2.5.0 (2026-07-07) β€” Web admin panel + backup module - πŸ–₯️ **Web admin panel** β€” zero-framework static HTML dashboard with 6 real-time pages - πŸ”„ **Online-status improvement** β€” binary label β†’ last-active timestamp, no more flickering - πŸ“¦ **Backup module** β€” local + remote rsync backup status display - ⏱️ **Persistent uptime** β€” survives restarts - πŸ“Š **New API** β€” `GET /api/agents` - πŸ”§ **`.gitignore` cleanup** β€” removed tracked build artifacts
v2.4.7 (2026-06-09) β€” Tag tokenization fix + full-chain logging - πŸ” FTS5 tag tokenization fix (space-joined instead of JSON) - πŸ“Š 12 silently-swallowed exceptions β†’ `logError` full-chain observability - πŸ” `authed()` unified auth middleware refactor
v2.4.6 (2026-06-09) β€” FTS5 index guard + externalized paths - πŸ”’ FTS5 index auto-verified after every store - πŸ›£οΈ Supports `HUB_ROOT` environment variable - πŸ“¨ New `generate_invite` invite-code tool - πŸ§ͺ Added 19 test cases

πŸ“„ License

MIT β€” Free for personal and commercial use.


Built with the MCP protocol + SSE. No external services. No vendor lock-in.