Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(recall): factual compression digests, Haiku / gpt-6-luna compressors, custom Codex providers (#5732)
t0saki9093583b3405
diff --git a/.github/scripts/build-plugin-downloads.sh b/.github/scripts/build-plugin-downloads.shindex 21e8190a7..5f7c72c8a 100755--- a/.github/scripts/build-plugin-downloads.sh+++ b/.github/scripts/build-plugin-downloads.sh@@ -44,8 +44,9 @@ SRC="${WORK}/memory-plugins-src"cp -R "${STAGE}" "${SRC}"git -C "${SRC}" init -q -b maingit -C "${SRC}" add -A+# Background auto-maintenance would repack while the clone below reads.GIT_AUTHOR_DATE="2000-01-01T00:00:00Z" GIT_COMMITTER_DATE="2000-01-01T00:00:00Z" \- git -C "${SRC}" -c [email protected] -c user.name="OpenViking Release" \+ git -C "${SRC}" -c maintenance.auto=false -c [email protected] -c user.name="OpenViking Release" \commit -qm "OpenViking memory plugins"git clone -q --bare "${SRC}" "${OUT}/plugins/memory-plugins.git"git -C "${OUT}/plugins/memory-plugins.git" -c pack.threads=1 repack -adqdiff --git a/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json b/examples/agent-hook-plugin/hosts/cursor/openviking.integration.jsonindex 7c430ecfc..66a939e86 100644--- a/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json+++ b/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json@@ -1,7 +1,7 @@{"schemaVersion": 1,"id": "openviking-memory",- "version": "0.5.15",+ "version": "0.5.16","clients": ["cursor"],diff --git a/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json b/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.jsonindex 6e307c1b3..39f028dfe 100644--- a/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json+++ b/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json@@ -1,6 +1,6 @@{"name": "openviking-memory",- "version": "0.5.15",+ "version": "0.5.16","description": "Long-term semantic memory for Kimi Code CLI, powered by OpenViking.","author": {"name": "OpenViking",diff --git a/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json b/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.jsonindex bbd40a94a..f171acef7 100644--- a/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json+++ b/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json@@ -1,7 +1,7 @@{"schemaVersion": 1,"id": "openviking-memory",- "version": "0.5.15",+ "version": "0.5.16","clients": ["kimicode"],diff --git a/examples/agent-hook-plugin/hosts/trae/openviking.integration.json b/examples/agent-hook-plugin/hosts/trae/openviking.integration.jsonindex 68c2c52cd..24adf8b5d 100644--- a/examples/agent-hook-plugin/hosts/trae/openviking.integration.json+++ b/examples/agent-hook-plugin/hosts/trae/openviking.integration.json@@ -1,7 +1,7 @@{"schemaVersion": 1,"id": "openviking-memory",- "version": "0.5.15",+ "version": "0.5.16","clients": ["trae","trae-cn"diff --git a/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json b/examples/agent-hook-plugin/hosts/zcode/openviking.integration.jsonindex 2b4160ebd..436526df1 100644--- a/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json+++ b/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json@@ -1,7 +1,7 @@{"schemaVersion": 1,"id": "openviking-memory",- "version": "0.5.15",+ "version": "0.5.16","clients": ["zcode"],diff --git a/examples/agent-hook-plugin/plugin.json b/examples/agent-hook-plugin/plugin.jsonindex dd085b23f..50bfad4ec 100644--- a/examples/agent-hook-plugin/plugin.json+++ b/examples/agent-hook-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "agent-hook-plugin",- "version": "0.5.15",+ "version": "0.5.16","description": "Long-term semantic memory for Cursor, TRAE, TRAE CN, ZCode and Kimi Code — powered by OpenViking. Auto-recall relevant memories and capture the conversation as it happens.","author": {"name": "OpenViking",diff --git a/examples/claude-code-memory-plugin/.claude-plugin/plugin.json b/examples/claude-code-memory-plugin/.claude-plugin/plugin.jsonindex ee3f89924..536ab2bb8 100644--- a/examples/claude-code-memory-plugin/.claude-plugin/plugin.json+++ b/examples/claude-code-memory-plugin/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "openviking-memory",- "version": "0.7.7",+ "version": "0.7.8","description": "Long-term semantic memory for Claude Code, powered by OpenViking. Auto-recall relevant memories at session start and capture important information during conversations.","author": {"name": "OpenViking",diff --git a/examples/claude-code-memory-plugin/README.md b/examples/claude-code-memory-plugin/README.mdindex 2c8e606e9..da83d209c 100644--- a/examples/claude-code-memory-plugin/README.md+++ b/examples/claude-code-memory-plugin/README.md@@ -367,7 +367,7 @@ Keep `.gitignore` from ignoring all of `.openviking/`, or `config.json` can neve### Digest compression-`recallCompress` decides where the digest is produced and defaults to `auto`. `client` always compresses locally through `claude -p` (Sonnet with low effort by default — Haiku ignores the effort knob, so its latency is unbounded), keeping the token cost on your own subscription. `server` asks OpenViking for the digest. `auto` prefers local and falls back to the server when no healthy host CLI is found. Compressor execution or output-validation failures fall back to the uncompressed context block; an exact `NO_RELEVANT_MEMORY` response from either compressor is a successful empty result and injects nothing. The compressor subprocess runs with all OpenViking hooks disabled so it cannot recurse. The former `OPENVIKING_RECALL_REWRITE` environment variable and `recallRewrite` config key remain supported as lower-priority compatibility aliases.+`recallCompress` decides where the digest is produced and defaults to `auto`. `client` always compresses locally through `claude -p` (Haiku with low effort by default), keeping the token cost on your own subscription. `server` asks OpenViking for the digest. `auto` prefers local and falls back to the server when no healthy host CLI is found. Compressor execution or output-validation failures fall back to the uncompressed context block; an exact `NO_RELEVANT_MEMORY` response from either compressor is a successful empty result and injects nothing. The compressor subprocess runs with all OpenViking hooks disabled so it cannot recurse. The former `OPENVIKING_RECALL_REWRITE` environment variable and `recallRewrite` config key remain supported as lower-priority compatibility aliases.### Legacy `claude_code` block in `ov.conf`diff --git a/examples/claude-code-memory-plugin/README_CN.md b/examples/claude-code-memory-plugin/README_CN.mdindex e180d9267..9d71311b6 100644--- a/examples/claude-code-memory-plugin/README_CN.md+++ b/examples/claude-code-memory-plugin/README_CN.md@@ -315,7 +315,7 @@ bypass 命中时所有 hook 直接放行,不联系 OpenViking。### digest 压缩-`recallCompress` 决定 digest 在哪里生成,默认值为 `auto`。`client` 始终通过 `claude -p` 在本地压缩(默认 Sonnet + 低推理档——Haiku 不支持 effort 旋钮,时延不可控),token 成本留在你自己的订阅额度里。`server` 让 OpenViking 生成 digest。`auto` 优先本地,探测不到可用的宿主 CLI 时回落到服务端。压缩器执行失败或输出校验失败时会退回未压缩的上下文块;任一压缩器精确返回 `NO_RELEVANT_MEMORY` 都是成功的空结果,不注入任何内容。压缩子进程运行时所有 OpenViking hook 均被禁用,不会递归。旧的环境变量 `OPENVIKING_RECALL_REWRITE` 和配置键 `recallRewrite` 仍作为低优先级兼容别名保留。+`recallCompress` 决定 digest 在哪里生成,默认值为 `auto`。`client` 始终通过 `claude -p` 在本地压缩(默认 Haiku + 低推理档),token 成本留在你自己的订阅额度里。`server` 让 OpenViking 生成 digest。`auto` 优先本地,探测不到可用的宿主 CLI 时回落到服务端。压缩器执行失败或输出校验失败时会退回未压缩的上下文块;任一压缩器精确返回 `NO_RELEVANT_MEMORY` 都是成功的空结果,不注入任何内容。压缩子进程运行时所有 OpenViking hook 均被禁用,不会递归。旧的环境变量 `OPENVIKING_RECALL_REWRITE` 和配置键 `recallRewrite` 仍作为低优先级兼容别名保留。### 遗留 `claude_code` 块(在 `ov.conf` 里)diff --git a/examples/claude-code-memory-plugin/package.json b/examples/claude-code-memory-plugin/package.jsonindex a054ef396..13bbf5006 100644--- a/examples/claude-code-memory-plugin/package.json+++ b/examples/claude-code-memory-plugin/package.json@@ -1,6 +1,6 @@{"name": "claude-code-openviking-memory",- "version": "0.7.7",+ "version": "0.7.8","description": "OpenViking memory plugin for Claude Code — semantic long-term memory","type": "module","scripts": {diff --git a/examples/claude-code-memory-plugin/scripts/lib/host-compressor.mjs b/examples/claude-code-memory-plugin/scripts/lib/host-compressor.mjsindex 184cf27e8..e1b888708 100644--- a/examples/claude-code-memory-plugin/scripts/lib/host-compressor.mjs+++ b/examples/claude-code-memory-plugin/scripts/lib/host-compressor.mjs@@ -2,10 +2,8 @@* Local digest compression through the host CLI.** Running the rewrite here keeps the token cost on the user's own subscription- * instead of the OpenViking deployment. Measured against a server-side rewrite- * the latency is the same order as long as the reasoning budget is actually- * clamped, which is why the default model/effort pair is Sonnet + low (Haiku- * ignores the effort knob and its latency is unbounded).+ * instead of the OpenViking deployment. The default model/effort pair is+ * Haiku + low, which keeps the reasoning budget, and thus latency, clamped.** Everything here is best-effort: a missing CLI, a timeout, or malformed output* means no digest, and the caller injects the unrewritten context block.@@ -116,7 +114,7 @@ export async function createHostCompressor(cfg = {}, log = () => {}) {return null;}- const model = String(cfg.recallCompressModel || "sonnet");+ const model = String(cfg.recallCompressModel || "haiku");const effort = String(cfg.recallCompressEffort || "low");const timeoutMs = Math.max(5000, Number(cfg.recallCompressTimeoutMs || 30000));diff --git a/examples/claude-code-memory-plugin/scripts/shared/recall-compress-core.mjs b/examples/claude-code-memory-plugin/scripts/shared/recall-compress-core.mjsindex 1ced4cf4d..b5e10ef0f 100644--- a/examples/claude-code-memory-plugin/scripts/shared/recall-compress-core.mjs+++ b/examples/claude-code-memory-plugin/scripts/shared/recall-compress-core.mjs@@ -27,9 +27,15 @@ Write a memory digest for a coding agent about to answer that query. Keep theconcrete facts (paths, identifiers, decisions, constraints); drop pleasantriesand conversational filler.+Report only facts found in the fragments; never restate the user query as a+fact. Do not tell the agent what to do with them: no advice, instructions,+warnings, or next steps of your own. Report a preference or rule as something+the user recorded, not as a command to the agent.+Format rules:- Group related facts by topic, one bullet per topic, at most ${maxBullets} bullets.- Start every bullet with "- ".+- Write in the language of the user query.- End every bullet with its source, copied verbatim from the fragments above:"来源:viking://..." or "source: viking://...". Never edit, shorten, or invent a URI.- Output the digest body only. No preamble, no closing remark.diff --git a/examples/codex-memory-plugin/.codex-plugin/plugin.json b/examples/codex-memory-plugin/.codex-plugin/plugin.jsonindex b29e6f2bb..5cee7ed26 100644--- a/examples/codex-memory-plugin/.codex-plugin/plugin.json+++ b/examples/codex-memory-plugin/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "openviking-memory",- "version": "0.11.6",+ "version": "0.11.7","description": "Long-term semantic memory for Codex, powered by OpenViking. Recall on UserPromptSubmit, incremental add_message on Stop (per turn), commit on SessionEnd (Codex >= 0.145) and on PreCompact, with an idle/ended sweep on SessionStart as the fallback for signals, crashes and older Codex builds. Includes a local stdio MCP proxy that reads OpenViking credentials from env/ovcli.conf.","author": {"name": "OpenViking",diff --git a/examples/codex-memory-plugin/DESIGN.md b/examples/codex-memory-plugin/DESIGN.mdindex ec7eb163c..0e9e1760a 100644--- a/examples/codex-memory-plugin/DESIGN.md+++ b/examples/codex-memory-plugin/DESIGN.md@@ -443,9 +443,12 @@ codex -m <model> -c 'model_reasoning_effort="low"' exec ...```The compressor runs with `--ignore-user-config`, so it does not inherit the-main Codex process's provider table. When-`OPENVIKING_RECALL_COMPRESS_BASE_URL` is set, the plugin adds an isolated-provider for the nested request:+main Codex process's provider table. When the user's `config.toml` selects a+custom `model_provider`, the plugin forwards that provider's single-line+`key = value` entries (endpoint and auth included) as `-c` overrides; a+provider with sub-tables or multi-line values is not forwarded. When+`OPENVIKING_RECALL_COMPRESS_BASE_URL` is set, the plugin instead adds an+isolated provider for the nested request:```bash-c 'model_provider="openviking_compressor"' \@@ -474,7 +477,7 @@ Fallback order:1. configured model/thinking (`OPENVIKING_RECALL_COMPRESS_MODEL` +`OPENVIKING_RECALL_COMPRESS_THINKING`)-2. `gpt-5.3-codex-spark`, thinking `default`+2. `gpt-6-luna`, thinking `low`3. `gpt-5.6-luna`, thinking `low`4. off (deterministic digest, no child `codex exec`)diff --git a/examples/codex-memory-plugin/README.md b/examples/codex-memory-plugin/README.mdindex f9bf3482a..eef76cb3c 100644--- a/examples/codex-memory-plugin/README.md+++ b/examples/codex-memory-plugin/README.md@@ -156,8 +156,8 @@ All plugin behavior is controlled by `OPENVIKING_*` environment variables. Conne# ~/.zshrc — examplesexport OPENVIKING_RECALL_LIMIT=10export OPENVIKING_RECALL_COMPRESS=1-export OPENVIKING_RECALL_COMPRESS_MODEL=gpt-5.3-codex-spark-export OPENVIKING_RECALL_COMPRESS_THINKING=default+export OPENVIKING_RECALL_COMPRESS_MODEL=gpt-6-luna+export OPENVIKING_RECALL_COMPRESS_THINKING=lowexport OPENVIKING_RECALL_COMPRESS_BASE_URL=https://api.example.com/v1export OPENVIKING_RECALL_TIMEOUT_MS=120000export OPENVIKING_CAPTURE_ASSISTANT_TURNS=1@@ -338,7 +338,7 @@ and removes injected context from newly captured messages.The compressor profile is recreated on every `SessionStart` and cached under `OPENVIKING_CODEX_STATE_DIR` so cross-session config changes are picked up but each `UserPromptSubmit` does not probe models. Default fallback order:1. configured `OPENVIKING_RECALL_COMPRESS_MODEL` + `OPENVIKING_RECALL_COMPRESS_THINKING`-2. `gpt-5.3-codex-spark` with thinking `default`+2. `gpt-6-luna` with thinking `low`3. `gpt-5.6-luna` with thinking `low`4. off (deterministic digest, no `codex exec` compression)@@ -350,7 +350,7 @@ Config knobs:| `OPENVIKING_RECALL_COMPRESS` | `auto` | `server`: cloud rewrite, never launches `codex exec`; `client`: local only; `auto`: local when available, otherwise cloud; `off` / `0`: uncompressed. `1` aliases `auto`. || `OPENVIKING_RECALL_COMPRESS_MODEL` | unset | Custom first-choice compressor model. Set `off` to disable the local compressor (`auto` then uses cloud compression). || `OPENVIKING_RECALL_COMPRESS_THINKING` | unset | Custom `model_reasoning_effort`; `default` omits the Codex config override. Alias: `OPENVIKING_RECALL_COMPRESS_REASONING_EFFORT`. |-| `OPENVIKING_RECALL_COMPRESS_BASE_URL` | unset | Base URL for the nested compressor's provider. Use this when `--ignore-user-config` prevents the compressor from reading the main Codex provider configuration. |+| `OPENVIKING_RECALL_COMPRESS_BASE_URL` | unset | Base URL for the nested compressor's provider. When unset, the compressor reuses the custom `model_provider` selected in `config.toml`, including its auth settings. || `OPENVIKING_RECALL_COMPRESS_MIN_INPUT_CHARS` | `1500` | Skip the nested compressor below this recalled-context size. Set `0` to compress every non-empty result. || `OPENVIKING_RECALL_COMPRESS_DETECT_ON_STARTUP` | `1` | Recreate/cache compressor profile in `SessionStart`. || `OPENVIKING_RECALL_COMPRESS_DETECT_TIMEOUT_MS` | `15000` | Per-candidate startup probe timeout. |diff --git a/examples/codex-memory-plugin/scripts/recall-compressor-profile.mjs b/examples/codex-memory-plugin/scripts/recall-compressor-profile.mjsindex aeaaea0c5..9071e8513 100644--- a/examples/codex-memory-plugin/scripts/recall-compressor-profile.mjs+++ b/examples/codex-memory-plugin/scripts/recall-compressor-profile.mjs@@ -1,3 +1,4 @@+import { readFileSync } from "node:fs";import { readFile, rm } from "node:fs/promises";import { homedir } from "node:os";import { join } from "node:path";@@ -5,11 +6,12 @@ import { mkdir, rename, writeFile } from "node:fs/promises";import { normalizeRewriteMode } from "./shared/plugin-config.mjs";import { getStateDir } from "./session-state.mjs";-const DEFAULT_PRIMARY = { model: "gpt-5.3-codex-spark", thinking: "default", source: "default_primary" };+const DEFAULT_PRIMARY = { model: "gpt-6-luna", thinking: "low", source: "default_primary" };const DEFAULT_FALLBACK = { model: "gpt-5.6-luna", thinking: "low", source: "default_fallback" };-const PROFILE_SCHEMA_VERSION = 3;+const PROFILE_SCHEMA_VERSION = 4;const DEFAULT_CODEX_HOME = join(homedir(), ".codex");const COMPRESSOR_PROVIDER = "openviking_compressor";+const BUILTIN_PROVIDERS = new Set(["openai", "oss", "ollama", "lmstudio"]);function isOff(value) {return /^(?:0|false|no|off|none|disabled)$/i.test(String(value || "").trim());@@ -31,7 +33,51 @@ export function recallCompressionExplicitlyOff(cfg) {|| isOff(cfg.recallCompressModel) || isOff(cfg.recallCompressThinking);}-export function buildCodexExecArgs(profile, outputPath, cfg = {}) {+/**+ * `--ignore-user-config` also drops the user's custom provider (endpoint and+ * auth), so forward the active one as `-c` overrides. Only single-line+ * `key = value` entries are copied; anything else (sub-tables, multi-line+ * values, trailing comments) forwards nothing.+ */+export function userProviderOverrides(env = process.env) {+ let text;+ try {+ text = readFileSync(join(codexHomeDir(env), "config.toml"), "utf-8");+ } catch {+ return [];+ }+ const topLevel = text.split(/^\s*\[/m)[0];+ const id = topLevel.match(/^\s*model_provider\s*=\s*"([\w-]+)"\s*$/m)?.[1];+ if (!id || BUILTIN_PROVIDERS.has(id)) return [];++ const header = new RegExp(`^\\[model_providers\\.(?:${id}|"${id}")(\\.|\\])`);+ const args = ["-c", `model_provider=${JSON.stringify(id)}`];+ let inSection = false;+ let found = false;+ for (const raw of text.split(/\r?\n/)) {+ const line = raw.trim();+ if (line.startsWith("[")) {+ const match = line.match(header);+ if (match?.[1] === ".") return [];+ inSection = Boolean(match);+ found ||= inSection;+ continue;+ }+ if (!inSection || !line || line.startsWith("#")) continue;+ const entry = line.match(/^([A-Za-z0-9_-]+)\s*=\s*(.+)$/);+ if (!entry || !isSingleLineValue(entry[2])) return [];+ args.push("-c", `model_providers.${id}.${entry[1]}=${entry[2]}`);+ }+ return found ? args : [];+}++function isSingleLineValue(value) {+ if (/^"(?:[^"\\]|\\.)*"$|^'[^']*'$/.test(value)) return true;+ if (/^\{.*\}$/.test(value)) return !value.includes("#");+ return /^[\w.+-]+$/.test(value);+}++export function buildCodexExecArgs(profile, outputPath, cfg = {}, env = process.env) {const args = [];if (profile.model) args.push("-m", profile.model);if (profile.thinking && profile.thinking !== "default") {@@ -43,6 +89,8 @@ export function buildCodexExecArgs(profile, outputPath, cfg = {}) {"-c", `model_providers.${COMPRESSOR_PROVIDER}.name=${JSON.stringify(COMPRESSOR_PROVIDER)}`,"-c", `model_providers.${COMPRESSOR_PROVIDER}.base_url=${JSON.stringify(cfg.recallCompressBaseUrl)}`,);+ } else {+ args.push(...userProviderOverrides(env));}args.push("--sandbox",diff --git a/examples/codex-memory-plugin/scripts/recall-compressor-profile.test.mjs b/examples/codex-memory-plugin/scripts/recall-compressor-profile.test.mjsindex 2101a0112..2b0c6c40d 100644--- a/examples/codex-memory-plugin/scripts/recall-compressor-profile.test.mjs+++ b/examples/codex-memory-plugin/scripts/recall-compressor-profile.test.mjs@@ -12,6 +12,7 @@ import {loadCodexModelsCache,markRecallCompressorRuntimeFailed,resolveRecallCompressorProfile,+ userProviderOverrides,} from "./recall-compressor-profile.mjs";function baseCfg(overrides = {}) {@@ -53,13 +54,13 @@ async function writeModelsCache(codexHome, slugs) {test("buildCodexExecArgs injects a configured compressor base URL", () => {const args = buildCodexExecArgs(- { model: "gpt-5.3-codex-spark", thinking: "default" },+ { model: "gpt-6-luna", thinking: "default" },"/tmp/last-message.txt",{ recallCompressBaseUrl: "https://compressor.example/v1" },);assert.deepEqual(args.slice(0, 8), [- "-m", "gpt-5.3-codex-spark",+ "-m", "gpt-6-luna","-c", 'model_provider="openviking_compressor"',"-c", 'model_providers.openviking_compressor.name="openviking_compressor"',"-c", 'model_providers.openviking_compressor.base_url="https://compressor.example/v1"',@@ -69,11 +70,83 @@ test("buildCodexExecArgs injects a configured compressor base URL", () => {test("buildCodexExecArgs preserves the existing command without a compressor base URL", () => {const args = buildCodexExecArgs(- { model: "gpt-5.3-codex-spark", thinking: "default" },+ { model: "gpt-6-luna", thinking: "default" },"/tmp/last-message.txt",+ {},+ { CODEX_HOME: "/nonexistent-codex-home" },);assert.equal(args.some((arg) => arg.includes("openviking_compressor")), false);+ assert.equal(args.some((arg) => arg.startsWith("model_provider")), false);+});++async function withCodexConfig(toml, action) {+ const codexHome = await mkdtemp(join(tmpdir(), "ov-codex-home-"));+ try {+ await writeFile(join(codexHome, "config.toml"), toml);+ await action({ CODEX_HOME: codexHome });+ } finally {+ await rm(codexHome, { recursive: true, force: true });+ }+}++test("buildCodexExecArgs forwards the user's active custom provider", async () => {+ await withCodexConfig([+ 'model_provider = "custom"',+ 'model = "gpt-6.1-sol"',+ "",+ '[projects."/tmp"]',+ 'trust_level = "trusted"',+ "[model_providers.custom]",+ 'base_url = "http://127.0.0.1:1936/v1"',+ 'wire_api = "responses"',+ "# comment",+ 'experimental_bearer_token = "secret"',+ 'http_headers = { "X-Team" = "ov" }',+ "requires_openai_auth = false",+ "[model_providers.other]",+ 'base_url = "http://other"',+ ].join("\n"), async (env) => {+ const args = buildCodexExecArgs({ model: "gpt-6-luna", thinking: "low" }, "/tmp/out.txt", {}, env);+ const overrides = args.filter((_, i) => args[i - 1] === "-c");+ assert.deepEqual(overrides.filter((v) => v.startsWith("model_provider")), [+ 'model_provider="custom"',+ 'model_providers.custom.base_url="http://127.0.0.1:1936/v1"',+ 'model_providers.custom.wire_api="responses"',+ 'model_providers.custom.experimental_bearer_token="secret"',+ 'model_providers.custom.http_headers={ "X-Team" = "ov" }',+ "model_providers.custom.requires_openai_auth=false",+ ]);+ assert.ok(args.indexOf("exec") > args.indexOf("model_providers.custom.requires_openai_auth=false"));+ });+});++test("userProviderOverrides skips built-in providers and unsupported layouts", async () => {+ await withCodexConfig('model_provider = "openai"\n', (env) => {+ assert.deepEqual(userProviderOverrides(env), []);+ });+ await withCodexConfig('model_provider = "custom"\n[model_providers.custom]\nbase_url = "x"\n[model_providers.custom.http_headers]\nA = "b"\n', (env) => {+ assert.deepEqual(userProviderOverrides(env), []);+ });+ await withCodexConfig('model_provider = "custom"\n[model_providers.custom]\nbase_url = "x" # trailing\n', (env) => {+ assert.deepEqual(userProviderOverrides(env), []);+ });+ await withCodexConfig('model_provider = "custom"\n', (env) => {+ assert.deepEqual(userProviderOverrides(env), []);+ });+});++test("a configured compressor base URL takes precedence over the user's provider", async () => {+ await withCodexConfig('model_provider = "custom"\n[model_providers.custom]\nbase_url = "x"\n', (env) => {+ const args = buildCodexExecArgs(+ { model: "gpt-6-luna", thinking: "low" },+ "/tmp/out.txt",+ { recallCompressBaseUrl: "https://compressor.example/v1" },+ env,+ );+ assert.equal(args.includes('model_provider="custom"'), false);+ assert.ok(args.includes('model_provider="openviking_compressor"'));+ });});test("loadCodexModelsCache returns empty set when cache missing", async () => {@@ -86,11 +159,11 @@ test("loadCodexModelsCache returns empty set when cache missing", async () => {test("loadCodexModelsCache parses available slugs", async () => {await withTempState(async ({ codexHome }) => {- await writeModelsCache(codexHome, ["gpt-5.3-codex-spark", "gpt-5.6-luna", "codex-auto-review"]);+ await writeModelsCache(codexHome, ["gpt-6-luna", "gpt-5.6-luna", "codex-auto-review"]);const result = await loadCodexModelsCache({ CODEX_HOME: codexHome });assert.equal(result.present, true);assert.equal(result.slugs.size, 3);- assert.equal(result.slugs.has("gpt-5.3-codex-spark"), true);+ assert.equal(result.slugs.has("gpt-6-luna"), true);assert.equal(result.slugs.has("gpt-5.6-luna"), true);});});@@ -116,7 +189,7 @@ test("resolveRecallCompressorProfile picks first candidate present in cache", astest("resolveRecallCompressorProfile honors configured candidate first when present", async () => {await withTempState(async ({ codexHome }) => {- await writeModelsCache(codexHome, ["gpt-5.5", "gpt-5.3-codex-spark"]);+ await writeModelsCache(codexHome, ["gpt-5.5", "gpt-6-luna"]);const profile = await resolveRecallCompressorProfile(baseCfg({recallCompressModel: "gpt-5.5",@@ -142,7 +215,7 @@ test("resolveRecallCompressorProfile falls back optimistically when cache missin{ CODEX_HOME: codexHome },);assert.equal(profile.enabled, true);- assert.equal(profile.model, "gpt-5.3-codex-spark");+ assert.equal(profile.model, "gpt-6-luna");assert.equal(profile.detected, false);});});@@ -162,7 +235,7 @@ test("resolveRecallCompressorProfile disables when compress is configured off",test("invalidateRecallCompressorProfileCache removes the persisted profile", async () => {await withTempState(async ({ stateDir, codexHome }) => {- await writeModelsCache(codexHome, ["gpt-5.3-codex-spark"]);+ await writeModelsCache(codexHome, ["gpt-6-luna"]);await resolveRecallCompressorProfile(baseCfg(), {}, { CODEX_HOME: codexHome });const path = join(stateDir, "recall-compressor-profile.json");await readFile(path, "utf-8"); // exists@@ -174,7 +247,7 @@ test("invalidateRecallCompressorProfileCache removes the persisted profile", asytest("detectRecallCompressorProfile prefers cached profile (no probe even when cache exists)", async () => {await withTempState(async ({ stateDir, codexHome }) => {// Seed cache with a different model than what the resolver would pick now.- await writeModelsCache(codexHome, ["gpt-5.3-codex-spark"]);+ await writeModelsCache(codexHome, ["gpt-6-luna"]);await resolveRecallCompressorProfile(baseCfg(), {}, { CODEX_HOME: codexHome });// Change the catalogue so the resolver would pick something else if it@@ -186,12 +259,12 @@ test("detectRecallCompressorProfile prefers cached profile (no probe even when c{},{ CODEX_HOME: codexHome },);- assert.equal(profile.model, "gpt-5.3-codex-spark");+ assert.equal(profile.model, "gpt-6-luna");// Persisted profile is unchanged.const persisted = JSON.parse(await readFile(join(stateDir, "recall-compressor-profile.json"), "utf-8"),);- assert.equal(persisted.profile.model, "gpt-5.3-codex-spark");+ assert.equal(persisted.profile.model, "gpt-6-luna");});});@@ -211,13 +284,13 @@ test("detectRecallCompressorProfile resolves on cache miss", async () => {test("detectRecallCompressorProfile after invalidate re-resolves against current catalogue", async () => {await withTempState(async ({ codexHome }) => {- await writeModelsCache(codexHome, ["gpt-5.3-codex-spark", "gpt-5.6-luna"]);+ await writeModelsCache(codexHome, ["gpt-6-luna", "gpt-5.6-luna"]);const initial = await detectRecallCompressorProfile(baseCfg(),{},{ CODEX_HOME: codexHome },);- assert.equal(initial.model, "gpt-5.3-codex-spark");+ assert.equal(initial.model, "gpt-6-luna");// Simulate runtime compress failure → invalidate cache, then drop the// failing slug from the catalogue. Next detect should pick the next one.@@ -252,25 +325,25 @@ test("markRecallCompressorRuntimeFailed writes a disabled profile cached for UPSawait writeModelsCache(codexHome, ["gpt-5.6-luna"]);await resolveRecallCompressorProfile(baseCfg(), {}, { CODEX_HOME: codexHome });- await markRecallCompressorRuntimeFailed(baseCfg(), { failedModel: "gpt-5.3-codex-spark" });+ await markRecallCompressorRuntimeFailed(baseCfg(), { failedModel: "gpt-6-luna" });const cached = await loadCachedRecallCompressorProfile(baseCfg());assert.ok(cached, "expected cached profile to exist");assert.equal(cached.enabled, false);assert.equal(cached.source, "runtime_failed");- assert.equal(cached.failedModel, "gpt-5.3-codex-spark");+ assert.equal(cached.failedModel, "gpt-6-luna");});});test("detectRecallCompressorProfile recovers across SessionStart after runtime_failed marker", async () => {await withTempState(async ({ codexHome }) => {// Initial healthy resolve.- await writeModelsCache(codexHome, ["gpt-5.3-codex-spark", "gpt-5.6-luna"]);+ await writeModelsCache(codexHome, ["gpt-6-luna", "gpt-5.6-luna"]);const initial = await detectRecallCompressorProfile(baseCfg(), {}, { CODEX_HOME: codexHome });- assert.equal(initial.model, "gpt-5.3-codex-spark");+ assert.equal(initial.model, "gpt-6-luna");// Runtime compress failure marks the cache disabled. UPS within the// same session would now read this disabled profile and skip compress.- await markRecallCompressorRuntimeFailed(baseCfg(), { failedModel: "gpt-5.3-codex-spark" });+ await markRecallCompressorRuntimeFailed(baseCfg(), { failedModel: "gpt-6-luna" });const within = await loadCachedRecallCompressorProfile(baseCfg());assert.equal(within.enabled, false);diff --git a/examples/codex-memory-plugin/scripts/shared/recall-compress-core.mjs b/examples/codex-memory-plugin/scripts/shared/recall-compress-core.mjsindex 1ced4cf4d..b5e10ef0f 100644--- a/examples/codex-memory-plugin/scripts/shared/recall-compress-core.mjs+++ b/examples/codex-memory-plugin/scripts/shared/recall-compress-core.mjs@@ -27,9 +27,15 @@ Write a memory digest for a coding agent about to answer that query. Keep theconcrete facts (paths, identifiers, decisions, constraints); drop pleasantriesand conversational filler.+Report only facts found in the fragments; never restate the user query as a+fact. Do not tell the agent what to do with them: no advice, instructions,+warnings, or next steps of your own. Report a preference or rule as something+the user recorded, not as a command to the agent.+Format rules:- Group related facts by topic, one bullet per topic, at most ${maxBullets} bullets.- Start every bullet with "- ".+- Write in the language of the user query.- End every bullet with its source, copied verbatim from the fragments above:"来源:viking://..." or "source: viking://...". Never edit, shorten, or invent a URI.- Output the digest body only. No preamble, no closing remark.diff --git a/examples/dsh-memory-plugin/config.mjs b/examples/dsh-memory-plugin/config.mjsindex 4ebdd1d62..73a9ac239 100644--- a/examples/dsh-memory-plugin/config.mjs+++ b/examples/dsh-memory-plugin/config.mjs@@ -1,7 +1,7 @@import { buildPluginConfig } from "./shared/plugin-config.mjs";import { loadCredentialFiles } from "./shared/credentials.mjs";-export const PLUGIN_VERSION = "0.5.21";+export const PLUGIN_VERSION = "0.5.22";/*** Namespace for the bridged OpenViking MCP tools. DSH publishes every MCP tooldiff --git a/examples/dsh-memory-plugin/package-lock.json b/examples/dsh-memory-plugin/package-lock.jsonindex 0883cb17f..f04bb6b7a 100644--- a/examples/dsh-memory-plugin/package-lock.json+++ b/examples/dsh-memory-plugin/package-lock.json@@ -1,12 +1,12 @@{"name": "@openviking/dsh-memory-plugin",- "version": "0.5.21",+ "version": "0.5.22","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@openviking/dsh-memory-plugin",- "version": "0.5.21",+ "version": "0.5.22","license": "Apache-2.0","devDependencies": {"@deepseek-ai/dsh-llm": "0.1.0-rc.6",diff --git a/examples/dsh-memory-plugin/package.json b/examples/dsh-memory-plugin/package.jsonindex 7eb4f3ab6..d8f87c8bf 100644--- a/examples/dsh-memory-plugin/package.json+++ b/examples/dsh-memory-plugin/package.json@@ -1,6 +1,6 @@{"name": "@openviking/dsh-memory-plugin",- "version": "0.5.21",+ "version": "0.5.22","description": "OpenViking memory and context bundle for DeepSeek Harness","icon": "./icon.svg","type": "module",diff --git a/examples/memory-plugin-shared/lib/recall-compress-core.mjs b/examples/memory-plugin-shared/lib/recall-compress-core.mjsindex 7557e1501..39bc9a6ed 100644--- a/examples/memory-plugin-shared/lib/recall-compress-core.mjs+++ b/examples/memory-plugin-shared/lib/recall-compress-core.mjs@@ -26,9 +26,15 @@ Write a memory digest for a coding agent about to answer that query. Keep theconcrete facts (paths, identifiers, decisions, constraints); drop pleasantriesand conversational filler.+Report only facts found in the fragments; never restate the user query as a+fact. Do not tell the agent what to do with them: no advice, instructions,+warnings, or next steps of your own. Report a preference or rule as something+the user recorded, not as a command to the agent.+Format rules:- Group related facts by topic, one bullet per topic, at most ${maxBullets} bullets.- Start every bullet with "- ".+- Write in the language of the user query.- End every bullet with its source, copied verbatim from the fragments above:"来源:viking://..." or "source: viking://...". Never edit, shorten, or invent a URI.- Output the digest body only. No preamble, no closing remark.diff --git a/examples/openclaw-plugin/shared/recall-compress-core.mjs b/examples/openclaw-plugin/shared/recall-compress-core.mjsindex 1ced4cf4d..b5e10ef0f 100644--- a/examples/openclaw-plugin/shared/recall-compress-core.mjs+++ b/examples/openclaw-plugin/shared/recall-compress-core.mjs@@ -27,9 +27,15 @@ Write a memory digest for a coding agent about to answer that query. Keep theconcrete facts (paths, identifiers, decisions, constraints); drop pleasantriesand conversational filler.+Report only facts found in the fragments; never restate the user query as a+fact. Do not tell the agent what to do with them: no advice, instructions,+warnings, or next steps of your own. Report a preference or rule as something+the user recorded, not as a command to the agent.+Format rules:- Group related facts by topic, one bullet per topic, at most ${maxBullets} bullets.- Start every bullet with "- ".+- Write in the language of the user query.- End every bullet with its source, copied verbatim from the fragments above:"来源:viking://..." or "source: viking://...". Never edit, shorten, or invent a URI.- Output the digest body only. No preamble, no closing remark.diff --git a/examples/opencode-plugin/package.json b/examples/opencode-plugin/package.jsonindex 0930fa476..ad5c55436 100644--- a/examples/opencode-plugin/package.json+++ b/examples/opencode-plugin/package.json@@ -1,6 +1,6 @@{"name": "@openviking/opencode-plugin",- "version": "0.5.9",+ "version": "0.5.10","author": "@openviking","description": "Unified OpenCode plugin for OpenViking repository retrieval and long-term memory","type": "module",diff --git a/examples/pi-coding-agent-extension/package-lock.json b/examples/pi-coding-agent-extension/package-lock.jsonindex 7095813a3..19b3e2d60 100644--- a/examples/pi-coding-agent-extension/package-lock.json+++ b/examples/pi-coding-agent-extension/package-lock.json@@ -1,12 +1,12 @@{"name": "openviking-pi-extension",- "version": "0.4.14",+ "version": "0.4.15","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openviking-pi-extension",- "version": "0.4.14",+ "version": "0.4.15","dependencies": {"@modelcontextprotocol/client": "2.0.0"},diff --git a/examples/pi-coding-agent-extension/package.json b/examples/pi-coding-agent-extension/package.jsonindex 764b3f365..48d8cfebb 100644--- a/examples/pi-coding-agent-extension/package.json+++ b/examples/pi-coding-agent-extension/package.json@@ -1,6 +1,6 @@{"name": "openviking-pi-extension",- "version": "0.4.14",+ "version": "0.4.15","description": "OpenViking memory and context extension for the pi coding agent","private": true,"type": "module",diff --git a/openviking/prompts/templates/retrieval/recall_rewrite.yaml b/openviking/prompts/templates/retrieval/recall_rewrite.yamlindex c27ea42e6..ababee98b 100644--- a/openviking/prompts/templates/retrieval/recall_rewrite.yaml+++ b/openviking/prompts/templates/retrieval/recall_rewrite.yaml@@ -2,7 +2,7 @@ metadata:id: "retrieval.recall_rewrite"name: "Recall Rewrite"description: "Rewrite assembled context into a short digest that keeps source URIs"- version: "1.0.0"+ version: "1.1.0"language: "en"category: "retrieval"@@ -34,9 +34,15 @@ template: |concrete facts (paths, identifiers, decisions, constraints); drop pleasantriesand conversational filler.+ Report only facts found in the fragments; never restate the user query as a+ fact. Do not tell the agent what to do with them: no advice, instructions,+ warnings, or next steps of your own. Report a preference or rule as something+ the user recorded, not as a command to the agent.+Format rules:- Group related facts by topic, one bullet per topic, at most {{ max_bullets }} bullets.- Start every bullet with "- ".+ - Write in the language of the user query.- End every bullet with its source, copied verbatim from the fragment above:"来源:viking://..." or "source: viking://...". Never edit, shorten, or invent a URI.- Output the digest body only. No preamble, no closing remark.