Skip to main content
The MAP (Multiplayer Agent Protocol) event bus enables loose coupling between agents, flows, and external systems. Events flow through the Context Hub.

Publishing Events

# Via CLI
jfl context-hub emit "eval:scored" \
  --data "agent=test-coverage,delta=0.0031,improved=true"

# Via API
curl -X POST http://localhost:4360/api/events \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"type":"eval:scored","data":{"agent":"test-coverage","delta":0.0031}}'

Event Types

PatternWhen FiredUsed By
eval:scoredAfter agent eval completesAuto-merge flow, training capture
kanban:pickupPP picks up a backlog issueTraining data capture
session:endedSession closesTuple mining flow
peter:daily-completeNightly loop finishesSummary reporting
telemetry:insightTelemetry agent finds somethingPP experiment trigger
scope:impactCross-service change detectedCascade fix flow
friction:detectedUser friction eventAuto-create issue
review:scoredAI review completesBlock merge on blockers
subway:taskTask from Subway mesh peerCreate GitHub issue

Subscribing (Flows)

Flows subscribe to events via pattern matching in .jfl/flows/self-driving.yaml:
flows:
  - name: auto-merge-on-improvement
    trigger:
      pattern: "eval:scored"
      condition: 'data.improved == "true"'
    actions:
      - type: command
        command: "gh pr merge {{data.pr_number}} --merge"

Querying Events

# Recent events
curl "http://localhost:4360/api/events?limit=20" \
  -H "Authorization: Bearer $TOKEN"

# Filter by type
curl "http://localhost:4360/api/events?pattern=eval:*&limit=10" \
  -H "Authorization: Bearer $TOKEN"

Event-Driven Architecture

Events enable the self-driving pipeline without tight coupling:
Agent finishes eval
  → emits eval:scored
  → auto-merge flow catches it
  → merges PR if improved
  → emits kanban:done
  → training capture flow logs tuple
No component knows about the others. They communicate through events.