12 KiB
12 KiB
Chat-First Communications Manager — Phase 1 MVP Sprint Plan\n\nDate: 2026-06-15\nSource spec: 2026-06-15-comprehensive-product-spec.md (Sections IV, V, VI)\nStatus: DRAFT — ready for engineering sprint kickoff\nTarget: MVP launch by 2026-07-01 (3 weeks, 1 engineer full-time)\nRepo: hermes-mcp\nNote: This breaks Section VI "Phase 1: MVP" into a day-by-day backlog. ChatGPT/Claude store listing for this product does NOT happen at the end of this sprint — per spec Section VII.2, the Communications GPT ships only after pilot gates (Section VIII) are met. This sprint's exit criterion is "ready for Alex Ferrari + publisher pilot," not "deployed to ChatGPT."\n\n---\n\n## Pre-Sprint Checklist (Day 0)\n\n- [ ] Confirm hermes-mcp repo access and current branch state (check for uncommitted changes from the 2026-06-15 Living Brief docs work — those are unrelated and should not be touched)\n- [ ] Confirm Anthropic API key / Claude access is configured for server-side calls (Section V.4 — claude-3-5-sonnet-20241022)\n- [ ] Confirm existing platform credentials still valid: LinkedIn, Facebook, Instagram, SMTP (these were validated for Living Brief/v1-lite as of 2026-06-13)\n- [ ] Identify Alex Ferrari (mortgage broker) and the publisher pilot contact for Week 3 testing\n\n---\n\n## Week 1 — Data Model, Profiles, Onboarding, Chat Skeleton\n\nGoal: A user can complete onboarding and reach a working (even if unstyled) chat endpoint that echoes back a structured response.\n\n### 1.1 Database migrations (Section V.1)\n- [ ] Create chat_sessions, chat_messages, drafts, posts, user_content_examples, business_profiles tables\n- [ ] Add autonomous_mode_enabled and approved_posts_count columns to users\n- [ ] Write migration scripts + rollback scripts\n- Files: new migration file(s) in repo's migration directory\n- Schema reference: full table definitions are in the comprehensive spec, Section V.1 — copy column definitions directly from there rather than re-deriving\n- Acceptance: migrations run cleanly against staging DB; rollback verified\n\n### 1.2 Business profile API (Section IV.2, V.2)\n- [ ] GET /api/communications/profile\n- [ ] PUT /api/communications/profile\n- [ ] GET /api/communications/examples — list a user's user_content_examples (simple read, no filtering logic yet; useful for debugging the Week 3 learning loop)\n- [ ] Vertical-specific field validation: mortgage broker (NMLS number, states licensed, disclaimer text), publisher (book titles, audience, genres)\n- Files: src/communications.ts (new), route registration in src/index.ts\n- Acceptance: profile create/update round-trips correctly for both verticals; GET /examples returns [] for a new user and populated rows after Week 2 approvals\n\n### 1.3 Onboarding generation endpoint (Section IV.2 step 2-3)\n- [ ] POST /api/communications/profile/generate-onboarding — given a business profile, return vertical-aware prompt chips\n- Acceptance: mortgage broker profile returns the 5 chips listed in spec (rate update, new listing, market commentary, testimonial request, refi education); publisher returns its 5 chips\n\n### 1.4 Chat session skeleton (Section V.1, V.2)\n- [ ] POST /api/communications/chat — create/append to chat_sessions + chat_messages, but generation logic stubbed (Week 2)\n- Files: src/chat.ts (new)\n- Acceptance: session persists across calls; message history retrievable\n\nWeek 1 exit criteria: profile + onboarding + chat session plumbing works end-to-end with stubbed generation responses.\n\n---\n\n## Week 2 — Multi-Platform Generation, Draft Management, Approval & Publishing\n\nGoal: User can generate real multi-platform drafts, edit/regenerate them, approve, and have them actually post.\n\n### 2.1 Claude generation integration (Section IV.5, V.4)\n- [ ] Implement system prompt assembly: business profile + vertical constraints + (empty) style examples\n- [ ] Call Claude (claude-3-5-sonnet-20241022), parse JSON response into {linkedin, facebook, instagram: {caption, hashtags}, email: {subject, body}}\n- [ ] Persist each platform variant as a row in drafts (status pending)\n- [ ] Generate all enabled platforms in parallel; partial failure on one platform doesn't block others\n- Files: src/chat.ts, src/communications.ts\n- Acceptance: a single prompt produces drafts for all enabled platforms; a forced failure on one platform doesn't prevent the others from completing\n\n### 2.2 NMLS / vertical compliance injection (Section IV.5)\n- [ ] Detect rate/loan/APR/financial-advice keywords in mortgage broker drafts; append NMLS disclaimer from business_profiles.nmls_disclaimer_text\n- [ ] Publisher: avoid spoilers unless requested, ensure CTA present (best-effort prompt instruction, not hard validation)\n- Acceptance: 100% of generated mortgage-broker drafts mentioning rates/loans/APR include the disclaimer (this is a Section VIII launch gate — test it now)\n\n### 2.3 Draft management endpoints (Section V.2)\n- [ ] GET /api/communications/drafts/:draft_id\n- [ ] POST /api/communications/drafts/:draft_id/regenerate — regenerate single platform, increment regeneration_count\n- [ ] POST /api/communications/drafts/:draft_id/reject\n- Acceptance: regenerate replaces only the targeted platform's draft; reject marks status without publishing\n\n### 2.4 Approval & publish (Section IV.6, V.2, V.5)\n- [ ] POST /api/communications/drafts/:draft_id/approve — on approve, call the existing platform connectors:\n - LinkedIn: POST /v2/ugcPosts via existing OAuth credential lookup\n - Facebook: POST /{page_id}/feed (reuse src/tools.ts Facebook connector)\n - Instagram: POST /{ig_user_id}/media → POST /{media_id}/caption (requires image URL from user)\n - Email: reuse smtp.ts, send to business_profiles-configured recipient list\n- [ ] On success: insert into posts with platform_post_id; update drafts.status = 'published'\n- [ ] On per-platform failure: record error_message on that platform's row, leave others unaffected; return per-platform status to caller (e.g. "Posted to LinkedIn, Facebook. Instagram failed (invalid credentials).")\n- [ ] On any successful approval: insert into user_content_examples (Section IV.7) — table only, no weighting logic yet\n- Acceptance: approving a draft with one intentionally-broken platform credential posts successfully to the other platforms and returns a clear per-platform error for the broken one\n\nWeek 2 exit criteria: end-to-end "generate → review → approve → published, with errors isolated per platform" works for all four v1 platforms (LinkedIn, Facebook, Instagram, Email).\n\n---\n\n## Week 3 — Chat UI, Learning Loop, Hardening, Pilot Prep\n\nGoal: A non-technical user (Alex Ferrari / publisher) can complete the full flow in the browser without engineering help.\n\n### 3.1 Chat interface (Section IV.3, V.3 — React SPA at app.squaremcp.com)\n- [ ] Left panel: conversation history from chat_sessions/chat_messages\n- [ ] Right panel: per-platform draft preview tabs (LinkedIn/Facebook/Instagram/Email), each with text + edit box + "Regenerate this platform"\n- [ ] Bottom bar: prompt input + vertical-aware suggestion chips + "Generate" / "Approve & post all" buttons\n- [ ] Per-platform toggle before approval (don't post to a platform if toggled off)\n- Acceptance: Section 4.1 user flow (sign up → onboarding → prompt → review → approve → post) completes in the UI without using API tools directly\n\n### 3.2 Onboarding flow (Section IV.2)\n- [ ] Business profile form UI (vertical dropdown → conditional fields)\n- [ ] First-prompt chip selection → triggers first generation\n- [ ] Success state after first approved post\n- Acceptance criterion to hit: "user reaches their first approved post in under 5 minutes without coaching" — dry-run this with an internal tester before the real pilot\n\n### 3.3 Learning loop activation (Section IV.7)\n- [ ] On generation, query last 3 user_content_examples per platform for the user and inject into system prompt as style examples\n- Acceptance: after 1 approved post on a platform, the next generation's system prompt includes that approved text (verify via logging, not necessarily visible output diff)\n\n### 3.4 Hardening / error states\n- [ ] Surface partial-failure messaging in UI (per Section IV.6 example copy)\n- [ ] Basic input validation on profile and chat endpoints\n- [ ] Smoke test: full flow for both mortgage-broker and publisher verticals\n\n### 3.5 Pilot kickoff (Section II, VIII)\n- [ ] Onboard Alex Ferrari (Lodge Brothers) with mortgage broker profile\n- [ ] Onboard publisher pilot contact\n- [ ] Track against Section VIII pilot gates: 1 week of content in <15 min, weekly rate-update usage, 10+ approvals → autonomous toggle appears\n\nWeek 3 exit criteria: both pilot users can independently complete the core flow; Section VIII pilot-gate tracking is in place.\n\n---\n\n## Explicitly Out of Scope for This Sprint (per spec Section VI)\n\n- Scheduling (scheduled_posts, Phase 1.1)\n- Autonomous mode publishing (Phase 1.2) — only the approved_posts_count increment and toggle visibility condition are in scope; actual autonomous publishing is not\n- Image upload for Instagram (v1 uses user-provided URL only)\n- WhatsApp, TikTok, Discord\n- Analytics, content calendar, billing\n- Any ChatGPT/Claude GPT Store listing for this product — blocked on pilot gates per Section VII.2\n\n---\n\n## Dependencies & Risks\n\n- Reuses Living Brief/v1-lite infrastructure: OAuth credential storage, src/tools.ts platform connectors, smtp.ts. If those were modified by the unrelated 2026-06-15 working-tree changes (src/oauth.ts, src/manifest.ts, etc. — currently uncommitted per the docs deployment note), confirm they don't conflict before starting Week 2.\n- Claude API cost: spec flags ~2000 tokens/generation; with 10 generations/hour/user rate limit, monitor usage from Day 1 of Week 2 to validate the $99/month Pro tier economics (Section V.4, VII.3).\n- Instagram posting requires an image URL from the user — UI must make this requirement clear during onboarding, or Instagram drafts will be perpetually blocked.\n\n---\n\n## Definition of Done for Phase 1 (maps to Section VI Phase 1 scope)\n\n- [x] Business profile form (mortgage broker + publisher fields) — Week 1\n- [x] Chat interface (React SPA) — Week 3\n- [x] Multi-platform draft generation (LinkedIn, Facebook, Instagram, Email) — Week 2\n- [x] Approval workflow (Approve & post all) — Week 2\n- [x] Publishing via existing platform APIs — Week 2\n- [x] NMLS compliance injection — Week 2\n- [x] user_content_examples table + basic learning — Week 1 (table), Week 3 (loop)\n- [x] Pilot testing with Alex Ferrari + one publisher — Week 3\n\nNext step after this sprint: re-read Section VIII pilot gates against actual pilot results before scoping Phase 1.1 (Quality & Trust) or any ChatGPT GPT Store work.\n\n---\n\n## Changelog\n- 2026-06-15: Verified against spec Section V.2/VI; added GET /api/communications/examples to Week 1.2 (was missing from initial draft).\n
Related: Engineering Design Doc
→ 2026-06-15-phase1-engineering-design.md — implementable schema (DDL with FKs/indexes), API request/response contracts, generation pipeline design (per-platform parallel Claude calls instead of one multi-platform JSON blob, to satisfy 2.1's partial-failure requirement), and the approve/publish sequence. Read this alongside the week-by-week tasks above; it also lists open items to confirm before Week 1 (e.g. users PK type, pgcrypto availability).