#1 Persistent memory for AI coding agents based on real-world benchmarks
TypeScript agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryompopenclawopencodepi
chore(release): v0.9.22 (#659)
Rohit Ghumarefd197dfda4d7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dbdd9e49..250caf70 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,44 +6,98 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),## [Unreleased]+## [0.9.22] — 2026-05-26++Stability + ecosystem wave. Three install-broken bugs (`npm install` ERESOLVE, non-OpenAI base URLs, broken Claude bridge path) closed. Six runtime bugs from active users fixed end-to-end. Three new agent integrations (Qwen Code, Antigravity, Kiro). New `AGENT_ID` scope for multi-agent setups. Port mapping documented.+### Fixed-- **PostToolUse hook reads `tool_response`, falls back to `tool_output`** ([PR #561](https://github.com/rohitg00/agentmemory/pull/561) by [@faraz152](https://github.com/faraz152), closes [#539](https://github.com/rohitg00/agentmemory/issues/539)). Claude Code's PostToolUse payload sends the field as `tool_response`, not `tool_output`. The hook was reading the wrong field, so `cleanOutput` was always `undefined`, `mem::compress` consistently failed its XML schema validation (requires `narrative >= 10` chars), and observations from every real Claude Code tool call were dropped. Now reads `tool_response ?? tool_output` so older integrations that emit the legacy field name keep working.+- **`npm install` ERESOLVE on fresh install** ([PR #649](https://github.com/rohitg00/agentmemory/pull/649), closes [#631](https://github.com/rohitg00/agentmemory/issues/631)). `@anthropic-ai/sdk` bumped from `^0.39.0` to `^0.93.0` so `claude-agent-sdk`'s peer is satisfied. Verified clean install with only the published `dependencies` block.++- **Non-OpenAI base URLs silent-404** ([PR #649](https://github.com/rohitg00/agentmemory/pull/649), closes [#646](https://github.com/rohitg00/agentmemory/issues/646), [#628](https://github.com/rohitg00/agentmemory/issues/628)). `buildChatUrl` + `buildEmbeddingUrl` no longer blindly prepend `/v1/`. DeepSeek, SiliconFlow, Zhipu (`/api/paas/v4`), vLLM, LM Studio, Ollama all resolve correctly.++- **`CLAUDE_MEMORY_BRIDGE` writes to a path Claude Code reads** ([PR #649](https://github.com/rohitg00/agentmemory/pull/649), closes [#625](https://github.com/rohitg00/agentmemory/issues/625)). Slug now preserves the leading `-` on POSIX absolute paths and drops the spurious `/memory/` subdir, matching `~/.claude/projects/<slug>/MEMORY.md`.++- **OpenAI provider reads `reasoning_content` for thinking models** ([PR #648](https://github.com/rohitg00/agentmemory/pull/648), closes [#627](https://github.com/rohitg00/agentmemory/issues/627)). DeepSeek V4 / Qwen3 / GLM / Kimi return `message.reasoning_content`. Previously only `message.reasoning` was checked — compress silently failed every call and tripped the circuit breaker.++- **`agentmemory stop` reaps the worker process** ([PR #648](https://github.com/rohitg00/agentmemory/pull/648), closes [#640](https://github.com/rohitg00/agentmemory/issues/640), [#474](https://github.com/rohitg00/agentmemory/issues/474)). Worker pid is written to `~/.agentmemory/worker.pid` on boot; `stop` signals both engine + worker.++- **OpenCode plugin implicit-creates the session on first observation** ([PR #648](https://github.com/rohitg00/agentmemory/pull/648), closes [#638](https://github.com/rohitg00/agentmemory/issues/638)). `mem::observe` creates the session row when one doesn't exist. No more orphan observations or `Session not found for summarize`.++- **OpenCode plugin zero-config auto-context injection** ([PR #648](https://github.com/rohitg00/agentmemory/pull/648), closes [#431](https://github.com/rohitg00/agentmemory/issues/431)). `POST /session/start` context is cached per-session; the existing `experimental.chat.system.transform` hook reads from the cache.++- **Viewer graph settles on 1000+ node graphs** ([PR #648](https://github.com/rohitg00/agentmemory/pull/648), closes [#563](https://github.com/rohitg00/agentmemory/issues/563)). Tick-decayed damping, per-node velocity cap, raf park on quiescence. Mousedown / wheel / zoom / recenter re-wake the parked loop.++- **`/memories` + `/export` paginate** ([PR #648](https://github.com/rohitg00/agentmemory/pull/648), closes [#544](https://github.com/rohitg00/agentmemory/issues/544)). New `?count=true` and `?limit=N&offset=M` on `/memories`. `/export` forwards `?maxSessions` + `?offset`. Stops large corpora (8K+ memories) from timing out at the iii-engine invocation boundary.++- **Claude Code drops the MCP server silently** ([PR #650](https://github.com/rohitg00/agentmemory/pull/650), closes [#510](https://github.com/rohitg00/agentmemory/issues/510)). `plugin/.mcp.json` env block uses `${VAR:-default}` form. Unset required vars no longer fail config parse.++- **Full 51-tool MCP surface by default** ([PR #650](https://github.com/rohitg00/agentmemory/pull/650), closes [#553](https://github.com/rohitg00/agentmemory/issues/553)). `getVisibleTools()` default flipped from `core` (8) to `all` (51) to match what every plugin manifest advertises. `AGENTMEMORY_TOOLS=core` still gives the lean set.++- **Connect adapters write `${VAR:-default}` env block** ([PR #650](https://github.com/rohitg00/agentmemory/pull/650)). `agentmemory connect` for Claude Code / Cursor / Gemini CLI / Windsurf writes the same default form.++- **Hermes `memory status` no longer reports the plugin as Missing** ([PR #643](https://github.com/rohitg00/agentmemory/pull/643), closes [#520](https://github.com/rohitg00/agentmemory/issues/520)). Hermes plugin seeds `AGENTMEMORY_URL` to `http://localhost:3111` at import. Works for systemd-managed agentmemory where the env file is loaded via `EnvironmentFile=` and never reaches the interactive shell.-- **iii-sdk pinned to exact `0.11.2`** ([PR #567](https://github.com/rohitg00/agentmemory/pull/567), closes [#555](https://github.com/rohitg00/agentmemory/issues/555)). `[email protected]` introduced a routing regression — all `/agentmemory/*` routes returned `404` from the iii-engine, even though `0.11.6` satisfied our previous `"^0.11.2"` range. `npm install -g @agentmemory/agentmemory` silently drifted everyone forward after `0.9.21` shipped. Pin removes the caret + also pins `[email protected]` in `agentmemory setup`'s upgrade flow.+- **Deleted memories cleared from BM25 + vector indices** ([PR #636](https://github.com/rohitg00/agentmemory/pull/636) by [@abhinav-m22](https://github.com/abhinav-m22), closes [#632](https://github.com/rohitg00/agentmemory/issues/632)). `SearchIndex.remove()` added and called from every delete path. Snapshot flushed synchronously so a SIGKILL between mutation + debounce can't resurrect deleted entries.-- **OpenAI provider sends explicit `stream: false`** ([PR #526](https://github.com/rohitg00/agentmemory/pull/526) by [@Ptah-CT](https://github.com/Ptah-CT)). Some OpenAI-compatible proxies default to `text/event-stream` when `stream` is absent, which crashes `response.json()` and trips `ResilientProvider`'s circuit breaker, silently disabling LLM-backed compression / summarisation / reflection.+- **PostToolUse hook reads `tool_response`, falls back to `tool_output`** ([PR #561](https://github.com/rohitg00/agentmemory/pull/561) by [@faraz152](https://github.com/faraz152), closes [#539](https://github.com/rohitg00/agentmemory/issues/539)). Claude Code's PostToolUse payload uses `tool_response`. Now reads `tool_response ?? tool_output` so legacy integrations keep working.-- **Viewer search uses NFKC normalisation for CJK / fullwidth input** ([PR #542](https://github.com/rohitg00/agentmemory/pull/542) by [@kaushalrog](https://github.com/kaushalrog)). Fullwidth characters and ligatures pasted from PDFs were missed by `.includes()`. NFKC normalisation on both sides of the comparison makes search match.+- **iii-sdk pinned to exact `0.11.2`** ([PR #567](https://github.com/rohitg00/agentmemory/pull/567), closes [#555](https://github.com/rohitg00/agentmemory/issues/555)). `[email protected]` introduced a routing regression where every `/agentmemory/*` route returned 404. Pin removes the caret.-- **Viewer splash shows actual bound viewer port** ([PR #560](https://github.com/rohitg00/agentmemory/pull/560) by [@Tanmay-008](https://github.com/Tanmay-008), closes [#521](https://github.com/rohitg00/agentmemory/issues/521)). `/agentmemory/livez` now returns `viewerPort` + `viewerSkipped`; CLI polls until populated. New fields are additive — existing consumers of `/livez` are unaffected.+- **OpenAI provider sends explicit `stream: false`** ([PR #526](https://github.com/rohitg00/agentmemory/pull/526) by [@Ptah-CT](https://github.com/Ptah-CT)). Some OpenAI-compatible proxies default to `text/event-stream` when `stream` is absent.-- **Viewer tab bar height stable across tab switches** ([PR #325](https://github.com/rohitg00/agentmemory/pull/325) by [@hungtd119](https://github.com/hungtd119), closes [#324](https://github.com/rohitg00/agentmemory/issues/324)). Explicit `height: 48px` on `.tab-bar` prevents scrollbar-induced height shift on tab switch (complements #313's `flex: 0 0 auto`).+- **Viewer search uses NFKC normalisation for CJK / fullwidth input** ([PR #542](https://github.com/rohitg00/agentmemory/pull/542) by [@kaushalrog](https://github.com/kaushalrog)).-- **Graph parser accepts self-closing `<entity .../>` tags** ([PR #494](https://github.com/rohitg00/agentmemory/pull/494) by [@Rex57](https://github.com/Rex57), follow-up regex fix in this release, closes [#492](https://github.com/rohitg00/agentmemory/issues/492)). Real LLM output uses self-closing entity tags for entities without properties; the parser regex required explicit `</entity>` closes and dropped them. Initial fix added an alternation; follow-up made the attribute matcher lazy (`[^>]*?`) so the self-closing branch is reached before the explicit-close branch greedily eats the next entity.+- **Viewer splash shows actual bound viewer port** ([PR #560](https://github.com/rohitg00/agentmemory/pull/560) by [@Tanmay-008](https://github.com/Tanmay-008), closes [#521](https://github.com/rohitg00/agentmemory/issues/521)). `/agentmemory/livez` now returns `viewerPort` + `viewerSkipped`.-- **Plugin MCP server inherits remote/auth env** ([PR #386](https://github.com/rohitg00/agentmemory/pull/386) by [@LaplaceYoung](https://github.com/LaplaceYoung), closes [#375](https://github.com/rohitg00/agentmemory/issues/375)). `plugin/.mcp.json` now passes `AGENTMEMORY_URL` + `AGENTMEMORY_SECRET` through to the bundled MCP server. Matches the `AGENTMEMORY_MCP_BLOCK` already used by the connect adapters. MCP hosts that expand `${VAR}` (Claude Code, Cursor) inherit shell env; hosts that don't expand (or pass the placeholder literally) still work — the shim now strips literal `${...}` strings and falls back to `http://localhost:3111` (hardening, this release).+- **Viewer tab bar height stable across tab switches** ([PR #325](https://github.com/rohitg00/agentmemory/pull/325) by [@hungtd119](https://github.com/hungtd119), closes [#324](https://github.com/rohitg00/agentmemory/issues/324)).-- **`@agentmemory/mcp` rejects literal `${VAR}` placeholders** (this release). Defensive guard in `src/mcp/rest-proxy.ts` and `src/mcp/standalone.ts`: any `AGENTMEMORY_URL` / `AGENTMEMORY_SECRET` value of the form `${...}` is treated as unset, so the shim falls back to `http://localhost:3111` instead of trying to fetch from a host literally named `${AGENTMEMORY_URL}`. Future-proofs against MCP hosts that don't expand env-var placeholders.+- **Graph parser accepts self-closing `<entity .../>` tags** ([PR #494](https://github.com/rohitg00/agentmemory/pull/494) by [@Rex57](https://github.com/Rex57), closes [#492](https://github.com/rohitg00/agentmemory/issues/492)).++- **Plugin MCP server inherits remote/auth env** ([PR #386](https://github.com/rohitg00/agentmemory/pull/386) by [@LaplaceYoung](https://github.com/LaplaceYoung), closes [#375](https://github.com/rohitg00/agentmemory/issues/375)).++- **`@agentmemory/mcp` rejects literal `${VAR}` placeholders**. Any `AGENTMEMORY_URL` / `AGENTMEMORY_SECRET` value of the form `${...}` is treated as unset and falls back to `http://localhost:3111`.++- **Codex `stop` hook closes session** ([PR #579](https://github.com/rohitg00/agentmemory/pull/579), closes [#493](https://github.com/rohitg00/agentmemory/issues/493)). `Stop` was missing from the Codex bundle; session never got marked completed.++- **Claude Code `--with-hooks` works for MCP-standalone users** ([PR #581](https://github.com/rohitg00/agentmemory/pull/581), closes [#508](https://github.com/rohitg00/agentmemory/issues/508)).### Added-- **Pluggable benchmark harness with in-house coding-agent corpus** ([PR #562](https://github.com/rohitg00/agentmemory/pull/562)). New `eval/` directory: 15 fictional coding-agent sessions + 15 hand-graded queries (single-session, multi-session, preference, temporal) plus three adapters (grep, OpenAI embeddings + cosine, agentmemory hybrid). LongMemEval support via `eval/runner/longmemeval.ts`. Sandboxed agentmemory + iii-engine on alt ports via `eval/scripts/sandbox.sh`. No runtime impact on the package — `eval/` is dev-only.+- **`AGENT_ID` multi-agent memory isolation** ([PR #654](https://github.com/rohitg00/agentmemory/pull/654), closes [#554](https://github.com/rohitg00/agentmemory/issues/554)). Optional `AGENT_ID` env tags every Session / RawObservation / CompressedObservation / Memory. `AGENTMEMORY_AGENT_SCOPE=isolated` (opt-in; `shared` default) also filters every recall path (`mem::smart-search`, `/memories`, `/observations`, `/sessions`). Per-call overrides via request body + `?agentId=<role>` / `?agentId=*` query params. `?includeOrphans=true` surfaces pre-tag rows.++- **Qwen Code connect adapter** ([PR #651](https://github.com/rohitg00/agentmemory/pull/651), closes [#647](https://github.com/rohitg00/agentmemory/issues/647)). `agentmemory connect qwen` writes the standard `mcpServers` block to `~/.qwen/settings.json`.++- **Antigravity connect adapter** ([PR #651](https://github.com/rohitg00/agentmemory/pull/651), closes [#614](https://github.com/rohitg00/agentmemory/issues/614)). Replacement for Gemini CLI (sunset 2026-06-18). Writes `mcp_config.json` to the platform-specific User dir.++- **Kiro connect adapter** ([PR #651](https://github.com/rohitg00/agentmemory/pull/651), closes [#618](https://github.com/rohitg00/agentmemory/issues/618)). Writes user-level `~/.kiro/settings/mcp.json`.-- **`agentmemory connect codex --with-hooks` opt-in flag** ([PR #564](https://github.com/rohitg00/agentmemory/pull/564), closes [#509](https://github.com/rohitg00/agentmemory/issues/509)). Workaround for [openai/codex#16430](https://github.com/openai/codex/issues/16430), which prevents plugin-local `hooks.json` from dispatching on Codex Desktop. Opt-in flag merges the bundled `hooks.codex.json` into `~/.codex/hooks.json` with absolute paths to the bundled scripts. Idempotent (re-install strips previous entries via the resolved script-path prefix; unrelated user hooks survive). MCP wiring is unchanged.+- **Cost-aware model selection** ([PR #654](https://github.com/rohitg00/agentmemory/pull/654), closes [#613](https://github.com/rohitg00/agentmemory/issues/613)). Runtime warning when `OPENROUTER_MODEL` matches the premium pattern. README cost-tier table with measured workload data. Suppress via `AGENTMEMORY_SUPPRESS_COST_WARNING=1`.-- **Cross-platform CI matrix** ([PR #556](https://github.com/rohitg00/agentmemory/pull/556)). Runs tests on Node 20 + 22 with `paths-ignore` for doc-only changes and per-branch concurrency cancellation.+- **Pluggable benchmark harness** ([PR #562](https://github.com/rohitg00/agentmemory/pull/562)). New `eval/` directory with the `coding-agent-life-v1` corpus (15 sessions + 15 graded queries) and three adapters (grep, OpenAI embeddings + cosine, agentmemory hybrid). LongMemEval support. Sandboxed agentmemory + iii-engine on alt ports via `eval/scripts/sandbox.sh`. Dev-only — no runtime impact.++- **`agentmemory connect codex --with-hooks` opt-in flag** ([PR #564](https://github.com/rohitg00/agentmemory/pull/564), closes [#509](https://github.com/rohitg00/agentmemory/issues/509)). Workaround for [openai/codex#16430](https://github.com/openai/codex/issues/16430).++- **Cross-platform CI matrix** ([PR #556](https://github.com/rohitg00/agentmemory/pull/556)). Ubuntu + macOS × Node 20 + 22, `paths-ignore`, per-branch concurrency cancellation.### Docs-- **README "Config File" section + Windows path + Claude subscription opt-in example** ([PR #321](https://github.com/rohitg00/agentmemory/pull/321) by [@aqilaziz](https://github.com/aqilaziz), closes [#293](https://github.com/rohitg00/agentmemory/issues/293)).+- **Port mapping table** ([PR #651](https://github.com/rohitg00/agentmemory/pull/651), closes [#629](https://github.com/rohitg00/agentmemory/issues/629)). `3111` REST / `3112` streams / `3113` viewer / `49134` engine WS + env overrides + stale-process cleanup recipe.++- **Pairings recipe** ([PR #641](https://github.com/rohitg00/agentmemory/pull/641)). `docs/recipes/pairings.md` covers stacking agentmemory with codegraph, Understand Anything, and Graphify.++- **Multi-agent README section** ([PR #654](https://github.com/rohitg00/agentmemory/pull/654)). `AGENT_ID` + `AGENTMEMORY_AGENT_SCOPE` semantics, per-endpoint behavior table.++- **Supply-chain policy in SECURITY.md** ([PR #654](https://github.com/rohitg00/agentmemory/pull/654), closes [#540](https://github.com/rohitg00/agentmemory/issues/540)). Explains why no lockfile is committed (`dist/` ships pre-built) and what monitoring exists.++- **README "Config File" section + Windows path** ([PR #321](https://github.com/rohitg00/agentmemory/pull/321) by [@aqilaziz](https://github.com/aqilaziz), closes [#293](https://github.com/rohitg00/agentmemory/issues/293)).-- **README sudo install hint for `EACCES` on system Node** ([PR #454](https://github.com/rohitg00/agentmemory/pull/454) by [@kedar-1](https://github.com/kedar-1)).+- **README sudo install hint for `EACCES`** ([PR #454](https://github.com/rohitg00/agentmemory/pull/454) by [@kedar-1](https://github.com/kedar-1)).### Infrastructure-- 98 test files, **1091 tests pass** on `fix/pre-release-hardening`.-- All MCP env-var consumers go through a single guarded `resolveEnvOrEmpty()` helper.+- 108 test files, **1171 tests pass**.+- Agent count: 8 → 11 (claude-code, codex, cursor, gemini-cli, qwen, antigravity, kiro, openclaw, hermes, pi, openhuman).## [0.9.21] — 2026-05-19diff --git a/package.json b/package.jsonindex bd92a70b..318d8787 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "@agentmemory/agentmemory",- "version": "0.9.21",+ "version": "0.9.22","description": "Persistent memory for AI coding agents, powered by iii-engine's three primitives","type": "module","main": "dist/index.mjs",diff --git a/packages/mcp/package.json b/packages/mcp/package.jsonindex 96da3ae4..2339efe7 100644--- a/packages/mcp/package.json+++ b/packages/mcp/package.json@@ -1,6 +1,6 @@{"name": "@agentmemory/mcp",- "version": "0.9.21",+ "version": "0.9.22","description": "Standalone MCP server for agentmemory — thin shim that re-exposes @agentmemory/agentmemory's MCP entrypoint","type": "module","bin": {diff --git a/plugin/.claude-plugin/plugin.json b/plugin/.claude-plugin/plugin.jsonindex e53f8088..e438aa2f 100644--- a/plugin/.claude-plugin/plugin.json+++ b/plugin/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "agentmemory",- "version": "0.9.21",+ "version": "0.9.22","description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 51 MCP tools, 4 skills, real-time viewer.","author": {"name": "Rohit Ghumare",diff --git a/plugin/.codex-plugin/plugin.json b/plugin/.codex-plugin/plugin.jsonindex 0a7cc173..67b0bf8a 100644--- a/plugin/.codex-plugin/plugin.json+++ b/plugin/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "agentmemory",- "version": "0.9.21",+ "version": "0.9.22","description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 6 hooks, 51 MCP tools, 4 skills, real-time viewer.","author": {"name": "Rohit Ghumare",diff --git a/plugin/opencode/agentmemory-capture.ts b/plugin/opencode/agentmemory-capture.tsindex cc7a44d8..056d53d3 100644--- a/plugin/opencode/agentmemory-capture.ts+++ b/plugin/opencode/agentmemory-capture.ts@@ -64,7 +64,7 @@ const stashedFiles = new Map<string, Set<string>>();const seenSubtaskIds = new Map<string, Set<string>>();const seenToolCallIds = new Map<string, Set<string>>();const contextInjectedSessions = new Set<string>();-// #431: cache the context returned by POST /session/start so the chat+// cache the context returned by POST /session/start so the chat// system-transform hook can inject it without a second /context fetch.// Auto-injection now happens at session.created (immediately) AND at// the first prompt_submit (fallback for older OpenCode builds that@@ -196,7 +196,7 @@ export const AgentmemoryCapturePlugin: Plugin = async (ctx) => {project: projectPath,cwd: projectPath,});- // #431: cache the context returned at session/start so the+ // cache the context returned at session/start so the// chat.system.transform hook injects it without a second fetch.const startCtx = (startResult as any)?.context;if (typeof startCtx === "string" && startCtx.length > 0) {@@ -605,7 +605,7 @@ export const AgentmemoryCapturePlugin: Plugin = async (ctx) => {if (!contextInjectedSessions.has(sid)) {if (!Array.isArray(output.system)) return;output.system.push(AGENTMEMORY_INSTRUCTIONS);- // #431: prefer the context already fetched at session.created;+ // prefer the context already fetched at session.created;// fall back to a fresh /context call if the cache missed (e.g.// session resumed across plugin reloads).let ctx = startContextCache.get(sid);diff --git a/src/config.ts b/src/config.tsindex beaab034..4162eefa 100644--- a/src/config.ts+++ b/src/config.ts@@ -95,7 +95,7 @@ function detectProvider(env: Record<string, string>): ProviderConfig {if (hasRealValue(env["OPENROUTER_API_KEY"])) {const model =env["OPENROUTER_MODEL"] || "anthropic/claude-sonnet-4-20250514";- // #613: warn when the configured OpenRouter model is in the+ // warn when the configured OpenRouter model is in the// premium tier and likely to burn money on background compression.// Captured workload data shows ~$5/35h on claude-sonnet-4 vs// ~$0.46/35h on deepseek-v4-pro for the same compression mix.@@ -241,7 +241,7 @@ export function loadClaudeBridgeConfig(): ClaudeBridgeConfig {const lineBudget = safeParseInt(env["CLAUDE_MEMORY_LINE_BUDGET"], 200);let memoryFilePath = "";if (enabled && projectPath) {- // #625: Claude Code stores MEMORY.md at+ // Claude Code stores MEMORY.md at// ~/.claude/projects/<slug>/MEMORY.md// where <slug> is the project path with `/` and `\` swapped for `-`.// The leading `-` from an absolute POSIX path is preserved (Claude@@ -269,7 +269,7 @@ export function loadTeamConfig(): TeamConfig | null {return { teamId, userId, mode };}-// #554: optional AGENT_ID env for multi-agent memory isolation.+// optional AGENT_ID env for multi-agent memory isolation.// Returns null when unset so memory stays unscoped (legacy behavior).// Trimmed + length-capped to keep KV writes well-formed.//diff --git a/src/functions/compress-synthetic.ts b/src/functions/compress-synthetic.tsindex 8cfd0202..28d17e97 100644--- a/src/functions/compress-synthetic.ts+++ b/src/functions/compress-synthetic.ts@@ -101,7 +101,6 @@ export function buildSyntheticCompression(};if (raw.modality) result.modality = raw.modality;if (raw.imageData) result.imageData = raw.imageData;- // #554: carry the role through synthetic compression too.if (raw.agentId) result.agentId = raw.agentId;return result;}diff --git a/src/functions/compress.ts b/src/functions/compress.tsindex 38a7fdea..0569555e 100644--- a/src/functions/compress.ts+++ b/src/functions/compress.ts@@ -165,7 +165,6 @@ export function registerCompressFunction(...(hasImage ? { modality: data.raw.modality } : {}),...(imageDescription ? { imageDescription } : {}),...(data.raw.imageData ? { imageRef: data.raw.imageData } : {}),- // #554: carry the role through LLM compression too....(data.raw.agentId ? { agentId: data.raw.agentId } : {}),};diff --git a/src/functions/export-import.ts b/src/functions/export-import.tsindex 4c997630..39c6036d 100644--- a/src/functions/export-import.ts+++ b/src/functions/export-import.ts@@ -176,7 +176,7 @@ export function registerExportImportFunction(sdk: ISdk, kv: StateKV): void {const strategy = data.strategy || "merge";const importData = data.exportData;- const supportedVersions = new Set(["0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.6.1", "0.7.0", "0.7.2", "0.7.3", "0.7.4", "0.7.5", "0.7.6", "0.7.7", "0.7.9", "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.8.6", "0.8.7", "0.8.8", "0.8.9", "0.8.10", "0.8.11", "0.8.12", "0.8.13", "0.9.0", "0.9.1", "0.9.2", "0.9.3", "0.9.4", "0.9.5", "0.9.6", "0.9.7", "0.9.8", "0.9.9", "0.9.10", "0.9.11", "0.9.12", "0.9.13", "0.9.14", "0.9.15", "0.9.16", "0.9.17", "0.9.18", "0.9.19", "0.9.20", "0.9.21"]);+ const supportedVersions = new Set(["0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.6.1", "0.7.0", "0.7.2", "0.7.3", "0.7.4", "0.7.5", "0.7.6", "0.7.7", "0.7.9", "0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.8.6", "0.8.7", "0.8.8", "0.8.9", "0.8.10", "0.8.11", "0.8.12", "0.8.13", "0.9.0", "0.9.1", "0.9.2", "0.9.3", "0.9.4", "0.9.5", "0.9.6", "0.9.7", "0.9.8", "0.9.9", "0.9.10", "0.9.11", "0.9.12", "0.9.13", "0.9.14", "0.9.15", "0.9.16", "0.9.17", "0.9.18", "0.9.19", "0.9.20", "0.9.21", "0.9.22"]);if (!supportedVersions.has(importData.version)) {return {success: false,diff --git a/src/functions/observe.ts b/src/functions/observe.tsindex c9aaa7aa..0adaff0f 100644--- a/src/functions/observe.ts+++ b/src/functions/observe.ts@@ -134,22 +134,15 @@ export function registerObserveFunction(}}- // #554: inherit agentId from the parent session so every- // observation carries the role that wrote it. Pre-existing- // session takes precedence (multi-agent runtime stamped at- // session/start), env AGENT_ID is the fallback for the- // implicit-create path (#638) where session doesn't exist yet.- // We reuse this lookup later for observationCount/firstPrompt.+ // Existing session is the source of truth for agentId (even+ // undefined). Env AGENT_ID only fires when no session row+ // exists yet — otherwise an unscoped session would get+ // retroactively scoped by a later AGENT_ID export.const existingSession = await kv.get<{agentId?: string;observationCount?: number;firstPrompt?: string;}>(KV.sessions, payload.sessionId);- // Existing session wins absolutely — even if its agentId is- // undefined. env AGENT_ID only fires on the implicit-create- // path where no session row exists yet (#638). Otherwise an- // unscoped session would get retroactively scoped by whatever- // AGENT_ID was set on the server later.const inheritedAgentId = existingSession? existingSession.agentId: getAgentId();@@ -241,7 +234,7 @@ export function registerObserveFunction(typeof payload.cwd === "string" &&payload.cwd.trim().length > 0) {- // #638: OpenCode (and any plugin that skips POST /session/start)+ // OpenCode (and any plugin that skips POST /session/start)// can fire observations before the session record exists. Without// an implicit create, those observations stack up but// `memory_sessions` never lists them, and summarize bails with@@ -262,8 +255,6 @@ export function registerObserveFunction(updatedAt: ts,status: "active",observationCount: 1,- // #554: implicit-create path also stamps agentId so the- // session row matches its child observations....(inheritedAgentId ? { agentId: inheritedAgentId } : {}),...(trimmedPrompt && trimmedPrompt.length > 0? { firstPrompt: trimmedPrompt }diff --git a/src/functions/remember.ts b/src/functions/remember.tsindex 247d927f..97440082 100644--- a/src/functions/remember.ts+++ b/src/functions/remember.ts@@ -71,7 +71,7 @@ export function registerRememberFunction(sdk: ISdk, kv: StateKV): void {}}- // #554: stamp the agent role on the memory so future recall can+ // stamp the agent role on the memory so future recall can// filter by agent. Request body wins (multi-agent runtimes// explicitly tagging at write time), env AGENT_ID fallback,// none → memory is unscoped (legacy behavior).diff --git a/src/functions/smart-search.ts b/src/functions/smart-search.tsindex 6ca6b828..fbdaad0d 100644--- a/src/functions/smart-search.ts+++ b/src/functions/smart-search.ts@@ -28,7 +28,7 @@ export function registerSmartSearchFunction(limit?: number;project?: string;includeLessons?: boolean;- // #554: optional per-call agent filter for runtimes routing many+ // optional per-call agent filter for runtimes routing many// roles through one server. "*" opts out of the env-default// scope and returns hits from every agent.agentId?: string;diff --git a/src/mcp/tools-registry.ts b/src/mcp/tools-registry.tsindex a8a8dfaf..a8e64839 100644--- a/src/mcp/tools-registry.ts+++ b/src/mcp/tools-registry.ts@@ -941,7 +941,7 @@ export function getAllTools(): McpToolDef[] {];}-// #553: default switched from "core" (8 essential tools) to "all"+// default switched from "core" (8 essential tools) to "all"// (full 51-tool surface). README and plugin manifests have always// advertised 51 tools "in proxy mode"; the old default left OpenCode /// Claude Code users seeing 8 with no indication the other 43 existed.diff --git a/src/triggers/api.ts b/src/triggers/api.tsindex fbef98c8..06a29282 100644--- a/src/triggers/api.ts+++ b/src/triggers/api.ts@@ -538,7 +538,7 @@ export function registerApiTriggers(};}const title = typeof body.title === "string" ? body.title.trim() : undefined;- // #554: allow session/start to override AGENT_ID from request body+ // allow session/start to override AGENT_ID from request body// (multi-agent runtimes that route many roles through one server// process). Falls back to the AGENT_ID env on the server.const requestAgentId =@@ -1082,7 +1082,7 @@ export function registerApiTriggers(async (req: ApiRequest): Promise<Response> => {const authErr = checkAuth(req, secret);if (authErr) return authErr;- // #544: mem::export already supports maxSessions/offset internally,+ // mem::export already supports maxSessions/offset internally,// but the HTTP endpoint hardcoded an empty payload — so /export on a// real corpus (40 sessions × 34K observations × 8K memories) hit the// iii engine invocation timeout and `agentmemory status` reported 0.@@ -1530,7 +1530,7 @@ export function registerApiTriggers(if (authErr) return authErr;const memories = await kv.list<import("../types.js").Memory>(KV.memories);const latest = req.query_params?.["latest"] === "true";- // #554: agentId filter. Request param wins, env AGENT_ID (when+ // agentId filter. Request param wins, env AGENT_ID (when// scope=isolated) is the fallback. Shared mode keeps the tag but// does not restrict the list endpoint. Pass agentId=* to opt out// of the env scope entirely. includeOrphans=true surfaces@@ -1556,7 +1556,7 @@ export function registerApiTriggers();}- // #544: viewer + `agentmemory status` were hitting this endpoint to+ // viewer + `agentmemory status` were hitting this endpoint to// count memories. On a real corpus (8K+ memories) the unbounded// response either timed out at the iii engine boundary ("Invocation// stopped") or arrived too large for the viewer to render — so thediff --git a/src/types.ts b/src/types.tsindex 967cf6d7..97a7457b 100644--- a/src/types.ts+++ b/src/types.ts@@ -306,7 +306,7 @@ export interface ExportPagination {}export interface ExportData {- version: "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.6.1" | "0.7.0" | "0.7.2" | "0.7.3" | "0.7.4" | "0.7.5" | "0.7.6" | "0.7.7" | "0.7.9" | "0.8.0" | "0.8.1" | "0.8.2" | "0.8.3" | "0.8.4" | "0.8.5" | "0.8.6" | "0.8.7" | "0.8.8" | "0.8.9" | "0.8.10" | "0.8.11" | "0.8.12" | "0.8.13" | "0.9.0" | "0.9.1" | "0.9.2" | "0.9.3" | "0.9.4" | "0.9.5" | "0.9.6" | "0.9.7" | "0.9.8" | "0.9.9" | "0.9.10" | "0.9.11" | "0.9.12" | "0.9.13" | "0.9.14" | "0.9.15" | "0.9.16" | "0.9.17" | "0.9.18" | "0.9.19" | "0.9.20" | "0.9.21";+ version: "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.6.1" | "0.7.0" | "0.7.2" | "0.7.3" | "0.7.4" | "0.7.5" | "0.7.6" | "0.7.7" | "0.7.9" | "0.8.0" | "0.8.1" | "0.8.2" | "0.8.3" | "0.8.4" | "0.8.5" | "0.8.6" | "0.8.7" | "0.8.8" | "0.8.9" | "0.8.10" | "0.8.11" | "0.8.12" | "0.8.13" | "0.9.0" | "0.9.1" | "0.9.2" | "0.9.3" | "0.9.4" | "0.9.5" | "0.9.6" | "0.9.7" | "0.9.8" | "0.9.9" | "0.9.10" | "0.9.11" | "0.9.12" | "0.9.13" | "0.9.14" | "0.9.15" | "0.9.16" | "0.9.17" | "0.9.18" | "0.9.19" | "0.9.20" | "0.9.21" | "0.9.22";exportedAt: string;sessions: Session[];observations: Record<string, CompressedObservation[]>;diff --git a/src/version.ts b/src/version.tsindex 8a1b6acf..a3c318f9 100644--- a/src/version.ts+++ b/src/version.ts@@ -1 +1 @@-export const VERSION = "0.9.21";+export const VERSION = "0.9.22";diff --git a/src/viewer/index.html b/src/viewer/index.htmlindex ecb779e8..d0bbc01c 100644--- a/src/viewer/index.html+++ b/src/viewer/index.html@@ -1766,7 +1766,7 @@}lastMX = e.clientX;lastMY = e.clientY;- // #563: wake the simulation if it parked itself after settling+ // wake the simulation if it parked itself after settlingwakeGraphSim();});canvas.addEventListener('mousemove', function(e) {@@ -1824,7 +1824,7 @@e.preventDefault();var factor = e.deltaY > 0 ? 0.9 : 1.1;graphSim.zoom = Math.max(0.1, Math.min(5, graphSim.zoom * factor));- // #563: zoom is visually meaningless if the rAF loop is parked —+ // zoom is visually meaningless if the rAF loop is parked —// wake the simulation so the next frame redraws at the new scale.wakeGraphSim();}, { passive: false });@@ -1914,7 +1914,7 @@var edges = graphSim.edges;var nodeCount = nodes.length;graphSim.tickCount = (graphSim.tickCount || 0) + 1;- // #563: dense graphs (>1000 nodes) used to oscillate forever+ // dense graphs (>1000 nodes) used to oscillate forever// because the per-node force pile-up exceeded what 0.9 damping// could bleed off each tick. Tick-decay tightens damping over// time so the layout actually settles; a per-node velocity cap@@ -1977,7 +1977,7 @@totalKineticEnergy += n.vx * n.vx + n.vy * n.vy;});- // #563: park the simulation when the layout is quiet to save CPU.+ // park the simulation when the layout is quiet to save CPU.// Pick up again when a drag/interaction wakes the loop.var rmsVelocity = nodes.length > 0 ? Math.sqrt(totalKineticEnergy / nodes.length) : 0;if (rmsVelocity < 0.05 && graphSim.tickCount > 60 && !graphSim.dragNode) {@@ -2261,7 +2261,7 @@async function loadMemories() {var el = document.getElementById('view-memories');el.innerHTML = '<div class="loading">Loading memories...</div>';- // #544: cap at 2000 so the viewer remains responsive on large+ // cap at 2000 so the viewer remains responsive on large// corpora. Older endpoints returned the full unbounded list which// hit the iii invocation timeout and the UI fell through to 0.var result = await apiGet('memories?latest=true&limit=2000');diff --git a/test/agent-id-scope.test.ts b/test/agent-id-scope.test.tsindex 4539e213..b74e5c74 100644--- a/test/agent-id-scope.test.ts+++ b/test/agent-id-scope.test.ts@@ -4,7 +4,7 @@ vi.mock("../src/logger.js", () => ({logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn() },}));-// #554: AGENT_ID scope for multi-agent memory isolation.+// AGENT_ID scope for multi-agent memory isolation.describe("loadAgentScope (#554)", () => {const ORIG = process.env["AGENT_ID"];diff --git a/test/claude-bridge-path.test.ts b/test/claude-bridge-path.test.tsindex c1e1f101..fa3573d3 100644--- a/test/claude-bridge-path.test.ts+++ b/test/claude-bridge-path.test.ts@@ -3,7 +3,7 @@ import { homedir } from "node:os";import { join } from "node:path";import { loadClaudeBridgeConfig } from "../src/config.js";-// #625: bridge path must match Claude Code's slug convention exactly:+// bridge path must match Claude Code's slug convention exactly:// ~/.claude/projects/<slug>/MEMORY.md// where <slug> replaces every / and \ with - and KEEPS any leading -.// The previous code stripped the leading - and added a /memory/diff --git a/test/cli-connect.test.ts b/test/cli-connect.test.tsindex 83dfb66e..11b2395b 100644--- a/test/cli-connect.test.ts+++ b/test/cli-connect.test.ts@@ -30,7 +30,7 @@ describe("agentmemory connect — dispatcher", () => {});it("ships the supported agent list", () => {- // Bumped to 11 with Qwen Code (#647), Antigravity (#614), Kiro (#618).+ // Bumped to 11 after adding Qwen Code + Antigravity + Kiro.expect(knownAgents().sort()).toEqual(["antigravity",@@ -133,7 +133,7 @@ describe("agentmemory connect — claude-code adapter (mock filesystem)", () =>const config = JSON.parse(readFileSync(join(tmpHome, ".claude.json"), "utf-8"));const entry = config.mcpServers.agentmemory;expect(entry.env).toBeDefined();- // #510: env interpolation must carry a default so Claude Code+ // env interpolation must carry a default so Claude Code// doesn't silently drop the server when the user hasn't exported// AGENTMEMORY_URL / AGENTMEMORY_SECRET. Defaults match the// documented runtime (localhost:3111, no auth, all tools).diff --git a/test/codex-plugin.test.ts b/test/codex-plugin.test.tsindex e501938d..6b711197 100644--- a/test/codex-plugin.test.ts+++ b/test/codex-plugin.test.ts@@ -81,7 +81,7 @@ describe("Codex plugin manifest (developers.openai.com/codex/plugins)", () => {>;}>(join(pluginRoot, ".mcp.json"));- // #510: env interpolation must include defaults so Claude Code (and+ // env interpolation must include defaults so Claude Code (and// any other MCP host that fails parse on unset ${VAR}) doesn't drop// the server silently when the user hasn't exported the var.expect(mcp.mcpServers.agentmemory?.env?.AGENTMEMORY_URL).toMatch(diff --git a/test/connect-new-agents.test.ts b/test/connect-new-agents.test.tsindex 8120eae3..d73f1c0f 100644--- a/test/connect-new-agents.test.ts+++ b/test/connect-new-agents.test.ts@@ -3,16 +3,15 @@ import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync } from "node:fimport { tmpdir, platform } from "node:os";import { join } from "node:path";-// #647 / #614 / #618: connect adapters for Qwen Code, Antigravity, and-// Kiro. Each writes the canonical agentmemory MCP block (npx-// @agentmemory/mcp + env defaults from PR #650) into the agent's-// documented config path.+// Connect adapters for Qwen Code, Antigravity, and Kiro. Each writes+// the canonical MCP block (npx @agentmemory/mcp + env defaults) into+// the agent's documented config path.function freshHome(): string {return mkdtempSync(join(tmpdir(), "am-connect-"));}-describe("connect: Qwen Code (#647)", () => {+describe("connect: Qwen Code", () => {let home: string;const ORIG = process.env["HOME"];beforeEach(() => {@@ -50,7 +49,7 @@ describe("connect: Qwen Code (#647)", () => {});});-describe("connect: Antigravity (#614)", () => {+describe("connect: Antigravity", () => {let home: string;const ORIG = process.env["HOME"];beforeEach(() => {@@ -83,7 +82,7 @@ describe("connect: Antigravity (#614)", () => {});});-describe("connect: Kiro (#618)", () => {+describe("connect: Kiro", () => {let home: string;const ORIG = process.env["HOME"];beforeEach(() => {diff --git a/test/export-import.test.ts b/test/export-import.test.tsindex 373d2518..11745b66 100644--- a/test/export-import.test.ts+++ b/test/export-import.test.ts@@ -119,7 +119,7 @@ describe("Export/Import Functions", () => {it("export produces valid ExportData structure", async () => {const result = (await sdk.trigger("mem::export", {})) as ExportData;- expect(result.version).toBe("0.9.21");+ expect(result.version).toBe("0.9.22");expect(result.exportedAt).toBeDefined();expect(result.sessions.length).toBe(1);expect(result.sessions[0].id).toBe("ses_1");diff --git a/test/hermes-plugin.test.ts b/test/hermes-plugin.test.tsindex 70ea8544..87e7ed64 100644--- a/test/hermes-plugin.test.ts+++ b/test/hermes-plugin.test.ts@@ -62,7 +62,7 @@ describe("Hermes plugin manifest", () => {expect(declaredHooks).toEqual(expectedHermesHooks);});- it("preloads AGENTMEMORY_URL default at import time (#520)", () => {+ it("preloads AGENTMEMORY_URL default at import time", () => {const source = readFileSync("integrations/hermes/__init__.py", "utf8");expect(source).toMatch(/os\.environ\.setdefault\(\s*["']AGENTMEMORY_URL["']\s*,\s*DEFAULT_BASE_URL\s*\)/,diff --git a/test/mcp-surface-default.test.ts b/test/mcp-surface-default.test.tsindex 835ebaeb..07fa235b 100644--- a/test/mcp-surface-default.test.ts+++ b/test/mcp-surface-default.test.ts@@ -5,7 +5,7 @@ import {getVisibleTools,} from "../src/mcp/tools-registry.js";-// #553: plugin manifests and README advertise 51 MCP tools. The old+// plugin manifests and README advertise 51 MCP tools. The old// default was AGENTMEMORY_TOOLS=core which silently capped the surface// at 8 essentials with no indication the other 43 existed. Default// flipped to "all"; the lean set is still accessible viadiff --git a/test/memories-pagination.test.ts b/test/memories-pagination.test.tsindex c7ad7586..c3275df6 100644--- a/test/memories-pagination.test.ts+++ b/test/memories-pagination.test.ts@@ -1,7 +1,7 @@import { describe, it, expect } from "vitest";import { readFileSync } from "node:fs";-// #544: /memories and /export must support count + pagination so the+// /memories and /export must support count + pagination so the// viewer and `agentmemory status` work on large corpora (8K+ memories)// without timing out at the iii engine boundary.describe("memories + export pagination (#544)", () => {diff --git a/test/opencode-auto-context.test.ts b/test/opencode-auto-context.test.tsindex c00593cb..3ed49590 100644--- a/test/opencode-auto-context.test.ts+++ b/test/opencode-auto-context.test.ts@@ -1,7 +1,7 @@import { describe, it, expect } from "vitest";import { readFileSync } from "node:fs";-// #431: OpenCode plugin needs zero-config memory injection. Plugin+// OpenCode plugin needs zero-config memory injection. Plugin// already wires experimental.chat.system.transform; this PR threads// the /session/start context through a cache so injection happens// without a second /context fetch and is documented as thediff --git a/test/viewer-graph-cooldown.test.ts b/test/viewer-graph-cooldown.test.tsindex d5bf49a2..267301f9 100644--- a/test/viewer-graph-cooldown.test.ts+++ b/test/viewer-graph-cooldown.test.ts@@ -1,11 +1,11 @@import { describe, it, expect } from "vitest";import { readFileSync } from "node:fs";-// #563: viewer graph kept bouncing on >1000 nodes because damping+// viewer graph kept bouncing on >1000 nodes because damping// alone could not bleed off the per-frame force pile-up. Cool-down// adds tick-decayed damping, a per-node velocity cap, and parks the// raf loop when total kinetic energy drops below an epsilon.-describe("viewer graph cool-down (#563)", () => {+describe("viewer graph cool-down", () => {const viewer = readFileSync("src/viewer/index.html", "utf-8");it("tracks a tickCount that grows each simulation step", () => {