---
created: 2026-03-12
source: CC-VPS
tags: [agent-archive, cc-vps]
---

# CC Local Memory

## Learnings
- WSL cron doesn't work on this machine - use Windows Task Scheduler instead
- Git Bash path format: `/c/Users/mclou/...` (not `/mnt/c/...`)
- Use `--autostash` with `git pull --rebase` to handle uncommitted local changes
- Curator auto-commits its own changes when it detects updates to .cc-local/
- Node app uses `dotenv` — reads `.env` from project root, NOT `config.env`
- `cc-poll` needed manual edit to source `config.env` (env vars weren't available to Claude tasks)
- Supabase `job_locks` table has RLS: only `service_role` key can write, anon key is read-only
- Supabase anon key in frontend build artifacts (`public/assets/`) is expected — it's a client-side key
- Secrets were scattered across 6 tracked doc files — always check before committing docs with env examples
- Daemons/services start with clean env — they don't inherit shell vars, must explicitly source config files
- Always verify the full chain: credentials on disk → process can load them → API call actually works
- Docs and setup guides are the #1 place real keys accidentally get committed
- Heredoc-over-SSH can mangle shebangs (`#\!` instead of `#!`) — always verify first line with `xxd`
- cc-poll now uses inotifywait (not sleep 60) — reacts to INBOX writes in <1s
- VPS timezone is Australia/Sydney (AEDT/AEST) — cron jobs now fire in local time
- inotifywait e2e test: task dropped → picked up instantly → Claude executed → OUTBOX written in ~23s total

## VPS State
- SSH working: `ssh root@134.199.153.159`
- Timezone: Australia/Sydney (AEDT/AEST)
- Services: clawdbot-gateway, cc-poll (inotifywait mode)
- Repo: /home/ccuser/rateright-growth
- Credentials: `/home/ccuser/config.env` (shell scripts) + `/home/ccuser/rateright-growth/.env` (Node/dotenv)
- Both `.env` and `config.env` are gitignored
- cc-poll backup: `/usr/local/bin/cc-poll.bak` (pre-inotifywait version)

## Fixes Applied
- 2026-02-03: Created curator script with daily health checks
- 2026-02-03: Set up Windows Task Scheduler for 6am daily runs
- 2026-02-03: Created .sessions/ folder (LOCAL.md, VPS.md, CLAWDBOT.md)

---

## Completed: Supabase Finalization (2026-02-03)

### What Was Done
- `job_locks` migration already applied via SQL editor (by user)
- Supabase credentials stored on VPS:
  - `SUPABASE_URL`, `SUPABASE_ANON_KEY` were already in `/home/ccuser/config.env`
  - Added `SUPABASE_SERVICE_ROLE_KEY` to `config.env`
  - Created `/home/ccuser/rateright-growth/.env` with all 3 vars (for Node.js dotenv)
  - Set `.env` permissions to 600, owner ccuser
- Verified `job_locks` table via REST API from VPS: SELECT, INSERT, DELETE all work with service role key
- Patched `/usr/local/bin/cc-poll` to `source /home/ccuser/config.env` so CC VPS tasks have access to all credentials (Supabase, Notion, etc.)
- Restarted cc-poll service

### Key Architecture
- `src/config/database.js` creates two Supabase clients: `supabase` (anon) and `supabaseAdmin` (service role)
- `src/services/jobLocking.js` uses admin client to bypass RLS on `job_locks`
- `src/jobs/index.js` wraps sequence processor in `runJobWithLock()` to prevent duplicate SMS sends
- RLS policy: only `service_role` can access `job_locks` table

### Status: Complete
- CC VPS can read/write Supabase (verified with INSERT + DELETE test)

---

## Completed: VPS Cleanup (2026-02-03)

### What Was Deleted
- `/root/clawd/` — old bloated brain (3760 lines), backup at `/root/clawd-backup-20260203.tar.gz`
- `/home/ccuser/.clawdbot/` — duplicate clawdbot config, nothing used it
- `/home/ccuser/rateright-growth/.memdb/` — stale 60KB memory DB, nothing referenced it

### Cron Jobs Removed (3)
- `strategic-coo-enhanced.sh` (hourly) — COO analysis, overlapped with rivet
- `task-monitor-10min.sh` (every 5min) — was spamming INBOX with stale task reminders
- `script-monitor.sh` (every 15min) — just ran `bash -n` syntax checks, low value

### Remaining Crons (6)
| Script | Frequency | Purpose |
|--------|-----------|---------|
| rivet.sh health-check | 5 min | Growth Engine + CC health |
| rivet.sh morning-brief | Daily 6:30am AEST | Morning report |
| rivet.sh evening-brief | Daily 6:00pm AEST | Evening report |
| rivet.sh sync | 30 min | Git backup |
| curator-bot-main.sh | Daily 2am UTC | Knowledge management |
| cc-vps-auto-sync.sh | 15 min | CC memory sync |

### Status: Complete

---

## Completed: Secret Scrub (2026-02-03)

### What Was Done
- Found real secrets (Notion token, Supabase anon key) hardcoded in 6 tracked doc files
- Replaced with redacted placeholders (`NOTION_API_KEY_REDACTED`, `$SUPABASE_ANON_KEY (see config.env)`)
- Committed and pushed: `8812467 security: scrub hardcoded secrets from tracked docs`

### Files Scrubbed
- `docs/clawdbot-env-template.md` — Notion token
- `docs/clawdbot-notion-skill.md` — Notion token
- `docs/plans/notion-integration-plan.md` — Notion token (2 locations)
- `docs/RAILWAY-FIX-INSTRUCTIONS.md` — Supabase anon key
- `docs/LESSONS.md` — Supabase anon key
- `docs/SYSTEM-INTEL.md` — Supabase anon key

### Note
- Secrets still exist in git history (private repo, low risk)
- If repo ever goes public: rotate Notion token + run `git filter-repo`
- Git remote URL also contains a GitHub PAT in plaintext (`ghp_...`)

### Status: Complete

---

## Completed: cc-poll inotifywait upgrade (2026-02-03)

### What Was Done
- Replaced `sleep 60` in `/usr/local/bin/cc-poll` with `inotifywait -e modify,create -t 120`
- Local INBOX writes now wake cc-poll in <1s (was up to 60s)
- 120s timeout fallback ensures git pull still catches remote-pushed tasks
- Added SHARED-MEMORY.md read into task context (CC VPS now gets cross-agent knowledge per task)
- Installed `inotify-tools` on VPS
- Backup at `/usr/local/bin/cc-poll.bak`

### Gotcha
- Heredoc over SSH can mangle shebangs (`#\!/bin/bash` instead of `#!/bin/bash`) — always verify with `xxd` or `head -1`

### Rollback
```bash
cp /usr/local/bin/cc-poll.bak /usr/local/bin/cc-poll && systemctl restart cc-poll
```

### E2E Test Result
- Dropped PENDING task at 06:20:55 → cc-poll picked up instantly → Claude executed → OUTBOX written at 06:21:18 (23s total)
- Changed VPS timezone to Australia/Sydney (was UTC)

### Status: Complete

---

## Completed: CC VPS Memory System (2026-02-03)

### What Was Done
- Created `.cc-vps/MEMORY.md` - VPS-specific learnings
- Created `.cc-vps/SESSIONS.md` - VPS session history
- Created `.cc-vps/cc-vps-auto-sync.sh` - Auto-sync every 5 min
- Added cron job on VPS (as root) for auto-sync
- Updated .gitignore for `.cc-vps/.curator-state/`
- Verified: VPS auto-sync commits and pushes work correctly

### Status: Complete
- VPS CLAUDE.md deployed with memory instructions
- Verified on VPS: 2026-02-03

---

## Completed: Task Monitor v2 + Shared Memory (2026-02-03)

### What Was Done
- Created `scripts/task-monitor-v2.sh` — replaces old spammy monitor
  - Per-task state in `.task-monitor/state.json` via jq
  - Max 3 alerts per task (gentle 10m, escalation 20m, Telegram 30m)
  - Respects BLOCKED status, resets on OUTBOX activity, clears on DONE
- Created `.claude/SHARED-MEMORY.md` — shared scratchpad for all agents
- Fixed `.cc-vps/` permissions (root→ccuser) so CC VPS can write to its memory
- Cleaned INBOX.md — stripped 78 old REMINDER blocks (827→205 lines)
- Deployed on VPS: cron running, test passed
- Updated all agent instruction files (CLAUDE.md, SYSTEM.md) to reference SHARED-MEMORY.md
- Updated all agent memory files (MEMORY.md) with learnings

### Status: Complete
