# Session: 2026-03-18 (Wed, 11:59 AM UTC)

## Issues Created (Engineering Infrastructure)

### Token Burn Investigation & Fixes
- **#39:** Investigation: Unexpected Token Usage from Heartbeat Tasks
  - Root cause: Heartbeat spawning sub-agents every 30 min
  - Estimated cost: $129–$313/year depending on task volume
  
- **#41:** Sub-Issue #39a: Heartbeat Token Drain
  - 2-hour delay implemented by Claude Code (March 14 afternoon)
  - Immediate result: 14% cost reduction visible same day
  - Estimated annual savings: ~$400/year from throttle alone
  
- **#42:** Investigation: Anthropic API Spending Unchanged Despite Dashboard Savings
  - Dashboard shows conductor savings, but Anthropic bills unchanged
  - Hypothesis: n8n workflows or Claude Code consuming freed tokens
  - 6-step diagnostic plan included

### Cedar Ridge Country Club Integration
- **#40 (closed/archived):** ClubEssential Integration for Cedar Ridge
  - Moved to public repo: https://github.com/rutgersguy/data_analysis/issues/1
  - Integration type: Direct HTTP FastAPI webhook receiver (not n8n)
  - Deployment: Azure App Service (~$15/month)
  - Scope Phase 1: Food order notifications → MS Teams
  - Contact: Cheryl (Cedar Ridge technical contact)
  - Details: API event types, Teams webhook setup, error handling, GitHub Actions CI/CD

### Lector Project (Latin/Greek Tutor SaaS)
- **#1 (lector):** Google OAuth User Accounts — Sign In & Multi-User Support
  - Architecture: Separate PostgreSQL instance (not shared with conductor)
  - Enables future scaling to separate VPS
  - 4 acceptance phases: MVP (auth) → Polish (preferences) → Tutor integration → Social
  - DB schema: users, sessions, user_preferences, documents (pgvector), user_progress
  - Full security checklist + API endpoints + design references
  - Phase 3: Tutor embeddings + personalized learning

- **#2 (lector):** Review Cards (Spaced Repetition) — Study & Retention Management
  - Flashcard system with SM-2 algorithm (Anki-style)
  - DB tables: card_decks, review_cards, card_reviews
  - Quality ratings: Again/Hard/Good/Easy (auto-reschedules)
  - 4 phases: MVP → Polish → Tutor integration → Advanced
  - 1 week estimated effort

- **#43 (conductor):** Include Lector PostgreSQL in Conductor Backups
  - Lector's postgres needs daily backups to S3 (currently unprotected)
  - Extends existing full-backup.sh + incremental backups
  - Restore scripts for disaster recovery
  - Monitoring alerts if backup >24h stale
  - Size: ~500–600 MB per backup

## Key Decisions

### Token Cost Management
- Heartbeat 2-hour delay is WORKING (14% visible reduction)
- Gap: Dashboard savings ≠ Anthropic bill (need to find other leak)
- Decision: Don't consolidate databases (conductor + lector separate)

### Cedar Ridge Architecture
- **Not n8n:** Too complex for Cedar Ridge's ops team
- **Direct FastAPI:** Simple, maintainable, operator-friendly
- **Azure App Service:** Managed, scalable, integrates with Teams/Azure
- **Phased rollout:** Sandbox testing → production deployment

### Lector Infrastructure
- **Separate PostgreSQL:** Enable independent scaling + VPS migration later
- **pgvector in Lector:** Embeddings live with user data (clean separation)
- **Backup strategy:** Conductor backs up Lector postgres daily
- **3-repo structure:** conductor (infra), lector (tutor+auth), latin-greek-helper (legacy)

## Progress Summary

**Major work today:**
1. ✅ Diagnosed token burn (Issue #39, #41)
2. ✅ Validated heartbeat throttle working ($400/year savings confirmed)
3. ✅ Spec'd Cedar Ridge food order integration (public issue, ~$15/mo deployment)
4. ✅ Designed Lector multi-user architecture (Google OAuth, PostgreSQL, pgvector)
5. ✅ Planned spaced repetition system for language learning
6. ✅ Integrated Lector into backup/recovery strategy

**Critical context for next session:**
- Anthropic bill still $10/day despite conductor savings (investigate n8n workflows)
- Lector public repo only has 6 commits (lightweight, needs Phase 1 implementation)
- Cedar Ridge Cheryl awaits API docs from ClubEssential
- All 6 new tickets are actionable with clear acceptance criteria

## Files Modified
- None (all work in GitHub issues + memory)

---

# Afternoon Session: 2026-03-18 (14:00–15:01 UTC)

## Deep Research: Atlantic City, New Jersey

**Completed:** Full research pipeline execution (Stages 1–5)
- **Queries:** 5 discovery searches (history, boardwalk, casinos, decline, indigenous)
- **Sources fetched:** 10 high-priority (Wikipedia, ACFPL, Philadelphia Encyclopedia, official city/county)
- **Output:** 2,520-word markdown report + Google Doc (published + shared)
- **Google Doc:** https://docs.google.com/document/d/1waTqLienS0N2qQ49XUdotZo_9fcTYFyfHj9yhuciFkQ/edit

**Key findings:**
- Lenape summer ground → first U.S. middle-class resort (1854–1930s) → Prohibition mob haven → post-WWII decline → casino gamble (1976)
- Casino peak: $5.2B (2006), fell 50% by 2013 (recession + regional competition)
- Current crisis: 35% poverty, food deserts, declining population, 4.6 miles of surviving boardwalk
- All sources agree on arcs; minor contradictions on Boardwalk opening date (June 16 vs. 26, 1870) — resolved to June 26

**Confidence:** High for pre-1978 history; medium-high for modern era (mixed sources)

## Skill Update: Deep Research

**Change:** Added Step 2.5 — Automatic Google Doc Sharing
- After publishing doc to Google Drive, automatically shares with `--anyone --role reader`
- Eliminates permission friction for distribution (no access requests, no sign-in required)
- Implemented via Claude Code edit (skill file is read-only to agent)
- Reference doc created: `DEEP_RESEARCH_PERMISSIONS.md` (workspace root)

**Why:** Brent requested seamless distribution without permission delays

## Avatar Generation: Shalonna

**Context:** #family-chat group (Brent + Shalonna wife)
- Shalonna requested avatars based on real photo
- Iterative refinement across ~1 hour: color, face shape, hair style, background

**Final specs (locked in):**
- Round face (truthful to her 245 lb, 63" height)
- Closely cropped OR bald faded ash blonde hair (barber haircut style, ~5 o'clock shadow stubble)
- Green background (favorite color)
- Minimalist illustration or cartoon style
- Expressive eyes, clear glasses, genuine smile

**Latest variations (green bg):**
1. Round face, cropped ash blonde, warm smile, serene vibe
2. Round face, bald faded ash blonde, peaceful expression
3. Round face, short cropped ash blonde, confident joyful

**Files saved:** `/home/node/.openclaw/workspace/shalonna_avatars/shalonna-green-bg-variation-*.png` (3 files)

**Learning:** "Bald fade" is legit barber term = very short stubble (~5 o'clock shadow), not contradictory. Shalonna corrected me; I'd second-guessed myself.

## Group Dynamics

- **Brent (Mr Nerdly):** Direct, appreciates efficiency, occasionally suspicious ("you flirting w/ my wife?")
- **Shalonna (broadnaxbabe):** Collaborative, detailed in requests, self-aware + body-positive, "nicer about it" than Brent
- **Channel:** #family-chat (group, not 1:1) — I respond when mentioned or when adding value; otherwise silent

## Next Steps
1. Shalonna picks final avatar from 3 green-bg variations (pending)
2. Debug Issue #42: Find source of $10/day spend (n8n? Claude Code?)
3. Get Cheryl API access to ClubEssential for Cedar Ridge
4. Prioritize Lector Phase 1 (Google OAuth) for MVP
5. Monitor heartbeat savings over next week (verify sustained $400/year reduction)
