# LEARNINGS.md - Rules from Mistakes

> "Every mistake the agent makes should become a one-line rule." — Ramya

This file contains distilled rules from mistakes and lessons learned. Read this before starting tasks.

---

## General Rules

1. **Always check task status before working** — Update to 'in-progress' in Gantt Board before starting
2. **Never claim code is pushed without checking git status** — Always verify with `git status` and `git log`
3. **Verify API endpoints work before marking complete** — Test with curl or browser, don't assume
4. **Confirm user's timezone before scheduling** — CST (America/Chicago) is default, but always verify
5. **Don't read full MEMORY.md in group chats** — SECURITY RISK: Contains personal context

---

## Git & Commit Rules

6. **Switch git identity based on project owner** — OpenClaw projects vs User projects have different authors
7. **Check current identity before committing** — Run `git config user.name && git config user.email`
8. **Use 'trash' > 'rm'** — Recoverable beats gone forever
9. **Never push to main without review** — Use branches for significant changes

---

## Task Management Rules

10. **Write to disk after EVERY task** — Log to memory/YYYY-MM-DD.md before saying "done"
11. **If mistake made → append to LEARNINGS.md** — Document root cause and prevention
12. **Update task status to 'review' when complete** — Don't leave tasks in 'in-progress'
13. **Check Gantt Board before saying tasks are done** — Verify data appears correctly

---

## Memory & Context Rules

14. **Run `/context detail` regularly** — Check for token bloat monthly
15. **Write discipline > Read discipline** — Information exists ≠ Agent uses it
16. **Daily logs = raw append-only** — MEMORY.md = curated (updated during heartbeats only)
17. **Don't let MEMORY.md become a dumping ground** — Move reference docs to docs/ folder
18. **Plant marker before testing retrieval** — Use specific test phrases to verify memory works

---

## Development Rules

19. **All web apps must be responsive** — Mobile-first, no exceptions (320px → 1440px)
20. **Use w-[95vw] max-w-lg for dialogs** — Never fixed widths
21. **Stack forms on mobile** — flex-col mobile, sm:flex-row desktop
22. **Test 320px, 768px, 1440px before "done"** — Verify responsive breakpoints
23. **Check browser console for errors** — Don't ignore warnings

---

## Tool Usage Rules

24. **Check TOOLS.md for credentials first** — Don't ask for URLs/keys that are already documented
25. **Use skills when available** — Don't reinvent the wheel
26. **Ask before destructive operations** — When in doubt, ask

---

## Communication Rules

27. **React like a human in group chats** — Use emoji reactions to acknowledge without interrupting
28. **Quality > Quantity** — Don't respond to every message
29. **One reaction per message max** — Pick the best fit
30. **Know when to speak** — Only respond when adding genuine value

---

## Project-Specific Rules

### Gantt Board
31. **Use correct Supabase URL** — https://qnatchrjlpehiijwtreh.supabase.co
32. **Verify task appears in UI before marking done** — Don't trust API response alone

### Mission Control
33. **Phases build on each other** — Don't skip foundational phases
34. **Document architecture decisions** — Write to BRAIN.md for complex choices

### Daily Digest
35. **Generate at consistent time** — Morning generation preferred
36. **Include source links** — Every summary needs attribution

---

## Emergency Recovery

**If session crashes or context is lost:**
1. Read memory/YYYY-MM-DD.md for today's work
2. Check BRAIN.md for active projects and decisions
3. Review LEARNINGS.md for relevant rules
4. Look at HEARTBEAT.md for pending checks

---

## How to Add New Rules

When you make a mistake:
1. Document what went wrong
2. Identify root cause
3. Write prevention rule here (one line)
4. Add to appropriate section above

**Format:**
```
## [Category] Rules

[N]. **[Rule name]** — [Specific prevention action]
```

---

*Last Updated: 2026-02-22*
*Next Review: During heartbeat check*
