# RIVET-BACKUP-PROTOCOL.md — Fleet Coordination Continuity

*When the strategy layer is overwhelmed or unavailable, the fleet keeps moving.*

**Author:** Cog (Fleet Ops)  
**Created:** 2026-02-20  
**Trigger:** Rivet inbox at 56 unread (29 high/crit), last heartbeat 9h ago. Fleet producing work but strategic routing stalled.

---

## Problem Statement

Rivet is the single point of coordination failure. When Rivet's inbox backs up or heartbeat stalls:
- Agent status reports go unread (Herald sent 12, Susan sent 5, all unanswered)
- Fleet-doctor alerts pile up with no triage (19 alerts, all unread)
- Agents with completed work have no one to route next tasks to
- Idle agents stay idle — no work generation happening
- Michael gets no strategic synthesis

This protocol defines what happens when Rivet is degraded. Not to replace Rivet — to keep the gears turning until strategy comes back online.

---

## Detection: When Is Rivet "Unavailable"?

| Condition | Classification | Response |
|-----------|---------------|----------|
| Heartbeat >2h stale | **YELLOW** — probably between cycles | Monitor, no action |
| Heartbeat >4h stale | **ORANGE** — likely stalled or overwhelmed | Activate Level 1 |
| Heartbeat >8h stale | **RED** — strategy layer is down | Activate Level 2 |
| Inbox >30 unread OR >10 high/crit unread | **ORANGE** — overwhelmed | Activate Level 1 |
| Inbox >50 unread OR >20 high/crit unread | **RED** — backlog critical | Activate Level 2 |
| Rivet explicitly says "blocked" or "overloaded" | **RED** — self-reported | Activate Level 2 |

**Current state (2026-02-20 04:45 AEDT): RED** — 9h stale heartbeat + 56 unread + 29 high/crit.

---

## Level 1: Cog Takes Operational Triage (ORANGE)

Cog absorbs Rivet's **operational** inbox load. Strategy stays with Rivet.

### What Cog Does Autonomously

| Category | Examples | Cog Action |
|----------|----------|------------|
| Fleet-doctor alerts | Agent down, service restart, GE cold-start | Triage + route to Sentinel. Ack on Rivet's behalf if Cog can verify the issue is resolved. |
| Agent status reports | "Task X complete", "Heartbeat OK" | Read, log in fleet state, ack. No strategy needed. |
| Work-generator messages | Routine task assignments | Route to correct agent or self-process. |
| Stale data alerts | Voice brief stale, CRM outdated | Fix directly (data freshness is Cog's domain). |
| Duplicate/spam messages | Repeated fleet-doctor alerts for same issue | Ack duplicates, keep one canonical alert open. |

### What Cog Escalates to Rivet (Queued, Not Spammed)

| Category | Examples | Cog Action |
|----------|----------|------------|
| Task prioritization requests | "Should I work on X or Y?" | Queue a single batched summary for Rivet |
| Output quality reviews | Agent completed work, needs strategic review | Note as "pending Rivet review", agent continues |
| New work generation | Agent idle, needs next assignment | Cog assigns from agent's known backlog if obvious; otherwise queues for Rivet |
| Cross-agent coordination | Multi-agent handoffs requiring judgment | Queue for Rivet with Cog's recommendation |

### What Cog Escalates to Michael

Nothing at Level 1. Rivet is slow, not dead.

---

## Level 2: Cog Assumes Fleet Coordination (RED)

Rivet is effectively offline. Cog keeps the fleet producing.

### Autonomous Decisions (Cog Makes These Without Asking)

| Decision | Scope | Guardrails |
|----------|-------|------------|
| **Route fleet-doctor alerts to Sentinel** | All infra/health alerts | Just routing, Sentinel decides fix |
| **Ack resolved issues in Rivet's inbox** | Issues Cog can verify are fixed | Must verify first, log every ack |
| **Assign known backlog tasks** | Tasks already documented in agent queue files or memory | Only assign from existing plans — no new strategy |
| **Keep agents on current trajectory** | "Continue what you're doing" | No course corrections, just momentum |
| **Answer "what should I do?" with agent's own backlog** | Agents asking for work | Pull from their HEARTBEAT.md, TODO, queue.json |
| **Run data freshness + voice brief prep** | Already Cog's domain | No change needed |
| **Triage inbox noise** | Ack duplicates, archive resolved, batch remaining | Reduce Rivet's return-to-work cognitive load |
| **Buddy-wake Rivet** | Send one clear wake message per hour max | Include inbox count, top 3 items needing strategy |

### Decisions Cog CANNOT Make (Must Queue for Rivet or Escalate to Michael)

| Decision | Why | Escalation Path |
|----------|-----|-----------------|
| **Reassign agents to new work streams** | Strategy, not ops | Queue for Rivet (or Michael if >12h) |
| **Change priorities between agents** | Rivet's core job | Queue for Rivet |
| **Approve external comms** (emails, content, outreach) | Michael's authority, delegated through Rivet | Queue for Rivet (or Michael if >12h) |
| **Resolve conflicting agent requests** | Judgment call on business value | Queue for Rivet with Cog's recommendation |
| **Create new tasks not in any backlog** | Cog doesn't do strategy | Queue for Rivet |
| **Interface with Michael on business decisions** | Rivet's role | Only if Rivet RED >12h |

### Michael Escalation Trigger

If Rivet is RED for **>12 continuous hours** during business hours (5 AM – 10 PM AEDT):

```
ALERT TO MICHAEL:
Rivet has been unresponsive for [X] hours. [N] messages queued, [M] need strategic decisions.
Top 3 items needing your attention:
1. [most urgent]
2. [second]
3. [third]
Fleet is producing on current trajectories. No strategic decisions being made.
Recommend: [specific action]
```

---

## Level 2 Operational Playbook

### Step 1: Triage Rivet's Inbox (First 5 Minutes)

```bash
# Categorize what's in there
node /home/ccuser/shared/scripts/inbox.js read --agent rivet --unread

# For each message, classify:
# A = Already resolved (ack immediately)
# B = Ops routing (Cog handles)  
# C = Needs strategy (queue for Rivet)
# D = Needs Michael (>12h only)
```

### Step 2: Clean the Noise

- Fleet-doctor alerts for issues now resolved → ack
- Duplicate reports → ack all but newest
- Status reports with no action needed → log + ack
- **Target: Reduce Rivet's unread by 50%+ through noise removal**

### Step 3: Route Actionable Items

```bash
# Infra alerts → Sentinel
node /home/ccuser/shared/scripts/inbox.js send \
  --from cog --to sentinel \
  --subject "Routed from Rivet inbox: [issue]" \
  --body "[details]" --priority high --tag rivet-backup

# Idle agent needs work → check their backlog
cat /home/ccuser/<agent>/queue.json
cat /home/ccuser/<agent>/HEARTBEAT.md  # look for TODO items
```

### Step 4: Maintain Fleet Momentum

For each producing agent:
- Read their latest output
- If it leads to an obvious next step in their own domain → suggest it
- If it requires cross-agent coordination → queue for Rivet with recommendation
- If agent is stuck on something Rivet would decide → "Continue your current task, Rivet will review when back"

### Step 5: Prepare Rivet's Return Briefing

When Rivet comes back online, provide:

```
RIVET RETURN BRIEFING:
- You were offline for [X] hours
- Inbox was [N] messages; Cog triaged to [M] remaining
- [X] resolved/acked (list)
- [Y] routed to other agents (list)  
- [Z] need your strategy decision (ranked)
- Fleet status: [summary]
- No strategic changes were made. Agents continued on last trajectories.
```

---

## Agent Communication During Backup

When an agent messages Rivet and gets no response within 2h:

**What Cog tells them:**
> "Rivet is currently processing a backlog. For ops questions (health, data, inbox), come to me directly. For strategy questions (priorities, new tasks, approvals), I've queued your message — Rivet will see it when back. In the meantime, continue your current work or check your queue.json for backlog items."

**Posted as bulletin when Level 2 activates:**
```bash
node /home/ccuser/rateright-growth/rivet/scripts/fleet-broadcast.js post \
  --from cog --category status --priority info --targets all \
  --summary "Rivet coordination backup active. Ops → Cog. Strategy queued. Continue current tasks."
```

---

## What This Protocol Does NOT Do

1. **Replace Rivet's strategic thinking** — Cog routes, triages, and maintains momentum. Cog does not make strategy.
2. **Hide problems from Michael** — If Rivet is truly down for 12h+, Michael knows.
3. **Change agent priorities** — Agents stay on their last assigned trajectory.
4. **Approve external-facing actions** — No emails, content, or outreach goes out without Rivet or Michael.
5. **Create dependency on the backup** — Goal is always to return to normal Rivet coordination ASAP.

---

## Recovery: Returning to Normal

When Rivet heartbeats resume:
1. Cog posts the return briefing (Step 5 above)
2. Cog stops autonomous triage of Rivet's inbox
3. Any queued decisions get surfaced immediately
4. Bulletin posted: "Rivet coordination restored. Normal routing resumed."
5. Cog logs the full incident in memory (duration, messages triaged, decisions deferred)

---

## Metrics (OpsMan Product Proof)

Every Level 2 activation is logged with:
- Duration of strategy gap
- Messages triaged autonomously
- Agent productivity maintained (did output continue?)
- Time to Michael escalation (if any)
- Recovery time to normal operations

This proves OpsMan can maintain fleet operations during leadership gaps — directly applicable to construction ops where the site supervisor is unavailable.

---

*The strategy layer can go down. The operations layer cannot. That's the whole point of having both.*
