@recapt/mcp 0.0.13-beta → 0.0.15-beta
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.
- package/dist/cli/index.js +0 -0
- package/dist/index.js +28 -1
- package/dist/tools/catalog/toolCatalog.json +2084 -4
- package/dist/tools/diagnostic.js +5 -1
- package/dist/tools/healingRun.d.ts +6 -0
- package/dist/tools/healingRun.js +313 -0
- package/dist/tools/triageSessions.js +3 -1
- package/dist/tools/upgradeOptions.d.ts +7 -0
- package/dist/tools/upgradeOptions.js +67 -0
- package/package.json +1 -1
- package/skills/self-healing.md +337 -22
- package/templates/self-healing.md +1 -1
package/skills/self-healing.md
CHANGED
|
@@ -1,13 +1,131 @@
|
|
|
1
1
|
# Recapt Self-Healing Workflow
|
|
2
2
|
|
|
3
|
-
Use this workflow when asked to "
|
|
3
|
+
Use this workflow when asked to "heal the site" or improve UX based on behavioral data from recapt.
|
|
4
4
|
|
|
5
5
|
## When to Use
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
This is a **comprehensive site improvement workflow**. Only use it when the user explicitly requests a full-site analysis:
|
|
8
|
+
|
|
9
|
+
- "Heal my site"
|
|
10
|
+
- "Run the self-healing workflow"
|
|
11
|
+
- "Analyze my whole site and improve it"
|
|
12
|
+
- "Do a full UX audit"
|
|
13
|
+
- "Make general improvements across the site"
|
|
14
|
+
**Do NOT use this workflow for:**
|
|
15
|
+
- Specific page fixes ("fix the checkout button")
|
|
16
|
+
- Single flow optimization ("improve the signup funnel")
|
|
17
|
+
- Investigating a specific issue ("why are users rage clicking here?")
|
|
18
|
+
For specific requests, use the appropriate tools directly — let the conversation guide which tools to call.
|
|
19
|
+
|
|
20
|
+
## Run Tracking
|
|
21
|
+
|
|
22
|
+
At the start of each healing session, register the run to track progress and outcomes:
|
|
23
|
+
|
|
24
|
+
- Search: "healing run" → `start_healing_run`, `update_healing_run`, `record_healing_action`
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
const response = await start_healing_run({
|
|
28
|
+
trigger_type: "manual", // or "github_actions", "cron", "api"
|
|
29
|
+
trigger_metadata: { ... }, // optional: branch, actor, etc.
|
|
30
|
+
phases: [
|
|
31
|
+
{ name: "diagnose", status: "pending" },
|
|
32
|
+
{ name: "investigate", status: "pending" },
|
|
33
|
+
{ name: "fix", status: "pending" },
|
|
34
|
+
{ name: "track", status: "pending" }
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// IMPORTANT: Extract the run ID from the response
|
|
39
|
+
const run_id = response.id; // e.g., "682d1a2b3c4d5e6f7a8b9c0d"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This creates a run record visible in the Healing Runs UI. **You must update the run as you progress through each phase.**
|
|
43
|
+
|
|
44
|
+
### Phase Progress Updates
|
|
45
|
+
|
|
46
|
+
Update the run status at each phase transition. Always pass the complete phases array with updated statuses:
|
|
47
|
+
|
|
48
|
+
**After starting diagnose:**
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
update_healing_run({
|
|
52
|
+
run_id: "<run_id>",
|
|
53
|
+
phases: [
|
|
54
|
+
{ name: "diagnose", status: "running", startedAt: new Date().toISOString() },
|
|
55
|
+
{ name: "investigate", status: "pending" },
|
|
56
|
+
{ name: "fix", status: "pending" },
|
|
57
|
+
{ name: "track", status: "pending" }
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**After completing diagnose (before investigate):**
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
update_healing_run({
|
|
66
|
+
run_id: "<run_id>",
|
|
67
|
+
phases: [
|
|
68
|
+
{ name: "diagnose", status: "completed", completedAt: new Date().toISOString(), output: { issuesFound: 5, opportunitiesFound: 3 } },
|
|
69
|
+
{ name: "investigate", status: "running", startedAt: new Date().toISOString() },
|
|
70
|
+
{ name: "fix", status: "pending" },
|
|
71
|
+
{ name: "track", status: "pending" }
|
|
72
|
+
],
|
|
73
|
+
summary: { issuesFound: 5 }
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**After completing investigate (before fix):**
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
update_healing_run({
|
|
81
|
+
run_id: "<run_id>",
|
|
82
|
+
phases: [
|
|
83
|
+
{ name: "diagnose", status: "completed", completedAt: "...", output: { ... } },
|
|
84
|
+
{ name: "investigate", status: "completed", completedAt: new Date().toISOString(), output: { issuesInvestigated: 5, issuesValidated: 4 } },
|
|
85
|
+
{ name: "fix", status: "running", startedAt: new Date().toISOString() },
|
|
86
|
+
{ name: "track", status: "pending" }
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**After completing fix (before track):**
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
update_healing_run({
|
|
95
|
+
run_id: "<run_id>",
|
|
96
|
+
phases: [
|
|
97
|
+
{ name: "diagnose", status: "completed", completedAt: "...", output: { ... } },
|
|
98
|
+
{ name: "investigate", status: "completed", completedAt: "...", output: { ... } },
|
|
99
|
+
{ name: "fix", status: "completed", completedAt: new Date().toISOString(), output: { fixesApplied: 3, prsCreated: 2 } },
|
|
100
|
+
{ name: "track", status: "running", startedAt: new Date().toISOString() }
|
|
101
|
+
],
|
|
102
|
+
summary: { issuesFound: 5, issuesFixed: 3, prsCreated: 2 }
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**After completing track (run complete):**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
update_healing_run({
|
|
110
|
+
run_id: "<run_id>",
|
|
111
|
+
status: "completed",
|
|
112
|
+
completed_at: new Date().toISOString(),
|
|
113
|
+
duration_ms: <elapsed_time>,
|
|
114
|
+
phases: [
|
|
115
|
+
{ name: "diagnose", status: "completed", completedAt: "...", output: { ... } },
|
|
116
|
+
{ name: "investigate", status: "completed", completedAt: "...", output: { ... } },
|
|
117
|
+
{ name: "fix", status: "completed", completedAt: "...", output: { ... } },
|
|
118
|
+
{ name: "track", status: "completed", completedAt: new Date().toISOString(), output: { deploymentsConfirmed: 2 } }
|
|
119
|
+
],
|
|
120
|
+
summary: {
|
|
121
|
+
issuesFound: 5,
|
|
122
|
+
issuesFixed: 3,
|
|
123
|
+
issuesDeferred: 1,
|
|
124
|
+
issuesDismissed: 1,
|
|
125
|
+
prsCreated: 2
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
```
|
|
11
129
|
|
|
12
130
|
## Workflow
|
|
13
131
|
|
|
@@ -33,42 +151,173 @@ If fixes have sufficient data:
|
|
|
33
151
|
|
|
34
152
|
### 1. Diagnose
|
|
35
153
|
|
|
154
|
+
**Update phase status to "running" before starting.**
|
|
155
|
+
|
|
36
156
|
Start with `run_full_diagnostic` (always available) to get a prioritized list of issues across the site.
|
|
37
157
|
|
|
38
|
-
|
|
158
|
+
After diagnosis completes, **update the phase to "completed"** and set `summary.issuesFound`.
|
|
159
|
+
|
|
160
|
+
### 2. Analyze Flows
|
|
161
|
+
|
|
162
|
+
After diagnosing issues, proactively look for flow optimization opportunities — even when nothing is "broken."
|
|
163
|
+
|
|
164
|
+
#### 2a. Discover Journey Patterns
|
|
165
|
+
|
|
166
|
+
- Search: "journey patterns" → `get_journey_patterns`
|
|
167
|
+
- Look for:
|
|
168
|
+
- **Backtrack hotspots** — pages users return to repeatedly (signals confusion or missing information)
|
|
169
|
+
- **Dropoff pages** — where sessions end unexpectedly (potential conversion leaks)
|
|
170
|
+
- **Unexpected paths** — users taking roundabout routes to reach goals
|
|
171
|
+
|
|
172
|
+
#### 2b. Analyze Key Funnels
|
|
173
|
+
|
|
174
|
+
- Search: "analyze funnel" → `analyze_funnel`
|
|
175
|
+
- Analyze critical conversion paths:
|
|
176
|
+
- Landing → Signup/Trial
|
|
177
|
+
- Pricing → Checkout → Success
|
|
178
|
+
- Onboarding flows
|
|
179
|
+
- For each funnel step, note:
|
|
180
|
+
- Dropoff rate (>30% is a red flag)
|
|
181
|
+
- Frustration/confusion scores
|
|
182
|
+
- Dwell time anomalies
|
|
183
|
+
|
|
184
|
+
#### 2c. Analyze Specific Flows
|
|
185
|
+
|
|
186
|
+
- Search: "analyze flow" → `analyze_flow`, `get_flow_friction`
|
|
187
|
+
- For pages with high dropoff or backtracking, analyze the flow in detail:
|
|
188
|
+
- What's the success rate for users entering this flow?
|
|
189
|
+
- Where are the bottlenecks?
|
|
190
|
+
- What's the friction score at each step?
|
|
191
|
+
|
|
192
|
+
#### 2d. Understand User Segments
|
|
193
|
+
|
|
194
|
+
- Search: "personas" → `discover_personas`
|
|
195
|
+
- Identify behavioral personas:
|
|
196
|
+
- Which personas struggle most?
|
|
197
|
+
- What are their risk factors?
|
|
198
|
+
- What interventions are recommended?
|
|
199
|
+
|
|
200
|
+
#### 2e. Compare Success vs Failure
|
|
201
|
+
|
|
202
|
+
- Search: "compare cohorts" → `compare_cohorts`
|
|
203
|
+
- For flows with low conversion, compare:
|
|
204
|
+
- Users who completed vs dropped off
|
|
205
|
+
- Users on mobile vs desktop
|
|
206
|
+
- New vs returning users
|
|
207
|
+
- Look for patterns: What do successful users do differently?
|
|
208
|
+
|
|
209
|
+
#### Presenting Flow Opportunities
|
|
39
210
|
|
|
40
|
-
|
|
211
|
+
Present opportunities alongside issues, clearly labeled:
|
|
212
|
+
|
|
213
|
+
> **Issues Found:**
|
|
214
|
+
>
|
|
215
|
+
> 1. [CRITICAL] Rage clicks on checkout button — JS error
|
|
216
|
+
> 2. [HIGH] Dead clicks on pricing toggle
|
|
217
|
+
>
|
|
218
|
+
> **Flow Optimization Opportunities:**
|
|
219
|
+
>
|
|
220
|
+
> 1. [OPPORTUNITY] 40% backtrack from /pricing to /features — consider adding feature comparison on pricing page
|
|
221
|
+
> 2. [OPPORTUNITY] 65% dropoff at step 2 of onboarding — simplify or add progress indicator
|
|
222
|
+
> 3. [OPPORTUNITY] Mobile users 3x more likely to abandon checkout — review mobile UX
|
|
223
|
+
|
|
224
|
+
### 3. Investigate
|
|
225
|
+
|
|
226
|
+
**Update phase status: mark "diagnose" as completed, "investigate" as running.**
|
|
227
|
+
|
|
228
|
+
For each high-priority issue or opportunity, search for investigation tools:
|
|
41
229
|
|
|
42
230
|
- Search: "investigate issue" → `investigate_issue`, `validate_issue`
|
|
43
231
|
- This provides detailed context: affected sessions, element interactions, timing patterns
|
|
44
232
|
|
|
45
|
-
|
|
233
|
+
For flow opportunities, also consider:
|
|
234
|
+
|
|
235
|
+
- Watching session replays of users who dropped off vs completed
|
|
236
|
+
- Checking element friction on high-dropoff pages
|
|
237
|
+
|
|
238
|
+
### 4. Triage
|
|
46
239
|
|
|
47
240
|
Present findings to the user. Not all detected issues need fixing:
|
|
48
241
|
|
|
49
242
|
- Search: "dismiss issue" → `dismiss_issue`, `mark_intended_behavior`
|
|
50
243
|
- Some behaviors are intentional (e.g., rage clicks on a "copy" button)
|
|
51
|
-
-
|
|
244
|
+
- Some flow patterns may be acceptable (e.g., users comparing options before deciding)
|
|
245
|
+
- Ask the user which issues and opportunities to address before proceeding
|
|
246
|
+
|
|
247
|
+
**After triage, update phase status: mark "investigate" as completed, "fix" as running.**
|
|
52
248
|
|
|
53
|
-
###
|
|
249
|
+
### 5. Fix
|
|
54
250
|
|
|
55
|
-
Implement code changes to address
|
|
251
|
+
Implement code changes to address issues and opportunities. After making changes:
|
|
56
252
|
|
|
57
253
|
- Search: "propose fix" → `propose_fix`, `get_similar_fixes`, `get_fix_history`
|
|
58
254
|
- Log the remediation so recapt can track its effectiveness
|
|
59
255
|
|
|
60
|
-
|
|
256
|
+
**Note:** `propose_fix` accepts either `issue_id` (for formal issues) or `page_path` + `element_selector` (for element friction fixes without a formal issue).
|
|
257
|
+
|
|
258
|
+
**Record each action in the healing run:**
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
record_healing_action({
|
|
262
|
+
run_id: "<run_id>",
|
|
263
|
+
issue_id: "<issue_id>", // optional - omit for element friction fixes
|
|
264
|
+
action_type: "code_fix", // or "needs_more_data", "dismissed", "marked_intended"
|
|
265
|
+
hypothesis: "The checkout button is unresponsive due to a JS error...",
|
|
266
|
+
expected_improvement: "Fixing the error handler should reduce rage clicks by 50%",
|
|
267
|
+
code_changes: [{ file: "checkout.tsx", diff: "...", linesAdded: 5, linesRemoved: 2 }],
|
|
268
|
+
pr_url: "https://github.com/...",
|
|
269
|
+
pr_number: 123,
|
|
270
|
+
remediation_id: "<remediation_id>" // from propose_fix response.id
|
|
271
|
+
})
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
For flow optimizations, common fixes include:
|
|
275
|
+
|
|
276
|
+
- Adding missing information to reduce backtracking
|
|
277
|
+
- Simplifying forms to reduce abandonment
|
|
278
|
+
- Adding progress indicators to multi-step flows
|
|
279
|
+
- Improving CTAs and visual hierarchy
|
|
280
|
+
- Adding social proof or trust signals at decision points
|
|
281
|
+
|
|
282
|
+
### 6. Track
|
|
283
|
+
|
|
284
|
+
**Update phase status: mark "fix" as completed, "track" as running.**
|
|
61
285
|
|
|
62
286
|
Mark fixes as deployed so recapt can measure impact:
|
|
63
287
|
|
|
64
288
|
- Search: "deployment" → `confirm_deployment`, `evaluate_fix`, `list_pending_fixes`
|
|
65
289
|
|
|
66
|
-
|
|
290
|
+
**Complete the healing run when done:**
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
update_healing_run({
|
|
294
|
+
run_id: "<run_id>",
|
|
295
|
+
status: "completed",
|
|
296
|
+
completed_at: new Date().toISOString(),
|
|
297
|
+
duration_ms: <elapsed_time>,
|
|
298
|
+
phases: [
|
|
299
|
+
{ name: "diagnose", status: "completed", ... },
|
|
300
|
+
{ name: "investigate", status: "completed", ... },
|
|
301
|
+
{ name: "fix", status: "completed", ... },
|
|
302
|
+
{ name: "track", status: "completed", completedAt: new Date().toISOString() }
|
|
303
|
+
],
|
|
304
|
+
summary: {
|
|
305
|
+
issuesFound: 5,
|
|
306
|
+
issuesFixed: 3,
|
|
307
|
+
issuesDeferred: 1,
|
|
308
|
+
issuesDismissed: 1,
|
|
309
|
+
prsCreated: 2
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### 7. Learn
|
|
67
315
|
|
|
68
316
|
Build site knowledge for future reference:
|
|
69
317
|
|
|
70
318
|
- Search: "site knowledge" → `get_site_knowledge`, `add_site_knowledge`
|
|
71
319
|
- Document patterns, intended behaviors, and architectural decisions
|
|
320
|
+
- Record successful flow optimizations for future reference
|
|
72
321
|
|
|
73
322
|
## Post-Fix Behavior
|
|
74
323
|
|
|
@@ -84,12 +333,78 @@ If the user agrees:
|
|
|
84
333
|
|
|
85
334
|
## Tool Discovery Reference
|
|
86
335
|
|
|
87
|
-
| Phase | Search Query | Tools
|
|
88
|
-
| ------------- | ------------------- |
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
336
|
+
| Phase | Search Query | Tools |
|
|
337
|
+
| ------------- | ------------------- | --------------------------------------------------------------------------------------- |
|
|
338
|
+
| Run Tracking | "healing run" | `start_healing_run`, `update_healing_run`, `record_healing_action`, `list_healing_runs` |
|
|
339
|
+
| Check Pending | "pending fixes" | `list_pending_fixes`, `evaluate_fix` |
|
|
340
|
+
| Diagnose | (always available) | `run_full_diagnostic` |
|
|
341
|
+
| Journey | "journey patterns" | `get_journey_patterns` |
|
|
342
|
+
| Funnels | "analyze funnel" | `analyze_funnel` |
|
|
343
|
+
| Flows | "analyze flow" | `analyze_flow`, `get_flow_friction` |
|
|
344
|
+
| Personas | "personas" | `discover_personas` |
|
|
345
|
+
| Compare | "compare cohorts" | `compare_cohorts` |
|
|
346
|
+
| Investigate | "investigate issue" | `investigate_issue`, `validate_issue` |
|
|
347
|
+
| Triage | "dismiss issue" | `dismiss_issue`, `mark_intended_behavior` |
|
|
348
|
+
| Fix | "propose fix" | `propose_fix`, `get_similar_fixes`, `get_fix_history` |
|
|
349
|
+
| Track | "deployment" | `confirm_deployment`, `evaluate_fix`, `list_pending_fixes` |
|
|
350
|
+
| Learn | "site knowledge" | `get_site_knowledge`, `add_site_knowledge` |
|
|
351
|
+
|
|
352
|
+
## Response Formats
|
|
353
|
+
|
|
354
|
+
Healing run tools return objects with an `id` field. Extract and store these IDs for subsequent calls.
|
|
355
|
+
|
|
356
|
+
**Note:** Response formats for `propose_fix` and `add_site_knowledge` are documented in their tool descriptions (discoverable via `search_tools`).
|
|
357
|
+
|
|
358
|
+
### start_healing_run
|
|
359
|
+
|
|
360
|
+
```json
|
|
361
|
+
{
|
|
362
|
+
"id": "682d1a2b3c4d5e6f7a8b9c0d",
|
|
363
|
+
"status": "running",
|
|
364
|
+
"trigger": { "type": "manual", "metadata": {} },
|
|
365
|
+
"phases": [
|
|
366
|
+
{
|
|
367
|
+
"name": "diagnose",
|
|
368
|
+
"status": "pending",
|
|
369
|
+
"startedAt": null,
|
|
370
|
+
"completedAt": null,
|
|
371
|
+
"output": {}
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
"summary": {
|
|
375
|
+
"issuesFound": 0,
|
|
376
|
+
"issuesFixed": 0,
|
|
377
|
+
"issuesDeferred": 0,
|
|
378
|
+
"issuesDismissed": 0,
|
|
379
|
+
"prsCreated": 0
|
|
380
|
+
},
|
|
381
|
+
"startedAt": "2026-04-26T19:00:00.000Z",
|
|
382
|
+
"completedAt": null,
|
|
383
|
+
"durationMs": null,
|
|
384
|
+
"createdAt": "2026-04-26T19:00:00.000Z"
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
**Extract:** `response.id` → use as `run_id` in `update_healing_run` and `record_healing_action`
|
|
389
|
+
|
|
390
|
+
### record_healing_action
|
|
391
|
+
|
|
392
|
+
```json
|
|
393
|
+
{
|
|
394
|
+
"id": "682d1a2b3c4d5e6f7a8b9c11",
|
|
395
|
+
"healingRunId": "682d1a2b3c4d5e6f7a8b9c0d",
|
|
396
|
+
"issueId": "682d1a2b3c4d5e6f7a8b9c0f",
|
|
397
|
+
"actionType": "code_fix",
|
|
398
|
+
"outcome": {
|
|
399
|
+
"hypothesis": "...",
|
|
400
|
+
"expectedImprovement": "...",
|
|
401
|
+
"codeChanges": [...],
|
|
402
|
+
"prUrl": "https://github.com/...",
|
|
403
|
+
"prNumber": 123
|
|
404
|
+
},
|
|
405
|
+
"remediationId": "682d1a2b3c4d5e6f7a8b9c0e",
|
|
406
|
+
"createdAt": "2026-04-26T19:45:00.000Z"
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Note:** This automatically increments the run's summary counters based on `action_type`.
|