fraim-framework 2.0.30 → 2.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/src/cli/commands/init.js +29 -2
  2. package/dist/src/cli/commands/sync.js +18 -1
  3. package/dist/src/utils/script-sync-utils.js +218 -0
  4. package/dist/tests/debug-tools.js +6 -5
  5. package/dist/tests/test-chalk-regression.js +58 -8
  6. package/dist/tests/test-cli.js +70 -5
  7. package/dist/tests/test-end-to-end-hybrid-validation.js +349 -0
  8. package/dist/tests/test-first-run-journey.js +43 -3
  9. package/dist/tests/test-hybrid-script-execution.js +369 -0
  10. package/dist/tests/test-mcp-connection.js +2 -2
  11. package/dist/tests/test-mcp-issue-integration.js +12 -4
  12. package/dist/tests/test-mcp-lifecycle-methods.js +4 -4
  13. package/dist/tests/test-node-compatibility.js +24 -2
  14. package/dist/tests/test-prep-issue.js +4 -1
  15. package/dist/tests/test-script-location-independence.js +173 -0
  16. package/dist/tests/test-script-sync.js +557 -0
  17. package/dist/tests/test-session-rehydration.js +2 -2
  18. package/dist/tests/test-standalone.js +3 -3
  19. package/dist/tests/test-sync-version-update.js +1 -1
  20. package/dist/tests/test-telemetry.js +2 -2
  21. package/dist/tests/test-user-journey.js +8 -4
  22. package/dist/tests/test-utils.js +13 -0
  23. package/dist/tests/test-wizard.js +2 -2
  24. package/package.json +3 -3
  25. package/registry/rules/agent-testing-guidelines.md +502 -502
  26. package/registry/rules/ephemeral-execution.md +37 -27
  27. package/registry/rules/local-development.md +253 -251
  28. package/registry/rules/successful-debugging-patterns.md +491 -482
  29. package/registry/scripts/prep-issue.sh +468 -468
  30. package/registry/workflows/bootstrap/evaluate-code-quality.md +8 -2
  31. package/registry/workflows/bootstrap/verify-test-coverage.md +8 -2
  32. package/registry/workflows/customer-development/thank-customers.md +203 -193
  33. package/registry/workflows/customer-development/weekly-newsletter.md +366 -362
  34. package/registry/workflows/performance/analyze-performance.md +65 -63
  35. package/registry/workflows/product-building/implement.md +6 -2
  36. package/registry/workflows/product-building/prep-issue.md +11 -24
  37. package/registry/workflows/product-building/resolve.md +5 -1
  38. package/registry/workflows/replicate/replicate-discovery.md +336 -0
  39. package/registry/workflows/replicate/replicate-to-issues.md +319 -0
  40. package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +632 -632
  41. package/.windsurf/rules/windsurf-rules.md +0 -7
  42. package/.windsurf/workflows/resolve-issue.md +0 -6
  43. package/.windsurf/workflows/retrospect.md +0 -6
  44. package/.windsurf/workflows/start-design.md +0 -6
  45. package/.windsurf/workflows/start-impl.md +0 -6
  46. package/.windsurf/workflows/start-spec.md +0 -6
  47. package/.windsurf/workflows/start-tests.md +0 -6
  48. package/bin/fraim.js +0 -23
  49. package/registry/scripts/build-scripts-generator.ts +0 -216
  50. package/registry/scripts/cleanup-branch.ts +0 -303
  51. package/registry/scripts/fraim-config.ts +0 -63
  52. package/registry/scripts/generate-engagement-emails.ts +0 -744
  53. package/registry/scripts/generic-issues-api.ts +0 -110
  54. package/registry/scripts/newsletter-helpers.ts +0 -874
  55. package/registry/scripts/openapi-generator.ts +0 -695
  56. package/registry/scripts/performance/profile-server.ts +0 -370
  57. package/registry/scripts/run-thank-you-workflow.ts +0 -122
  58. package/registry/scripts/send-newsletter-simple.ts +0 -104
  59. package/registry/scripts/send-thank-you-emails.ts +0 -57
  60. package/registry/workflows/replicate/re-implementation-strategy.md +0 -226
  61. package/registry/workflows/replicate/use-case-extraction.md +0 -135
  62. package/registry/workflows/replicate/visual-analysis.md +0 -154
  63. package/registry/workflows/replicate/website-discovery-analysis.md +0 -231
  64. package/sample_package.json +0 -18
  65. /package/registry/scripts/{replicate/comprehensive-explorer.py → comprehensive-explorer.py} +0 -0
  66. /package/registry/scripts/{replicate/interactive-explorer.py → interactive-explorer.py} +0 -0
  67. /package/registry/scripts/{replicate/scrape-site.py → scrape-site.py} +0 -0
@@ -1,362 +1,366 @@
1
- # Weekly Newsletter Workflow
2
-
3
- ## INTENT
4
- To generate and distribute a compelling weekly newsletter that showcases the AI Agent's amazing new features and improvements, creating excitement among current users and FOMO for subscribers who haven't joined yet.
5
-
6
- ## PRINCIPLES
7
- - **Value-Focused**: Highlight features and improvements that deliver real value to users
8
- - **User-Facing Only**: Do NOT include internal features (admin dashboards, monitoring, backups, devops)
9
- - **Authentic Testimonials**: Only use real testimonials from actual users - NO fake quotes
10
- - **FOMO-Inducing**: Create urgency and excitement about missing out
11
- - **Visually Stunning**: Beautiful design that catches the eye
12
- - **Concise**: Scannable format with clear sections
13
- - **AI Creativity**: AI agent makes all editorial decisions - what's a feature vs bug, what's worth highlighting
14
-
15
- ## WORKFLOW TRIGGER
16
- **User triggers this workflow manually**:
17
- - Weekly, typically Monday morning
18
- - User says: "Generate this week's newsletter" or similar
19
-
20
- ## AI AGENT PROCESS
21
-
22
- ### Step 1: Issue Retrieval
23
- **AI Agent calls function**:
24
- ```typescript
25
- // 1. Fetch the helper script
26
- const scriptContent = await get_fraim_file({ path: "scripts/newsletter-helpers.ts" });
27
-
28
- // 2. Save it to a temporary file (e.g. machine temp dir)
29
- const os = require('os');
30
- const path = require('path');
31
- const tempScriptPath = path.join(os.tmpdir(), 'newsletter-helpers.ts');
32
- const fs = require('fs');
33
- fs.writeFileSync(tempScriptPath, scriptContent);
34
-
35
- // 3. Import from the temporary file
36
- const { getResolvedIssuesForNewsletter } = await import(tempScriptPath);
37
-
38
- // 4. Use the function
39
- const resolvedIssues = await getResolvedIssuesForNewsletter();
40
- ```
41
-
42
- **Note**: The `getResolvedIssuesForNewsletter()` function automatically:
43
- - Finds the most recent newsletter date from existing files
44
- - Uses that date as the starting point to fetch issues resolved AFTER that date
45
- - If no newsletter files exist, falls back to last 7 days
46
- - Returns ALL closed issues - AI agent decides what to include
47
-
48
- ### Step 2: Intelligent Categorization & Filtering
49
- **AI Agent does creative analysis**:
50
-
51
- 1. **Go through each resolved issue** and make editorial decisions:
52
- - Is this user-facing or internal?
53
- - Is this a feature, improvement, or bug fix?
54
- - Is this worth highlighting to users?
55
- - How should this be described to non-technical users?
56
-
57
- 2. **Filter out internal-only issues**:
58
- - Admin dashboards, monitoring, analytics (internal tools)
59
- - Database backups, devops improvements
60
- - CI/CD, deployment automation
61
- - Developer tools, debugging features
62
- - Documentation updates, dependency updates
63
- - **API route fixes, endpoint refactoring, code structure changes**
64
- - **Environment variable updates, configuration file changes**
65
- - **Developer setup improvements, build process updates**
66
- - **Internal bug fixes that don't impact user experience**
67
- - Any change without user-facing impact
68
-
69
- 3. **Categorize remaining issues**:
70
- - **Features**: Adds NEW capability users didn't have before
71
- - **Improvements**: Makes existing functionality better/faster/easier
72
- - **Bug Fixes**: Fixes something that was broken
73
-
74
- 4. **Select hero feature** (optional):
75
- - Pick the MOST impactful feature or improvement
76
- - Must have clear user value and ideally a quantifiable impact statement
77
-
78
- ### Step 3: Write Compelling Content
79
- **AI Agent writes newsletter content** - be creative, exciting, and user-focused!
80
-
81
- **Guidelines**:
82
- - **NO TECHNICAL JARGON**: Don't mention internal systems, code, or technical details
83
- - **USER VALUE FOCUS**: Describe what the user can now do, not how it works
84
- - **ACTIVE, EXCITING LANGUAGE**: "You can now...", "The AI Agent now automatically...", "Your calendar finally..."
85
- - **QUANTIFY IMPACT**: "85% reduction in...", "5 hours saved per week", "3x faster"
86
- - **CREATE FOMO**: "Current users are already...", "Join 500+ executives who..."
87
-
88
- **For each item, write**:
89
- - **Title**: Short, benefit-focused (e.g., "Smart Timezone Detection" not "Implement timezone handling")
90
- - **Description**: What the user can do now, why it matters (2-3 sentences)
91
- - **Impact** (optional): Quantified benefit or user testimonial
92
-
93
- **Example**:
94
- ```json
95
- {
96
- "title": "Work Hours & Focus Blocks on Your Calendar",
97
- "description": "Your work hours and focus blocks now automatically appear as visual blocks on your calendar! No more scheduling conflicts during your protected time. The AI creates beautiful calendar events that sync across all your devices, making it crystal clear when you're available and when you're in deep work mode.",
98
- "impact": "Users report 85% reduction in meeting conflicts during focus time. Your calendar finally shows the complete picture of your day!"
99
- }
100
- ```
101
-
102
- ### Step 4: Generate Newsletter JSON
103
- **AI Agent creates ONE file**:
104
- - File: `docs/customer-development/newsletters/newsletter-YYYY-MM-DD.json`
105
- - Format: Structured JSON for deterministic rendering
106
- - Contains ALL content ready for user review
107
-
108
- **File format** (JSON):
109
- ```json
110
- {
111
- "metadata": {
112
- "generatedOn": "2025-11-01T00:00:00.000Z",
113
- "weekStart": "2025-10-25",
114
- "weekEnd": "2025-11-01",
115
- ...
116
- },
117
- "content": {
118
- "weekTitle": "Work Hours & Focus Blocks Now on Your Calendar! 🎯",
119
- "weekSubtitle": "8 powerful updates that supercharge your productivity",
120
- "weekDate": "Oct 25 - Nov 1, 2025",
121
- "openingMessage": "This week has been HUGE! We've shipped game-changing features that make the AI Agent even more powerful at protecting your time and managing your schedule. Current users are already saving hours every week - here's what you've been missing! 🚀",
122
- "heroFeature": { ... },
123
- "newFeatures": [ ... ],
124
- "improvements": [ ... ],
125
- "bugFixes": [ ... ],
126
- "testimonial": {
127
- "text": "The AI saved me 5 hours this week just by protecting my focus blocks...",
128
- "author": "Sid Mathur",
129
- "role": "Founder"
130
- },
131
- "comingNext": "Next week: Voice commands for calendar management, smart meeting summaries...",
132
- "ctaLink": "https://example.com/wellness/ai-agent",
133
- "ctaText": "Start Your Free Trial"
134
- }
135
- }
136
- ```
137
-
138
- ### Step 5: Generate HTML
139
- // 1. Fetch helper script and save to temp (if not already done)
140
- // const scriptContent = await get_fraim_file({ path: "scripts/newsletter-helpers.ts" });
141
- // ... (save to tempScriptPath) ...
142
- const { saveNewsletter } = await import(tempScriptPath);
143
-
144
- // 2. Save newsletter JSON and generate HTML
145
- const savedPath = saveNewsletter(newsletter);
146
- ```
147
-
148
- **This function will**:
149
- - Save the JSON file
150
- - Generate beautiful HTML from the template
151
- - Save the HTML file
152
- - Return path to JSON file
153
-
154
- ### Step 6: User Review
155
- **AI Agent**:
156
- 1. **Points user to the generated file**: `docs/customer-development/newsletters/newsletter-YYYY-MM-DD.json`
157
- 2. **Shows preview**: Points to HTML file for browser preview
158
- 3. **Requests review** and any edits needed (user can edit JSON directly)
159
- 4. **Waits for user approval** before proceeding
160
-
161
- **Note**: User can:
162
- - Edit titles to be more compelling
163
- - Add/remove items
164
- - Adjust descriptions
165
- - Add real testimonials (verify authenticity!)
166
- - Add "coming next" teaser
167
-
168
- ### Step 7: Send Newsletter (Separate Command)
169
- **When user says "Send the newsletter" or similar**:
170
-
171
- **User runs deterministic script**:
172
- ```bash
173
- npm run send-newsletter
174
- ```
175
-
176
- // 1. Fetch helper script and save to temp (if not already done)
177
- // ...
178
- const { sendNewsletterToExecutives } = await import(tempScriptPath);
179
-
180
- // 2. Send newsletter to all active executives
181
- await sendNewsletterToExecutives('docs/customer-development/newsletters/newsletter-2025-11-01.json');
182
- ```
183
-
184
- **This function will**:
185
- - Load the approved newsletter JSON
186
- - Get all active executives from database
187
- - For each executive:
188
- - Get their AI Agent email address
189
- - Get their OAuth tokens
190
- - Send personalized newsletter from their AI identity
191
- - Log results and exit
192
-
193
- ## NEWSLETTER STRUCTURE
194
-
195
- ### Hero Section
196
- - **Week Title**: Catchy title based on hero feature or main theme
197
- - **Subtitle**: Count of updates
198
- - **Stats Banner**: Features | Improvements | Bug Fixes counters
199
-
200
- ### Content Sections
201
- 1. **Opening Message**: Exciting intro about what shipped (AI agent writes this)
202
- 2. **Hero Feature** (optional): Spotlights the most impactful change with red "HERO FEATURE" badge
203
- 3. **New Capabilities**: Major new features added
204
- 4. **Major Improvements**: Significant enhancements
205
- 5. **Fixes & Polish**: Bug fixes and minor improvements
206
- 6. **Testimonial** (optional): Real user quote about impact (VERIFY AUTHENTICITY)
207
- 7. **Coming Next** (optional): Preview of upcoming features
208
-
209
- ### Call-to-Actions
210
- - **FOMO CTA**: "Don't Miss Out!" with signup link
211
- - **Feedback CTA**: Link to ChatGPT interface
212
-
213
- ## EDITORIAL GUIDELINES
214
-
215
- ### What to Include
216
- - New features that add capability for users
217
- - Improvements that save time or improve UX
218
- - Bug fixes that had user impact
219
- - Real user testimonials (ONLY - verify authenticity)
220
- - Quantified benefits (time saved, conflicts reduced, etc.)
221
-
222
- ### What to Exclude
223
- - Internal infrastructure changes
224
- - **Admin dashboards, monitoring, analytics (internal-only)**
225
- - **Backups, database operations, devops**
226
- - **API route fixes, duplicate endpoint resolution**
227
- - **Environment configuration, .env file updates**
228
- - **Developer setup scripts, build configuration**
229
- - CI/CD improvements
230
- - Documentation updates
231
- - Dependency updates
232
- - Technical debt cleanup
233
- - Developer tools and debugging features
234
- - **Internal bug fixes (code structure, not user experience)**
235
- - Issues without user-facing impact
236
- - **FAKE TESTIMONIALS - authenticity is critical**
237
-
238
- **Rule of thumb**: If the user wouldn't notice the change in their daily use of the AI Assistant, don't include it.
239
-
240
- ### Writing Style
241
-
242
- **Titles:**
243
- - Short, punchy, benefit-focused
244
- - "Implement timezone handling in calendar service"
245
- - ✅ "Smart Timezone Detection"
246
-
247
- **Descriptions:**
248
- - Start with the benefit to the user
249
- - Use "you" and "your" to make it personal
250
- - Be specific about what changed
251
- - ❌ "Fixed bug where calendar events weren't syncing correctly"
252
- - "Your calendar now stays perfectly in sync across all devices, no more mysterious missing meetings!"
253
-
254
- **Impact Statements:**
255
- - Quantify whenever possible
256
- - Include real user feedback
257
- - ❌ "Improved performance"
258
- - ✅ "Calendar loads 3x faster, getting you to your day in seconds instead of minutes"
259
-
260
- ### Creating FOMO
261
-
262
- - **Quantify Success**: "500+ executives already using this feature"
263
- - **Show Savings**: "Don't miss out on 5 hours saved per week"
264
- - **Create Urgency**: "Limited spots available"
265
- - **Social Proof**: Real testimonials, growth stats, company names (with permission)
266
-
267
- ## EXAMPLES
268
-
269
- ### Example 1: Feature-Rich Week
270
- ```
271
- User: "Generate this week's newsletter"
272
-
273
- AI Agent:
274
- 1. Calls getResolvedIssuesForNewsletter() → gets 15 issues
275
- 2. Analyzes each issue:
276
- - 3 user-facing features
277
- - 5 improvements
278
- - 2 bugs
279
- - 5 internal/devops (FILTERED OUT)
280
- 3. Writes compelling content for each item
281
- 4. Selects "Voice Commands for Calendar" as hero feature
282
- 5. Writes exciting opening: "This week has been HUGE!..."
283
- 6. Creates newsletter JSON with all content
284
- 7. Calls saveNewsletter() generates HTML
285
- 8. Shows preview: "Newsletter ready! docs/customer-development/newsletters/newsletter-2025-11-01.html"
286
-
287
- User: "Looks great, send it"
288
-
289
- AI Agent or User:
290
- Runs: npm run send-newsletter
291
- OR
292
- Calls: sendNewsletterToExecutives('newsletter-2025-11-01.json')
293
- ```
294
-
295
- ### Example 2: User Adds Testimonial
296
- ```
297
- User: "Generate newsletter"
298
-
299
- AI Agent:
300
- [Creates newsletter with 5 improvements, no testimonial]
301
-
302
- User: "Add a testimonial from me - I saved 5 hours this week thanks to focus blocks"
303
-
304
- AI Agent:
305
- [Edits JSON to add testimonial with user's name]
306
- [Regenerates HTML]
307
- Shows: "Updated! Ready to send?"
308
-
309
- User: "Yes, send it"
310
-
311
- User runs: npm run send-newsletter
312
- ```
313
-
314
- ## TIPS FOR COMPELLING NEWSLETTERS
315
-
316
- ### Highlight User Value
317
- - Focus on what users can DO, not how it works
318
- - "You can now..." not "We implemented..."
319
- - "Your calendar automatically..." not "The system now..."
320
-
321
- ### Use Concrete Examples
322
- - "Schedule meetings in seconds" not "Faster scheduling"
323
- - "85% fewer conflicts" not "Better conflict detection"
324
- - "Save 5 hours per week" not "More efficient"
325
-
326
- ### Create Narrative
327
- - Opening: "This week has been incredible!"
328
- - Hero feature: Build excitement around main change
329
- - Coming next: Build anticipation for next week
330
-
331
- ### Make it Scannable
332
- - Short paragraphs (2-3 sentences max)
333
- - Clear section headers
334
- - Visual hierarchy with emojis and formatting
335
- - Impact callouts that stand out
336
-
337
- ## QUALITY CHECKLIST
338
-
339
- Before approving newsletter, verify:
340
- - [ ] All items are user-facing (no internal/devops features)
341
- - [ ] Testimonials are real and verified
342
- - [ ] Impact statements are accurate and quantified
343
- - [ ] Descriptions focus on user value, not implementation
344
- - [ ] Opening message is exciting and FOMO-inducing
345
- - [ ] Links are correct (Azure signup URL)
346
- - [ ] No mention of API credits or costs (the service is free)
347
- - [ ] Grammar and spelling are perfect
348
- - [ ] Preview HTML looks beautiful in browser
349
-
350
- ## FREQUENCY
351
-
352
- **Recommended**: Weekly, sent Monday morning
353
- - Catches people starting their week
354
- - Fresh in mind for decision-making
355
- - Consistent schedule builds anticipation
356
-
357
- **Alternative**: Bi-weekly if weekly feels too frequent
358
-
359
- **Special editions**:
360
- - Major feature launches
361
- - Milestone celebrations (e.g., "100 users!")
362
- - Holiday/end-of-year roundups
1
+ # Weekly Newsletter Workflow
2
+
3
+ ## INTENT
4
+ To generate and distribute a compelling weekly newsletter that showcases the AI Agent's amazing new features and improvements, creating excitement among current users and FOMO for subscribers who haven't joined yet.
5
+
6
+ ## PRINCIPLES
7
+ - **Value-Focused**: Highlight features and improvements that deliver real value to users
8
+ - **User-Facing Only**: Do NOT include internal features (admin dashboards, monitoring, backups, devops)
9
+ - **Authentic Testimonials**: Only use real testimonials from actual users - NO fake quotes
10
+ - **FOMO-Inducing**: Create urgency and excitement about missing out
11
+ - **Visually Stunning**: Beautiful design that catches the eye
12
+ - **Concise**: Scannable format with clear sections
13
+ - **AI Creativity**: AI agent makes all editorial decisions - what's a feature vs bug, what's worth highlighting
14
+
15
+ ## WORKFLOW TRIGGER
16
+ **User triggers this workflow manually**:
17
+ - Weekly, typically Monday morning
18
+ - User says: "Generate this week's newsletter" or similar
19
+
20
+ ## AI AGENT PROCESS
21
+
22
+ ### Step 1: Issue Retrieval
23
+ **AI Agent calls function**:
24
+ ```typescript
25
+ // Import newsletter helper functions directly from synced location
26
+ const os = require('os');
27
+ const path = require('path');
28
+
29
+ const scriptsDir = path.join(os.homedir(), '.fraim', 'scripts');
30
+ const scriptPath = path.join(scriptsDir, 'newsletter-helpers.ts');
31
+
32
+ // Import from the synced script
33
+ const { getResolvedIssuesForNewsletter } = await import(scriptPath);
34
+
35
+ // Use the function
36
+ const resolvedIssues = await getResolvedIssuesForNewsletter();
37
+ ```
38
+
39
+ **Note**: The `getResolvedIssuesForNewsletter()` function automatically:
40
+ - Finds the most recent newsletter date from existing files
41
+ - Uses that date as the starting point to fetch issues resolved AFTER that date
42
+ - If no newsletter files exist, falls back to last 7 days
43
+ - Returns ALL closed issues - AI agent decides what to include
44
+
45
+ ### Step 2: Intelligent Categorization & Filtering
46
+ **AI Agent does creative analysis**:
47
+
48
+ 1. **Go through each resolved issue** and make editorial decisions:
49
+ - Is this user-facing or internal?
50
+ - Is this a feature, improvement, or bug fix?
51
+ - Is this worth highlighting to users?
52
+ - How should this be described to non-technical users?
53
+
54
+ 2. **Filter out internal-only issues**:
55
+ - Admin dashboards, monitoring, analytics (internal tools)
56
+ - Database backups, devops improvements
57
+ - CI/CD, deployment automation
58
+ - Developer tools, debugging features
59
+ - Documentation updates, dependency updates
60
+ - **API route fixes, endpoint refactoring, code structure changes**
61
+ - **Environment variable updates, configuration file changes**
62
+ - **Developer setup improvements, build process updates**
63
+ - **Internal bug fixes that don't impact user experience**
64
+ - Any change without user-facing impact
65
+
66
+ 3. **Categorize remaining issues**:
67
+ - **Features**: Adds NEW capability users didn't have before
68
+ - **Improvements**: Makes existing functionality better/faster/easier
69
+ - **Bug Fixes**: Fixes something that was broken
70
+
71
+ 4. **Select hero feature** (optional):
72
+ - Pick the MOST impactful feature or improvement
73
+ - Must have clear user value and ideally a quantifiable impact statement
74
+
75
+ ### Step 3: Write Compelling Content
76
+ **AI Agent writes newsletter content** - be creative, exciting, and user-focused!
77
+
78
+ **Guidelines**:
79
+ - **NO TECHNICAL JARGON**: Don't mention internal systems, code, or technical details
80
+ - **USER VALUE FOCUS**: Describe what the user can now do, not how it works
81
+ - **ACTIVE, EXCITING LANGUAGE**: "You can now...", "The AI Agent now automatically...", "Your calendar finally..."
82
+ - **QUANTIFY IMPACT**: "85% reduction in...", "5 hours saved per week", "3x faster"
83
+ - **CREATE FOMO**: "Current users are already...", "Join 500+ executives who..."
84
+
85
+ **For each item, write**:
86
+ - **Title**: Short, benefit-focused (e.g., "Smart Timezone Detection" not "Implement timezone handling")
87
+ - **Description**: What the user can do now, why it matters (2-3 sentences)
88
+ - **Impact** (optional): Quantified benefit or user testimonial
89
+
90
+ **Example**:
91
+ ```json
92
+ {
93
+ "title": "Work Hours & Focus Blocks on Your Calendar",
94
+ "description": "Your work hours and focus blocks now automatically appear as visual blocks on your calendar! No more scheduling conflicts during your protected time. The AI creates beautiful calendar events that sync across all your devices, making it crystal clear when you're available and when you're in deep work mode.",
95
+ "impact": "Users report 85% reduction in meeting conflicts during focus time. Your calendar finally shows the complete picture of your day!"
96
+ }
97
+ ```
98
+
99
+ ### Step 4: Generate Newsletter JSON
100
+ **AI Agent creates ONE file**:
101
+ - File: `docs/customer-development/newsletters/newsletter-YYYY-MM-DD.json`
102
+ - Format: Structured JSON for deterministic rendering
103
+ - Contains ALL content ready for user review
104
+
105
+ **File format** (JSON):
106
+ ```json
107
+ {
108
+ "metadata": {
109
+ "generatedOn": "2025-11-01T00:00:00.000Z",
110
+ "weekStart": "2025-10-25",
111
+ "weekEnd": "2025-11-01",
112
+ ...
113
+ },
114
+ "content": {
115
+ "weekTitle": "Work Hours & Focus Blocks Now on Your Calendar! 🎯",
116
+ "weekSubtitle": "8 powerful updates that supercharge your productivity",
117
+ "weekDate": "Oct 25 - Nov 1, 2025",
118
+ "openingMessage": "This week has been HUGE! We've shipped game-changing features that make the AI Agent even more powerful at protecting your time and managing your schedule. Current users are already saving hours every week - here's what you've been missing! 🚀",
119
+ "heroFeature": { ... },
120
+ "newFeatures": [ ... ],
121
+ "improvements": [ ... ],
122
+ "bugFixes": [ ... ],
123
+ "testimonial": {
124
+ "text": "The AI saved me 5 hours this week just by protecting my focus blocks...",
125
+ "author": "Sid Mathur",
126
+ "role": "Founder"
127
+ },
128
+ "comingNext": "Next week: Voice commands for calendar management, smart meeting summaries...",
129
+ "ctaLink": "https://example.com/wellness/ai-agent",
130
+ "ctaText": "Start Your Free Trial"
131
+ }
132
+ }
133
+ ```
134
+
135
+ ### Step 5: Generate HTML
136
+ // Import helper functions directly from synced location
137
+ const os = require('os');
138
+ const path = require('path');
139
+ const scriptsDir = path.join(os.homedir(), '.fraim', 'scripts');
140
+ const scriptPath = path.join(scriptsDir, 'newsletter-helpers.ts');
141
+
142
+ const { saveNewsletter } = await import(scriptPath);
143
+
144
+ // 2. Save newsletter JSON and generate HTML
145
+ const savedPath = saveNewsletter(newsletter);
146
+ ```
147
+
148
+ **This function will**:
149
+ - Save the JSON file
150
+ - Generate beautiful HTML from the template
151
+ - Save the HTML file
152
+ - Return path to JSON file
153
+
154
+ ### Step 6: User Review
155
+ **AI Agent**:
156
+ 1. **Points user to the generated file**: `docs/customer-development/newsletters/newsletter-YYYY-MM-DD.json`
157
+ 2. **Shows preview**: Points to HTML file for browser preview
158
+ 3. **Requests review** and any edits needed (user can edit JSON directly)
159
+ 4. **Waits for user approval** before proceeding
160
+
161
+ **Note**: User can:
162
+ - Edit titles to be more compelling
163
+ - Add/remove items
164
+ - Adjust descriptions
165
+ - Add real testimonials (verify authenticity!)
166
+ - Add "coming next" teaser
167
+
168
+ ### Step 7: Send Newsletter (Separate Command)
169
+ **When user says "Send the newsletter" or similar**:
170
+
171
+ **User runs deterministic script**:
172
+ ```bash
173
+ npm run send-newsletter
174
+ ```
175
+
176
+ // Import helper functions directly from synced location
177
+ const os = require('os');
178
+ const path = require('path');
179
+ const scriptsDir = path.join(os.homedir(), '.fraim', 'scripts');
180
+ const scriptPath = path.join(scriptsDir, 'newsletter-helpers.ts');
181
+
182
+ const { sendNewsletterToExecutives } = await import(scriptPath);
183
+
184
+ // 2. Send newsletter to all active executives
185
+ await sendNewsletterToExecutives('docs/customer-development/newsletters/newsletter-2025-11-01.json');
186
+ ```
187
+
188
+ **This function will**:
189
+ - Load the approved newsletter JSON
190
+ - Get all active executives from database
191
+ - For each executive:
192
+ - Get their AI Agent email address
193
+ - Get their OAuth tokens
194
+ - Send personalized newsletter from their AI identity
195
+ - Log results and exit
196
+
197
+ ## NEWSLETTER STRUCTURE
198
+
199
+ ### Hero Section
200
+ - **Week Title**: Catchy title based on hero feature or main theme
201
+ - **Subtitle**: Count of updates
202
+ - **Stats Banner**: Features | Improvements | Bug Fixes counters
203
+
204
+ ### Content Sections
205
+ 1. **Opening Message**: Exciting intro about what shipped (AI agent writes this)
206
+ 2. **Hero Feature** (optional): Spotlights the most impactful change with red "HERO FEATURE" badge
207
+ 3. **New Capabilities**: Major new features added
208
+ 4. **Major Improvements**: Significant enhancements
209
+ 5. **Fixes & Polish**: Bug fixes and minor improvements
210
+ 6. **Testimonial** (optional): Real user quote about impact (VERIFY AUTHENTICITY)
211
+ 7. **Coming Next** (optional): Preview of upcoming features
212
+
213
+ ### Call-to-Actions
214
+ - **FOMO CTA**: "Don't Miss Out!" with signup link
215
+ - **Feedback CTA**: Link to ChatGPT interface
216
+
217
+ ## EDITORIAL GUIDELINES
218
+
219
+ ### What to Include
220
+ - New features that add capability for users
221
+ - Improvements that save time or improve UX
222
+ - Bug fixes that had user impact
223
+ - Real user testimonials (ONLY - verify authenticity)
224
+ - Quantified benefits (time saved, conflicts reduced, etc.)
225
+
226
+ ### What to Exclude
227
+ - Internal infrastructure changes
228
+ - **Admin dashboards, monitoring, analytics (internal-only)**
229
+ - **Backups, database operations, devops**
230
+ - **API route fixes, duplicate endpoint resolution**
231
+ - **Environment configuration, .env file updates**
232
+ - **Developer setup scripts, build configuration**
233
+ - CI/CD improvements
234
+ - Documentation updates
235
+ - Dependency updates
236
+ - Technical debt cleanup
237
+ - Developer tools and debugging features
238
+ - **Internal bug fixes (code structure, not user experience)**
239
+ - Issues without user-facing impact
240
+ - **FAKE TESTIMONIALS - authenticity is critical**
241
+
242
+ **Rule of thumb**: If the user wouldn't notice the change in their daily use of the AI Assistant, don't include it.
243
+
244
+ ### Writing Style
245
+
246
+ **Titles:**
247
+ - Short, punchy, benefit-focused
248
+ - "Implement timezone handling in calendar service"
249
+ - "Smart Timezone Detection"
250
+
251
+ **Descriptions:**
252
+ - Start with the benefit to the user
253
+ - Use "you" and "your" to make it personal
254
+ - Be specific about what changed
255
+ - "Fixed bug where calendar events weren't syncing correctly"
256
+ - "Your calendar now stays perfectly in sync across all devices, no more mysterious missing meetings!"
257
+
258
+ **Impact Statements:**
259
+ - Quantify whenever possible
260
+ - Include real user feedback
261
+ - ❌ "Improved performance"
262
+ - "Calendar loads 3x faster, getting you to your day in seconds instead of minutes"
263
+
264
+ ### Creating FOMO
265
+
266
+ - **Quantify Success**: "500+ executives already using this feature"
267
+ - **Show Savings**: "Don't miss out on 5 hours saved per week"
268
+ - **Create Urgency**: "Limited spots available"
269
+ - **Social Proof**: Real testimonials, growth stats, company names (with permission)
270
+
271
+ ## EXAMPLES
272
+
273
+ ### Example 1: Feature-Rich Week
274
+ ```
275
+ User: "Generate this week's newsletter"
276
+
277
+ AI Agent:
278
+ 1. Calls getResolvedIssuesForNewsletter() → gets 15 issues
279
+ 2. Analyzes each issue:
280
+ - 3 user-facing features
281
+ - 5 improvements
282
+ - 2 bugs
283
+ - 5 internal/devops (FILTERED OUT)
284
+ 3. Writes compelling content for each item
285
+ 4. Selects "Voice Commands for Calendar" as hero feature
286
+ 5. Writes exciting opening: "This week has been HUGE!..."
287
+ 6. Creates newsletter JSON with all content
288
+ 7. Calls saveNewsletter() → generates HTML
289
+ 8. Shows preview: "Newsletter ready! docs/customer-development/newsletters/newsletter-2025-11-01.html"
290
+
291
+ User: "Looks great, send it"
292
+
293
+ AI Agent or User:
294
+ Runs: npm run send-newsletter
295
+ OR
296
+ Calls: sendNewsletterToExecutives('newsletter-2025-11-01.json')
297
+ ```
298
+
299
+ ### Example 2: User Adds Testimonial
300
+ ```
301
+ User: "Generate newsletter"
302
+
303
+ AI Agent:
304
+ [Creates newsletter with 5 improvements, no testimonial]
305
+
306
+ User: "Add a testimonial from me - I saved 5 hours this week thanks to focus blocks"
307
+
308
+ AI Agent:
309
+ [Edits JSON to add testimonial with user's name]
310
+ [Regenerates HTML]
311
+ Shows: "Updated! Ready to send?"
312
+
313
+ User: "Yes, send it"
314
+
315
+ User runs: npm run send-newsletter
316
+ ```
317
+
318
+ ## TIPS FOR COMPELLING NEWSLETTERS
319
+
320
+ ### Highlight User Value
321
+ - Focus on what users can DO, not how it works
322
+ - "You can now..." not "We implemented..."
323
+ - "Your calendar automatically..." not "The system now..."
324
+
325
+ ### Use Concrete Examples
326
+ - "Schedule meetings in seconds" not "Faster scheduling"
327
+ - "85% fewer conflicts" not "Better conflict detection"
328
+ - "Save 5 hours per week" not "More efficient"
329
+
330
+ ### Create Narrative
331
+ - Opening: "This week has been incredible!"
332
+ - Hero feature: Build excitement around main change
333
+ - Coming next: Build anticipation for next week
334
+
335
+ ### Make it Scannable
336
+ - Short paragraphs (2-3 sentences max)
337
+ - Clear section headers
338
+ - Visual hierarchy with emojis and formatting
339
+ - Impact callouts that stand out
340
+
341
+ ## QUALITY CHECKLIST
342
+
343
+ Before approving newsletter, verify:
344
+ - [ ] All items are user-facing (no internal/devops features)
345
+ - [ ] Testimonials are real and verified
346
+ - [ ] Impact statements are accurate and quantified
347
+ - [ ] Descriptions focus on user value, not implementation
348
+ - [ ] Opening message is exciting and FOMO-inducing
349
+ - [ ] Links are correct (Azure signup URL)
350
+ - [ ] No mention of API credits or costs (the service is free)
351
+ - [ ] Grammar and spelling are perfect
352
+ - [ ] Preview HTML looks beautiful in browser
353
+
354
+ ## FREQUENCY
355
+
356
+ **Recommended**: Weekly, sent Monday morning
357
+ - Catches people starting their week
358
+ - Fresh in mind for decision-making
359
+ - Consistent schedule builds anticipation
360
+
361
+ **Alternative**: Bi-weekly if weekly feels too frequent
362
+
363
+ **Special editions**:
364
+ - Major feature launches
365
+ - Milestone celebrations (e.g., "100 users!")
366
+ - Holiday/end-of-year roundups