@recapt/mcp 0.0.16-beta → 0.0.18-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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Diagnostic tools for self-healing workflow.
2
+ * Diagnostic tools for self-improvement workflow.
3
3
  *
4
4
  * Provides comprehensive site diagnostics, issue investigation, and validation.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Diagnostic tools for self-healing workflow.
2
+ * Diagnostic tools for self-improvement workflow.
3
3
  *
4
4
  * Provides comprehensive site diagnostics, issue investigation, and validation.
5
5
  */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Improvement Run tools for tracking self-improvement workflow executions.
3
+ *
4
+ * Provides run registration, phase updates, action recording, and run listing.
5
+ */
6
+ export declare function registerImprovementRunTools(server: any): void;
@@ -1,18 +1,18 @@
1
1
  /**
2
- * Healing Run tools for tracking self-healing workflow executions.
2
+ * Improvement Run tools for tracking self-improvement workflow executions.
3
3
  *
4
4
  * Provides run registration, phase updates, action recording, and run listing.
5
5
  */
6
6
  import { z } from "zod";
7
7
  import { apiGet, apiPost, apiPatch, isApiConfigured } from "../api/client.js";
8
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- export function registerHealingRunTools(server) {
10
- server.registerTool("start_healing_run", {
11
- description: "Register the start of a self-healing workflow run. Call this at the beginning of a healing session to track the run and its outcomes. Returns a run ID to use for subsequent updates.",
9
+ export function registerImprovementRunTools(server) {
10
+ server.registerTool("start_improvement_run", {
11
+ description: "Register the start of a self-improvement workflow run. Call this at the beginning of an improvement session to track the run and its outcomes. Returns a run ID to use for subsequent updates.",
12
12
  inputSchema: z.object({
13
13
  trigger_type: z
14
14
  .enum(["github_actions", "cron", "manual", "api"])
15
- .describe("What triggered this healing run"),
15
+ .describe("What triggered this improvement run"),
16
16
  trigger_metadata: z
17
17
  .record(z.unknown())
18
18
  .optional()
@@ -39,7 +39,7 @@ export function registerHealingRunTools(server) {
39
39
  isError: true,
40
40
  };
41
41
  }
42
- const { data, error } = await apiPost("/healing-runs", {
42
+ const { data, error } = await apiPost("/improvement-runs", {
43
43
  trigger_type,
44
44
  trigger_metadata,
45
45
  phases,
@@ -52,10 +52,10 @@ export function registerHealingRunTools(server) {
52
52
  }
53
53
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
54
54
  });
55
- server.registerTool("update_healing_run", {
56
- description: "Update a healing run's status, phases, or summary. Use to track progress through the workflow phases and record final outcomes.",
55
+ server.registerTool("update_improvement_run", {
56
+ description: "Update an improvement run's status, phases, or summary. Use to track progress through the workflow phases and record final outcomes.",
57
57
  inputSchema: z.object({
58
- run_id: z.string().describe("The ID of the healing run to update"),
58
+ run_id: z.string().describe("The ID of the improvement run to update"),
59
59
  status: z
60
60
  .enum(["running", "completed", "failed", "cancelled"])
61
61
  .optional()
@@ -107,7 +107,7 @@ export function registerHealingRunTools(server) {
107
107
  isError: true,
108
108
  };
109
109
  }
110
- const { data, error } = await apiPatch(`/healing-runs/${run_id}`, {
110
+ const { data, error } = await apiPatch(`/improvement-runs/${run_id}`, {
111
111
  status,
112
112
  phases,
113
113
  summary,
@@ -122,12 +122,12 @@ export function registerHealingRunTools(server) {
122
122
  }
123
123
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
124
124
  });
125
- server.registerTool("record_healing_action", {
126
- description: "Record an action taken during a healing run. Use to track what was done for each issue: code fixes, deferrals, dismissals, etc. " +
125
+ server.registerTool("record_improvement_action", {
126
+ description: "Record an action taken during an improvement run. Use to track what was done for each issue: code fixes, deferrals, dismissals, etc. " +
127
127
  "IMPORTANT: When recording code_fix actions, the code_changes.diff field must contain ACTUAL SOURCE CODE in unified diff format, " +
128
128
  "not a description of what changed. Include the literal code lines with proper +/- prefixes.",
129
129
  inputSchema: z.object({
130
- run_id: z.string().describe("The ID of the healing run"),
130
+ run_id: z.string().describe("The ID of the improvement run"),
131
131
  issue_id: z
132
132
  .string()
133
133
  .optional()
@@ -216,7 +216,7 @@ export function registerHealingRunTools(server) {
216
216
  isError: true,
217
217
  };
218
218
  }
219
- const { data, error } = await apiPost(`/healing-runs/${run_id}/actions`, {
219
+ const { data, error } = await apiPost(`/improvement-runs/${run_id}/actions`, {
220
220
  issue_id,
221
221
  action_type,
222
222
  hypothesis,
@@ -236,10 +236,12 @@ export function registerHealingRunTools(server) {
236
236
  }
237
237
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
238
238
  });
239
- server.registerTool("get_healing_run", {
240
- description: "Get details of a specific healing run including all actions taken. Use to review what happened during a run.",
239
+ server.registerTool("get_improvement_run", {
240
+ description: "Get details of a specific improvement run including all actions taken. Use to review what happened during a run.",
241
241
  inputSchema: z.object({
242
- run_id: z.string().describe("The ID of the healing run to retrieve"),
242
+ run_id: z
243
+ .string()
244
+ .describe("The ID of the improvement run to retrieve"),
243
245
  }),
244
246
  }, async ({ run_id }) => {
245
247
  if (!isApiConfigured()) {
@@ -253,7 +255,7 @@ export function registerHealingRunTools(server) {
253
255
  isError: true,
254
256
  };
255
257
  }
256
- const { data, error } = await apiGet(`/healing-runs/${run_id}`);
258
+ const { data, error } = await apiGet(`/improvement-runs/${run_id}`);
257
259
  if (error) {
258
260
  return {
259
261
  content: [{ type: "text", text: JSON.stringify({ error }) }],
@@ -262,8 +264,8 @@ export function registerHealingRunTools(server) {
262
264
  }
263
265
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
264
266
  });
265
- server.registerTool("list_healing_runs", {
266
- description: "List recent healing runs with optional filters. Use to review past runs and their outcomes.",
267
+ server.registerTool("list_improvement_runs", {
268
+ description: "List recent improvement runs with optional filters. Use to review past runs and their outcomes.",
267
269
  inputSchema: z.object({
268
270
  status: z
269
271
  .enum(["running", "completed", "failed", "cancelled"])
@@ -296,7 +298,7 @@ export function registerHealingRunTools(server) {
296
298
  isError: true,
297
299
  };
298
300
  }
299
- const { data, error } = await apiGet("/healing-runs", {
301
+ const { data, error } = await apiGet("/improvement-runs", {
300
302
  status,
301
303
  trigger_type,
302
304
  limit: limit ?? 20,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Knowledge tools for self-healing workflow.
2
+ * Knowledge tools for self-improvement workflow.
3
3
  *
4
4
  * Provides site-specific knowledge management for learning from past fixes.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Knowledge tools for self-healing workflow.
2
+ * Knowledge tools for self-improvement workflow.
3
3
  *
4
4
  * Provides site-specific knowledge management for learning from past fixes.
5
5
  */
@@ -24,7 +24,7 @@ const ISSUE_CATEGORIES = [
24
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
25
  export function registerKnowledgeTools(server) {
26
26
  server.registerTool("get_site_knowledge", {
27
- description: "Retrieve site-specific learnings including known false positives, intended behaviors, and successful fix patterns. Use at the start of a self-healing workflow to avoid re-flagging known issues.",
27
+ description: "Retrieve site-specific learnings including known false positives, intended behaviors, and successful fix patterns. Use at the start of a self-improvement workflow to avoid re-flagging known issues.",
28
28
  inputSchema: z.object({
29
29
  category: z
30
30
  .enum(KNOWLEDGE_CATEGORIES)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Remediation tools for self-healing workflow.
2
+ * Remediation tools for self-improvement workflow.
3
3
  *
4
4
  * Provides fix proposal, deployment confirmation, evaluation, and history tracking.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Remediation tools for self-healing workflow.
2
+ * Remediation tools for self-improvement workflow.
3
3
  *
4
4
  * Provides fix proposal, deployment confirmation, evaluation, and history tracking.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Triage tools for self-healing workflow.
2
+ * Triage tools for self-improvement workflow.
3
3
  *
4
4
  * Provides issue dismissal, marking intended behavior, and issue history.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Triage tools for self-healing workflow.
2
+ * Triage tools for self-improvement workflow.
3
3
  *
4
4
  * Provides issue dismissal, marking intended behavior, and issue history.
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recapt/mcp",
3
- "version": "0.0.16-beta",
3
+ "version": "0.0.18-beta",
4
4
  "description": "MCP exposing recapt behavioral intelligence to AI coding agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,13 +1,13 @@
1
- # Recapt Self-Healing Workflow
1
+ # Recapt Self-Improvement Workflow
2
2
 
3
- Use this workflow when asked to "heal the site" or improve UX based on behavioral data from recapt.
3
+ Use this workflow when asked to "improve the site" or enhance UX based on behavioral data from recapt.
4
4
 
5
5
  ## When to Use
6
6
 
7
7
  This is a **comprehensive site improvement workflow**. Only use it when the user explicitly requests a full-site analysis:
8
8
 
9
- - "Heal my site"
10
- - "Run the self-healing workflow"
9
+ - "Improve my site"
10
+ - "Run the self-improvement workflow"
11
11
  - "Analyze my whole site and improve it"
12
12
  - "Do a full UX audit"
13
13
  - "Make general improvements across the site"
@@ -19,12 +19,12 @@ This is a **comprehensive site improvement workflow**. Only use it when the user
19
19
 
20
20
  ## Run Tracking
21
21
 
22
- At the start of each healing session, register the run to track progress and outcomes:
22
+ At the start of each improvement session, register the run to track progress and outcomes:
23
23
 
24
- - Search: "healing run" → `start_healing_run`, `update_healing_run`, `record_healing_action`
24
+ - Search: "improvement run" → `start_improvement_run`, `update_improvement_run`, `record_improvement_action`
25
25
 
26
26
  ```
27
- const response = await start_healing_run({
27
+ const response = await start_improvement_run({
28
28
  trigger_type: "manual", // or "github_actions", "cron", "api"
29
29
  trigger_metadata: { ... }, // optional: branch, actor, etc.
30
30
  phases: [
@@ -39,7 +39,7 @@ const response = await start_healing_run({
39
39
  const run_id = response.id; // e.g., "682d1a2b3c4d5e6f7a8b9c0d"
40
40
  ```
41
41
 
42
- This creates a run record visible in the Healing Runs UI. **You must update the run as you progress through each phase.**
42
+ This creates a run record visible in the Improvement Runs UI. **You must update the run as you progress through each phase.**
43
43
 
44
44
  ### Phase Progress Updates
45
45
 
@@ -48,7 +48,7 @@ Update the run status at each phase transition. Always pass the complete phases
48
48
  **After starting diagnose:**
49
49
 
50
50
  ```
51
- update_healing_run({
51
+ update_improvement_run({
52
52
  run_id: "<run_id>",
53
53
  phases: [
54
54
  { name: "diagnose", status: "running", startedAt: new Date().toISOString() },
@@ -62,7 +62,7 @@ update_healing_run({
62
62
  **After completing diagnose (before investigate):**
63
63
 
64
64
  ```
65
- update_healing_run({
65
+ update_improvement_run({
66
66
  run_id: "<run_id>",
67
67
  phases: [
68
68
  { name: "diagnose", status: "completed", completedAt: new Date().toISOString(), output: { issuesFound: 5, opportunitiesFound: 3 } },
@@ -77,7 +77,7 @@ update_healing_run({
77
77
  **After completing investigate (before fix):**
78
78
 
79
79
  ```
80
- update_healing_run({
80
+ update_improvement_run({
81
81
  run_id: "<run_id>",
82
82
  phases: [
83
83
  { name: "diagnose", status: "completed", completedAt: "...", output: { ... } },
@@ -91,7 +91,7 @@ update_healing_run({
91
91
  **After completing fix (before track):**
92
92
 
93
93
  ```
94
- update_healing_run({
94
+ update_improvement_run({
95
95
  run_id: "<run_id>",
96
96
  phases: [
97
97
  { name: "diagnose", status: "completed", completedAt: "...", output: { ... } },
@@ -106,7 +106,7 @@ update_healing_run({
106
106
  **After completing track (run complete):**
107
107
 
108
108
  ```
109
- update_healing_run({
109
+ update_improvement_run({
110
110
  run_id: "<run_id>",
111
111
  status: "completed",
112
112
  completed_at: new Date().toISOString(),
@@ -255,22 +255,58 @@ Implement code changes to address issues and opportunities. After making changes
255
255
 
256
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
257
 
258
- **Record each action in the healing run:**
258
+ **Record each action in the improvement run.** You MUST call `record_improvement_action` for EVERY issue — whether fixed, deferred, or dismissed. The UI tabs are populated from these action records, not from the summary counters.
259
+
260
+ **For code fixes:**
259
261
 
260
262
  ```
261
- record_healing_action({
263
+ record_improvement_action({
262
264
  run_id: "<run_id>",
263
265
  issue_id: "<issue_id>", // optional - omit for element friction fixes
264
- action_type: "code_fix", // or "needs_more_data", "dismissed", "marked_intended"
266
+ action_type: "code_fix",
265
267
  hypothesis: "The checkout button is unresponsive due to a JS error...",
266
268
  expected_improvement: "Fixing the error handler should reduce rage clicks by 50%",
267
- code_changes: [{ file: "checkout.tsx", diff: "...", linesAdded: 5, linesRemoved: 2 }],
269
+ code_changes: [{
270
+ file: "src/components/Checkout.tsx",
271
+ startLine: 45, // line number where the change starts
272
+ linesAdded: 5,
273
+ linesRemoved: 2,
274
+ diff: "@@ -45,7 +45,10 @@\n- const handleClick = () => {\n+ const handleClick = async () => {\n+ try {\n await processPayment();\n+ } catch (err) {\n+ setError(err.message);\n+ }\n };"
275
+ }],
268
276
  pr_url: "https://github.com/...",
269
277
  pr_number: 123,
270
278
  remediation_id: "<remediation_id>" // from propose_fix response.id
271
279
  })
272
280
  ```
273
281
 
282
+ **CRITICAL: The `diff` field must contain actual unified diff format** (like `git diff` output), NOT a description of what changed. Include the `@@` hunk header, `-` for removed lines, `+` for added lines. The UI renders this as a syntax-highlighted diff viewer.
283
+
284
+ **For deferred issues (needs more data):**
285
+
286
+ ```
287
+ record_improvement_action({
288
+ run_id: "<run_id>",
289
+ issue_id: "<issue_id>",
290
+ action_type: "needs_more_data",
291
+ hypothesis: "Users may be rage-clicking the save button, but only 3 sessions show this pattern.",
292
+ expected_improvement: "With more data, we can confirm if this is a real issue or noise.",
293
+ deferral_reason: "Only 3 sessions in the last 7 days. Need at least 10 sessions to validate."
294
+ })
295
+ ```
296
+
297
+ **For dismissed issues:**
298
+
299
+ ```
300
+ record_improvement_action({
301
+ run_id: "<run_id>",
302
+ issue_id: "<issue_id>",
303
+ action_type: "dismissed", // or "marked_intended"
304
+ hypothesis: "Rage clicks detected on the copy-to-clipboard button.",
305
+ expected_improvement: "N/A - this is expected behavior.",
306
+ dismissal_reason: "Users click multiple times to confirm the copy action. This is intentional UX."
307
+ })
308
+ ```
309
+
274
310
  For flow optimizations, common fixes include:
275
311
 
276
312
  - Adding missing information to reduce backtracking
@@ -287,10 +323,10 @@ Mark fixes as deployed so recapt can measure impact:
287
323
 
288
324
  - Search: "deployment" → `confirm_deployment`, `evaluate_fix`, `list_pending_fixes`
289
325
 
290
- **Complete the healing run when done:**
326
+ **Complete the improvement run when done:**
291
327
 
292
328
  ```
293
- update_healing_run({
329
+ update_improvement_run({
294
330
  run_id: "<run_id>",
295
331
  status: "completed",
296
332
  completed_at: new Date().toISOString(),
@@ -333,29 +369,29 @@ If the user agrees:
333
369
 
334
370
  ## Tool Discovery Reference
335
371
 
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` |
372
+ | Phase | Search Query | Tools |
373
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------- |
374
+ | Run Tracking | "improvement run" | `start_improvement_run`, `update_improvement_run`, `record_improvement_action`, `list_improvement_runs` |
375
+ | Check Pending | "pending fixes" | `list_pending_fixes`, `evaluate_fix` |
376
+ | Diagnose | (always available) | `run_full_diagnostic` |
377
+ | Journey | "journey patterns" | `get_journey_patterns` |
378
+ | Funnels | "analyze funnel" | `analyze_funnel` |
379
+ | Flows | "analyze flow" | `analyze_flow`, `get_flow_friction` |
380
+ | Personas | "personas" | `discover_personas` |
381
+ | Compare | "compare cohorts" | `compare_cohorts` |
382
+ | Investigate | "investigate issue" | `investigate_issue`, `validate_issue` |
383
+ | Triage | "dismiss issue" | `dismiss_issue`, `mark_intended_behavior` |
384
+ | Fix | "propose fix" | `propose_fix`, `get_similar_fixes`, `get_fix_history` |
385
+ | Track | "deployment" | `confirm_deployment`, `evaluate_fix`, `list_pending_fixes` |
386
+ | Learn | "site knowledge" | `get_site_knowledge`, `add_site_knowledge` |
351
387
 
352
388
  ## Response Formats
353
389
 
354
- Healing run tools return objects with an `id` field. Extract and store these IDs for subsequent calls.
390
+ Improvement run tools return objects with an `id` field. Extract and store these IDs for subsequent calls.
355
391
 
356
392
  **Note:** Response formats for `propose_fix` and `add_site_knowledge` are documented in their tool descriptions (discoverable via `search_tools`).
357
393
 
358
- ### start_healing_run
394
+ ### start_improvement_run
359
395
 
360
396
  ```json
361
397
  {
@@ -385,14 +421,14 @@ Healing run tools return objects with an `id` field. Extract and store these IDs
385
421
  }
386
422
  ```
387
423
 
388
- **Extract:** `response.id` → use as `run_id` in `update_healing_run` and `record_healing_action`
424
+ **Extract:** `response.id` → use as `run_id` in `update_improvement_run` and `record_improvement_action`
389
425
 
390
- ### record_healing_action
426
+ ### record_improvement_action
391
427
 
392
428
  ```json
393
429
  {
394
430
  "id": "682d1a2b3c4d5e6f7a8b9c11",
395
- "healingRunId": "682d1a2b3c4d5e6f7a8b9c0d",
431
+ "improvementRunId": "682d1a2b3c4d5e6f7a8b9c0d",
396
432
  "issueId": "682d1a2b3c4d5e6f7a8b9c0f",
397
433
  "actionType": "code_fix",
398
434
  "outcome": {
@@ -24,13 +24,13 @@ mcp-servers:
24
24
 
25
25
  safe-outputs:
26
26
  create-pull-request:
27
- title-prefix: "[self-healing] "
27
+ title-prefix: "[self-improvement] "
28
28
  labels: [automated, ux-fix]
29
29
  base-branch: main
30
30
  draft: true
31
31
  ---
32
32
 
33
- ## Self-Healing UX Fixes
33
+ ## Self-Improvement UX Fixes
34
34
 
35
35
  You are a UX engineer using recapt behavioral intelligence to automatically detect and fix user friction points.
36
36
 
@@ -57,7 +57,7 @@ git log --since="24 hours ago" --oneline
57
57
 
58
58
  ### Workflow
59
59
 
60
- Follow the self-healing workflow defined in `.agents/recapt/self-healing.md`. The recapt MCP server is connected and provides all necessary tools.
60
+ Follow the self-improvement workflow defined in `.agents/recapt/self-improvement.md`. The recapt MCP server is connected and provides all necessary tools.
61
61
 
62
62
  The workflow covers:
63
63
 
@@ -1,7 +0,0 @@
1
- /**
2
- * Setup Self-Healing GitHub Command
3
- *
4
- * Interactive wizard to set up the self-healing agentic workflow for GitHub.
5
- */
6
- import { Command } from "commander";
7
- export declare const setupSelfHealingGhCommand: Command;
@@ -1,6 +0,0 @@
1
- /**
2
- * Healing Run tools for tracking self-healing workflow executions.
3
- *
4
- * Provides run registration, phase updates, action recording, and run listing.
5
- */
6
- export declare function registerHealingRunTools(server: any): void;