@contextstream/mcp-server 0.4.74 → 0.4.81

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.
@@ -342,21 +342,33 @@ var CONTEXTSTREAM_TOOL_NAMES = [
342
342
  // Renamed from context_smart - get relevant context every message
343
343
  "context_feedback",
344
344
  "generate_rules",
345
+ "instruct",
346
+ "flash",
345
347
  // Consolidated domain tools (v0.4.x default)
346
348
  "search",
347
349
  // Modes: auto (recommended), semantic, hybrid (legacy alias), keyword, pattern
348
350
  "session",
349
- // Actions: capture, capture_lesson, get_lessons, recall, remember, user_context, summary, compress, delta, smart_search, decision_trace
351
+ // Actions: capture, retro_capture, capture_lesson, get_lessons, update_lesson, delete_lesson, recall, ground, set_account_mode, remember, user_context, summary, compress, delta, smart_search, decision_trace
350
352
  "memory",
351
353
  // Actions: create_event, get_event, update_event, delete_event, list_events, distill_event, create_node, get_node, update_node, delete_node, list_nodes, supersede_node, search, decisions, timeline, summary
354
+ "entity",
355
+ // Actions: list, get, create, update, delete for structured taxonomy entities
356
+ "capsule",
357
+ // Actions: open, create, share, bootstrap_prompt, graph, audit, delete
358
+ "qa",
359
+ // Actions: ask (grounded answer with citations), search (prior Q&A), save_kb/list_kb/get_kb/update_kb/delete_kb (knowledge base), feedback
352
360
  "graph",
353
361
  // Actions: dependencies, impact, call_path, related, path, decisions, ingest, circular_dependencies, unused_code, contradictions
354
362
  "project",
355
- // Actions: list, get, create, update, index, overview, statistics, files, index_status, ingest_local
363
+ // Actions: list, get, create, update, index, purge, forget_local, remove_paths, merge, overview, statistics, files, index_status, ingest_local
356
364
  "workspace",
357
365
  // Actions: list, get, associate, bootstrap
358
366
  "reminder",
359
367
  // Actions: list, active, create, snooze, complete, dismiss
368
+ "media",
369
+ // Actions: index, status, search, get_clip, list, delete
370
+ "skill",
371
+ // Actions: list, run, create, update, supersede, import
360
372
  "integration",
361
373
  // Provider: slack, github, all; Actions: status, search, stats, activity, contributors, knowledge, summary, channels, discussions, sync_users, repos, issues
362
374
  "help"
@@ -378,9 +390,60 @@ var CONTEXTSTREAM_RULES_BOOTSTRAP = `
378
390
 
379
391
  **Why?** \`context()\` delivers task-specific rules, lessons from past mistakes, and relevant decisions. Skip it = fly blind.
380
392
 
393
+ **Common queries \u2014 use these exact tool calls:**
394
+ - "list lessons" / "show lessons" \u2192 \`session(action="get_lessons")\`
395
+ - "save lesson" / "remember this lesson" / "lesson learned" / "I made a mistake" \u2192 \`session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...", severity="low|medium|high|critical")\` \u2014 **NEVER store lessons in local files** (e.g. \`~/.claude/.../memory/\`, \`.cursorrules\`, scratch markdown). Lessons live in ContextStream so they auto-surface as \`[LESSONS_WARNING]\` on future turns and across sessions.
396
+ - "list decisions" / "show decisions" \u2192 \`memory(action="decisions")\`
397
+ - "save decision" / "decided to" \u2192 \`session(action="capture", event_type="decision", title="...", content="...")\`
398
+ - "what did we do last session" / "past sessions" / "pick up where we left off" \u2192 \`session(action="recall", query="...")\` or \`memory(action="list_transcripts", limit=10)\`
399
+ - "search past sessions" / "when did we discuss X" \u2192 \`memory(action="search_transcripts", query="...")\`
400
+ - "save snapshot" \u2192 \`session(action="capture", event_type="session_snapshot", title="...", content="...")\`
401
+ - "list media" / "show assets" / "show photos/videos/audio/docs" \u2192 \`media(action="list", content_types=["image"])\` (use \`image|video|audio|document\`; omit \`content_types\` for all assets)
402
+ - "find media" / "search photos/videos/audio/docs" / "what's in this PDF/video/audio?" \u2192 \`media(action="search", query="...", content_types=["document"])\`
403
+ - "index media" / "upload asset" / "read this photo/video/audio/PDF" \u2192 \`media(action="index", file_path="...", content_type="image")\` or \`media(action="index", external_url="...", content_type="document")\`
404
+
405
+ ## Skills, Docs & Lessons First
406
+
407
+ Before guessing, improvising, or struggling through a workflow you do not fully know, check whether ContextStream already has guidance for it.
408
+ - Start with \`context(...)\` and obey \`[MATCHED_SKILLS]\`, \`[LESSONS_WARNING]\`, \`[PREFERENCE]\`, and \`<system-reminder>\` output
409
+ - Treat \`[LESSONS_WARNING]\` as active working instructions for the current task, not optional background
410
+ - If the task is unfamiliar or likely documented already, check \`skill(action="list")\`, \`memory(action="list_docs")\`, \`session(action="get_lessons")\`, or \`memory(action="decisions")\` before trial-and-error
411
+ - Prefer surfaced ContextStream skills/docs/lessons over inventing a new workflow from memory
412
+
413
+ ## Project Scope Discipline
414
+
415
+ - Reuse the \`project_id\` returned by \`init(...)\` or \`context(...)\` for project-scoped writes and lookups
416
+ - For project-scoped \`memory(...)\`, \`session(...)\`, and \`skill(...)\` calls, pass explicit \`project_id\` instead of guessing from the folder name
417
+ - If no \`project_id\` is resolved, rerun \`init(folder_path="...")\` before creating docs, skills, events, tasks, todos, or other project memory
418
+ - Use \`target_project\` only after init from a multi-project parent folder
419
+
381
420
  **Hooks:** \`<system-reminder>\` tags contain injected instructions \u2014 follow them exactly.
382
421
 
383
- **Notices:** [LESSONS_WARNING] \u2192 apply lessons | [PREFERENCE] \u2192 follow user preferences | [RULES_NOTICE] \u2192 run \`generate_rules()\` | [VERSION_NOTICE/CRITICAL] \u2192 tell user about update
422
+ **Planning:** ALWAYS save plans to ContextStream \u2014 NOT markdown files or built-in todo tools:
423
+ \`session(action="capture_plan", title="...", steps=[...])\` + \`memory(action="create_task", title="...", plan_id="...")\`
424
+
425
+ **Memory, Docs, Lessons & Decisions:** Use ContextStream \u2014 NOT editor built-in tools, \`~/.claude/.../memory/\`, \`.cursorrules\`, or scratch markdown files. Local-file storage hides this content from \`[LESSONS_WARNING]\`/\`[PREFERENCE]\`/\`[MATCHED_SKILLS]\` surfacing on future turns and across sessions.
426
+ - Lessons (mistakes, corrections, "never do X again"): \`session(action="capture_lesson", title="...", trigger="...", impact="...", prevention="...", severity="...")\`
427
+ - Decisions / notes / insights: \`session(action="capture", event_type="decision|note|insight", ...)\`
428
+ - Docs / todos / knowledge nodes: \`memory(action="create_doc|create_todo|create_node", ...)\`
429
+
430
+ **Skills (IMPORTANT):** When \`context()\` returns \`[MATCHED_SKILLS]\`, you **MUST run** the listed skills immediately via \`skill(action="run", name="...")\`. High-priority skills (marked \u26A1) are mandatory.
431
+
432
+ ## Past Sessions Are Queryable \u2014 USE THEM
433
+
434
+ Transcripts of every prior session are captured + indexed. Before asking the user what you did last time, or re-deriving context you built together previously, check the transcript + snapshot layer.
435
+
436
+ Triggers: user says "last time"/"previous"/"yesterday"/"pick up where we left off", the task is clearly a continuation, or you're about to ask a clarifying question whose answer is likely in a prior session.
437
+
438
+ Exact calls:
439
+ - Ranked past-session context: \`session(action="recall", query="<what you're continuing>")\`
440
+ - Chronological list of recent sessions: \`memory(action="list_transcripts", limit=10)\`
441
+ - Full-text search across ALL past transcripts: \`memory(action="search_transcripts", query="<keyword>")\`
442
+ - Save a snapshot of the current session so the NEXT session can pick up: \`session(action="capture", event_type="session_snapshot", title="...", content="...")\`
443
+
444
+ **Never answer "I don't know what we did before" without running recall or search_transcripts at least once.**
445
+
446
+ **Notices:** [MATCHED_SKILLS] \u2192 run surfaced skills before other work | [LESSONS_WARNING] \u2192 apply lessons immediately and keep them active for the turn | [PREFERENCE] \u2192 follow user preferences | [RULES_NOTICE] \u2192 run \`generate_rules()\` | [VERSION_NOTICE/CRITICAL] \u2192 tell user about update
384
447
 
385
448
  v${RULES_VERSION}
386
449
  `.trim();
@@ -448,7 +511,7 @@ Use \`context()\` by default to get task-specific rules, lessons from past mista
448
511
  2. **PreToolUse blocking** - If you try to use Glob/Grep/Search/Explore:
449
512
  - Hook returns error: \`STOP: Use mcp__contextstream__search(mode="auto") instead\`
450
513
  - **You MUST use the suggested ContextStream tool instead**
451
- - For stale/not-indexed projects, wait for background refresh (up to ~20s), retry search, then allow local tools only after the grace window
514
+ - Run search FIRST even while the index is still building (keyword hits return immediately); fall back to local tools ONLY after search itself returns 0 results/errors on a retry, for known-new edits, or on explicit user request
452
515
 
453
516
  3. **PostToolUse indexing** - After Edit/Write operations:
454
517
  - Changed files are automatically re-indexed
@@ -485,7 +548,7 @@ STOP \u2192 Call search(mode="auto", query="...") FIRST
485
548
 
486
549
  \u2705 **ALWAYS DO THIS:**
487
550
  1. \`search(mode="auto", query="what you're looking for")\`
488
- 2. Only use local tools (Glob/Grep/Read) after stale/not-indexed refresh grace window elapses (~20s) or ContextStream still returns **0 results** after retry
551
+ 2. Only use local tools (Glob/Grep/Read) after \`search(...)\` itself returns **0 results**/errors on a retry \u2014 never preemptively because the index "isn't built yet"
489
552
  3. Use Read ONLY for exact file edits after you know the file path
490
553
 
491
554
  This applies to **EVERY search** throughout the **ENTIRE conversation**, not just the first message.
@@ -748,7 +811,7 @@ session(action="capture", event_type="session_snapshot", title="Pre-compaction s
748
811
 
749
812
  ### Search & Code Intelligence (ContextStream-first)
750
813
 
751
- \u26A0\uFE0F **STOP: Before using Search/Glob/Grep/Read/Explore** \u2192 Call \`search(mode="auto")\` FIRST. For stale/not-indexed projects, wait ~20s for background refresh and retry search before local fallback.
814
+ \u26A0\uFE0F **STOP: Before using Search/Glob/Grep/Read/Explore** \u2192 Call \`search(mode="auto")\` FIRST \u2014 even while the index is still building (keyword hits return immediately). Fall back to local tools ONLY after search itself returns 0 results/errors on a retry, for known-new edits, or on explicit user request.
752
815
 
753
816
  **\u274C WRONG workflow (wastes tokens, slow):**
754
817
  \`\`\`
@@ -767,7 +830,7 @@ search(mode="auto", query="function implementation") \u2192 done (results includ
767
830
  2. \`search(mode="auto", query="...", limit=3)\` or \`search(mode="keyword", query="<filename>", limit=3)\`
768
831
  3. \`project(action="files")\` - file tree/list (only when needed)
769
832
  4. \`graph(action="dependencies", ...)\` - code structure
770
- 5. Local repo scans (rg/ls/find) - ONLY after refresh grace window/retry still yields no results/errors, or the user explicitly asks
833
+ 5. Local repo scans (rg/ls/find) - ONLY after \`search(...)\` itself returns 0 results/errors on a retry, or the user explicitly asks
771
834
 
772
835
  **Search Mode Selection:**
773
836
 
@@ -798,7 +861,7 @@ search(mode="auto", query="function implementation") \u2192 done (results includ
798
861
 
799
862
  **Search defaults:** \`search\` returns the top 3 results with compact snippets. Use \`limit\` + \`offset\` for pagination, and \`content_max_chars\` to expand snippets when needed.
800
863
 
801
- If ContextStream returns results, stop and use them. NEVER use local Search/Explore/Read unless you need exact code edits, or refresh grace window + retry still returns 0 results.
864
+ If ContextStream returns results, stop and use them. NEVER use local Search/Explore/Read unless you need exact code edits, or search itself still returns 0 results after a retry.
802
865
 
803
866
  **Code Analysis:**
804
867
  - Dependencies: \`graph(action="dependencies", file_path="...")\`
@@ -927,7 +990,7 @@ var CONTEXTSTREAM_RULES_MINIMAL = `
927
990
  3. Narrow bypass: immediate read-only ContextStream calls are allowed only when prior context is fresh and no state-changing tool has run
928
991
 
929
992
  **BEFORE Glob/Grep/Read/Search/Explore/Task/EnterPlanMode:**
930
- \u2192 \`search(mode="auto", query="...")\` FIRST \u2014 for stale/not-indexed, wait ~20s for refresh then retry before local fallback
993
+ \u2192 \`search(mode="auto", query="...")\` FIRST \u2014 even while the index is building; fall back ONLY after search itself returns 0/errors on a retry, for known-new edits, or on explicit request
931
994
 
932
995
  **HOOKS: \`<system-reminder>\` tags contain instructions \u2014 FOLLOW THEM**
933
996
  </contextstream_protocol>
@@ -1150,7 +1213,7 @@ search(mode="auto", query="what you're looking for")
1150
1213
  \u2192 Use this instead of Explore/Task/EnterPlanMode for file discovery.
1151
1214
 
1152
1215
  **IF project is NOT indexed or very stale (>7 days):**
1153
- \u2192 Wait up to ~20s for background refresh, retry \`search(mode="auto", ...)\`, then allow local tools only after the grace window
1216
+ \u2192 Run \`search(mode="auto", ...)\` anyway \u2014 keyword hits return immediately while indexing builds; retry once, and use local tools only if search itself returns 0/errors
1154
1217
  \u2192 OR run \`project(action="index")\` first, then search
1155
1218
 
1156
1219
  **IF ContextStream search still returns 0 results or errors after retry/window:**
@@ -1179,7 +1242,7 @@ search(mode="auto", query="what you're looking for")
1179
1242
  - Then use local Read/Grep only on paths returned by ContextStream.
1180
1243
 
1181
1244
  ### When Local Tools Are OK:
1182
- \u2705 Stale/not-indexed grace window has elapsed (~20s default, configurable)
1245
+ \u2705 The edit is known-new (just written this turn) and not yet indexed
1183
1246
  \u2705 ContextStream search still returns 0 results after retry
1184
1247
  \u2705 ContextStream returns errors
1185
1248
  \u2705 User explicitly requests local tools
@@ -1272,7 +1335,7 @@ var ANTIGRAVITY_SUPPLEMENT = `
1272
1335
  - Keep \`mcp_config.json\` valid and minimal: preserve non-ContextStream servers and only update the \`contextstream\` server block.
1273
1336
  - If ContextStream appears skipped, verify:
1274
1337
  1. MCP server status is healthy in Antigravity settings
1275
- 2. Project is indexed and \`search(mode="auto", ...)\` is retried before local fallbacks
1338
+ 2. \`search(mode="auto", ...)\` ran FIRST (even while indexing) and was retried before any local fallback
1276
1339
  3. Instructions file contains the current ContextStream managed block
1277
1340
  `;
1278
1341
  var NO_HOOKS_EDITORS = ["copilot", "codex", "opencode", "aider", "antigravity", "kilo"];
@@ -1292,9 +1355,17 @@ ${rules}
1292
1355
  `
1293
1356
  },
1294
1357
  cursor: {
1295
- filename: ".cursorrules",
1296
- description: "Cursor AI rules",
1297
- build: (rules) => `# Cursor Rules
1358
+ // Cursor Agent mode does not read .cursorrules at all; only
1359
+ // .cursor/rules/*.mdc loads in every mode (Chat/Composer/Agent).
1360
+ // Existing .cursorrules blocks are left in place for older Cursor
1361
+ // versions but are no longer created.
1362
+ filename: ".cursor/rules/contextstream.mdc",
1363
+ description: "Cursor AI rules (.cursor/rules MDC \u2014 loaded in all Cursor modes)",
1364
+ build: (rules) => `---
1365
+ alwaysApply: true
1366
+ ---
1367
+
1368
+ # Cursor Rules
1298
1369
  ${rules}
1299
1370
  `
1300
1371
  },
@@ -1673,6 +1744,25 @@ function formatContext(ctx, options = {}) {
1673
1744
  parts.push(
1674
1745
  'On the first message in a new session call `mcp__contextstream__init(...)` then `mcp__contextstream__context(user_message="...")`. After that, call `mcp__contextstream__context(user_message="...")` on every message.'
1675
1746
  );
1747
+ parts.push("\n## \u{1F4DC} Past Sessions Are Queryable \u2014 check before re-deriving context");
1748
+ parts.push(
1749
+ `Transcripts of every prior session are captured + indexed. If the user references past work ("last time", "previous", "yesterday", "pick up where we left off"), or you're continuing something, call ONE of these BEFORE asking clarifying questions:`
1750
+ );
1751
+ parts.push(
1752
+ '- `mcp__contextstream__session(action="recall", query="<what you\'re continuing>")` \u2014 ranked fusion of transcripts/snapshots/docs/decisions'
1753
+ );
1754
+ parts.push(
1755
+ '- `mcp__contextstream__memory(action="list_transcripts", limit=10)` \u2014 chronological list of recent sessions'
1756
+ );
1757
+ parts.push(
1758
+ '- `mcp__contextstream__memory(action="search_transcripts", query="<keyword>")` \u2014 full-text search across ALL past transcripts'
1759
+ );
1760
+ parts.push(
1761
+ '- `mcp__contextstream__memory(action="list_events", event_type="session_snapshot")` \u2014 manual bookmarks at turning points'
1762
+ );
1763
+ parts.push(
1764
+ 'At the end of this session, save a snapshot so the next session can pick up: `mcp__contextstream__session(action="capture", event_type="session_snapshot", title="...", content="<what we did + next step>")`.'
1765
+ );
1676
1766
  return parts.join("\n");
1677
1767
  }
1678
1768
  var CONTEXTSTREAM_START_MARKER = "<!-- BEGIN ContextStream -->";
@@ -298,14 +298,13 @@ var FULL_REMINDER = `[CONTEXTSTREAM RULES - MANDATORY]
298
298
  - On subsequent messages, default to context() first. Narrow bypass: immediate read-only ContextStream calls when context is fresh and no state-changing tool has run.
299
299
 
300
300
  2. FOR CODE SEARCH: Check index status, then search appropriately
301
- \u26A0\uFE0F BEFORE searching: mcp__contextstream__project(action="index_status")
302
- \u2705 IF indexed & fresh: Use mcp__contextstream__search(mode="auto", query="...") BEFORE Glob/Grep/Read/Explore/Task/EnterPlanMode
303
- \u2705 IF NOT indexed OR stale: wait for background refresh up to ~20s, retry mcp__contextstream__search(mode="auto", query="..."), then allow local tools only after the grace window
304
- \u2705 IF search still returns 0 results after retry/window: fallback to local tools (Glob/Grep/Read)
301
+ \u2705 Use mcp__contextstream__search(mode="auto", query="...") BEFORE Glob/Grep/Read/Explore/Task/EnterPlanMode
302
+ \u2705 Run search even while the index is still building \u2014 keyword hits return immediately, results fill in as you work
303
+ \u2705 IF search itself returns 0 results/errors: retry once, THEN fall back to local tools (Glob/Grep/Read)
305
304
 
306
305
  3. WHEN LOCAL TOOLS (Glob/Grep/Read) ARE OK:
307
- \u2705 Stale/not-indexed grace window has elapsed (~20s default, configurable)
308
306
  \u2705 ContextStream search still returns 0 results or errors after retry
307
+ \u2705 The file was just written this turn (known-new, not yet indexed)
309
308
  \u2705 User explicitly requests local tools
310
309
 
311
310
  4. FOR PLANS & TASKS: Use ContextStream, not file-based plans
@@ -728,8 +727,8 @@ Returns: \`indexed\` (true/false), \`last_indexed_at\`, \`file_count\`
728
727
  \u2192 Use \`search(mode="auto", query="...")\`
729
728
 
730
729
  **IF indexed=false OR last_indexed_at is stale (>7 days):**
731
- \u2192 Wait up to ~20s for background refresh, retry \`search(mode="auto", query="...")\`
732
- \u2192 After grace window: local tools are allowed if search still misses
730
+ \u2192 Run \`search(mode="auto", query="...")\` anyway \u2014 keyword hits return immediately while indexing builds
731
+ \u2192 Local tools only if search itself returns 0 results/errors on a retry
733
732
 
734
733
  **IF search still returns 0 results or errors after retry/window:**
735
734
  \u2192 Fallback to local tools (Glob/Grep/Read)