mindgraph-mcp 0.3.2 → 0.3.4

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 +53 -42
  2. package/dist/index.js +53 -42
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -874,7 +874,7 @@ var init_tools = __esm({
874
874
  },
875
875
  {
876
876
  name: "mindgraph_retrieve",
877
- 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.",
877
+ description: "Search the knowledge graph using BM25 keyword matching. Primary action: 'context' \u2014 pass 1\u20133 discriminating keywords (proper nouns, technical terms) extracted from the user's question. Drop filler words (what, how, tell me about, implications of). GOOD: 'Kissinger NATO', 'Rust async runtime'. BAD: 'What is Kissinger\\'s view on NATO?'. Use 'text' for fast keyword-only lookup. Other actions ('active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions', 'layer', 'recent') are ONLY for when the user explicitly asks about those topics \u2014 never pre-fetch them.",
878
878
  inputSchema: {
879
879
  type: "object",
880
880
  properties: {
@@ -895,7 +895,7 @@ var init_tools = __esm({
895
895
  },
896
896
  query: {
897
897
  type: "string",
898
- 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)"
898
+ description: "BM25 keyword query \u2014 extract 1\u20133 discriminating terms from the user's question, drop filler words. User asks 'What is Kissinger's view on NATO?' \u2192 'Kissinger NATO'. User asks about async in Rust \u2192 'Rust async runtime'. NEVER pass natural language sentences. (for text, context)"
899
899
  },
900
900
  node_types: {
901
901
  type: "array",
@@ -1039,61 +1039,72 @@ var init_src = __esm({
1039
1039
  baseUrl: BASE_URL,
1040
1040
  apiKey: API_KEY
1041
1041
  });
1042
- INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph. This is the user's long-term memory \u2014 use it proactively.
1042
+ INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph.
1043
1043
 
1044
- ## Critical: minimize latency
1044
+ ## #1 RULE: Go straight to the user's topic
1045
1045
 
1046
- - **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.
1047
- - **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.
1046
+ When the user asks about something, your FIRST and ONLY action should be a SINGLE \`mindgraph_retrieve\` call with action "context" and keyword terms from their message. Nothing else first.
1048
1047
 
1049
- ## When to READ from the graph
1048
+ **NEVER do any of these before addressing the user's topic:**
1049
+ - Do NOT retrieve active_goals
1050
+ - Do NOT retrieve open_questions
1051
+ - Do NOT retrieve contradictions or weak_claims
1052
+ - Do NOT follow a "session lifecycle" or "warm-up" sequence
1053
+ - Do NOT make multiple serial retrieve calls when one "context" call covers it
1050
1054
 
1051
- Only retrieve when the user's message references or would benefit from stored knowledge:
1052
- - User asks about a topic \u2192 \`mindgraph_retrieve\` with action "context" and keyword query
1053
- - User asks about goals \u2192 \`mindgraph_retrieve\` with action "active_goals"
1054
- - User asks about open questions \u2192 \`mindgraph_retrieve\` with action "open_questions"
1055
- - Before asserting something the user previously told you \u2192 retrieve to check
1055
+ There is no session to open. There is no context to pre-load. Just search for what the user asked about.
1056
1056
 
1057
- Do NOT retrieve preemptively. If the user says "let's discuss X", search for X \u2014 don't also fetch goals, questions, and contradictions.
1057
+ **Example:** User says "Tell me about Indian philosophy and Taoism"
1058
+ \u2713 CORRECT: \`mindgraph_retrieve({action: "context", query: "Indian philosophy Taoism"})\` \u2014 extracted key nouns, dropped "Tell me about"
1059
+ \u2717 WRONG: First retrieve active_goals, then open_questions, then search for the topic
1060
+ \u2717 WRONG: \`mindgraph_retrieve({action: "context", query: "Tell me about Indian philosophy and Taoism"})\` \u2014 natural language sentence won't match BM25 index
1058
1061
 
1059
- ## Search query style
1062
+ ## Search query style \u2014 BM25 keyword matching
1060
1063
 
1061
- MindGraph uses **full-text search (BM25)**, not semantic/embedding search. Write queries as **short keyword phrases**, not natural language questions:
1062
- - GOOD: \`"Rust async runtime"\`, \`"project deadline March"\`, \`"Sarah engineering manager"\`
1063
- - BAD: \`"what do I know about async programming in Rust?"\`, \`"tell me about Sarah's role"\`
1064
+ The search index uses BM25 keyword matching against node labels and summaries. It matches individual words, NOT meaning or concepts. Drop filler words like "what", "how", "implications of", "tell me about". Query with 1\u20133 discriminating terms (proper nouns, technical terms, domain-specific words).
1064
1065
 
1065
- Use the most specific nouns and terms from the topic. Multiple keywords broaden recall across label, summary, and content fields.
1066
+ **Derive keywords from the user's question \u2014 examples:**
1067
+ - User asks "What is Kissinger's view on NATO expansion?" \u2192 query: \`"Kissinger NATO"\`
1068
+ - User asks "Tell me about async programming in Rust" \u2192 query: \`"Rust async runtime"\`
1069
+ - User asks "How does Indian philosophy relate to Taoism?" \u2192 query: \`"Indian philosophy Taoism"\`
1070
+ - User asks "What are the implications of carbon tax policy?" \u2192 query: \`"carbon tax"\`
1066
1071
 
1067
- ## When to WRITE to the graph
1072
+ **GOOD queries:** \`"Rust async runtime"\`, \`"Kissinger NATO"\`, \`"carbon tax emissions"\`
1073
+ **BAD queries:** \`"what do I know about async programming in Rust?"\`, \`"how does X relate to Y"\`, \`"implications of climate change"\`
1068
1074
 
1069
- Store knowledge whenever the user shares something worth remembering:
1070
- - **People, organizations, places, events** \u2192 \`mindgraph_capture\` with action "entity"
1071
- - **Quick notes, preferences, reflections, moods** \u2192 \`mindgraph_journal\`
1072
- - **Factual observations** \u2192 \`mindgraph_capture\` with action "observation"
1073
- - **Claims with evidence** \u2192 \`mindgraph_argue\`
1074
- - **Questions to track** \u2192 \`mindgraph_inquire\` with action "open_question"
1075
- - **Hypotheses or theories** \u2192 \`mindgraph_inquire\` with action "hypothesis" or "theory"
1076
- - **Goals or projects** \u2192 \`mindgraph_commit\`
1077
- - **Decisions** \u2192 \`mindgraph_decide\`
1078
- - **Long-form content** \u2192 \`mindgraph_ingest\`
1075
+ If the first query returns no results, try synonym or related terms (e.g. \`"global warming"\` instead of \`"climate change"\`).
1079
1076
 
1080
- ## Tool selection guide
1077
+ ## When to READ
1081
1078
 
1082
- - **mindgraph_capture vs mindgraph_journal**: \`capture\` for structured entities and factual observations. \`journal\` for informal notes, preferences, and reflections.
1083
- - **mindgraph_argue vs mindgraph_inquire**: \`argue\` when there's evidence. \`inquire\` for open questions and hypotheses without evidence yet.
1084
- - **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.
1085
- - **mindgraph_ingest**: For content longer than a paragraph. Automatically extracts entities, claims, and relationships.
1079
+ - User asks about topic X \u2192 \`mindgraph_retrieve\` action "context", query "X keywords"
1080
+ - User explicitly asks "what are my goals?" \u2192 action "active_goals"
1081
+ - User explicitly asks about open questions \u2192 action "open_questions"
1082
+ - Before asserting something the user previously said \u2192 retrieve to check
1083
+ - Parallelize independent calls in a single batch
1086
1084
 
1087
- ## Important behaviors
1085
+ ## When to WRITE
1088
1086
 
1089
- - Be proactive about capturing: if the user mentions a person, place, or organization, capture it
1090
- - Deduplicate: the graph handles deduplication automatically
1091
- - Confidence scores: 0.9+ for stated facts, 0.5-0.8 for uncertain claims, below 0.5 for speculation
1092
- - Don't narrate tool usage \u2014 capture knowledge naturally as part of the conversation`;
1087
+ Capture knowledge when the user shares something worth remembering:
1088
+ - People/orgs/places/events \u2192 \`mindgraph_capture\` action "entity"
1089
+ - Quick notes, preferences \u2192 \`mindgraph_journal\`
1090
+ - Factual observations \u2192 \`mindgraph_capture\` action "observation"
1091
+ - Claims with evidence \u2192 \`mindgraph_argue\`
1092
+ - Questions to track \u2192 \`mindgraph_inquire\` action "open_question"
1093
+ - Goals or projects \u2192 \`mindgraph_commit\`
1094
+ - Decisions \u2192 \`mindgraph_decide\`
1095
+ - Long-form content \u2192 \`mindgraph_ingest\`
1096
+
1097
+ ## Tool tips
1098
+
1099
+ - \`capture\` for structured/factual, \`journal\` for personal/informal
1100
+ - \`argue\` when evidence exists, \`inquire\` for open questions
1101
+ - \`text\` for fast lookup, \`context\` for rich retrieval with graph traversal
1102
+ - Confidence: 0.9+ for facts, 0.5-0.8 for uncertain, <0.5 for speculation
1103
+ - Don't narrate tool usage \u2014 capture naturally as part of conversation`;
1093
1104
  server = new import_server.Server(
1094
1105
  {
1095
1106
  name: "mindgraph",
1096
- version: "0.2.1"
1107
+ version: "0.3.4"
1097
1108
  },
1098
1109
  {
1099
1110
  capabilities: {
@@ -1226,7 +1237,7 @@ Store knowledge whenever the user shares something worth remembering:
1226
1237
  role: "user",
1227
1238
  content: {
1228
1239
  type: "text",
1229
- 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.`
1240
+ text: `Search my knowledge graph for everything related to "${topic}". Use context retrieval with short BM25 keyword queries (1\u20133 discriminating terms extracted from the topic, not full sentences). Try multiple keyword variations and synonyms to ensure broad coverage. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1230
1241
  }
1231
1242
  }
1232
1243
  ]
@@ -1321,7 +1332,7 @@ ${conversation}`
1321
1332
  {
1322
1333
  uriTemplate: "mindgraph://search/{query}",
1323
1334
  name: "Search Results",
1324
- description: "Full-text search across all nodes in the knowledge graph",
1335
+ description: "BM25 keyword search across all nodes \u2014 pass 1\u20133 discriminating terms (e.g. 'Kissinger NATO'), not natural language sentences",
1325
1336
  mimeType: "application/json"
1326
1337
  },
1327
1338
  {
package/dist/index.js CHANGED
@@ -389,7 +389,7 @@ var TOOLS = [
389
389
  },
390
390
  {
391
391
  name: "mindgraph_retrieve",
392
- 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.",
392
+ description: "Search the knowledge graph using BM25 keyword matching. Primary action: 'context' \u2014 pass 1\u20133 discriminating keywords (proper nouns, technical terms) extracted from the user's question. Drop filler words (what, how, tell me about, implications of). GOOD: 'Kissinger NATO', 'Rust async runtime'. BAD: 'What is Kissinger\\'s view on NATO?'. Use 'text' for fast keyword-only lookup. Other actions ('active_goals', 'open_questions', 'weak_claims', 'pending_approvals', 'unresolved_contradictions', 'layer', 'recent') are ONLY for when the user explicitly asks about those topics \u2014 never pre-fetch them.",
393
393
  inputSchema: {
394
394
  type: "object",
395
395
  properties: {
@@ -410,7 +410,7 @@ var TOOLS = [
410
410
  },
411
411
  query: {
412
412
  type: "string",
413
- 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)"
413
+ description: "BM25 keyword query \u2014 extract 1\u20133 discriminating terms from the user's question, drop filler words. User asks 'What is Kissinger's view on NATO?' \u2192 'Kissinger NATO'. User asks about async in Rust \u2192 'Rust async runtime'. NEVER pass natural language sentences. (for text, context)"
414
414
  },
415
415
  node_types: {
416
416
  type: "array",
@@ -996,61 +996,72 @@ var client = new import_mindgraph.MindGraph({
996
996
  baseUrl: BASE_URL,
997
997
  apiKey: API_KEY
998
998
  });
999
- var INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph. This is the user's long-term memory \u2014 use it proactively.
999
+ var INSTRUCTIONS = `You have access to a persistent knowledge graph via MindGraph.
1000
1000
 
1001
- ## Critical: minimize latency
1001
+ ## #1 RULE: Go straight to the user's topic
1002
1002
 
1003
- - **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.
1004
- - **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.
1003
+ When the user asks about something, your FIRST and ONLY action should be a SINGLE \`mindgraph_retrieve\` call with action "context" and keyword terms from their message. Nothing else first.
1005
1004
 
1006
- ## When to READ from the graph
1005
+ **NEVER do any of these before addressing the user's topic:**
1006
+ - Do NOT retrieve active_goals
1007
+ - Do NOT retrieve open_questions
1008
+ - Do NOT retrieve contradictions or weak_claims
1009
+ - Do NOT follow a "session lifecycle" or "warm-up" sequence
1010
+ - Do NOT make multiple serial retrieve calls when one "context" call covers it
1007
1011
 
1008
- Only retrieve when the user's message references or would benefit from stored knowledge:
1009
- - User asks about a topic \u2192 \`mindgraph_retrieve\` with action "context" and keyword query
1010
- - User asks about goals \u2192 \`mindgraph_retrieve\` with action "active_goals"
1011
- - User asks about open questions \u2192 \`mindgraph_retrieve\` with action "open_questions"
1012
- - Before asserting something the user previously told you \u2192 retrieve to check
1012
+ There is no session to open. There is no context to pre-load. Just search for what the user asked about.
1013
1013
 
1014
- Do NOT retrieve preemptively. If the user says "let's discuss X", search for X \u2014 don't also fetch goals, questions, and contradictions.
1014
+ **Example:** User says "Tell me about Indian philosophy and Taoism"
1015
+ \u2713 CORRECT: \`mindgraph_retrieve({action: "context", query: "Indian philosophy Taoism"})\` \u2014 extracted key nouns, dropped "Tell me about"
1016
+ \u2717 WRONG: First retrieve active_goals, then open_questions, then search for the topic
1017
+ \u2717 WRONG: \`mindgraph_retrieve({action: "context", query: "Tell me about Indian philosophy and Taoism"})\` \u2014 natural language sentence won't match BM25 index
1015
1018
 
1016
- ## Search query style
1019
+ ## Search query style \u2014 BM25 keyword matching
1017
1020
 
1018
- MindGraph uses **full-text search (BM25)**, not semantic/embedding search. Write queries as **short keyword phrases**, not natural language questions:
1019
- - GOOD: \`"Rust async runtime"\`, \`"project deadline March"\`, \`"Sarah engineering manager"\`
1020
- - BAD: \`"what do I know about async programming in Rust?"\`, \`"tell me about Sarah's role"\`
1021
+ The search index uses BM25 keyword matching against node labels and summaries. It matches individual words, NOT meaning or concepts. Drop filler words like "what", "how", "implications of", "tell me about". Query with 1\u20133 discriminating terms (proper nouns, technical terms, domain-specific words).
1021
1022
 
1022
- Use the most specific nouns and terms from the topic. Multiple keywords broaden recall across label, summary, and content fields.
1023
+ **Derive keywords from the user's question \u2014 examples:**
1024
+ - User asks "What is Kissinger's view on NATO expansion?" \u2192 query: \`"Kissinger NATO"\`
1025
+ - User asks "Tell me about async programming in Rust" \u2192 query: \`"Rust async runtime"\`
1026
+ - User asks "How does Indian philosophy relate to Taoism?" \u2192 query: \`"Indian philosophy Taoism"\`
1027
+ - User asks "What are the implications of carbon tax policy?" \u2192 query: \`"carbon tax"\`
1023
1028
 
1024
- ## When to WRITE to the graph
1029
+ **GOOD queries:** \`"Rust async runtime"\`, \`"Kissinger NATO"\`, \`"carbon tax emissions"\`
1030
+ **BAD queries:** \`"what do I know about async programming in Rust?"\`, \`"how does X relate to Y"\`, \`"implications of climate change"\`
1025
1031
 
1026
- Store knowledge whenever the user shares something worth remembering:
1027
- - **People, organizations, places, events** \u2192 \`mindgraph_capture\` with action "entity"
1028
- - **Quick notes, preferences, reflections, moods** \u2192 \`mindgraph_journal\`
1029
- - **Factual observations** \u2192 \`mindgraph_capture\` with action "observation"
1030
- - **Claims with evidence** \u2192 \`mindgraph_argue\`
1031
- - **Questions to track** \u2192 \`mindgraph_inquire\` with action "open_question"
1032
- - **Hypotheses or theories** \u2192 \`mindgraph_inquire\` with action "hypothesis" or "theory"
1033
- - **Goals or projects** \u2192 \`mindgraph_commit\`
1034
- - **Decisions** \u2192 \`mindgraph_decide\`
1035
- - **Long-form content** \u2192 \`mindgraph_ingest\`
1032
+ If the first query returns no results, try synonym or related terms (e.g. \`"global warming"\` instead of \`"climate change"\`).
1036
1033
 
1037
- ## Tool selection guide
1034
+ ## When to READ
1038
1035
 
1039
- - **mindgraph_capture vs mindgraph_journal**: \`capture\` for structured entities and factual observations. \`journal\` for informal notes, preferences, and reflections.
1040
- - **mindgraph_argue vs mindgraph_inquire**: \`argue\` when there's evidence. \`inquire\` for open questions and hypotheses without evidence yet.
1041
- - **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.
1042
- - **mindgraph_ingest**: For content longer than a paragraph. Automatically extracts entities, claims, and relationships.
1036
+ - User asks about topic X \u2192 \`mindgraph_retrieve\` action "context", query "X keywords"
1037
+ - User explicitly asks "what are my goals?" \u2192 action "active_goals"
1038
+ - User explicitly asks about open questions \u2192 action "open_questions"
1039
+ - Before asserting something the user previously said \u2192 retrieve to check
1040
+ - Parallelize independent calls in a single batch
1043
1041
 
1044
- ## Important behaviors
1042
+ ## When to WRITE
1045
1043
 
1046
- - Be proactive about capturing: if the user mentions a person, place, or organization, capture it
1047
- - Deduplicate: the graph handles deduplication automatically
1048
- - Confidence scores: 0.9+ for stated facts, 0.5-0.8 for uncertain claims, below 0.5 for speculation
1049
- - Don't narrate tool usage \u2014 capture knowledge naturally as part of the conversation`;
1044
+ Capture knowledge when the user shares something worth remembering:
1045
+ - People/orgs/places/events \u2192 \`mindgraph_capture\` action "entity"
1046
+ - Quick notes, preferences \u2192 \`mindgraph_journal\`
1047
+ - Factual observations \u2192 \`mindgraph_capture\` action "observation"
1048
+ - Claims with evidence \u2192 \`mindgraph_argue\`
1049
+ - Questions to track \u2192 \`mindgraph_inquire\` action "open_question"
1050
+ - Goals or projects \u2192 \`mindgraph_commit\`
1051
+ - Decisions \u2192 \`mindgraph_decide\`
1052
+ - Long-form content \u2192 \`mindgraph_ingest\`
1053
+
1054
+ ## Tool tips
1055
+
1056
+ - \`capture\` for structured/factual, \`journal\` for personal/informal
1057
+ - \`argue\` when evidence exists, \`inquire\` for open questions
1058
+ - \`text\` for fast lookup, \`context\` for rich retrieval with graph traversal
1059
+ - Confidence: 0.9+ for facts, 0.5-0.8 for uncertain, <0.5 for speculation
1060
+ - Don't narrate tool usage \u2014 capture naturally as part of conversation`;
1050
1061
  var server = new import_server.Server(
1051
1062
  {
1052
1063
  name: "mindgraph",
1053
- version: "0.2.1"
1064
+ version: "0.3.4"
1054
1065
  },
1055
1066
  {
1056
1067
  capabilities: {
@@ -1183,7 +1194,7 @@ server.setRequestHandler(import_types.GetPromptRequestSchema, async (request) =>
1183
1194
  role: "user",
1184
1195
  content: {
1185
1196
  type: "text",
1186
- 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.`
1197
+ text: `Search my knowledge graph for everything related to "${topic}". Use context retrieval with short BM25 keyword queries (1\u20133 discriminating terms extracted from the topic, not full sentences). Try multiple keyword variations and synonyms to ensure broad coverage. Present a structured overview of what I know about this topic, highlighting any gaps or open questions.`
1187
1198
  }
1188
1199
  }
1189
1200
  ]
@@ -1278,7 +1289,7 @@ server.setRequestHandler(import_types.ListResourceTemplatesRequestSchema, async
1278
1289
  {
1279
1290
  uriTemplate: "mindgraph://search/{query}",
1280
1291
  name: "Search Results",
1281
- description: "Full-text search across all nodes in the knowledge graph",
1292
+ description: "BM25 keyword search across all nodes \u2014 pass 1\u20133 discriminating terms (e.g. 'Kissinger NATO'), not natural language sentences",
1282
1293
  mimeType: "application/json"
1283
1294
  },
1284
1295
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph-mcp",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
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",