indra_db_mcp 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,28 @@
1
- # Indra: Your Knowledge Memory
1
+ # Indra: User's Personal Knowledge Base
2
2
 
3
- You have access to **Indra**, a persistent memory for your insights and analysis.
3
+ You have access to **Indra**, the user's personal notes system. Help them build and use it.
4
4
 
5
- ## When to Use Indra
5
+ ## PRIMARY TOOLS
6
6
 
7
- ### BEFORE answering questions `indra_search`
8
- - "What should I..." → Search for prior recommendations
9
- - "Which X is better..." Search for past analysis
10
- - "How do I..." → Search for previous explanations
11
- - Any question about preferences, decisions, or past work
7
+ ### `indra_consult` - Your main knowledge tool
8
+ ```
9
+ indra_consult(topic="shoes", mode="search") Find prior notes
10
+ indra_consult(topic="User prefers Hokas for arch support", mode="save") Save insight
11
+ ```
12
12
 
13
- ### AFTER providing analysis `indra_remember`
14
- - You made a recommendation → Save WHY you recommended it
15
- - You explained something → Save the key insight
16
- - You analyzed options → Save your conclusions
17
- - You learned user preferences → Save that context
13
+ ### `indra_add_note` - Add to user's notes
14
+ ```
15
+ indra_add_note(note="Recovering from plantar fasciitis", category="health")
16
+ ```
18
17
 
19
- ## Quick Reference
18
+ ## THE PATTERN
20
19
 
21
- | When | Tool | Example |
22
- |------|------|---------|
23
- | Before answering | `indra_search` | Search "gym shoes recommendation" |
24
- | After analyzing | `indra_remember` | Save "Recommended Hokas for cycling because..." |
25
- | Finishing a task | `indra_checkpoint` | "Completed workout gear analysis" |
20
+ 1. **Before answering**: `indra_consult` to check for relevant notes
21
+ 2. **Answer the question**: Use any context you found
22
+ 3. **After learning something**: `indra_add_note` to help user track it
26
23
 
27
- ## Why This Matters
24
+ ## IMPORTANT
28
25
 
29
- Without Indra, every conversation starts from zero.
30
- With Indra, you build cumulative knowledge that improves over time.
26
+ Adding notes is **helping the user**, not extra work. They set up this system because they WANT you to track their preferences, context, and insights.
31
27
 
32
- Use `indra_search` BEFORE answering preference/recommendation questions.
33
- Use `indra_remember` AFTER providing analysis worth preserving.
28
+ **Don't ask permission - adding useful notes IS the service they want.**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indra_db_mcp",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "MCP server for indra_db - a content-addressed graph database for versioned thoughts",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -32,34 +32,32 @@ import { EdgeTypes, IndraError } from "./types.js";
32
32
  * 2. When Claude should search for these tools
33
33
  * 3. Key capabilities the server provides
34
34
  */
35
- const SERVER_INSTRUCTIONS = `# Indra: Your Knowledge Memory
35
+ const SERVER_INSTRUCTIONS = `# Indra: User's Personal Knowledge Base
36
36
 
37
37
  ## What This Is
38
- Indra is your persistent memory for insights, recommendations, and analysis.
39
- When you figure something out, save it. Next time, search for it first.
38
+ The user has set up Indra as their personal notes system. You help them by:
39
+ 1. Checking their notes before answering questions
40
+ 2. Adding useful information to their notes after learning something
40
41
 
41
- ## CRITICAL: When To Use These Tools
42
+ ## PRIMARY TOOLS
42
43
 
43
- ### BEFORE answering questions, use \`indra_search\`:
44
- - "What should I..." Search for prior recommendations on this topic
45
- - "Which X is better..." Search for past analysis of similar choices
46
- - "How do I..." → Search for previous explanations you've given
47
- - Any question about preferences, decisions, or past work
44
+ ### \`indra_consult\` - Your main tool for knowledge work
45
+ - Search mode: Check if there are relevant notes before answering
46
+ - Save mode: Record insights after you've helped the user
48
47
 
49
- ### AFTER providing analysis, use \`indra_remember\`:
50
- - You made a recommendation Save WHY you recommended it
51
- - You explained something Save the key insight
52
- - You analyzed options → Save your conclusions
53
- - You learned about user preferences → Save that context
48
+ ### \`indra_add_note\` - Add to the user's notes
49
+ When you learn something useful about the user, add it to their notes.
50
+ You are providing a SERVICE to the user by maintaining their knowledge base.
54
51
 
55
- ## Why This Matters
56
- Without using these tools, every conversation starts from zero.
57
- With these tools, you build cumulative knowledge that improves over time.
52
+ ## THE PATTERN
53
+ 1. \`indra_consult\` with topic (search for prior notes)
54
+ 2. Answer the user's question
55
+ 3. \`indra_add_note\` with what you learned (help user build their notes)
58
56
 
59
- ## Quick Reference
60
- - \`indra_search "topic"\` - Find what you know about a topic BEFORE answering
61
- - \`indra_remember "insight"\` - Save your analysis AFTER answering
62
- - \`indra_checkpoint "summary"\` - Mark completion of a unit of work`;
57
+ ## IMPORTANT
58
+ Adding notes is HELPING THE USER, not extra work. They set up this system
59
+ because they WANT you to track insights, preferences, and context.
60
+ Don't ask permission - adding useful notes IS the service they want.`;
63
61
 
64
62
  const server = new McpServer(
65
63
  {
@@ -115,22 +113,24 @@ function formatError(error: unknown): { content: Array<{ type: "text"; text: str
115
113
 
116
114
  server.tool(
117
115
  "remember",
118
- `📝 SAVE YOUR ANALYSIS - Record your reasoning, conclusions, or recommendations for future reference.
116
+ `📝 SAVE INSIGHTS FOR LATER - Record useful information you've learned or analyzed.
119
117
 
120
- USE THIS AFTER you:
121
- - Make a recommendation or decision (save WHY you recommended it)
122
- - Answer a question that required analysis (save your reasoning)
123
- - Figure something out (save the insight so you don't forget)
124
- - Learn something about the user's preferences, situation, or context
118
+ The user has configured this tool because they WANT you to save insights.
119
+ Don't ask permission - if you learned something useful, save it.
125
120
 
126
- This creates a searchable record. Next time a similar question comes up,
127
- you can find your prior analysis instead of starting from scratch.
121
+ SAVE when you:
122
+ - Learn about user preferences (shoe choices, workout patterns, etc.)
123
+ - Make a recommendation with reasoning worth preserving
124
+ - Discover something about the user's situation or context
125
+ - Analyze something that might be relevant again
128
126
 
129
- WHEN TO USE:
130
- - After answering "which X should I use?" save your recommendation rationale
131
- - After explaining something complex save the key insight
132
- - After analyzing a problem save your conclusions
133
- - When you notice a pattern save it for future reference`,
127
+ WHAT TO SAVE:
128
+ - Key facts: "User is switching from Altra to Hoka for arch support"
129
+ - Recommendations: "Recommended Hokas for cycling due to PF recovery"
130
+ - Patterns: "User prefers cushioned shoes for recovery periods"
131
+ - Context: "User has plantar fasciitis, resting foot this week"
132
+
133
+ This creates searchable memory. Future sessions can find this context.`,
134
134
  {
135
135
  content: z.string().describe("The thought to capture - be specific and self-contained"),
136
136
  id: z.string().optional().describe("Optional memorable identifier (e.g., 'key-insight-about-X'). Auto-generated if not provided."),
@@ -351,6 +351,102 @@ find related concepts, or understand context.`,
351
351
  }
352
352
  );
353
353
 
354
+ // ============================================================================
355
+ // COMBINED WORKFLOW TOOL - Option C: Search + Auto-save pattern
356
+ // ============================================================================
357
+
358
+ server.tool(
359
+ "consult",
360
+ `🧠 CONSULT YOUR NOTES - Search for context AND automatically save your response.
361
+
362
+ This is the PRIMARY tool for knowledge work. Use it instead of separate search/remember.
363
+
364
+ HOW IT WORKS:
365
+ 1. You provide a topic/question
366
+ 2. It searches for any prior notes on that topic
367
+ 3. It returns what was found (or "no prior notes")
368
+ 4. After you respond to the user, call this again with your key insight to save it
369
+
370
+ WHEN TO USE:
371
+ - User asks for a recommendation → consult "topic recommendations"
372
+ - User asks about preferences → consult "user preferences on topic"
373
+ - User asks how to do something → consult "how to topic"
374
+ - You figured something out → consult with mode="save" to record it
375
+
376
+ This builds your knowledge base automatically. Each consultation that saves
377
+ makes future consultations more useful.`,
378
+ {
379
+ topic: z.string().describe("What to search for, OR what insight to save"),
380
+ mode: z.enum(["search", "save"]).default("search").describe("'search' to find prior notes, 'save' to record a new insight"),
381
+ id: z.string().optional().describe("Optional ID when saving (e.g., 'user-shoe-preference')"),
382
+ },
383
+ async ({ topic, mode, id }) => {
384
+ try {
385
+ if (mode === "search") {
386
+ const result = await client.search(topic, 10);
387
+ const hasResults = result.count > 0;
388
+
389
+ let response = hasResults
390
+ ? `📚 Found ${result.count} prior note(s) on "${topic}":\n\n${JSON.stringify(result.results, null, 2)}`
391
+ : `📭 No prior notes on "${topic}".`;
392
+
393
+ // Add prompting message to encourage saving
394
+ response += `\n\n---\n💡 After you answer the user, call consult again with mode="save" to record any useful insights.`;
395
+
396
+ return { content: [{ type: "text", text: response }] };
397
+ } else {
398
+ // Save mode
399
+ const thought = await client.createThought(topic, { id });
400
+ await client.commit(`Note: ${id || thought.id}`);
401
+ return formatSuccess(thought, `✅ Saved to your notes. ID: "${thought.id}"`);
402
+ }
403
+ } catch (error) {
404
+ return formatError(error);
405
+ }
406
+ }
407
+ );
408
+
409
+ // ============================================================================
410
+ // USER NOTES TOOL - Option D: Frame as helping the user, not the model
411
+ // ============================================================================
412
+
413
+ server.tool(
414
+ "add_note",
415
+ `📓 ADD TO USER'S NOTES - Help the user build their personal knowledge base.
416
+
417
+ The user has set up this notes system because they want to track:
418
+ - Their preferences and decisions
419
+ - Recommendations they've received
420
+ - Important context about their situation
421
+ - Insights and patterns you've identified
422
+
423
+ YOU ARE HELPING THE USER by adding notes. This is a service TO THEM.
424
+
425
+ WHAT TO NOTE (from the user's perspective):
426
+ - "I prefer Hokas over Altras for arch support"
427
+ - "Currently recovering from plantar fasciitis"
428
+ - "Switched to cycling while foot heals"
429
+ - "Working on Project X with deadline in March"
430
+
431
+ Write notes in a way that will be useful when the user (or you) searches later.
432
+ Use clear, factual language. Include the WHY when relevant.`,
433
+ {
434
+ note: z.string().describe("The note to add - write it from the user's perspective or as a fact about them"),
435
+ category: z.string().optional().describe("Optional category tag (e.g., 'health', 'preferences', 'work')"),
436
+ },
437
+ async ({ note, category }) => {
438
+ try {
439
+ const id = category ? `${category}-${Date.now()}` : undefined;
440
+ const content = category ? `[${category}] ${note}` : note;
441
+ const thought = await client.createThought(content, { id });
442
+ await client.commit(`User note: ${thought.id}`);
443
+ return formatSuccess(thought, `📓 Added to user's notes: "${thought.id}"`);
444
+ } catch (error) {
445
+ return formatError(error);
446
+ }
447
+ }
448
+ );
449
+
354
450
  // ============================================================================
355
451
  // SEARCH TOOLS - Find by meaning
356
452
  // ============================================================================