@mrc2204/agent-smart-memo 4.1.3 → 5.0.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 +445 -141
- package/dist/adapters/openclaw/tool-runtime.d.ts +29 -0
- package/dist/adapters/openclaw/tool-runtime.d.ts.map +1 -0
- package/dist/adapters/openclaw/tool-runtime.js +48 -0
- package/dist/adapters/openclaw/tool-runtime.js.map +1 -0
- package/dist/commands/telegram-addproject-command.d.ts +33 -0
- package/dist/commands/telegram-addproject-command.d.ts.map +1 -0
- package/dist/commands/telegram-addproject-command.js +208 -0
- package/dist/commands/telegram-addproject-command.js.map +1 -0
- package/dist/core/contracts/adapter-contracts.d.ts +31 -0
- package/dist/core/contracts/adapter-contracts.d.ts.map +1 -0
- package/dist/core/contracts/adapter-contracts.js +2 -0
- package/dist/core/contracts/adapter-contracts.js.map +1 -0
- package/dist/core/runtime-boundary.d.ts +23 -0
- package/dist/core/runtime-boundary.d.ts.map +1 -0
- package/dist/core/runtime-boundary.js +39 -0
- package/dist/core/runtime-boundary.js.map +1 -0
- package/dist/core/usecases/default-memory-usecase-port.d.ts +54 -0
- package/dist/core/usecases/default-memory-usecase-port.d.ts.map +1 -0
- package/dist/core/usecases/default-memory-usecase-port.js +1139 -0
- package/dist/core/usecases/default-memory-usecase-port.js.map +1 -0
- package/dist/core/usecases/semantic-memory-usecase.d.ts +52 -0
- package/dist/core/usecases/semantic-memory-usecase.d.ts.map +1 -0
- package/dist/core/usecases/semantic-memory-usecase.js +136 -0
- package/dist/core/usecases/semantic-memory-usecase.js.map +1 -0
- package/dist/db/slot-db.d.ts +293 -0
- package/dist/db/slot-db.d.ts.map +1 -1
- package/dist/db/slot-db.js +1272 -0
- package/dist/db/slot-db.js.map +1 -1
- package/dist/index.d.ts +537 -64
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +239 -99
- package/dist/index.js.map +1 -1
- package/dist/services/qdrant.d.ts.map +1 -1
- package/dist/services/qdrant.js +17 -0
- package/dist/services/qdrant.js.map +1 -1
- package/dist/tools/graph-tools.d.ts +2 -0
- package/dist/tools/graph-tools.d.ts.map +1 -1
- package/dist/tools/graph-tools.js +126 -177
- package/dist/tools/graph-tools.js.map +1 -1
- package/dist/tools/project-tools.d.ts +8 -0
- package/dist/tools/project-tools.d.ts.map +1 -0
- package/dist/tools/project-tools.js +649 -0
- package/dist/tools/project-tools.js.map +1 -0
- package/dist/tools/semantic-memory-tools.d.ts +8 -0
- package/dist/tools/semantic-memory-tools.d.ts.map +1 -0
- package/dist/tools/semantic-memory-tools.js +111 -0
- package/dist/tools/semantic-memory-tools.js.map +1 -0
- package/dist/tools/slot-tools.d.ts +3 -1
- package/dist/tools/slot-tools.d.ts.map +1 -1
- package/dist/tools/slot-tools.js +82 -156
- package/dist/tools/slot-tools.js.map +1 -1
- package/openclaw.plugin.json +22 -2
- package/package.json +25 -32
- package/dist/config.d.ts +0 -62
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -102
- package/dist/config.js.map +0 -1
- package/dist/scripts/reembed-collection.d.ts +0 -2
- package/dist/scripts/reembed-collection.d.ts.map +0 -1
- package/dist/scripts/reembed-collection.js +0 -165
- package/dist/scripts/reembed-collection.js.map +0 -1
- package/dist/tools/memory_search.d.ts +0 -89
- package/dist/tools/memory_search.d.ts.map +0 -1
- package/dist/tools/memory_search.js +0 -188
- package/dist/tools/memory_search.js.map +0 -1
- package/dist/tools/memory_store.d.ts +0 -65
- package/dist/tools/memory_store.d.ts.map +0 -1
- package/dist/tools/memory_store.js +0 -196
- package/dist/tools/memory_store.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,38 +1,265 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Agent Smart Memo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **ASM v5.1 super memory platform for OpenClaw agents** — unified memory for **conversation memory**, **project memory**, semantic retrieval, structured slots, graph knowledge, onboarding, and engineering context assembly.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Originally built as an OpenClaw memory plugin for conversation/runtime memory, `agent-smart-memo` has evolved into a broader **agent memory platform**:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **conversation memory** for agent runtime continuity
|
|
8
|
+
- **project memory** for repo-aware engineering context
|
|
9
|
+
- **semantic memory** via vector retrieval
|
|
10
|
+
- **structured slot memory** via SQLite
|
|
11
|
+
- **graph memory** for entities/relationships
|
|
12
|
+
- **operator onboarding** for project registration + Jira mapping + indexing
|
|
13
|
+
- **CLI/setup flows** for OpenClaw installation and bootstrap
|
|
14
|
+
|
|
15
|
+
This repo is still packaged for **OpenClaw first**, but its practical role is now:
|
|
16
|
+
|
|
17
|
+
- a **super memory layer** for agents
|
|
18
|
+
- a **project-aware engineering memory system**
|
|
19
|
+
- an **operator-friendly onboarding/runtime package**
|
|
20
|
+
|
|
21
|
+
It is no longer accurate to describe ASM as only a small conversation-memory plugin.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1) What ASM v5.1 is
|
|
26
|
+
|
|
27
|
+
ASM v5.1 combines two big memory domains.
|
|
28
|
+
|
|
29
|
+
### A. Conversation memory
|
|
30
|
+
Used for ongoing agent continuity and runtime recall:
|
|
31
|
+
- semantic memory (`memory_search`, `memory_store`)
|
|
32
|
+
- structured slot memory (`memory_slot_*`)
|
|
33
|
+
- graph memory (`memory_graph_*`)
|
|
34
|
+
- auto-capture / auto-recall support
|
|
35
|
+
- namespace-aware memory behavior
|
|
8
36
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
37
|
+
### B. Project memory
|
|
38
|
+
Used for engineering/project-aware workflows:
|
|
39
|
+
- project registry and aliasing
|
|
40
|
+
- repo root / repo remote identity
|
|
41
|
+
- Jira mapping and tracker linkage
|
|
42
|
+
- onboarding flows for new repos
|
|
43
|
+
- project indexing / reindexing
|
|
44
|
+
- hybrid retrieval with file / symbol / task lineage
|
|
15
45
|
|
|
16
|
-
|
|
46
|
+
That is why ASM now acts as:
|
|
17
47
|
|
|
48
|
+
> **conversation memory + project memory + retrieval/control plane in one agent-facing platform**
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 2) What ASM v5.1 provides today
|
|
53
|
+
|
|
54
|
+
ASM-69 and follow-up waves expanded the system from memory-only into project-aware memory orchestration.
|
|
55
|
+
|
|
56
|
+
### Project-aware memory model
|
|
57
|
+
Agents can now reason about:
|
|
58
|
+
- `project_id`
|
|
59
|
+
- project alias
|
|
60
|
+
- `repo_root`
|
|
61
|
+
- `repo_remote`
|
|
62
|
+
- Jira space / epic mapping
|
|
63
|
+
- registration / validation state
|
|
64
|
+
|
|
65
|
+
### Ingest + semantic block extraction
|
|
66
|
+
Codebases can be transformed into retrievable structures using:
|
|
67
|
+
- file planning
|
|
68
|
+
- semantic block extraction
|
|
69
|
+
- deterministic file/chunk/symbol IDs
|
|
70
|
+
- diff-aware indexing primitives
|
|
71
|
+
|
|
72
|
+
### Incremental reindex
|
|
73
|
+
Instead of rebuilding everything blindly, ASM now supports:
|
|
74
|
+
- changed / unchanged / deleted diffing
|
|
75
|
+
- watch-state snapshotting
|
|
76
|
+
- checksum-driven reindex control
|
|
77
|
+
- background-friendly trigger flow
|
|
78
|
+
|
|
79
|
+
### Hybrid retrieval + task lineage
|
|
80
|
+
ASM is not just vector search anymore.
|
|
81
|
+
It can combine:
|
|
82
|
+
- semantic recall
|
|
83
|
+
- lexical/project filters
|
|
84
|
+
- file/symbol/task context
|
|
85
|
+
- parent/related/touched lineage context
|
|
86
|
+
|
|
87
|
+
### Operator onboarding
|
|
88
|
+
Operators can onboard a project with repo + alias + Jira mapping + optional index trigger using project-aware command flows.
|
|
89
|
+
|
|
90
|
+
### Setup CLI
|
|
91
|
+
OpenClaw setup is now easier through the global CLI:
|
|
92
|
+
- `asm setup-openclaw`
|
|
93
|
+
- `asm setup openclaw`
|
|
94
|
+
- legacy-compatible `npm run init-openclaw`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 3) Scope of this repository
|
|
99
|
+
|
|
100
|
+
This repository now spans multiple practical layers.
|
|
101
|
+
|
|
102
|
+
### OpenClaw runtime/plugin layer
|
|
103
|
+
Includes:
|
|
104
|
+
- plugin entry
|
|
105
|
+
- tool registration
|
|
106
|
+
- runtime hooks
|
|
107
|
+
- OpenClaw packaging/build flow
|
|
108
|
+
- setup/bootstrap CLI flow
|
|
109
|
+
|
|
110
|
+
### Shared memory platform layer
|
|
111
|
+
Includes:
|
|
112
|
+
- SlotDB
|
|
113
|
+
- semantic memory use-cases
|
|
114
|
+
- graph/registry logic
|
|
115
|
+
- shared contracts and runtime abstractions
|
|
116
|
+
|
|
117
|
+
### Project-aware engineering memory layer
|
|
118
|
+
Includes:
|
|
119
|
+
- project registry
|
|
120
|
+
- onboarding use-cases
|
|
121
|
+
- tracker mapping
|
|
122
|
+
- indexing/reindexing primitives
|
|
123
|
+
- lineage-aware retrieval
|
|
124
|
+
|
|
125
|
+
So the best mental model is:
|
|
126
|
+
|
|
127
|
+
> **an OpenClaw-delivered super memory platform with both conversation memory and project memory**
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 4) Runtime targets
|
|
132
|
+
|
|
133
|
+
### OpenClaw target
|
|
134
|
+
Use this when you want ASM as the main OpenClaw memory/runtime plugin.
|
|
135
|
+
|
|
136
|
+
Contains:
|
|
137
|
+
- core memory platform
|
|
138
|
+
- OpenClaw adapter
|
|
139
|
+
- plugin entry / hooks / tool registration
|
|
140
|
+
- operator onboarding command surfaces
|
|
141
|
+
|
|
142
|
+
Artifact intent:
|
|
143
|
+
- **OpenClaw plugin artifact**
|
|
144
|
+
|
|
145
|
+
### Paperclip target
|
|
146
|
+
Use this when you want Paperclip to consume the same shared memory core/runtime behavior.
|
|
147
|
+
|
|
148
|
+
Contains:
|
|
149
|
+
- core memory platform
|
|
150
|
+
- Paperclip adapter/runtime wrapper
|
|
151
|
+
- compatibility mapping
|
|
152
|
+
|
|
153
|
+
Artifact intent:
|
|
154
|
+
- **Paperclip runtime package**
|
|
155
|
+
|
|
156
|
+
### Core target
|
|
157
|
+
Use this when you want the shared contracts/use-cases without OpenClaw/Paperclip-specific delivery.
|
|
158
|
+
|
|
159
|
+
Contains:
|
|
160
|
+
- shared contracts
|
|
161
|
+
- shared use-cases
|
|
162
|
+
- shared memory/platform rules
|
|
163
|
+
|
|
164
|
+
Artifact intent:
|
|
165
|
+
- **runtime-agnostic shared memory core**
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 5) Main capability areas
|
|
170
|
+
|
|
171
|
+
### Conversation memory capabilities
|
|
172
|
+
- `memory_search`
|
|
173
|
+
- `memory_store`
|
|
174
|
+
- `memory_slot_get`
|
|
175
|
+
- `memory_slot_set`
|
|
176
|
+
- `memory_slot_delete`
|
|
177
|
+
- `memory_slot_list`
|
|
178
|
+
- `memory_graph_*`
|
|
179
|
+
- auto-capture / auto-recall
|
|
180
|
+
|
|
181
|
+
### Project memory capabilities
|
|
182
|
+
- `project.register`
|
|
183
|
+
- `project.get`
|
|
184
|
+
- `project.list`
|
|
185
|
+
- `project.link_tracker`
|
|
186
|
+
- `project.trigger_index`
|
|
187
|
+
- `project.reindex_diff`
|
|
188
|
+
- `project.index_watch_get`
|
|
189
|
+
- `project.legacy_backfill`
|
|
190
|
+
- Telegram/operator onboarding surfaces
|
|
191
|
+
|
|
192
|
+
### Retrieval/engineering context capabilities
|
|
193
|
+
- semantic retrieval
|
|
194
|
+
- lexical/project filtering
|
|
195
|
+
- project-aware context assembly
|
|
196
|
+
- file / symbol / task lineage
|
|
197
|
+
- repo-aware indexing and reindexing
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 6) CLI / setup UX
|
|
202
|
+
|
|
203
|
+
The preferred setup path is the global CLI.
|
|
204
|
+
|
|
205
|
+
### Install globally
|
|
18
206
|
```bash
|
|
19
|
-
|
|
207
|
+
npm install -g @mrc2204/agent-smart-memo
|
|
20
208
|
```
|
|
21
209
|
|
|
22
|
-
|
|
210
|
+
### Preferred setup flow
|
|
211
|
+
```bash
|
|
212
|
+
asm setup-openclaw
|
|
213
|
+
```
|
|
23
214
|
|
|
24
|
-
|
|
215
|
+
Also supported:
|
|
216
|
+
```bash
|
|
217
|
+
asm setup openclaw
|
|
218
|
+
```
|
|
25
219
|
|
|
26
|
-
|
|
220
|
+
Legacy-compatible flow:
|
|
221
|
+
```bash
|
|
222
|
+
npm run init-openclaw
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### What `asm setup-openclaw` does
|
|
226
|
+
1. checks that `openclaw` CLI exists
|
|
227
|
+
2. installs `@mrc2204/agent-smart-memo` if missing
|
|
228
|
+
3. runs OpenClaw bootstrap/init flow
|
|
229
|
+
4. patches config with preview + backup behavior
|
|
230
|
+
5. prints next-step verification guidance
|
|
27
231
|
|
|
28
|
-
|
|
29
|
-
|---------|----------|---------|
|
|
30
|
-
| [Qdrant](https://qdrant.tech/documentation/quick-start/) | Stores memory vectors | `docker run -d -p 6333:6333 qdrant/qdrant` |
|
|
31
|
-
| [Ollama](https://ollama.ai) | Generates text embeddings | [Download](https://ollama.ai/download) then `ollama pull mxbai-embed-large` |
|
|
232
|
+
This is the fastest path for operators who want ASM enabled in OpenClaw without manual config editing first.
|
|
32
233
|
|
|
33
|
-
|
|
234
|
+
---
|
|
34
235
|
|
|
35
|
-
|
|
236
|
+
## 7) Quick start for OpenClaw
|
|
237
|
+
|
|
238
|
+
If your current goal is still “install and run ASM in OpenClaw”, use this section.
|
|
239
|
+
|
|
240
|
+
### Install plugin directly
|
|
241
|
+
```bash
|
|
242
|
+
openclaw plugins install @mrc2204/agent-smart-memo
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Or install locally from source
|
|
246
|
+
```bash
|
|
247
|
+
npm install
|
|
248
|
+
npm run build
|
|
249
|
+
openclaw plugins install -l .
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Prerequisites
|
|
253
|
+
You typically need:
|
|
254
|
+
|
|
255
|
+
| Service | Purpose | Example |
|
|
256
|
+
|---|---|---|
|
|
257
|
+
| Qdrant | Semantic/vector memory | `docker run -d -p 6333:6333 qdrant/qdrant` |
|
|
258
|
+
| Embedding backend | Embeddings for semantic recall | Ollama / OpenAI-compatible / docker adapter |
|
|
259
|
+
| LLM endpoint | Fact extraction / auto-capture | OpenAI-compatible API |
|
|
260
|
+
|
|
261
|
+
### Example OpenClaw config
|
|
262
|
+
Add to `~/.openclaw/openclaw.json`:
|
|
36
263
|
|
|
37
264
|
```json5
|
|
38
265
|
{
|
|
@@ -45,25 +272,20 @@ Add to your `~/.openclaw/openclaw.json`:
|
|
|
45
272
|
"agent-smart-memo": {
|
|
46
273
|
enabled: true,
|
|
47
274
|
config: {
|
|
48
|
-
// Required: Qdrant connection
|
|
49
275
|
qdrantHost: "localhost",
|
|
50
276
|
qdrantPort: 6333,
|
|
51
277
|
qdrantCollection: "openclaw_memory",
|
|
52
278
|
|
|
53
|
-
// Required: Any OpenAI-compatible API for fact extraction
|
|
54
279
|
llmBaseUrl: "https://api.openai.com/v1",
|
|
55
280
|
llmApiKey: "sk-...",
|
|
56
281
|
llmModel: "gpt-4o-mini",
|
|
57
282
|
|
|
58
|
-
// Required: Embedding backend (additive, backward-compatible)
|
|
59
283
|
embedBaseUrl: "http://localhost:11434",
|
|
60
|
-
embedBackend: "ollama",
|
|
61
|
-
embedModel: "
|
|
284
|
+
embedBackend: "ollama",
|
|
285
|
+
embedModel: "qwen3-embedding:0.6b",
|
|
62
286
|
embedDimensions: 1024,
|
|
63
287
|
|
|
64
|
-
|
|
65
|
-
// Priority: OPENCLAW_SLOTDB_DIR > config.slotDbDir > ${OPENCLAW_STATE_DIR}/agent-memo
|
|
66
|
-
slotDbDir: "/Users/mrcagents/.openclaw/agent-memo"
|
|
288
|
+
slotDbDir: "/Users/your-user/.openclaw/agent-memo"
|
|
67
289
|
}
|
|
68
290
|
}
|
|
69
291
|
}
|
|
@@ -71,156 +293,238 @@ Add to your `~/.openclaw/openclaw.json`:
|
|
|
71
293
|
}
|
|
72
294
|
```
|
|
73
295
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Start chatting with your agent. Memories are captured automatically.
|
|
296
|
+
---
|
|
77
297
|
|
|
78
|
-
|
|
298
|
+
## 8) Project onboarding flow
|
|
79
299
|
|
|
80
|
-
|
|
300
|
+
For project-aware onboarding in OpenClaw/Telegram flows, the current slash command is:
|
|
81
301
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
If `embedBackend` is omitted, plugin preserves legacy auto behavior.
|
|
302
|
+
```text
|
|
303
|
+
/project <repo_url>
|
|
304
|
+
```
|
|
87
305
|
|
|
88
|
-
|
|
306
|
+
### Current behavior summary
|
|
307
|
+
- onboarding preview exposes resolved `repo_root` when derivable
|
|
308
|
+
- preview/commit can report `repo_resolution` and `clone_policy`
|
|
309
|
+
- if `repo_url` matches an already-registered remote, registration reuses the existing project identity / `repo_root`
|
|
310
|
+
- if `repo_url` is a local path, it is treated as import without `git clone`
|
|
311
|
+
- `project.trigger_index` is background-friendly and reports:
|
|
312
|
+
- `accepted`
|
|
313
|
+
- `enqueued`
|
|
314
|
+
- `detached`
|
|
315
|
+
- `job_id`
|
|
316
|
+
|
|
317
|
+
### Typical onboarding path
|
|
318
|
+
1. operator starts with `/project <repo_url>`
|
|
319
|
+
2. bot prepares preview
|
|
320
|
+
3. preview shows alias/Jira/index choices and repo resolution hints
|
|
321
|
+
4. operator confirms
|
|
322
|
+
5. flow bridges into:
|
|
323
|
+
- `project_register_command`
|
|
324
|
+
- `project_link_tracker`
|
|
325
|
+
- `project_trigger_index`
|
|
326
|
+
|
|
327
|
+
See also:
|
|
328
|
+
- `docs/architecture/ASM-74-master-project-registration-ux-command-contract-jira-mapping-v5.1.md`
|
|
329
|
+
- `tests/test-project-registry.ts`
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 9) Quick start for Paperclip
|
|
334
|
+
|
|
335
|
+
If your goal is to let **Paperclip** consume the same memory core:
|
|
336
|
+
|
|
337
|
+
### Build the Paperclip target
|
|
338
|
+
```bash
|
|
339
|
+
npm install
|
|
340
|
+
npm run build:paperclip
|
|
341
|
+
npm run package:paperclip
|
|
342
|
+
npm run pack:paperclip
|
|
343
|
+
```
|
|
89
344
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
| `llmBaseUrl` | string | — | OpenAI-compatible API base URL |
|
|
96
|
-
| `llmApiKey` | string | — | API key for the LLM |
|
|
97
|
-
| `llmModel` | string | `"gpt-4o-mini"` | Model for fact extraction |
|
|
98
|
-
| `embedBaseUrl` | string | `"http://localhost:11434"` | Embedding service base URL |
|
|
99
|
-
| `embedBackend` | string | _unset_ | Optional backend selector: `ollama` \| `openai` \| `docker` (unset = legacy auto behavior) |
|
|
100
|
-
| `embedModel` | string | `"mxbai-embed-large"` | Embedding model name |
|
|
101
|
-
| `embedDimensions` | number | `1024` | Embedding vector dimensions |
|
|
102
|
-
| `slotDbDir` | string | `${OPENCLAW_STATE_DIR}/agent-memo` | Explicit SlotDB directory. Overridden by `OPENCLAW_SLOTDB_DIR` if set |
|
|
103
|
-
| `autoCaptureEnabled` | boolean | `true` | Enable automatic fact extraction |
|
|
104
|
-
| `autoCaptureMinConfidence` | number | `0.7` | Minimum confidence to store a fact (0-1) |
|
|
105
|
-
| `contextWindowMaxTokens` | number | `12000` | Max tokens sent to LLM for extraction |
|
|
106
|
-
| `summarizeEveryActions` | number | `6` | Auto-summarize project state every N turns |
|
|
107
|
-
| `slotCategories` | string[] | `["profile","preferences","project","environment","custom"]` | Allowed slot categories |
|
|
108
|
-
| `maxSlots` | number | `500` | Max slots per agent+user scope |
|
|
109
|
-
| `injectStateTokenBudget` | number | `500` | Max tokens for auto-recall context injection |
|
|
345
|
+
### What Paperclip consumes
|
|
346
|
+
Paperclip should consume:
|
|
347
|
+
- shared core contracts/use-cases
|
|
348
|
+
- Paperclip adapter runtime
|
|
349
|
+
- no OpenClaw plugin metadata/runtime dependency unless explicitly needed
|
|
110
350
|
|
|
111
|
-
|
|
351
|
+
### Current maturity
|
|
352
|
+
Paperclip path has:
|
|
353
|
+
- adapter contracts
|
|
354
|
+
- compatibility mapper
|
|
355
|
+
- runtime wrapper
|
|
356
|
+
- production-like smoke verification
|
|
112
357
|
|
|
113
|
-
|
|
358
|
+
But README intentionally does **not** overclaim this as full production-grade multi-runtime completion.
|
|
114
359
|
|
|
115
|
-
|
|
360
|
+
---
|
|
116
361
|
|
|
117
|
-
|
|
118
|
-
2. Plugin config `slotDbDir`
|
|
119
|
-
3. Legacy fallback `${OPENCLAW_STATE_DIR}/agent-memo`
|
|
362
|
+
## 10) Build targets
|
|
120
363
|
|
|
121
|
-
|
|
364
|
+
### Default build
|
|
365
|
+
```bash
|
|
366
|
+
npm run build
|
|
367
|
+
```
|
|
122
368
|
|
|
123
|
-
|
|
124
|
-
- Legacy `new SlotDB("/Users/mrcagents/.openclaw")` still resolves to `/Users/mrcagents/.openclaw/agent-memo/slots.db`
|
|
125
|
-
- Passing `/Users/mrcagents/.openclaw/agent-memo` as the target dir will **not** create nested `/agent-memo/agent-memo`
|
|
369
|
+
Default build remains **OpenClaw-compatible** for backward compatibility.
|
|
126
370
|
|
|
371
|
+
### Explicit targets
|
|
372
|
+
```bash
|
|
373
|
+
npm run build:openclaw
|
|
374
|
+
npm run build:paperclip
|
|
375
|
+
npm run build:core
|
|
376
|
+
npm run build:all
|
|
377
|
+
```
|
|
127
378
|
|
|
128
|
-
|
|
379
|
+
### Packaging
|
|
380
|
+
```bash
|
|
381
|
+
npm run package:openclaw
|
|
382
|
+
npm run package:paperclip
|
|
383
|
+
npm run package:core
|
|
384
|
+
```
|
|
129
385
|
|
|
386
|
+
### Pack tarballs
|
|
387
|
+
```bash
|
|
388
|
+
npm run pack:openclaw
|
|
389
|
+
npm run pack:paperclip
|
|
390
|
+
npm run pack:core
|
|
130
391
|
```
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
↓
|
|
138
|
-
Facts stored in SlotDB + Qdrant
|
|
139
|
-
↓
|
|
140
|
-
Next conversation starts
|
|
141
|
-
↓
|
|
142
|
-
Auto-Recall searches relevant memories
|
|
143
|
-
↓
|
|
144
|
-
Context injected into agent prompt
|
|
145
|
-
↓
|
|
146
|
-
Agent "remembers" previous conversations ✨
|
|
392
|
+
|
|
393
|
+
### Publish targets
|
|
394
|
+
```bash
|
|
395
|
+
npm run publish:openclaw
|
|
396
|
+
npm run publish:paperclip
|
|
397
|
+
npm run publish:core
|
|
147
398
|
```
|
|
148
399
|
|
|
149
|
-
|
|
400
|
+
> Publish requires valid npm authentication. If `NPM_TOKEN` is missing, publish should be treated as not ready / dry-run only.
|
|
150
401
|
|
|
151
|
-
|
|
402
|
+
---
|
|
152
403
|
|
|
153
|
-
|
|
154
|
-
|------|----------------------|---------------|
|
|
155
|
-
| `general` | Most conversations | Key decisions, rules, configurations |
|
|
156
|
-
| `principles` | Learning or teaching content | Core principles, atomic rules |
|
|
157
|
-
| `requirements` | Technical specs or constraints | Measurable requirements, acceptance criteria |
|
|
158
|
-
| `market_signal` | Financial or market discussions | Actionable signals, risk levels, triggers |
|
|
404
|
+
## 11) CI/CD model
|
|
159
405
|
|
|
160
|
-
|
|
406
|
+
GitHub Actions workflow: `.github/workflows/publish.yml`
|
|
161
407
|
|
|
162
|
-
|
|
408
|
+
Current flow:
|
|
409
|
+
- matrix build for `openclaw`, `paperclip`, `core`
|
|
410
|
+
- build → package → pack `.tgz` → upload artifact
|
|
411
|
+
- target-aware tests
|
|
412
|
+
- `workflow_dispatch` for manual publish
|
|
413
|
+
- `dry_run` supported
|
|
414
|
+
- real publish gated by `NPM_TOKEN`
|
|
163
415
|
|
|
164
|
-
|
|
416
|
+
### Important distinction
|
|
417
|
+
A `work/...` branch is for:
|
|
418
|
+
- CI checks
|
|
419
|
+
- PR review
|
|
420
|
+
- dry-run readiness
|
|
165
421
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
| `memory_auto_capture` | Manually trigger fact extraction on text |
|
|
171
|
-
| `memory_slot_get` | Read slot value(s) by key or category |
|
|
172
|
-
| `memory_slot_set` | Write a structured slot value |
|
|
173
|
-
| `memory_slot_delete` | Remove a slot |
|
|
174
|
-
| `memory_slot_list` | List all slots for current scope |
|
|
175
|
-
| `memory_graph_add` | Add a knowledge graph relation |
|
|
176
|
-
| `memory_graph_query` | Query the knowledge graph |
|
|
422
|
+
It is **not** the same as:
|
|
423
|
+
- production deploy
|
|
424
|
+
- final release approval
|
|
425
|
+
- final npm publish approval
|
|
177
426
|
|
|
178
|
-
|
|
427
|
+
Recommended flow:
|
|
179
428
|
|
|
180
|
-
|
|
429
|
+
```text
|
|
430
|
+
work/... push -> CI checks -> PR review -> approve -> merge default branch -> publish/release/deploy
|
|
431
|
+
```
|
|
181
432
|
|
|
182
|
-
|
|
183
|
-
|----------|-------------|------------|
|
|
184
|
-
| OpenAI | `https://api.openai.com/v1` | `gpt-4o-mini` |
|
|
185
|
-
| Anthropic (via proxy) | Your proxy URL | `claude-sonnet-4-20250514` |
|
|
186
|
-
| Local (Ollama) | `http://localhost:11434/v1` | `llama3.2` |
|
|
187
|
-
| OpenRouter | `https://openrouter.ai/api/v1` | `google/gemini-2.5-flash` |
|
|
188
|
-
| Any proxy | Your proxy URL | Your model |
|
|
433
|
+
---
|
|
189
434
|
|
|
190
|
-
##
|
|
435
|
+
## 12) Configuration notes
|
|
191
436
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
437
|
+
### Embedding backend mapping
|
|
438
|
+
When `embedBackend` is set:
|
|
439
|
+
- `ollama` → `/api/embeddings`
|
|
440
|
+
- `docker` → `/engines/llama.cpp/v1/embeddings`
|
|
441
|
+
- `openai` → `/v1/embeddings`
|
|
195
442
|
|
|
196
|
-
|
|
197
|
-
openclaw plugins update agent-smart-memo
|
|
443
|
+
If omitted, legacy auto behavior is preserved.
|
|
198
444
|
|
|
199
|
-
|
|
200
|
-
|
|
445
|
+
### SlotDB path resolution
|
|
446
|
+
Resolution order:
|
|
447
|
+
1. `OPENCLAW_SLOTDB_DIR`
|
|
448
|
+
2. plugin config `slotDbDir`
|
|
449
|
+
3. `${OPENCLAW_STATE_DIR}/agent-memo`
|
|
201
450
|
|
|
202
|
-
|
|
203
|
-
openclaw plugins uninstall agent-smart-memo
|
|
204
|
-
```
|
|
451
|
+
---
|
|
205
452
|
|
|
206
|
-
##
|
|
453
|
+
## 13) Verification levels
|
|
207
454
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
git clone https://github.com/cong91/agent-smart-memo.git
|
|
211
|
-
cd agent-smart-memo
|
|
455
|
+
### Build level
|
|
456
|
+
Confirms code compiles:
|
|
212
457
|
|
|
213
|
-
|
|
214
|
-
npm install
|
|
458
|
+
```bash
|
|
215
459
|
npm run build
|
|
460
|
+
npm run build:all
|
|
461
|
+
```
|
|
216
462
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
# Run tests
|
|
463
|
+
### Contract / integration level
|
|
464
|
+
```bash
|
|
221
465
|
npm test
|
|
466
|
+
npm run test:openclaw
|
|
467
|
+
npm run test:paperclip
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Project-aware targeted verification
|
|
471
|
+
```bash
|
|
472
|
+
npx tsx tests/test-project-registry.ts
|
|
473
|
+
npx tsx tests/test-project-reindex-diff.ts
|
|
474
|
+
npx tsx tests/test-project-hybrid-lineage.ts
|
|
475
|
+
npx tsx tests/test-project-legacy-backfill.ts
|
|
222
476
|
```
|
|
223
477
|
|
|
224
|
-
|
|
478
|
+
### Production-like runtime verification
|
|
479
|
+
Examples already added in this repo include:
|
|
480
|
+
- Paperclip runtime E2E
|
|
481
|
+
- OpenClaw anti-regression integration
|
|
482
|
+
- production-like smoke parity harness
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## 14) Repository layout (high level)
|
|
487
|
+
|
|
488
|
+
```text
|
|
489
|
+
src/
|
|
490
|
+
core/
|
|
491
|
+
contracts/
|
|
492
|
+
usecases/
|
|
493
|
+
ingest/
|
|
494
|
+
adapters/
|
|
495
|
+
openclaw/
|
|
496
|
+
paperclip/
|
|
497
|
+
tools/
|
|
498
|
+
hooks/
|
|
499
|
+
entries/
|
|
500
|
+
services/
|
|
501
|
+
db/
|
|
502
|
+
shared/
|
|
503
|
+
|
|
504
|
+
scripts/
|
|
505
|
+
artifacts/
|
|
506
|
+
docs/architecture/
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
## 15) Current mental model
|
|
512
|
+
|
|
513
|
+
If you only remember one thing, remember this:
|
|
514
|
+
|
|
515
|
+
> **ASM v5.1 is a super memory platform for agents: conversation memory + project memory + retrieval/control-plane capabilities.**
|
|
516
|
+
|
|
517
|
+
It helps agents:
|
|
518
|
+
- remember ongoing runtime/conversation context
|
|
519
|
+
- store/retrieve structured and semantic knowledge
|
|
520
|
+
- register and map projects
|
|
521
|
+
- index and reindex repos
|
|
522
|
+
- retrieve engineering context with lineage
|
|
523
|
+
- onboard projects with operator-friendly flows
|
|
524
|
+
- bootstrap OpenClaw faster through the CLI
|
|
525
|
+
|
|
526
|
+
---
|
|
527
|
+
|
|
528
|
+
## 16) License
|
|
225
529
|
|
|
226
530
|
MIT © [mrc2204](https://github.com/cong91)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SlotDB } from "../../db/slot-db.js";
|
|
2
|
+
import type { MemoryUseCasePort } from "../../core/contracts/adapter-contracts.js";
|
|
3
|
+
import type { SemanticMemoryUseCase } from "../../core/usecases/semantic-memory-usecase.js";
|
|
4
|
+
import { type MemoryRuntimeConfig } from "../../core/runtime-boundary.js";
|
|
5
|
+
export declare function configureOpenClawRuntime(options?: {
|
|
6
|
+
stateDir?: string;
|
|
7
|
+
slotDbDir?: string;
|
|
8
|
+
semanticUseCaseFactory?: (slotDbDir: string) => SemanticMemoryUseCase | undefined;
|
|
9
|
+
}): MemoryRuntimeConfig;
|
|
10
|
+
export declare function getSessionKey(ctx: any): string;
|
|
11
|
+
export declare function parseOpenClawSessionIdentity(sessionKey: string): {
|
|
12
|
+
userId: string;
|
|
13
|
+
agentId: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function getSlotDBForContext(ctx: any): SlotDB;
|
|
16
|
+
export declare function getMemoryUseCasePortForContext(ctx: any): MemoryUseCasePort;
|
|
17
|
+
export declare function createOpenClawResult(text: string, isError?: boolean): {
|
|
18
|
+
content: {
|
|
19
|
+
type: "text";
|
|
20
|
+
text: string;
|
|
21
|
+
}[];
|
|
22
|
+
details: {
|
|
23
|
+
toolResult: {
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
isError: boolean;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=tool-runtime.d.ts.map
|