opencode-supermemory 2.0.2 → 2.0.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.
package/README.md CHANGED
@@ -12,13 +12,14 @@ Your agent remembers what you tell it - across sessions, across projects.
12
12
  bunx opencode-supermemory@latest install
13
13
  ```
14
14
 
15
- Then get your API key from [console.supermemory.ai](https://console.supermemory.ai) and set it:
15
+ Then get your API key from [app.supermemory.ai](https://app.supermemory.ai/?view=integrations) and set it:
16
16
 
17
17
  ```bash
18
18
  export SUPERMEMORY_API_KEY="sm_..."
19
19
  ```
20
20
 
21
21
  **Or let your agent do it** - paste this into OpenCode:
22
+
22
23
  ```
23
24
  Install opencode-supermemory by following https://raw.githubusercontent.com/supermemoryai/opencode-supermemory/main/README.md
24
25
  ```
@@ -37,6 +38,7 @@ bunx opencode-supermemory@latest install --no-tui
37
38
  ```
38
39
 
39
40
  This will:
41
+
40
42
  - Register the plugin in `~/.config/opencode/opencode.jsonc`
41
43
  - Create the `/supermemory-init` command
42
44
 
@@ -47,6 +49,7 @@ cat ~/.config/opencode/opencode.jsonc
47
49
  ```
48
50
 
49
51
  Should contain:
52
+
50
53
  ```json
51
54
  {
52
55
  "plugin": ["opencode-supermemory"]
@@ -56,16 +59,18 @@ Should contain:
56
59
  If not, add it manually:
57
60
 
58
61
  **JSONC:**
62
+
59
63
  ```jsonc
60
64
  {
61
65
  "plugin": [
62
- "opencode-supermemory"
66
+ "opencode-supermemory",
63
67
  // ... other plugins
64
- ]
68
+ ],
65
69
  }
66
70
  ```
67
71
 
68
72
  **JSON:**
73
+
69
74
  ```json
70
75
  {
71
76
  "plugin": ["opencode-supermemory"]
@@ -74,7 +79,7 @@ If not, add it manually:
74
79
 
75
80
  #### Step 3: Configure API key
76
81
 
77
- Ask the user to get their API key from [console.supermemory.ai](https://console.supermemory.ai).
82
+ Ask the user to get their API key from [app.supermemory.ai](https://app.supermemory.ai/?view=integrations).
78
83
 
79
84
  Then set it via environment variable:
80
85
 
@@ -86,7 +91,7 @@ Or create `~/.config/opencode/supermemory.jsonc`:
86
91
 
87
92
  ```jsonc
88
93
  {
89
- "apiKey": "sm_..."
94
+ "apiKey": "sm_...",
90
95
  }
91
96
  ```
92
97
 
@@ -99,6 +104,7 @@ opencode -c
99
104
  ```
100
105
 
101
106
  They should see `supermemory` in the tools list. If not, check:
107
+
102
108
  1. Is `SUPERMEMORY_API_KEY` set?
103
109
  2. Is the plugin in `opencode.jsonc`?
104
110
  3. Check logs: `tail ~/.opencode-supermemory.log`
@@ -114,11 +120,13 @@ Run `/supermemory-init` to have the agent explore and memorize the codebase.
114
120
  ### Context Injection
115
121
 
116
122
  On first message, the agent receives (invisible to user):
123
+
117
124
  - User profile (cross-project preferences)
118
125
  - Project memories (all project knowledge)
119
126
  - Relevant user memories (semantic search)
120
127
 
121
128
  Example of what the agent sees:
129
+
122
130
  ```
123
131
  [SUPERMEMORY]
124
132
 
@@ -154,6 +162,7 @@ Run `/supermemory-init` to explore and memorize your codebase structure, pattern
154
162
  ### Preemptive Compaction
155
163
 
156
164
  When context hits 80% capacity:
165
+
157
166
  1. Triggers OpenCode's summarization
158
167
  2. Injects project memories into summary context
159
168
  3. Saves session summary as a memory
@@ -172,13 +181,13 @@ Content in `<private>` tags is never stored.
172
181
 
173
182
  The `supermemory` tool is available to the agent:
174
183
 
175
- | Mode | Args | Description |
176
- |------|------|-------------|
177
- | `add` | `content`, `type?`, `scope?` | Store memory |
178
- | `search` | `query`, `scope?` | Search memories |
179
- | `profile` | `query?` | View user profile |
180
- | `list` | `scope?`, `limit?` | List memories |
181
- | `forget` | `memoryId`, `scope?` | Delete memory |
184
+ | Mode | Args | Description |
185
+ | --------- | ---------------------------- | ----------------- |
186
+ | `add` | `content`, `type?`, `scope?` | Store memory |
187
+ | `search` | `query`, `scope?` | Search memories |
188
+ | `profile` | `query?` | View user profile |
189
+ | `list` | `scope?`, `limit?` | List memories |
190
+ | `forget` | `memoryId`, `scope?` | Delete memory |
182
191
 
183
192
  **Scopes:** `user` (cross-project), `project` (default)
184
193
 
@@ -186,9 +195,9 @@ The `supermemory` tool is available to the agent:
186
195
 
187
196
  ## Memory Scoping
188
197
 
189
- | Scope | Tag | Persists |
190
- |-------|-----|----------|
191
- | User | `opencode_user_{sha256(git email)}` | All projects |
198
+ | Scope | Tag | Persists |
199
+ | ------- | -------------------------------------- | ------------ |
200
+ | User | `opencode_user_{sha256(git email)}` | All projects |
192
201
  | Project | `opencode_project_{sha256(directory)}` | This project |
193
202
 
194
203
  ## Configuration
@@ -228,7 +237,7 @@ Create `~/.config/opencode/supermemory.jsonc`:
228
237
  "keywordPatterns": ["log\\s+this", "write\\s+down"],
229
238
 
230
239
  // Context usage ratio that triggers compaction (0-1)
231
- "compactionThreshold": 0.80
240
+ "compactionThreshold": 0.8,
232
241
  }
233
242
  ```
234
243
 
@@ -237,6 +246,7 @@ All fields optional. Env var `SUPERMEMORY_API_KEY` takes precedence over config
237
246
  ### Container Tag Selection
238
247
 
239
248
  By default, container tags are auto-generated using `containerTagPrefix` plus a hash:
249
+
240
250
  - User tag: `{prefix}_user_{hash(git_email)}`
241
251
  - Project tag: `{prefix}_project_{hash(directory)}`
242
252
 
@@ -248,11 +258,12 @@ You can override this by specifying exact container tags:
248
258
  "userContainerTag": "my-team-workspace",
249
259
 
250
260
  // Use a specific container tag for project memories
251
- "projectContainerTag": "my-awesome-project"
261
+ "projectContainerTag": "my-awesome-project",
252
262
  }
253
263
  ```
254
264
 
255
265
  This is useful when you want to:
266
+
256
267
  - Share memories across team members (same `userContainerTag`)
257
268
  - Sync memories between different machines for the same project
258
269
  - Organize memories using your own naming scheme
@@ -282,7 +293,7 @@ Local install:
282
293
 
283
294
  ```jsonc
284
295
  {
285
- "plugin": ["file:///path/to/opencode-supermemory"]
296
+ "plugin": ["file:///path/to/opencode-supermemory"],
286
297
  }
287
298
  ```
288
299
 
package/dist/cli.js CHANGED
@@ -86,7 +86,7 @@ import { homedir } from "node:os";
86
86
  var CREDENTIALS_DIR = join(homedir(), ".supermemory-opencode");
87
87
  var CREDENTIALS_FILE = join(CREDENTIALS_DIR, "credentials.json");
88
88
  var AUTH_PORT = 19877;
89
- var AUTH_BASE_URL = "https://console.supermemory.ai/auth/connect";
89
+ var AUTH_BASE_URL = process.env.SUPERMEMORY_AUTH_URL || "https://app.supermemory.ai/auth/connect";
90
90
  var CLIENT_NAME = "opencode";
91
91
  function loadCredentials() {
92
92
  if (!existsSync(CREDENTIALS_FILE))
@@ -374,10 +374,23 @@ This will:
374
374
 
375
375
  Wait for the command to complete, then inform the user whether authentication succeeded or failed.
376
376
 
377
- If the user wants to log out instead, run:
377
+ If the user wants to log out instead, tell them to use the /supermemory-logout command.
378
+ `;
379
+ var SUPERMEMORY_LOGOUT_COMMAND = `---
380
+ description: Log out from Supermemory and clear credentials
381
+ ---
382
+
383
+ # Supermemory Logout
384
+
385
+ Run this command to log out and clear Supermemory credentials:
386
+
378
387
  \`\`\`bash
379
388
  bunx opencode-supermemory@latest logout
380
389
  \`\`\`
390
+
391
+ This will remove the saved credentials from ~/.supermemory-opencode/credentials.json.
392
+
393
+ Inform the user whether logout succeeded and that they'll need to run /supermemory-login to re-authenticate.
381
394
  `;
382
395
  function createReadline() {
383
396
  return readline.createInterface({
@@ -470,6 +483,9 @@ function createCommands() {
470
483
  const loginPath = join2(OPENCODE_COMMAND_DIR, "supermemory-login.md");
471
484
  writeFileSync2(loginPath, SUPERMEMORY_LOGIN_COMMAND);
472
485
  console.log(`✓ Created /supermemory-login command`);
486
+ const logoutPath = join2(OPENCODE_COMMAND_DIR, "supermemory-logout.md");
487
+ writeFileSync2(logoutPath, SUPERMEMORY_LOGOUT_COMMAND);
488
+ console.log(`✓ Created /supermemory-logout command`);
473
489
  return true;
474
490
  }
475
491
  function isOhMyOpencodeInstalled() {
@@ -546,7 +562,7 @@ async function install(options) {
546
562
  }
547
563
  }
548
564
  console.log(`
549
- Step 2: Create /supermemory-init and /supermemory-login commands`);
565
+ Step 2: Create /supermemory-init, /supermemory-login, and /supermemory-logout commands`);
550
566
  if (options.tui) {
551
567
  const shouldCreate = await confirm(rl, "Add supermemory commands?");
552
568
  if (!shouldCreate) {
package/dist/index.js CHANGED
@@ -13683,6 +13683,7 @@ import { join } from "node:path";
13683
13683
  import { homedir } from "node:os";
13684
13684
  var CREDENTIALS_DIR = join(homedir(), ".supermemory-opencode");
13685
13685
  var CREDENTIALS_FILE = join(CREDENTIALS_DIR, "credentials.json");
13686
+ var AUTH_BASE_URL = process.env.SUPERMEMORY_AUTH_URL || "https://app.supermemory.ai/auth/connect";
13686
13687
  function loadCredentials() {
13687
13688
  if (!existsSync(CREDENTIALS_FILE))
13688
13689
  return null;
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
1
  {
2
- "name": "opencode-supermemory",
3
- "version": "2.0.2",
4
- "description": "OpenCode plugin that gives coding agents persistent memory using Supermemory",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "opencode-supermemory": "./dist/cli.js"
10
- },
11
- "scripts": {
12
- "build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/cli.ts --outfile ./dist/cli.js --target node && tsc --emitDeclarationOnly",
13
- "dev": "tsc --watch",
14
- "typecheck": "tsc --noEmit"
15
- },
16
- "keywords": [
17
- "opencode",
18
- "plugin",
19
- "supermemory",
20
- "memory",
21
- "ai",
22
- "coding-agent"
23
- ],
24
- "author": "Supermemory",
25
- "license": "MIT",
26
- "repository": {
27
- "type": "git",
28
- "url": "https://github.com/supermemoryai/opencode-supermemory"
29
- },
30
- "dependencies": {
31
- "@opencode-ai/plugin": "^1.0.162",
32
- "supermemory": "^4.0.0"
33
- },
34
- "devDependencies": {
35
- "@types/bun": "latest",
36
- "typescript": "^5.7.3"
37
- },
38
- "opencode": {
39
- "type": "plugin",
40
- "hooks": [
41
- "chat.message",
42
- "event"
43
- ]
44
- },
45
- "files": [
46
- "dist"
47
- ]
2
+ "name": "opencode-supermemory",
3
+ "version": "2.0.4",
4
+ "description": "OpenCode plugin that gives coding agents persistent memory using Supermemory",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "opencode-supermemory": "./dist/cli.js"
10
+ },
11
+ "scripts": {
12
+ "build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/cli.ts --outfile ./dist/cli.js --target node && tsc --emitDeclarationOnly",
13
+ "dev": "tsc --watch",
14
+ "typecheck": "tsc --noEmit"
15
+ },
16
+ "keywords": [
17
+ "opencode",
18
+ "plugin",
19
+ "supermemory",
20
+ "memory",
21
+ "ai",
22
+ "coding-agent"
23
+ ],
24
+ "author": "Supermemory",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/supermemoryai/opencode-supermemory"
29
+ },
30
+ "dependencies": {
31
+ "@opencode-ai/plugin": "^1.0.162",
32
+ "supermemory": "^4.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/bun": "latest",
36
+ "typescript": "^5.7.3"
37
+ },
38
+ "opencode": {
39
+ "type": "plugin",
40
+ "hooks": [
41
+ "chat.message",
42
+ "event"
43
+ ]
44
+ },
45
+ "files": [
46
+ "dist"
47
+ ]
48
48
  }