@aislop-inc/opencode-mem 2.41.2 → 2.42.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 +107 -1
- package/dist/config.d.ts +69 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +80 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -5
- package/dist/services/ai/ai-provider-factory.d.ts.map +1 -1
- package/dist/services/ai/ai-provider-factory.js +4 -0
- package/dist/services/ai/generation-ledger.d.ts +16 -0
- package/dist/services/ai/generation-ledger.d.ts.map +1 -0
- package/dist/services/ai/generation-ledger.js +20 -0
- package/dist/services/ai/memory-provider-presets.d.ts +16 -0
- package/dist/services/ai/memory-provider-presets.d.ts.map +1 -0
- package/dist/services/ai/memory-provider-presets.js +51 -0
- package/dist/services/ai/opencode-provider.d.ts +11 -0
- package/dist/services/ai/opencode-provider.d.ts.map +1 -1
- package/dist/services/ai/opencode-provider.js +31 -2
- package/dist/services/ai/provider-config.d.ts.map +1 -1
- package/dist/services/ai/provider-config.js +5 -8
- package/dist/services/ai/providers/api-route.d.ts +2 -2
- package/dist/services/ai/providers/api-route.d.ts.map +1 -1
- package/dist/services/ai/providers/api-route.js +3 -2
- package/dist/services/ai/providers/atlas-cloud.d.ts +2 -2
- package/dist/services/ai/providers/atlas-cloud.d.ts.map +1 -1
- package/dist/services/ai/providers/atlas-cloud.js +3 -2
- package/dist/services/ai/providers/cheaper-inference.d.ts +2 -2
- package/dist/services/ai/providers/cheaper-inference.d.ts.map +1 -1
- package/dist/services/ai/providers/cheaper-inference.js +3 -2
- package/dist/services/ai/providers/cloudgpu.d.ts +2 -2
- package/dist/services/ai/providers/cloudgpu.d.ts.map +1 -1
- package/dist/services/ai/providers/cloudgpu.js +3 -2
- package/dist/services/ai/providers/orcarouter.d.ts +2 -2
- package/dist/services/ai/providers/orcarouter.d.ts.map +1 -1
- package/dist/services/ai/providers/orcarouter.js +3 -2
- package/dist/services/ai/providers/runcrate.d.ts +2 -2
- package/dist/services/ai/providers/runcrate.d.ts.map +1 -1
- package/dist/services/ai/providers/runcrate.js +3 -2
- package/dist/services/ai/providers/standardcompute.d.ts +54 -0
- package/dist/services/ai/providers/standardcompute.d.ts.map +1 -0
- package/dist/services/ai/providers/standardcompute.js +63 -0
- package/dist/services/ai/session/session-types.d.ts +1 -1
- package/dist/services/ai/session/session-types.d.ts.map +1 -1
- package/dist/services/auto-capture.d.ts.map +1 -1
- package/dist/services/auto-capture.js +18 -1
- package/dist/services/memory-recall.d.ts +9 -1
- package/dist/services/memory-recall.d.ts.map +1 -1
- package/dist/services/memory-recall.js +16 -1
- package/dist/services/memory-review.d.ts +74 -0
- package/dist/services/memory-review.d.ts.map +1 -0
- package/dist/services/memory-review.js +259 -0
- package/dist/services/migration-service.d.ts.map +1 -1
- package/dist/services/migration-service.js +15 -11
- package/dist/services/user-profile/user-profile-manager.d.ts +1 -0
- package/dist/services/user-profile/user-profile-manager.d.ts.map +1 -1
- package/dist/services/user-profile/user-profile-manager.js +23 -0
- package/dist/services/user-prompt/user-prompt-manager.d.ts +6 -0
- package/dist/services/user-prompt/user-prompt-manager.d.ts.map +1 -1
- package/dist/services/user-prompt/user-prompt-manager.js +15 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/v2/adapter.d.ts +7 -0
- package/dist/v2/adapter.d.ts.map +1 -1
- package/dist/v2/adapter.js +33 -2
- package/dist/v2/legacy-client.d.ts +1 -1
- package/dist/v2/legacy-client.d.ts.map +1 -1
- package/dist/v2/legacy-client.js +26 -4
- package/dist/v2/plugin.d.ts.map +1 -1
- package/dist/v2/plugin.js +2 -1
- package/dist/web/assets/index-Bc7-K6u-.css +2 -0
- package/dist/web/assets/index-h_HQTX3Y.js +112 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-mTgxOb5l.css +0 -2
- package/dist/web/assets/index-ysje17yK.js +0 -109
package/README.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
|
|
4
4
|
# OpenCode Memory
|
|
5
5
|
|
|
6
|
+
**BGE-M3 migration**
|
|
7
|
+
|
|
8
|
+
An experimental Japanese-memory calibration used the following local settings.
|
|
9
|
+
These are corpus-specific operating points, not universal model defaults.
|
|
10
|
+
|
|
11
|
+
```jsonc
|
|
12
|
+
{
|
|
13
|
+
"embeddingModel": "Xenova/bge-m3",
|
|
14
|
+
"embeddingDimensions": 1024,
|
|
15
|
+
"embeddingPooling": "cls",
|
|
16
|
+
"embeddingDtype": "q8",
|
|
17
|
+
"similarityThreshold": 0.375,
|
|
18
|
+
"chatMessage": { "maxMemories": 3, "similarityThreshold": 0.41 },
|
|
19
|
+
"updateOnCaptureSimilarityThreshold": 0.7,
|
|
20
|
+
"dreaming": { "relatedThreshold": 0.725 },
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Back up the store before changing models, then use the Web UI's **re-embed**
|
|
25
|
+
migration rather than a fresh start.
|
|
26
|
+
Migration detects model-name changes even at the same dimension, rebuilds
|
|
27
|
+
content/tag vectors and profile centroids, and preserves session links, pins,
|
|
28
|
+
and trash timestamps.
|
|
29
|
+
After switching models in an already-running host, restart the OpenCode service
|
|
30
|
+
once: the process-wide embedding singleton can otherwise retain the previous
|
|
31
|
+
model across a plugin reload, even when migration detection shows the new model.
|
|
32
|
+
The auto-injection cutoff was evaluated with a three-memory cap and usefulness
|
|
33
|
+
judgments.
|
|
34
|
+
The separate 0.375 explicit-search cutoff used a ten-memory cap and retained
|
|
35
|
+
430/451 retrievable known-source targets in 489 synthetic test queries.
|
|
36
|
+
This is source-target recall, not human usefulness precision, and does not
|
|
37
|
+
validate cross-project search.
|
|
38
|
+
Duplicate detection and profile matching still need separate calibration.
|
|
39
|
+
|
|
6
40
|
[](https://www.npmjs.com/package/@aislop-inc/opencode-mem)
|
|
7
41
|
[](https://www.npmjs.com/package/@aislop-inc/opencode-mem)
|
|
8
42
|
[](https://www.npmjs.com/package/@aislop-inc/opencode-mem)
|
|
@@ -232,6 +266,40 @@ Rule of thumb: lasting always-on project instructions → `AGENTS.md`; growing w
|
|
|
232
266
|
|
|
233
267
|
The web UI's **Stats** tab (at `/stats`) shows memory-system health at a glance: totals per scope, per-shard memory counts with stale/missing-shard warnings and a same-tag duplication proxy, the active user-profile version, and a 14-day activity series (captures, skipped captures, profile/compaction injections, and errors bucketed by message) parsed from the plugin's own structured logs in `~/.opencode-mem/`. It is read-only — `GET /api/stats` — and degrades per section if a database is unavailable, so it keeps reporting during incidents.
|
|
234
268
|
|
|
269
|
+
### Native V2 generation ledger
|
|
270
|
+
|
|
271
|
+
Optional model fallback for internal structured generation can be configured alongside the primary model:
|
|
272
|
+
|
|
273
|
+
```jsonc
|
|
274
|
+
{
|
|
275
|
+
"opencodeProvider": "claude-agent-sdk",
|
|
276
|
+
"opencodeModel": "claude-haiku-5-5",
|
|
277
|
+
"opencodeFallbackProvider": "inception",
|
|
278
|
+
"opencodeFallbackModel": "mercury-3",
|
|
279
|
+
"opencodeFallbackVariant": "high",
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
The configured primary model is tried first on each request.
|
|
284
|
+
If generation fails (including quota, connection, timeout, or invalid structured output), the fallback is tried once with its own variant.
|
|
285
|
+
This shared path covers auto-capture, profile learning, deduplication, and other internal structured generation.
|
|
286
|
+
The connectivity gate also permits the configured fallback when the primary provider is disconnected.
|
|
287
|
+
Unrelated models and successful primary requests are not redirected.
|
|
288
|
+
If both fail, the fallback error reaches the existing caller retry policy.
|
|
289
|
+
Native V2 ledger rows record each actual model attempt separately.
|
|
290
|
+
|
|
291
|
+
Native V2 internal generation calls append measurements to `<storagePath>/generation-ledger.jsonl`.
|
|
292
|
+
Each completed or rejected call records a unique request ID, start time, duration, requested model, success/error status, and UTF-8 input/output byte counts.
|
|
293
|
+
Prompts, generated memories, and provider error bodies are not stored.
|
|
294
|
+
These calls use the host's stateless Generate API, so their synthetic session IDs are not durable OpenCode sessions.
|
|
295
|
+
The host currently returns text only: token usage and cost are explicitly `null` with `usageStatus: "not_exposed_by_host"`, not zero or byte-derived estimates.
|
|
296
|
+
Success means the generation request resolved, not that subsequent JSON validation or memory storage succeeded.
|
|
297
|
+
Host-internal retries are not separate ledger rows; process termination can leave an in-flight call unrecorded.
|
|
298
|
+
The ledger is append-only and is not included in the existing Stats UI.
|
|
299
|
+
An unwritable ledger emits a warning without breaking memory capture.
|
|
300
|
+
When Claude SDK explicitly reports that a subscription quota has been exhausted, auto-capture defers the current batch without consuming the prompts' retry budgets.
|
|
301
|
+
Pending prompts remain eligible on a later idle event; ordinary transient failures keep their existing retry behavior.
|
|
302
|
+
|
|
235
303
|
### Intelligent prompt-based memory extraction
|
|
236
304
|
|
|
237
305
|
That phrase in the feature list is **auto-capture**: after a conversation, a background AI request summarizes technical work and saves it as memory. No special prompt from you is required. It uses `opencodeProvider` / `opencodeModel` when set, otherwise the manual `memoryProvider` fallback.
|
|
@@ -369,6 +437,38 @@ memories do not consume slots that could hold eligible memories. Setting
|
|
|
369
437
|
`chatMessage.maxMemories` to `0` disables project-memory injection while still allowing
|
|
370
438
|
the user profile to be injected when enabled.
|
|
371
439
|
|
|
440
|
+
#### Frozen snapshot and periodic review
|
|
441
|
+
|
|
442
|
+
`chatMessage.snapshot` (default `"frozen"`) builds the injected memory context once per
|
|
443
|
+
session and reuses it on later turns (it is rebuilt after compaction and in new sessions),
|
|
444
|
+
so the system-prompt prefix cache stays stable. Set `"live"` to restore the previous
|
|
445
|
+
per-turn relevance refresh (issue #460). When `"frozen"`, `injectOn`/`recall` only affect
|
|
446
|
+
how the snapshot is built. In `"live"` mode an unchanged recalled memory set (compared by
|
|
447
|
+
memory ID, ignoring order and score) reuses the previous text verbatim.
|
|
448
|
+
|
|
449
|
+
`chatMessage.injectAs` (V2, default `"system"`) chooses where the context goes. `"user"`
|
|
450
|
+
attaches it to the first user message of the conversation, so the system prompt never
|
|
451
|
+
changes (system-prompt changes restart some providers' sessions and defeat prefix caching)
|
|
452
|
+
and memories rank as reference material rather than instructions above the user's own.
|
|
453
|
+
|
|
454
|
+
`memoryReview` (opt-in) runs a Hermes-style background review: every `intervalTurns`
|
|
455
|
+
(default 10) authored user turns of a session, once the reply has finished, an LLM reads
|
|
456
|
+
the conversation and saves durable user/project facts, skipping near-duplicates.
|
|
457
|
+
Tool calls, internal capture sessions and child sessions are not counted. The review model
|
|
458
|
+
is set with `memoryReview.opencodeProvider` / `opencodeModel` / `opencodeVariant`; any unset
|
|
459
|
+
field falls back to the top-level `opencodeProvider` / `opencodeModel` / `opencodeVariant`,
|
|
460
|
+
and `opencodeModel: "inherit"` uses the session's model. `maxMemories` (default 5) caps
|
|
461
|
+
writes per review.
|
|
462
|
+
|
|
463
|
+
```jsonc
|
|
464
|
+
"memoryReview": {
|
|
465
|
+
"enabled": true,
|
|
466
|
+
"intervalTurns": 10,
|
|
467
|
+
"opencodeProvider": "anthropic",
|
|
468
|
+
"opencodeModel": "claude-haiku-4-5-20251001"
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
372
472
|
Injected memory tags identify `selection="recent"` or `selection="semantic"`.
|
|
373
473
|
Recent selections (including fallback and recent fill in `both`) have no
|
|
374
474
|
numeric score. Semantic selections carry a finite `retrieval_score` when available;
|
|
@@ -698,6 +798,12 @@ Manual `memoryProvider` modes:
|
|
|
698
798
|
"memoryApiKey": "env://CLOUDGPU_API_KEY",
|
|
699
799
|
```
|
|
700
800
|
When this provider is selected, auto-capture / profile prompts, model responses, and relevant conversation context are transmitted to `https://cloudgpu.app`.
|
|
801
|
+
- `standardcompute`: OpenAI-compatible Chat Completions preset for [Standard Compute](https://standardcompute.com). `memoryApiUrl` and `memoryModel` are optional — they default to `https://api.stdcmpt.com/v1` and `StandardCompute`. If `memoryApiKey` is omitted, `STANDARDCOMPUTE_API_KEY` from the environment is used (create a key at https://standardcompute.com/dashboard; API docs: https://docs.standardcompute.com). Example:
|
|
802
|
+
```jsonc
|
|
803
|
+
"memoryProvider": "standardcompute",
|
|
804
|
+
"memoryApiKey": "env://STANDARDCOMPUTE_API_KEY",
|
|
805
|
+
```
|
|
806
|
+
When this provider is selected, auto-capture / profile prompts, model responses, and relevant conversation context are transmitted to `https://api.stdcmpt.com`.
|
|
701
807
|
|
|
702
808
|
Troubleshooting:
|
|
703
809
|
|
|
@@ -741,7 +847,7 @@ Troubleshooting:
|
|
|
741
847
|
- If auto-capture reports that a provider is not connected, confirm the provider name with `opencode providers list` and configure that provider in opencode first.
|
|
742
848
|
- If a proxy or custom provider returns plain text instead of structured/tool output, choose another model/provider or use one of the manual provider modes above.
|
|
743
849
|
- For models that reject `temperature`, add `"memoryTemperature": false` when using manual API configuration.
|
|
744
|
-
- For models that reject forced tool calls (`tool_choice: "required"`, e.g. some thinking modes), add `"forceToolChoice": false` when using `openai-chat` / `orcarouter` / `atlas-cloud` / `cheaper-inference` / `api-route` / `runcrate` / `cloudgpu`.
|
|
850
|
+
- For models that reject forced tool calls (`tool_choice: "required"`, e.g. some thinking modes), add `"forceToolChoice": false` when using `openai-chat` / `orcarouter` / `atlas-cloud` / `cheaper-inference` / `api-route` / `runcrate` / `cloudgpu` / `standardcompute`.
|
|
745
851
|
- For `opencodeProvider` / `opencodeModel` (e.g. DeepSeek V4 thinking), OpenCode still sends forced `tool_choice` for structured output. opencode-mem disables thinking on the internal `opencode-mem-structured` agent (and re-applies that in `chat.params` after variant merge) so auto-capture and profile learning can complete. Your interactive chat agent is unchanged. If capture still fails with a thinking/`tool_choice` error, pick a non-thinking model for `opencodeModel` or configure a complete manual fallback (`memoryModel` + `memoryApiUrl`).
|
|
746
852
|
- **`opencode-claude-auth` / Claude Code:** auto-capture uses OpenCode with your authenticated `anthropic` provider. Forced `format: json_schema` often loops with Claude-auth, so opencode-mem uses an auth-preserving **text-JSON** path for `opencodeProvider: "anthropic"` (no forced `StructuredOutput` tools; reply is parsed with Zod). A step watchdog still aborts runaway internal sessions after 2 steps. If capture still fails, configure a complete manual Anthropic API-key fallback (`memoryProvider: "anthropic"` + `memoryModel` + `memoryApiUrl` + `memoryApiKey`) — Claude Pro/Max OAuth cannot be reused outside OpenCode.
|
|
747
853
|
- **Unsupported platforms:** Intel Mac (`darwin/x64`) is not supported — `@tursodatabase/database` and fixed `onnxruntime-node` releases (pinned `1.31.1`) ship no x64 native binding. Use Apple Silicon, Linux, or Windows, or a remote embedding endpoint via `embeddingApiUrl` + `embeddingApiKey`. MLX is not supported.
|
package/dist/config.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ interface OpenCodeMemConfig {
|
|
|
80
80
|
* host session API is busy; failed primary channel falls back to the other.
|
|
81
81
|
*/
|
|
82
82
|
autoCaptureProviderOrder?: "opencode-first" | "external-first";
|
|
83
|
-
memoryProvider?: "atlas-cloud" | "api-route" | "cheaper-inference" | "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "runcrate" | "cloudgpu";
|
|
83
|
+
memoryProvider?: "atlas-cloud" | "api-route" | "cheaper-inference" | "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "runcrate" | "cloudgpu" | "standardcompute";
|
|
84
84
|
memoryModel?: string;
|
|
85
85
|
memoryApiUrl?: string;
|
|
86
86
|
memoryApiKey?: string;
|
|
@@ -101,6 +101,9 @@ interface OpenCodeMemConfig {
|
|
|
101
101
|
* cheaper/faster/higher variant than the interactive session default.
|
|
102
102
|
*/
|
|
103
103
|
opencodeVariant?: string;
|
|
104
|
+
opencodeFallbackProvider?: string;
|
|
105
|
+
opencodeFallbackModel?: string;
|
|
106
|
+
opencodeFallbackVariant?: string;
|
|
104
107
|
/**
|
|
105
108
|
* Timeout in milliseconds for the plugin's internal structured-output LLM
|
|
106
109
|
* calls (auto-capture summaries, profile learning). Profile cleanup keeps
|
|
@@ -192,6 +195,22 @@ interface OpenCodeMemConfig {
|
|
|
192
195
|
excludeCurrentSession?: boolean;
|
|
193
196
|
maxAgeDays?: number;
|
|
194
197
|
injectOn?: "first" | "always";
|
|
198
|
+
/**
|
|
199
|
+
* Session memory snapshot behaviour.
|
|
200
|
+
* - frozen: build the injected memory context once per session (and again
|
|
201
|
+
* after compaction / a new session) and reuse the same text, keeping the
|
|
202
|
+
* system-prompt prefix cache stable (Hermes-style). Default.
|
|
203
|
+
* - live: legacy behaviour; relevant/both recall re-runs on every user turn.
|
|
204
|
+
*/
|
|
205
|
+
snapshot?: "frozen" | "live";
|
|
206
|
+
/**
|
|
207
|
+
* Where the V2 adapter puts the memory context.
|
|
208
|
+
* - system: appended to the system prompt (default, legacy)
|
|
209
|
+
* - user: attached to the first user message of the conversation, so the
|
|
210
|
+
* system prompt never changes and memories rank as reference material,
|
|
211
|
+
* not as instructions above the user's own.
|
|
212
|
+
*/
|
|
213
|
+
injectAs?: "system" | "user";
|
|
195
214
|
/**
|
|
196
215
|
* How auto-injected memories are selected.
|
|
197
216
|
* - recent: newest pinned/recency listing (legacy)
|
|
@@ -215,6 +234,27 @@ interface OpenCodeMemConfig {
|
|
|
215
234
|
*/
|
|
216
235
|
captureChildSessions?: boolean;
|
|
217
236
|
};
|
|
237
|
+
/**
|
|
238
|
+
* Opt-in periodic memory review (Hermes-style). Every `intervalTurns` authored
|
|
239
|
+
* user turns of a session, once the reply has finished, a background LLM job
|
|
240
|
+
* reads the conversation and saves durable facts (deduplicated against
|
|
241
|
+
* existing memories).
|
|
242
|
+
*/
|
|
243
|
+
memoryReview?: {
|
|
244
|
+
enabled?: boolean;
|
|
245
|
+
/** Authored user turns between reviews. Default 10 (clamped 1..1000). */
|
|
246
|
+
intervalTurns?: number;
|
|
247
|
+
/**
|
|
248
|
+
* Summary/review model. Falls back to the top-level opencodeProvider /
|
|
249
|
+
* opencodeModel / opencodeVariant when unset. opencodeModel "inherit"
|
|
250
|
+
* uses the session's current model.
|
|
251
|
+
*/
|
|
252
|
+
opencodeProvider?: string;
|
|
253
|
+
opencodeModel?: string;
|
|
254
|
+
opencodeVariant?: string;
|
|
255
|
+
/** Max memories one review may write. Default 5 (clamped 1..20). */
|
|
256
|
+
maxMemories?: number;
|
|
257
|
+
};
|
|
218
258
|
/**
|
|
219
259
|
* Opt-in background memory consolidation ("dreaming"): merge near-duplicate
|
|
220
260
|
* memories via the configured LLM and soft-delete superseded rows into trash.
|
|
@@ -333,7 +373,7 @@ declare function buildConfig(fileConfig: OpenCodeMemConfig): {
|
|
|
333
373
|
updateOnCaptureEnabled: boolean;
|
|
334
374
|
updateOnCaptureSimilarityThreshold: number;
|
|
335
375
|
updateOnCaptureMaxCandidates: number;
|
|
336
|
-
memoryProvider: "
|
|
376
|
+
memoryProvider: "orcarouter" | "atlas-cloud" | "cheaper-inference" | "api-route" | "runcrate" | "cloudgpu" | "standardcompute" | "openai-chat" | "openai-responses" | "anthropic" | "minimax";
|
|
337
377
|
memoryModel: string | undefined;
|
|
338
378
|
memoryApiUrl: string | undefined;
|
|
339
379
|
memoryApiKey: string | undefined;
|
|
@@ -343,6 +383,9 @@ declare function buildConfig(fileConfig: OpenCodeMemConfig): {
|
|
|
343
383
|
opencodeProvider: string | undefined;
|
|
344
384
|
opencodeModel: string | undefined;
|
|
345
385
|
opencodeVariant: string | undefined;
|
|
386
|
+
opencodeFallbackProvider: string | undefined;
|
|
387
|
+
opencodeFallbackModel: string | undefined;
|
|
388
|
+
opencodeFallbackVariant: string | undefined;
|
|
346
389
|
opencodeTimeoutMs: number;
|
|
347
390
|
autoCaptureProviderStatus: AutoCaptureProviderStatus;
|
|
348
391
|
aiSessionRetentionDays: number;
|
|
@@ -409,6 +452,8 @@ declare function buildConfig(fileConfig: OpenCodeMemConfig): {
|
|
|
409
452
|
excludeCurrentSession: boolean | undefined;
|
|
410
453
|
maxAgeDays: number | undefined;
|
|
411
454
|
injectOn: "first" | "always";
|
|
455
|
+
snapshot: "frozen" | "live";
|
|
456
|
+
injectAs: "system" | "user";
|
|
412
457
|
recall: "recent" | "relevant" | "both";
|
|
413
458
|
recallScope: "project" | "all-projects" | "default";
|
|
414
459
|
similarityThreshold: number | undefined;
|
|
@@ -416,6 +461,14 @@ declare function buildConfig(fileConfig: OpenCodeMemConfig): {
|
|
|
416
461
|
injectionMarkers: string[];
|
|
417
462
|
captureChildSessions: boolean | undefined;
|
|
418
463
|
};
|
|
464
|
+
memoryReview: {
|
|
465
|
+
enabled: boolean | undefined;
|
|
466
|
+
intervalTurns: number;
|
|
467
|
+
maxMemories: number;
|
|
468
|
+
opencodeProvider: string | undefined;
|
|
469
|
+
opencodeModel: string | undefined;
|
|
470
|
+
opencodeVariant: string | undefined;
|
|
471
|
+
};
|
|
419
472
|
dreaming: {
|
|
420
473
|
enabled: boolean | undefined;
|
|
421
474
|
intervalHours: number;
|
|
@@ -460,7 +513,7 @@ export declare let CONFIG: {
|
|
|
460
513
|
updateOnCaptureEnabled: boolean;
|
|
461
514
|
updateOnCaptureSimilarityThreshold: number;
|
|
462
515
|
updateOnCaptureMaxCandidates: number;
|
|
463
|
-
memoryProvider: "
|
|
516
|
+
memoryProvider: "orcarouter" | "atlas-cloud" | "cheaper-inference" | "api-route" | "runcrate" | "cloudgpu" | "standardcompute" | "openai-chat" | "openai-responses" | "anthropic" | "minimax";
|
|
464
517
|
memoryModel: string | undefined;
|
|
465
518
|
memoryApiUrl: string | undefined;
|
|
466
519
|
memoryApiKey: string | undefined;
|
|
@@ -470,6 +523,9 @@ export declare let CONFIG: {
|
|
|
470
523
|
opencodeProvider: string | undefined;
|
|
471
524
|
opencodeModel: string | undefined;
|
|
472
525
|
opencodeVariant: string | undefined;
|
|
526
|
+
opencodeFallbackProvider: string | undefined;
|
|
527
|
+
opencodeFallbackModel: string | undefined;
|
|
528
|
+
opencodeFallbackVariant: string | undefined;
|
|
473
529
|
opencodeTimeoutMs: number;
|
|
474
530
|
autoCaptureProviderStatus: AutoCaptureProviderStatus;
|
|
475
531
|
aiSessionRetentionDays: number;
|
|
@@ -536,6 +592,8 @@ export declare let CONFIG: {
|
|
|
536
592
|
excludeCurrentSession: boolean | undefined;
|
|
537
593
|
maxAgeDays: number | undefined;
|
|
538
594
|
injectOn: "first" | "always";
|
|
595
|
+
snapshot: "frozen" | "live";
|
|
596
|
+
injectAs: "system" | "user";
|
|
539
597
|
recall: "recent" | "relevant" | "both";
|
|
540
598
|
recallScope: "project" | "all-projects" | "default";
|
|
541
599
|
similarityThreshold: number | undefined;
|
|
@@ -543,6 +601,14 @@ export declare let CONFIG: {
|
|
|
543
601
|
injectionMarkers: string[];
|
|
544
602
|
captureChildSessions: boolean | undefined;
|
|
545
603
|
};
|
|
604
|
+
memoryReview: {
|
|
605
|
+
enabled: boolean | undefined;
|
|
606
|
+
intervalTurns: number;
|
|
607
|
+
maxMemories: number;
|
|
608
|
+
opencodeProvider: string | undefined;
|
|
609
|
+
opencodeModel: string | undefined;
|
|
610
|
+
opencodeVariant: string | undefined;
|
|
611
|
+
};
|
|
546
612
|
dreaming: {
|
|
547
613
|
enabled: boolean | undefined;
|
|
548
614
|
intervalHours: number;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAsB3E,UAAU,iBAAiB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE;QACP,YAAY,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;KAC3C,CAAC;IACF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js
CHANGED
|
@@ -4,6 +4,7 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import { stripJsoncComments } from "./services/jsonc.js";
|
|
5
5
|
import { resolveSecretValue } from "./services/secret-resolver.js";
|
|
6
6
|
import { isPlaceholderApiKey } from "./services/ai/api-key-placeholder.js";
|
|
7
|
+
import { isMemoryProviderPreset, resolveMemoryProviderPresetDefaults, } from "./services/ai/memory-provider-presets.js";
|
|
7
8
|
import { getDefaultInjectionMarkers } from "./services/injected-prompt-filter.js";
|
|
8
9
|
const CONFIG_DIR = join(homedir(), ".config", "opencode");
|
|
9
10
|
const DATA_DIR = join(homedir(), ".opencode-mem");
|
|
@@ -92,6 +93,8 @@ const DEFAULTS = {
|
|
|
92
93
|
excludeCurrentSession: true,
|
|
93
94
|
maxAgeDays: undefined,
|
|
94
95
|
injectOn: "first",
|
|
96
|
+
snapshot: "frozen",
|
|
97
|
+
injectAs: "system",
|
|
95
98
|
recall: "relevant",
|
|
96
99
|
recallScope: "default",
|
|
97
100
|
similarityThreshold: undefined,
|
|
@@ -99,6 +102,11 @@ const DEFAULTS = {
|
|
|
99
102
|
injectionMarkers: [...getDefaultInjectionMarkers()],
|
|
100
103
|
captureChildSessions: false,
|
|
101
104
|
},
|
|
105
|
+
memoryReview: {
|
|
106
|
+
enabled: false,
|
|
107
|
+
intervalTurns: 10,
|
|
108
|
+
maxMemories: 5,
|
|
109
|
+
},
|
|
102
110
|
dreaming: {
|
|
103
111
|
enabled: false,
|
|
104
112
|
intervalHours: 24,
|
|
@@ -117,6 +125,12 @@ function expandPath(path) {
|
|
|
117
125
|
}
|
|
118
126
|
return path;
|
|
119
127
|
}
|
|
128
|
+
function clampInt(value, min, max, fallback) {
|
|
129
|
+
const n = typeof value === "string" && value.trim() ? Number(value) : value;
|
|
130
|
+
if (typeof n !== "number" || !Number.isFinite(n))
|
|
131
|
+
return fallback;
|
|
132
|
+
return Math.min(max, Math.max(min, Math.floor(n)));
|
|
133
|
+
}
|
|
120
134
|
function normalizeMemoryBackend(value) {
|
|
121
135
|
if (value === "markdown")
|
|
122
136
|
return "markdown";
|
|
@@ -291,6 +305,9 @@ const CONFIG_TEMPLATE = `{
|
|
|
291
305
|
// Optional model reasoning variant for internal LLM calls (e.g. "xhigh");
|
|
292
306
|
// also applies when opencodeModel is "inherit":
|
|
293
307
|
// "opencodeVariant": "xhigh",
|
|
308
|
+
// "opencodeFallbackProvider": "inception",
|
|
309
|
+
// "opencodeFallbackModel": "mercury-3",
|
|
310
|
+
// "opencodeFallbackVariant": "high",
|
|
294
311
|
// Optional timeout in milliseconds for the plugin's internal structured-output LLM calls
|
|
295
312
|
// (auto-capture summaries, profile learning; default 90000, clamped to 10000..600000;
|
|
296
313
|
// invalid values fall back to the default; numeric strings are coerced):
|
|
@@ -315,7 +332,7 @@ const CONFIG_TEMPLATE = `{
|
|
|
315
332
|
// "updateOnCaptureSimilarityThreshold": 0.75,
|
|
316
333
|
// "updateOnCaptureMaxCandidates": 5,
|
|
317
334
|
|
|
318
|
-
// Provider type: "api-route" | "atlas-cloud" | "cheaper-inference" | "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "runcrate" | "cloudgpu"
|
|
335
|
+
// Provider type: "api-route" | "atlas-cloud" | "cheaper-inference" | "openai-chat" | "openai-responses" | "anthropic" | "minimax" | "orcarouter" | "runcrate" | "cloudgpu" | "standardcompute"
|
|
319
336
|
// Note: "openai-chat" is a generic OpenAI API-compatible mode.
|
|
320
337
|
// Any service that follows the OpenAI Chat Completions API can use it via custom "memoryApiUrl".
|
|
321
338
|
"memoryProvider": "openai-chat",
|
|
@@ -425,6 +442,16 @@ const CONFIG_TEMPLATE = `{
|
|
|
425
442
|
// // conversation context are sent to cloudgpu.app.
|
|
426
443
|
// // "memoryModel": "deepseek-v4.1-flash"
|
|
427
444
|
|
|
445
|
+
// Standard Compute (OpenAI-compatible Chat Completions preset, with session support):
|
|
446
|
+
// "memoryProvider": "standardcompute"
|
|
447
|
+
// "memoryApiKey": "env://STANDARDCOMPUTE_API_KEY"
|
|
448
|
+
// // memoryApiUrl and memoryModel are optional — they default to
|
|
449
|
+
// // https://api.stdcmpt.com/v1 and "StandardCompute".
|
|
450
|
+
// // Create a key at https://standardcompute.com/dashboard (docs: https://docs.standardcompute.com).
|
|
451
|
+
// // When selected, auto-capture/profile prompts, responses, and relevant
|
|
452
|
+
// // conversation context are sent to api.stdcmpt.com.
|
|
453
|
+
// // "memoryModel": "StandardCompute"
|
|
454
|
+
|
|
428
455
|
// Groq (OpenAI-compatible, use openai-chat provider):
|
|
429
456
|
// "memoryProvider": "openai-chat"
|
|
430
457
|
// "memoryModel": "llama-3.3-70b-versatile"
|
|
@@ -460,7 +487,7 @@ const CONFIG_TEMPLATE = `{
|
|
|
460
487
|
// Set to false and add "memoryTemperature": false in config when using such models
|
|
461
488
|
"memoryTemperature": 0.3,
|
|
462
489
|
|
|
463
|
-
// Force tool calls on openai-chat / orcarouter / atlas-cloud / cheaper-inference / api-route / runcrate / cloudgpu (tool_choice: "required"). Default true.
|
|
490
|
+
// Force tool calls on openai-chat / orcarouter / atlas-cloud / cheaper-inference / api-route / runcrate / cloudgpu / standardcompute (tool_choice: "required"). Default true.
|
|
464
491
|
// Some thinking/reasoning models reject forced tool choice — set false to fall back to "auto":
|
|
465
492
|
// "forceToolChoice": false,
|
|
466
493
|
|
|
@@ -598,13 +625,31 @@ const CONFIG_TEMPLATE = `{
|
|
|
598
625
|
// by the parent agent, not by you, so default false means they are not
|
|
599
626
|
// stored, auto-captured, used for profile learning, or given memory
|
|
600
627
|
// context. Enable only if you deliberately want those prompts memorized.
|
|
601
|
-
"captureChildSessions": false
|
|
628
|
+
"captureChildSessions": false,
|
|
629
|
+
|
|
630
|
+
// "frozen" (default): build the memory context once per session and reuse it
|
|
631
|
+
// on later turns (stable prompt prefix, Hermes-style). "live": relevant/both
|
|
632
|
+
// recall re-runs on every user turn.
|
|
633
|
+
"snapshot": "frozen"
|
|
602
634
|
|
|
603
635
|
// Extra markers identifying injected blocks. These are ADDED to the
|
|
604
636
|
// built-in list, never replace it.
|
|
605
637
|
// "injectionMarkers": ["<my-plugin-banner>"]
|
|
606
638
|
},
|
|
607
639
|
|
|
640
|
+
// Opt-in periodic memory review: every intervalTurns authored user turns, after
|
|
641
|
+
// the reply finishes, a background LLM reads the session and saves durable facts.
|
|
642
|
+
// The summary/review model is set here; unset fields fall back to the top-level
|
|
643
|
+
// opencodeProvider / opencodeModel / opencodeVariant.
|
|
644
|
+
"memoryReview": {
|
|
645
|
+
"enabled": false,
|
|
646
|
+
"intervalTurns": 10,
|
|
647
|
+
"maxMemories": 5
|
|
648
|
+
// "opencodeProvider": "anthropic",
|
|
649
|
+
// "opencodeModel": "claude-haiku-4-5-20251001", // or "inherit"
|
|
650
|
+
// "opencodeVariant": "high"
|
|
651
|
+
},
|
|
652
|
+
|
|
608
653
|
// Opt-in background consolidation: merge/update/supersede related memories
|
|
609
654
|
// via the configured LLM and soft-delete superseded rows into trash.
|
|
610
655
|
// "enabled" gates only the scheduler; the Dream button / POST /api/dreaming/run
|
|
@@ -891,7 +936,17 @@ function buildConfig(fileConfig) {
|
|
|
891
936
|
? process.env.RUNCRATE_API_KEY
|
|
892
937
|
: memoryProvider === "cloudgpu"
|
|
893
938
|
? process.env.CLOUDGPU_API_KEY
|
|
894
|
-
:
|
|
939
|
+
: memoryProvider === "standardcompute"
|
|
940
|
+
? process.env.STANDARDCOMPUTE_API_KEY
|
|
941
|
+
: undefined);
|
|
942
|
+
// Preset providers advertise optional memoryModel / memoryApiUrl in docs and
|
|
943
|
+
// factory code, but auto-capture / dreaming / profile learning gate on the
|
|
944
|
+
// resolved CONFIG fields. Fill preset defaults here so key-only configs work.
|
|
945
|
+
const presetDefaults = resolveMemoryProviderPresetDefaults(memoryProvider);
|
|
946
|
+
const memoryModel = (typeof fileConfig.memoryModel === "string" ? fileConfig.memoryModel.trim() : "") ||
|
|
947
|
+
presetDefaults?.model;
|
|
948
|
+
const memoryApiUrl = (typeof fileConfig.memoryApiUrl === "string" ? fileConfig.memoryApiUrl.trim() : "") ||
|
|
949
|
+
presetDefaults?.apiUrl;
|
|
895
950
|
const embeddingModel = fileConfig.embeddingModel ?? DEFAULTS.embeddingModel;
|
|
896
951
|
const embeddingPreset = getEmbeddingModelPreset(embeddingModel);
|
|
897
952
|
const embeddingDimensions = fileConfig.embeddingDimensions ?? getEmbeddingDimensions(embeddingModel);
|
|
@@ -958,8 +1013,8 @@ function buildConfig(fileConfig) {
|
|
|
958
1013
|
updateOnCaptureSimilarityThreshold: normalizeSimilarityUnitInterval(fileConfig.updateOnCaptureSimilarityThreshold, DEFAULTS.updateOnCaptureSimilarityThreshold),
|
|
959
1014
|
updateOnCaptureMaxCandidates: normalizeUpdateOnCaptureMaxCandidates(fileConfig.updateOnCaptureMaxCandidates),
|
|
960
1015
|
memoryProvider,
|
|
961
|
-
memoryModel
|
|
962
|
-
memoryApiUrl
|
|
1016
|
+
memoryModel,
|
|
1017
|
+
memoryApiUrl,
|
|
963
1018
|
memoryApiKey,
|
|
964
1019
|
memoryTemperature: fileConfig.memoryTemperature,
|
|
965
1020
|
forceToolChoice: fileConfig.forceToolChoice,
|
|
@@ -967,13 +1022,16 @@ function buildConfig(fileConfig) {
|
|
|
967
1022
|
opencodeProvider: fileConfig.opencodeProvider,
|
|
968
1023
|
opencodeModel: fileConfig.opencodeModel,
|
|
969
1024
|
opencodeVariant: normalizeOpencodeVariant(fileConfig.opencodeVariant),
|
|
1025
|
+
opencodeFallbackProvider: normalizeOpencodeVariant(fileConfig.opencodeFallbackProvider),
|
|
1026
|
+
opencodeFallbackModel: normalizeOpencodeVariant(fileConfig.opencodeFallbackModel),
|
|
1027
|
+
opencodeFallbackVariant: normalizeOpencodeVariant(fileConfig.opencodeFallbackVariant),
|
|
970
1028
|
opencodeTimeoutMs: normalizeOpencodeTimeoutMs(fileConfig.opencodeTimeoutMs),
|
|
971
1029
|
autoCaptureProviderStatus: getAutoCaptureProviderStatus({
|
|
972
1030
|
opencodeProvider: fileConfig.opencodeProvider,
|
|
973
1031
|
opencodeModel: fileConfig.opencodeModel,
|
|
974
1032
|
memoryProvider,
|
|
975
|
-
memoryModel
|
|
976
|
-
memoryApiUrl
|
|
1033
|
+
memoryModel,
|
|
1034
|
+
memoryApiUrl,
|
|
977
1035
|
memoryApiKey,
|
|
978
1036
|
}),
|
|
979
1037
|
aiSessionRetentionDays: fileConfig.aiSessionRetentionDays ?? DEFAULTS.aiSessionRetentionDays,
|
|
@@ -1048,6 +1106,8 @@ function buildConfig(fileConfig) {
|
|
|
1048
1106
|
excludeCurrentSession: fileConfig.chatMessage?.excludeCurrentSession ?? DEFAULTS.chatMessage.excludeCurrentSession,
|
|
1049
1107
|
maxAgeDays: fileConfig.chatMessage?.maxAgeDays,
|
|
1050
1108
|
injectOn: (fileConfig.chatMessage?.injectOn ?? DEFAULTS.chatMessage.injectOn),
|
|
1109
|
+
snapshot: (fileConfig.chatMessage?.snapshot === "live" ? "live" : "frozen"),
|
|
1110
|
+
injectAs: (fileConfig.chatMessage?.injectAs === "user" ? "user" : "system"),
|
|
1051
1111
|
recall: normalizeChatMessageRecall(fileConfig.chatMessage?.recall),
|
|
1052
1112
|
recallScope: normalizeChatMessageRecallScope(fileConfig.chatMessage?.recallScope),
|
|
1053
1113
|
similarityThreshold: typeof fileConfig.chatMessage?.similarityThreshold === "number" &&
|
|
@@ -1058,6 +1118,14 @@ function buildConfig(fileConfig) {
|
|
|
1058
1118
|
injectionMarkers: normalizeInjectionMarkers(fileConfig.chatMessage?.injectionMarkers),
|
|
1059
1119
|
captureChildSessions: fileConfig.chatMessage?.captureChildSessions ?? DEFAULTS.chatMessage.captureChildSessions,
|
|
1060
1120
|
},
|
|
1121
|
+
memoryReview: {
|
|
1122
|
+
enabled: fileConfig.memoryReview?.enabled ?? DEFAULTS.memoryReview.enabled,
|
|
1123
|
+
intervalTurns: clampInt(fileConfig.memoryReview?.intervalTurns, 1, 1000, DEFAULTS.memoryReview.intervalTurns ?? 10),
|
|
1124
|
+
maxMemories: clampInt(fileConfig.memoryReview?.maxMemories, 1, 20, DEFAULTS.memoryReview.maxMemories ?? 5),
|
|
1125
|
+
opencodeProvider: normalizeOpencodeVariant(fileConfig.memoryReview?.opencodeProvider),
|
|
1126
|
+
opencodeModel: normalizeOpencodeVariant(fileConfig.memoryReview?.opencodeModel),
|
|
1127
|
+
opencodeVariant: normalizeOpencodeVariant(fileConfig.memoryReview?.opencodeVariant),
|
|
1128
|
+
},
|
|
1061
1129
|
dreaming: {
|
|
1062
1130
|
enabled: fileConfig.dreaming?.enabled ?? DEFAULTS.dreaming.enabled,
|
|
1063
1131
|
intervalHours: normalizeDreamingIntervalHours(fileConfig.dreaming?.intervalHours),
|
|
@@ -1089,14 +1157,10 @@ export function getAutoCaptureProviderStatus(config) {
|
|
|
1089
1157
|
const hasMemoryApiUrl = hasValue(config.memoryApiUrl);
|
|
1090
1158
|
const hasMemoryApiKey = hasValue(config.memoryApiKey);
|
|
1091
1159
|
const hasPlaceholderMemoryApiKey = isPlaceholderApiKey(config.memoryApiKey);
|
|
1092
|
-
// Preset providers fill endpoint/model themselves
|
|
1093
|
-
// required for the manual
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
config.memoryProvider === "cheaper-inference" ||
|
|
1097
|
-
config.memoryProvider === "api-route" ||
|
|
1098
|
-
config.memoryProvider === "runcrate" ||
|
|
1099
|
-
config.memoryProvider === "cloudgpu") {
|
|
1160
|
+
// Preset providers fill endpoint/model themselves (and buildConfig resolves
|
|
1161
|
+
// those defaults into CONFIG), so only an API key is required for the manual
|
|
1162
|
+
// fallback path.
|
|
1163
|
+
if (isMemoryProviderPreset(config.memoryProvider)) {
|
|
1100
1164
|
if (!hasMemoryApiKey)
|
|
1101
1165
|
issues.push("memoryApiKey is not configured");
|
|
1102
1166
|
if (hasPlaceholderMemoryApiKey)
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","source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