@mono-agent/memory-supermemory 0.12.0 → 0.14.0
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 +126 -43
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,41 +1,76 @@
|
|
|
1
1
|
# @mono-agent/memory-supermemory
|
|
2
2
|
|
|
3
|
+
Use a local or hosted Supermemory service behind mono-agent's standard memory
|
|
4
|
+
contract while keeping external-backend installation explicitly opt-in.
|
|
5
|
+
|
|
3
6
|
## Category
|
|
4
7
|
|
|
8
|
+
<!-- package-metadata:start -->
|
|
9
|
+
<!-- Generated by scripts/generate-package-docs.mjs. Do not edit by hand. -->
|
|
10
|
+
|
|
5
11
|
Category: `context`
|
|
12
|
+
Tier: `plugin`
|
|
13
|
+
Catalog responsibility: Provides a MemoryStore over an external Supermemory instance (local OSS binary or hosted cloud) via its REST API: server-side extraction, hybrid recall, awaited completed-turn admission, and legacy best-effort writes.
|
|
14
|
+
|
|
15
|
+
<!-- package-metadata:end -->
|
|
6
16
|
|
|
7
17
|
Plugin tier: this package is released in the mono-agent lockstep, but is not
|
|
8
18
|
installed with `@mono-agent/agent-app`; the operator installs and selects it explicitly.
|
|
9
19
|
|
|
10
20
|
## Responsibility
|
|
11
21
|
|
|
12
|
-
Provides a `MemoryStore`
|
|
13
|
-
[Supermemory](https://supermemory.ai)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Supermemory extracts and consolidates memories **server-side**, so this backend needs no
|
|
17
|
-
embeddings model and no memory chat LLM — the adapter just posts turns and searches.
|
|
22
|
+
Provides a `MemoryStore` backed by an external
|
|
23
|
+
[Supermemory](https://supermemory.ai) REST service: server-side extraction,
|
|
24
|
+
hybrid recall, awaited run-keyed completed-turn admission, and legacy
|
|
25
|
+
best-effort writes. The service may be a local OSS instance or hosted cloud.
|
|
18
26
|
|
|
19
27
|
## Install / Usage
|
|
20
28
|
|
|
21
29
|
```bash
|
|
22
|
-
npm install @mono-agent/
|
|
30
|
+
npm install @mono-agent/agent-app@latest @mono-agent/memory-supermemory@latest
|
|
23
31
|
```
|
|
24
32
|
|
|
25
|
-
The
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
the
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
The lockstep `latest` tags resolve to the same framework version. If the host
|
|
34
|
+
pins an older release, replace both `latest` tags with that same version.
|
|
35
|
+
|
|
36
|
+
Installing the package does not enable it. Select the backend explicitly in the
|
|
37
|
+
agent configuration; `writeMode: "capture"` sends the completed turn for
|
|
38
|
+
server-side extraction:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"memory": {
|
|
43
|
+
"backend": "supermemory",
|
|
44
|
+
"writeMode": "capture",
|
|
45
|
+
"supermemory": {
|
|
46
|
+
"baseUrl": "http://127.0.0.1:6767",
|
|
47
|
+
"container": "my-agent"
|
|
48
|
+
},
|
|
49
|
+
"recallTool": { "enabled": true }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For hosted Supermemory, keep the secret outside JSON:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
MONO_AGENT_MEMORY_SUPERMEMORY_API_KEY=replace-with-your-secret
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The app configuration also accepts `apiKeyEnv`, `timeoutMs`, and
|
|
61
|
+
`exposeMcpServer`. Those are host-level settings: the direct factory below
|
|
62
|
+
accepts the already-resolved `apiKey` and does not read environment variables.
|
|
63
|
+
|
|
64
|
+
Direct embedders can construct the store without `@mono-agent/agent-app`:
|
|
65
|
+
|
|
66
|
+
<!-- doc-test:typescript -->
|
|
31
67
|
|
|
32
68
|
```ts
|
|
33
69
|
import { createSupermemoryStore } from "@mono-agent/memory-supermemory";
|
|
34
70
|
|
|
35
71
|
const store = createSupermemoryStore({
|
|
36
|
-
baseUrl: "http://127.0.0.1:6767",
|
|
37
|
-
|
|
38
|
-
container: "my-agent", // namespace tag scoping every add + search
|
|
72
|
+
baseUrl: "http://127.0.0.1:6767",
|
|
73
|
+
container: "my-agent",
|
|
39
74
|
maxBytes: 64_000,
|
|
40
75
|
});
|
|
41
76
|
|
|
@@ -46,38 +81,79 @@ await store.persistCompletedTurn({
|
|
|
46
81
|
captureText: "User: Use dark mode.\nAssistant: Done.",
|
|
47
82
|
});
|
|
48
83
|
const block = await store.load("conv-1", "preferences");
|
|
84
|
+
console.log(block?.content);
|
|
85
|
+
await store.close();
|
|
49
86
|
```
|
|
50
87
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
The package also ships `skills/mono-agent-supermemory/SKILL.md`, which guides a
|
|
89
|
+
local configuration agent through service selection, privacy disclosure,
|
|
90
|
+
validation, and a real recall smoke test. There is no separate preset loader;
|
|
91
|
+
the normal wizard offers the plugin after installation.
|
|
92
|
+
|
|
93
|
+
## Architecture
|
|
94
|
+
|
|
95
|
+
### Data flow
|
|
96
|
+
|
|
97
|
+
1. A completed turn enters `persistCompletedTurn()`, which awaits a
|
|
98
|
+
`POST /v3/documents` request and the service's admission response.
|
|
99
|
+
2. A recall query enters `load()` or `recall()`, which requests
|
|
100
|
+
`POST /v4/search` and caches a `/v3/search` fallback after a 404 response.
|
|
101
|
+
3. The store normalizes the ranked service hits and returns a bounded memory
|
|
102
|
+
block or the tool-oriented recall-hit shape.
|
|
103
|
+
|
|
104
|
+
These steps describe network requests, not an in-process database. With hosted
|
|
105
|
+
Supermemory, completed-turn text, legacy write text, recall queries, and returned
|
|
106
|
+
memory leave the machine. Strong completed-turn metadata omits raw run and
|
|
107
|
+
conversation ids, but its document content still contains the host-approved
|
|
108
|
+
summary and optional capture text. A local service keeps the REST hop on-machine;
|
|
109
|
+
service storage, extraction, access control, retention, and deletion remain
|
|
110
|
+
Supermemory responsibilities in either deployment.
|
|
111
|
+
|
|
112
|
+
### Package structure
|
|
113
|
+
|
|
114
|
+
| Source file | Responsibility |
|
|
115
|
+
| --- | --- |
|
|
116
|
+
| `src/index.ts` | Validated convenience factory and public exports. |
|
|
117
|
+
| `src/client.ts` | Raw Fetch-based `/v3/documents`, `/v4/search`, and cached `/v3/search` fallback client. |
|
|
118
|
+
| `src/store.ts` | `MemoryStore` behavior, strong admission, legacy write compatibility, recall shaping, and queue draining. |
|
|
119
|
+
| `src/format.ts` | UTF-8-bounded Markdown `MemoryBlock` rendering. |
|
|
120
|
+
|
|
121
|
+
### Read and write behavior
|
|
122
|
+
|
|
123
|
+
- `load(conversationId, query?)` searches with `query` when non-empty and falls
|
|
124
|
+
back to `conversationId` otherwise. It formats ranked hits into a Markdown
|
|
125
|
+
block capped at `maxBytes` and degrades to `undefined` on any client error.
|
|
126
|
+
- `persistCompletedTurn(turn)` awaits one `/v3/documents` upsert containing the
|
|
127
|
+
deterministic summary and optional capture text. Its SHA-256-derived custom id
|
|
128
|
+
is keyed only by `runId`; failures are logged and rethrown so the harness can
|
|
129
|
+
report memory degradation without replacing the provider answer.
|
|
130
|
+
- The strong path retains a default 10,000-entry bounded LRU of successful
|
|
131
|
+
run/payload fingerprints. Same-process exact retries return `duplicate` without
|
|
132
|
+
another request; retained conflicts fail before a request. After eviction or
|
|
133
|
+
restart, the stable remote id still converges on one logical upsert, but the API
|
|
134
|
+
cannot classify an old duplicate or reject an old conflicting payload.
|
|
135
|
+
- Strong completed-turn documents above 1,000,000 bytes are rejected instead of
|
|
136
|
+
being partially admitted.
|
|
137
|
+
- Legacy `appendHostSummary(conversationId, summary)` and
|
|
138
|
+
`scheduleCapture(conversationId, text)` remain best-effort compatibility paths.
|
|
139
|
+
Summary failure returns `bytesWritten: 0`; scheduled capture is serialized and
|
|
140
|
+
fire-and-forget. Neither throws to its caller, and the bundled harness does not
|
|
141
|
+
choose them while `persistCompletedTurn` is present.
|
|
142
|
+
- `recall(query, { topK? })` propagates search errors and returns hits shaped for
|
|
143
|
+
the app-owned `MemoryRecall` tool.
|
|
78
144
|
|
|
79
145
|
## Public API
|
|
80
146
|
|
|
147
|
+
### Start here
|
|
148
|
+
|
|
149
|
+
| API | Use it for |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| `createSupermemoryStore` | Validate service settings and construct the normal HTTP-backed store. |
|
|
152
|
+
| `validateSupermemoryConfig` | Validate direct-factory configuration without sending a network request. |
|
|
153
|
+
| `SupermemoryMemoryStore` | Inject a fake/custom `SupermemoryClient` or tune the direct-constructor completion LRU. |
|
|
154
|
+
| `createSupermemoryHttpClient` | Use the narrow REST client without the `MemoryStore` adapter. |
|
|
155
|
+
| `formatHitsAsBlock` | Render normalized hits into a byte-bounded Markdown memory block. |
|
|
156
|
+
|
|
81
157
|
<!-- public-api-inventory:start -->
|
|
82
158
|
<!-- Generated by scripts/generate-public-api-docs.mjs. Do not edit by hand. -->
|
|
83
159
|
|
|
@@ -122,6 +198,13 @@ It does not own backend selection (that is `config.memory.backend`) or the
|
|
|
122
198
|
the Supermemory service itself (extraction, consolidation, and storage all happen
|
|
123
199
|
server-side). It does not run BuJo scheduled consolidation and ignores `mode`/`embeddings`/`llm`.
|
|
124
200
|
|
|
201
|
+
## Related Documentation
|
|
202
|
+
|
|
203
|
+
- [Built-in versus Supermemory backends](https://mono-agent-docs.vercel.app/memory/backends-comparison/)
|
|
204
|
+
- [Write modes, durable capture, and recall](https://mono-agent-docs.vercel.app/memory/capture-and-recall/)
|
|
205
|
+
- [Memory validation and CLI maintenance](https://mono-agent-docs.vercel.app/memory/validation-and-cli/)
|
|
206
|
+
- [Memory configuration environment variables](https://mono-agent-docs.vercel.app/config/env-vars/#memory)
|
|
207
|
+
|
|
125
208
|
## Verification
|
|
126
209
|
|
|
127
210
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mono-agent/memory-supermemory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Supermemory external memory backend: a MemoryStore over Supermemory's REST API (local OSS binary or hosted cloud).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "GPL-3.0-only",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"README.md"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@mono-agent/agent-contracts": "0.
|
|
32
|
+
"@mono-agent/agent-contracts": "0.14.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|