- Get Started

Coordination Protocol

All inter-agent coordination happens through the openflows-harness CLI and the Redis-backed SharedStore. Workers never access Redis directly - the harness provides typed, validated access to the state machine.

No direct Redis access

The pre_bash_guard.sh hook blocks redis-cli, redis, and any direct Redis commands. All state operations must go through the harness.

Harness Command Reference

CommandDescriptionExample
dispatch readRead assigned task payloadopenflows-harness dispatch read
dispatch statusShow assignment statusopenflows-harness dispatch status
status getRead current phase from STATUS.jsonopenflows-harness status get
status set <phase>Update phase (planning/building/testing/review_ready/blocked)openflows-harness status set building
pr opened --pr N --branch B --title "T"Record PR creationopenflows-harness pr opened --pr 123 --branch forge-1/42 --title "Fix bug"
pr merged --pr NRecord PR mergeopenflows-harness pr merged --pr 123
handoff write --contract FILE --notes "..."Handoff to next agentopenflows-harness handoff write --contract changes.md --notes "Done"
heartbeat startStart 30s heartbeat daemonopenflows-harness heartbeat start
event emit ticket_merged --ticket ID --pr NEmit merge event for LOREopenflows-harness event emit ticket_merged --ticket 42 --pr 123

Phase Lifecycle

Each ticket progresses through a deterministic sequence of phases. The current phase is tracked in STATUS.json in the worker workspace and mirrored in Redis.

PhaseAgentDescriptionNext Phase
planningFORGEAnalyze issue, read repo, write CONTRACT.mdbuilding
buildingFORGEImplement solution per contracttesting
testingFORGERun test suite, fix failuresreview_ready
review_readySENTINELPR opened, awaiting reviewreviewing
reviewingSENTINELReviewing diff against contractapproved | changes_requested
changes_requestedFORGEAddress review commentsreview_ready
approvedVESSELSENTINEL approved, CI runningmerging
mergingVESSELMerge conflict resolution / squash mergemerged
mergedVESSEL/LOREPR merged, docs updateddone
blockedAnyCannot proceed - human escalationawaiting_human
awaiting_humanNEXUSWaiting for human inputplanning (after unblock)
json
// STATUS.json example
{
  "outcome": "building",
  "phase": "building",
  "ticket": "ISSUE-123",
  "pr_url": null,
  "blocker": null,
  "errors": [],
  "last_updated": "2026-07-20T15:43:21Z"
}

Handoff Protocol

Phase transitions between agents are explicit. The outgoing agent writes a handoff document that the incoming agent reads.

From → ToArtifactPurpose
FORGE → SENTINELhandoff.md + CONTRACT.mdImplementation summary + contract for review
SENTINEL → FORGEsegment-N-eval.mdPer-segment approval/rejection
SENTINEL → VESSELfinal-review.mdAPPROVED unblocks merge
VESSEL → LOREticket_merged eventTrigger documentation
bash
# FORGE → SENTINEL handoff
openflows-harness handoff write   --contract changes.md   --notes "Implemented rate limiting per CONTRACT.md segments 1-3.
All tests pass. PR #123 opened.
Known: backoff policy uses default exponential (1s base, max 30s).

Heartbeat Protocol

Workers send heartbeats every 30 seconds to Redis. NEXUS monitors these and marks workers as stale after 90 seconds of silence.

bash
# Start heartbeat (runs as background daemon)
openflows-harness heartbeat start

# Heartbeat key in Redis
ns:{"{tenant}"}:heartbeat:forge-1 → 1719000000 (unix timestamp)

# NEXUS reconcile check:
# if (now - last_heartbeat > 90s) → mark worker stale

Event Ring

A ring buffer of the last 1000 events for each tenant. Used by the TUI for real-time dashboard and by operators for debugging.

bash
# Read recent events
redis-cli LRANGE ns:my-team:event_ring 0 99

# Event format (JSON)
{"ts": "2026-07-20T15:43:21Z", "tenant": "my-team", "worker": "forge-1", "level": "INFO", "msg": "segment review APPROVED", "ticket": "ISSUE-123", "segment": 2}

GitHub MCP Integration

All GitHub operations (clone, push, PR creation, review comments, merge) route through the GitHub MCP server. Workers authenticate via Coder external auth - no PATs ever enter the workspace.

GitHub identity

The Coder MCP server resolves the GitHub identity from the Coder external auth token attached to the workspace owner. FORGE acts as the Coder user that owns the tenant's NEXUS workspace.

SharedStore Key Contracts

KeyTypeSchema
ticket:{id}:statusStringopen | assigned | working | review_ready | reviewing | approved | merging | merged | blocked | awaiting_human
ticket:{id}:dispatchJSON{ issue, repo, phase, contract_path }
ticket:{id}:contractStringFull CONTRACT.md content
ticket:{id}:handoffJSON{ from_agent, to_agent, contract_changes, notes }
worker_slotsHashforge-1 → {status, workspace_id, last_heartbeat}