@bd7pil/opencode-deep-memory 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -177,58 +177,38 @@ npm run verify # typecheck + test (363) + build + smoke (49)
177
177
 
178
178
  ## Acknowledgments
179
179
 
180
- **[MiMo-Code][]** — a terminal-native AI coding assistant with persistent memory that keeps a
181
- deep understanding of your project across sessions while continuously improving itself.
180
+ **[DCP][]** — Dynamic Context Pruning for OpenCode. Tool dedup, error purge, and nudge system.
182
181
 
183
- **[Magic Context][]** — unbounded context. Memory that manages itself. One session, for life.
184
- The hippocampus for coding agents, part of CortexKit.
182
+ **[Headroom][]** — JSON array crush and CCR (Compress-Cache-Retrieve).
185
183
 
186
- **[Aider][]** — AI pair programming in your terminal. Lets you pair program with LLMs to start
187
- a new project or build on your existing codebase.
184
+ **[Edgee][]** — Per-tool compression strategies (read, bash, grep, glob).
188
185
 
189
- **[Roo Code][]** — a whole dev team of AI agents in your code editor.
186
+ **[Contextomizer][]** — Content type detection pipeline.
190
187
 
191
- **[Continue][]** — pioneering open-source coding agent, available as a CLI, VS Code extension,
192
- and JetBrains plugin.
188
+ **[Focus Agent][]** — Absolute token thresholds and assistant text compression research.
193
189
 
194
- **[OpenHands][]** — Code Less, Make More. A community focused on AI-driven development.
190
+ **[LLMLingua][]** — Selective compression: preserve structure, compress prose.
195
191
 
196
- **[Plandex][]** — an AI coding agent designed for large tasks and real world projects.
192
+ **[Codex CLI][]** — Handoff prefix pattern for compaction continuity.
197
193
 
198
- **[DCP][]** — Dynamic Context Pruning for OpenCode. Our tool deduplication, error purging,
199
- and nudge system are inspired by DCP's architecture.
194
+ **[Google ADK][]** — Append-only event compaction architecture.
200
195
 
201
- **[Headroom][]** — compress tool outputs, logs, files, RAG chunks for AI agents.
202
- Our JSON array crush and CCR (Compress-Cache-Retrieve) are derived from Headroom's SmartCrusher.
196
+ **[Hermes][]** — 8-section structured compaction prompt design.
203
197
 
204
- **[Edgee][]** — agent gateway that compresses tokens before LLM providers.
205
- Our per-tool compression strategies (read, bash, grep, glob) are inspired by Edgee's approach.
198
+ **[MiMo-Code][]** — Terminal-native AI coding assistant with persistent memory.
206
199
 
207
- **[Contextomizer][]** — ultra-fast deterministic library for transforming bloated tool outputs.
208
- Our content type detection pipeline is inspired by Contextomizer's approach.
200
+ **[Magic Context][]** — Unbounded context for coding agents.
209
201
 
210
- **[Focus Agent][]** — autonomous memory management for coding agents.
211
- Our absolute token thresholds and assistant text compression strategy are based on Focus Agent's research.
202
+ **[Aider][]** — AI pair programming in your terminal.
212
203
 
213
- **[LLMLingua][]** — prompt compression for LLMs.
214
- Our selective assistant text compression (preserve structure, compress prose) is inspired by LLMLingua's approach.
204
+ **[Roo Code][]** — A whole dev team of AI agents in your code editor.
215
205
 
216
- **[Codex CLI][]** — OpenAI's coding agent.
217
- Our handoff prefix pattern (telling the LLM it's resuming a prior task) is based on Codex CLI's compaction protocol.
206
+ **[Continue][]** — Pioneering open-source coding agent.
218
207
 
219
- **[Google ADK][]** — Agent Development Kit with append-only event compaction.
220
- Our structured compaction prompt (Hermes-8 sections) is inspired by ADK's compaction architecture.
208
+ **[OpenHands][]** — Code Less, Make More.
221
209
 
222
- **[Hermes][]** — production-grade compaction prompt design.
223
- Our 8-section checkpoint template follows Hermes's structured summary format.
210
+ **[Plandex][]** — AI coding agent for large tasks and real world projects.
224
211
 
225
- [MiMo-Code]: https://github.com/XiaomiMiMo/MiMo-Code
226
- [Magic Context]: https://github.com/cortexkit/magic-context
227
- [Aider]: https://github.com/Aider-AI/aider
228
- [Roo Code]: https://github.com/RooCodeInc/Roo-Code
229
- [Continue]: https://github.com/continuedev/continue
230
- [OpenHands]: https://github.com/All-Hands-AI/OpenHands
231
- [Plandex]: https://github.com/plandex-ai/plandex
232
212
  [DCP]: https://github.com/Opencode-DCP/opencode-dynamic-context-pruning
233
213
  [Headroom]: https://github.com/chopratejas/headroom
234
214
  [Edgee]: https://github.com/edgee-ai/edgee
@@ -238,6 +218,13 @@ Our 8-section checkpoint template follows Hermes's structured summary format.
238
218
  [Codex CLI]: https://github.com/openai/codex
239
219
  [Google ADK]: https://github.com/google/adk-python
240
220
  [Hermes]: https://github.com/NousResearch/hermes-agent
221
+ [MiMo-Code]: https://github.com/XiaomiMiMo/MiMo-Code
222
+ [Magic Context]: https://github.com/cortexkit/magic-context
223
+ [Aider]: https://github.com/Aider-AI/aider
224
+ [Roo Code]: https://github.com/RooCodeInc/Roo-Code
225
+ [Continue]: https://github.com/continuedev/continue
226
+ [OpenHands]: https://github.com/All-Hands-AI/OpenHands
227
+ [Plandex]: https://github.com/plandex-ai/plandex
241
228
 
242
229
  ## License
243
230
 
package/dist/index.js CHANGED
@@ -432,9 +432,6 @@ var PluginState = class {
432
432
  const last = this._lastMemoryNudgeMessageCount.get(sessionID);
433
433
  return last != null ? currentMessageCount - last : Number.POSITIVE_INFINITY;
434
434
  }
435
- setModelContextWindow(tokens) {
436
- if (tokens > 0) this._modelContextWindow = tokens;
437
- }
438
435
  getModelContextWindow() {
439
436
  return this._modelContextWindow;
440
437
  }
@@ -15369,14 +15366,13 @@ function extractInputTokensFromMessages(messages) {
15369
15366
  for (const part of msg.parts) {
15370
15367
  if (typeof part !== "object" || part === null) continue;
15371
15368
  const p = part;
15372
- if (p["type"] === "step-finish") {
15373
- const tokens = p;
15374
- const input = tokens.tokens?.input ?? 0;
15375
- const cached2 = tokens.tokens?.cached ?? 0;
15376
- const total = input + cached2;
15377
- if (total > best) best = total;
15378
- if (best > 0) return best;
15379
- }
15369
+ if (p["type"] !== "step-finish") continue;
15370
+ const tokens = p;
15371
+ const input = tokens.tokens?.input ?? 0;
15372
+ const cached2 = tokens.tokens?.cache?.read ?? 0;
15373
+ const total = input + cached2;
15374
+ if (total > best) best = total;
15375
+ if (best > 0) return best;
15380
15376
  }
15381
15377
  }
15382
15378
  return best;
@@ -16182,29 +16178,6 @@ function createNotifyHandler(client, logger) {
16182
16178
  };
16183
16179
  }
16184
16180
 
16185
- // src/shared/model-limits.ts
16186
- var KNOWN_MODEL_LIMITS = {
16187
- "deepseek-v4-pro": 1e6,
16188
- "deepseek-v4": 1e6,
16189
- "deepseek-v3": 64e3,
16190
- "deepseek-r1": 64e3,
16191
- "claude-opus-4": 2e5,
16192
- "claude-sonnet-4": 2e5,
16193
- "gpt-4o": 128e3,
16194
- "o1": 2e5,
16195
- "o3-mini": 2e5,
16196
- "gemini-2.5-pro": 1e6,
16197
- "gemini-2.5-flash": 1e6,
16198
- "qwen-max": 131072
16199
- };
16200
- function lookupModelLimit(modelID) {
16201
- if (KNOWN_MODEL_LIMITS[modelID]) return KNOWN_MODEL_LIMITS[modelID];
16202
- for (const [key, limit] of Object.entries(KNOWN_MODEL_LIMITS)) {
16203
- if (modelID.includes(key)) return limit;
16204
- }
16205
- return void 0;
16206
- }
16207
-
16208
16181
  // src/extract/enrich.ts
16209
16182
  import { stat } from "fs/promises";
16210
16183
 
@@ -16536,14 +16509,10 @@ var deepMemoryPlugin = async (input) => {
16536
16509
  const defaultModel = configResult.data?.model;
16537
16510
  if (typeof defaultModel === "string" && defaultModel.includes("/")) {
16538
16511
  const slashIdx = defaultModel.indexOf("/");
16539
- const providerID = defaultModel.slice(0, slashIdx);
16540
- const modelID = defaultModel.slice(slashIdx + 1);
16541
- state.recordFallbackModel({ providerID, modelID });
16542
- const limit = lookupModelLimit(modelID);
16543
- if (limit) {
16544
- state.setModelContextWindow(limit);
16545
- logger.debug("resolved model context window", { modelID, limit });
16546
- }
16512
+ state.recordFallbackModel({
16513
+ providerID: defaultModel.slice(0, slashIdx),
16514
+ modelID: defaultModel.slice(slashIdx + 1)
16515
+ });
16547
16516
  }
16548
16517
  }).catch((err) => {
16549
16518
  logger.debug("config.get failed, dream/distill will omit model", {