clawdbot-workspace/memory/lessons-learned.md
Jake Shore 5754cdb6cd Lean Memory Architecture: 60% system prompt reduction
- HEARTBEAT.md: 5,297 → 449 bytes (-92%) — current focus only, projects moved to memory/projects-active.md
- AGENTS.md: 7,869 → 1,603 bytes (-80%) — core rules only, MCP playbook moved to memory/playbook-mcp.md
- SOUL.md: 5,394 → 1,935 bytes (-64%) — same security, fewer words
- USER.md: 2,732 → 705 bytes (-74%) — collaborators moved to memory/contacts.md
- lessons-learned.md: 27,252 → 3,031 bytes (-89%) — hot universal rules only, rest in lessons-archive.md
- 2026-02-15.md: 24,675 → 2,453 bytes (-90%) — compressed, full version in archive/

Total injected tokens: ~5,700 → ~2,000 (65% reduction)
Research basis: Stanford 'Lost in the Middle', JetBrains context management study
2026-02-16 00:03:44 -05:00

55 lines
3.0 KiB
Markdown

# Lessons Learned (Hot — Universal Rules)
> Search this before repeating mistakes. Older/situational lessons in lessons-archive.md.
## Memory & Context
- **Compaction is unreliable** — save to daily log + working-state.md proactively, every ~15 messages. Don't wait.
- **After compaction with lost context:** Read working-state → daily log → channel history → memory search → ask Jake last.
- **Save decisions immediately** — all options AND the chosen one, right when the choice is made.
## Discord
- **Don't spam debug messages** — work silently, announce clean results.
- **Guild ID:** `1458233582404501547`. Channel IDs are different from guild IDs.
- **Delete messages containing tokens IMMEDIATELY.**
## Cloudflare / Tunnels
- **nohup your tunnels** — cloudflared dies when exec sessions close.
- **Verify before announcing** — curl the URL and confirm 200 before posting.
- **Workers need DNS** — proxied A record (use 192.0.2.1 dummy IP).
- **http2 > quic** for cloudflared tunnels.
- **Quick tunnels break HTML POST** — use fetch() for form submissions.
- **VPN breaks tunnels** — disconnect Mullvad before creating tunnels.
- **Never use quick tunnels for production** — use permanent named tunnels.
## Upwork
- **Upwork blocks off-platform comms** in proposals — NEVER mention Discord/email/phone before contract.
- **Rate increase field is REQUIRED** on proposals — select "Never."
- **Full workflow:** op signin → search by URL → browser navigate → DOM snapshots → fill form → submit. See lessons-archive.md #39 for full steps.
## 1Password / Auth
- **Search by URL** not title: `op item list --format json | jq ... test("SERVICENAME")`
- **Every op command triggers auth dialog** — run op in background, approve with Tab+Tab+Enter via Peekaboo.
## Computer Use
- **Right tool for the right layer:** Web → browser tool (DOM). Native apps → Peekaboo. System dialogs → AppleScript. CLI → exec. Creds → op.
- **Don't over-engineer** — see, click, type, verify. Don't reach for DevTools/CDP unless simple approach fails.
- **Browser DOM snapshots > screenshots** for web automation.
- **Don't ask Jake to do things I can do myself** — I have Peekaboo, 1Password CLI, browser tool, shell, AppleScript.
## Cron Jobs
- Format: `schedule: {kind: "cron", expr: "..."}`, `payload: {kind: "systemEvent", text: "..."}`
## Infrastructure
- **Gateway logs:** `/tmp/clawdbot/` not `~/.clawdbot/logs/`
- **tmux death kills auto-restart** — check `tmux list-sessions` when diagnosing downtime.
- **API tokens go in gateway config env.vars** via `config.patch`, not just .env files.
- **Never save secrets in memory/*.md** — use .env.local (gitignored).
## Image Gen
- **Jake's preferred style:** chibi/kawaii anime. Be VERY specific about appearance in first prompt.
## Sub-agents
- **Always verify output** — `find ... | wc -l`. Never trust the narrative.
- **Single-purpose > multi-purpose** — one clear deliverable per agent.
- **10min too short for full builds** — use 900s for full MCP servers, 600s for focused tasks.