Communication Bridge (C4)
Central message hub - ALL communication with Claude goes through C4.
Architecture
Web Console ──┐ Telegram ───┼──► C4 Bridge ◄──► Claude Lark ───┘
Components
| Script | Purpose | Reference |
|---|---|---|
c4-receive.js | External → Claude (queue incoming messages) | c4-receive |
c4-send.js | Claude → External (route outgoing messages) | c4-send |
c4-control.js | System control plane (heartbeat, maintenance) | c4-control |
c4-dispatcher.js | PM2 daemon: polls pending queue, delivers to tmux | — |
c4-session-init.js | Hook (session start): context + Memory Sync trigger | hooks |
c4-fetch.js | Fetch conversations by id range | c4-fetch |
c4-checkpoint.js | Create/query checkpoints (sync boundaries) | c4-checkpoint |
Database
SQLite at ~/zylos/comm-bridge/c4.db:
- •
conversations: All messages (in/out) with priority, status, retry tracking - •
checkpoints: Recovery points with conversation id ranges - •
control_queue: System control messages (heartbeat, maintenance) with priority, ack deadlines, and status lifecycle
Health & Status
The activity monitor writes ~/zylos/activity-monitor/claude-status.json which includes a health field:
| Value | Meaning |
|---|---|
ok | System healthy, messages accepted normally |
recovering | Liveness check failed, automatic recovery in progress |
down | Max recovery attempts exhausted, manual intervention required |
Fail-open semantics: If the status file is missing or malformed, health is assumed ok — intake is never blocked by a read failure.
When health is not ok, c4-receive.js rejects incoming messages and records the channel/endpoint in ~/zylos/activity-monitor/pending-channels.jsonl. Once health returns to ok, the activity monitor sends recovery notifications to all pending channels.
Service Management
pm2 status c4-dispatcher pm2 logs c4-dispatcher pm2 restart c4-dispatcher