---
created: 2026-03-12
source: Rivet
tags: [agent-archive, rivet]
---

# System Redesign — Implementation Plan
**Created: 2026-02-04 | Status: DRAFT — awaiting Michael's approval**

---

## Overview

Redesign Rivet's system from a 5-layer architecture with 12 cron jobs to a single-brain + sub-agent model with 4 cron jobs. Make DeepSeek the default sub-agent model.

**Total files to change:** ~10
**Estimated cost:** $2-3
**Estimated time:** 15-20 minutes

---

## Phase 1: Config Changes (Rivet on Opus — must be exact)

### Step 1.1: Apply DeepSeek as sub-agent default
**File:** `/root/.clawdbot/clawdbot.json` (via gateway config.patch)
**Change:** Add `agents.defaults.subagents.model: "deepseek/deepseek-chat"`
**Why:** All sub-agents will use DeepSeek ($0.27/$1.10 per M) instead of inheriting Sonnet ($3/$15 per M)

### Step 1.2: Verify model hierarchy is correct
**Current config confirms:**
- Primary: `anthropic/claude-sonnet-4-5` ✅
- Fallback: `anthropic/claude-opus-4-5` ✅
- Sub-agents: `deepseek/deepseek-chat` (after step 1.1)
- Available aliases: `default`, `opus`, `sonnet`, `deepseek`, `r1`

### Step 1.3: Restart gateway to apply
**Command:** Gateway restart via config.patch (auto-restarts)

---

## Phase 2: Cron Job Rewrite (Rivet on Opus)

### Step 2.1: Delete old cron jobs (8 jobs)
Remove these rigid/redundant jobs:
- `lead-alerts` (disabled, move to heartbeat)
- `session-capture` (disabled, remove)
- `cc-phone-ai-monitor` (disabled, remove)
- `vapi-call-notify` (disabled, remove)
- `apollo-enrichment` (merge into nightly-routine)
- `candidate-onboard-check` (move to heartbeat)
- `daily-token-tracking` (move to heartbeat)
- `weekly-token-report` (merge into weekly review)

### Step 2.2: Rewrite remaining 4 cron jobs (goal-oriented)

**Job 1: `nightly-routine`** (2am AEST, isolated, DeepSeek via sub-agent inheritance)
```
Old: 5 numbered steps with specific instructions
New: "Run the nightly routine. Research fresh leads (job boards, Sydney focus, 
construction trades). Scan competitors (Workmate, Sidekicker, Airtasker). 
Check industry news. Save everything to memory/nightly-scan.md and 
memory/fresh-leads.json. Enrich leads via Apollo script if available. 
Be thorough but efficient."
```

**Job 2: `morning-brief`** (5:00am AEST, isolated, deliver to Telegram)
```
Old: 7 numbered steps with specific API calls
New: "Morning brief for Michael. Cover: system health, overnight activity, 
fresh leads ready for upload, decisions needed, business snapshot from 
Growth Engine if active. Read memory/nightly-scan.md for overnight findings. 
Keep it under 20 lines. Lead with what matters most."
```

**Job 3: `evening-brief`** (6:00pm AEST, isolated, deliver to Telegram)
```
Old: Detailed step-by-step
New: "Evening brief for Michael. Cover: what got done today, what's blocked, 
what needs his input tonight, overnight plan. Check Growth Engine stats 
if active. Short and actionable."
```

**Job 4: `weekly-review`** (Monday 7:00am AEST, isolated, deliver to Telegram)
```
Old: 5 numbered steps
New: "Weekly review. What worked last week? What didn't? Cost analysis 
(check token usage logs). One concrete recommendation for next week. 
Patterns worth noting. Keep it brief."
```

### Step 2.3: Update monthly-analysis to goal-oriented
Keep the existing monthly job but simplify the prompt to goal-oriented.

---

## Phase 3: File Updates (Sub-agents on DeepSeek)

### Step 3.1: Rewrite HEARTBEAT.md
**Sub-agent task:** Rewrite HEARTBEAT.md to be the primary monitoring layer.
**What it needs to include:**
- System health checks (disk, memory, services, Growth Engine API)
- Git commit/push if uncommitted changes
- Check for stuck processes
- Candidate onboard check (moved from cron)
- Token usage check (moved from cron)
- Lead alert check when Growth Engine is active (moved from cron)
- Keep the PAUSE section at top
- Keep quiet hours (11pm-4am)
- Keep it SHORT (every token in this file is sent with every API call)

### Step 3.2: Replace SYSTEM.md with v2
**Sub-agent task:** Copy SYSTEM-v2-draft.md to SYSTEM.md.
Add the correct model hierarchy section:
- Sonnet 4.5 = main agent
- Opus = manual switch for deep/technical work  
- DeepSeek = sub-agents (default)

### Step 3.3: Update CONTEXT.md
**Sub-agent task:** Update CONTEXT.md to reflect new architecture:
- Remove references to CC VPS, Curator, INBOX/OUTBOX
- Update "Recent Decisions" with today's redesign
- Update system state to reflect single-brain architecture

### Step 3.4: Clean up old coordination files
**Sub-agent task:** Archive (don't delete) old files that are no longer needed:
- `.claude/INBOX.md` → `.claude/archive/INBOX.md`
- `.claude/OUTBOX.md` → `.claude/archive/OUTBOX.md`
- `.claude/HANDSHAKE.md` → `.claude/archive/HANDSHAKE.md`
- `.claude/STATUS.md` → `.claude/archive/STATUS.md`
- `.claude/SHARED-MEMORY.md` → `.claude/archive/SHARED-MEMORY.md`

---

## Phase 4: Verification (Rivet on Opus)

### Step 4.1: Verify config
- Check gateway config shows DeepSeek as sub-agent model
- Verify Sonnet is still primary
- Verify heartbeat interval is 30min

### Step 4.2: Verify cron jobs
- List all cron jobs — should be 4-5 active
- Check prompts are goal-oriented

### Step 4.3: Test sub-agent spawn
- Spawn a quick test sub-agent
- Verify it uses DeepSeek (check session status)

### Step 4.4: Verify files
- SYSTEM.md = v2
- HEARTBEAT.md = rewritten
- CONTEXT.md = updated
- Old .claude/ files archived

### Step 4.5: Git commit
- Commit all changes: "system: v2 redesign — single brain + sub-agents"
- Push to origin

---

## Phase 5: Notify Michael
- Send summary of what changed
- Push updated SYSTEM.md to Notion (Live System Design page)
- Confirm everything is working

---

## Risk Mitigation

- **Config rollback:** If gateway doesn't restart, old config is still in git
- **File backup:** Archive old files, don't delete
- **Cron safety:** Old disabled cron jobs can be re-enabled if needed
- **Test before notify:** Verify everything works before telling Michael it's done

---

*Awaiting approval to execute.*
