Wire live data + first agent + GSC handoff spec (#3)
End-to-end cross-property write loop is now real: marketing-bot's gda/gsc-refresh agent can POST drafts to GDA's new /api/internal/drafts endpoint. Smoke-tested against production — draft drf_o9tr6xaw
End-to-end cross-property write loop is now real: marketing-bot's gda/gsc-refresh agent can POST drafts to GDA's new /api/internal/drafts endpoint. Smoke-tested against production — draft drf_o9tr6xaw created, preview URL renders fact block correctly, live page does not leak the draft, robots.txt has Disallow: /*?*draft=.
What's new:
- agents/gda/gsc-refresh/CLAUDE.md: agent memory file (voice, audience,
CMS endpoints, what's been tried)
- agents/gda/gsc-refresh/draftPoster.js: real POST client for GDA
/api/internal/drafts (X-Internal-Auth, accepts snake_case or camelCase keys, surfaces 404/401/409 distinctly)
- agents/gda/gsc-refresh/agent.js: agent entry point with --dry-run,
--production, --mock flags; mock opportunity baked in until GSC source is wired
- specs/gda-gsc-snapshot-endpoint-handoff.md: paste-ready brief for
GDA to add /api/internal/gsc/snapshots + /aggregates endpoints (the READ side that pairs with the just-shipped WRITE side)
Live data wiring:
- api/analytics/trials.js: resolveMetricSource() attaches
metric_source { source, status, label, reason } to every trial so the dashboard can show "needs GSC" badges instead of blank cells. Summary now includes source_status_counts rollup.
- experiments.html: GDA Live Signals card with 4 sparklines (sessions,
users, signups, emails_sent) backed by the existing /api/analytics/xmr endpoint. Data Sources Health panel shows per-source wired/stubbed counts with explanations. Observed column shows source-status badges instead of blank cells (tooltips explain what's needed).
What's now visible at http://marketing.imprevista.com/experiments.html:
- 4 live sparklines at top (assuming env vars now picked up by container
after redeploy)
- Data Sources Health row showing: gsc stubbed (6 trials),
reddit stubbed (2), ai-referrals stubbed (1)
- Per-row "needs GSC" badge in Observed column for the 6 GSC-dependent
trials
- The 2 PropertyTesting trials (year fix + JSON-LD) and 7 Upcoming
experiments remain visible as before
What's still gated:
- GSC integration (waiting on
specs/gda-gsc-snapshot-endpoint-handoff.md implementation, ~2-4h on GDA side)
- Reddit posting (no client built yet)
- AI referral GA4 channel grouping (not configured)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>