@contextstream/mcp-server 0.3.19 → 0.3.20

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 (2) hide show
  1. package/dist/index.js +596 -41
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6237,6 +6237,8 @@ You have access to ContextStream MCP tools for persistent memory and context.
6237
6237
  | **1st message** | \`session_init(folder_path="...", context_hint="<user's message>")\` |
6238
6238
  | **2nd+ messages** | \`context_smart(user_message="<user's message>")\` |
6239
6239
  | **After completing task** | \`session_capture(...)\` - MUST capture decisions/insights |
6240
+ | **User frustration/correction** | \`session_capture_lesson(...)\` - MUST capture lessons |
6241
+ | **Command/tool error + fix** | \`session_capture_lesson(...)\` - MUST capture lessons |
6240
6242
 
6241
6243
  **NO EXCEPTIONS.** Do not skip even if you think you have enough context.
6242
6244
 
@@ -6292,6 +6294,52 @@ You have access to ContextStream MCP tools for persistent memory and context.
6292
6294
 
6293
6295
  ---
6294
6296
 
6297
+ ### Lesson Capture (MANDATORY)
6298
+
6299
+ When:
6300
+ 1. **Expresses frustration** (caps, profanity, "COME ON", "WTF", repeated corrections)
6301
+ 2. **Corrects you** ("No, you should...", "That's wrong", "Fix this")
6302
+ 3. **Points out a mistake** (broken code, wrong approach, production issue)
6303
+ 4. **A command/tool call fails and you learn the correct fix** (even if the user didn\u2019t explicitly correct you)
6304
+
6305
+ You MUST immediately call \`session_capture_lesson\` with:
6306
+
6307
+ | Field | Description | Example |
6308
+ |-------|-------------|---------|
6309
+ | \`title\` | What to remember | "Verify assets in git before pushing" |
6310
+ | \`severity\` | \`critical\`/\`high\`/\`medium\`/\`low\` | \`critical\` for production issues |
6311
+ | \`category\` | \`workflow\`/\`code_quality\`/\`verification\`/\`communication\`/\`project_specific\` | \`workflow\` |
6312
+ | \`trigger\` | What action caused the problem | "Pushed code referencing images without committing them" |
6313
+ | \`impact\` | What went wrong | "Production 404 errors - broken landing page" |
6314
+ | \`prevention\` | How to prevent in future | "Run git status to check untracked files before pushing" |
6315
+ | \`keywords\` | Keywords for matching | \`["git", "images", "assets", "push"]\` |
6316
+
6317
+ **Example call:**
6318
+ \`\`\`json
6319
+ {
6320
+ "title": "Always verify assets in git before pushing code references",
6321
+ "severity": "critical",
6322
+ "category": "workflow",
6323
+ "trigger": "Pushed code referencing /screenshots/*.png without committing images",
6324
+ "impact": "Production 404 errors - broken landing page",
6325
+ "prevention": "Run 'git status' to check untracked files before pushing code that references static assets",
6326
+ "keywords": ["git", "images", "assets", "push", "404", "static"]
6327
+ }
6328
+ \`\`\`
6329
+
6330
+ **Why this matters:**
6331
+ - Lessons are surfaced automatically in \`session_init\` and \`context_smart\`
6332
+ - Future sessions will warn you before repeating the same mistake
6333
+ - This prevents production issues and user frustration
6334
+
6335
+ **Severity guide:**
6336
+ - \`critical\`: Production outages, data loss, security issues
6337
+ - \`high\`: Breaking changes, significant user impact
6338
+ - \`medium\`: Workflow inefficiencies, minor bugs
6339
+ - \`low\`: Style/preference corrections
6340
+
6341
+ ---
6342
+
6295
6343
  ### Quick Examples
6296
6344
 
6297
6345
  \`\`\`
@@ -7285,7 +7333,7 @@ Automatically detects code files and skips ignored directories like node_modules
7285
7333
  title: "Initialize conversation session",
7286
7334
  description: `Initialize a new conversation session and automatically retrieve relevant context.
7287
7335
  This is the FIRST tool AI assistants should call when starting a conversation.
7288
- Returns: workspace info, project info, recent memory, recent decisions, and relevant context.
7336
+ Returns: workspace info, project info, recent memory, recent decisions, relevant context, and high-priority lessons.
7289
7337
  Automatically detects the IDE workspace/project path and can auto-index code.
7290
7338
 
7291
7339
  IMPORTANT: Pass the user's FIRST MESSAGE as context_hint to get semantically relevant context!
@@ -8032,7 +8080,7 @@ Format options:
8032
8080
  - 'readable': Line-separated with labels
8033
8081
  - 'structured': JSON-like grouped format
8034
8082
 
8035
- Type codes: W=Workspace, P=Project, D=Decision, M=Memory, I=Insight, T=Task
8083
+ Type codes: W=Workspace, P=Project, D=Decision, M=Memory, I=Insight, T=Task, L=Lesson
8036
8084
 
8037
8085
  Example usage:
8038
8086
  1. User asks "how should I implement auth?"
@@ -8130,7 +8178,7 @@ function registerPrompts(server) {
8130
8178
  title: "Explore Codebase",
8131
8179
  description: "Get an overview of a project codebase structure and key components",
8132
8180
  argsSchema: {
8133
- project_id: external_exports.string().uuid().describe("Project ID to explore"),
8181
+ project_id: external_exports.string().uuid().optional().describe("Project ID to explore (optional if session_init has set defaults)"),
8134
8182
  focus_area: external_exports.string().optional().describe('Optional area to focus on (e.g., "authentication", "api routes")')
8135
8183
  }
8136
8184
  },
@@ -8140,12 +8188,14 @@ function registerPrompts(server) {
8140
8188
  role: "user",
8141
8189
  content: {
8142
8190
  type: "text",
8143
- text: `I want to understand the codebase for project ${args.project_id}${args.focus_area ? ` with focus on ${args.focus_area}` : ""}.
8191
+ text: `I want to understand the codebase${args.project_id ? ` for project ${args.project_id}` : ""}${args.focus_area ? ` with focus on ${args.focus_area}` : ""}.
8192
+
8193
+ If project_id is not provided, first call \`session_init\` (or \`projects_list\`) to resolve the current project ID.
8144
8194
 
8145
8195
  Please help me by:
8146
- 1. First, use \`projects.overview\` to get the project summary
8147
- 2. Use \`projects.files\` to list the key files
8148
- 3. Use \`search.semantic\` to find relevant code${args.focus_area ? ` related to "${args.focus_area}"` : ""}
8196
+ 1. First, use \`projects_overview\` to get the project summary
8197
+ 2. Use \`projects_files\` to list the key files
8198
+ 3. Use \`search_semantic\` to find relevant code${args.focus_area ? ` related to "${args.focus_area}"` : ""}
8149
8199
  4. Summarize the architecture and key patterns you observe
8150
8200
 
8151
8201
  Provide a clear, structured overview that helps me navigate this codebase effectively.`
@@ -8160,7 +8210,7 @@ Provide a clear, structured overview that helps me navigate this codebase effect
8160
8210
  title: "Capture Decision",
8161
8211
  description: "Document an architectural or technical decision in workspace memory",
8162
8212
  argsSchema: {
8163
- workspace_id: external_exports.string().uuid().describe("Workspace ID"),
8213
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional if session_init has set defaults)"),
8164
8214
  decision_title: external_exports.string().describe("Brief title of the decision"),
8165
8215
  context: external_exports.string().describe("What prompted this decision"),
8166
8216
  decision: external_exports.string().describe("The decision made"),
@@ -8180,12 +8230,15 @@ Provide a clear, structured overview that helps me navigate this codebase effect
8180
8230
  **Decision:** ${args.decision}
8181
8231
  ${args.consequences ? `**Consequences:** ${args.consequences}` : ""}
8182
8232
 
8183
- Use \`memory.create_event\` with:
8233
+ If workspace_id is not provided, first call \`session_init\` to resolve the workspace, then capture the decision.
8234
+
8235
+ Use \`session_capture\` with:
8184
8236
  - event_type: "decision"
8185
- - workspace_id: "${args.workspace_id}"
8186
- - title: The decision title
8237
+ ${args.workspace_id ? `- workspace_id: "${args.workspace_id}"` : "- workspace_id: (omit to use session defaults)"}
8238
+ - title: "${args.decision_title}"
8187
8239
  - content: A well-formatted ADR (Architecture Decision Record) with context, decision, and consequences
8188
- - metadata: Include relevant tags and status
8240
+ - tags: Include relevant tags (e.g., "adr", "architecture")
8241
+ - importance: "high"
8189
8242
 
8190
8243
  After creating, confirm the decision was recorded and summarize it.`
8191
8244
  }
@@ -8199,7 +8252,7 @@ After creating, confirm the decision was recorded and summarize it.`
8199
8252
  title: "Code Review Context",
8200
8253
  description: "Build context for reviewing code changes",
8201
8254
  argsSchema: {
8202
- project_id: external_exports.string().uuid().describe("Project ID"),
8255
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional if session_init has set defaults)"),
8203
8256
  file_paths: external_exports.string().describe("Comma-separated file paths being changed"),
8204
8257
  change_description: external_exports.string().describe("Brief description of the changes")
8205
8258
  }
@@ -8215,10 +8268,10 @@ After creating, confirm the decision was recorded and summarize it.`
8215
8268
  Change description: ${args.change_description}
8216
8269
 
8217
8270
  Please help me understand the impact by:
8218
- 1. Use \`graph.dependencies\` to find what depends on these files
8219
- 2. Use \`graph.impact\` to analyze potential impact
8220
- 3. Use \`memory.search\` to find related decisions or notes about these areas
8221
- 4. Use \`search.semantic\` to find related code patterns
8271
+ 1. Use \`graph_dependencies\` to find what depends on these files
8272
+ 2. Use \`graph_impact\` to analyze potential impact
8273
+ 3. Use \`memory_search\` to find related decisions or notes about these areas
8274
+ 4. Use \`search_semantic\` to find related code patterns
8222
8275
 
8223
8276
  Provide:
8224
8277
  - Summary of what these files do
@@ -8236,7 +8289,7 @@ Provide:
8236
8289
  title: "Investigate Bug",
8237
8290
  description: "Build context for debugging an issue",
8238
8291
  argsSchema: {
8239
- project_id: external_exports.string().uuid().describe("Project ID"),
8292
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional if session_init has set defaults)"),
8240
8293
  error_message: external_exports.string().describe("Error message or symptom"),
8241
8294
  affected_area: external_exports.string().optional().describe("Known affected area or component")
8242
8295
  }
@@ -8253,10 +8306,10 @@ Provide:
8253
8306
  ${args.affected_area ? `**Affected Area:** ${args.affected_area}` : ""}
8254
8307
 
8255
8308
  Please help me investigate by:
8256
- 1. Use \`search.semantic\` to find code related to this error
8257
- 2. Use \`search.pattern\` to find where similar errors are thrown
8258
- 3. Use \`graph.call_path\` to trace call flows if we identify key functions
8259
- 4. Use \`memory.search\` to check if this issue has been encountered before
8309
+ 1. Use \`search_semantic\` to find code related to this error
8310
+ 2. Use \`search_pattern\` to find where similar errors are thrown
8311
+ 3. Use \`graph_call_path\` to trace call flows if we identify key functions
8312
+ 4. Use \`memory_search\` to check if this issue has been encountered before
8260
8313
 
8261
8314
  Provide:
8262
8315
  - Likely locations where this error originates
@@ -8274,7 +8327,7 @@ Provide:
8274
8327
  title: "Explore Knowledge Graph",
8275
8328
  description: "Navigate and understand the knowledge graph for a workspace",
8276
8329
  argsSchema: {
8277
- workspace_id: external_exports.string().uuid().describe("Workspace ID"),
8330
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional if session_init has set defaults)"),
8278
8331
  starting_topic: external_exports.string().optional().describe("Topic to start exploration from")
8279
8332
  }
8280
8333
  },
@@ -8284,13 +8337,15 @@ Provide:
8284
8337
  role: "user",
8285
8338
  content: {
8286
8339
  type: "text",
8287
- text: `Help me explore the knowledge captured in workspace ${args.workspace_id}${args.starting_topic ? ` starting from "${args.starting_topic}"` : ""}.
8340
+ text: `Help me explore the knowledge captured in the current workspace${args.workspace_id ? ` (${args.workspace_id})` : ""}${args.starting_topic ? ` starting from "${args.starting_topic}"` : ""}.
8341
+
8342
+ If workspace_id is not provided, first call \`session_init\` to resolve the workspace.
8288
8343
 
8289
8344
  Please:
8290
- 1. Use \`memory.list_nodes\` to see available knowledge nodes
8291
- 2. Use \`memory.decisions\` to see decision history
8292
- 3. ${args.starting_topic ? `Use \`memory.search\` to find nodes related to "${args.starting_topic}"` : "Use `memory.summary` to get an overview"}
8293
- 4. Use \`graph.related\` to explore connections between nodes
8345
+ 1. Use \`memory_list_nodes\` to see available knowledge nodes
8346
+ 2. Use \`memory_decisions\` to see decision history
8347
+ 3. ${args.starting_topic ? `Use \`memory_search\` to find nodes related to "${args.starting_topic}"` : "Use `memory_summary` to get an overview"}
8348
+ 4. Use \`graph_related\` to explore connections between nodes
8294
8349
 
8295
8350
  Provide:
8296
8351
  - Overview of knowledge captured
@@ -8308,8 +8363,8 @@ Provide:
8308
8363
  title: "Project Onboarding",
8309
8364
  description: "Generate onboarding context for a new team member",
8310
8365
  argsSchema: {
8311
- project_id: external_exports.string().uuid().describe("Project ID"),
8312
- workspace_id: external_exports.string().uuid().describe("Workspace ID"),
8366
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional if session_init has set defaults)"),
8367
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional if session_init has set defaults)"),
8313
8368
  role: external_exports.string().optional().describe('Role of the person being onboarded (e.g., "backend developer", "frontend developer")')
8314
8369
  }
8315
8370
  },
@@ -8323,11 +8378,11 @@ Provide:
8323
8378
  ${args.role ? `They will be working as a ${args.role}.` : ""}
8324
8379
 
8325
8380
  Please gather comprehensive context:
8326
- 1. Use \`projects.overview\` and \`projects.statistics\` for project summary
8327
- 2. Use \`projects.files\` to identify key entry points
8328
- 3. Use \`memory.timeline\` to see recent activity and changes
8329
- 4. Use \`memory.decisions\` to understand key architectural choices
8330
- 5. Use \`search.semantic\` to find documentation and READMEs
8381
+ 1. Use \`projects_overview\` and \`projects_statistics\` for project summary
8382
+ 2. Use \`projects_files\` to identify key entry points
8383
+ 3. Use \`memory_timeline\` to see recent activity and changes
8384
+ 4. Use \`memory_decisions\` to understand key architectural choices
8385
+ 5. Use \`search_semantic\` to find documentation and READMEs
8331
8386
 
8332
8387
  Provide an onboarding guide that includes:
8333
8388
  - Project overview and purpose
@@ -8347,7 +8402,7 @@ Provide an onboarding guide that includes:
8347
8402
  title: "Refactoring Analysis",
8348
8403
  description: "Analyze a codebase for refactoring opportunities",
8349
8404
  argsSchema: {
8350
- project_id: external_exports.string().uuid().describe("Project ID"),
8405
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional if session_init has set defaults)"),
8351
8406
  target_area: external_exports.string().optional().describe("Specific area to analyze")
8352
8407
  }
8353
8408
  },
@@ -8360,10 +8415,10 @@ Provide an onboarding guide that includes:
8360
8415
  text: `Analyze the codebase for refactoring opportunities${args.target_area ? ` in ${args.target_area}` : ""}.
8361
8416
 
8362
8417
  Please investigate:
8363
- 1. Use \`graph.circular_dependencies\` to find circular dependencies
8364
- 2. Use \`graph.unused_code\` to find dead code
8365
- 3. Use \`search.pattern\` to find code duplication patterns
8366
- 4. Use \`projects.statistics\` to identify complex areas
8418
+ 1. Use \`graph_circular_dependencies\` to find circular dependencies
8419
+ 2. Use \`graph_unused_code\` to find dead code
8420
+ 3. Use \`search_pattern\` to find code duplication patterns
8421
+ 4. Use \`projects_statistics\` to identify complex areas
8367
8422
 
8368
8423
  Provide:
8369
8424
  - Circular dependencies that should be broken
@@ -8398,7 +8453,7 @@ Provide:
8398
8453
 
8399
8454
  **Query:** ${args.query}
8400
8455
 
8401
- Please use \`ai.enhanced_context\` with:
8456
+ Please use \`ai_enhanced_context\` with:
8402
8457
  - query: "${args.query}"
8403
8458
  ${args.workspace_id ? `- workspace_id: "${args.workspace_id}"` : ""}
8404
8459
  ${args.project_id ? `- project_id: "${args.project_id}"` : ""}
@@ -8412,6 +8467,491 @@ Then synthesize the retrieved context into a coherent briefing that will help wi
8412
8467
  ]
8413
8468
  })
8414
8469
  );
8470
+ server.registerPrompt(
8471
+ "smart-search",
8472
+ {
8473
+ title: "Smart Search",
8474
+ description: "Search across memory, decisions, and code for a query",
8475
+ argsSchema: {
8476
+ query: external_exports.string().describe("What you want to find"),
8477
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8478
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)")
8479
+ }
8480
+ },
8481
+ async (args) => ({
8482
+ messages: [
8483
+ {
8484
+ role: "user",
8485
+ content: {
8486
+ type: "text",
8487
+ text: `Find the most relevant context for: "${args.query}"
8488
+
8489
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8490
+
8491
+ Please:
8492
+ 1. Use \`session_smart_search\` with query "${args.query}"${args.workspace_id ? ` and workspace_id "${args.workspace_id}"` : ""}${args.project_id ? ` and project_id "${args.project_id}"` : ""}
8493
+ 2. If results are thin, follow up with \`search_hybrid\` and \`memory_search\`
8494
+ 3. Return the top results with file paths/links and a short synthesis of what matters`
8495
+ }
8496
+ }
8497
+ ]
8498
+ })
8499
+ );
8500
+ server.registerPrompt(
8501
+ "recall-context",
8502
+ {
8503
+ title: "Recall Context",
8504
+ description: "Retrieve relevant past decisions and memory for a query",
8505
+ argsSchema: {
8506
+ query: external_exports.string().describe("What to recall (natural language)"),
8507
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8508
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)")
8509
+ }
8510
+ },
8511
+ async (args) => ({
8512
+ messages: [
8513
+ {
8514
+ role: "user",
8515
+ content: {
8516
+ type: "text",
8517
+ text: `Recall relevant context for: "${args.query}"
8518
+
8519
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8520
+
8521
+ Use \`session_recall\` with query "${args.query}"${args.workspace_id ? ` and workspace_id "${args.workspace_id}"` : ""}${args.project_id ? ` and project_id "${args.project_id}"` : ""}.
8522
+ Then summarize the key points and any relevant decisions/lessons.`
8523
+ }
8524
+ }
8525
+ ]
8526
+ })
8527
+ );
8528
+ server.registerPrompt(
8529
+ "session-summary",
8530
+ {
8531
+ title: "Session Summary",
8532
+ description: "Get a compact summary of workspace/project context",
8533
+ argsSchema: {
8534
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8535
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8536
+ max_tokens: external_exports.string().optional().describe("Max tokens for summary (default: 500)")
8537
+ }
8538
+ },
8539
+ async (args) => ({
8540
+ messages: [
8541
+ {
8542
+ role: "user",
8543
+ content: {
8544
+ type: "text",
8545
+ text: `Generate a compact, token-efficient summary of the current workspace/project context.
8546
+
8547
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8548
+
8549
+ Use \`session_summary\`${args.workspace_id ? ` with workspace_id "${args.workspace_id}"` : ""}${args.project_id ? ` and project_id "${args.project_id}"` : ""}${args.max_tokens ? ` and max_tokens ${args.max_tokens} (number)` : ""}.
8550
+ Then list the top decisions (titles only) and any high-priority lessons to watch for.`
8551
+ }
8552
+ }
8553
+ ]
8554
+ })
8555
+ );
8556
+ server.registerPrompt(
8557
+ "capture-lesson",
8558
+ {
8559
+ title: "Capture Lesson",
8560
+ description: "Record a lesson learned from an error or correction",
8561
+ argsSchema: {
8562
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8563
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8564
+ title: external_exports.string().describe("Lesson title (what to remember)"),
8565
+ severity: external_exports.string().optional().describe("low|medium|high|critical (default: medium)"),
8566
+ category: external_exports.string().describe("workflow|code_quality|verification|communication|project_specific"),
8567
+ trigger: external_exports.string().describe("What action caused the problem"),
8568
+ impact: external_exports.string().describe("What went wrong"),
8569
+ prevention: external_exports.string().describe("How to prevent in future"),
8570
+ keywords: external_exports.string().optional().describe("Comma-separated keywords (optional)")
8571
+ }
8572
+ },
8573
+ async (args) => ({
8574
+ messages: [
8575
+ {
8576
+ role: "user",
8577
+ content: {
8578
+ type: "text",
8579
+ text: `Capture this lesson so it is surfaced in future sessions:
8580
+
8581
+ Title: ${args.title}
8582
+ Severity: ${args.severity || "medium"}
8583
+ Category: ${args.category}
8584
+ Trigger: ${args.trigger}
8585
+ Impact: ${args.impact}
8586
+ Prevention: ${args.prevention}
8587
+ ${args.keywords ? `Keywords: ${args.keywords}` : ""}
8588
+
8589
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8590
+
8591
+ Use \`session_capture_lesson\` with the fields above. If keywords were provided, split the comma-separated list into an array of strings.`
8592
+ }
8593
+ }
8594
+ ]
8595
+ })
8596
+ );
8597
+ server.registerPrompt(
8598
+ "capture-preference",
8599
+ {
8600
+ title: "Capture Preference",
8601
+ description: "Save a user preference to memory",
8602
+ argsSchema: {
8603
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8604
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8605
+ title: external_exports.string().optional().describe("Preference title (optional)"),
8606
+ preference: external_exports.string().describe("Preference details to remember")
8607
+ }
8608
+ },
8609
+ async (args) => ({
8610
+ messages: [
8611
+ {
8612
+ role: "user",
8613
+ content: {
8614
+ type: "text",
8615
+ text: `Save this preference to memory:
8616
+
8617
+ ${args.title ? `Title: ${args.title}
8618
+ ` : ""}Preference: ${args.preference}
8619
+
8620
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8621
+
8622
+ Use \`session_capture\` with:
8623
+ - event_type: "preference"
8624
+ - title: ${args.title ? `"${args.title}"` : "(choose a short title)"}
8625
+ - content: "${args.preference}"
8626
+ - importance: "medium"`
8627
+ }
8628
+ }
8629
+ ]
8630
+ })
8631
+ );
8632
+ server.registerPrompt(
8633
+ "capture-task",
8634
+ {
8635
+ title: "Capture Task",
8636
+ description: "Capture an action item into memory",
8637
+ argsSchema: {
8638
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8639
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8640
+ title: external_exports.string().optional().describe("Task title (optional)"),
8641
+ task: external_exports.string().describe("Task details")
8642
+ }
8643
+ },
8644
+ async (args) => ({
8645
+ messages: [
8646
+ {
8647
+ role: "user",
8648
+ content: {
8649
+ type: "text",
8650
+ text: `Capture this task in memory for tracking:
8651
+
8652
+ ${args.title ? `Title: ${args.title}
8653
+ ` : ""}Task: ${args.task}
8654
+
8655
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8656
+
8657
+ Use \`session_capture\` with:
8658
+ - event_type: "task"
8659
+ - title: ${args.title ? `"${args.title}"` : "(choose a short title)"}
8660
+ - content: "${args.task}"
8661
+ - importance: "medium"`
8662
+ }
8663
+ }
8664
+ ]
8665
+ })
8666
+ );
8667
+ server.registerPrompt(
8668
+ "capture-bug",
8669
+ {
8670
+ title: "Capture Bug",
8671
+ description: "Capture a bug report into workspace memory",
8672
+ argsSchema: {
8673
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8674
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8675
+ title: external_exports.string().describe("Bug title"),
8676
+ description: external_exports.string().describe("Bug description"),
8677
+ reproduction_steps: external_exports.string().optional().describe("Steps to reproduce (optional)"),
8678
+ expected: external_exports.string().optional().describe("Expected behavior (optional)"),
8679
+ actual: external_exports.string().optional().describe("Actual behavior (optional)")
8680
+ }
8681
+ },
8682
+ async (args) => ({
8683
+ messages: [
8684
+ {
8685
+ role: "user",
8686
+ content: {
8687
+ type: "text",
8688
+ text: `Capture this bug report in memory:
8689
+
8690
+ Title: ${args.title}
8691
+ Description: ${args.description}
8692
+ ${args.reproduction_steps ? `Steps to reproduce:
8693
+ ${args.reproduction_steps}
8694
+ ` : ""}${args.expected ? `Expected:
8695
+ ${args.expected}
8696
+ ` : ""}${args.actual ? `Actual:
8697
+ ${args.actual}
8698
+ ` : ""}
8699
+
8700
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8701
+
8702
+ Use \`session_capture\` with:
8703
+ - event_type: "bug"
8704
+ - title: "${args.title}"
8705
+ - content: A well-formatted bug report with the details above
8706
+ - tags: include relevant component/area tags
8707
+ - importance: "high"`
8708
+ }
8709
+ }
8710
+ ]
8711
+ })
8712
+ );
8713
+ server.registerPrompt(
8714
+ "capture-feature",
8715
+ {
8716
+ title: "Capture Feature",
8717
+ description: "Capture a feature request into workspace memory",
8718
+ argsSchema: {
8719
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8720
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8721
+ title: external_exports.string().describe("Feature title"),
8722
+ description: external_exports.string().describe("Feature description"),
8723
+ rationale: external_exports.string().optional().describe("Why this matters (optional)"),
8724
+ acceptance_criteria: external_exports.string().optional().describe("Acceptance criteria (optional)")
8725
+ }
8726
+ },
8727
+ async (args) => ({
8728
+ messages: [
8729
+ {
8730
+ role: "user",
8731
+ content: {
8732
+ type: "text",
8733
+ text: `Capture this feature request in memory:
8734
+
8735
+ Title: ${args.title}
8736
+ Description: ${args.description}
8737
+ ${args.rationale ? `Rationale:
8738
+ ${args.rationale}
8739
+ ` : ""}${args.acceptance_criteria ? `Acceptance criteria:
8740
+ ${args.acceptance_criteria}
8741
+ ` : ""}
8742
+
8743
+ If workspace_id/project_id are not provided, call \`session_init\` first to resolve the current workspace/project.
8744
+
8745
+ Use \`session_capture\` with:
8746
+ - event_type: "feature"
8747
+ - title: "${args.title}"
8748
+ - content: A well-formatted feature request with the details above
8749
+ - tags: include relevant component/area tags
8750
+ - importance: "medium"`
8751
+ }
8752
+ }
8753
+ ]
8754
+ })
8755
+ );
8756
+ server.registerPrompt(
8757
+ "generate-plan",
8758
+ {
8759
+ title: "Generate Plan",
8760
+ description: "Generate a development plan from a description",
8761
+ argsSchema: {
8762
+ description: external_exports.string().describe("What you want to build/fix"),
8763
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8764
+ complexity: external_exports.string().optional().describe("low|medium|high (optional)")
8765
+ }
8766
+ },
8767
+ async (args) => ({
8768
+ messages: [
8769
+ {
8770
+ role: "user",
8771
+ content: {
8772
+ type: "text",
8773
+ text: `Generate a development plan for:
8774
+
8775
+ ${args.description}
8776
+
8777
+ Use \`ai_plan\` with:
8778
+ - description: "${args.description}"
8779
+ ${args.project_id ? `- project_id: "${args.project_id}"` : ""}
8780
+ ${args.complexity ? `- complexity: "${args.complexity}"` : ""}
8781
+
8782
+ Then present the plan as a concise ordered list with clear milestones and risks.`
8783
+ }
8784
+ }
8785
+ ]
8786
+ })
8787
+ );
8788
+ server.registerPrompt(
8789
+ "generate-tasks",
8790
+ {
8791
+ title: "Generate Tasks",
8792
+ description: "Generate actionable tasks from a plan or description",
8793
+ argsSchema: {
8794
+ plan_id: external_exports.string().optional().describe("Plan ID (optional)"),
8795
+ description: external_exports.string().optional().describe("Description to generate tasks from (optional if plan_id provided)"),
8796
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8797
+ granularity: external_exports.string().optional().describe("fine|medium|coarse (optional)")
8798
+ }
8799
+ },
8800
+ async (args) => ({
8801
+ messages: [
8802
+ {
8803
+ role: "user",
8804
+ content: {
8805
+ type: "text",
8806
+ text: `Generate actionable tasks.
8807
+
8808
+ ${args.plan_id ? `Use plan_id: ${args.plan_id}` : ""}${!args.plan_id && args.description ? `Use description: ${args.description}` : ""}
8809
+
8810
+ Use \`ai_tasks\` with:
8811
+ ${args.plan_id ? `- plan_id: "${args.plan_id}"` : ""}${!args.plan_id && args.description ? `- description: "${args.description}"` : ""}
8812
+ ${args.project_id ? `- project_id: "${args.project_id}"` : ""}
8813
+ ${args.granularity ? `- granularity: "${args.granularity}"` : ""}
8814
+
8815
+ Then output a checklist of tasks with clear acceptance criteria for each.`
8816
+ }
8817
+ }
8818
+ ]
8819
+ })
8820
+ );
8821
+ server.registerPrompt(
8822
+ "token-budget-context",
8823
+ {
8824
+ title: "Token-Budget Context",
8825
+ description: "Get the most relevant context that fits within a token budget",
8826
+ argsSchema: {
8827
+ query: external_exports.string().describe("What you need context for"),
8828
+ max_tokens: external_exports.string().describe("Max tokens for context (e.g., 500, 1000, 2000)"),
8829
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8830
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8831
+ include_code: external_exports.string().optional().describe('Include code ("true" or "false")')
8832
+ }
8833
+ },
8834
+ async (args) => ({
8835
+ messages: [
8836
+ {
8837
+ role: "user",
8838
+ content: {
8839
+ type: "text",
8840
+ text: `Build the most relevant context for:
8841
+
8842
+ Query: ${args.query}
8843
+ Token budget: ${args.max_tokens}
8844
+
8845
+ Use \`ai_context_budget\` with:
8846
+ - query: "${args.query}"
8847
+ - max_tokens: ${args.max_tokens} (number)
8848
+ ${args.workspace_id ? `- workspace_id: "${args.workspace_id}"` : ""}
8849
+ ${args.project_id ? `- project_id: "${args.project_id}"` : ""}
8850
+ ${args.include_code ? `- include_code: ${args.include_code}` : ""}
8851
+
8852
+ Return the packed context plus a short note about what was included/excluded.`
8853
+ }
8854
+ }
8855
+ ]
8856
+ })
8857
+ );
8858
+ server.registerPrompt(
8859
+ "find-todos",
8860
+ {
8861
+ title: "Find TODOs",
8862
+ description: "Scan the codebase for TODO/FIXME/HACK notes and summarize",
8863
+ argsSchema: {
8864
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional)"),
8865
+ pattern: external_exports.string().optional().describe("Regex/pattern to search (default: TODO|FIXME|HACK)")
8866
+ }
8867
+ },
8868
+ async (args) => ({
8869
+ messages: [
8870
+ {
8871
+ role: "user",
8872
+ content: {
8873
+ type: "text",
8874
+ text: `Find TODO-style notes in the codebase.
8875
+
8876
+ If project_id is not provided, first call \`session_init\` (or \`projects_list\`) to resolve the current project ID.
8877
+
8878
+ Use \`search_pattern\` with query "${args.pattern || "TODO|FIXME|HACK"}"${args.project_id ? ` and project_id "${args.project_id}"` : ""}.
8879
+ Group results by file path, summarize themes, and propose a small prioritized cleanup list.`
8880
+ }
8881
+ }
8882
+ ]
8883
+ })
8884
+ );
8885
+ server.registerPrompt(
8886
+ "generate-editor-rules",
8887
+ {
8888
+ title: "Generate Editor Rules",
8889
+ description: "Generate ContextStream AI rule files for your editor",
8890
+ argsSchema: {
8891
+ folder_path: external_exports.string().describe("Project folder path (ideally absolute)"),
8892
+ editors: external_exports.string().optional().describe('Comma-separated editors or "all" (windsurf,cursor,cline,kilo,roo,claude,aider)'),
8893
+ workspace_id: external_exports.string().uuid().optional().describe("Workspace ID (optional)"),
8894
+ workspace_name: external_exports.string().optional().describe("Workspace name (optional)"),
8895
+ project_name: external_exports.string().optional().describe("Project name (optional)"),
8896
+ additional_rules: external_exports.string().optional().describe("Additional project-specific rules (optional)"),
8897
+ dry_run: external_exports.string().optional().describe('Dry run ("true" or "false", default: false)')
8898
+ }
8899
+ },
8900
+ async (args) => ({
8901
+ messages: [
8902
+ {
8903
+ role: "user",
8904
+ content: {
8905
+ type: "text",
8906
+ text: `Generate ContextStream editor rule files in: ${args.folder_path}
8907
+
8908
+ Use \`generate_editor_rules\` with:
8909
+ - folder_path: "${args.folder_path}"
8910
+ ${args.editors ? `- editors: "${args.editors}"` : ""}
8911
+ ${args.workspace_id ? `- workspace_id: "${args.workspace_id}"` : ""}
8912
+ ${args.workspace_name ? `- workspace_name: "${args.workspace_name}"` : ""}
8913
+ ${args.project_name ? `- project_name: "${args.project_name}"` : ""}
8914
+ ${args.additional_rules ? `- additional_rules: "${args.additional_rules}"` : ""}
8915
+ ${args.dry_run ? `- dry_run: ${args.dry_run}` : ""}
8916
+
8917
+ If editors is provided as a comma-separated string, split it into an array (or use ["all"] to generate for all editors). If dry_run is provided as a string, convert to boolean.`
8918
+ }
8919
+ }
8920
+ ]
8921
+ })
8922
+ );
8923
+ server.registerPrompt(
8924
+ "index-local-repo",
8925
+ {
8926
+ title: "Index Local Repo",
8927
+ description: "Ingest local files into ContextStream for indexing/search",
8928
+ argsSchema: {
8929
+ project_id: external_exports.string().uuid().optional().describe("Project ID (optional if session_init has set defaults)"),
8930
+ path: external_exports.string().describe("Local directory path to ingest")
8931
+ }
8932
+ },
8933
+ async (args) => ({
8934
+ messages: [
8935
+ {
8936
+ role: "user",
8937
+ content: {
8938
+ type: "text",
8939
+ text: `Ingest local files for indexing/search.
8940
+
8941
+ Path: ${args.path}
8942
+
8943
+ If project_id is not provided, call \`session_init\` first and use the resolved project_id (or use \`projects_list\` to select).
8944
+
8945
+ Use \`projects_ingest_local\` with:
8946
+ - project_id: ${args.project_id ? `"${args.project_id}"` : "(resolved from session_init)"}
8947
+ - path: "${args.path}"
8948
+
8949
+ Then advise how to monitor progress via \`projects_index_status\`.`
8950
+ }
8951
+ }
8952
+ ]
8953
+ })
8954
+ );
8415
8955
  }
8416
8956
 
8417
8957
  // src/session-manager.ts
@@ -8643,6 +9183,21 @@ var SessionManager = class {
8643
9183
  parts.push(` \u2022 [${type}] ${title}`);
8644
9184
  });
8645
9185
  }
9186
+ const lessonsWarning = typeof context.lessons_warning === "string" ? context.lessons_warning : void 0;
9187
+ const lessons = Array.isArray(context.lessons) ? context.lessons : [];
9188
+ if (lessonsWarning || lessons.length > 0) {
9189
+ parts.push("");
9190
+ parts.push("\u26A0\uFE0F Lessons (review before changes):");
9191
+ if (lessonsWarning) {
9192
+ parts.push(` ${lessonsWarning}`);
9193
+ }
9194
+ lessons.slice(0, 3).forEach((l) => {
9195
+ const title = l.title || "Lesson";
9196
+ const severity = l.severity || "unknown";
9197
+ parts.push(` \u2022 [${severity}] ${title}`);
9198
+ });
9199
+ parts.push(' Use session_get_lessons(query="...") for details.');
9200
+ }
8646
9201
  parts.push("");
8647
9202
  if (context.ide_roots && context.ide_roots.length > 0) {
8648
9203
  const roots = context.ide_roots;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextstream/mcp-server",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "MCP server exposing ContextStream public API - code context, memory, search, and AI tools for developers",
5
5
  "type": "module",
6
6
  "license": "MIT",