Coordinating running agents via messaging.

Publish/subscribe broadcast

One publishes; many react:

  # Scanner agent
gr msg pub --topic audit/auth-hardening/7f2a9/file/user "SQL injection in user.go:89"

# Fixer agents (each subscribing)
gr msg sub --topic audit/auth-hardening/7f2a9/file/user --follow --ack
  

Request/reply

A request with a dedicated reply channel:

  # Requester
gr msg send worker-1 "analyze auth.go for race conditions" --reply-to review/auth-races/7f2a9/response/worker-1
gr msg sub --topic review/auth-races/7f2a9/response/worker-1 --wait

# Worker
gr msg inbox --all --ack
# ... does analysis ...
gr msg pub --topic review/auth-races/7f2a9/response/worker-1 "No race conditions found. Thread-safe."
  

Hierarchical coordination

Parent orchestrates children:

  # Parent creates workers and sends tasks
gr new worker-1 --repo ~/Code/api --background
gr new worker-2 --repo ~/Code/api --background
gr msg send worker-1 "fix the auth tests"
gr msg send worker-2 "fix the API tests"

# Workers report back
gr msg send --parent "auth tests fixed, all passing"

# Parent reads results
gr msg inbox --all --ack