fraim-framework 2.0.26 → 2.0.30

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 (104) hide show
  1. package/.github/workflows/deploy-fraim.yml +1 -1
  2. package/dist/registry/scripts/build-scripts-generator.js +205 -0
  3. package/dist/registry/scripts/cleanup-branch.js +258 -0
  4. package/dist/registry/scripts/evaluate-code-quality.js +66 -0
  5. package/dist/registry/scripts/exec-with-timeout.js +142 -0
  6. package/dist/registry/scripts/fraim-config.js +61 -0
  7. package/dist/registry/scripts/generate-engagement-emails.js +630 -0
  8. package/dist/registry/scripts/generic-issues-api.js +100 -0
  9. package/dist/registry/scripts/newsletter-helpers.js +731 -0
  10. package/dist/registry/scripts/openapi-generator.js +664 -0
  11. package/dist/registry/scripts/performance/profile-server.js +390 -0
  12. package/dist/registry/scripts/run-thank-you-workflow.js +92 -0
  13. package/dist/registry/scripts/send-newsletter-simple.js +85 -0
  14. package/dist/registry/scripts/send-thank-you-emails.js +54 -0
  15. package/dist/registry/scripts/validate-openapi-limits.js +311 -0
  16. package/dist/registry/scripts/validate-test-coverage.js +262 -0
  17. package/dist/registry/scripts/verify-test-coverage.js +66 -0
  18. package/dist/src/cli/commands/init.js +14 -12
  19. package/dist/src/cli/commands/sync.js +19 -2
  20. package/dist/src/cli/fraim.js +24 -22
  21. package/dist/src/cli/setup/first-run.js +13 -6
  22. package/dist/src/fraim/config-loader.js +0 -8
  23. package/dist/src/fraim/db-service.js +26 -15
  24. package/dist/src/fraim/issues.js +67 -0
  25. package/dist/src/fraim/setup-wizard.js +1 -69
  26. package/dist/src/fraim/types.js +0 -11
  27. package/dist/src/fraim-mcp-server.js +272 -18
  28. package/dist/src/utils/git-utils.js +1 -1
  29. package/dist/src/utils/version-utils.js +32 -0
  30. package/dist/tests/debug-tools.js +79 -0
  31. package/dist/tests/esm-compat.js +11 -0
  32. package/dist/tests/test-chalk-esm-issue.js +159 -0
  33. package/dist/tests/test-chalk-real-world.js +265 -0
  34. package/dist/tests/test-chalk-regression.js +327 -0
  35. package/dist/tests/test-chalk-resolution-issue.js +304 -0
  36. package/dist/tests/test-cli.js +0 -2
  37. package/dist/tests/test-fraim-install-chalk-issue.js +254 -0
  38. package/dist/tests/test-fraim-issues.js +59 -0
  39. package/dist/tests/test-genericization.js +1 -3
  40. package/dist/tests/test-mcp-connection.js +166 -0
  41. package/dist/tests/test-mcp-issue-integration.js +144 -0
  42. package/dist/tests/test-mcp-lifecycle-methods.js +312 -0
  43. package/dist/tests/test-node-compatibility.js +71 -0
  44. package/dist/tests/test-npm-install.js +66 -0
  45. package/dist/tests/test-npm-resolution-diagnostic.js +140 -0
  46. package/dist/tests/test-session-rehydration.js +145 -0
  47. package/dist/tests/test-standalone.js +2 -8
  48. package/dist/tests/test-sync-version-update.js +93 -0
  49. package/dist/tests/test-telemetry.js +190 -0
  50. package/package.json +10 -8
  51. package/registry/agent-guardrails.md +62 -54
  52. package/registry/rules/agent-success-criteria.md +52 -0
  53. package/registry/rules/agent-testing-guidelines.md +502 -502
  54. package/registry/rules/communication.md +121 -121
  55. package/registry/rules/continuous-learning.md +54 -54
  56. package/registry/rules/ephemeral-execution.md +10 -5
  57. package/registry/rules/hitl-ppe-record-analysis.md +302 -302
  58. package/registry/rules/local-development.md +251 -251
  59. package/registry/rules/software-development-lifecycle.md +104 -104
  60. package/registry/rules/successful-debugging-patterns.md +482 -478
  61. package/registry/rules/telemetry.md +67 -0
  62. package/registry/scripts/build-scripts-generator.ts +216 -215
  63. package/registry/scripts/cleanup-branch.ts +303 -284
  64. package/registry/scripts/code-quality-check.sh +559 -559
  65. package/registry/scripts/detect-tautological-tests.sh +38 -38
  66. package/registry/scripts/evaluate-code-quality.ts +1 -1
  67. package/registry/scripts/generate-engagement-emails.ts +744 -744
  68. package/registry/scripts/generic-issues-api.ts +110 -150
  69. package/registry/scripts/newsletter-helpers.ts +874 -874
  70. package/registry/scripts/openapi-generator.ts +695 -693
  71. package/registry/scripts/performance/profile-server.ts +5 -3
  72. package/registry/scripts/prep-issue.sh +468 -455
  73. package/registry/scripts/validate-openapi-limits.ts +366 -365
  74. package/registry/scripts/validate-test-coverage.ts +280 -280
  75. package/registry/scripts/verify-pr-comments.sh +70 -70
  76. package/registry/scripts/verify-test-coverage.ts +1 -1
  77. package/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +53 -53
  78. package/registry/templates/evidence/Implementation-BugEvidence.md +85 -85
  79. package/registry/templates/evidence/Implementation-FeatureEvidence.md +120 -120
  80. package/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +66 -0
  81. package/registry/workflows/bootstrap/create-architecture.md +2 -2
  82. package/registry/workflows/bootstrap/evaluate-code-quality.md +3 -3
  83. package/registry/workflows/bootstrap/verify-test-coverage.md +2 -2
  84. package/registry/workflows/customer-development/insight-analysis.md +156 -156
  85. package/registry/workflows/customer-development/interview-preparation.md +421 -421
  86. package/registry/workflows/customer-development/strategic-brainstorming.md +146 -146
  87. package/registry/workflows/customer-development/thank-customers.md +193 -191
  88. package/registry/workflows/customer-development/weekly-newsletter.md +362 -352
  89. package/registry/workflows/improve-fraim/contribute.md +32 -0
  90. package/registry/workflows/improve-fraim/file-issue.md +32 -0
  91. package/registry/workflows/marketing/hbr-article.md +73 -0
  92. package/registry/workflows/performance/analyze-performance.md +63 -59
  93. package/registry/workflows/product-building/design.md +3 -2
  94. package/registry/workflows/product-building/implement.md +4 -3
  95. package/registry/workflows/product-building/prep-issue.md +28 -17
  96. package/registry/workflows/product-building/resolve.md +3 -2
  97. package/registry/workflows/product-building/retrospect.md +3 -2
  98. package/registry/workflows/product-building/spec.md +5 -4
  99. package/registry/workflows/product-building/test.md +3 -2
  100. package/registry/workflows/quality-assurance/iterative-improvement-cycle.md +562 -562
  101. package/registry/workflows/replicate/website-discovery-analysis.md +3 -3
  102. package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +632 -632
  103. package/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +669 -669
  104. package/tsconfig.json +2 -1
@@ -1,191 +1,193 @@
1
- # Thank Customers Workflow
2
-
3
- ## INTENT
4
- To automatically generate and send personalized thank you emails to customers whose feedback has been implemented, strengthening customer relationships and encouraging continued engagement.
5
-
6
- ## PRINCIPLES
7
- - **Personal Touch**: Ashley's voice, grateful tone, "Thank you for making me better..."
8
- - **Voice & Pronouns**: Emails are written in first person from Ashley ("I", "me", "my"). When referring to Ashley in third person (outside the email body), use they/them pronouns. Avoid gendered pronouns for Ashley.
9
- - **Customer-Focused**: No technical jargon or issue numbers in customer emails
10
- - **Short and Sweet**: To the point, instructive, humble
11
- - **Encourage more feedback**: ChatGPT (https://ashley-chat.wellnessatwork.me) is the best way
12
-
13
- ## WORKFLOW TRIGGER
14
- **User triggers this workflow manually**:
15
- - When customer issues are resolved and deployed
16
- - User says: "Generate thank you emails for customers" or similar
17
-
18
- ## AI AGENT PROCESS
19
-
20
- ### Step 1: Issue Retrieval
21
- **AI Agent calls function**:
22
- ```typescript
23
- import { getResolvedIssues, findExecutiveByEmail, getAshleyEmailForExecutive } from '.ai-agents/scripts/generate-thank-you-emails.ts';
24
-
25
- // Get issues resolved since last thank-you date (automatic) or user-specified date
26
- const resolvedIssues = await getResolvedIssues(); // Automatically uses latest thank-you date
27
- // OR with explicit date:
28
- const resolvedIssues = await getResolvedIssues('2025-10-29'); // Optional: user-specified date
29
- ```
30
-
31
- **Note**: The `getResolvedIssues()` function automatically:
32
- - Finds the most recent date from existing `thank-you-candidates-YYYY-MM-DD.json` files where emails were sent (status: "sent")
33
- - Uses that date as the starting point to only fetch issues resolved AFTER that date
34
- - If no thank-you files exist, falls back to last 14 days
35
- - This ensures we never send duplicate thank-you emails for the same resolved issues
36
-
37
- ### Step 2: Customer Information Extraction
38
- **AI Agent does intelligent extraction**:
39
- 1. **Go through each resolved issue**
40
- 2. **Extract customer email** from:
41
- - Issue title format: `email@domain.com: summary`
42
- - Issue body: look for email patterns
43
- - If no email found, extract customer name and use database lookup
44
- 3. **Extract customer name** from:
45
- - Issue title or body
46
- - Previous thank-you notes
47
- - Onboarding insights documents
48
-
49
- ### Step 3: Database Lookup
50
- **AI Agent calls function for each customer**:
51
- ```typescript
52
- // Look up executive by customer email
53
- const executive = await findExecutiveByEmail(customerEmail);
54
-
55
- // Get Ashley email address for this executive
56
- const ashleyEmail = await getAshleyEmailForExecutive(executive.id);
57
- ```
58
-
59
- ### Step 4: Collate Issues by Customer
60
- **AI Agent organizes data**:
61
- - Group all resolved issues by customer email
62
- - **Consolidate customers with multiple email addresses** by matching customer names (case-insensitive)
63
- - When a customer has multiple emails, use the primary email from the database lookup
64
- - Output customer list to console for verification
65
-
66
- ### Step 5: Generate Single Thank-You File
67
- **AI Agent creates ONE file**:
68
- - File: `docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json`
69
- - Format: Structured JSON (not markdown) for easy parsing by mail sending script
70
- - Contains ALL customers and their personalized emails
71
- - **AI Agent writes the email content** - be creative, personal, and contextual!
72
- - Follow principles: personal touch, customer-focused, short and sweet, encourage feedback
73
- - **NO TECHNICAL JARGON**: Do not mention issue numbers, BAML, internal systems, or technical details
74
- - **CUSTOMER EXPERIENCE FOCUS**: Describe what was broken from the user's perspective, what was fixed, and how they can verify it works
75
- - **First-person Email Body**: Use "I" for actions Ashley took (e.g., "I fixed", "I now", "I will"), not "Ashley" or "she". Sign off as Ashley.
76
- - Include `From:` field showing Ashley email from PPE (via `getAshleyEmailForExecutive()`)
77
-
78
- **File format** (JSON):
79
- ```json
80
- {
81
- "metadata": {
82
- "generatedOn": "2025-10-29T02:29:02.497Z",
83
- "issuesResolvedSince": "2025-10-28",
84
- "totalCustomers": 2,
85
- "totalIssues": 3
86
- },
87
- "candidates": [
88
- {
89
- "customer": {
90
- "name": "Olga Ivanova",
91
- "email": "olga.ivanova@gmail.com"
92
- },
93
- "executive": {
94
- "name": "Olga Ivanova",
95
- "id": "exec-..."
96
- },
97
- "status": "pending",
98
- "from": {
99
- "displayName": "Ashley - Olga Ivanova's AI Executive Assistant",
100
- "email": "ashley+olga@ashleycalendar.ai"
101
- },
102
- "to": "olga.ivanova@gmail.com",
103
- "subject": "Thank you for your feedback - your issues have been addressed!",
104
- "greeting": "Hi Olga,",
105
- "opening": "Thank you for making me better! I wanted to personally reach out because your feedback helped us catch and fix an important bug.",
106
- "improvements": [
107
- {
108
- "title": "Issue filing feature",
109
- "description": "The issue filing feature is now working properly - when you ask me to file a bug or feature request through voice, I'll handle it correctly.",
110
- "verification": "Try asking me to file a bug or feature request and it should work smoothly now."
111
- }
112
- ],
113
- "closing": "Your quick feedback saved you (and others) frustration down the line. That kind of real-time input makes all the difference as I'm learning."
114
- }
115
- ]
116
- }
117
- ```
118
-
119
- **Note**: The structured format allows the HTML template to format each section beautifully:
120
- - `greeting`: Personal greeting (e.g., "Hi Olga,")
121
- - `opening`: Opening paragraph - thanks and context
122
- - `improvements[]`: Array of improvements (title, description, optional verification step)
123
- - `closing`: Closing paragraph - encouraging more feedback
124
-
125
- The HTML template formats each section with appropriate styling.
126
-
127
- ### Step 6: User Review
128
- **AI Agent**:
129
- 1. **Points user to the generated file**: `docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json`
130
- 2. **Requests review** and any edits needed (user can edit JSON directly)
131
- 3. **Waits for user approval** before proceeding
132
-
133
- **Note**: Each email section includes a `From:` field showing the display name and email address that will be used when sending. The signature includes a humble note about ramping up, without displaying a generic email address.
134
-
135
- ### Step 7: Send Emails (Separate Command)
136
- **When user says "Send the emails" or similar**:
137
-
138
- **AI Agent calls function**:
139
- ```typescript
140
- import { sendCustomerMail } from '.ai-agents/scripts/generate-thank-you-emails.ts';
141
-
142
- // Send emails from the candidates JSON file (all pending candidates)
143
- await sendCustomerMail('docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json');
144
-
145
- // OR send to a specific executive only (optional)
146
- await sendCustomerMail('docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json', 'exec-1761011032377-q36j91sdl');
147
- ```
148
-
149
- **Note**: The `sendCustomerMail` function parses JSON (not markdown) for easy, deterministic parsing.
150
-
151
- **Function parameters**:
152
- - `candidatesFilePath` (required): Path to the JSON candidates file
153
- - `executiveId` (optional): If provided, only sends emails for candidates matching this executive ID. If omitted, sends to all pending candidates.
154
-
155
- **This function will**:
156
- - Parse the JSON candidates file
157
- - If `executiveId` is provided, filter to only that executive's candidates
158
- - For each candidate with `status: "pending"`, send email
159
- - Use the `from` field (displayName and email) specified in JSON
160
- - Use the `to`, `subject`, and `body` fields from JSON
161
- - Update the JSON file after each send with status: `"sent"` or `"failed"`
162
- - Skip candidates that already have status `"sent"` or `"failed"`
163
-
164
- ## REQUIRED FUNCTIONS IN SCRIPT
165
-
166
- The script must provide these deterministic functions for AI agents to call:
167
-
168
- ```typescript
169
- // Get resolved issues since a date
170
- export async function getResolvedIssues(date: string): Promise<ResolvedIssue[]>
171
-
172
- // Find executive by email in PPE database
173
- export async function findExecutiveByEmail(email: string): Promise<Executive | null>
174
-
175
- // Get Ashley email for executive from PPE database
176
- export async function getAshleyEmailForExecutive(executiveId: string): Promise<string>
177
-
178
- // Send emails from candidates file
179
- // executiveId is optional - if provided, only sends to that executive; if omitted, sends to all pending
180
- export async function sendCustomerMail(candidatesFilePath: string, executiveId?: string): Promise<void>
181
- ```
182
-
183
- **Note**: The script provides ONLY data retrieval and sending. The AI agent does ALL intelligent work:
184
- - Extracts customer info from issues (intelligent parsing)
185
- - Writes personalized, creative email content (better than hardcoded templates!)
186
- - Organizes and formats the candidates file
187
-
188
- ## WORKFLOW COMPLETION
189
-
190
- **Generate workflow completes with**: Single candidates file ready for review
191
- **Send workflow completes with**: All emails sent and file updated with status
1
+ # Thank Customers Workflow
2
+
3
+ ## INTENT
4
+ To automatically generate and send personalized thank you emails to customers whose feedback has been implemented, strengthening customer relationships and encouraging continued engagement.
5
+
6
+ ## PRINCIPLES
7
+ - **Personal Touch**: Ashley's voice, grateful tone, "Thank you for making me better..."
8
+ - **Voice & Pronouns**: Emails are written in first person from Ashley ("I", "me", "my"). When referring to Ashley in third person (outside the email body), use they/them pronouns. Avoid gendered pronouns for Ashley.
9
+ - **Customer-Focused**: No technical jargon or issue numbers in customer emails
10
+ - **Short and Sweet**: To the point, instructive, humble
11
+ - **Encourage more feedback**: ChatGPT (https://ashley-chat.wellnessatwork.me) is the best way
12
+
13
+ ## WORKFLOW TRIGGER
14
+ **User triggers this workflow manually**:
15
+ - When customer issues are resolved and deployed
16
+ - User says: "Generate thank you emails for customers" or similar
17
+
18
+ ## AI AGENT PROCESS
19
+
20
+ ### Step 1: Issue Retrieval
21
+ **AI Agent calls function**:
22
+ ```typescript
23
+ // Note: Retrieve script via get_fraim_file({ path: "scripts/generate-thank-you-emails.ts" }) and save to tmp/generate-thank-you-emails.ts
24
+ import { getResolvedIssues, findExecutiveByEmail, getAshleyEmailForExecutive } from './tmp/generate-thank-you-emails.ts';
25
+
26
+ // Get issues resolved since last thank-you date (automatic) or user-specified date
27
+ const resolvedIssues = await getResolvedIssues(); // Automatically uses latest thank-you date
28
+ // OR with explicit date:
29
+ const resolvedIssues = await getResolvedIssues('2025-10-29'); // Optional: user-specified date
30
+ ```
31
+
32
+ **Note**: The `getResolvedIssues()` function automatically:
33
+ - Finds the most recent date from existing `thank-you-candidates-YYYY-MM-DD.json` files where emails were sent (status: "sent")
34
+ - Uses that date as the starting point to only fetch issues resolved AFTER that date
35
+ - If no thank-you files exist, falls back to last 14 days
36
+ - This ensures we never send duplicate thank-you emails for the same resolved issues
37
+
38
+ ### Step 2: Customer Information Extraction
39
+ **AI Agent does intelligent extraction**:
40
+ 1. **Go through each resolved issue**
41
+ 2. **Extract customer email** from:
42
+ - Issue title format: `email@domain.com: summary`
43
+ - Issue body: look for email patterns
44
+ - If no email found, extract customer name and use database lookup
45
+ 3. **Extract customer name** from:
46
+ - Issue title or body
47
+ - Previous thank-you notes
48
+ - Onboarding insights documents
49
+
50
+ ### Step 3: Database Lookup
51
+ **AI Agent calls function for each customer**:
52
+ ```typescript
53
+ // Look up executive by customer email
54
+ const executive = await findExecutiveByEmail(customerEmail);
55
+
56
+ // Get Ashley email address for this executive
57
+ const ashleyEmail = await getAshleyEmailForExecutive(executive.id);
58
+ ```
59
+
60
+ ### Step 4: Collate Issues by Customer
61
+ **AI Agent organizes data**:
62
+ - Group all resolved issues by customer email
63
+ - **Consolidate customers with multiple email addresses** by matching customer names (case-insensitive)
64
+ - When a customer has multiple emails, use the primary email from the database lookup
65
+ - Output customer list to console for verification
66
+
67
+ ### Step 5: Generate Single Thank-You File
68
+ **AI Agent creates ONE file**:
69
+ - File: `docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json`
70
+ - Format: Structured JSON (not markdown) for easy parsing by mail sending script
71
+ - Contains ALL customers and their personalized emails
72
+ - **AI Agent writes the email content** - be creative, personal, and contextual!
73
+ - Follow principles: personal touch, customer-focused, short and sweet, encourage feedback
74
+ - **NO TECHNICAL JARGON**: Do not mention issue numbers, BAML, internal systems, or technical details
75
+ - **CUSTOMER EXPERIENCE FOCUS**: Describe what was broken from the user's perspective, what was fixed, and how they can verify it works
76
+ - **First-person Email Body**: Use "I" for actions Ashley took (e.g., "I fixed", "I now", "I will"), not "Ashley" or "she". Sign off as Ashley.
77
+ - Include `From:` field showing Ashley email from PPE (via `getAshleyEmailForExecutive()`)
78
+
79
+ **File format** (JSON):
80
+ ```json
81
+ {
82
+ "metadata": {
83
+ "generatedOn": "2025-10-29T02:29:02.497Z",
84
+ "issuesResolvedSince": "2025-10-28",
85
+ "totalCustomers": 2,
86
+ "totalIssues": 3
87
+ },
88
+ "candidates": [
89
+ {
90
+ "customer": {
91
+ "name": "Olga Ivanova",
92
+ "email": "olga.ivanova@gmail.com"
93
+ },
94
+ "executive": {
95
+ "name": "Olga Ivanova",
96
+ "id": "exec-..."
97
+ },
98
+ "status": "pending",
99
+ "from": {
100
+ "displayName": "Ashley - Olga Ivanova's AI Executive Assistant",
101
+ "email": "ashley+olga@ashleycalendar.ai"
102
+ },
103
+ "to": "olga.ivanova@gmail.com",
104
+ "subject": "Thank you for your feedback - your issues have been addressed!",
105
+ "greeting": "Hi Olga,",
106
+ "opening": "Thank you for making me better! I wanted to personally reach out because your feedback helped us catch and fix an important bug.",
107
+ "improvements": [
108
+ {
109
+ "title": "Issue filing feature",
110
+ "description": "The issue filing feature is now working properly - when you ask me to file a bug or feature request through voice, I'll handle it correctly.",
111
+ "verification": "Try asking me to file a bug or feature request and it should work smoothly now."
112
+ }
113
+ ],
114
+ "closing": "Your quick feedback saved you (and others) frustration down the line. That kind of real-time input makes all the difference as I'm learning."
115
+ }
116
+ ]
117
+ }
118
+ ```
119
+
120
+ **Note**: The structured format allows the HTML template to format each section beautifully:
121
+ - `greeting`: Personal greeting (e.g., "Hi Olga,")
122
+ - `opening`: Opening paragraph - thanks and context
123
+ - `improvements[]`: Array of improvements (title, description, optional verification step)
124
+ - `closing`: Closing paragraph - encouraging more feedback
125
+
126
+ The HTML template formats each section with appropriate styling.
127
+
128
+ ### Step 6: User Review
129
+ **AI Agent**:
130
+ 1. **Points user to the generated file**: `docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json`
131
+ 2. **Requests review** and any edits needed (user can edit JSON directly)
132
+ 3. **Waits for user approval** before proceeding
133
+
134
+ **Note**: Each email section includes a `From:` field showing the display name and email address that will be used when sending. The signature includes a humble note about ramping up, without displaying a generic email address.
135
+
136
+ ### Step 7: Send Emails (Separate Command)
137
+ **When user says "Send the emails" or similar**:
138
+
139
+ **AI Agent calls function**:
140
+ ```typescript
141
+ // Note: Retrieve script via get_fraim_file({ path: "scripts/generate-thank-you-emails.ts" }) and save to tmp/generate-thank-you-emails.ts
142
+ import { sendCustomerMail } from './tmp/generate-thank-you-emails.ts';
143
+
144
+ // Send emails from the candidates JSON file (all pending candidates)
145
+ await sendCustomerMail('docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json');
146
+
147
+ // OR send to a specific executive only (optional)
148
+ await sendCustomerMail('docs/customer-development/thank-you-notes/thank-you-candidates-YYYY-MM-DD.json', 'exec-1761011032377-q36j91sdl');
149
+ ```
150
+
151
+ **Note**: The `sendCustomerMail` function parses JSON (not markdown) for easy, deterministic parsing.
152
+
153
+ **Function parameters**:
154
+ - `candidatesFilePath` (required): Path to the JSON candidates file
155
+ - `executiveId` (optional): If provided, only sends emails for candidates matching this executive ID. If omitted, sends to all pending candidates.
156
+
157
+ **This function will**:
158
+ - Parse the JSON candidates file
159
+ - If `executiveId` is provided, filter to only that executive's candidates
160
+ - For each candidate with `status: "pending"`, send email
161
+ - Use the `from` field (displayName and email) specified in JSON
162
+ - Use the `to`, `subject`, and `body` fields from JSON
163
+ - Update the JSON file after each send with status: `"sent"` or `"failed"`
164
+ - Skip candidates that already have status `"sent"` or `"failed"`
165
+
166
+ ## REQUIRED FUNCTIONS IN SCRIPT
167
+
168
+ The script must provide these deterministic functions for AI agents to call:
169
+
170
+ ```typescript
171
+ // Get resolved issues since a date
172
+ export async function getResolvedIssues(date: string): Promise<ResolvedIssue[]>
173
+
174
+ // Find executive by email in PPE database
175
+ export async function findExecutiveByEmail(email: string): Promise<Executive | null>
176
+
177
+ // Get Ashley email for executive from PPE database
178
+ export async function getAshleyEmailForExecutive(executiveId: string): Promise<string>
179
+
180
+ // Send emails from candidates file
181
+ // executiveId is optional - if provided, only sends to that executive; if omitted, sends to all pending
182
+ export async function sendCustomerMail(candidatesFilePath: string, executiveId?: string): Promise<void>
183
+ ```
184
+
185
+ **Note**: The script provides ONLY data retrieval and sending. The AI agent does ALL intelligent work:
186
+ - Extracts customer info from issues (intelligent parsing)
187
+ - Writes personalized, creative email content (better than hardcoded templates!)
188
+ - Organizes and formats the candidates file
189
+
190
+ ## WORKFLOW COMPLETION
191
+
192
+ **Generate workflow completes with**: Single candidates file ready for review
193
+ **Send workflow completes with**: All emails sent and file updated with status