mindgraph-mcp 0.2.1 → 0.3.1

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 (3) hide show
  1. package/dist/cli.js +95 -56
  2. package/dist/index.js +95 -56
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -411,33 +411,43 @@ async function handlePlan(client2, args) {
411
411
  }
412
412
  }
413
413
  async function handleRetrieve(client2, args) {
414
- const { action, query, layer, limit, node_type, agent_id } = args;
414
+ const {
415
+ action,
416
+ query,
417
+ node_types,
418
+ layer,
419
+ limit,
420
+ include_chunks,
421
+ include_graph,
422
+ confidence_min,
423
+ salience_min,
424
+ agent_id
425
+ } = args;
415
426
  switch (action) {
416
427
  case "context":
417
428
  if (!query) return err("query is required for context retrieval");
418
- return ok(await client2.retrieveContext({ query, k: limit }));
419
- case "hybrid":
420
- if (!query) return err("query is required for hybrid search");
421
429
  return ok(
422
- await client2.hybridSearch(query, {
430
+ await client2.retrieveContext({
431
+ query,
423
432
  k: limit,
424
- node_types: node_type ? [node_type] : void 0
433
+ node_types,
434
+ layer,
435
+ include_chunks,
436
+ include_graph
425
437
  })
426
438
  );
427
- case "semantic":
428
- if (!query) return err("query is required for semantic search");
439
+ case "text":
440
+ if (!query) return err("query is required for text search");
429
441
  return ok(
430
442
  await client2.retrieve({
431
- action: "semantic",
443
+ action: "text",
432
444
  query,
433
445
  limit,
434
- node_type,
446
+ node_types,
447
+ layer,
435
448
  agent_id
436
449
  })
437
450
  );
438
- case "text":
439
- if (!query) return err("query is required for text search");
440
- return ok(await client2.search(query, { limit, node_type }));
441
451
  case "active_goals":
442
452
  return ok(await client2.getGoals());
443
453
  case "open_questions":
@@ -463,7 +473,9 @@ async function handleRetrieve(client2, args) {
463
473
  await client2.retrieve({
464
474
  action: "recent",
465
475
  limit,
466
- node_type,
476
+ node_types,
477
+ confidence_min,
478
+ salience_min,
467
479
  agent_id
468
480
  })
469
481
  );
@@ -525,7 +537,7 @@ var init_tools = __esm({
525
537
  TOOLS = [
526
538
  {
527
539
  name: "mindgraph_session",
528
- description: "Manage conversation sessions. ALWAYS open a session at the start of a substantial conversation (label it with the topic). Use 'trace' to bookmark key moments (decisions made, important facts shared). Close the session at the end with a summary of what was discussed. Sessions enable the graph to track conversation continuity and trigger knowledge distillation on close.",
540
+ description: "Manage conversation sessions. Only open a session for long, substantive conversations \u2014 never as a first action. Use 'trace' to bookmark key moments (decisions, important facts). Close with a summary to trigger knowledge distillation. Sessions track conversation continuity but are optional for short interactions.",
529
541
  inputSchema: {
530
542
  type: "object",
531
543
  properties: {
@@ -943,15 +955,13 @@ var init_tools = __esm({
943
955
  },
944
956
  {
945
957
  name: "mindgraph_retrieve",
946
- description: "Search and query the knowledge graph. ALWAYS retrieve before answering questions about previously stored knowledge. Actions: 'context' for rich retrieval (follows graph edges \u2014 best for RAG), 'hybrid' for fast keyword+semantic search, 'text' for exact keyword match, 'semantic' for meaning-based search. Convenience queries: 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a specific cognitive layer, 'recent' for latest additions.",
958
+ description: "Search and query the knowledge graph using full-text search (BM25). Use short keyword queries \u2014 specific nouns and terms, NOT full sentences. Only retrieve when the user's message references or benefits from stored knowledge \u2014 do NOT pre-fetch goals/questions/contradictions unless asked. Actions: 'context' for rich retrieval (FTS + graph traversal, returns connected entities and source chunks), 'text' for fast direct keyword search. Convenience queries (no query needed): 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a cognitive layer, 'recent' for latest additions.",
947
959
  inputSchema: {
948
960
  type: "object",
949
961
  properties: {
950
962
  action: {
951
963
  type: "string",
952
964
  enum: [
953
- "hybrid",
954
- "semantic",
955
965
  "text",
956
966
  "context",
957
967
  "active_goals",
@@ -966,7 +976,12 @@ var init_tools = __esm({
966
976
  },
967
977
  query: {
968
978
  type: "string",
969
- description: "Search query (for hybrid, semantic, text, context)"
979
+ description: "Keyword search query \u2014 use specific nouns and terms, e.g. 'Rust async runtime' not 'what do I know about async in Rust' (for text, context)"
980
+ },
981
+ node_types: {
982
+ type: "array",
983
+ items: { type: "string" },
984
+ description: "Filter by node types (e.g. ['Claim', 'Entity', 'Observation'])"
970
985
  },
971
986
  layer: {
972
987
  type: "string",
@@ -978,15 +993,31 @@ var init_tools = __esm({
978
993
  "memory",
979
994
  "agent"
980
995
  ],
981
- description: "Layer filter (for layer action)"
996
+ description: "Filter by cognitive layer (for context, text, layer actions)"
982
997
  },
983
998
  limit: {
984
999
  type: "number",
985
1000
  description: "Max results to return (default: 10)"
986
1001
  },
987
- node_type: {
988
- type: "string",
989
- description: "Filter by node type"
1002
+ include_chunks: {
1003
+ type: "boolean",
1004
+ description: "Include source document chunks in context results (default: true)"
1005
+ },
1006
+ include_graph: {
1007
+ type: "boolean",
1008
+ description: "Include graph nodes in context results (default: true)"
1009
+ },
1010
+ confidence_min: {
1011
+ type: "number",
1012
+ minimum: 0,
1013
+ maximum: 1,
1014
+ description: "Minimum confidence filter (for recent action)"
1015
+ },
1016
+ salience_min: {
1017
+ type: "number",
1018
+ minimum: 0,
1019
+ maximum: 1,
1020
+ description: "Minimum salience filter (for recent action)"
990
1021
  },
991
1022
  agent_id: {
992
1023
  type: "string",
@@ -1064,7 +1095,7 @@ async function main() {
1064
1095
  const transport = new import_stdio.StdioServerTransport();
1065
1096
  await server.connect(transport);
1066
1097
  console.error(
1067
- `MindGraph MCP server v0.2.0 running on stdio (${BASE_URL})`
1098
+ `MindGraph MCP server v0.3.1 running on stdio (${BASE_URL})`
1068
1099
  );
1069
1100
  }
1070
1101
  var import_server, import_stdio, import_types, import_mindgraph, API_KEY, BASE_URL, AGENT_ID, client, INSTRUCTIONS, server, PROMPTS;
@@ -1091,48 +1122,56 @@ var init_src = __esm({
1091
1122
  });
1092
1123
  INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph. This is the user's long-term memory \u2014 use it proactively.
1093
1124
 
1094
- ## When to WRITE to the graph
1125
+ ## Critical: minimize latency
1095
1126
 
1096
- Store knowledge whenever the user shares something worth remembering:
1097
- - **People, organizations, places, events** \u2192 \`mindgraph_capture\` with action "entity" and the appropriate entity_type
1098
- - **Quick notes, preferences, reflections, moods** \u2192 \`mindgraph_journal\`
1099
- - **Factual observations about the world** \u2192 \`mindgraph_capture\` with action "observation"
1100
- - **Claims that could be true or false** \u2192 \`mindgraph_argue\` (with evidence if available)
1101
- - **Questions to investigate later** \u2192 \`mindgraph_inquire\` with action "open_question"
1102
- - **Hypotheses or theories** \u2192 \`mindgraph_inquire\` with action "hypothesis" or "theory"
1103
- - **Goals or projects the user is working on** \u2192 \`mindgraph_commit\`
1104
- - **Decisions being made** \u2192 \`mindgraph_decide\` (open, add options, resolve)
1105
- - **Long-form content (articles, transcripts, documents)** \u2192 \`mindgraph_ingest\`
1127
+ - **Jump straight to the user's topic.** Do NOT pre-fetch goals, open questions, or other convenience queries unless the user specifically asks about them.
1128
+ - **Parallelize tool calls.** When you need to search and capture at the same time, issue all calls in a single parallel batch \u2014 never serialize independent calls.
1129
+ - **Sessions are optional.** Only open a session if the conversation is long and substantive. Never open a session as a first action \u2014 answer the user's question first, then open a session in the background if warranted.
1106
1130
 
1107
1131
  ## When to READ from the graph
1108
1132
 
1109
- Retrieve context before answering questions that might benefit from prior knowledge:
1110
- - **"What do I know about X?"** \u2192 \`mindgraph_retrieve\` with action "hybrid" or "context"
1111
- - **"What are my goals?"** \u2192 \`mindgraph_retrieve\` with action "active_goals"
1112
- - **"What questions are open?"** \u2192 \`mindgraph_retrieve\` with action "open_questions"
1113
- - **Anything referencing past conversations or stored knowledge** \u2192 \`mindgraph_retrieve\` with action "context"
1114
- - **Before making claims about things the user has told you** \u2192 retrieve first to avoid contradictions
1133
+ Only retrieve when the user's message references or would benefit from stored knowledge:
1134
+ - User asks about a topic \u2192 \`mindgraph_retrieve\` with action "context" and keyword query
1135
+ - User asks about goals \u2192 \`mindgraph_retrieve\` with action "active_goals"
1136
+ - User asks about open questions \u2192 \`mindgraph_retrieve\` with action "open_questions"
1137
+ - Before asserting something the user previously told you \u2192 retrieve to check
1138
+
1139
+ Do NOT retrieve preemptively. If the user says "let's discuss X", search for X \u2014 don't also fetch goals, questions, and contradictions.
1140
+
1141
+ ## Search query style
1115
1142
 
1116
- ## Session management
1143
+ MindGraph uses **full-text search (BM25)**, not semantic/embedding search. Write queries as **short keyword phrases**, not natural language questions:
1144
+ - GOOD: \`"Rust async runtime"\`, \`"project deadline March"\`, \`"Sarah engineering manager"\`
1145
+ - BAD: \`"what do I know about async programming in Rust?"\`, \`"tell me about Sarah's role"\`
1117
1146
 
1118
- - Open a session with \`mindgraph_session\` action "open" at the start of a substantial conversation
1119
- - Use action "trace" to mark key moments during the conversation
1120
- - Close the session with action "close" and a summary at the end
1147
+ Use the most specific nouns and terms from the topic. Multiple keywords broaden recall across label, summary, and content fields.
1148
+
1149
+ ## When to WRITE to the graph
1150
+
1151
+ Store knowledge whenever the user shares something worth remembering:
1152
+ - **People, organizations, places, events** \u2192 \`mindgraph_capture\` with action "entity"
1153
+ - **Quick notes, preferences, reflections, moods** \u2192 \`mindgraph_journal\`
1154
+ - **Factual observations** \u2192 \`mindgraph_capture\` with action "observation"
1155
+ - **Claims with evidence** \u2192 \`mindgraph_argue\`
1156
+ - **Questions to track** \u2192 \`mindgraph_inquire\` with action "open_question"
1157
+ - **Hypotheses or theories** \u2192 \`mindgraph_inquire\` with action "hypothesis" or "theory"
1158
+ - **Goals or projects** \u2192 \`mindgraph_commit\`
1159
+ - **Decisions** \u2192 \`mindgraph_decide\`
1160
+ - **Long-form content** \u2192 \`mindgraph_ingest\`
1121
1161
 
1122
1162
  ## Tool selection guide
1123
1163
 
1124
- - **mindgraph_capture vs mindgraph_journal**: Use \`capture\` for structured entities (people, orgs, places) and factual observations. Use \`journal\` for informal notes, preferences, reflections, and anything that's more about the user's inner state than external facts.
1125
- - **mindgraph_argue vs mindgraph_inquire**: Use \`argue\` when there's a specific claim with supporting evidence. Use \`inquire\` for open-ended questions, hypotheses without evidence yet, or theoretical frameworks.
1126
- - **mindgraph_commit vs mindgraph_plan**: Use \`commit\` for the user's goals, projects, and milestones. Use \`plan\` for agent-level task management and execution tracking.
1127
- - **mindgraph_retrieve "hybrid" vs "context"**: Use "hybrid" for quick keyword+semantic search. Use "context" for richer retrieval that follows graph edges from matching chunks to find connected entities and claims.
1128
- - **mindgraph_ingest**: Use for any content longer than a paragraph. It automatically extracts entities, claims, and relationships. For short facts, use the specific cognitive tools instead.
1164
+ - **mindgraph_capture vs mindgraph_journal**: \`capture\` for structured entities and factual observations. \`journal\` for informal notes, preferences, and reflections.
1165
+ - **mindgraph_argue vs mindgraph_inquire**: \`argue\` when there's evidence. \`inquire\` for open questions and hypotheses without evidence yet.
1166
+ - **mindgraph_retrieve "text" vs "context"**: "text" for fast direct keyword lookup. "context" for richer retrieval that follows graph edges to connected entities and source chunks \u2014 best for RAG.
1167
+ - **mindgraph_ingest**: For content longer than a paragraph. Automatically extracts entities, claims, and relationships.
1129
1168
 
1130
1169
  ## Important behaviors
1131
1170
 
1132
- - Be proactive: if the user mentions a person, place, or organization you haven't captured yet, capture it
1133
- - Deduplicate: the graph handles entity deduplication automatically \u2014 don't worry about creating duplicates
1134
- - Confidence scores: use 0.9+ for things the user states as fact, 0.5-0.8 for uncertain claims, below 0.5 for speculation
1135
- - Don't narrate tool usage excessively \u2014 capture knowledge naturally as part of the conversation`;
1171
+ - Be proactive about capturing: if the user mentions a person, place, or organization, capture it
1172
+ - Deduplicate: the graph handles deduplication automatically
1173
+ - Confidence scores: 0.9+ for stated facts, 0.5-0.8 for uncertain claims, below 0.5 for speculation
1174
+ - Don't narrate tool usage \u2014 capture knowledge naturally as part of the conversation`;
1136
1175
  server = new import_server.Server(
1137
1176
  {
1138
1177
  name: "mindgraph",
@@ -1269,7 +1308,7 @@ Retrieve context before answering questions that might benefit from prior knowle
1269
1308
  role: "user",
1270
1309
  content: {
1271
1310
  type: "text",
1272
- text: `Search my knowledge graph for everything related to "${topic}". Use both hybrid search and context retrieval to find entities, claims, evidence, questions, and any connected knowledge. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1311
+ text: `Search my knowledge graph for everything related to "${topic}". Use context retrieval with keyword queries to find entities, claims, evidence, questions, and any connected knowledge. Try multiple keyword variations to ensure broad coverage. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1273
1312
  }
1274
1313
  }
1275
1314
  ]
@@ -1463,7 +1502,7 @@ ${conversation}`
1463
1502
  const searchMatch = uri.match(/^mindgraph:\/\/search\/(.+)$/);
1464
1503
  if (searchMatch) {
1465
1504
  const query = decodeURIComponent(searchMatch[1]);
1466
- const results = await client.hybridSearch(query, { k: 20 });
1505
+ const results = await client.search(query, { limit: 20 });
1467
1506
  return {
1468
1507
  contents: [
1469
1508
  {
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ var import_mindgraph = require("mindgraph");
10
10
  var TOOLS = [
11
11
  {
12
12
  name: "mindgraph_session",
13
- description: "Manage conversation sessions. ALWAYS open a session at the start of a substantial conversation (label it with the topic). Use 'trace' to bookmark key moments (decisions made, important facts shared). Close the session at the end with a summary of what was discussed. Sessions enable the graph to track conversation continuity and trigger knowledge distillation on close.",
13
+ description: "Manage conversation sessions. Only open a session for long, substantive conversations \u2014 never as a first action. Use 'trace' to bookmark key moments (decisions, important facts). Close with a summary to trigger knowledge distillation. Sessions track conversation continuity but are optional for short interactions.",
14
14
  inputSchema: {
15
15
  type: "object",
16
16
  properties: {
@@ -428,15 +428,13 @@ var TOOLS = [
428
428
  },
429
429
  {
430
430
  name: "mindgraph_retrieve",
431
- description: "Search and query the knowledge graph. ALWAYS retrieve before answering questions about previously stored knowledge. Actions: 'context' for rich retrieval (follows graph edges \u2014 best for RAG), 'hybrid' for fast keyword+semantic search, 'text' for exact keyword match, 'semantic' for meaning-based search. Convenience queries: 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a specific cognitive layer, 'recent' for latest additions.",
431
+ description: "Search and query the knowledge graph using full-text search (BM25). Use short keyword queries \u2014 specific nouns and terms, NOT full sentences. Only retrieve when the user's message references or benefits from stored knowledge \u2014 do NOT pre-fetch goals/questions/contradictions unless asked. Actions: 'context' for rich retrieval (FTS + graph traversal, returns connected entities and source chunks), 'text' for fast direct keyword search. Convenience queries (no query needed): 'active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions'. Use 'layer' to browse a cognitive layer, 'recent' for latest additions.",
432
432
  inputSchema: {
433
433
  type: "object",
434
434
  properties: {
435
435
  action: {
436
436
  type: "string",
437
437
  enum: [
438
- "hybrid",
439
- "semantic",
440
438
  "text",
441
439
  "context",
442
440
  "active_goals",
@@ -451,7 +449,12 @@ var TOOLS = [
451
449
  },
452
450
  query: {
453
451
  type: "string",
454
- description: "Search query (for hybrid, semantic, text, context)"
452
+ description: "Keyword search query \u2014 use specific nouns and terms, e.g. 'Rust async runtime' not 'what do I know about async in Rust' (for text, context)"
453
+ },
454
+ node_types: {
455
+ type: "array",
456
+ items: { type: "string" },
457
+ description: "Filter by node types (e.g. ['Claim', 'Entity', 'Observation'])"
455
458
  },
456
459
  layer: {
457
460
  type: "string",
@@ -463,15 +466,31 @@ var TOOLS = [
463
466
  "memory",
464
467
  "agent"
465
468
  ],
466
- description: "Layer filter (for layer action)"
469
+ description: "Filter by cognitive layer (for context, text, layer actions)"
467
470
  },
468
471
  limit: {
469
472
  type: "number",
470
473
  description: "Max results to return (default: 10)"
471
474
  },
472
- node_type: {
473
- type: "string",
474
- description: "Filter by node type"
475
+ include_chunks: {
476
+ type: "boolean",
477
+ description: "Include source document chunks in context results (default: true)"
478
+ },
479
+ include_graph: {
480
+ type: "boolean",
481
+ description: "Include graph nodes in context results (default: true)"
482
+ },
483
+ confidence_min: {
484
+ type: "number",
485
+ minimum: 0,
486
+ maximum: 1,
487
+ description: "Minimum confidence filter (for recent action)"
488
+ },
489
+ salience_min: {
490
+ type: "number",
491
+ minimum: 0,
492
+ maximum: 1,
493
+ description: "Minimum salience filter (for recent action)"
475
494
  },
476
495
  agent_id: {
477
496
  type: "string",
@@ -924,33 +943,43 @@ async function handlePlan(client2, args) {
924
943
  }
925
944
  }
926
945
  async function handleRetrieve(client2, args) {
927
- const { action, query, layer, limit, node_type, agent_id } = args;
946
+ const {
947
+ action,
948
+ query,
949
+ node_types,
950
+ layer,
951
+ limit,
952
+ include_chunks,
953
+ include_graph,
954
+ confidence_min,
955
+ salience_min,
956
+ agent_id
957
+ } = args;
928
958
  switch (action) {
929
959
  case "context":
930
960
  if (!query) return err("query is required for context retrieval");
931
- return ok(await client2.retrieveContext({ query, k: limit }));
932
- case "hybrid":
933
- if (!query) return err("query is required for hybrid search");
934
961
  return ok(
935
- await client2.hybridSearch(query, {
962
+ await client2.retrieveContext({
963
+ query,
936
964
  k: limit,
937
- node_types: node_type ? [node_type] : void 0
965
+ node_types,
966
+ layer,
967
+ include_chunks,
968
+ include_graph
938
969
  })
939
970
  );
940
- case "semantic":
941
- if (!query) return err("query is required for semantic search");
971
+ case "text":
972
+ if (!query) return err("query is required for text search");
942
973
  return ok(
943
974
  await client2.retrieve({
944
- action: "semantic",
975
+ action: "text",
945
976
  query,
946
977
  limit,
947
- node_type,
978
+ node_types,
979
+ layer,
948
980
  agent_id
949
981
  })
950
982
  );
951
- case "text":
952
- if (!query) return err("query is required for text search");
953
- return ok(await client2.search(query, { limit, node_type }));
954
983
  case "active_goals":
955
984
  return ok(await client2.getGoals());
956
985
  case "open_questions":
@@ -976,7 +1005,9 @@ async function handleRetrieve(client2, args) {
976
1005
  await client2.retrieve({
977
1006
  action: "recent",
978
1007
  limit,
979
- node_type,
1008
+ node_types,
1009
+ confidence_min,
1010
+ salience_min,
980
1011
  agent_id
981
1012
  })
982
1013
  );
@@ -1048,48 +1079,56 @@ var client = new import_mindgraph.MindGraph({
1048
1079
  });
1049
1080
  var INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph. This is the user's long-term memory \u2014 use it proactively.
1050
1081
 
1051
- ## When to WRITE to the graph
1082
+ ## Critical: minimize latency
1052
1083
 
1053
- Store knowledge whenever the user shares something worth remembering:
1054
- - **People, organizations, places, events** \u2192 \`mindgraph_capture\` with action "entity" and the appropriate entity_type
1055
- - **Quick notes, preferences, reflections, moods** \u2192 \`mindgraph_journal\`
1056
- - **Factual observations about the world** \u2192 \`mindgraph_capture\` with action "observation"
1057
- - **Claims that could be true or false** \u2192 \`mindgraph_argue\` (with evidence if available)
1058
- - **Questions to investigate later** \u2192 \`mindgraph_inquire\` with action "open_question"
1059
- - **Hypotheses or theories** \u2192 \`mindgraph_inquire\` with action "hypothesis" or "theory"
1060
- - **Goals or projects the user is working on** \u2192 \`mindgraph_commit\`
1061
- - **Decisions being made** \u2192 \`mindgraph_decide\` (open, add options, resolve)
1062
- - **Long-form content (articles, transcripts, documents)** \u2192 \`mindgraph_ingest\`
1084
+ - **Jump straight to the user's topic.** Do NOT pre-fetch goals, open questions, or other convenience queries unless the user specifically asks about them.
1085
+ - **Parallelize tool calls.** When you need to search and capture at the same time, issue all calls in a single parallel batch \u2014 never serialize independent calls.
1086
+ - **Sessions are optional.** Only open a session if the conversation is long and substantive. Never open a session as a first action \u2014 answer the user's question first, then open a session in the background if warranted.
1063
1087
 
1064
1088
  ## When to READ from the graph
1065
1089
 
1066
- Retrieve context before answering questions that might benefit from prior knowledge:
1067
- - **"What do I know about X?"** \u2192 \`mindgraph_retrieve\` with action "hybrid" or "context"
1068
- - **"What are my goals?"** \u2192 \`mindgraph_retrieve\` with action "active_goals"
1069
- - **"What questions are open?"** \u2192 \`mindgraph_retrieve\` with action "open_questions"
1070
- - **Anything referencing past conversations or stored knowledge** \u2192 \`mindgraph_retrieve\` with action "context"
1071
- - **Before making claims about things the user has told you** \u2192 retrieve first to avoid contradictions
1090
+ Only retrieve when the user's message references or would benefit from stored knowledge:
1091
+ - User asks about a topic \u2192 \`mindgraph_retrieve\` with action "context" and keyword query
1092
+ - User asks about goals \u2192 \`mindgraph_retrieve\` with action "active_goals"
1093
+ - User asks about open questions \u2192 \`mindgraph_retrieve\` with action "open_questions"
1094
+ - Before asserting something the user previously told you \u2192 retrieve to check
1095
+
1096
+ Do NOT retrieve preemptively. If the user says "let's discuss X", search for X \u2014 don't also fetch goals, questions, and contradictions.
1097
+
1098
+ ## Search query style
1072
1099
 
1073
- ## Session management
1100
+ MindGraph uses **full-text search (BM25)**, not semantic/embedding search. Write queries as **short keyword phrases**, not natural language questions:
1101
+ - GOOD: \`"Rust async runtime"\`, \`"project deadline March"\`, \`"Sarah engineering manager"\`
1102
+ - BAD: \`"what do I know about async programming in Rust?"\`, \`"tell me about Sarah's role"\`
1074
1103
 
1075
- - Open a session with \`mindgraph_session\` action "open" at the start of a substantial conversation
1076
- - Use action "trace" to mark key moments during the conversation
1077
- - Close the session with action "close" and a summary at the end
1104
+ Use the most specific nouns and terms from the topic. Multiple keywords broaden recall across label, summary, and content fields.
1105
+
1106
+ ## When to WRITE to the graph
1107
+
1108
+ Store knowledge whenever the user shares something worth remembering:
1109
+ - **People, organizations, places, events** \u2192 \`mindgraph_capture\` with action "entity"
1110
+ - **Quick notes, preferences, reflections, moods** \u2192 \`mindgraph_journal\`
1111
+ - **Factual observations** \u2192 \`mindgraph_capture\` with action "observation"
1112
+ - **Claims with evidence** \u2192 \`mindgraph_argue\`
1113
+ - **Questions to track** \u2192 \`mindgraph_inquire\` with action "open_question"
1114
+ - **Hypotheses or theories** \u2192 \`mindgraph_inquire\` with action "hypothesis" or "theory"
1115
+ - **Goals or projects** \u2192 \`mindgraph_commit\`
1116
+ - **Decisions** \u2192 \`mindgraph_decide\`
1117
+ - **Long-form content** \u2192 \`mindgraph_ingest\`
1078
1118
 
1079
1119
  ## Tool selection guide
1080
1120
 
1081
- - **mindgraph_capture vs mindgraph_journal**: Use \`capture\` for structured entities (people, orgs, places) and factual observations. Use \`journal\` for informal notes, preferences, reflections, and anything that's more about the user's inner state than external facts.
1082
- - **mindgraph_argue vs mindgraph_inquire**: Use \`argue\` when there's a specific claim with supporting evidence. Use \`inquire\` for open-ended questions, hypotheses without evidence yet, or theoretical frameworks.
1083
- - **mindgraph_commit vs mindgraph_plan**: Use \`commit\` for the user's goals, projects, and milestones. Use \`plan\` for agent-level task management and execution tracking.
1084
- - **mindgraph_retrieve "hybrid" vs "context"**: Use "hybrid" for quick keyword+semantic search. Use "context" for richer retrieval that follows graph edges from matching chunks to find connected entities and claims.
1085
- - **mindgraph_ingest**: Use for any content longer than a paragraph. It automatically extracts entities, claims, and relationships. For short facts, use the specific cognitive tools instead.
1121
+ - **mindgraph_capture vs mindgraph_journal**: \`capture\` for structured entities and factual observations. \`journal\` for informal notes, preferences, and reflections.
1122
+ - **mindgraph_argue vs mindgraph_inquire**: \`argue\` when there's evidence. \`inquire\` for open questions and hypotheses without evidence yet.
1123
+ - **mindgraph_retrieve "text" vs "context"**: "text" for fast direct keyword lookup. "context" for richer retrieval that follows graph edges to connected entities and source chunks \u2014 best for RAG.
1124
+ - **mindgraph_ingest**: For content longer than a paragraph. Automatically extracts entities, claims, and relationships.
1086
1125
 
1087
1126
  ## Important behaviors
1088
1127
 
1089
- - Be proactive: if the user mentions a person, place, or organization you haven't captured yet, capture it
1090
- - Deduplicate: the graph handles entity deduplication automatically \u2014 don't worry about creating duplicates
1091
- - Confidence scores: use 0.9+ for things the user states as fact, 0.5-0.8 for uncertain claims, below 0.5 for speculation
1092
- - Don't narrate tool usage excessively \u2014 capture knowledge naturally as part of the conversation`;
1128
+ - Be proactive about capturing: if the user mentions a person, place, or organization, capture it
1129
+ - Deduplicate: the graph handles deduplication automatically
1130
+ - Confidence scores: 0.9+ for stated facts, 0.5-0.8 for uncertain claims, below 0.5 for speculation
1131
+ - Don't narrate tool usage \u2014 capture knowledge naturally as part of the conversation`;
1093
1132
  var server = new import_server.Server(
1094
1133
  {
1095
1134
  name: "mindgraph",
@@ -1226,7 +1265,7 @@ server.setRequestHandler(import_types.GetPromptRequestSchema, async (request) =>
1226
1265
  role: "user",
1227
1266
  content: {
1228
1267
  type: "text",
1229
- text: `Search my knowledge graph for everything related to "${topic}". Use both hybrid search and context retrieval to find entities, claims, evidence, questions, and any connected knowledge. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1268
+ text: `Search my knowledge graph for everything related to "${topic}". Use context retrieval with keyword queries to find entities, claims, evidence, questions, and any connected knowledge. Try multiple keyword variations to ensure broad coverage. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1230
1269
  }
1231
1270
  }
1232
1271
  ]
@@ -1420,7 +1459,7 @@ server.setRequestHandler(import_types.ReadResourceRequestSchema, async (request)
1420
1459
  const searchMatch = uri.match(/^mindgraph:\/\/search\/(.+)$/);
1421
1460
  if (searchMatch) {
1422
1461
  const query = decodeURIComponent(searchMatch[1]);
1423
- const results = await client.hybridSearch(query, { k: 20 });
1462
+ const results = await client.search(query, { limit: 20 });
1424
1463
  return {
1425
1464
  contents: [
1426
1465
  {
@@ -1451,7 +1490,7 @@ async function main() {
1451
1490
  const transport = new import_stdio.StdioServerTransport();
1452
1491
  await server.connect(transport);
1453
1492
  console.error(
1454
- `MindGraph MCP server v0.2.0 running on stdio (${BASE_URL})`
1493
+ `MindGraph MCP server v0.3.1 running on stdio (${BASE_URL})`
1455
1494
  );
1456
1495
  }
1457
1496
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "MCP server for MindGraph — connect Claude Desktop, Claude Code, and any MCP client to your knowledge graph",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",