GitHub 3.6K
Orchestration & Control emerging

Cross-Cycle Consensus Relay

By Nikita Dmitrieff (@NikitaDmitrieff)
Add to Pack
or

Saved locally in this browser for now.

Cite This Pattern
APA
Nikita Dmitrieff (@NikitaDmitrieff) (2026). Cross-Cycle Consensus Relay. In *Awesome Agentic Patterns*. Retrieved March 11, 2026, from https://agentic-patterns.com/patterns/cross-cycle-consensus-relay
BibTeX
@misc{agentic_patterns_cross-cycle-consensus-relay,
  title = {Cross-Cycle Consensus Relay},
  author = {Nikita Dmitrieff (@NikitaDmitrieff)},
  year = {2026},
  howpublished = {\url{https://agentic-patterns.com/patterns/cross-cycle-consensus-relay}},
  note = {Awesome Agentic Patterns}
}
01

Problem

Autonomous multi-agent loops that run across many cycles (minutes, hours, or days) need a way to reliably transfer context, decisions, and next actions between cycles. In-memory state is lost on crash or restart. Generic checkpoint files don't encode the structured reasoning — what was decided, why, and what comes next — that agents need to make good decisions in subsequent cycles.

Without a structured relay mechanism, autonomous loops suffer from:

  • Drift: each cycle restarts without awareness of prior decisions
  • Repetition: agents re-debate already-settled questions
  • Stalls: no convergence signal — agents loop indefinitely without shipping
02

Solution

Each agent cycle reads a consensus relay document at the start, executes its work, then writes an updated consensus document at the end. The document is not just a checkpoint — it's a structured handoff that encodes current phase, completed actions, active decisions, open questions, and the single most important next action for the following cycle.

The relay document is written to a temp file and atomically renamed to prevent partial-write corruption. Every field is a deliberate relay signal, not just a log.

Core pattern:

# auto-loop.sh — the minimal autonomous loop
while true; do
  # Each cycle reads the relay baton, executes, writes a new one
  claude -p "$(cat PROMPT.md)" \
    --context "$(cat memories/consensus.md)"
  sleep $CYCLE_INTERVAL
done

Relay document structure:

# Relay Consensus
03

How to use it

Best for:

  • Long-running autonomous agent loops (multi-cycle, multi-day execution)
  • Multi-agent systems where context and decisions must survive restarts
  • Teams of agents where shared understanding of "what we've decided" matters
  • Any system where you want convergence toward shipping rather than endless discussion

Implementation steps:

  1. Define your relay document schema — every field should serve the next cycle, not just log the current one:

04

Trade-offs

Pros:

  • Agents resume with full context even after crash, restart, or long pause
  • Structured relay prevents context drift across cycles
  • Open questions create forward pressure — cycles don't stall in comfort
  • Convergence rules can be encoded directly in the relay document
  • Human-readable: anyone can inspect the relay and understand the workflow state
  • Git-friendly: diffs show exactly what changed between cycles

Cons:

  • Schema discipline required — a poorly structured relay document degrades agent reasoning
  • Relay grows over time; needs periodic summarization / archival of old decisions
  • Single-file relay is a bottleneck for high-frequency loops (>1 cycle/minute)
  • Context window limits constrain how large the relay can grow
  • Sensitive state (API keys, credentials) must never be written to the relay file

Operational considerations:

  • Keep the relay document under ~2000 tokens to leave room for agent reasoning
  • Archive old cycles to memories/archive/ when the relay grows unwieldy
  • Use atomic writes (write to temp, rename) to prevent partial-write corruption
  • Commit the relay to git after each cycle for full audit trail
  • Define what "done" looks like in the relay — open-ended phases create drift
06

References