true-mem 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -7,17 +7,13 @@
7
7
  ## Table of Contents
8
8
 
9
9
  - [Overview](#overview)
10
- - [The Problem](#the-problem)
11
- - [The Solution](#the-solution)
12
- - [The Psychology Behind It](#the-psychology-behind-it)
13
10
  - [Key Features](#key-features)
11
+ - [Noise Filtering](#noise-filtering)
14
12
  - [Installation](#installation)
15
13
  - [Usage](#usage)
16
14
  - [Architecture](#architecture)
17
15
  - [Memory Classifications](#memory-classifications)
18
16
  - [Technical Details](#technical-details)
19
- - [Inspiration](#inspiration)
20
- - [Debug](#debug)
21
17
 
22
18
  ---
23
19
 
@@ -78,13 +74,36 @@ What makes True-Mem different from a simple database? It's modeled after how hum
78
74
 
79
75
  ---
80
76
 
81
- ## Installation
77
+ ## Noise Filtering
82
78
 
83
- ```bash
84
- npm install true-mem
85
- ```
79
+ What truly sets True-Mem apart is its ability to distinguish **signal from noise**. Unlike simpler memory plugins that store everything matching a keyword, True-Mem understands context and intent:
80
+
81
+ **What gets filtered OUT:**
82
+
83
+ | Pattern Type | Example | Why filtered |
84
+ |--------------|---------|--------------|
85
+ | Questions | "Do you remember this?" | It's a question, not a statement |
86
+ | 1st person recall | "I remember when we fixed that" | Recounting, not requesting storage |
87
+ | Remind-me recall | "Remind me how we did this" | Asking AI to recall info, not store |
88
+ | AI meta-talk | "Goal: The user is trying to..." | AI-generated, not user content |
89
+ | List selections | "I prefer option 3" | Context-specific choice, not general preference |
90
+
91
+ **What gets stored:**
92
+
93
+ | Pattern Type | Example | Why stored |
94
+ |--------------|---------|------------|
95
+ | Imperatives | "Remember this: always run tests" | Explicit storage request |
96
+ | Preferences | "I prefer TypeScript over JavaScript" | General, reusable preference |
97
+ | Decisions | "We decided to use SQLite" | Project-level decision |
98
+ | Constraints | "Never use var keyword" | Permanent rule |
86
99
 
87
- Then add to your `~/.config/opencode/opencode.jsonc`:
100
+ All filtering patterns support **10 languages**: English, Italian, Spanish, French, German, Portuguese, Dutch, Polish, Turkish, and Russian.
101
+
102
+ ---
103
+
104
+ ## Installation
105
+
106
+ Add to your `~/.config/opencode/opencode.jsonc`:
88
107
 
89
108
  ```jsonc
90
109
  {
@@ -94,6 +113,8 @@ Then add to your `~/.config/opencode/opencode.jsonc`:
94
113
  }
95
114
  ```
96
115
 
116
+ OpenCode will automatically download the plugin from npm.
117
+
97
118
  ---
98
119
 
99
120
  ## Usage
@@ -111,11 +132,11 @@ Just have conversations with OpenCode. True-Mem extracts relevant info in the ba
111
132
 
112
133
  ### Explicit Memory Storage
113
134
 
114
- Use phrases like "Remember this:" or "Ricorda questo:" to force storage:
135
+ Use phrases like "Remember this:" or "Remember that ..." to force storage:
115
136
 
116
137
  ```
117
- "Ricorda questo: preferisco sempre usare TypeScript per i miei progetti"
118
138
  "Remember this: never commit without running tests first"
139
+ "Remember that I prefer to use TypeScript in my projects"
119
140
  ```
120
141
 
121
142
  ---
@@ -182,10 +203,10 @@ true-mem/
182
203
 
183
204
  | Layer | Purpose |
184
205
  |-------|---------|
185
- | 1. Negative Patterns | Filter known false positives |
186
- | 2. Multi-Keyword Scoring | Require 2+ signals |
187
- | 3. Confidence Threshold | Store only if score >= 0.6 |
188
- | 4. Role Validation | Human-only for user-level memories |
206
+ | 1. Question Detection | Filter questions before classification |
207
+ | 2. Negative Patterns | AI meta-talk, list selections, 1st person recall, remind-me recall (10 languages) |
208
+ | 3. Multi-Keyword + Sentence-Level | Require 2+ signals in the same sentence |
209
+ | 4. Confidence Threshold | Store only if score >= 0.6 |
189
210
 
190
211
  ### Decay Strategy
191
212
 
package/dist/index.js CHANGED
@@ -858,12 +858,18 @@ function matchesNegativePattern(text, classification) {
858
858
  if (isAIMetaTalk(text)) {
859
859
  return true;
860
860
  }
861
+ if (FIRST_PERSON_RECALL_PATTERNS.some((pattern) => pattern.test(text))) {
862
+ return true;
863
+ }
864
+ if (REMIND_RECALL_PATTERNS.some((pattern) => pattern.test(text))) {
865
+ return true;
866
+ }
861
867
  const patterns = NEGATIVE_PATTERNS[classification];
862
868
  if (!patterns)
863
869
  return false;
864
870
  return patterns.some((pattern) => pattern.test(text));
865
871
  }
866
- var AI_META_TALK_PATTERNS, NEGATIVE_PATTERNS;
872
+ var AI_META_TALK_PATTERNS, FIRST_PERSON_RECALL_PATTERNS, REMIND_RECALL_PATTERNS, NEGATIVE_PATTERNS;
867
873
  var init_negative_patterns = __esm(() => {
868
874
  AI_META_TALK_PATTERNS = [
869
875
  /^(Goal|Summary|Context|Analysis|Note|Overview|Background):\s+The user/i,
@@ -886,6 +892,45 @@ var init_negative_patterns = __esm(() => {
886
892
  /\|\w+\|.*\.\.\./i,
887
893
  /^\|.+\|$/i
888
894
  ];
895
+ FIRST_PERSON_RECALL_PATTERNS = [
896
+ /\bI\s+(remember|recall|recollect|don'?t\s+forget)\b/i,
897
+ /\bwe\s+(remember|recall|recollect)\b/i,
898
+ /\bI\s+can\s+remember\b/i,
899
+ /\b(io\s+)?ricordo\b/i,
900
+ /\bmi\s+ricordo\b/i,
901
+ /\bho\s+ricordato\b/i,
902
+ /\b(ci\s+)?ricordiamo\s+(che|di|quando|come|perch)\b/i,
903
+ /\b(yo\s+)?recuerdo\b/i,
904
+ /\bme\s+acuerdo\b/i,
905
+ /\brecordamos\b/i,
906
+ /\bje\s+(me\s+)?souviens\b/i,
907
+ /\bnous\s+(nous\s+)?souvenons\b/i,
908
+ /\bich\s+erinnere(\s+mich)?\b/i,
909
+ /\bwir\s+erinnern(\s+uns)?\b/i,
910
+ /\b(eu\s+)?(me\s+)?lembro\b/i,
911
+ /\bnos\s+lembramos\b/i,
912
+ /\bik\s+herinner(\s+me)?\b/i,
913
+ /\bwe\s+herinneren(\s+ons)?\b/i,
914
+ /\bpami\u0119tam\b/i,
915
+ /\bpami\u0119tamy\b/i,
916
+ /\bhat\u0131rl\u0131yorum\b/i,
917
+ /\bhat\u0131rl\u0131yoruz\b/i
918
+ ];
919
+ REMIND_RECALL_PATTERNS = [
920
+ /\bremind\s+me\s+(how|what|when|where|why|who|which)\b/i,
921
+ /\bremind\s+me\s+of\s+(the|what|how|when|where|why)\b/i,
922
+ /\bricordami\s+(come|cosa|quando|dove|perch[e\u00E9]|chi|quale|quanto)\b/i,
923
+ /\bricordami\s+che\s+(cosa|tipo|ragione)\b/i,
924
+ /\brec[u\u00FA]rdame\s+(c[o\u00F3]mo|qu[e\u00E9]|cu[a\u00E1]ndo|d[o\u00F3]nde|por\s*qu[e\u00E9]|qui[e\u00E9]n|cu[a\u00E1]l)\b/i,
925
+ /\brappelle[s]?\s*-?\s*moi\s+(comment|quand|o[u\u00F9]|pourquoi|qui|quel)\b/i,
926
+ /\brappelle[s]?\s*-?\s*moi\s+ce\s+que\b/i,
927
+ /\berinner\s+(mich|uns)\s+(wie|was|wann|wo|warum|wer|welche[ns]?)\b/i,
928
+ /\blembre\s*-?\s*me\s+(como|quando|onde|por\s*que|quem|qual)\b/i,
929
+ /\blembre\s*-?\s*me\s+o\s+que\b/i,
930
+ /\bherinner\s+(me|ons)\s+(hoe|wat|wanneer|waar|waarom|wie|welke)\b/i,
931
+ /\bprzypomnij\s+mi\s+(jak|co|kiedy|gdzie|dlaczego|kto|kt[o\u00F3]ry)\b/i,
932
+ /\bhat[\u0131i]rlat\s+(bana)\s+(nas[\u0131i]l|ne|ne\s+zaman|nere[dy]e|neden|kim|hangi)\b/i
933
+ ];
889
934
  NEGATIVE_PATTERNS = {
890
935
  bugfix: [
891
936
  /resolve\s+(dns|ip|address|hostname|url|uri|path)/i,
@@ -1086,8 +1131,6 @@ function classifyWithExplicitIntent(text, signals) {
1086
1131
  /\bmemorizziamo\b:?\s*/gi,
1087
1132
  /\bricordiamoci che\b:?\s*/gi,
1088
1133
  /\bricordiamoci di\b:?\s*/gi,
1089
- /\bricorda\b:?\s*/gi,
1090
- /\bremember\b:?\s*/gi,
1091
1134
  /\btieni a mente\b:?\s*/gi,
1092
1135
  /\bkeep in mind\b:?\s*/gi,
1093
1136
  /\bnota che\b:?\s*/gi,
@@ -2912,7 +2955,7 @@ init_logger();
2912
2955
  // package.json
2913
2956
  var package_default = {
2914
2957
  name: "true-mem",
2915
- version: "1.0.2",
2958
+ version: "1.0.3",
2916
2959
  description: "Persistent memory plugin for OpenCode with cognitive psychology-based memory management",
2917
2960
  main: "dist/index.js",
2918
2961
  types: "dist/index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../src/memory/classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAoCjE,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAkCzF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,GACtB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA0DxD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAc/D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,EAAE,GACb;IAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CA4FhF;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,WAA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GAAG,EAAE,GACb;IAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CA0FhF;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,WAAW,GACvB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA8CpC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,EAAE,EACd,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,GACxC;IACD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAsEA;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,GACX,MAAM,CAWR"}
@@ -23,6 +23,28 @@ export declare function isAIMetaTalk(text: string): boolean;
23
23
  * Check if text is a question (should NOT be stored as a statement)
24
24
  */
25
25
  export declare function isQuestion(text: string): boolean;
26
+ /**
27
+ * First Person Recall Patterns
28
+ *
29
+ * These patterns detect when the user is recounting/recalling something
30
+ * (1st person indicative) rather than requesting storage (imperative).
31
+ *
32
+ * "I remember when..." = recounting, NOT storage request
33
+ * "Remember this!" = imperative, storage request
34
+ */
35
+ export declare const FIRST_PERSON_RECALL_PATTERNS: RegExp[];
36
+ /**
37
+ * Remind Recall Patterns
38
+ *
39
+ * These patterns detect when "remind me" is used to request INFORMATION
40
+ * (recall) rather than to store something (imperative).
41
+ *
42
+ * "Remind me how we did this" = asking AI to recall → DON'T store
43
+ * "Remind me to commit" = imperative to store → STORE
44
+ *
45
+ * Key distinction: question word vs. preposition/demonstrative after "remind me"
46
+ */
47
+ export declare const REMIND_RECALL_PATTERNS: RegExp[];
26
48
  export declare const NEGATIVE_PATTERNS: Record<string, RegExp[]>;
27
49
  /**
28
50
  * Check if text matches any negative pattern for the given classification
@@ -1 +1 @@
1
- {"version":3,"file":"negative-patterns.d.ts","sourceRoot":"","sources":["../../src/memory/negative-patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,EAmCzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAahD;AAGD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA0DtD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAUpF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAkB1F"}
1
+ {"version":3,"file":"negative-patterns.d.ts","sourceRoot":"","sources":["../../src/memory/negative-patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,EAmCzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAahD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,EA0ChD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,EA+B1C,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA0DtD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAoBpF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CA4B1F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "true-mem",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Persistent memory plugin for OpenCode with cognitive psychology-based memory management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",