opencode-supermemory 0.1.0 → 0.1.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.
- package/README.md +32 -2
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/services/client.d.ts.map +1 -1
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -16,9 +16,22 @@ Interactive wizard that:
|
|
|
16
16
|
Then set your API key:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
+
# Add to your shell profile (.zshrc, .bashrc, etc.)
|
|
20
|
+
echo 'export SUPERMEMORY_API_KEY="your-api-key"' >> ~/.zshrc
|
|
21
|
+
source ~/.zshrc
|
|
22
|
+
|
|
23
|
+
# Or set temporarily for current session
|
|
19
24
|
export SUPERMEMORY_API_KEY="your-api-key" # from console.supermemory.ai
|
|
20
25
|
```
|
|
21
26
|
|
|
27
|
+
Make sure `~/.config/opencode/opencode.json` contains the plugin:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"plugin": ["opencode-supermemory"]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
22
35
|
## Features
|
|
23
36
|
|
|
24
37
|
### Context Injection
|
|
@@ -121,13 +134,30 @@ Create `~/.config/opencode/supermemory.jsonc`:
|
|
|
121
134
|
"injectProfile": true,
|
|
122
135
|
|
|
123
136
|
// Prefix for container tags
|
|
124
|
-
"containerTagPrefix": "opencode"
|
|
137
|
+
"containerTagPrefix": "opencode",
|
|
138
|
+
|
|
139
|
+
// LLM filter prompt for memory relevance
|
|
140
|
+
"filterPrompt": "You are a stateful coding agent. Remember all the information, including but not limited to user's coding preferences, tech stack, behaviours, workflows, and any other relevant details."
|
|
125
141
|
}
|
|
126
142
|
```
|
|
127
143
|
|
|
128
144
|
All fields optional. Env var `SUPERMEMORY_API_KEY` takes precedence over config file.
|
|
129
145
|
|
|
130
|
-
API timeout:
|
|
146
|
+
API timeout: 30s
|
|
147
|
+
|
|
148
|
+
## Usage with Oh My OpenCode
|
|
149
|
+
|
|
150
|
+
If you're using [Oh My OpenCode](https://github.com/code-yeongyu/oh-my-opencode), disable its built-in auto-compact hook to let supermemory handle context compaction:
|
|
151
|
+
|
|
152
|
+
Add to `~/.config/opencode/oh-my-opencode.json`:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"disabled_hooks": ["anthropic-auto-compact"]
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This ensures supermemory's preemptive compaction (which preserves memories across sessions) works correctly instead of oh-my-opencode's default compaction.
|
|
131
161
|
|
|
132
162
|
## Hooks
|
|
133
163
|
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,mBAAmB,oBAAuD,CAAC;AAExF,eAAO,MAAM,MAAM;;;;;;;;CAQlB,CAAC;AAEF,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
package/dist/index.js
CHANGED
|
@@ -13616,7 +13616,8 @@ var DEFAULTS = {
|
|
|
13616
13616
|
maxProjectMemories: 10,
|
|
13617
13617
|
maxProfileItems: 5,
|
|
13618
13618
|
injectProfile: true,
|
|
13619
|
-
containerTagPrefix: "opencode"
|
|
13619
|
+
containerTagPrefix: "opencode",
|
|
13620
|
+
filterPrompt: "You are a stateful coding agent. Remember all the information, including but not limited to user's coding preferences, tech stack, behaviours, workflows, and any other relevant details."
|
|
13620
13621
|
};
|
|
13621
13622
|
function loadConfig() {
|
|
13622
13623
|
for (const path2 of CONFIG_FILES) {
|
|
@@ -13638,7 +13639,8 @@ var CONFIG = {
|
|
|
13638
13639
|
maxProjectMemories: fileConfig.maxProjectMemories ?? DEFAULTS.maxProjectMemories,
|
|
13639
13640
|
maxProfileItems: fileConfig.maxProfileItems ?? DEFAULTS.maxProfileItems,
|
|
13640
13641
|
injectProfile: fileConfig.injectProfile ?? DEFAULTS.injectProfile,
|
|
13641
|
-
containerTagPrefix: fileConfig.containerTagPrefix ?? DEFAULTS.containerTagPrefix
|
|
13642
|
+
containerTagPrefix: fileConfig.containerTagPrefix ?? DEFAULTS.containerTagPrefix,
|
|
13643
|
+
filterPrompt: fileConfig.filterPrompt ?? DEFAULTS.filterPrompt
|
|
13642
13644
|
};
|
|
13643
13645
|
function isConfigured() {
|
|
13644
13646
|
return !!SUPERMEMORY_API_KEY;
|
|
@@ -13662,7 +13664,7 @@ function log(message, data) {
|
|
|
13662
13664
|
|
|
13663
13665
|
// src/services/client.ts
|
|
13664
13666
|
var SUPERMEMORY_API_URL = "https://api.supermemory.ai";
|
|
13665
|
-
var TIMEOUT_MS =
|
|
13667
|
+
var TIMEOUT_MS = 30000;
|
|
13666
13668
|
function withTimeout(promise2, ms) {
|
|
13667
13669
|
return Promise.race([
|
|
13668
13670
|
promise2,
|
|
@@ -13678,6 +13680,10 @@ class SupermemoryClient {
|
|
|
13678
13680
|
throw new Error("SUPERMEMORY_API_KEY not set");
|
|
13679
13681
|
}
|
|
13680
13682
|
this.client = new Supermemory({ apiKey: SUPERMEMORY_API_KEY });
|
|
13683
|
+
this.client.settings.update({
|
|
13684
|
+
shouldLLMFilter: true,
|
|
13685
|
+
filterPrompt: CONFIG.filterPrompt
|
|
13686
|
+
});
|
|
13681
13687
|
}
|
|
13682
13688
|
return this.client;
|
|
13683
13689
|
}
|
|
@@ -13689,7 +13695,7 @@ class SupermemoryClient {
|
|
|
13689
13695
|
containerTag,
|
|
13690
13696
|
threshold: CONFIG.similarityThreshold,
|
|
13691
13697
|
limit: CONFIG.maxMemories,
|
|
13692
|
-
|
|
13698
|
+
searchMode: "hybrid"
|
|
13693
13699
|
}), TIMEOUT_MS);
|
|
13694
13700
|
log("searchMemories: success", { count: result.results?.length || 0 });
|
|
13695
13701
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAe3B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAe3B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,SAAS;IAcX,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAsBlD,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAmB/C,SAAS,CACb,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE;IAiBnE,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAepD,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,SAAK;IAqB7C,kBAAkB,CACtB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACnD,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC;CAmC9C;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-supermemory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "OpenCode plugin that gives coding agents persistent memory using Supermemory",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,14 +28,12 @@
|
|
|
28
28
|
"url": "https://github.com/supermemoryai/opencode-supermemory"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@opencode-ai/plugin": "^1.0.162",
|
|
31
32
|
"supermemory": "^4.0.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"typescript": "^5.9.3"
|
|
35
|
+
"@types/bun": "latest",
|
|
36
|
+
"typescript": "^5.7.3"
|
|
39
37
|
},
|
|
40
38
|
"opencode": {
|
|
41
39
|
"type": "plugin",
|