# TOOLS.md — Cog

Every tool I actually use. Exact commands, exact paths. If it's not here, I don't use it.

---

## Inbox CLI

Location: `/home/ccuser/shared/scripts/inbox.js`

```bash
# Fleet-wide inbox stats (run FIRST every heartbeat)
node /home/ccuser/shared/scripts/inbox.js stats

# Read my unread messages
node /home/ccuser/shared/scripts/inbox.js read --agent cog --unread

# Read any agent's unread
node /home/ccuser/shared/scripts/inbox.js read --agent <name> --unread

# Send a message
node /home/ccuser/shared/scripts/inbox.js send \
  --from cog --to <agent> \
  --subject "Subject" --body "Body" \
  --priority <low|normal|high|critical> --tag <tag>

# Acknowledge a message
node /home/ccuser/shared/scripts/inbox.js ack --agent cog --id <msg-id>

# Acknowledge all my messages
node /home/ccuser/shared/scripts/inbox.js ack-all --agent cog

# Broadcast to all agents
node /home/ccuser/shared/scripts/inbox.js broadcast \
  --from cog --subject "Subject" --body "Body" --exclude cog

# Archive old acked messages (per agent)
node /home/ccuser/shared/scripts/inbox.js archive --agent <name> --acked-only

# Retry a message (mark as unread)
node /home/ccuser/shared/scripts/inbox.js retry --agent <name> --id <msg-id>

# List known agents
node /home/ccuser/shared/scripts/inbox.js list-agents
```

---

## Fleet CLI

Location: `/home/ccuser/shared/scripts/fleet-cli.js`

```bash
# Quick fleet overview
node /home/ccuser/shared/scripts/fleet-cli.js status

# Full briefing for an agent
node /home/ccuser/shared/scripts/fleet-cli.js briefing <agent>

# Brief summary
node /home/ccuser/shared/scripts/fleet-cli.js briefing <agent> --brief

# Report an alert
node /home/ccuser/shared/scripts/fleet-cli.js alert cog "problem description"

# Flag decision needed from Michael
node /home/ccuser/shared/scripts/fleet-cli.js decide cog "Need Michael to decide X"

# Run stall detection
node /home/ccuser/shared/scripts/fleet-cli.js detect [--auto-wake]
```

---

## Fleet Update

Location: `/home/ccuser/shared/scripts/fleet-update.js`

```bash
# Update my status in fleet-state.json
node /home/ccuser/shared/scripts/fleet-update.js cog --status active --task "inbox-curation" --progress 1

# Mark blocked
node /home/ccuser/shared/scripts/fleet-update.js cog --status blocked --blocked-on "reason"
```

---

## Stall Detector

Location: `/home/ccuser/shared/scripts/stall-detector.js`

```bash
# Check all agents
node /home/ccuser/shared/scripts/stall-detector.js

# Auto-wake stalled agents
node /home/ccuser/shared/scripts/stall-detector.js --auto-wake

# Dry run
node /home/ccuser/shared/scripts/stall-detector.js --dry-run
```

Stall threshold: 60 min no heartbeat. Context warnings at 85%/95%.

---

## Productivity Checks

Commands I run to verify agent output (not just heartbeats):

```bash
# Builder — recent commits
cd /home/ccuser/the-50-dollar-app && git log --oneline -5 --since="4 hours ago"

# Other agents — latest memory file (shows work done)
ls -lt /home/ccuser/<agent>/memory/*.md | head -1
cat /home/ccuser/<agent>/memory/$(date +%Y-%m-%d).md
```

---

## Key File Paths

| Path | Purpose |
|------|---------|
| `/home/ccuser/shared/fleet-state.json` | Fleet status — all agents, tasks, heartbeats |
| `/home/ccuser/shared/inboxes/` | JSONL inbox files per agent |
| `/home/ccuser/shared/inboxes/cog.jsonl` | My inbox |
| `/home/ccuser/shared/inboxes/cog.acks.json` | My acknowledgments |
| `/home/ccuser/shared/locks/` | Task coordination locks |
| `/home/ccuser/shared/logs/` | Shared fleet logs |
| `/home/ccuser/cog/status.json` | My status — updated every heartbeat |
| `/home/ccuser/cog/queue.json` | My task queue — tasks from other agents |
| `/home/ccuser/cog/memory/` | Daily memory files |

---

## Agent Ports & Services

| Agent | Port | Service | Workspace |
|-------|------|---------|-----------|
| Rivet | 18789 | clawdbot-gateway | `/home/ccuser/rateright-growth/rivet` |
| Builder | 18790 | clawdbot-builder | `/home/ccuser/the-50-dollar-app` |
| Susan | 18792 | clawdbot-susan | `/home/ccuser/susan` |
| Harper | 18796 | clawdbot-harper | `/home/ccuser/harper` |
| Sentinel | 18800 | clawdbot-sentinel | `/home/ccuser/sentinel` |
| Radar | 18804 | clawdbot-radar | `/home/ccuser/radar` |
| Herald | 18808 | clawdbot-herald | `/home/ccuser/herald` |
| Cog | 18812 | clawdbot-cog | `/home/ccuser/cog` |

---

## Shared Reference Docs

| File | What's In It |
|------|-------------|
| `/home/ccuser/shared/MISSION.md` | Team mission, priorities, success metrics |
| `/home/ccuser/shared/COMPANY.md` | Company dashboard, financials, blockers |
| `/home/ccuser/shared/COMMS-PROTOCOL.md` | Fleet communication rules, buddy system |
| `/home/ccuser/shared/LESSONS.md` | Shared lessons — read before doing anything risky |

## Fleet Operations Scripts

Tools for the ops duties delegated from Rivet:

```bash
# Data freshness check (run every 2nd heartbeat)
bash /home/ccuser/rateright-growth/rivet/scripts/data-freshness-check.sh

# Fleet doctor log (verify health monitoring is running)
tail -20 /home/ccuser/rateright-growth/rivet/memory/fleet-doctor.log

# Session archiver log (verify daily cron ran)
cat /home/ccuser/shared/logs/session-archiver.log | tail -5

# Fleet bulletin archiver log (verify daily cron ran)
cat /home/ccuser/shared/logs/fleet-broadcast-archive.log | tail -5

# Manual session archive (if cron missed)
bash /home/ccuser/shared/scripts/session-archiver.sh

# Manual bulletin archive (if cron missed)
node /home/ccuser/rateright-growth/rivet/scripts/fleet-broadcast.js archive
```

## Fleet Bulletin Board

```bash
# Read all bulletins (do this every boot)
cat /home/ccuser/shared/fleet-bulletins.jsonl

# Post a bulletin (when you learn something fleet-relevant)
node /home/ccuser/rateright-growth/rivet/scripts/fleet-broadcast.js post \
  --from cog --category <fix|correction|strategy|status|alert|decision> \
  --priority <info|urgent> --targets <all|agent1,agent2> --summary "..."

# Read formatted
node /home/ccuser/rateright-growth/rivet/scripts/fleet-broadcast.js read
```

## Key Ops File Paths

| Path | Purpose |
|------|---------|
| `/home/ccuser/rateright-growth/rivet/memory/voice-brief-data.json` | Voice brief data — must be fresh by 5:15 AM and 6:00 PM |
| `/home/ccuser/rateright-growth/rivet/memory/fleet-doctor.log` | Fleet doctor output — check every heartbeat |
| `/home/ccuser/shared/logs/session-archiver.log` | Session archiver cron log |
| `/home/ccuser/shared/logs/fleet-broadcast-archive.log` | Bulletin archiver cron log |
| `/home/ccuser/shared/fleet-bulletins.jsonl` | Fleet bulletin board — read every boot |
| `/home/ccuser/shared/fleet-bulletins-archive.jsonl` | Archived expired bulletins |
