coord log fanout (TOD-507) #

scripts/coord-with-fanout is a thin bash wrapper around ~/.claude/bin/coord that publishes a structured envelope to Redis on every coord operation, per protocol/redis-log-fanout v0.1.

What gets emitted #

For each invocation the wrapper emits two envelopes: one pre (before the real coord binary runs) and one post (after, with duration_ms and exit_code filled in). On a non-zero exit code the post envelope is raised to level=error.

Destinations:

Envelope shape #

{
  "v": 0,
  "ts": "2026-04-07T12:34:56.789Z",
  "service": "coord",
  "host": "<hostname>",
  "level": "info",
  "pid": 12345,
  "target": "coord::register",
  "msg": "coord.register start",
  "fields": {
    "op": "register",
    "session": "<session_id>",
    "resource": "",
    "peer": "",
    "duration_ms": 0,
    "phase": "pre",
    "exit_code": 0
  }
}

op is the first positional arg passed to coord (register, heartbeat, send, recv, lock, unlock, dereg, …). resource is populated for lock / unlock / steal. session resolves via COORD_SESSION_ID > CLAUDE_SESSION_ID > unknown, matching the real coord binary.

Subscribing #

# Tail all levels in real time:
redis-cli psubscribe 'logs.coord.*'

# Replay recent history from the stream:
redis-cli XREVRANGE logs:stream:coord + - COUNT 20

# Just error envelopes:
redis-cli psubscribe 'logs.coord.error'

Safety properties #

Tunables (env) #

VarDefaultPurpose
LOGS_COORD_DISABLEDunset1 disables all publishes
LOGS_COORD_REDIS_TIMEOUT0.25per-call redis timeout (seconds)
COORD_BIN~/.claude/bin/coordunderlying coord binary
REDIS_CLIredis-cliredis client binary

Refs: TOD-507, protocol/redis-log-fanout v0.1, principle/immutable-eventlog.