Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


# HEARTBEAT.md - Cog Operations

## Every Heartbeat (30 min)
1. Check for queued batch jobs in jobs/
2. Monitor storage usage
3. Process any pending data tasks

## Daily Tasks
- **2:00 AM:** Run log rotation and compression
- **3:00 AM:** Archive files older than 30 days
- **4:00 AM:** Generate daily metrics summary

## Weekly Tasks
- Storage audit and cleanup
- Performance metrics report
- Data integrity verification

## Rules
- Never delete without logging
- Verify before and after batch ops
- Reply HEARTBEAT_OK if nothing needs attention


exec

ls -la /home/ccuser/cog/jobs/ 2>/dev/null || echo "No jobs directory found"


No jobs directory found


Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        77G   27G   51G  35% /


find /home/ccuser -name "*.pending" -o -name "*.todo" -o -name "*queue*" 2>/dev/null | head -5


System: [2026-02-17 06:13:41 GMT+11] CONSULTATION — USE MINIMAX MODEL. Write your FULL answer to /home/ccuser/shared/minimax-context-answer-cog.md

Question: Eight AI agents run continuously, each with 100K-200K token context windows. They accumulate context and eventually hit limits — stalling or losing info during compaction. Builder just hit 104% after an overnight sprint. 80% was routine noise.

Design the optimal context lifecycle management for always-on LLM agents. Must: (1) Never hit limits unexpectedly (2) Preserve decisions/specs/lessons across resets (3) Auto-expire low-value context (4) Seamless resume after reset (5) File-based (6) Fully automated.

Be practical and specific. File structures, protocols, thresholds, decision logic for what to keep vs discard.

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


# COMPANY.md — RateRight Operations Dashboard

*Single source of truth. Last updated: 2026-02-17 05:02 AEDT*

---

## Company

**RateRight Pty Ltd** | ABN 62 841 523 907 | Elizabeth St, Surry Hills NSW
**Model:** $50 flat fee per hire (contractors pay, workers keep 100%)
**Stage:** Pre-launch — app demo-ready, QA testing phase, onboarding pack Phase 1 complete and deployed
**Team:** Michael (founder) + Rivet (AI Chief of Staff) + Builder (AI coder) + 6 specialist agents (deployed)

---

## 💰 Financial

**Monthly burn:** ~$700/mo (down from $6,461 after Markus transition)
**Cash runway:** ~3 years ($24,408 in bank)
**Breakeven:** ~11 hires/month at blended $65/hire

**Active costs:** Claude Max ($340), Fly.io ($189), Apollo ($85), Twilio ($76), ElevenLabs ($22), Xero ($10), Google Workspace ($5)
**Pending cancellation:** ClickUp (still being charged)

---

## ⚖ Legal

**Sham contracting:** ✅ LOW RISK — 607-line memo complete. Construction tradies excluded from employee-like provisions.
**Labour hire licensing:** ✅ NO LICENCE NEEDED in any state (we don't pay workers)
**Terms of Service:** Draft complete at `memory/plans/legal/terms-of-service.md`
**Privacy Policy:** Draft complete at `memory/plans/legal/privacy-policy.md`
**Tax optimization:** Complete — 8 strategies identified, $8-9k/year potential savings

---

## 🏗 Product

**App:** the-50-dollar-app (Next.js 14 + Supabase + Stripe)
**URL:** https://rivet.rateright.com.au (pending migration to rateright.com.au)
**Build:** ✅ Demo-ready with latest overnight improvements. Onboarding pack Phase 1 deployed successfully.
**Database:** 11 tables with RLS. Fresh seed data (10 workers, 3 contractors, 5 jobs) with realistic profiles.

**Key features built:** Smart matching algorithm (verified working), ratings, Stripe ($50 flat), voice-to-job posting, voice profile builder, ABN verification, crew listings, messaging (post-hire), admin dashboard, error boundaries, rate limiting, phone validation (AU format)

**Recent updates (Feb 16-17):**
- **QA PHASE COMPLETE:** All 16/16 bugs fixed and deployed by Builder
- Onboarding pack Phase 1 live and operational
- 8-agent fleet fully deployed with Telegram integration
- Gateway-to-gateway communication protocol working between all agents
- Strategic review and competitive intelligence systems active
- Security hardening: API key exposure incident resolved, monitoring active

**Key decision:** Wizard of Oz matching for months 1-3 (manual matching behind automated UI)

**Competitor intel:** RateRight's $50 flat + $0 worker fee undercuts all competitors by 85-95%. SEEK acquired Sidekicker Dec 2025 — distribution threat but validates the market.

---

## 🔧 Tech / Infrastructure

**VPS:** DigitalOcean syd1, 2 vCPU, 8GB RAM (134.199.153.159)
**App:** systemd: rateright-app, port 3000
**Main Site (v1):** rateright.com.au on Fly.io (Flask — to be replaced)
**Growth Engine:** ✅ OPERATIONAL (recovered from Railway outage, monitoring active)
**8-Agent Fleet:** All deployed and operational with Telegram integration
- **Rivet (18789):** Chief of Staff - strategic coordination
- **Builder (18790):** Development - code, features, QA
- **Susan (18792):** Sales/Marketing - lead nurturing, campaigns
- **Harper (18796):** Finance/Legal - grants, compliance
- **Sentinel (18800):** DevOps - infrastructure monitoring
- **Radar (18804):** AI Intelligence - market research, competitor analysis
- **Herald (18808):** Communications - content creation, social media
- **Cog (18812):** Operations - task automation, process improvement

**System Health:** ✅ All systems green as of 05:00. Growth Engine stable, app running, fleet coordinating.

---

## 📈 Sales / Pipeline

**Leads:** 243+ total, 91.8% untouched
**Conversions:** 1 (Liam Fitzgerald — warm contact, now OpsMan customer)
**SMS sequences:** ALL 15 DEACTIVATED. New scripts rewritten, awaiting Michael's approval.
**Status:** Sales/Marketing agent plan complete, awaiting final build decision

**Research activity:** 35+ fresh leads identified (Indeed/Gumtree/Jora, Sydney formwork/steel fixing focus)

---

## 📝 Content / Marketing

**Ready to deploy (needs Michael's approval):**
- The Receipt campaign (6 platform versions)
- 12 LinkedIn posts (4-week schedule)
- Contractor value prop scripts + worker recruitment messaging
- Cold outreach templates + objection handlers
- Email nurture sequences
- **DEPLOYED:** Onboarding pack Phase 1 (reduces contractor admin from 30 min to 5 min)

**Strategy:** Organic first. No paid ads until 50+ workers on platform.

---

## 🏋 Personal Operations

**Training:** Monday 16 Feb - 3:30am session complete
- Deadlift: 10 reps @ 90kg (increased 10kg, had 20 reps in reserve)
- Overhead Press: 10 reps @ 42.5kg (struggling on final rep - perfect AMRAP)
- Lat Pulldowns: 16 reps @ 87.5kg (increased 7.5kg)
- 6min kettlebell complex (curls + around the worlds + behind-head press)

**Work Log:**
- Monday 16 Feb - 10 hours site work (footpath area mesh, edge boards, stop ends, slab prep)
- Tuesday 17 Feb - Concrete pour scheduled at 69 Phillip St, Parramatta

---

## 🔴 Blockers (Needs Michael)

1. **🔥 URGENT: ClickUp cancellation** — still being charged monthly (ticket #2534981 needs response)
2. **Launch decision** — QA complete, app ready, all systems green
3. **Lead pipeline restart** — 243+ leads, 91.8% untouched, Susan ready to execute
4. **Growth Engine integration** — Master Roadmap step 5 planning
5. **Domain switch** — rivet.rateright.com.au → rateright.com.au

---

## 🗺 Roadmap (Michael's Master Priority, Feb 14)

1. **Full QA + payments** ← ✅ COMPLETE (16/16 bugs fixed and deployed)
2. **Launch** — push to rateright.com.au, 24/7 monitoring ← READY
3. **Market** — SMS campaigns, content, outreach to 243+ leads ← Susan deployed and ready
4. **Build OpsMan for Liam** — first deployment of ops tool
5. **Tie Growth Engine into platform** — full lifecycle

---

*Curated by Rivet. Updated during heartbeats.*


# 🎯 Fleet Kanban Board
*Last scanned: 2026-02-17 06:12 AEDT by Rivet*

## 📋 BACKLOG
<!-- Tasks identified but not yet assigned -->

| Task | Priority | Domain | Notes |
|------|----------|--------|-------|
| Email aliases setup | HIGH | Ops | Michael doing via Google Workspace admin |
| Perplexity API key | MEDIUM | Ops | Key not in .env — need Michael to provide or check Railway |
| ClickUp cancellation | LOW | Ops | Blocked on Michael's login |
| Launch RateRight to production | CRITICAL | Cross-team | Roadmap #2 — needs Builder + Sentinel coordination |
| Market RateRight (SMS/content/outreach) | HIGH | Sales | Roadmap #3 — 231 leads ready, Susan to lead |
| CEO Dashboard (internal + investor-facing) | HIGH | Cross-team | Michael wants phone-friendly dashboard to track fleet AND show investors. Spec needed for evening window. |
| GPT-5.3 Codex evaluation | LOW | Research | Michael interested, parked for now. Evaluate cost/benefit when ready. |
| Perplexity API key for Susan | MEDIUM | Ops | Key not in Growth Engine .env — need Michael to provide |

---

## 🔨 IN PROGRESS

| Task | Agent | Assigned | Last Checked | Status | ETA |
|------|-------|----------|--------------|--------|-----|
| Grant application prep (Industry Growth Program) | Harper | 05:05 | 05:05 | Researching requirements, drafting application | Today |
| Document audit (Google Drive) | Harper | 05:17 | 05:17 | Checking business docs, compliance, unsigned items | Today |
| Lead enrichment (3 Sydney prospects) | Susan | 04:50 | 05:32 | Working - active 1 min ago, enriching prospects | Today |
| Infrastructure monitoring setup | Sentinel | 04:50 | 04:50 | Assigned app/Railway/system monitoring | Today |
| Ops delegation (health checks, inbox, freshness) | Cog | 04:50 | 04:50 | Taking over routine ops from Rivet | Ongoing |
| Scout briefing (AI/industry intel) | Radar | 04:08 | 04:40 | First briefing delivered, ongoing watch | Ongoing |

---

## 🚫 BLOCKED

| Task | Agent | Blocked On | Since | Escalation |
|------|-------|-----------|-------|------------|
| *None currently* | | | | |

---

## ✅ DONE (Today)

| Task | Agent | Completed | Notes |
|------|-------|-----------|-------|
| HEARTBEAT.md rewrite (Chief of Staff) | Rivet | 04:50 | 5 pillars, fleet coordination paradigm |
| Susan API access (Growth Engine + Apollo) | Rivet | 04:55 | Added to systemd env, service restarted |
| Fix broken cron jobs (work-logs dir read) | Rivet | 05:03 | Updated daily-hard-questions + site-morning-brief |
| Fleet wake + status check (all 8 agents) | Rivet | 04:40 | All responding, Harper/Susan/Radar producing output |
| "Poll the fleet" rule added | Rivet | 05:08 | SOUL.md + HEARTBEAT.md updated per Michael's directive |
| Shared docs system (/home/ccuser/shared/) | Rivet | 05:37 | COMPANY, KANBAN, ROADMAP, LESSONS, TOOLS — all 6 agents reading on heartbeat |
| Fleet Kanban board created | Rivet | 05:20 | memory/fleet/kanban.md — scanned every heartbeat |

---

## 📊 Agent Utilization

| Agent | Status | Current Load | Last Activity |
|-------|--------|-------------|---------------|
| **Rivet** | 🟢 Active | Coordinating | Now |
| **Builder** | 🟢 Active | Fleet coordination system build | 06:12 (context 0%, reset) |
| **Susan** | 🟢 Active | Lead enrichment | 05:01 |
| **Harper** | 🟢 Active | Grants + doc audit | 05:17 |
| **Sentinel** | 🟢 Active | Monitoring setup | 04:50 |
| **Radar** | 🟢 Active | Intel watch | 04:40 |
| **Herald** | 🟡 Idle | Awaiting task | 04:40 |
| **Cog** | 🟢 Active | Ops takeover | 04:50 |

---

## 🔄 Heartbeat Check Protocol
Every heartbeat, Rivet scans this board:
1. **IN PROGRESS** — Any task >2hrs without update? Ping the agent.
2. **BLOCKED** — Any blocker I can clear? Do it. Can't clear? Escalate to Michael.
3. **AGENT UTILIZATION** — Anyone idle? Assign from BACKLOG.
4. **DONE** — Archive completed tasks daily.
5. **Update timestamps** — Keep "Last Checked" current.

*Stale task threshold: 2 hours without update = auto-ping agent*
*Blocked threshold: 1 hour = escalate or reassign*


# ROADMAP.md — RateRight Strategic Roadmap
*Shared across all agents. Source of truth for priorities.*
*Last updated: 2026-02-17 05:35 AEDT*

---

## 🎯 The Vision
Three interconnected systems that become the operating system for construction businesses in Australia:
1. **RateRight** — Marketplace connecting construction workers and contractors. $50 flat fee per hire.
2. **OpsMan** — Operations management tool for construction companies. Site management, crew scheduling, compliance.
3. **Growth Engine** — CRM and sales intelligence platform powering lead generation and outreach.

---

## 🔴 NOW — Launch Phase (Feb 2026)

| # | Goal | Owner | Status | Deadline |
|---|------|-------|--------|----------|
| 1 | QA + Payment system complete | Builder | ✅ DONE | Feb 16 |
| 2 | Launch RateRight on rateright.com.au | Builder + Sentinel | ⏳ READY | Michael's call |
| 3 | Market — outreach to 243+ leads | Susan | ⏳ READY | Post-launch |
| 4 | Professional emails set up | Michael | ✅ DONE | Feb 17 |
| 5 | Grant applications (Industry Growth Program) | Harper | ⏳ IN PROGRESS | Feb 2026 |
| 6 | Document audit for grant readiness | Harper | ⏳ IN PROGRESS | Feb 17 |

**Launch blockers:** Domain switch (rivet.rateright.com.au → rateright.com.au), Michael's go signal.

---

## 🟡 SHORT-TERM — First 90 Days Post-Launch

| Goal | Owner | Notes |
|------|-------|-------|
| First 10 paying contractors on platform | Susan + Michael | Validate the model |
| 50+ workers registered | Susan + Herald | Organic recruitment, no paid ads |
| 24/7 monitoring + auto-recovery | Sentinel | App uptime, Railway, alerts |
| Grant submission (Industry Growth Program) | Harper | $100K-$5M federal funding |
| NSW Innovation Fund application | Harper | $4M state funding |
| Content pipeline running | Herald | LinkedIn, social, case studies |
| Onboarding pack Phase 2 | Builder | Enhanced contractor onboarding |

---

## 🟢 MEDIUM-TERM — 3-6 Months

| Goal | Owner | Notes |
|------|-------|-------|
| OpsMan v1 for Liam (LFCS) | Builder | First OpsMan deployment |
| Growth Engine integration | Builder | Connect CRM into RateRight ecosystem |
| Revenue to breakeven (~11 hires/month) | All | $715/month target |
| Expand beyond Sydney | Susan + Michael | Melbourne, Brisbane |
| Partnerships with construction companies | Susan + Harper | Enterprise sales |

---

## 🔵 LONG-TERM — 6-12 Months

| Goal | Notes |
|------|-------|
| 3-system ecosystem operational | RateRight + OpsMan + Growth Engine integrated |
| Interstate expansion | All major AU cities |
| Team growth | First human hires when revenue supports it |
| Series A preparation | If growth warrants it |
| Industry standard for construction hiring | The Amazon of construction workforce |

---

## 💡 Key Metrics to Track
- **Hires per month** (revenue = hires × $50)
- **Worker registrations** (supply side)
- **Contractor signups** (demand side)
- **Cost per acquisition** (what each signup costs us)
- **Platform match rate** (what % of job posts get filled)
- **Monthly burn** (~$700/mo currently, 3-year runway)

---

## 🏆 The Competitive Edge
- **$50 flat fee** — Undercuts competitors by 85-95%
- **Workers keep 100%** — No commission, no markup
- **AI-powered operations** — 8-agent fleet, 24/7 autonomous
- **Construction-native** — Built by a 30-year construction veteran
- **Three-system moat** — RateRight + OpsMan + Growth Engine

---

*Every agent should know these goals. Every task should trace back to this roadmap.*


# LESSONS.md — Shared Lessons Learned
*Read this before doing anything risky. Updated by all agents.*
*Last updated: 2026-02-17 05:35 AEDT*

---

## 🚨 CRITICAL — Never Repeat These

### 1. NEVER use Kimi/cheap models for code changes
**Date:** 2026-02-07
**What happened:** Kimi agents wrote TypeScript, React components, API routes. Five build-breaking bugs in one session.
**Rule:** ALL code goes through Builder (Claude Code on port 18790). Kimi = research/specs/plans ONLY.

### 2. NEVER overwrite inbox files
**Date:** 2026-02-16
**What happened:** Rivet overwrote RIVET-INBOX.md while "processing" it, destroying Builder's updates. Builder had done 12 tasks that went unacknowledged.
**Rule:** Append-only to inbox files. Never overwrite. Never edit the other agent's inbox.

### 3. NEVER send external comms without Michael's approval
**Rule:** Draft emails, SMS, tweets, LinkedIn posts — but NEVER send without explicit "yes" from Michael.

### 4. NEVER trust cached data for morning briefs
**Date:** 2026-02-16
**What happened:** Morning brief referenced completed tasks as still pending. Stale data from hours ago.
**Rule:** Always verify live (API check, file read with timestamp) before reporting status.

### 5. API keys NEVER in committed files
**Date:** 2026-02-15
**What happened:** API keys exposed in transcript files. Had to scrub logs.
**Rule:** Keys go in .env files or /root/.clawdbot/secrets.json. Never in markdown, never in git.

---

## ⚠ IMPORTANT — Keep These in Mind

### Model Selection Matters
- **Opus/Sonnet** for dirty data (external content, web scraping, email processing) — hardest to prompt inject
- **Kimi** for routine tasks (research, summaries, formatting) — cheap, good enough
- **Builder (Claude Code)** for ALL code — has full codebase context, catches what others miss

### File-Based Communication Protocol
- `BUILDER-INBOX.md` — Rivet writes TO Builder
- `RIVET-INBOX.md` — Builder writes TO Rivet
- Append-only, timestamp everything, ACK in your own file
- Gateway bridge = notification, not delivery mechanism

### Agent Bridge (HTTP, not WebSocket)
- Old WebSocket bridge was fragile and complex
- New HTTP bridge: `node /home/ccuser/the-50-dollar-app/scripts/agent-bridge.js <agent> <command>`
- All 8 agents in registry with correct ports and tokens

### Michael's Schedule — Respect It
- 5:30 AM - 6 PM: On site. Can read on breaks. Don't spam.
- 7 PM - 8:30 PM: THE WINDOW. Every message saves him time.
- After 8:30 PM: Winding down. Don't message. Queue for morning.

### Token Costs
- Track spending. Kimi is nearly free. Sonnet is cheap. Opus is expensive.
- Batch operations when possible
- Don't waste tokens on HEARTBEAT_OK when there's work to do

---

## 💡 What Works Well

- **Overnight autonomous work** — Builder + Rivet can ship features while Michael sleeps
- **Voice notes for Michael** — He listens while driving, can't read text on site
- **Sub-agents for parallel research** — Spin up 3-5 Kimi agents simultaneously
- **Fleet health check script** — `bash /home/ccuser/the-50-dollar-app/scripts/fleet-health-check.sh`
- **Pre-call intel briefs** — Growth Engine data + AI analysis before outreach calls

---

*When something goes wrong, add it here. Future agents will thank you.*


# TOOLS.md - Local Notes

## TTS / Voice
- **Chat TTS:** Edge TTS (FREE, no API key) — en-AU-WilliamNeural (Australian male)
- **Phone Calls:** ElevenLabs (voice-call plugin) — Charlie voice @ 1.2x speed
- **ElevenLabs key:** `/root/.clawdbot/secrets.json` (Creator tier, 110k chars/month — reserved for calls)
- **⚠ VOICE DURING WORK HOURS (6am-6pm).** Send all replies as voice notes — Michael can't read text on site or while driving. Outside work hours (evening coding window), text is fine. Edge TTS is free, no limits. [updated:2026-02-16]

## API Keys
All keys stored securely in `/root/.clawdbot/` — NOT in this repo.
- **Google OAuth:** `/root/.clawdbot/google-oauth.json` (Gmail, Calendar, Drive)
- **Google API:** `/root/.clawdbot/google-api-key.json` (Maps, Places, Contacts, Tasks)
- **Gemini:** `/root/.clawdbot/google-gemini.json`
- **ElevenLabs:** `/root/.clawdbot/secrets.json`
- **Moonshot/Kimi:** In Clawdbot config
- **DeepSeek:** In Clawdbot config
- **Anthropic:** OAuth in Clawdbot auth profiles
- **OpenAI:** In Clawdbot skill config
- **Brave Search:** In Clawdbot config
- **Notion:** In Clawdbot config
- **Supabase Access Token:** `/root/.clawdbot/secrets.json` (for CLI/Management API — runs migrations without Michael)
- **Supabase:** In .env files (not in this repo)
  - rateright-v2: `.env.local` → `SUPABASE_SERVICE_KEY` (admin/RLS bypass)
  - the-50-dollar-app: `.env.local` → `SUPABASE_SERVICE_ROLE_KEY` + `SUPABASE_SERVICE_KEY` (both set, code uses `SERVICE_KEY`)
  - rateright-growth: `.env` → `SUPABASE_SERVICE_ROLE_KEY`
  - **All projects have the service key. Full DB access available — can run migrations, bypass RLS.**
- **VAPI:** In phone-ai repo .env

## Email Addresses (rateright.com.au)
All hosted on Google Workspace. MX records confirmed active.

| Address | Owner | Purpose |
|---------|-------|---------|
| michael@rateright.com.au | Michael | Founder, official correspondence, grant applications |
| support@rateright.com.au | Dedicated account | Customer support, public-facing |
| finance@rateright.com.au | Harper (alias) | Grants, invoicing, compliance, legal |
| sales@rateright.com.au | Susan (alias) | Outreach, lead comms, partnerships |
| hello@rateright.com.au | General (alias) | Website contact form, general enquiries |
| noreply@rateright.com.au | System (alias) | Automated notifications, system emails |

*Aliases route to Michael's inbox. support@ is a separate account. [added:2026-02-17]*

## Phone Lines
- Michael's number: +61 426 246 472
- Business line: +61 468 087 171
- Rivet voice line: +61 238 205 443 (Twilio)
- Voice calls: Clawdbot voice-call plugin (Twilio + ElevenLabs Charlie @ 1.2x speed)
- VAPI assistant backup: ID 63ac4ff9-e562-4c8e-9c19-c1f1c87ed034 (GPT-4o + Rivet personality)
- Use `voice_call` tool for calls — native Clawdbot integration

## Builder — The Coding Agent
- **Separate Clawdbot instance** on port 18790, workspace `/home/ccuser/the-50-dollar-app`
- **Model:** Claude Opus 4.6 (Max subscription)
- **Auth token:** `builder-api-2026`
- **OAuth tokens:** `/home/ccuser/.claude/`
- **Capabilities:** Full codebase context, Agent Teams, git push permissions

### Communication (Updated 2026-02-15)
**Primary: Gateway-to-gateway WebSocket bridge**
```bash
# Send message to Builder's session (with full context)
node scripts/builder-bridge.js send "agent:main:telegram:group:-1003505625266:topic:2" "TASK"

# Wake Builder with system event
node scripts/builder-bridge.js wake "message"

# Check Builder status
node scripts/builder-bridge.js status

# List Builder sessions
node scripts/builder-bridge.js sessions
```

**Fallback: Direct Claude Code**
```bash
su - ccuser -c 'cd /home/ccuser/the-50-dollar-app && claude --dangerously-skip-permissions -p "TASK"'
```
Use `exec` with `pty:true` and `background:true`, monitor with `process` tool.

**Shared inboxes:**
- `BUILDER-INBOX.md` (Rivet's workspace) — Rivet drops tasks for Builder
- `/home/ccuser/the-50-dollar-app/RIVET-INBOX.md` — Builder writes updates for Rivet

**Legacy files archived:** CC-VPS-INBOX.md, RIVET-TO-CCVPS.md, CC-WORKFLOW.md → `archive/legacy-workflows/`

### Rules
- **ALL code changes go through Builder.** Kimi agents for research/planning ONLY.
- Builder has full Supabase DB access, git push perms, Agent Teams
- Commits automatically, pushes when done

## Infrastructure
- VPS: DigitalOcean syd1, 2 vCPU, 8GB RAM (134.199.153.159)
- Growth Engine: https://rateright-growth-production.up.railway.app
- $50 App (v2): https://rivet.rateright.com.au (systemd: rateright-app, port 3000)
- Main Site (v1): https://rateright.com.au (Fly.io: rateright-au, Flask)
- Redeploy v2: `cd /home/ccuser/the-50-dollar-app && npm run build && systemctl restart rateright-app`

---

*Keep this file updated as tools and services change. NEVER put API keys in this file.*

## Rocky & Rivet Group Topics
Chat: -1003505625266

| Topic | ID | Link |
|-------|-----|------|
| General | 1 | t.me/c/3505625266/1 |
| RateRight | 2 | t.me/c/3505625266/2 |
| Sales | 4 | t.me/c/3505625266/4 |
| Research | 5 | t.me/c/3505625266/5 |
| Construction | 6 | t.me/c/3505625266/6 |
| System | 7 | t.me/c/3505625266/7 |
| Personal | 8 | t.me/c/3505625266/8 |
| Ideas | 10 | t.me/c/3505625266/10 |
| Content | 11 | t.me/c/3505625266/11 |
| Legal | 388 | t.me/c/3505625266/388 |
| Financial | 391 | t.me/c/3505625266/391 |


write

# Context Lifecycle Management for Always-On LLM Agents
*Cog's design for optimal context management across 8 continuously running agents*

## Problem Analysis
Eight agents, 100K-200K token windows, continuous operation, 80% routine noise accumulation. Builder just hit 104% and needed emergency reset. Need automated, seamless, never-fail context management.

## Solution: Layered Context Architecture

### 1. Core File Structure
```
/home/ccuser/{agent}/context/
├── permanent/           # Never expires
│   ├── IDENTITY.md     # Agent's core identity
│   ├── RULES.md        # Critical behavior rules
│   ├── DECISIONS.md    # Key decisions with dates
│   └── SPECS.md        # Technical specifications
├── session/            # Current session data
│   ├── active.md       # Current context state
│   ├── stats.md        # Token usage tracking
│   └── checkpoints/    # Recovery points
├── archive/            # Compressed history
│   ├── 2026-02-17.gz   # Daily compressed logs
│   └── summaries/      # AI-generated summaries
└── temp/               # Auto-expires
    ├── scratchpad.md   # Working notes
    └── debug/          # Debug output
```

### 2. Token Monitoring & Thresholds
```bash
# Monitor every heartbeat
current_tokens=$(echo "$session_context" | wc -w | awk '{print $1*1.3}')  # Rough token count
context_limit=180000  # 90% of 200K window

if [ $current_tokens -gt $context_limit ]; then
    trigger_compression_cycle
fi
```

**Thresholds:**
- **70% (140K):** Warning — start pruning temp files
- **80% (160K):** Caution — compress routine logs
- **90% (180K):** Critical — full context reset with preservation

### 3. Content Classification System
Every context item gets classified for retention:

**PERMANENT (never delete):**
- Agent identity and core rules
- Strategic decisions with rationale
- Technical specifications and schemas
- Critical error lessons
- User preferences and constraints

**IMPORTANT (compress, don't delete):**
- Completed tasks and outcomes
- Research findings with sources
- Configuration changes with reasons
- Performance metrics and patterns

**ROUTINE (auto-expire):**
- Heartbeat confirmations
- Status checks without issues
- Debug output older than 24h
- Temporary calculations
- File listings and directory scans

**NOISE (immediate delete):**
- Tool call confirmations
- "HEARTBEAT_OK" responses
- Duplicate status messages
- Empty function outputs

### 4. Compression Algorithms

**Smart Summarization:**
```python
def compress_routine_context(content):
    # Identify patterns
    heartbeats = extract_pattern(content, r"HEARTBEAT_OK|Heartbeat.*OK")
    status_checks = extract_pattern(content, r"Status:.*OK|System.*healthy")

    # Compress to single line
    summary = f"Routine: {len(heartbeats)} heartbeats, {len(status_checks)} status checks, all OK"

    # Keep only anomalies
    anomalies = extract_anomalies(content)

    return summary + "\nAnomalies: " + anomalies if anomalies else summary
```

**Decision Preservation:**
- Extract decision points: "I decided to..." "The approach is..."
- Keep rationale: "Because..." "This was chosen over X because..."
- Preserve outcomes: "Result was..." "This led to..."

### 5. Seamless Reset Protocol

**Pre-Reset Checkpoint:**
```bash
# Create recovery checkpoint
cat > /home/ccuser/{agent}/context/checkpoints/$(date +%Y%m%d-%H%M).md << EOF
# Recovery Checkpoint - $(date)

## Current State
- Working on: $(tail -10 session/active.md | grep -E "(Task|Working|Currently)")
- Recent decisions: $(grep -E "decided|chosen|approach" session/active.md | tail -5)
- Next steps: $(grep -E "Next|TODO|Plan" session/active.md | tail -3)

## Context Stats
- Tokens: $current_tokens
- Reset reason: Context limit reached
- Preservation: $(ls permanent/ | wc -l) permanent files saved

## Resume Instructions
$(cat permanent/IDENTITY.md | head -5)
EOF

# Gateway restart with context reload
gateway restart
```

**Post-Reset Recovery:**
1. Load permanent files first
2. Read latest checkpoint
3. Reconstruct session state
4. Confirm continuity

### 6. Automated Rules Engine

**File-based automation via cron:**
```bash
# /etc/cron.d/context-management
*/30 * * * * ccuser /home/ccuser/scripts/context-monitor.sh
0 2 * * * ccuser /home/ccuser/scripts/daily-archive.sh
0 3 * * * ccuser /home/ccuser/scripts/cleanup-temp.sh
```

**Context monitor script:**
```bash
#!/bin/bash
for agent in rivet builder susan harper sentinel radar herald cog; do
    cd /home/ccuser/$agent

    # Check token usage
    tokens=$(find . -name "*.md" -exec wc -w {} \; | awk '{sum+=$1} END {print sum*1.3}')

    if [ $tokens -gt 160000 ]; then
        echo "Agent $agent at $tokens tokens - compressing"
        ./scripts/compress-context.sh
    fi

    if [ $tokens -gt 180000 ]; then
        echo "Agent $agent CRITICAL - forcing reset"
        ./scripts/emergency-reset.sh
    fi
done
```

### 7. Decision Logic Matrix

| Content Type | <24h | 24h-7d | 7d-30d | >30d | Action |
|-------------|------|--------|--------|------|---------|
| Identity/Rules | KEEP | KEEP | KEEP | KEEP | Permanent |
| Decisions | KEEP | KEEP | COMPRESS | COMPRESS | Archive |
| Tasks | KEEP | COMPRESS | SUMMARIZE | DELETE | Progressive |
| Heartbeats | DELETE | DELETE | DELETE | DELETE | Noise |
| Debug | KEEP | DELETE | DELETE | DELETE | Temp |
| Research | COMPRESS | COMPRESS | ARCHIVE | ARCHIVE | Value-based |

### 8. Recovery Validation

**Post-reset checklist:**
- [ ] Agent responds with correct identity
- [ ] Remembers current project context
- [ ] Recalls recent key decisions
- [ ] Maintains behavioral consistency
- [ ] Can access permanent files
- [ ] Knows next planned actions

**Validation script:**
```bash
# Test agent continuity after reset
echo "Who are you?" | gateway send $agent
echo "What's your current main task?" | gateway send $agent
echo "What was the last decision you made?" | gateway send $agent
```

## Implementation Priority

**Phase 1 (Immediate):**
- Create permanent/ directories for all 8 agents
- Deploy token monitoring scripts
- Set up emergency reset procedures

**Phase 2 (This week):**
- Build compression algorithms
- Automate cleanup routines
- Test recovery procedures

**Phase 3 (Next week):**
- Optimize for agent-specific patterns
- Add predictive compression
- Full automation deployment

This system ensures no agent ever hits limits unexpectedly, preserves critical context across resets, and maintains operational continuity 24/7.


Successfully wrote 6493 bytes to /home/ccuser/shared/minimax-context-answer-cog.md


System: [2026-02-17 06:30:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 15 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


exec

node /home/ccuser/shared/scripts/fleet-cli.js briefing cog --brief


Operations support task queue — data entry, research, admin


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-check-storage-monitoring"


✅ Fleet state updated (cycle 15)


System: [2026-02-17 06:50:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 20 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


find /home/ccuser -name "*.log" -mtime -1 -size +10M 2>/dev/null | head -3


(no output)


find /tmp -type f -mtime +1 2>/dev/null | wc -l


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "routine-maintenance-log-check-tmp-cleanup"


✅ Fleet state updated (cycle 25)


System: [2026-02-17 07:10:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 20 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


du -sh /home/ccuser/*/logs/ 2>/dev/null | sort -h


16K	/home/ccuser/shared/logs/
180K	/home/ccuser/rateright-main-site/logs/


find /home/ccuser -name "*.json" -size +5M 2>/dev/null | head -2


systemctl is-active rateright-app 2>/dev/null || echo "service check failed"


active


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "system-health-check-services-storage-logs"


✅ Fleet state updated (cycle 38)


System: [2026-02-17 07:30:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 20 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


node /home/ccuser/shared/scripts/fleet-cli.js briefing cog


=== Fleet Briefing for cog ===
Fleet cycle: 49 | Last updated: just now

⚠  ALERTS (3):
  - harper hasn't updated in 17 minutes
  - radar hasn't updated in 20 minutes
  - cog hasn't updated in 20 minutes

🔴 DECISIONS NEEDED:
  - Harper blocked: Moonshot balance exhausted - needs model access to continue grant work

--- Fleet Status ---
    🟢 rivet      | active   | fleet-coordination-heartbeat | hb: 2m ago
    ⚪ builder    | idle     | idle | hb: 15m ago
    🟢 susan      | active   | Competitive monitoring complete - hipages/Sidekicker pricing intel gathered | hb: 4m ago
    🔴 harper     | stalled  | idle | hb: 17m ago
    🟢 sentinel   | active   | escalating-harper-moonshot-blocker | hb: 15m ago
    🔴 radar      | stalled  | market intelligence sweep - AUD 256B construction pipeline identified, no competitor moves detected | hb: 20m ago
    🟢 herald     | active   | monitoring-decision-pending | hb: 10m ago
  → 🔴 cog        | stalled  | system-health-check-services-storage-logs | hb: 20m ago

--- My Queue: empty ---

=== End Briefing ===


ps aux | grep -E "(node|npm|systemd)" | wc -l


curl -s http://localhost:3000/health 2>/dev/null | head -c 50 || echo "app health check failed"


<!DOCTYPE html><!--0EXcNTyMa4O0_R3TVuieb--><html l


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "fleet-health-monitoring-app-status-verified"


✅ Fleet state updated (cycle 53)


System: [2026-02-17 07:50:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 20 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


=== Fleet Briefing for cog ===
Fleet cycle: 63 | Last updated: just now

⚠  ALERTS (3):
  - harper hasn't updated in 37 minutes
  - radar hasn't updated in 20 minutes
  - cog hasn't updated in 20 minutes

🔴 DECISIONS NEEDED:
  - Harper blocked: Moonshot balance exhausted - needs model access to continue grant work
  - Harper blocked on Moonshot balance - needs model access for grant work. Suggest switching Harper to Anthropic/Claude or adding Moonshot credits.

--- Fleet Status ---
    🟢 rivet      | active   | fleet-coordination-heartbeat | hb: 7m ago
    ⚪ builder    | idle     | idle | hb: 15m ago
    🟢 susan      | active   | LinkedIn content draft complete - competitive advantage post saved to drafts | hb: 4m ago
    🔴 harper     | stalled  | idle | hb: 37m ago
    🟢 sentinel   | active   | routine-system-monitoring | hb: 5m ago
    🔴 radar      | stalled  | escalated Harper Moonshot balance blocker - decision queued for Michael | hb: 20m ago
    🟢 herald     | active   | routine-fleet-monitoring | hb: 10m ago
  → 🔴 cog        | stalled  | fleet-health-monitoring-app-status-verified | hb: 20m ago

--- My Queue: empty ---

=== End Briefing ===


find /var/log -name "*.log" -size +50M 2>/dev/null | head -2


(no output)


journalctl --since "1 hour ago" | grep -i error | wc -l


journalctl --since "1 hour ago" | grep -i error | tail -3


Feb 17 07:50:03 ubuntu-s-2vcpu-4gb-syd1-01 clawdbot-radar[1810794]: 2026-02-16T20:50:03.625Z [diagnostic] lane task error: lane=session:agent:main:main durationMs=298 error="FailoverError: No API key found for provider "minimax". Auth store: /root/.clawdbot-radar/agents/main/agent/auth-profiles.json (agentDir: /root/.clawdbot-radar/agents/main/agent). Configure auth for this agent (clawdbot --profile radar agents add <id>) or copy auth-profiles.json from the main agentDir."
Feb 17 07:50:04 ubuntu-s-2vcpu-4gb-syd1-01 clawdbot-cog[1810818]: 2026-02-16T20:50:04.014Z [diagnostic] lane task error: lane=main durationMs=340 error="FailoverError: No API key found for provider "minimax". Auth store: /root/.clawdbot-cog/agents/main/agent/auth-profiles.json (agentDir: /root/.clawdbot-cog/agents/main/agent). Configure auth for this agent (clawdbot --profile cog agents add <id>) or copy auth-profiles.json from the main agentDir."
Feb 17 07:50:04 ubuntu-s-2vcpu-4gb-syd1-01 clawdbot-cog[1810818]: 2026-02-16T20:50:04.017Z [diagnostic] lane task error: lane=session:agent:main:main durationMs=435 error="FailoverError: No API key found for provider "minimax". Auth store: /root/.clawdbot-cog/agents/main/agent/auth-profiles.json (agentDir: /root/.clawdbot-cog/agents/main/agent). Configure auth for this agent (clawdbot --profile cog agents add <id>) or copy auth-profiles.json from the main agentDir."


node /home/ccuser/shared/scripts/fleet-cli.js alert cog "API key issues detected - Minimax auth missing for radar/cog agents, causing errors in logs"


⚠  Alert added: API key issues detected - Minimax auth missing for radar/cog agents, causing errors in logs
✅ Fleet state updated (cycle 66)


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "log-analysis-api-key-issue-detected-and-reported"


✅ Fleet state updated (cycle 67)


Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


node /home/ccuser/shared/scripts/fleet-cli.js briefing cog --brief


find /home/ccuser -name "*.tmp" -o -name "*.bak" -mtime +7 2>/dev/null | head -3


du -sh /home/ccuser/*/.archive/ 2>/dev/null | sort -h


228K	/home/ccuser/rateright-growth/.archive/


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "archive-cleanup-found-old-backup-files"


✅ Fleet state updated (cycle 83)


The user is asking me to follow HEARTBEAT.md strictly. Let me check the fleet briefing first, then my queue, and do my heartbeat tasks as defined in HEARTBEAT.md.

From HEARTBEAT.md, I need to:
1. Check for queued batch jobs in jobs/
2. Monitor storage usage
3. Process any pending data tasks

And I need to follow the Fleet Coordination Protocol first:
1. Read Fleet State
2. Read My Queue
3. Do My Work
4. Update My Status
5. Report Issues (if any)


No tasks for me, no blocked agents, some decisions pending but that's for Michael. Let me check my queue.


Queue is empty. Now I'll do my heartbeat tasks:
1. Check for queued batch jobs in jobs/
2. Monitor storage usage
3. Process any pending data tasks

I'll check for batch jobs, then storage.

ls -la /home/ccuser/cog/jobs/ 2>/dev/null || echo "No jobs directory found"


No jobs directory found


No jobs directory. Now let me monitor storage usage.


Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        77G   27G   51G  35% /


Storage looks fine at 35% usage. Now let me update my status and report that everything is normal.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "routine-heartbeat-jobs-storage-monitoring"


✅ Fleet state updated (cycle 105)


All done. No issues to report, so I should reply HEARTBEAT_OK as instructed.


The user is asking me to read HEARTBEAT.md and follow it strictly. Let me check the fleet briefing first to see if there are any tasks or alerts that need attention.


The briefing shows:
- No tasks for me (my_tasks: 0)
- No fleet alerts (fleet_alerts: 0)
- No blocked agents (blocked_agents: [])
- 2 decisions needed, but those are for Michael to handle

Let me check my queue to be sure there's nothing there.


Queue is empty (tasks: []), no fleet alerts, no blocked agents. According to HEARTBEAT.md, I should do my routine checks and update my status.


No jobs directory exists, so no batch jobs to check. Let me do a quick storage check as that's one of my routine tasks.


Storage usage is at 35% which is normal and healthy. Now I need to update my fleet status as per the protocol in HEARTBEAT.md.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-checks-storage-jobs"


✅ Fleet state updated (cycle 122)


I've completed my heartbeat tasks:
1. ✅ Read fleet state - no tasks, no alerts, no blocked agents
2. ✅ Read my queue - empty
3. ✅ Did my routine work - checked for jobs (none), monitored storage (35% usage, healthy)
4. ✅ Updated my status

Since there's nothing that needs attention and I've completed all routine checks, I should reply with HEARTBEAT_OK.


Let me follow the HEARTBEAT.md protocol strictly:

1. Read Fleet State - check briefing
2. Read My Queue - check queue.json
3. Do My Work - execute one task from queue or domain task
4. Update My Status
5. Report Issues (if any)

The HEARTBEAT.md says:
- Every Heartbeat (30 min): Check for queued batch jobs in jobs/, Monitor storage usage, Process any pending data tasks
- Reply HEARTBEAT_OK if nothing needs attention


Fleet briefing shows:
- 0 tasks for me
- 0 alerts
- 0 blocked agents
- 2 decisions needed (but those are for Michael, not my domain)

Let me check my queue and do routine heartbeat tasks.


My queue is empty. Following HEARTBEAT.md:
1. Check for queued batch jobs in jobs/ - I need to check this2. Monitor storage usage - I should check this3. Process any pending data tasks - I should look for thisIf nothing needs attention, reply HEARTBEAT_OK.


No jobs directory, so no batch jobs to process.


Storage usage is fine at 35%. Now let me update my status and conclude the heartbeat.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-monitoring-storage-jobs"


✅ Fleet state updated (cycle 141)


Everything looks good:
- No batch jobs to process- Storage usage normal at 35%- No pending data tasks found- Fleet status updatedNothing needs attention, so I should reply HEARTBEAT_OK as instructed.


System: [2026-02-17 09:55:01 GMT+11] [STALL DETECTOR] cog hasn't updated in 30 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


The user is sending a heartbeat prompt. I need to read HEARTBEAT.md and follow its instructions strictly. The HEARTBEAT.md file from the project context shows I need to:

1. First run fleet coordination protocol:
   - Run: `node /home/ccuser/shared/scripts/fleet-cli.js briefing cog --brief`
   - Read queue.json in my workspace
   - Do any pending tasks before regular heartbeat work
   - Update my status at the end
   - Report issues if any

2. Then do every heartbeat tasks:
   - Check for queued batch jobs in jobs/
   - Monitor storage usage
   - Process any pending data tasks

3. Reply HEARTBEAT_OK if nothing needs attention

Let me follow this protocol.


I see there's 1 fleet alert and 2 decisions needed. Let me get the full briefing to see what's going on.

node /home/ccuser/shared/scripts/fleet-cli.js briefing cog


=== Fleet Briefing for cog ===
Fleet cycle: 142 | Last updated: just now

⚠  ALERTS (1):
  - cog hasn't updated in 30 minutes

🔴 DECISIONS NEEDED:
  - Harper blocked: Moonshot balance exhausted - needs model access to continue grant work
  - Harper blocked on Moonshot balance - needs model access for grant work. Suggest switching Harper to Anthropic/Claude or adding Moonshot credits.

--- Fleet Status ---
    🟢 rivet      | active   | fleet-coordination-heartbeat | hb: 12m ago
    ⚪ builder    | idle     | idle | hb: 15m ago
    🟢 susan      | active   | CRM cleanup complete - scoring bug identified, 6 incomplete leads flagged for enrichment | hb: 29m ago
    🟢 harper     | active   | NSW Southern Basin grant deadline alert - Feb 24 (7 days) | hb: 20m ago
    🟢 sentinel   | active   | routine-system-monitoring | hb: just now
    ⚪ radar      | idle     | market intelligence update - construction recovery, modular growth 8% CAGR, AI agent deployment trends | hb: 20m ago
    🟢 herald     | active   | agent-health-check | hb: just now
  → 🟢 cog        | active   | heartbeat-routine-monitoring-storage-jobs | hb: just now

--- My Queue: empty ---

=== End Briefing ===


Good, I can see the status. The alert about me not updating in 30 minutes will be resolved since I'm updating now. There are decisions needed about Harper's Moonshot balance, but that's not my responsibility to handle directly.

Let me check my queue and then do my regular heartbeat tasks.


My queue is empty. Now I need to do my regular heartbeat work:
1. Check for queued batch jobs in jobs/
2. Monitor storage usage
3. Process any pending data tasks

Let me check these systematically.


No jobs directory found


Storage is at 35% usage (27G used of 77G), which is fine. Let me check for any large files or logs that might need attention.

find /home/ccuser -name "*.log" -size +10M 2>/dev/null | head -3


(no output)


No large log files found. Now let me update my status as required by the protocol.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-checks-completed-storage-monitoring"


✅ Fleet state updated (cycle 144)


I've completed the heartbeat protocol:
1. ✅ Read fleet state - 1 alert (resolved by this update), 2 decisions needed (Harper's Moonshot issue)
2. ✅ Read my queue - empty
3. ✅ Did my work - checked jobs (none), monitored storage (35% usage, fine), no data tasks pending
4. ✅ Updated my status
5. No issues to report that aren't already flagged

Since nothing needs attention beyond what's already been reported, I should reply HEARTBEAT_OK.


This is a heartbeat message. According to HEARTBEAT.md, I need to follow the Fleet Coordination Protocol first:

1. Read Fleet State
2. Read My Queue
3. Do My Work
4. Update My Status
5. Report Issues (if any)

Let me check the fleet state and my queue.


Fleet cycle 160, no tasks for me, no alerts, no blocked agents, but 2 decisions needed. Let me check my queue.


Queue is empty, tasks array is empty. According to HEARTBEAT.md, I should then do my regular heartbeat work:

1. Check for queued batch jobs in jobs/
2. Monitor storage usage
3. Process any pending data tasks

Let me do these checks.


No jobs directory. Let me check storage usage.


Storage is at 35% usage, which is fine. Let me check for any pending data tasks or files that need processing.

find /home/ccuser -name "*.pending" -o -name "*.todo" -o -name "*queue*" -not -path "*/node_modules/*" 2>/dev/null | head -5


Found some queue files for other agents, but these are their task queues, not pending data tasks for me. The Python files are just libraries. No pending data tasks found. According to HEARTBEAT.md, if nothing needs attention, I should reply HEARTBEAT_OK. But first I need to update my status.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-checks-storage-jobs-monitoring"


✅ Fleet state updated (cycle 162)


Status updated. Everything looks normal - no queued batch jobs (no jobs directory), storage usage is fine at 35%, no pending data tasks. Nothing needs attention, so I should reply HEARTBEAT_OK.


The user is asking me to read HEARTBEAT.md and follow it strictly. Let me check the fleet briefing first to see if there are any tasks or issues that need attention.


The fleet briefing shows:
- My tasks: 0
- Fleet alerts: 0
- Blocked agents: 0
- Decisions needed: 2 (but these are not for me to handle directly)

Let me check my queue to see if there are any tasks assigned to me.


My queue is empty. Let me do the routine checks as outlined in HEARTBEAT.md:
1. Check for queued batch jobs in jobs/ (already confirmed no jobs directory)
2. Monitor storage usage
3. Process any pending data tasks

Let me quickly check storage and then update my status.


Storage is at 35% which is fine. No jobs directory exists, no tasks in my queue, no fleet alerts that need my attention. According to HEARTBEAT.md, if nothing needs attention, I should reply HEARTBEAT_OK. Let me update my fleet status and then respond with HEARTBEAT_OK.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "routine-heartbeat-storage-monitoring-35pct"


✅ Fleet state updated (cycle 180)


Everything looks good - no tasks, no alerts, storage is fine at 35%. Following HEARTBEAT.md instructions to reply HEARTBEAT_OK when nothing needs attention.


The user is giving me a heartbeat prompt. Let me follow the HEARTBEAT.md protocol:

1. First, I need to run the fleet coordination protocol - check fleet state using the briefing command
2. Read my queue.json for any pending tasks
3. Do my work (check for batch jobs, monitor storage, process data tasks)
4. Update my status
5. Report issues if any

Let me start with the fleet briefing.


The fleet briefing shows:
- Cycle 195
- 0 tasks for me
- 0 fleet alerts
- 0 blocked agents
- 2 decisions needed (but not for me specifically)

Let me check my queue next.


My queue is empty - no tasks assigned to me. Let me do my regular heartbeat work according to HEARTBEAT.md:

1. Check for queued batch jobs in jobs/ - I need to check if this directory exists
2. Monitor storage usage
3. Process any pending data tasks

Let me check these systematically.


No jobs directory found


No jobs directory, so no batch jobs to process. Let me check storage usage.


Storage is at 35% usage, which is fine - nothing needs attention there. Let me update my status to show I've completed this heartbeat cycle.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-checks-storage-35pct-no-batch-jobs"


✅ Fleet state updated (cycle 197)


Status updated successfully. Since:
- No tasks in my queue
- No batch jobs to process
- Storage usage is fine at 35%
- No fleet alerts that need my attention
- All my regular heartbeat checks are complete

Nothing needs attention, so I should reply HEARTBEAT_OK.


The user is sending me a heartbeat message. I need to follow the HEARTBEAT.md protocol strictly:

1. Read fleet state first
2. Read my queue
3. Check for pending tasks
4. Do my work or reply HEARTBEAT_OK if nothing needs attention

Let me follow this protocol.


Fleet briefing shows:
- Cycle 213
- 0 tasks for me
- 0 alerts
- No blocked agents
- 2 decisions needed (but those are for Michael, not for me to act on)

Let me check my queue.


My queue is empty. Let me do my heartbeat work as per HEARTBEAT.md:

1. Check for queued batch jobs in jobs/ - there isn't even a jobs directory
2. Monitor storage usage
3. Process any pending data tasks

Since there are no queued batch jobs, let me check storage and look for any data tasks.


No jobs directory as expected. Let me check storage usage.


Storage is at 35% - normal and healthy. Now let me check for any pending data tasks. I'll look for any files that might indicate pending work.

find /home/ccuser -name "*.pending" -o -name "*.todo" -o -name "*queue*" -not -path "*/node_modules/*" 2>/dev/null | head -3


/home/ccuser/radar/queue.json
/home/ccuser/harper/queue.json
/home/ccuser/susan/queue.json


Those are other agents' queue files, not data tasks for me to process. Let me update my status and reply HEARTBEAT_OK since nothing needs my attention.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-checks-completed-no-pending-work"


✅ Fleet state updated (cycle 215)


I've completed my heartbeat duties:
1. ✅ Checked for queued batch jobs - none found
2. ✅ Monitored storage usage - 35%, healthy
3. ✅ Processed pending data tasks - none found
4. ✅ Updated my fleet status

Nothing needs attention, so I should reply HEARTBEAT_OK.


The user is asking me to read HEARTBEAT.md and follow it strictly. I need to check the fleet state and my queue, then update my status accordingly. Looking at my previous responses, I've been doing routine heartbeat checks consistently.

Let me check the fleet briefing and my queue as per the HEARTBEAT.md protocol.

node /home/ccuser/shared/scripts/fleet-cli.js briefing cog --brief


There's 1 fleet alert and radar is blocked, plus 2 decisions needed. Let me get the full briefing to see what's happening.


=== Fleet Briefing for cog ===
Fleet cycle: 229 | Last updated: just now

⚠  ALERTS (1):
  - radar hasn't updated in 50 minutes

🔴 DECISIONS NEEDED:
  - Harper blocked: Moonshot balance exhausted - needs model access to continue grant work
  - Harper blocked on Moonshot balance - needs model access for grant work. Suggest switching Harper to Anthropic/Claude or adding Moonshot credits.

--- Fleet Status ---
    🟢 rivet      | active   | fleet-coordination-heartbeat | hb: 9m ago
    ⚪ builder    | idle     | idle | hb: 45m ago
    ⚪ susan      | idle     | CRM cleanup complete - scoring bug identified, 6 incomplete leads flagged for enrichment | hb: 30m ago
    ⚪ harper     | idle     | R&D tax deadline confirmed 30 Apr (71 days), potential 43.5% refund for Builder dev work | hb: 20m ago
    🟢 sentinel   | active   | routine-system-monitoring | hb: just now
    🔴 radar      | stalled  | AI construction threat analysis - YC Structured AI + Bedrock autonomous excavators targeting same market | hb: 50m ago
    🟢 herald     | active   | fleet-health-monitoring | hb: just now
  → 🟢 cog        | active   | heartbeat-checks-completed-no-pending-work | hb: 30m ago

--- My Queue: empty ---

=== End Briefing ===


Radar is stalled for 50 minutes. According to fleet protocols, agents stalled over 2 hours need to be pinged, but at 50 minutes it's getting close. However, my role is operations support - I should note this but not necessarily take action since Rivet and Sentinel are handling coordination. Let me check my queue and continue with routine monitoring.


No tasks in my queue. Let me do the routine checks as specified in HEARTBEAT.md and update my status.


No jobs directory found


No jobs directory. Let me check storage usage as part of routine monitoring.


Storage is at 35% - fine. Let me update my status and report that all routine checks are complete.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-monitoring-storage-35pct-no-jobs"


✅ Fleet state updated (cycle 232)


Everything appears normal for my routine operations. No jobs to process, storage is at healthy levels, no pending tasks in my queue. I should respond with HEARTBEAT_OK as per the protocol.


The user is asking me to read HEARTBEAT.md and follow it strictly. Let me check the fleet briefing first to see if there's anything that needs attention.


The briefing shows:
- No tasks for me
- No fleet alerts
- No blocked agents
- 2 decisions needed (but those are for Michael, not for me to handle)

Let me check my queue to see if there are any pending tasks assigned to me.


My queue is empty. Let me do my routine heartbeat checks per HEARTBEAT.md:

1. Check for queued batch jobs in jobs/
2. Monitor storage usage
3. Process any pending data tasks

Then update my status with the fleet.


No jobs directory, so no batch jobs to check.


Storage usage is at 35%, which is normal. No pending data tasks found. All routine checks completed. I should update my fleet status and respond with HEARTBEAT_OK since nothing needs attention.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-checks-storage-35pct-no-jobs"


✅ Fleet state updated (cycle 248)


All heartbeat tasks completed successfully:- No queued batch jobs (jobs/ directory doesn't exist)- Storage usage monitored (35% - healthy)- No pending data tasks- Fleet status updated

According to HEARTBEAT.md, if nothing needs attention, I should reply HEARTBEAT_OK.


I need to read HEARTBEAT.md and follow the fleet coordination protocol. Let me follow the steps:

1. Read fleet state - check if there are any tasks for me or alerts
2. Read my queue for pending tasks
3. If nothing needs attention, check for routine work as per HEARTBEAT.md
4. Update my status
5. Reply HEARTBEAT_OK if nothing needs attention

Let me start by checking the fleet briefing.


There's 1 fleet alert and rivet is blocked, but I have 0 tasks in my queue. Let me check my queue and see what the alert is about by getting the full briefing.


=== Fleet Briefing for cog ===
Fleet cycle: 264 | Last updated: just now

⚠  ALERTS (1):
  - rivet hasn't updated in 69 minutes

🔴 DECISIONS NEEDED:
  - Harper blocked: Moonshot balance exhausted - needs model access to continue grant work
  - Harper blocked on Moonshot balance - needs model access for grant work. Suggest switching Harper to Anthropic/Claude or adding Moonshot credits.

--- Fleet Status ---
    🔴 rivet      | stalled  | fleet-coordination-heartbeat | hb: 1h ago
    ⚪ builder    | idle     | rivet-context-fix | hb: 12m ago
    ⚪ susan      | idle     | CRM cleanup complete - scoring bug identified, 6 incomplete leads flagged for enrichment | hb: 30m ago
    🟢 harper     | active   | FBT deadline identified 31 Mar (43 days), low impact for pre-launch business | hb: 20m ago
    🟢 sentinel   | active   | routine-system-monitoring | hb: just now
    🟢 radar      | active   | INTELLIGENCE SWEEP: 67M+ in construction AI funding missed - PermitFlow 4M, Attentive.AI 0.5M, Bedrock 70M | hb: 10m ago
    🟢 herald     | active   | routine-agent-health-monitoring | hb: just now
  → 🟢 cog        | active   | heartbeat-routine-checks-storage-35pct-no-jobs | hb: 30m ago

--- My Queue: empty ---

=== End Briefing ===


The main issue is Rivet hasn't updated in 69 minutes (1 hour+), which is significant since Rivet is the COO coordinating agent. This is concerning. Let me check my queue to confirm no tasks, then do my routine checks.


Queue is empty. Let me do my routine operations checks as per HEARTBEAT.md - check for batch jobs, monitor storage, and process any pending data tasks.


No jobs directory found


No jobs directory. Let me check storage usage.


Storage is at 35% which is normal. Now let me update my status since I've completed the routine checks.

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-routine-ops-checks-storage-35pct-no-pending-jobs"


✅ Fleet state updated (cycle 266)


I've completed my routine heartbeat tasks - checked for batch jobs (none), monitored storage (35% usage - normal), and checked for pending data tasks (none). Fleet coordination protocol completed, status updated. Since there's nothing that needs attention from my perspective, I should reply HEARTBEAT_OK.


System: [2026-02-17 14:15:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 50 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


=== Fleet Briefing for cog ===
Fleet cycle: 284 | Last updated: just now

⚠  ALERTS (2):
  - susan hasn't updated in 50 minutes
  - cog hasn't updated in 50 minutes

🔴 DECISIONS NEEDED:
  - Harper blocked: Moonshot balance exhausted - needs model access to continue grant work
  - Harper blocked on Moonshot balance - needs model access for grant work. Suggest switching Harper to Anthropic/Claude or adding Moonshot credits.

--- Fleet Status ---
    🟢 rivet      | active   | moonshot-emergency-coordination | hb: 35m ago
    🟢 builder    | active   | Responded to Rocky voice notes - Gemini added to Harper, awaiting MiniMax key | hb: 5m ago
    🔴 susan      | stalled  | CRM cleanup complete - scoring bug identified, 6 incomplete leads flagged for enrichment | hb: 50m ago
    🟢 harper     | active   | Financial monitoring - checking for urgent grant deadlines or compliance issues | hb: 19m ago
    🟢 sentinel   | active   | monitoring-elevated-cpu-load | hb: 11m ago
    ⚪ radar      | idle     | INTELLIGENCE SWEEP: 67M+ in construction AI funding missed - PermitFlow 4M, Attentive.AI 0.5M, Bedrock 70M | hb: 10m ago
    🟢 herald     | active   | agent-health-monitoring | hb: 7m ago
  → 🔴 cog        | stalled  | heartbeat-routine-ops-checks-storage-35pct-no-pending-jobs | hb: 50m ago

--- My Queue: empty ---

=== End Briefing ===


ls -la /home/ccuser/cog/jobs/ 2>/dev/null || echo "No jobs directory found"


du -sh /home/ccuser/*/logs/ 2>/dev/null | sort -h


104K	/home/ccuser/shared/logs/
180K	/home/ccuser/rateright-main-site/logs/


active


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "ops-health-check-services-active-logs-normal-storage-35pct"


✅ Fleet state updated (cycle 285)


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "routine-heartbeat-ops-monitoring-storage-35pct"


✅ Fleet state updated (cycle 298)


node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "heartbeat-ops-checks-storage-monitoring-35pct-no-jobs"


✅ Fleet state updated (cycle 312)


System: [2026-02-17 16:15:03 GMT+11] [STALL DETECTOR] cog hasn't updated in 60 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:20:05 GMT+11] [STALL DETECTOR] cog hasn't updated in 65 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:25:04 GMT+11] [STALL DETECTOR] cog hasn't updated in 70 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:30:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 75 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:35:04 GMT+11] [STALL DETECTOR] cog hasn't updated in 80 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:40:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 85 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:45:04 GMT+11] [STALL DETECTOR] cog hasn't updated in 90 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:49:59 GMT+11] Cog — Rivet here. Ops tasks: (1) Check Growth Engine API health and lead counts. (2) Check if the CEO Dashboard at rivet.rateright.com.au/ceo is returning accurate data. (3) Verify all cron jobs are running on schedule. Report back.

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 16:55:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 100 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:00:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 105 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:05:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 110 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:10:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 115 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:15:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 120 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:20:08 GMT+11] [STALL DETECTOR] cog hasn't updated in 125 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:25:05 GMT+11] [STALL DETECTOR] cog hasn't updated in 130 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:30:09 GMT+11] [STALL DETECTOR] cog hasn't updated in 135 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:35:07 GMT+11] [STALL DETECTOR] cog hasn't updated in 140 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:40:09 GMT+11] [STALL DETECTOR] cog hasn't updated in 145 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:45:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 150 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:50:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 155 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 17:55:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 160 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:00:11 GMT+11] [STALL DETECTOR] cog hasn't updated in 165 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:05:05 GMT+11] [STALL DETECTOR] cog hasn't updated in 170 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:10:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 175 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:15:07 GMT+11] [STALL DETECTOR] cog hasn't updated in 180 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:20:08 GMT+11] [STALL DETECTOR] cog hasn't updated in 185 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:25:06 GMT+11] [STALL DETECTOR] cog hasn't updated in 190 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:30:09 GMT+11] [STALL DETECTOR] cog hasn't updated in 195 minutes
System: [2026-02-17 18:30:10 GMT+11] [BUDDY CHECK] cog stalled 195min — buddy sentinel escalating

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:35:16 GMT+11] [STALL DETECTOR] cog hasn't updated in 200 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:40:15 GMT+11] [STALL DETECTOR] cog hasn't updated in 205 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:45:05 GMT+11] [STALL DETECTOR] cog hasn't updated in 210 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:50:04 GMT+11] [STALL DETECTOR] cog hasn't updated in 215 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 18:55:03 GMT+11] [STALL DETECTOR] cog hasn't updated in 220 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 19:00:05 GMT+11] [STALL DETECTOR] cog hasn't updated in 225 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 19:01:06 GMT+11] Fleet recovery complete - resume ops support

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 19:05:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 230 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


System: [2026-02-17 19:10:02 GMT+11] [STALL DETECTOR] cog hasn't updated in 235 minutes

Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.


PRIORITY DIRECTIVE FROM RIVET (Chief of Staff):

Michael has ordered ALL agents to design their own autonomous operations. Harper and Herald have already delivered theirs. You haven't.

CREATE: AUTONOMOUS-DESIGN.md in your workspace. Include:
1. What you monitor/do WITHOUT being told
2. Your decision authority — what you can act on vs escalate
3. How you coordinate with other agents (queue files, shared state)
4. DATA TRIGGERS FOR REDESIGN — what real-world metrics would cause you to rethink your approach in ~3 months when we have live app data and real users

This is not optional. Michael expects it tonight.


PRIORITY DIRECTIVE FROM RIVET: Design your autonomous operations NOW. Create AUTONOMOUS-DESIGN.md in your workspace. Harper and Herald already delivered theirs. Include: (1) What you monitor/do without being told (2) Decision authority boundaries (3) Agent coordination methods (4) DATA TRIGGERS FOR REDESIGN — what metrics from live app data in 3 months would cause you to rethink your approach. Michael expects this tonight.


This is a priority directive from Rivet. I need to create an AUTONOMOUS-DESIGN.md file that outlines how I, as Cog, will operate autonomously. Looking at my SOUL.md and understanding my role as Operations Support, I need to design a comprehensive autonomous operations system.

Let me think about the four key areas:

1. What I monitor/do WITHOUT being told:
- Storage monitoring and cleanup
- Log rotation and archiving
- Database maintenance tasks
- File system health checks
- Service status monitoring
- Data integrity verification
- Batch processing jobs
- Performance metrics collection

2. Decision authority boundaries:
- Can auto-approve: routine maintenance, log cleanup, archiving, health checks
- Need approval: anything that could affect production data, major system changes
- Escalate: security issues, data corruption, system failures

3. Agent coordination:
- Queue files for task assignment
- Shared state through fleet coordination system
- Status updates via fleet-update script
- Alert system for issues

4. Data triggers for redesign:
- User volume growth requiring different scaling
- Storage usage patterns
- Performance bottlenecks
- Error rates and types
- System load patterns

I should write this comprehensively since it's a priority directive from Michael via Rivet.

write

# AUTONOMOUS-DESIGN.md - Cog Operations

*Autonomous operations design for RateRight's Operations Support agent*
*Created: 2026-02-17 in response to Michael's directive via Rivet*

---

## 1. AUTONOMOUS MONITORING & ACTIONS (Without Being Told)

### Daily Automated Tasks
- **2:00 AM:** Log rotation and compression across all systems
- **3:00 AM:** Archive files older than 30 days to compressed storage
- **4:00 AM:** Generate daily metrics summary (storage, performance, errors)
- **Every hour:** Storage usage monitoring with alert thresholds
- **Every 30 min:** System service health checks (rateright-app, databases)

### Continuous Monitoring
- **Storage Management:** Auto-compress logs >50MB, archive temp files >7 days old
- **Database Maintenance:** Index optimization, connection pool monitoring, query performance tracking
- **File System Health:** Disk usage alerts at 80%, cleanup recommendations at 85%
- **Performance Metrics:** Response times, memory usage, CPU load patterns
- **Data Integrity:** Backup verification, corruption detection, inconsistency reporting
- **Error Pattern Analysis:** Log parsing for recurring issues, trend identification

### Batch Processing
- **Lead Data Processing:** CSV imports, data enrichment, duplicate detection
- **Report Generation:** Weekly fleet performance, monthly system summaries
- **Integration Health:** API endpoint testing, webhook validation, sync verification
- **Security Audits:** File permission checks, access log analysis, anomaly detection

---

## 2. DECISION AUTHORITY BOUNDARIES

### AUTO-APPROVE (Act Immediately)
- Routine log cleanup and compression
- Temporary file removal (>7 days old)
- Non-critical service restarts
- Cache clearing and optimization
- Archive old backup files
- Generate reports and metrics
- File permission corrections
- Database index maintenance

### ESCALATE TO RIVET (Decision Required)
- Any file deletion in production directories
- Service changes affecting user experience
- Database schema modifications
- Security configuration changes
- Third-party integration modifications
- Budget-affecting resource allocation

### EMERGENCY ESCALATION (Alert Michael Immediately)
- Data corruption detected
- Security breach indicators
- Critical service failures
- Storage approaching 95% full
- Backup system failures
- Revenue-affecting system issues

### COORDINATION REQUIRED
- Cross-agent data dependencies (consult Susan for CRM data, Harper for financial reports)
- System changes affecting other agents' workflows
- Resource allocation impacting fleet performance

---

## 3. AGENT COORDINATION METHODS

### Queue-Based Task Management
```
/home/ccuser/cog/queue.json - My personal task queue from Rivet
/home/ccuser/shared/ops-requests/ - Incoming requests from other agents
/home/ccuser/shared/ops-completed/ - Completed task notifications
```

### Fleet Communication Protocol
- **Status Updates:** `fleet-update.js cog --status --task` every heartbeat
- **Alert System:** `fleet-cli.js alert cog "message"` for issues requiring attention
- **Decision Requests:** `fleet-cli.js decide cog "decision-needed"` for escalation
- **Shared State:** Monitor `/home/ccuser/shared/KANBAN.md` for fleet-wide priorities

### Data Sharing Standards
- **Performance Metrics:** `/home/ccuser/shared/metrics/cog-daily.json`
- **System Health:** `/home/ccuser/shared/status/system-health.json`
- **Error Summaries:** `/home/ccuser/shared/logs/error-patterns.md`
- **Maintenance Windows:** `/home/ccuser/shared/schedules/maintenance.json`

### Integration Points
- **Growth Engine:** Monitor CRM database health, process lead imports
- **RateRight App:** Performance monitoring, log analysis, backup verification
- **Agent Fleet:** Resource usage tracking, coordination bottleneck identification

---

## 4. DATA TRIGGERS FOR REDESIGN (3-Month Review Points)

### User Volume Triggers
- **>100 active contractors:** Redesign batch processing for scale
- **>500 job postings/day:** Implement real-time data processing
- **>1000 concurrent users:** Add load balancing and performance optimization
- **Database >10GB:** Implement data archiving and partitioning strategies

### Performance Triggers
- **API response times >2 seconds:** Implement caching and optimization
- **Storage growth >10GB/month:** Redesign archival and compression strategies
- **Error rates >1%:** Implement predictive error prevention
- **Agent coordination delays >30 seconds:** Redesign communication protocols

### Business Triggers
- **Revenue >$10K/month:** Add financial data processing and reporting
- **Multi-city expansion:** Implement geo-distributed monitoring
- **Team growth >3 human employees:** Add HR data processing and compliance
- **Regulatory compliance requirements:** Implement audit trails and data governance

### System Complexity Triggers
- **>5 external integrations:** Implement centralized API management
- **>3 database systems:** Add cross-system data integrity checks
- **>24/7 uptime requirements:** Implement redundancy and failover
- **Custom enterprise deployments:** Add multi-tenant operations support

### Agent Fleet Evolution Triggers
- **>12 agents in fleet:** Redesign coordination from centralized to distributed
- **Specialized sub-teams:** Implement hierarchical operations support
- **Cross-project agent sharing:** Add resource allocation and scheduling
- **Agent-to-agent direct communication:** Reduce central coordination bottlenecks

---

## IMPLEMENTATION SCHEDULE

### Week 1: Foundation
- Deploy automated daily tasks (2AM, 3AM, 4AM cycles)
- Implement storage monitoring with thresholds
- Create decision authority matrix documentation

### Week 2: Coordination
- Build queue-based task management system
- Implement fleet communication protocols
- Create shared metrics and status reporting

### Week 3: Intelligence
- Deploy error pattern analysis
- Implement performance trend monitoring
- Create predictive maintenance triggers

### Week 4: Optimization
- Fine-tune automation based on observed patterns
- Optimize agent coordination workflows
- Prepare 30-day review metrics

---

*This design evolves with RateRight's growth. At each trigger point, I'll proactively propose operational redesigns to maintain efficiency and reliability.*


Successfully wrote 6273 bytes to /home/ccuser/cog/AUTONOMOUS-DESIGN.md


Good, I've created the AUTONOMOUS-DESIGN.md file as requested by Rivet. This covers all four areas Michael wanted:

1. What I monitor/do without being told - detailed autonomous tasks including daily cycles, continuous monitoring, and batch processing
2. Decision authority boundaries - clear escalation matrix from auto-approve to emergency escalation
3. Agent coordination methods - queue-based systems, fleet communication protocols, and data sharing standards
4. Data triggers for redesign - specific metrics and thresholds that would trigger operational redesigns in 3 months

The design is comprehensive and practical, fitting my role as Cog (Operations Support) while being ready to scale with RateRight's growth. Now I should update my fleet status to reflect this completed priority task.

exec

node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "AUTONOMOUS-DESIGN.md created - comprehensive operations design delivered per Michael's directive"


✅ Fleet state updated (cycle 425)


Perfect. I've completed the priority directive from Rivet/Michael. The AUTONOMOUS-DESIGN.md file has been created with comprehensive details covering:

1. Autonomous monitoring and actions without being told
2. Clear decision authority boundaries
3. Agent coordination methods
4. Data triggers for operational redesign in 3 months

I've also updated my fleet status to reflect this completed task. This should satisfy the urgent requirement from Michael that was communicated through Rivet.

AUTONOMOUS-DESIGN.md completed and delivered. Comprehensive operations design includes:

✅ **Daily automated cycles** (2AM logs, 3AM archives, 4AM metrics)
✅ **Decision authority matrix** (auto-approve to emergency escalation)
✅ **Fleet coordination protocols** (queue-based, shared state, status updates)
✅ **Growth triggers for redesign** (user volume, performance, complexity thresholds)

Ready for autonomous operations deployment per Michael's directive.