hindclaw-openclaw 0.1.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/dist/client.d.ts +41 -0
- package/dist/client.js +211 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.js +132 -0
- package/dist/debug.d.ts +3 -0
- package/dist/debug.js +15 -0
- package/dist/derive-bank-id.d.ts +17 -0
- package/dist/derive-bank-id.js +60 -0
- package/dist/embed-manager.d.ts +32 -0
- package/dist/embed-manager.js +289 -0
- package/dist/format.d.ts +4 -0
- package/dist/format.js +20 -0
- package/dist/hooks/recall.d.ts +17 -0
- package/dist/hooks/recall.js +230 -0
- package/dist/hooks/retain.d.ts +26 -0
- package/dist/hooks/retain.js +178 -0
- package/dist/hooks/session-start.d.ts +3 -0
- package/dist/hooks/session-start.js +61 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +577 -0
- package/dist/moltbot-types.d.ts +27 -0
- package/dist/moltbot-types.js +3 -0
- package/dist/types.d.ts +256 -0
- package/dist/types.js +2 -0
- package/dist/utils.d.ts +51 -0
- package/dist/utils.js +230 -0
- package/openclaw.plugin.json +344 -0
- package/package.json +58 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "hindclaw",
|
|
3
|
+
"name": "HindClaw",
|
|
4
|
+
"kind": "memory",
|
|
5
|
+
"configSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"daemonIdleTimeout": {
|
|
9
|
+
"type": "number",
|
|
10
|
+
"description": "Seconds before daemon shuts down from inactivity (0 = never)",
|
|
11
|
+
"default": 0
|
|
12
|
+
},
|
|
13
|
+
"embedPort": {
|
|
14
|
+
"type": "number",
|
|
15
|
+
"description": "Port for hindsight-embed server (auto-assigned if not specified)",
|
|
16
|
+
"default": 0
|
|
17
|
+
},
|
|
18
|
+
"embedVersion": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "hindsight-embed version to use (e.g. 'latest', '0.4.2', or empty for latest)",
|
|
21
|
+
"default": "latest"
|
|
22
|
+
},
|
|
23
|
+
"llmProvider": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "LLM provider for Hindsight memory (e.g. 'openai', 'anthropic', 'gemini', 'groq', 'ollama', 'openai-codex', 'claude-code'). Takes priority over auto-detection but not over HINDSIGHT_API_LLM_PROVIDER env var.",
|
|
26
|
+
"enum": [
|
|
27
|
+
"openai",
|
|
28
|
+
"anthropic",
|
|
29
|
+
"gemini",
|
|
30
|
+
"groq",
|
|
31
|
+
"ollama",
|
|
32
|
+
"openai-codex",
|
|
33
|
+
"claude-code"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"llmModel": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "LLM model to use (e.g. 'gpt-4o-mini', 'claude-3-5-haiku-20241022'). Used with llmProvider."
|
|
39
|
+
},
|
|
40
|
+
"llmApiKeyEnv": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Name of the env var holding the API key (e.g. 'MY_CUSTOM_KEY'). If not set, uses the standard env var for the chosen provider."
|
|
43
|
+
},
|
|
44
|
+
"embedPackagePath": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Local path to hindsight package for development (e.g. '/path/to/hindsight'). When set, uses 'uv run --directory <path>' instead of 'uvx hindsight-embed@latest'."
|
|
47
|
+
},
|
|
48
|
+
"apiPort": {
|
|
49
|
+
"type": "number",
|
|
50
|
+
"description": "Port for the openclaw profile daemon (default: 9077)",
|
|
51
|
+
"default": 9077
|
|
52
|
+
},
|
|
53
|
+
"hindsightApiUrl": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "External Hindsight API URL (e.g. 'https://mcp.hindsight.devcraft.team'). When set, skips local daemon and connects directly to this API."
|
|
56
|
+
},
|
|
57
|
+
"jwtSecret": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "HMAC-SHA256 secret for signing JWT tokens sent to the Hindsight API. Must match HINDCLAW_JWT_SECRET on the server."
|
|
60
|
+
},
|
|
61
|
+
"clientId": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "Client identifier included in JWT claims. Defaults to 'openclaw'.",
|
|
64
|
+
"default": "openclaw"
|
|
65
|
+
},
|
|
66
|
+
"dynamicBankId": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"description": "Enable per-user memory banks. When true, memories are isolated by user per channel (e.g., slack-U123, telegram-456789). When false, all users share a single 'openclaw' bank.",
|
|
69
|
+
"default": true
|
|
70
|
+
},
|
|
71
|
+
"bankIdPrefix": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Optional prefix for bank IDs (e.g., 'prod' results in 'prod-slack-U123'). Useful for separating environments."
|
|
74
|
+
},
|
|
75
|
+
"autoRecall": {
|
|
76
|
+
"type": "boolean",
|
|
77
|
+
"description": "Automatically recall memories on every prompt and inject them as context. Set to false when agent has its own recall tool.",
|
|
78
|
+
"default": true
|
|
79
|
+
},
|
|
80
|
+
"excludeProviders": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "string"
|
|
84
|
+
},
|
|
85
|
+
"description": "Message providers to exclude from recall and retain (e.g. ['telegram', 'discord'])"
|
|
86
|
+
},
|
|
87
|
+
"dynamicBankGranularity": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"enum": [
|
|
92
|
+
"agent",
|
|
93
|
+
"channel",
|
|
94
|
+
"user",
|
|
95
|
+
"provider"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"description": "Fields used to derive bank ID. Controls memory isolation granularity. Default: ['agent', 'channel', 'user'].",
|
|
99
|
+
"default": [
|
|
100
|
+
"agent",
|
|
101
|
+
"channel",
|
|
102
|
+
"user"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"autoRetain": {
|
|
106
|
+
"type": "boolean",
|
|
107
|
+
"description": "Automatically retain conversation as memories after each interaction. Set to false to disable.",
|
|
108
|
+
"default": true
|
|
109
|
+
},
|
|
110
|
+
"retainRoles": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"enum": [
|
|
115
|
+
"user",
|
|
116
|
+
"assistant",
|
|
117
|
+
"system",
|
|
118
|
+
"tool"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"description": "Message roles to include in retained transcript. Default: ['user', 'assistant'].",
|
|
122
|
+
"default": [
|
|
123
|
+
"user",
|
|
124
|
+
"assistant"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"retainEveryNTurns": {
|
|
128
|
+
"type": "integer",
|
|
129
|
+
"description": "Retain every Nth turn instead of every turn. 1 = every turn (default). Values > 1 enable chunked retention with a sliding window.",
|
|
130
|
+
"minimum": 1,
|
|
131
|
+
"default": 1
|
|
132
|
+
},
|
|
133
|
+
"retainOverlapTurns": {
|
|
134
|
+
"type": "integer",
|
|
135
|
+
"description": "Extra prior turns to include when chunked retention fires. Window = retainEveryNTurns + retainOverlapTurns. Only applies when retainEveryNTurns > 1.",
|
|
136
|
+
"minimum": 0,
|
|
137
|
+
"default": 0
|
|
138
|
+
},
|
|
139
|
+
"recallBudget": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"description": "Recall effort level. Higher budgets use more retrieval strategies for better results but take longer.",
|
|
142
|
+
"enum": ["low", "mid", "high"],
|
|
143
|
+
"default": "mid"
|
|
144
|
+
},
|
|
145
|
+
"recallMaxTokens": {
|
|
146
|
+
"type": "integer",
|
|
147
|
+
"description": "Maximum tokens for recall response. Controls how much memory context is injected per turn.",
|
|
148
|
+
"minimum": 1,
|
|
149
|
+
"default": 1024
|
|
150
|
+
},
|
|
151
|
+
"recallTypes": {
|
|
152
|
+
"type": "array",
|
|
153
|
+
"items": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"enum": ["world", "experience", "observation"]
|
|
156
|
+
},
|
|
157
|
+
"description": "Memory types to recall. Defaults to ['world', 'experience'] — excludes verbose observation entries.",
|
|
158
|
+
"default": ["world", "experience"]
|
|
159
|
+
},
|
|
160
|
+
"recallRoles": {
|
|
161
|
+
"type": "array",
|
|
162
|
+
"items": {
|
|
163
|
+
"type": "string",
|
|
164
|
+
"enum": ["user", "assistant", "system", "tool"]
|
|
165
|
+
},
|
|
166
|
+
"description": "Roles to include when composing contextual recall query. Default: ['user', 'assistant'].",
|
|
167
|
+
"default": ["user", "assistant"]
|
|
168
|
+
},
|
|
169
|
+
"recallContextTurns": {
|
|
170
|
+
"type": "integer",
|
|
171
|
+
"minimum": 1,
|
|
172
|
+
"description": "Number of user turns to include in recall query context. 1 keeps latest-message-only behavior.",
|
|
173
|
+
"default": 1
|
|
174
|
+
},
|
|
175
|
+
"recallMaxQueryChars": {
|
|
176
|
+
"type": "integer",
|
|
177
|
+
"minimum": 1,
|
|
178
|
+
"description": "Maximum character length for composed recall query before calling recall.",
|
|
179
|
+
"default": 800
|
|
180
|
+
},
|
|
181
|
+
"recallTopK": {
|
|
182
|
+
"type": "integer",
|
|
183
|
+
"minimum": 1,
|
|
184
|
+
"description": "Maximum number of memories to inject per turn. Applied after API response as a hard cap."
|
|
185
|
+
},
|
|
186
|
+
"recallPromptPreamble": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"description": "Text shown above recalled memories in the injected context block.",
|
|
189
|
+
"default": "Relevant memories from past conversations (prioritize recent when conflicting). Only use memories that are directly useful to continue this conversation; ignore the rest:"
|
|
190
|
+
},
|
|
191
|
+
"debug": {
|
|
192
|
+
"type": "boolean",
|
|
193
|
+
"description": "Enable debug logging for Hindsight plugin operations.",
|
|
194
|
+
"default": false
|
|
195
|
+
},
|
|
196
|
+
"agents": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"description": "Per-agent bank config registration. Keys are agent IDs.",
|
|
199
|
+
"additionalProperties": {
|
|
200
|
+
"type": "object",
|
|
201
|
+
"properties": {
|
|
202
|
+
"bankConfig": {
|
|
203
|
+
"type": "string",
|
|
204
|
+
"description": "Path to bank config template file (relative to .openclaw/)."
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"required": ["bankConfig"]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"retainContext": {
|
|
211
|
+
"type": "string",
|
|
212
|
+
"description": "Short label describing the source context for retained facts."
|
|
213
|
+
},
|
|
214
|
+
"retainObservationScopes": {
|
|
215
|
+
"description": "Controls observation consolidation.",
|
|
216
|
+
"oneOf": [
|
|
217
|
+
{ "type": "string", "enum": ["combined", "per_tag", "all_combinations"] },
|
|
218
|
+
{ "type": "array", "items": { "type": "array", "items": { "type": "string" } } }
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"additionalProperties": false
|
|
223
|
+
},
|
|
224
|
+
"uiHints": {
|
|
225
|
+
"daemonIdleTimeout": {
|
|
226
|
+
"label": "Daemon Idle Timeout",
|
|
227
|
+
"placeholder": "0 (never timeout)"
|
|
228
|
+
},
|
|
229
|
+
"embedPort": {
|
|
230
|
+
"label": "Embed Server Port",
|
|
231
|
+
"placeholder": "0 (auto-assign)"
|
|
232
|
+
},
|
|
233
|
+
"embedVersion": {
|
|
234
|
+
"label": "Hindsight Embed Version",
|
|
235
|
+
"placeholder": "latest (or pin to specific version like 0.4.2)"
|
|
236
|
+
},
|
|
237
|
+
"llmProvider": {
|
|
238
|
+
"label": "LLM Provider",
|
|
239
|
+
"placeholder": "e.g. openai, anthropic, gemini, groq"
|
|
240
|
+
},
|
|
241
|
+
"llmModel": {
|
|
242
|
+
"label": "LLM Model",
|
|
243
|
+
"placeholder": "e.g. gpt-4o-mini, claude-3-5-haiku-20241022"
|
|
244
|
+
},
|
|
245
|
+
"llmApiKeyEnv": {
|
|
246
|
+
"label": "API Key Env Var",
|
|
247
|
+
"placeholder": "e.g. MY_CUSTOM_API_KEY (optional)"
|
|
248
|
+
},
|
|
249
|
+
"embedPackagePath": {
|
|
250
|
+
"label": "Local Package Path (Dev)",
|
|
251
|
+
"placeholder": "/path/to/hindsight (for local development)"
|
|
252
|
+
},
|
|
253
|
+
"apiPort": {
|
|
254
|
+
"label": "API Port",
|
|
255
|
+
"placeholder": "9077 (default)"
|
|
256
|
+
},
|
|
257
|
+
"hindsightApiUrl": {
|
|
258
|
+
"label": "External Hindsight API URL",
|
|
259
|
+
"placeholder": "e.g. https://mcp.hindsight.devcraft.team (leave empty for local daemon)"
|
|
260
|
+
},
|
|
261
|
+
"jwtSecret": {
|
|
262
|
+
"label": "JWT Secret",
|
|
263
|
+
"placeholder": "HMAC-SHA256 secret (must match server)"
|
|
264
|
+
},
|
|
265
|
+
"clientId": {
|
|
266
|
+
"label": "Client ID",
|
|
267
|
+
"placeholder": "openclaw (default)"
|
|
268
|
+
},
|
|
269
|
+
"dynamicBankId": {
|
|
270
|
+
"label": "Dynamic Bank IDs",
|
|
271
|
+
"placeholder": "true (isolate memories per channel)"
|
|
272
|
+
},
|
|
273
|
+
"bankIdPrefix": {
|
|
274
|
+
"label": "Bank ID Prefix",
|
|
275
|
+
"placeholder": "e.g., prod, staging (optional)"
|
|
276
|
+
},
|
|
277
|
+
"autoRecall": {
|
|
278
|
+
"label": "Auto-Recall",
|
|
279
|
+
"placeholder": "true (inject memories on every prompt)"
|
|
280
|
+
},
|
|
281
|
+
"excludeProviders": {
|
|
282
|
+
"label": "Excluded Providers",
|
|
283
|
+
"placeholder": "e.g. telegram, discord"
|
|
284
|
+
},
|
|
285
|
+
"dynamicBankGranularity": {
|
|
286
|
+
"label": "Bank Granularity",
|
|
287
|
+
"placeholder": "e.g. ['agent', 'channel', 'user']"
|
|
288
|
+
},
|
|
289
|
+
"autoRetain": {
|
|
290
|
+
"label": "Auto-Retain",
|
|
291
|
+
"placeholder": "true (enable auto-retention)"
|
|
292
|
+
},
|
|
293
|
+
"retainRoles": {
|
|
294
|
+
"label": "Retain Roles",
|
|
295
|
+
"placeholder": "e.g. ['user', 'assistant']"
|
|
296
|
+
},
|
|
297
|
+
"retainEveryNTurns": {
|
|
298
|
+
"label": "Retain Every N Turns",
|
|
299
|
+
"placeholder": "1 (every turn, default)"
|
|
300
|
+
},
|
|
301
|
+
"retainOverlapTurns": {
|
|
302
|
+
"label": "Retain Overlap Turns",
|
|
303
|
+
"placeholder": "0 (no overlap, default)"
|
|
304
|
+
},
|
|
305
|
+
"recallBudget": {
|
|
306
|
+
"label": "Recall Budget",
|
|
307
|
+
"placeholder": "low, mid, or high"
|
|
308
|
+
},
|
|
309
|
+
"recallMaxTokens": {
|
|
310
|
+
"label": "Recall Max Tokens",
|
|
311
|
+
"placeholder": "1024 (default)"
|
|
312
|
+
},
|
|
313
|
+
"recallTypes": {
|
|
314
|
+
"label": "Recall Types",
|
|
315
|
+
"placeholder": "e.g. ['world', 'experience']"
|
|
316
|
+
},
|
|
317
|
+
"recallRoles": {
|
|
318
|
+
"label": "Recall Roles",
|
|
319
|
+
"placeholder": "e.g. ['user', 'assistant']"
|
|
320
|
+
},
|
|
321
|
+
"recallContextTurns": {
|
|
322
|
+
"label": "Recall Context Turns",
|
|
323
|
+
"placeholder": "1 (latest only, default)"
|
|
324
|
+
},
|
|
325
|
+
"recallMaxQueryChars": {
|
|
326
|
+
"label": "Recall Max Query Chars",
|
|
327
|
+
"placeholder": "800 (default)"
|
|
328
|
+
},
|
|
329
|
+
"recallTopK": {
|
|
330
|
+
"label": "Recall Top K",
|
|
331
|
+
"placeholder": "e.g. 5 (no limit by default)"
|
|
332
|
+
},
|
|
333
|
+
"recallPromptPreamble": {
|
|
334
|
+
"label": "Recall Prompt Preamble",
|
|
335
|
+
"placeholder": "Instruction shown above recalled memories in injected context"
|
|
336
|
+
},
|
|
337
|
+
"debug": {
|
|
338
|
+
"label": "Debug"
|
|
339
|
+
},
|
|
340
|
+
"agents": { "label": "Agent Bank Configs", "placeholder": "Map of agentId → { bankConfig: path }" },
|
|
341
|
+
"retainContext": { "label": "Retain Context", "placeholder": "e.g. 'telegram conversation'" },
|
|
342
|
+
"retainObservationScopes": { "label": "Observation Scopes", "placeholder": "e.g. 'combined' or [['health','fitness']]" }
|
|
343
|
+
}
|
|
344
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hindclaw-openclaw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Hindsight memory plugin for OpenClaw — JWT-authenticated, per-agent config, multi-bank recall",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"openclaw": {
|
|
9
|
+
"extensions": [
|
|
10
|
+
"./dist/index.js"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"openclaw",
|
|
15
|
+
"memory",
|
|
16
|
+
"ai",
|
|
17
|
+
"agent",
|
|
18
|
+
"multiagent",
|
|
19
|
+
"hindsight",
|
|
20
|
+
"long-term-memory"
|
|
21
|
+
],
|
|
22
|
+
"author": "Ruben Khachaturov <mr.kha4a2rov@protonmail.com>",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+ssh://git@github.com/mrkhachaturov/hindclaw.git"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"openclaw.plugin.json",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"dev": "tsc --watch",
|
|
36
|
+
"clean": "rm -rf dist",
|
|
37
|
+
"test": "vitest run src",
|
|
38
|
+
"test:watch": "vitest src",
|
|
39
|
+
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
40
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"json5": "^2.2.3",
|
|
44
|
+
"node-fetch": "^3.3.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^20.0.0",
|
|
48
|
+
"@vitest/ui": "^4.0.18",
|
|
49
|
+
"typescript": "^5.3.0",
|
|
50
|
+
"vitest": "^4.0.18"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=22"
|
|
54
|
+
},
|
|
55
|
+
"overrides": {
|
|
56
|
+
"rollup": "^4.59.0"
|
|
57
|
+
}
|
|
58
|
+
}
|