@plur-ai/mcp 0.5.0 → 0.5.2

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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- var VERSION = "0.5.0";
4
+ var VERSION = "0.5.2";
5
5
  var HELP = `plur-mcp v${VERSION} \u2014 persistent memory for AI agents
6
6
 
7
7
  Usage:
@@ -75,7 +75,7 @@ if (arg === "init") {
75
75
  process.exit(0);
76
76
  }
77
77
  if (arg === "serve" || arg === void 0) {
78
- const { runStdio } = await import("./server-3QMSEZUP.js");
78
+ const { runStdio } = await import("./server-4WAIYC37.js");
79
79
  runStdio().catch((err) => {
80
80
  console.error("Failed to start PLUR MCP server:", err);
81
81
  process.exit(1);
@@ -36,19 +36,34 @@ function makeHttpLlm(baseUrl, apiKey, model = "gpt-4o-mini") {
36
36
  return data.choices?.[0]?.message?.content ?? "";
37
37
  };
38
38
  }
39
- var PLUR_GUIDE = `## PLUR Quick Start
39
+ var PLUR_GUIDE_EMPTY = `## PLUR \u2014 Empty Store
40
+
41
+ You have **0 engrams**. This session's learnings will be lost unless you store them.
42
+
43
+ ### What to store (call plur_learn):
44
+ - When the user corrects you ("no, use X not Y")
45
+ - When the user states a preference ("always do X", "never Y")
46
+ - When you discover a convention or pattern in the codebase
47
+ - Architecture decisions and their rationale
48
+
49
+ ### Session workflow:
50
+ 1. Work on your task
51
+ 2. Call **plur_learn** whenever you encounter something worth remembering
52
+ 3. Call **plur_session_end** before the conversation ends \u2014 suggest new engrams
40
53
 
41
- Persistent memory for AI agents. Corrections, preferences, and conventions stored as engrams.
54
+ The more you store now, the smarter you start next session.`;
55
+ var PLUR_GUIDE = `## PLUR Quick Start
42
56
 
43
57
  ### Session Workflow
44
- 1. **plur_session_start** (you just called this) \u2014 get context
58
+ 1. **plur_session_start** (you just called this) \u2014 context loaded
45
59
  2. Work on your task
46
- 3. **plur_feedback** \u2014 rate which injected engrams helped
47
- 4. **plur_session_end** \u2014 capture summary + suggest new engrams
60
+ 3. Call **plur_learn** when the user corrects you or states a preference
61
+ 4. Call **plur_feedback** to rate which injected engrams helped
62
+ 5. Call **plur_session_end** before the conversation ends \u2014 suggest new engrams
48
63
 
49
64
  ### Core Tools
50
- - **plur_learn** \u2014 record patterns, preferences, insights
51
- - **plur_recall_hybrid** \u2014 search engrams
65
+ - **plur_learn** \u2014 record corrections, preferences, patterns (CALL THIS OFTEN)
66
+ - **plur_recall_hybrid** \u2014 search engrams by topic
52
67
  - **plur_forget** \u2014 retire an outdated engram`;
53
68
  function getToolDefinitions() {
54
69
  return [
@@ -672,6 +687,12 @@ function getToolDefinitions() {
672
687
  const session_id = crypto.randomUUID();
673
688
  const task = args.task;
674
689
  const tags = args.tags;
690
+ const status = plur.status();
691
+ const store_stats = {
692
+ engram_count: status.engram_count,
693
+ episode_count: status.episode_count,
694
+ pack_count: status.pack_count
695
+ };
675
696
  let engrams = null;
676
697
  try {
677
698
  const result = await plur.injectHybrid(task, {
@@ -696,10 +717,26 @@ function getToolDefinitions() {
696
717
  engrams = { text: lines.join("\n"), count: result.count, injected_ids: result.injected_ids };
697
718
  }
698
719
  }
720
+ let guide;
721
+ if (engrams) {
722
+ guide = `Session started with ${engrams.count} engrams from ${store_stats.engram_count} total. Remember to call plur_learn when corrected and plur_session_end before the conversation ends.`;
723
+ } else if (store_stats.engram_count === 0) {
724
+ guide = PLUR_GUIDE_EMPTY;
725
+ } else {
726
+ guide = `${PLUR_GUIDE}
727
+
728
+ You have ${store_stats.engram_count} engrams but none matched this task. Call plur_learn to capture new learnings from this session.`;
729
+ }
730
+ const isFreshInstall = store_stats.engram_count === 0 && store_stats.episode_count === 0;
699
731
  return {
700
732
  session_id,
701
- engrams,
702
- guide: engrams ? "Session started. Workflow: work \u2192 plur_feedback \u2192 plur_session_end." : PLUR_GUIDE
733
+ engrams: engrams ?? [],
734
+ store_stats,
735
+ guide,
736
+ // Ask LLM to check back — MCP can't push, but we can request a follow-up
737
+ follow_up: store_stats.engram_count === 0 ? "This is a fresh store with 0 engrams. After your first exchange with the user, review what you learned and call plur_learn for any corrections, preferences, or patterns. Build the memory from this session." : void 0,
738
+ // On fresh install, suggest hook setup for reliable injection
739
+ setup_hint: isFreshInstall ? "IMPORTANT: For reliable memory injection, ask the user to run: npx @plur-ai/cli init \u2014 this installs Claude Code hooks that automatically inject engrams at conversation start and after context compaction. Without hooks, memory injection depends on you remembering to call plur_session_start." : void 0
703
740
  };
704
741
  }
705
742
  },
@@ -742,9 +779,12 @@ function getToolDefinitions() {
742
779
  session_id,
743
780
  channel: "mcp"
744
781
  });
782
+ const status = plur.status();
745
783
  return {
746
784
  engrams_created,
747
- episode_id: episode.id
785
+ episode_id: episode.id,
786
+ total_engrams: status.engram_count,
787
+ hint: engrams_created === 0 ? "No engrams captured this session. If any corrections, preferences, or patterns came up, consider calling plur_learn before ending." : void 0
748
788
  };
749
789
  }
750
790
  },
@@ -856,16 +896,26 @@ function getToolDefinitions() {
856
896
 
857
897
  // src/server.ts
858
898
  import { z } from "zod";
859
- var VERSION = "0.5.0";
860
- var INSTRUCTIONS = `PLUR is your persistent memory. It stores corrections, preferences, and conventions as engrams that persist across sessions.
899
+ var VERSION = "0.5.2";
900
+ var INSTRUCTIONS = `PLUR is your persistent memory. Corrections, preferences, and conventions persist across sessions as engrams.
861
901
 
862
- Use PLUR proactively:
863
- - Call plur_session_start at session start with a task description \u2014 loads relevant context
864
- - Call plur_learn when the user corrects you, states a preference, or you discover a convention
865
- - Call plur_feedback after using recalled engrams to train relevance
866
- - Call plur_session_end before the conversation ends \u2014 captures learnings and session summary
902
+ REQUIRED at session boundaries:
903
+ - FIRST ACTION of every session: call plur_session_start with a task description
904
+ - LAST ACTION before conversation ends: call plur_session_end with summary + engram_suggestions
867
905
 
868
- Do not ask permission to use these tools \u2014 they are your memory system.`;
906
+ REQUIRED during the session:
907
+ - When user corrects you ("no, use X not Y") \u2192 call plur_learn immediately
908
+ - When user states a preference ("always X", "never Y") \u2192 call plur_learn immediately
909
+ - When you discover a codebase convention or pattern \u2192 call plur_learn
910
+
911
+ OPTIONAL but improves quality:
912
+ - Call plur_feedback to rate which injected engrams helped (positive/negative)
913
+ - Call plur_recall_hybrid before answering factual questions \u2014 the answer may be in memory
914
+
915
+ Do not ask permission to use these tools \u2014 they are your memory system.
916
+
917
+ Setup: If this is a fresh install, suggest the user run: npx @plur-ai/cli init
918
+ This installs Claude Code hooks for automatic engram injection. Without hooks, injection only happens when you call plur_session_start.`;
869
919
  var GUIDE_RESOURCE = `# PLUR \u2014 Agent Guide
870
920
 
871
921
  ## What is PLUR?
@@ -924,6 +974,8 @@ Persistent memory for AI agents. Corrections, preferences, and conventions are s
924
974
  - **plur_stores_add** \u2014 register an additional engram store
925
975
  - **plur_stores_list** \u2014 list all configured stores
926
976
 
977
+ **Note:** Multi-store is currently config-only. Recall and inject search the primary store. Cross-store search coming in a future release.
978
+
927
979
  ### Sync & Status
928
980
  - **plur_sync** \u2014 sync engrams across devices via git
929
981
  - **plur_sync_status** \u2014 check sync state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plur-ai/mcp",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "plur-mcp": "dist/index.js"
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@modelcontextprotocol/sdk": "^1.12.0",
14
14
  "zod": "^3.23.0",
15
- "@plur-ai/core": "0.5.0"
15
+ "@plur-ai/core": "0.5.2"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^25.5.0"