#1 Persistent memory for AI coding agents based on real-world benchmarks
TypeScript agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryompopenclawopencodepi
fix(memory): honest memory_forget reporting + lesson delete path (#1132)
Som Samantray5023cf3ccbbe
diff --git a/AGENTS.md b/AGENTS.mdindex 762b9b74..6f64946f 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -116,7 +116,7 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import).## Current Stats (v0.9.28)-- 53 MCP tools (8 visible by default, `AGENTMEMORY_TOOLS=all` for all)+- 54 MCP tools (8 visible by default, `AGENTMEMORY_TOOLS=all` for all)- 129 REST endpoints- 6 MCP resources, 3 MCP prompts- 12 hooks, 15 skillsdiff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.mdindex f368220b..18c78d3b 100644--- a/INSTALL_FOR_AGENTS.md+++ b/INSTALL_FOR_AGENTS.md@@ -80,7 +80,7 @@ agentmemory connect <agent>If you cannot tell which agent you are, default to `claude-code`. After wiring, restart the agent or run its MCP reload command (for example `/mcp` in Claude Code) so it picks up the server.-Expect: the agent now lists agentmemory's tools. With the server running you should see the full set of 53 tools (for example `memory_save`, `memory_smart_search`, `memory_sessions`). If you see only 7 tools, the MCP shim could not reach a server, see Troubleshooting.+Expect: the agent now lists agentmemory's tools. With the server running you should see the full set of 54 tools (for example `memory_save`, `memory_smart_search`, `memory_sessions`). If you see only 7 tools, the MCP shim could not reach a server, see Troubleshooting.## 6. Install native skills@@ -128,7 +128,7 @@ These are off by default because they spend tokens. Enable them only if the user## Tool surface-The MCP server exposes 53 tools by default (`--tools all`). Use `--tools core` (or `AGENTMEMORY_TOOLS=core`) for a lean 8-tool set on hosts with tight tool limits. The 8 core tools cover save, recall, consolidate, smart search, sessions, diagnose, lesson save, and reflect.+The MCP server exposes 54 tools by default (`--tools all`). Use `--tools core` (or `AGENTMEMORY_TOOLS=core`) for a lean 8-tool set on hosts with tight tool limits. The 8 core tools cover save, recall, consolidate, smart search, sessions, diagnose, lesson save, and reflect.## Lifecycle commandsdiff --git a/README.md b/README.mdindex 0c4ea33e..332e2010 100644--- a/README.md+++ b/README.md@@ -47,7 +47,7 @@<p align="center"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-recall.svg"><img src="assets/tags/stat-recall.svg" alt="95.2% retrieval R@5" height="38" /></picture><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tokens.svg"><img src="assets/tags/stat-tokens.svg" alt="92% fewer tokens" height="38" /></picture>- <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tools.svg"><img src="assets/tags/stat-tools.svg" alt="53 MCP tools" height="38" /></picture>+ <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tools.svg"><img src="assets/tags/stat-tools.svg" alt="54 MCP tools" height="38" /></picture><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-hooks.svg"><img src="assets/tags/stat-hooks.svg" alt="12 auto hooks" height="38" /></picture><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-deps.svg"><img src="assets/tags/stat-deps.svg" alt="0 external DBs" height="38" /></picture><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tests.svg"><img src="assets/tags/stat-tests.svg" alt="1,428+ tests passing" height="38" /></picture>@@ -511,7 +511,7 @@ Implementation details live in `src/cli.ts` (see `runUpgrade` around the `src/cl### Claude Code (one block, paste it)```text-Install agentmemory: run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server. Then run `/plugin marketplace add rohitg00/agentmemory` and `/plugin install agentmemory` — the plugin registers all 12 hooks, 15 skills, AND auto-wires the `@agentmemory/mcp` stdio server via its `.mcp.json`, so you get 53 MCP tools (memory_smart_search, memory_save, memory_sessions, memory_governance_delete, etc.) without any extra config step. Verify with `curl http://localhost:3111/agentmemory/health`. The real-time viewer is at http://localhost:3113.+Install agentmemory: run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server. Then run `/plugin marketplace add rohitg00/agentmemory` and `/plugin install agentmemory` — the plugin registers all 12 hooks, 15 skills, AND auto-wires the `@agentmemory/mcp` stdio server via its `.mcp.json`, so you get 54 MCP tools (memory_smart_search, memory_save, memory_sessions, memory_governance_delete, etc.) without any extra config step. Verify with `curl http://localhost:3111/agentmemory/health`. The real-time viewer is at http://localhost:3113.```#### Claude Code without the plugin install (MCP-standalone path)@@ -540,7 +540,7 @@ codex plugin add agentmemory@agentmemoryThe Codex plugin ships from the same `plugin/` directory as the Claude Code plugin. It registers:-- `@agentmemory/mcp` as an MCP server (proxies all 53 tools when `AGENTMEMORY_URL` points at a running agentmemory server; falls back to 7 tools locally when no server is reachable)+- `@agentmemory/mcp` as an MCP server (proxies all 54 tools when `AGENTMEMORY_URL` points at a running agentmemory server; falls back to 7 tools locally when no server is reachable)- 6 lifecycle hooks: `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, `Stop`- 8 invocable skills: `/recall`, `/remember`, `/session-history`, `/forget`, `/recap`, `/handoff`, `/commit-context`, `/commit-history`, plus 7 reference skills the agent loads on demand (MCP tools, REST API, config, agents, hooks, architecture, and the skill-authoring guide)@@ -574,7 +574,7 @@ copilot plugin install rohitg00/agentmemory:plugin<summary><b>OpenClaw (paste this prompt)</b></summary>```text-Install agentmemory for OpenClaw. Run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server on localhost:3111. Then add this to my OpenClaw MCP config so agentmemory is available with all 53 memory tools:+Install agentmemory for OpenClaw. Run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server on localhost:3111. Then add this to my OpenClaw MCP config so agentmemory is available with all 54 memory tools:{"mcpServers": {@@ -599,7 +599,7 @@ Full guide: [`integrations/openclaw/`](integrations/openclaw/)<summary><b>Hermes Agent (paste this prompt)</b></summary>```text-Install agentmemory for Hermes. Run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server on localhost:3111. Then add this to ~/.hermes/config.yaml so Hermes can use agentmemory as an MCP server with all 53 memory tools:+Install agentmemory for Hermes. Run `npx @agentmemory/agentmemory` in a separate terminal to start the memory server on localhost:3111. Then add this to ~/.hermes/config.yaml so Hermes can use agentmemory as an MCP server with all 54 memory tools:mcp_servers:agentmemory:@@ -956,11 +956,11 @@ npm install @huggingface/transformers<h2 id="mcp-server"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-mcp.svg"><img src="assets/tags/section-mcp.svg" alt="MCP Server" height="32" /></picture></h2>-53 tools, 6 resources, 3 prompts, and 15 skills, the most comprehensive MCP memory toolkit for any agent.+54 tools, 6 resources, 3 prompts, and 15 skills, the most comprehensive MCP memory toolkit for any agent.-> **MCP shim vs full server:** the published `@agentmemory/mcp` package is a thin shim. It exposes the full 53-tool surface **only when it can reach a running agentmemory server** via `AGENTMEMORY_URL` (proxy mode). With no server reachable, the shim falls back to a 7-tool local set (`memory_save`, `memory_recall`, `memory_smart_search`, `memory_sessions`, `memory_export`, `memory_audit`, `memory_governance_delete`). The `AGENTMEMORY_TOOLS=core|all` env var is a *server-side* flag — setting it in the shim's `env` block has no effect. If you see only 7 tools in Cursor / OpenCode / Gemini CLI, start `npx @agentmemory/agentmemory` (or the Docker stack) and set `AGENTMEMORY_URL=http://localhost:3111`.+> **MCP shim vs full server:** the published `@agentmemory/mcp` package is a thin shim. It exposes the full 54-tool surface **only when it can reach a running agentmemory server** via `AGENTMEMORY_URL` (proxy mode). With no server reachable, the shim falls back to a 7-tool local set (`memory_save`, `memory_recall`, `memory_smart_search`, `memory_sessions`, `memory_export`, `memory_audit`, `memory_governance_delete`). The `AGENTMEMORY_TOOLS=core|all` env var is a *server-side* flag — setting it in the shim's `env` block has no effect. If you see only 7 tools in Cursor / OpenCode / Gemini CLI, start `npx @agentmemory/agentmemory` (or the Docker stack) and set `AGENTMEMORY_URL=http://localhost:3111`.-### 53 Tools+### 54 Tools<details><summary>Core tools (always available)</summary>@@ -982,7 +982,7 @@ npm install @huggingface/transformers</details><details>-<summary>Extended tools (53 total — set AGENTMEMORY_TOOLS=all)</summary>+<summary>Extended tools (54 total — set AGENTMEMORY_TOOLS=all)</summary>| Tool | Description ||------|-------------|@@ -1490,7 +1490,7 @@ Create `~/.agentmemory/.env`:# USER_ID=# TEAM_MODE=private-# Tool visibility: "core" (8 tools, lean fallback) or "all" (53 tools)+# Tool visibility: "core" (8 tools, lean fallback) or "all" (54 tools)# AGENTMEMORY_TOOLS=core```diff --git a/assets/tags/light/stat-tools.svg b/assets/tags/light/stat-tools.svgindex e6d59853..9ed07e9f 100644--- a/assets/tags/light/stat-tools.svg+++ b/assets/tags/light/stat-tools.svg@@ -1,5 +1,5 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 48" fill="none" role="img" aria-label="MCP TOOLS: 53">+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 48" fill="none" role="img" aria-label="MCP TOOLS: 54"><rect x="0" y="0" width="140" height="48" rx="10" fill="#FFFFFF" stroke="#E5E7EB" stroke-width="1"/>- <text x="70" y="24" fill="#EA580C" font-family='ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif' font-size="18" font-weight="900" text-anchor="middle" letter-spacing="-0.3">53</text>+ <text x="70" y="24" fill="#EA580C" font-family='ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif' font-size="18" font-weight="900" text-anchor="middle" letter-spacing="-0.3">54</text><text x="70" y="38" fill="#64748B" font-family='ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif' font-size="9" font-weight="600" text-anchor="middle" letter-spacing="1.5">MCP TOOLS</text></svg>diff --git a/assets/tags/stat-tools.svg b/assets/tags/stat-tools.svgindex 2f38d7a1..57c3dc4e 100644--- a/assets/tags/stat-tools.svg+++ b/assets/tags/stat-tools.svg@@ -1,5 +1,5 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 48" fill="none" role="img" aria-label="MCP TOOLS: 53">+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 48" fill="none" role="img" aria-label="MCP TOOLS: 54"><rect x="0" y="0" width="140" height="48" rx="10" fill="#1A1A1A" stroke="#2A2A2A" stroke-width="1"/>- <text x="70" y="24" fill="#FF6B35" font-family='ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif' font-size="18" font-weight="900" text-anchor="middle" letter-spacing="-0.3">53</text>+ <text x="70" y="24" fill="#FF6B35" font-family='ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif' font-size="18" font-weight="900" text-anchor="middle" letter-spacing="-0.3">54</text><text x="70" y="38" fill="#9CA3AF" font-family='ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif' font-size="9" font-weight="600" text-anchor="middle" letter-spacing="1.5">MCP TOOLS</text></svg>diff --git a/plugin/.claude-plugin/plugin.json b/plugin/.claude-plugin/plugin.jsonindex 49d4bacb..27bdc81e 100644--- a/plugin/.claude-plugin/plugin.json+++ b/plugin/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "agentmemory","version": "0.9.28",- "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 53 MCP tools, 8 skills, real-time viewer.",+ "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 54 MCP tools, 8 skills, real-time viewer.","author": {"name": "Rohit Ghumare","url": "https://github.com/rohitg00"diff --git a/plugin/.codex-plugin/plugin.json b/plugin/.codex-plugin/plugin.jsonindex 9d350289..ad262621 100644--- a/plugin/.codex-plugin/plugin.json+++ b/plugin/.codex-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "agentmemory","version": "0.9.28",- "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 6 hooks, 53 MCP tools, 8 skills, real-time viewer.",+ "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 6 hooks, 54 MCP tools, 8 skills, real-time viewer.","author": {"name": "Rohit Ghumare","url": "https://github.com/rohitg00"diff --git a/plugin/opencode/README.md b/plugin/opencode/README.mdindex 60f5e5bb..6bcc4b32 100644--- a/plugin/opencode/README.md+++ b/plugin/opencode/README.md@@ -9,7 +9,7 @@</p><p align="center">- <img src="https://img.shields.io/badge/MCP-53_tools-1f6feb?style=flat-square" alt="53 MCP tools" />+ <img src="https://img.shields.io/badge/MCP-54_tools-1f6feb?style=flat-square" alt="54 MCP tools" /><img src="https://img.shields.io/badge/Plugin-22_hooks-1f6feb?style=flat-square" alt="22 hooks" /><img src="https://img.shields.io/badge/Commands-2_slash-1f6feb?style=flat-square" alt="2 slash commands" /><img src="https://img.shields.io/badge/[email protected]%25-00875f?style=flat-square" alt="95.2% R@5" />diff --git a/plugin/plugin.json b/plugin/plugin.jsonindex 7d9cfca1..90d248c5 100644--- a/plugin/plugin.json+++ b/plugin/plugin.json@@ -1,7 +1,7 @@{"name": "agentmemory","version": "0.9.28",- "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 53 MCP tools, 15 skills, real-time viewer.",+ "description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 54 MCP tools, 15 skills, real-time viewer.","author": {"name": "Rohit Ghumare","url": "https://github.com/rohitg00"diff --git a/plugin/skills/agentmemory-mcp-tools/REFERENCE.md b/plugin/skills/agentmemory-mcp-tools/REFERENCE.mdindex 0c556fc7..b6b18583 100644--- a/plugin/skills/agentmemory-mcp-tools/REFERENCE.md+++ b/plugin/skills/agentmemory-mcp-tools/REFERENCE.md@@ -3,7 +3,7 @@Generated from `src/mcp/tools-registry.ts`. Do not edit the block below by hand; run `npm run skills:gen` after changing the registry.<!-- AUTOGEN:tools START - generated by scripts/skills/generate.ts, do not edit by hand -->-agentmemory exposes 53 MCP tools. 8 are in the lean core set (`--tools core` or `AGENTMEMORY_TOOLS=core`); the rest load with `--tools all` (default).+agentmemory exposes 54 MCP tools. 8 are in the lean core set (`--tools core` or `AGENTMEMORY_TOOLS=core`); the rest load with `--tools all` (default).| Tool | Core | Parameters | Purpose || --- | --- | --- | --- |@@ -28,6 +28,7 @@ agentmemory exposes 53 MCP tools. 8 are in the lean core set (`--tools core` or| `memory_heal` | | `categories`: string, `dryRun`: string | Auto-fix all fixable issues found by diagnostics. Unblocks stuck actions, expires stale leases, cleans up orphaned data. || `memory_insight_list` | | `project`: string, `minConfidence`: number, `limit`: number | List synthesized insights, higher-order observations derived from patterns across memories, lessons, and crystals. || `memory_lease` | | `actionId`*: string, `agentId`*: string, `operation`*: string, `result`: string, `ttlMs`: number | Acquire, release, or renew an exclusive lease on an action. Prevents multiple agents from working on the same thing. |+| `memory_lesson_delete` | | `lessonId`*: string | Soft-delete a lesson by id. Deleted lessons are excluded from recall and list; re-saving the same content creates a fresh lesson. || `memory_lesson_recall` | | `query`*: string, `project`: string, `minConfidence`: number, `limit`: number | Search lessons by query. Returns lessons sorted by confidence and recency. Use to check what the agent has learned before making decisions. || `memory_lesson_save` | yes | `content`*: string, `context`: string, `confidence`: number, `project`: string, `tags`: string | Save a lesson learned from this session. Lessons have confidence scores that strengthen when reinforced and decay when not used. Duplicate content auto-strengthens the existing lesson. || `memory_mesh_sync` | | `peerId`: string, `direction`: string | Sync memories and actions with peer agentmemory instances for multi-agent collaboration. |diff --git a/plugin/skills/agentmemory-rest-api/REFERENCE.md b/plugin/skills/agentmemory-rest-api/REFERENCE.mdindex 77e0a5e4..d12ff461 100644--- a/plugin/skills/agentmemory-rest-api/REFERENCE.md+++ b/plugin/skills/agentmemory-rest-api/REFERENCE.md@@ -65,6 +65,7 @@ The REST API is the primary surface. All paths are under `http://localhost:3111`| POST | `/agentmemory/leases/release` || POST | `/agentmemory/leases/renew` || POST | `/agentmemory/lessons` |+| POST | `/agentmemory/lessons/delete` || POST | `/agentmemory/lessons/search` || POST | `/agentmemory/lessons/strengthen` || GET | `/agentmemory/livez` |diff --git a/src/functions/lessons.ts b/src/functions/lessons.tsindex 9e69f464..0314298c 100644--- a/src/functions/lessons.ts+++ b/src/functions/lessons.ts@@ -203,6 +203,32 @@ export function registerLessonsFunctions(sdk: ISdk, kv: StateKV): void {},);+ sdk.registerFunction("mem::lesson-delete",+ async (data: { lessonId: string }) => {+ if (!data.lessonId) {+ return { success: false, error: "lessonId is required" };+ }++ const lesson = await kv.get<Lesson>(KV.lessons, data.lessonId);+ if (!lesson || lesson.deleted) {+ return { success: false, error: "lesson not found" };+ }++ lesson.deleted = true;+ lesson.updatedAt = new Date().toISOString();++ await kv.set(KV.lessons, lesson.id, lesson);++ try {+ await recordAudit(kv, "lesson_delete", "mem::lesson-delete", [+ lesson.id,+ ]);+ } catch {}++ return { success: true, lesson };+ },+ );+sdk.registerFunction("mem::lesson-decay-sweep",async () => {const lessons = await kv.list<Lesson>(KV.lessons);diff --git a/src/functions/remember.ts b/src/functions/remember.tsindex 5cbfb693..759fddb5 100644--- a/src/functions/remember.ts+++ b/src/functions/remember.ts@@ -190,15 +190,17 @@ export function registerRememberFunction(sdk: ISdk, kv: StateKV): void {if (data.memoryId) {const mem = await kv.get<Memory>(KV.memories, data.memoryId);- await kv.delete(KV.memories, data.memoryId);- if (mem?.imageRef) {- await decrementImageRef(kv, sdk, mem.imageRef);+ if (mem) {+ await kv.delete(KV.memories, data.memoryId);+ if (mem.imageRef) {+ await decrementImageRef(kv, sdk, mem.imageRef);+ }+ await deleteAccessLog(kv, data.memoryId);+ getSearchIndex().remove(data.memoryId);+ vectorIndexRemove(data.memoryId);+ deletedMemoryIds.push(data.memoryId);+ deleted++;}- await deleteAccessLog(kv, data.memoryId);- getSearchIndex().remove(data.memoryId);- vectorIndexRemove(data.memoryId);- deletedMemoryIds.push(data.memoryId);- deleted++;}if (diff --git a/src/mcp/server.ts b/src/mcp/server.tsindex dbca07d9..13240003 100644--- a/src/mcp/server.ts+++ b/src/mcp/server.ts@@ -1122,6 +1122,16 @@ export function registerMcpEndpoints(return { status_code: 200, body: { content: [{ type: "text", text: JSON.stringify(lessonRecallResult, null, 2) }] } };}+ case "memory_lesson_delete": {+ if (typeof args.lessonId !== "string" || !args.lessonId.trim()) {+ return { status_code: 400, body: { error: "lessonId is required" } };+ }+ const lessonDeleteResult = await sdk.trigger({ function_id: "mem::lesson-delete", payload: {+ lessonId: args.lessonId.trim(),+ } });+ return { status_code: 200, body: { content: [{ type: "text", text: JSON.stringify(lessonDeleteResult, null, 2) }] } };+ }+case "memory_reflect": {const reflectResult = await sdk.trigger({ function_id: "mem::reflect", payload: {project: args.project,diff --git a/src/mcp/standalone.ts b/src/mcp/standalone.tsindex dd66ecb1..1ace150b 100644--- a/src/mcp/standalone.ts+++ b/src/mcp/standalone.ts@@ -339,7 +339,7 @@ async function handleProxyGeneric(handle: ProxyHandle,): Promise<{ content: Array<{ type: string; text: string }> }> {// Forward to the server's full MCP surface so non-Claude clients can- // reach all 53 tools (lessons, sentinels, slots, signals, graph, …)+ // reach all 54 tools (lessons, sentinels, slots, signals, graph, …)// instead of being capped at the 7 IMPLEMENTED_TOOLS set baked into// this shim. The server validates arguments per tool.const result = (await handle.call("/agentmemory/mcp/call", {diff --git a/src/mcp/tools-registry.ts b/src/mcp/tools-registry.tsindex c4df3499..464cb3b0 100644--- a/src/mcp/tools-registry.ts+++ b/src/mcp/tools-registry.ts@@ -799,6 +799,18 @@ export const V070_TOOLS: McpToolDef[] = [required: ["query"],},},+ {+ name: "memory_lesson_delete",+ description:+ "Soft-delete a lesson by id. Deleted lessons are excluded from recall and list; re-saving the same content creates a fresh lesson.",+ inputSchema: {+ type: "object",+ properties: {+ lessonId: { type: "string", description: "The lesson id (lsn_...)" },+ },+ required: ["lessonId"],+ },+ },{name: "memory_obsidian_export",description:@@ -950,8 +962,8 @@ export function getAllTools(): McpToolDef[] {}// default switched from "core" (8 essential tools) to "all"-// (full 53-tool surface). README and plugin manifests have always-// advertised 53 tools "in proxy mode"; the old default left OpenCode /+// (full 54-tool surface). README and plugin manifests have always+// advertised 54 tools "in proxy mode"; the old default left OpenCode /// Claude Code users seeing 8 with no indication the other tools existed.// Users who want the lean essentials can still set AGENTMEMORY_TOOLS=core.export function getVisibleTools(): McpToolDef[] {diff --git a/src/triggers/api.ts b/src/triggers/api.tsindex ce339ae0..701e8737 100644--- a/src/triggers/api.ts+++ b/src/triggers/api.ts@@ -3197,6 +3197,21 @@ export function registerApiTriggers(});sdk.registerTrigger({ type: "http", function_id: "api::lesson-strengthen", config: { api_path: "/agentmemory/lessons/strengthen", http_method: "POST" } });+ sdk.registerFunction("api::lesson-delete", async (req: ApiRequest) => {+ const denied = checkAuth(req, secret);+ if (denied) return denied;+ const body = req.body as Record<string, unknown>;+ const lessonId = typeof body?.lessonId === "string" ? body.lessonId.trim() : "";+ if (!lessonId) return { status_code: 400, body: { error: "lessonId is required" } };+ const result = await sdk.trigger({ function_id: "mem::lesson-delete", payload: { lessonId } });+ const resp = result as { success?: boolean; error?: string };+ if (resp?.success === false && resp.error === "lesson not found") {+ return { status_code: 404, body: { error: "lesson not found" } };+ }+ return { status_code: 200, body: result };+ });+ sdk.registerTrigger({ type: "http", function_id: "api::lesson-delete", config: { api_path: "/agentmemory/lessons/delete", http_method: "POST" } });+sdk.registerFunction("api::obsidian-export", async (req: ApiRequest) => {const denied = checkAuth(req, secret);if (denied) return denied;diff --git a/src/types.ts b/src/types.tsindex 113daeae..7cda80ff 100644--- a/src/types.ts+++ b/src/types.ts@@ -596,6 +596,7 @@ export interface AuditEntry {| "lesson_save"| "lesson_recall"| "lesson_strengthen"+ | "lesson_delete"| "obsidian_export"| "reflect"| "insight_search"diff --git a/test/lessons.test.ts b/test/lessons.test.tsindex 4a55003e..b55fb597 100644--- a/test/lessons.test.ts+++ b/test/lessons.test.ts@@ -349,4 +349,107 @@ describe("Lessons", () => {expect(after!.confidence).toBeGreaterThan(0.4);});});++ describe("mem::lesson-delete", () => {+ it("soft-deletes an existing lesson", async () => {+ const saved = (await sdk.trigger("mem::lesson-save", {+ content: "Delete me",+ confidence: 0.7,+ })) as { lesson: Lesson };++ const result = (await sdk.trigger("mem::lesson-delete", {+ lessonId: saved.lesson.id,+ })) as { success: boolean; lesson: Lesson };++ expect(result.success).toBe(true);+ expect(result.lesson.deleted).toBe(true);++ const stored = await kv.get<Lesson>("mem:lessons", saved.lesson.id);+ expect(stored!.deleted).toBe(true);+ });++ it("excludes a soft-deleted lesson from recall and list", async () => {+ const saved = (await sdk.trigger("mem::lesson-save", {+ content: "Hide me from recall",+ confidence: 0.9,+ })) as { lesson: Lesson };++ await sdk.trigger("mem::lesson-delete", { lessonId: saved.lesson.id });++ const recall = (await sdk.trigger("mem::lesson-recall", {+ query: "hide recall",+ })) as { lessons: Lesson[] };+ expect(recall.lessons.some((l) => l.id === saved.lesson.id)).toBe(false);++ const list = (await sdk.trigger("mem::lesson-list", {})) as {+ lessons: Lesson[];+ };+ expect(list.lessons.some((l) => l.id === saved.lesson.id)).toBe(false);+ });++ it("returns not found for an already-deleted lesson", async () => {+ const saved = (await sdk.trigger("mem::lesson-save", {+ content: "Double delete",+ })) as { lesson: Lesson };++ await sdk.trigger("mem::lesson-delete", { lessonId: saved.lesson.id });+ const second = (await sdk.trigger("mem::lesson-delete", {+ lessonId: saved.lesson.id,+ })) as { success: boolean; error?: string };++ expect(second.success).toBe(false);+ expect(second.error).toBe("lesson not found");+ });++ it("returns not found for a nonexistent lessonId", async () => {+ const result = (await sdk.trigger("mem::lesson-delete", {+ lessonId: "lsn_nonexistent",+ })) as { success: boolean; error?: string };++ expect(result.success).toBe(false);+ expect(result.error).toBe("lesson not found");+ });++ it("rejects a missing lessonId", async () => {+ const result = (await sdk.trigger("mem::lesson-delete", {})) as {+ success: boolean;+ error?: string;+ };++ expect(result.success).toBe(false);+ expect(result.error).toBe("lessonId is required");+ });++ it("creates a fresh lesson when deleted content is re-saved", async () => {+ const saved = (await sdk.trigger("mem::lesson-save", {+ content: "Resave after delete",+ })) as { lesson: Lesson };++ await sdk.trigger("mem::lesson-delete", { lessonId: saved.lesson.id });++ const resaved = (await sdk.trigger("mem::lesson-save", {+ content: "Resave after delete",+ })) as { action: string; lesson: Lesson };++ expect(resaved.action).toBe("created");+ expect(resaved.lesson.id).toBe(saved.lesson.id);+ expect(resaved.lesson.deleted).toBeUndefined();+ });++ it("records a lesson_delete audit row", async () => {+ const saved = (await sdk.trigger("mem::lesson-save", {+ content: "Audited delete",+ })) as { lesson: Lesson };++ await sdk.trigger("mem::lesson-delete", { lessonId: saved.lesson.id });++ const auditRows = (await kv.list("mem:audit")) as Array<{+ operation: string;+ targetIds: string[];+ }>;+ const row = auditRows.find((r) => r.operation === "lesson_delete");+ expect(row).toBeDefined();+ expect(row!.targetIds).toEqual([saved.lesson.id]);+ });+ });});diff --git a/test/remember-forget-audit.test.ts b/test/remember-forget-audit.test.tsindex 7d17b543..f875b7c0 100644--- a/test/remember-forget-audit.test.ts+++ b/test/remember-forget-audit.test.ts@@ -122,6 +122,40 @@ describe("mem::forget audit coverage (issue #125)", () => {const auditRows = await kv.list("mem:audit");expect(auditRows).toHaveLength(0);});++ // Regression coverage for issue #1120: mem::forget must not report a+ // deletion for ids it never touches (e.g. lesson ids live in KV.lessons,+ // not KV.memories).+ it("returns deleted: 0 for a nonexistent memoryId (lesson id)", async () => {+ const sdk = mockSdk();+ const kv = mockKV();+ registerRememberFunction(sdk as never, kv as never);++ const deleteSpy = vi.spyOn(kv, "delete");+ const result = await sdk.trigger({+ function_id: "mem::forget",+ payload: { memoryId: "lsn_4f9cb07017a7c8ac" },+ });++ expect(result).toEqual({ success: true, deleted: 0 });+ // No-op path must not touch the memories keyspace or search index.+ expect(deleteSpy).not.toHaveBeenCalled();+ expect(getSearchIndex().has("lsn_4f9cb07017a7c8ac")).toBe(false);+ });++ it("emits no audit row when memoryId does not exist", async () => {+ const sdk = mockSdk();+ const kv = mockKV();+ registerRememberFunction(sdk as never, kv as never);++ await sdk.trigger({+ function_id: "mem::forget",+ payload: { memoryId: "lsn_4f9cb07017a7c8ac" },+ });++ const auditRows = await kv.list("mem:audit");+ expect(auditRows).toHaveLength(0);+ });});// Delete paths must tear down the BM25 index entry and synchronouslydiff --git a/test/tool-count-consistency.test.ts b/test/tool-count-consistency.test.tsindex 6e845df0..a5b7b5b5 100644--- a/test/tool-count-consistency.test.ts+++ b/test/tool-count-consistency.test.ts@@ -9,7 +9,7 @@ vi.mock("../src/logger.js", () => ({import { getAllTools, ESSENTIAL_TOOLS } from "../src/mcp/tools-registry.js";const ROOT = join(import.meta.dirname, "..");-const EXPECTED_TOOL_COUNT = 53;+const EXPECTED_TOOL_COUNT = 54;function readText(relativePath: string): string {return readFileSync(join(ROOT, relativePath), "utf-8");