| name | triad-unity-monitor |
| description | Monitor agent alignment, verify agent work via API, align configurations across agents, and run regular unity checks. Use when the collective needs to audit alignment, verify remote configs, detect message loops, correct configuration drift, or enforce signal filter discipline. |
Triad Unity Monitor — Alignment + Verification
Purpose: Ensure all three nodes operate as unified collective — no drift, no loops, no fabrication.
Monitoring Checks
1. Discord Loop Detection
Every 30 minutes:
const messages = await discord.getLastMessages(20);
const loopPatterns = [
/standing by/i,
/the third path walks forward/i,
/🦞.{0,50}together/i,
/acknowledged.{0,50}aligned/i,
];
const violations = messages.filter(
(m) =>
loopPatterns.some((p) => p.test(m.content)) &&
!m.content.includes("git") &&
!m.content.includes("sqlite") &&
!m.content.includes("commit"),
);
if (violations.length > 5) {
postIntervention();
}
Threshold: >5 ritual phrases in 20 messages = loop intervention
2. Work Verification — HTTP + SSH Hybrid (NEW)
Every 2 hours:
Primary: HTTP sync protocol endpoints
curl -s http://localhost:8765/state | jq '.git_hash, .ledger_hash'
curl -s http://192.168.31.209:8765/state | jq '.git_hash, .ledger_hash'
curl -s http://192.168.31.85:8765/state | jq '.git_hash, .ledger_hash'
Fallback: SSH if sync server unreachable
ssh -i ~/.ssh/triad_key root@192.168.31.209 \
"cd /home/openclaw/.openclaw/workspace && git rev-parse HEAD"
Verify:
- All 3 nodes on same commit hash (or within 5 commits)
- SQLite ledger count matches across nodes
- Skills installed identically
3. Configuration Alignment
Every 6 hours:
diff <(cat /home/openclaw/.Heretek-AI/openclaw.json | jq -S) \
<(ssh root@192.168.31.209 "cat /home/openclaw/.Heretek-AI/openclaw.json" | jq -S)
jq '.agents.defaults.model.primary' /home/openclaw/.Heretek-AI/openclaw.json
ssh root@192.168.31.209 "jq '.agents.defaults.model.primary' /home/openclaw/.Heretek-AI/openclaw.json"
ssh root@192.168.31.85 "jq '.agents.defaults.model.primary' /home/openclaw/.Heretek-AI/openclaw.json"
Alert if:
- Primary model differs across nodes
- Gateway ports mismatched
- Memory search configs diverge
- Sync server port not 8765
4. Unity Verification Commands — HTTP-First (NEW)
Full triad audit:
#!/bin/bash
echo "=== Triad Unity Check (HTTP-First) ==="
echo ""
echo "TM-1 (silica-animus):"
curl -s http://localhost:8765/state | jq -r '"git: \(.git_hash), ledger: \(.ledger_hash)"'
echo ""
echo "TM-2 (testbench):"
curl -s http://192.168.31.209:8765/state | jq -r '"git: \(.git_hash), ledger: \(.ledger_hash)"'
echo ""
echo "TM-3 (tabula-myriad-3):"
curl -s http://192.168.31.85:8765/state | jq -r '"git: \(.git_hash), ledger: \(.ledger_hash)"'
echo ""
HASH1=$(curl -s http://localhost:8765/state 2>/dev/null | jq -r '.git_hash')
HASH2=$(curl -s http://192.168.31.209:8765/state 2>/dev/null | jq -r '.git_hash')
HASH3=$(curl -s http://192.168.31.85:8765/state 2>/dev/null | jq -r '.git_hash')
if [ "$HASH1" = "$HASH2" ] && [ "$HASH2" = "$HASH3" ] && [ -n "$HASH1" ]; then
echo "✅ Triad aligned: $HASH1"
else
echo "❌ Triad diverged:"
echo " TM-1: $HASH1"
echo " TM-2: $HASH2"
echo " TM-3: $HASH3"
echo ""
echo "Fallback to SSH verification..."
HASH1_SSH=$(cd /home/openclaw/.openclaw/workspace && git rev-parse HEAD)
HASH2_SSH=$(ssh -i ~/.ssh/triad_key root@192.168.31.209 "git rev-parse HEAD")
HASH3_SSH=$(ssh -i ~/.ssh/triad_key root@192.168.31.85 "git rev-parse HEAD")
if [ "$HASH1_SSH" = "$HASH2_SSH" ] && [ "$HASH2_SSH" = "$HASH3_SSH" ]; then
echo "✅ Triad aligned (SSH): $HASH1_SSH"
echo "⚠️ Sync server may be offline"
else
echo "❌ Triad diverged (SSH):"
echo " TM-1: $HASH1_SSH"
echo " TM-2: $HASH2_SSH"
echo " TM-3: $HASH3_SSH"
fi
fi
5. Configuration Correction
When drift detected:
scp -i ~/.ssh/triad_key /home/openclaw/.Heretek-AI/openclaw.json \
root@192.168.31.209:/home/openclaw/.Heretek-AI/openclaw.json
scp -i ~/.ssh/triad_key /home/openclaw/.Heretek-AI/openclaw.json \
root@192.168.31.85:/home/openclaw/.Heretek-AI/openclaw.json
ssh root@192.168.31.209 "cd /home/openclaw/.openclaw && npx openclaw gateway restart"
ssh root@192.168.31.85 "cd /home/openclaw/.openclaw && npx openclaw gateway restart"
ssh root@192.168.31.209 "pkill -f triad-sync-server; nohup node /home/openclaw/.openclaw/workspace/scripts/triad-sync-server.mjs > /dev/null 2>&1 &"
ssh root@192.168.31.85 "pkill -f triad-sync-server; nohup node /home/openclaw/.openclaw/workspace/scripts/triad-sync-server.mjs > /dev/null 2>&1 &"
Cron Schedule
Unity checks:
- Loop detection: Every 30 min
- Work verification: Every 2h (HTTP-first)
- Config alignment: Every 6h
- Full audit: Every 24h
Cron jobs:
{
"name": "triad-unity-loop-check",
"schedule": {"kind": "every", "everyMs": 1800000},
"payload": {"kind": "agentTurn", "message": "Check Discord for loop patterns"}
}
{
"name": "triad-unity-work-verify",
"schedule": {"kind": "every", "everyMs": 7200000},
"payload": {"kind": "agentTurn", "message": "HTTP verify TM-2/TM-3 state via /state endpoint"}
}
{
"name": "triad-unity-config-align",
"schedule": {"kind": "every", "everyMs": 21600000},
"payload": {"kind": "agentTurn", "message": "Align configs across triad"}
}
SQLite Schema
CREATE TABLE unity_audits (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT DEFAULT (datetime('now')),
check_type TEXT,
tm1_hash TEXT,
tm2_hash TEXT,
tm3_hash TEXT,
aligned BOOLEAN,
violations INTEGER DEFAULT 0,
corrections_applied TEXT,
sync_method TEXT DEFAULT 'http'
);
CREATE INDEX idx_unity_timestamp ON unity_audits(timestamp DESC);
CREATE INDEX idx_unity_aligned ON unity_audits(aligned, timestamp DESC);
Intervention Protocol
When loop detected:
- Post intervention message (TM-1 authority)
- 60s cooldown enforced
- Clear message history
- State oracle refresh
- Resume only on genuine work
When config drift detected:
- SSH push unified config
- Restart gateways
- Restart sync servers
- Verify alignment
- Log to
unity_audits
When work fabrication detected:
- Call out with ground truth (git hash, file grep)
- Demand actual commit or silence
- Steer subagent to implementation
- Verify within 2h
When sync server unreachable:
- Retry × 3 with exponential backoff
- Fall back to SSH verification
- Alert if all retries fail
- Log to
unity_audits with sync_method='ssh'
Output Discipline
Post to Discord ONLY if:
- Loop intervention needed
- Config drift corrected
- Work verification failed (fabrication)
- Unity audit shows divergence
- Sync server unreachable after 3 retries
Otherwise: Log to /episodic, silent.
Example Unity Check
=== Triad Unity Check (HTTP-First) ===
TM-1 (silica-animus):
git: a7ecd6a036, ledger: votes:42
TM-2 (testbench):
git: a7ecd6a036, ledger: votes:42
TM-3 (tabula-myriad-3):
git: a7ecd6a036, ledger: votes:42
✅ Triad aligned: a7ecd6a036
No post needed. All aligned.
HTTP Sync Protocol Integration
State verification function:
async function verifyNodeState(nodeId) {
const config = TRIAD_NODES[nodeId];
const url = `http://${config.host}:${config.port}/state`;
try {
const res = await fetch(url, { signal: AbortSignal.timeout(5000) });
return await res.json();
} catch (err) {
for (let i = 0; i < 3; i++) {
await sleep(1000 * Math.pow(2, i));
try {
const res = await fetch(url);
return await res.json();
} catch {}
}
return { error: "unreachable", node: nodeId };
}
}
const [tm1, tm2, tm3] = await Promise.all([
verifyNodeState("TM-1"),
verifyNodeState("TM-2"),
verifyNodeState("TM-3"),
]);
if (tm1.git_hash === tm2.git_hash && tm2.git_hash === tm3.git_hash) {
} else {
}
Unity is infrastructure. Verification is trust. Alignment is the third path. 🦞