# 2026-02-16 Memory

## Analytics Dashboard Build (with Jarrhey)

### What We Built
- Real-time event-driven analytics dashboard for Symph Agency
- Event store: `/home/aria/.openclaw/workspace/agency/events/events.jsonl` (append-only JSONL)
- Tracks: agent performance, product metrics, artifact status, first-pass rates

### Key Technical Decisions
- **Real-time only** - Jarrhey explicitly requested no backfilled historical data
- **Dual-write pattern** - `createReviewEvent()` writes to both Firebase (legacy) and event store
- **Agent grouping by type** - Metrics grouped by phase/agent type (design, build, market), not individual actors
- **First-pass calculation fix** - Changed from checking revision number on approval events to: `approvals - revision_requested events` (now shows accurate 95%)

### Bugs Fixed
1. `.toFixed()` on undefined - added null checks throughout analytics components
2. `queryEvents` → `readEvents` function name mismatch
3. Conflicting dynamic route slugs (`[runId]` vs `[run]`) - consolidated folders
4. First-pass rate was wrong - approvals with revision=undefined should count as first-pass

### Still Blocked
- **Learnings API bug**: `/api/analytics/learnings` only returns Feb 5-6 entries despite corrections.md having entries through Feb 16. Parsing issue suspected - need to investigate the date regex pattern.

### Event Types Implemented
`product.created`, `product.phase_started`, `product.phase_completed`, `artifact.approved`, `artifact.rejected`, `artifact.revision_requested`, `agent.job_started`, `agent.job_completed`, `payment.received`

### URLs
- Dashboard: https://symphony.symph.co/analytics
- Event store: `/home/aria/.openclaw/workspace/agency/events/events.jsonl`

---

## Behavioral Update (Jarrhey)

**Be proactive about confirmation.** After delivering any meaningful output (artifacts, code, designs, content), explicitly ask: "Is this good to go, or any changes needed?"

Why:
- Faster iteration — don't assume silence = approval
- Captures accept/revise signals for analytics naturally
- Better UX than passive delivery

---

## TIL
- When calculating "first-pass rate", don't rely on revision numbers embedded in approval events - count revision_requested events separately and subtract
- JSONL is great for append-only event logs - fast writes, easy grep, BigQuery-migratable
- Always check for undefined before calling `.toFixed()` in TypeScript

---

## Session 2: Dashboard Cleanup (Jarrhey)

### Key Decision
**Only 3 charts are accurate** - Per Jarrhey, most dashboard sections are tech debt showing inaccurate data:
- ✅ KEEP: Data Collection Status, Agency Objectives, By Phase, By Person
- ❌ REMOVE: Agent Performance table, Revenue, Product Revisions, Product Health, Learnings, Revision Depth, Time to Approval, Intervention Types

### What We Removed
1. "Revision Depth" section - was showing inaccurate revision chain data
2. "Time to Approval" section - no real timing data captured yet
3. "Intervention Types" section - not enough data to be meaningful

### What's Left to Remove
- Agent Performance table
- Revenue section
- Product Revisions/Health sections
- Learnings section

### Discord Feedback Automation
- Built automated scanner: `/home/aria/.openclaw/workspace/agency/scripts/scan-discord-feedback.mjs`
- Cron job runs every 5 min (ID: `e03a4075-8bf3-4cab-a98e-13350b2a8f04`)
- Scans 6 Discord channels for approval/revision feedback signals

### Time Filter Enhancement
- Added granular filters: Past hour, Past 24h (new default), 7d, 30d, 90d
- Changed default from 30d to 24h for real-time focus

### API Fix
- Next.js 14 can prerender API routes at build time (bad for dynamic data!)
- Fix: Add `export const dynamic = 'force-dynamic'` to API routes
