From bf801603c426f41dd10be008e363562c29279798 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 11 Nov 2026 16:36:40 +0530 Subject: [PATCH 1/7] fix(cli): say when an agent is connected with MCP only An agent connected with MCP only and no hooks captures nothing on its own. Observations are stored only when the agent calls memory_save. connect and status never said so, so users expected automatic capture. connect now prints one line after an MCP-only setup. It names --with-hooks only for adapters that can install hooks, points plugin-based agents at their plugin, and otherwise says the agent must call memory_save. Each adapter declares its capture mode in a new autoCapture field; JSON MCP adapters with a hook installer get "with-hooks" automatically. The status report and the status command warn when the server has no sessions and no capture activity, which means no hook has reached it yet. Sessions come from hooks or imports, never from MCP calls, so the existing session count is the signal. No new storage is added. Signed-off-by: Rohit Ghumare --- src/cli.ts | 4 + src/cli/connect/capture-notice.ts | 23 ++++++ src/cli/connect/claude-code.ts | 1 + src/cli/connect/codex.ts | 1 + src/cli/connect/copilot-cli.ts | 1 + src/cli/connect/cursor.ts | 1 + src/cli/connect/dsh.ts | 1 + src/cli/connect/hermes.ts | 1 + src/cli/connect/index.ts | 3 + src/cli/connect/json-mcp-adapter.ts | 6 +- src/cli/connect/omp.ts | 1 + src/cli/connect/openclaw.ts | 1 + src/cli/connect/opencode.ts | 1 + src/cli/connect/pi.ts | 2 +- src/cli/connect/types.ts | 7 ++ src/functions/status.ts | 17 +++++ test/connect-capture-notice.test.ts | 109 ++++++++++++++++++++++++++++ test/status.test.ts | 29 ++++++++ 18 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 src/cli/connect/capture-notice.ts create mode 100644 test/connect-capture-notice.test.ts diff --git a/src/cli.ts b/src/cli.ts index b2b89ab08d..f267139e9b 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -104,6 +104,7 @@ import { bearerHeaders, resolveClientSecret } from "./secret-store.js"; import { assertComposePortsFree, composeCall, composeRegistryFailureMessage, composeStateRegistryFailure, composeWorkerFailureSummary, ownedComposeProject, readComposeLogFromOffset, startComposeDaemon, writeComposeState, type ComposeStatus } from "./cli/compose-control.js"; import { COMPOSE_WORKER_VERSIONS, composeDownTimeoutMs, composeNamespace } from "./cli/compose-project.js"; import { legacyDockerStateMessage, type LegacyDockerEngineState } from "./cli/legacy-docker-state.js"; +import { NO_HOOK_CAPTURE } from "./functions/status.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); const args = process.argv.slice(2); @@ -1973,6 +1974,9 @@ async function runStatus() { } } p.note(lines.join("\n"), "agentmemory"); + if (Array.isArray(sessionsRes?.sessions) && sessions === 0) { + p.log.warn(`${NO_HOOK_CAPTURE.message}\n${NO_HOOK_CAPTURE.fix}`); + } } catch (err) { p.log.error(err instanceof Error ? err.message : String(err)); process.exit(1); diff --git a/src/cli/connect/capture-notice.ts b/src/cli/connect/capture-notice.ts new file mode 100644 index 0000000000..9dc84ce15f --- /dev/null +++ b/src/cli/connect/capture-notice.ts @@ -0,0 +1,23 @@ +import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; + +export function mcpOnlyCaptureNotice( + adapter: Pick, + opts: Pick, + result: ConnectResult, +): string | null { + if (result.kind !== "installed" && result.kind !== "already-wired") return null; + const mode = adapter.autoCapture; + if (mode === "built-in") return null; + if (opts.withHooks && (mode === "with-hooks" || mode === "plugin-or-with-hooks")) return null; + const lead = `${adapter.displayName}: MCP only. Nothing is captured automatically`; + switch (mode) { + case "with-hooks": + return `${lead}. Rerun with --with-hooks to capture sessions automatically.`; + case "plugin": + return `${lead} unless the agentmemory plugin for ${adapter.displayName} is installed. Without it, the agent must call memory_save to store anything.`; + case "plugin-or-with-hooks": + return `${lead} unless the agentmemory plugin is installed. Install the plugin, or rerun with --with-hooks.`; + default: + return `${lead}. The agent must call memory_save to store anything.`; + } +} diff --git a/src/cli/connect/claude-code.ts b/src/cli/connect/claude-code.ts index 271468bf2e..3ceb5d5f61 100644 --- a/src/cli/connect/claude-code.ts +++ b/src/cli/connect/claude-code.ts @@ -50,6 +50,7 @@ export const adapter: ConnectAdapter = { name: "claude-code", displayName: "Claude Code", category: "native", + autoCapture: "plugin-or-with-hooks", docs: "https://github.com/rohitg00/agentmemory#claude-code-one-block-paste-it", protocolNote: "→ Using MCP. Hooks are also available — see https://github.com/rohitg00/agentmemory#claude-code-one-block-paste-it.", diff --git a/src/cli/connect/codex.ts b/src/cli/connect/codex.ts index b31b35d119..d5f6824d22 100644 --- a/src/cli/connect/codex.ts +++ b/src/cli/connect/codex.ts @@ -64,6 +64,7 @@ export const adapter: ConnectAdapter = { name: "codex", displayName: "Codex CLI", category: "native", + autoCapture: "plugin-or-with-hooks", docs: "https://github.com/rohitg00/agentmemory#codex-cli-codex-plugin-platform", protocolNote: "→ Using MCP. Hooks ship via the Codex plugin; on Codex Desktop, also pass --with-hooks to install the global hooks.json workaround.", diff --git a/src/cli/connect/copilot-cli.ts b/src/cli/connect/copilot-cli.ts index 1f7b43dd87..7f50e37f5b 100644 --- a/src/cli/connect/copilot-cli.ts +++ b/src/cli/connect/copilot-cli.ts @@ -31,6 +31,7 @@ export const adapter: ConnectAdapter = { name: "copilot-cli", displayName: "GitHub Copilot CLI", category: "native", + autoCapture: "plugin", docs: "https://github.com/rohitg00/agentmemory#github-copilot-cli", protocolNote: "→ Using MCP. Install the plugin too for full hooks/skills coverage.", diff --git a/src/cli/connect/cursor.ts b/src/cli/connect/cursor.ts index 642add4efb..63d41a4025 100644 --- a/src/cli/connect/cursor.ts +++ b/src/cli/connect/cursor.ts @@ -8,6 +8,7 @@ export const adapter = createJsonMcpAdapter({ // Cursor speaks lifecycle hooks as well as MCP, so it groups with the // native hosts rather than the MCP-only ones. category: "native", + autoCapture: "plugin", detectDir: join(homedir(), ".cursor"), configPath: join(homedir(), ".cursor", "mcp.json"), docs: "https://github.com/rohitg00/agentmemory#cursor", diff --git a/src/cli/connect/dsh.ts b/src/cli/connect/dsh.ts index f18c93b7e9..48391858c5 100644 --- a/src/cli/connect/dsh.ts +++ b/src/cli/connect/dsh.ts @@ -100,6 +100,7 @@ export const adapter: ConnectAdapter = { protocolNote: "→ Using MCP via $DSH_HOME/cordis.patch.yml (the home-level patch layer every profile loads). Tools appear as mcp__agentmemory__*. Pass --with-hooks to also wire auto-capture with the bundled native DSH plugin.", category: "native", + autoCapture: "with-hooks", detect(): boolean { return existsSync(resolveDshHome()); }, diff --git a/src/cli/connect/hermes.ts b/src/cli/connect/hermes.ts index d7bc5e6b6f..09a7f577b1 100644 --- a/src/cli/connect/hermes.ts +++ b/src/cli/connect/hermes.ts @@ -18,6 +18,7 @@ export const adapter: ConnectAdapter = { name: "hermes", displayName: "Hermes Agent", category: "native", + autoCapture: "built-in", docs: DOCS, protocolNote: "→ Installs the native memory provider and bundled skills into the active Hermes profile. Credentials stay managed by Hermes.", detect: () => existsSync(hermesHome()), diff --git a/src/cli/connect/index.ts b/src/cli/connect/index.ts index 055cb547d3..2de3da9551 100644 --- a/src/cli/connect/index.ts +++ b/src/cli/connect/index.ts @@ -3,6 +3,7 @@ import * as p from "@clack/prompts"; import pc from "picocolors"; import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; import { writeGuideline } from "./guidelines.js"; +import { mcpOnlyCaptureNotice } from "./capture-notice.js"; import { adapter as antigravity } from "./antigravity.js"; import { adapter as antigravityCli } from "./antigravity-cli.js"; import { adapter as claudeCode } from "./claude-code.js"; @@ -129,6 +130,8 @@ export async function runAdapter( ); } } + const captureNotice = mcpOnlyCaptureNotice(adapter, opts, result); + if (captureNotice) p.log.warn(captureNotice); return result; } catch (err) { p.log.error( diff --git a/src/cli/connect/json-mcp-adapter.ts b/src/cli/connect/json-mcp-adapter.ts index 0b76aa754f..d968f73e45 100644 --- a/src/cli/connect/json-mcp-adapter.ts +++ b/src/cli/connect/json-mcp-adapter.ts @@ -1,7 +1,7 @@ import { existsSync, mkdirSync } from "node:fs"; import { dirname } from "node:path"; import * as p from "@clack/prompts"; -import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; +import type { AutoCapture, ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; import { AGENTMEMORY_MCP_BLOCK, backupFile, @@ -23,6 +23,7 @@ export type JsonMcpAdapterConfig = { // JSON MCP config writer is MCP-only by construction; hosts that also // ship hooks (e.g. OpenClaw) pass "native". category?: "native" | "mcp"; + autoCapture?: AutoCapture; // Wrapper key under which servers live. Default "mcpServers". // Zed uses "context_servers"; otherwise same shape. wrapperKey?: string; @@ -47,10 +48,13 @@ export function createJsonMcpAdapter( config: JsonMcpAdapterConfig, ): ConnectAdapter { const wrapperKey = config.wrapperKey ?? "mcpServers"; + const autoCapture: AutoCapture | undefined = + config.autoCapture ?? (config.installHooks ? "with-hooks" : undefined); return { name: config.name, displayName: config.displayName, category: config.category ?? "mcp", + ...(autoCapture !== undefined && { autoCapture }), ...(config.docs !== undefined && { docs: config.docs }), ...(config.protocolNote !== undefined && { protocolNote: config.protocolNote, diff --git a/src/cli/connect/omp.ts b/src/cli/connect/omp.ts index 90a4d59000..d0de985939 100644 --- a/src/cli/connect/omp.ts +++ b/src/cli/connect/omp.ts @@ -22,6 +22,7 @@ export const adapter: ConnectAdapter = { name: "omp", displayName: "Oh My Pi", category: "native", + autoCapture: "built-in", docs: "https://github.com/rohitg00/agentmemory/tree/main/integrations/omp", protocolNote: "Installs native recall, capture and skills. Add --with-mcp for the full memory toolset.", detect: () => { try { const paths = ompPaths(); return existsSync(paths.agent) || existsSync(paths.root); } catch { return false; } }, diff --git a/src/cli/connect/openclaw.ts b/src/cli/connect/openclaw.ts index 6b992a61d7..60ef6b6382 100644 --- a/src/cli/connect/openclaw.ts +++ b/src/cli/connect/openclaw.ts @@ -25,6 +25,7 @@ export const adapter: ConnectAdapter = { name: "openclaw", displayName: "OpenClaw", category: "native", + autoCapture: "built-in", docs: "https://github.com/rohitg00/agentmemory/tree/main/integrations/openclaw", protocolNote: "→ Installs native recall/capture and bundled skills into the active OpenClaw state directory. MCP tools are opt-in with --with-mcp.", detect: () => existsSync(paths().config) || existsSync(paths().state), diff --git a/src/cli/connect/opencode.ts b/src/cli/connect/opencode.ts index 76ddbf63d1..9016ecc1c4 100644 --- a/src/cli/connect/opencode.ts +++ b/src/cli/connect/opencode.ts @@ -45,6 +45,7 @@ export const adapter: ConnectAdapter = { name: "opencode", displayName: "OpenCode", category: "mcp", + autoCapture: "plugin", docs: "https://github.com/rohitg00/agentmemory#other-agents", protocolNote: "Using MCP via ~/.config/opencode/opencode.json (top-level `mcp` key). For full auto-capture, also install the bundled plugin in plugin/opencode/.", diff --git a/src/cli/connect/pi.ts b/src/cli/connect/pi.ts index 8d954fa21d..8489cc9e44 100644 --- a/src/cli/connect/pi.ts +++ b/src/cli/connect/pi.ts @@ -34,7 +34,7 @@ function hasPackage(config: Record, configDir: string, target: } export const adapter: ConnectAdapter = { - name: "pi", displayName: "Pi", category: "native", + name: "pi", displayName: "Pi", category: "native", autoCapture: "built-in", docs: "https://github.com/rohitg00/agentmemory/tree/main/integrations/pi", protocolNote: "Installs native recall, capture and skills. Add --with-mcp for the full memory toolset.", detect: () => existsSync(agentDir()) || existsSync(join(homedir(), ".pi")), diff --git a/src/cli/connect/types.ts b/src/cli/connect/types.ts index 4d71df33cc..2bd9511642 100644 --- a/src/cli/connect/types.ts +++ b/src/cli/connect/types.ts @@ -12,6 +12,12 @@ export type ConnectOptions = { guidelines?: boolean; }; +export type AutoCapture = + | "built-in" + | "with-hooks" + | "plugin" + | "plugin-or-with-hooks"; + export type ConnectAdapter = { name: string; displayName: string; @@ -24,6 +30,7 @@ export type ConnectAdapter = { */ protocolNote?: string; category?: "native" | "mcp"; + autoCapture?: AutoCapture; detect(): boolean; install(opts: ConnectOptions): Promise; }; diff --git a/src/functions/status.ts b/src/functions/status.ts index 6967f7249b..f73401256a 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -487,6 +487,9 @@ export function evaluateStatus(input: StatusInputs): StatusReport { }); } problems.push(...captureProblems(input.capture ?? null, input.now, input.ports.rest)); + if (input.index.sessions === 0 && !captureActivity(input.capture ?? null)) { + problems.push({ level: "warn", code: "no-hook-capture", ...NO_HOOK_CAPTURE }); + } if (input.stateStore && !input.stateStore.ok) { problems.push({ @@ -555,6 +558,20 @@ export function captureRestBase(restPort: number | null): string { return `http://localhost:${restPort ?? 3111}/agentmemory`; } +export const NO_HOOK_CAPTURE = { + message: + "No hook has reached this server yet: there are no sessions, so nothing is captured automatically. An agent connected with MCP only stores observations only when it calls memory_save.", + fix: "Install the agent's hooks: rerun npx @agentmemory/agentmemory connect --with-hooks, or install the agentmemory plugin for that agent. If you only just connected an agent, run one session and check again.", +}; + +function captureActivity(capture: CaptureStatus | null): boolean { + if (!capture) return false; + const inbox = capture.inbox; + const queued = inbox ? inbox.pending + inbox.retrying + inbox.dead : 0; + const spooled = capture.spool.reduce((n, s) => n + s.records, 0); + return capture.sinceStart.accepted > 0 || queued > 0 || spooled > 0; +} + function captureProblems(capture: CaptureStatus | null, now: Date, restPort: number | null): StatusProblem[] { if (!capture) return []; const problems: StatusProblem[] = []; diff --git a/test/connect-capture-notice.test.ts b/test/connect-capture-notice.test.ts new file mode 100644 index 0000000000..70c749f1c0 --- /dev/null +++ b/test/connect-capture-notice.test.ts @@ -0,0 +1,109 @@ +import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { ConnectAdapter } from "../src/cli/connect/types.js"; + +const log = vi.hoisted(() => ({ + info: vi.fn(), + warn: vi.fn(), + step: vi.fn(), + message: vi.fn(), + error: vi.fn(), + success: vi.fn(), +})); +vi.mock("@clack/prompts", () => ({ log })); + +import { mcpOnlyCaptureNotice } from "../src/cli/connect/capture-notice.js"; +import { ADAPTERS, runAdapter } from "../src/cli/connect/index.js"; + +const installed = { kind: "installed" } as const; + +describe("mcpOnlyCaptureNotice", () => { + it("tells MCP-only agents without hook support that the agent must call memory_save", () => { + const notice = mcpOnlyCaptureNotice({ displayName: "Gemini CLI" }, { withHooks: false }, installed); + expect(notice).toBe("Gemini CLI: MCP only. Nothing is captured automatically. The agent must call memory_save to store anything."); + expect(notice).not.toContain("--with-hooks"); + }); + + it("does not suggest --with-hooks when the adapter cannot install hooks, even if the flag was passed", () => { + const notice = mcpOnlyCaptureNotice({ displayName: "Kiro" }, { withHooks: true }, installed); + expect(notice).toContain("memory_save"); + expect(notice).not.toContain("--with-hooks"); + }); + + it("suggests --with-hooks only for adapters that support it", () => { + const notice = mcpOnlyCaptureNotice({ displayName: "Antigravity", autoCapture: "with-hooks" }, { withHooks: false }, installed); + expect(notice).toBe("Antigravity: MCP only. Nothing is captured automatically. Rerun with --with-hooks to capture sessions automatically."); + }); + + it("stays quiet once hooks were requested for an adapter that installs them", () => { + expect(mcpOnlyCaptureNotice({ displayName: "Droid", autoCapture: "with-hooks" }, { withHooks: true }, installed)).toBeNull(); + expect(mcpOnlyCaptureNotice({ displayName: "Codex CLI", autoCapture: "plugin-or-with-hooks" }, { withHooks: true }, installed)).toBeNull(); + }); + + it("points plugin-based agents at their plugin", () => { + const plugin = mcpOnlyCaptureNotice({ displayName: "Cursor", autoCapture: "plugin" }, { withHooks: false }, installed); + expect(plugin).toContain("unless the agentmemory plugin for Cursor is installed"); + expect(plugin).toContain("memory_save"); + expect(plugin).not.toContain("--with-hooks"); + const both = mcpOnlyCaptureNotice({ displayName: "Claude Code", autoCapture: "plugin-or-with-hooks" }, { withHooks: false }, installed); + expect(both).toContain("Install the plugin, or rerun with --with-hooks."); + }); + + it("stays quiet for built-in capture and for results that did not wire anything", () => { + expect(mcpOnlyCaptureNotice({ displayName: "Hermes Agent", autoCapture: "built-in" }, { withHooks: false }, installed)).toBeNull(); + expect(mcpOnlyCaptureNotice({ displayName: "Gemini CLI" }, { withHooks: false }, { kind: "skipped", reason: "exception" })).toBeNull(); + expect(mcpOnlyCaptureNotice({ displayName: "OpenHuman" }, { withHooks: false }, { kind: "stub", reason: "manual" })).toBeNull(); + expect(mcpOnlyCaptureNotice({ displayName: "Gemini CLI" }, { withHooks: false }, { kind: "already-wired" })).not.toBeNull(); + }); +}); + +describe("adapter capture modes", () => { + it("declares how each adapter captures automatically", () => { + const modes = Object.fromEntries(ADAPTERS.map((a) => [a.name, a.autoCapture ?? "none"])); + expect(modes).toMatchObject({ + "claude-code": "plugin-or-with-hooks", + codex: "plugin-or-with-hooks", + cursor: "plugin", + "copilot-cli": "plugin", + opencode: "plugin", + antigravity: "with-hooks", + "antigravity-cli": "with-hooks", + droid: "with-hooks", + devin: "with-hooks", + dsh: "with-hooks", + hermes: "built-in", + openclaw: "built-in", + pi: "built-in", + omp: "built-in", + "gemini-cli": "none", + kiro: "none", + qwen: "none", + zed: "none", + }); + }); +}); + +describe("runAdapter capture notice", () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + const fake = (overrides: Partial = {}): ConnectAdapter => ({ + name: "fake", + displayName: "Fake Agent", + detect: () => true, + install: async () => ({ kind: "installed" }), + ...overrides, + }); + + it("prints the MCP-only line after a hook-less install", async () => { + await runAdapter(fake(), { dryRun: true, force: false, guidelines: false }); + expect(log.warn).toHaveBeenCalledWith( + "Fake Agent: MCP only. Nothing is captured automatically. The agent must call memory_save to store anything.", + ); + }); + + it("does not print it when --with-hooks installed the hooks", async () => { + await runAdapter(fake({ autoCapture: "with-hooks" }), { dryRun: true, force: false, withHooks: true, guidelines: false }); + expect(log.warn).not.toHaveBeenCalled(); + }); +}); diff --git a/test/status.test.ts b/test/status.test.ts index 375f846cc6..6f7995d9ae 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -117,6 +117,35 @@ describe("evaluateStatus", () => { expect(problem?.fix).toMatch(/Restart agentmemory/); }); + it("warns when no hook has ever reached the server", () => { + const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 } })); + expect(codes(report)).toEqual(["no-hook-capture"]); + expect(report.status).toBe("warn"); + const problem = report.problems[0]; + expect(problem.message).toMatch(/nothing is captured automatically/); + expect(problem.message).toMatch(/memory_save/); + expect(problem.fix).toMatch(/--with-hooks/); + }); + + it("skips the no-hook warning while hook captures are in flight or the session count is unknown", () => { + const capture = { + policy: { maxAttempts: 5, retryIntervalMs: 10_000, dedupRetentionHours: 168, inboxMax: 10_000, deadMax: 1000, eventsMax: 100_000 }, + inbox: { pending: 0, retrying: 0, dead: 0, oldestAcceptedAt: null, nextAttemptAt: null, lastError: null }, + sinceStart: { accepted: 0, completed: 0, duplicates: 0, retried: 0, recovered: 0, deadLettered: 0, rejected: 0, pruned: 0 }, + lastSweepAt: null, + lastPruneAt: null, + lastBootDrain: null, + spool: [], + } as unknown as NonNullable; + const empty = { ...inputs().index, sessions: 0 }; + expect(codes(evaluateStatus(inputs({ index: empty, capture })))).toContain("no-hook-capture"); + const accepted = { ...capture, sinceStart: { ...capture.sinceStart, accepted: 2 } }; + expect(codes(evaluateStatus(inputs({ index: empty, capture: accepted })))).not.toContain("no-hook-capture"); + const pending = { ...capture, inbox: { ...capture.inbox!, pending: 1 } }; + expect(codes(evaluateStatus(inputs({ index: empty, capture: pending })))).not.toContain("no-hook-capture"); + expect(codes(evaluateStatus(inputs({ index: { ...empty, sessions: null } })))).not.toContain("no-hook-capture"); + }); + it("notes when the index check timed out instead of claiming the index is fine", () => { const report = evaluateStatus(inputs({ index: { ...inputs().index, missingObservations: null, sessions: null } })); expect(codes(report)).toEqual(["index-check-unavailable"]); From 23772d154b709afc7d05340e520eb77e90fbfd61 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 11 Nov 2026 16:36:40 +0530 Subject: [PATCH 2/7] docs: sync generated stats Run npm run docs:sync after the MCP-only capture notice change. Signed-off-by: Rohit Ghumare --- AGENTS.md | 4 ++-- README.md | 4 ++-- READMEs/README.ar-SA.md | 4 ++-- READMEs/README.bn-BD.md | 4 ++-- READMEs/README.cs-CZ.md | 4 ++-- READMEs/README.da-DK.md | 4 ++-- READMEs/README.de-DE.md | 4 ++-- READMEs/README.el-GR.md | 4 ++-- READMEs/README.es-ES.md | 4 ++-- READMEs/README.fi-FI.md | 4 ++-- READMEs/README.fr-FR.md | 4 ++-- READMEs/README.he-IL.md | 4 ++-- READMEs/README.hi-IN.md | 4 ++-- READMEs/README.hu-HU.md | 4 ++-- READMEs/README.id-ID.md | 4 ++-- READMEs/README.it-IT.md | 4 ++-- READMEs/README.ja-JP.md | 4 ++-- READMEs/README.ko-KR.md | 4 ++-- READMEs/README.nb-NO.md | 4 ++-- READMEs/README.nl-NL.md | 4 ++-- READMEs/README.pl-PL.md | 4 ++-- READMEs/README.pt-BR.md | 4 ++-- READMEs/README.pt-PT.md | 4 ++-- READMEs/README.ro-RO.md | 4 ++-- READMEs/README.ru-RU.md | 4 ++-- READMEs/README.sv-SE.md | 4 ++-- READMEs/README.th-TH.md | 4 ++-- READMEs/README.tl-PH.md | 4 ++-- READMEs/README.tr-TR.md | 4 ++-- READMEs/README.uk-UA.md | 4 ++-- READMEs/README.ur-PK.md | 4 ++-- READMEs/README.vi-VN.md | 4 ++-- READMEs/README.zh-CN.md | 4 ++-- READMEs/README.zh-TW.md | 4 ++-- assets/tags/light/stat-tests.svg | 4 ++-- assets/tags/stat-tests.svg | 4 ++-- scripts/docs-sync.state.json | 4 ++-- 37 files changed, 74 insertions(+), 74 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 3897c7910e..81b4eed6fa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -101,7 +101,7 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import). ## Testing -- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,700+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests. +- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,800+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests. - Before any npm publish: `npm run release:gate` must pass. It installs the packed tarballs into a clean home and runs capture, recovery, restart, export/import, MCP and status checks against the installed CLI (see CONTRIBUTING.md, Release process) - Mock pattern: `vi.mock("iii-sdk")` with mock `sdk.trigger`, `kv.get/set/list` - Test files go in `test/` with `.test.ts` extension @@ -114,4 +114,4 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import). - 6 MCP resources, 3 MCP prompts - 12 hooks, 17 skills - 322+ iii functions -- 4,700+ tests +- 4,800+ tests diff --git a/README.md b/README.md index cd40701a05..7590f939b8 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1313,7 +1313,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ar-SA.md b/READMEs/README.ar-SA.md index 19dfdad2f8..40b6c0699d 100644 --- a/READMEs/README.ar-SA.md +++ b/READMEs/README.ar-SA.md @@ -71,7 +71,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1244,7 +1244,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.bn-BD.md b/READMEs/README.bn-BD.md index a0881d0c27..b16b1f7bd4 100644 --- a/READMEs/README.bn-BD.md +++ b/READMEs/README.bn-BD.md @@ -69,7 +69,7 @@ 54 MCP টুল 12 অটো হুক 0 এক্সটার্নাল ডিবি - 4,700+ টেস্ট পাস + 4,800+ টেস্ট পাস

@@ -1257,7 +1257,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.cs-CZ.md b/READMEs/README.cs-CZ.md index 3837c5eb6e..41c98ab4df 100644 --- a/READMEs/README.cs-CZ.md +++ b/READMEs/README.cs-CZ.md @@ -69,7 +69,7 @@ 54 MCP nástrojů 12 automatických hooks 0 externích databází - 4,700+ testů úspěšně proběhlo + 4,800+ testů úspěšně proběhlo

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.da-DK.md b/READMEs/README.da-DK.md index 209257de1f..6e96f1ad65 100644 --- a/READMEs/README.da-DK.md +++ b/READMEs/README.da-DK.md @@ -69,7 +69,7 @@ 54 MCP-værktøjer 12 automatiske hooks 0 eksterne databaser - 4,700+ beståede tests + 4,800+ beståede tests

@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.de-DE.md b/READMEs/README.de-DE.md index a0b4b683b8..f09b2211b6 100644 --- a/READMEs/README.de-DE.md +++ b/READMEs/README.de-DE.md @@ -69,7 +69,7 @@ 54 MCP-Tools 12 Auto-Hooks 0 externe DBs - 4,700+ bestandene Tests + 4,800+ bestandene Tests

@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.el-GR.md b/READMEs/README.el-GR.md index 49f0fb50b2..20190d727a 100644 --- a/READMEs/README.el-GR.md +++ b/READMEs/README.el-GR.md @@ -69,7 +69,7 @@ 54 εργαλεία MCP 12 αυτόματα hooks 0 εξωτερικές βάσεις δεδομένων - 4,700+ επιτυχημένες δοκιμές + 4,800+ επιτυχημένες δοκιμές

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.es-ES.md b/READMEs/README.es-ES.md index 0cf25dab97..6ca88703a2 100644 --- a/READMEs/README.es-ES.md +++ b/READMEs/README.es-ES.md @@ -69,7 +69,7 @@ 54 tools MCP 12 hooks automáticos 0 bases de datos externas - 4,700+ tests superados + 4,800+ tests superados

@@ -1245,7 +1245,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.fi-FI.md b/READMEs/README.fi-FI.md index c580718e9f..c82e700071 100644 --- a/READMEs/README.fi-FI.md +++ b/READMEs/README.fi-FI.md @@ -69,7 +69,7 @@ 54 MCP-työkalua 12 automaattista hookia 0 ulkoista tietokantaa - 4,700+ testiä läpäisty + 4,800+ testiä läpäisty

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.fr-FR.md b/READMEs/README.fr-FR.md index 3f508c8454..981e72e4f9 100644 --- a/READMEs/README.fr-FR.md +++ b/READMEs/README.fr-FR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1252,7 +1252,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.he-IL.md b/READMEs/README.he-IL.md index 73f6e4a233..313f456302 100644 --- a/READMEs/README.he-IL.md +++ b/READMEs/README.he-IL.md @@ -71,7 +71,7 @@ 54 כלי MCP 12 hooks אוטומטיים 0 מסדי נתונים חיצוניים - 4,700+ בדיקות עוברות + 4,800+ בדיקות עוברות

@@ -1244,7 +1244,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.hi-IN.md b/READMEs/README.hi-IN.md index 4c3a8d31e2..9bed3ca5eb 100644 --- a/READMEs/README.hi-IN.md +++ b/READMEs/README.hi-IN.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1258,7 +1258,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.hu-HU.md b/READMEs/README.hu-HU.md index 20d0e86604..819b196d68 100644 --- a/READMEs/README.hu-HU.md +++ b/READMEs/README.hu-HU.md @@ -69,7 +69,7 @@ 54 MCP eszköz 12 automatikus hook 0 külső adatbázis - 4,700+ sikeres teszt + 4,800+ sikeres teszt

@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.id-ID.md b/READMEs/README.id-ID.md index 855cd4dd52..a5813dcfc8 100644 --- a/READMEs/README.id-ID.md +++ b/READMEs/README.id-ID.md @@ -69,7 +69,7 @@ 54 tool MCP 12 hook otomatis 0 DB eksternal - 4,700+ pengujian lolos + 4,800+ pengujian lolos

@@ -1258,7 +1258,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.it-IT.md b/READMEs/README.it-IT.md index cd396e06e9..a2e6f3aa8e 100644 --- a/READMEs/README.it-IT.md +++ b/READMEs/README.it-IT.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ja-JP.md b/READMEs/README.ja-JP.md index 9dfe1e726c..412d9f4224 100644 --- a/READMEs/README.ja-JP.md +++ b/READMEs/README.ja-JP.md @@ -69,7 +69,7 @@ 54 MCP ツール 12 自動 hooks 外部 DB 0 個 - 4,700+ 件のテストが成功 + 4,800+ 件のテストが成功

@@ -1257,7 +1257,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ko-KR.md b/READMEs/README.ko-KR.md index 4c77e312b0..db1bee6bd2 100644 --- a/READMEs/README.ko-KR.md +++ b/READMEs/README.ko-KR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1256,7 +1256,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.nb-NO.md b/READMEs/README.nb-NO.md index e617bec5e1..def9fa24d0 100644 --- a/READMEs/README.nb-NO.md +++ b/READMEs/README.nb-NO.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.nl-NL.md b/READMEs/README.nl-NL.md index ab0aa4972b..a41ab0bf2e 100644 --- a/READMEs/README.nl-NL.md +++ b/READMEs/README.nl-NL.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1245,7 +1245,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.pl-PL.md b/READMEs/README.pl-PL.md index c24834e624..be1064ea75 100644 --- a/READMEs/README.pl-PL.md +++ b/READMEs/README.pl-PL.md @@ -69,7 +69,7 @@ 54 narzędzia MCP 12 automatycznych hooków 0 zewnętrznych baz danych - 4,700+ zaliczonych testów + 4,800+ zaliczonych testów

@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.pt-BR.md b/READMEs/README.pt-BR.md index 8cba9a4b83..14023e43ce 100644 --- a/READMEs/README.pt-BR.md +++ b/READMEs/README.pt-BR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.pt-PT.md b/READMEs/README.pt-PT.md index c237b780d8..3f2e79bb91 100644 --- a/READMEs/README.pt-PT.md +++ b/READMEs/README.pt-PT.md @@ -69,7 +69,7 @@ 54 ferramentas MCP 12 hooks automáticos 0 bases de dados externas - 4,700+ testes aprovados + 4,800+ testes aprovados

@@ -1245,7 +1245,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ro-RO.md b/READMEs/README.ro-RO.md index 620d55913d..91d70e2ffe 100644 --- a/READMEs/README.ro-RO.md +++ b/READMEs/README.ro-RO.md @@ -69,7 +69,7 @@ 54 de instrumente MCP 12 hook-uri automate 0 baze de date externe - 4,700+ teste trecute + 4,800+ teste trecute

@@ -1237,7 +1237,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ru-RU.md b/READMEs/README.ru-RU.md index 3086998cdd..aed56590dc 100644 --- a/READMEs/README.ru-RU.md +++ b/READMEs/README.ru-RU.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.sv-SE.md b/READMEs/README.sv-SE.md index c29d00dbee..fc2f4d5b80 100644 --- a/READMEs/README.sv-SE.md +++ b/READMEs/README.sv-SE.md @@ -69,7 +69,7 @@ 54 MCP-verktyg 12 automatiska hooks 0 externa databaser - 4,700+ godkända tester + 4,800+ godkända tester

@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.th-TH.md b/READMEs/README.th-TH.md index 49a0e9ce46..fa1bd6d710 100644 --- a/READMEs/README.th-TH.md +++ b/READMEs/README.th-TH.md @@ -69,7 +69,7 @@ 54 เครื่องมือ MCP 12 hook อัตโนมัติ ไม่ต้องพึ่ง external DB เลย - ผ่านการทดสอบ 4,700+ รายการ + ผ่านการทดสอบ 4,800+ รายการ

@@ -1244,7 +1244,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.tl-PH.md b/READMEs/README.tl-PH.md index 9eacba7baf..27cec827c0 100644 --- a/READMEs/README.tl-PH.md +++ b/READMEs/README.tl-PH.md @@ -69,7 +69,7 @@ 54 MCP tool 12 awtomatikong hook 0 panlabas na DB - 4,700+ pumapasang test + 4,800+ pumapasang test

@@ -1253,7 +1253,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.tr-TR.md b/READMEs/README.tr-TR.md index f1aa62a40a..d26df964c2 100644 --- a/READMEs/README.tr-TR.md +++ b/READMEs/README.tr-TR.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.uk-UA.md b/READMEs/README.uk-UA.md index 11019c61fe..08832163f6 100644 --- a/READMEs/README.uk-UA.md +++ b/READMEs/README.uk-UA.md @@ -69,7 +69,7 @@ 54 інструменти MCP 12 автоматичних хуків 0 зовнішніх БД - 4,700+ тестів пройдено + 4,800+ тестів пройдено

@@ -1244,7 +1244,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.ur-PK.md b/READMEs/README.ur-PK.md index a4a9b37b3c..c61fdbc3ef 100644 --- a/READMEs/README.ur-PK.md +++ b/READMEs/README.ur-PK.md @@ -71,7 +71,7 @@ 54 MCP ٹولز 12 خودکار ہکس 0 خارجی ڈیٹابیسز - 4,700+ ٹیسٹس پاس ہو رہے ہیں + 4,800+ ٹیسٹس پاس ہو رہے ہیں

@@ -1248,7 +1248,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.vi-VN.md b/READMEs/README.vi-VN.md index 47177b4c47..6b3d54b63f 100644 --- a/READMEs/README.vi-VN.md +++ b/READMEs/README.vi-VN.md @@ -69,7 +69,7 @@ 54 MCP tools 12 auto hooks 0 external DBs - 4,700+ tests passing + 4,800+ tests passing

@@ -1253,7 +1253,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.zh-CN.md b/READMEs/README.zh-CN.md index 0a5f9c2d05..e7a3f90896 100644 --- a/READMEs/README.zh-CN.md +++ b/READMEs/README.zh-CN.md @@ -69,7 +69,7 @@ 54 个 MCP 工具 12 个自动 hooks 0 个外部数据库 - 4,700+ 项测试通过 + 4,800+ 项测试通过

@@ -1254,7 +1254,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/READMEs/README.zh-TW.md b/READMEs/README.zh-TW.md index c2e315c886..74e1eca426 100644 --- a/READMEs/README.zh-TW.md +++ b/READMEs/README.zh-TW.md @@ -69,7 +69,7 @@ 54 個 MCP 工具 12 個自動 hooks 0 個外部資料庫 - 4,700+ 測試通過 + 4,800+ 測試通過

@@ -1246,7 +1246,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: ```bash npm run dev # Hot reload npm run build # Production build -npm test # 4,700+ tests +npm test # 4,800+ tests npm run test:integration # API tests (requires running services) ``` diff --git a/assets/tags/light/stat-tests.svg b/assets/tags/light/stat-tests.svg index 1b4179cfc2..743b0d095d 100644 --- a/assets/tags/light/stat-tests.svg +++ b/assets/tags/light/stat-tests.svg @@ -1,5 +1,5 @@ - + - 4700+ + 4800+ TESTS PASSING diff --git a/assets/tags/stat-tests.svg b/assets/tags/stat-tests.svg index 2b679ac742..7b4a1c20eb 100644 --- a/assets/tags/stat-tests.svg +++ b/assets/tags/stat-tests.svg @@ -1,5 +1,5 @@ - + - 4700+ + 4800+ TESTS PASSING diff --git a/scripts/docs-sync.state.json b/scripts/docs-sync.state.json index ef3f2b4c6b..3829d237a6 100644 --- a/scripts/docs-sync.state.json +++ b/scripts/docs-sync.state.json @@ -20,13 +20,13 @@ "12" ], "tests": [ - "4700+" + "4800+" ], "functions": [ "323" ], "sourceFiles": [ - "259" + "260" ], "loc": [ "60000" From 396f069398bc95179899dcb228d645983ef86768 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 11 Nov 2026 18:20:57 +0530 Subject: [PATCH 3/7] fix(cli): base the MCP-only notice on hooks that were installed Adapters now report whether their hooks were installed. The connect notice stays quiet only when hooks are confirmed, and it warns when --with-hooks was passed but the hook install was skipped. DSH reports hook rows it keeps in place. connect codex --with-hooks on an already-wired config now installs the hooks before it returns. The no-hook warning in status needs a known capture state. A capture check that timed out no longer triggers it, and the CLI reads the capture endpoint so accepted, queued or spooled captures suppress it. Signed-off-by: Rohit Ghumare --- src/cli.ts | 8 ++++-- src/cli/connect/capture-notice.ts | 12 ++++++-- src/cli/connect/claude-code.ts | 37 ++++++++++++------------- src/cli/connect/codex.ts | 29 +++++++++++-------- src/cli/connect/dsh.ts | 7 +++-- src/cli/connect/json-mcp-adapter.ts | 43 +++++++++++------------------ src/cli/connect/types.ts | 6 ++-- src/functions/status.ts | 9 ++++-- test/codex-connect-hooks.test.ts | 32 ++++++++++++++++++++- test/connect-capture-notice.test.ts | 23 ++++++++++++--- test/status.test.ts | 30 ++++++++++++-------- 11 files changed, 148 insertions(+), 88 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index f267139e9b..bb0091299f 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -104,7 +104,7 @@ import { bearerHeaders, resolveClientSecret } from "./secret-store.js"; import { assertComposePortsFree, composeCall, composeRegistryFailureMessage, composeStateRegistryFailure, composeWorkerFailureSummary, ownedComposeProject, readComposeLogFromOffset, startComposeDaemon, writeComposeState, type ComposeStatus } from "./cli/compose-control.js"; import { COMPOSE_WORKER_VERSIONS, composeDownTimeoutMs, composeNamespace } from "./cli/compose-project.js"; import { legacyDockerStateMessage, type LegacyDockerEngineState } from "./cli/legacy-docker-state.js"; -import { NO_HOOK_CAPTURE } from "./functions/status.js"; +import { NO_HOOK_CAPTURE, hookCaptureMissing } from "./functions/status.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); const args = process.argv.slice(2); @@ -1975,7 +1975,11 @@ async function runStatus() { } p.note(lines.join("\n"), "agentmemory"); if (Array.isArray(sessionsRes?.sessions) && sessions === 0) { - p.log.warn(`${NO_HOOK_CAPTURE.message}\n${NO_HOOK_CAPTURE.fix}`); + const capture = (await apiFetch(base, "capture?limit=1"))?.capture; + const known = capture && typeof capture === "object" && capture.sinceStart && Array.isArray(capture.spool); + if (known && hookCaptureMissing(0, capture)) { + p.log.warn(`${NO_HOOK_CAPTURE.message}\n${NO_HOOK_CAPTURE.fix}`); + } } } catch (err) { p.log.error(err instanceof Error ? err.message : String(err)); diff --git a/src/cli/connect/capture-notice.ts b/src/cli/connect/capture-notice.ts index 9dc84ce15f..080db6fa55 100644 --- a/src/cli/connect/capture-notice.ts +++ b/src/cli/connect/capture-notice.ts @@ -1,4 +1,8 @@ -import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; +import type { ConnectAdapter, ConnectOptions, ConnectResult, HookState } from "./types.js"; + +export function hookState(result: ConnectResult): HookState { + return result.kind === "installed" || result.kind === "already-wired" ? "installed" : "skipped"; +} export function mcpOnlyCaptureNotice( adapter: Pick, @@ -7,9 +11,11 @@ export function mcpOnlyCaptureNotice( ): string | null { if (result.kind !== "installed" && result.kind !== "already-wired") return null; const mode = adapter.autoCapture; - if (mode === "built-in") return null; - if (opts.withHooks && (mode === "with-hooks" || mode === "plugin-or-with-hooks")) return null; + if (mode === "built-in" || result.hooks === "installed") return null; const lead = `${adapter.displayName}: MCP only. Nothing is captured automatically`; + if (opts.withHooks && (mode === "with-hooks" || mode === "plugin-or-with-hooks")) { + return `${lead} because the hooks were not installed. Fix the problem reported above, then rerun with --with-hooks.`; + } switch (mode) { case "with-hooks": return `${lead}. Rerun with --with-hooks to capture sessions automatically.`; diff --git a/src/cli/connect/claude-code.ts b/src/cli/connect/claude-code.ts index 3ceb5d5f61..66bab360cf 100644 --- a/src/cli/connect/claude-code.ts +++ b/src/cli/connect/claude-code.ts @@ -3,7 +3,8 @@ import { homedir } from "node:os"; import { isAbsolute, join, normalize, resolve } from "node:path"; import * as p from "@clack/prompts"; import { isEnvFileValue } from "../../config.js"; -import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; +import type { ConnectAdapter, ConnectOptions, ConnectResult, HookState } from "./types.js"; +import { hookState } from "./capture-notice.js"; import { AGENTMEMORY_MCP_BLOCK, backupFile, @@ -107,22 +108,16 @@ export const adapter: ConnectAdapter = { const alreadyHas = entryMatches(servers["agentmemory"]); if (alreadyHas && !opts.force) { logAlreadyWired("Claude Code", CLAUDE_JSON); - if (opts.withHooks) { - const hookResult = installClaudeHooks(opts); - if (hookResult.kind === "skipped") { - p.log.warn( - `Claude Code hooks fallback skipped: ${hookResult.reason}.`, - ); - } - } - return { kind: "already-wired", mutatedPath: CLAUDE_JSON }; + const hooks = runClaudeHooks(opts, ""); + return { kind: "already-wired", mutatedPath: CLAUDE_JSON, ...(hooks && { hooks }) }; } if (opts.dryRun) { p.log.info( `[dry-run] Would ${alreadyHas ? "overwrite" : "add"} mcpServers.agentmemory in ${CLAUDE_JSON}`, ); - return { kind: "installed", mutatedPath: CLAUDE_JSON }; + const hooks = runClaudeHooks(opts, ""); + return { kind: "installed", mutatedPath: CLAUDE_JSON, ...(hooks && { hooks }) }; } let backupPath: string | undefined; @@ -151,19 +146,21 @@ export const adapter: ConnectAdapter = { "Restart Claude Code (or run `/mcp` inside a session) to pick up the new server.", ); - if (opts.withHooks) { - const hookResult = installClaudeHooks(opts); - if (hookResult.kind === "skipped") { - p.log.warn( - `Claude Code hooks fallback skipped: ${hookResult.reason}. MCP wiring still applied.`, - ); - } - } + const hooks = runClaudeHooks(opts, " MCP wiring still applied."); - return { kind: "installed", mutatedPath: CLAUDE_JSON, backupPath }; + return { kind: "installed", mutatedPath: CLAUDE_JSON, backupPath, ...(hooks && { hooks }) }; }, }; +function runClaudeHooks(opts: ConnectOptions, suffix: string): HookState | undefined { + if (!opts.withHooks) return undefined; + const hookResult = installClaudeHooks(opts); + if (hookResult.kind === "skipped") { + p.log.warn(`Claude Code hooks fallback skipped: ${hookResult.reason}.${suffix}`); + } + return hookState(hookResult); +} + function installClaudeHooks(opts: ConnectOptions): ConnectResult { const { dir: CLAUDE_DIR, settings: CLAUDE_SETTINGS } = claudeConfigPaths(); let pluginRoot: string; diff --git a/src/cli/connect/codex.ts b/src/cli/connect/codex.ts index d5f6824d22..0a247b8e08 100644 --- a/src/cli/connect/codex.ts +++ b/src/cli/connect/codex.ts @@ -2,7 +2,8 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { homedir } from "node:os"; import { join, dirname } from "node:path"; import * as p from "@clack/prompts"; -import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; +import type { ConnectAdapter, ConnectOptions, ConnectResult, HookState } from "./types.js"; +import { hookState } from "./capture-notice.js"; import { backupFile, logAlreadyWired, @@ -80,15 +81,16 @@ export const adapter: ConnectAdapter = { if (wired && !opts.force) { logAlreadyWired("Codex CLI", CODEX_TOML); - return { kind: "already-wired", mutatedPath: CODEX_TOML }; + const hooks = runCodexHooks(opts, ""); + return { kind: "already-wired", mutatedPath: CODEX_TOML, ...(hooks && { hooks }) }; } if (opts.dryRun) { p.log.info( `[dry-run] Would ${wired ? "rewrite" : "append"} [mcp_servers.agentmemory] in ${CODEX_TOML}`, ); - if (opts.withHooks) installCodexHooks(opts); - return { kind: "installed", mutatedPath: CODEX_TOML }; + const hooks = runCodexHooks(opts, ""); + return { kind: "installed", mutatedPath: CODEX_TOML, ...(hooks && { hooks }) }; } let backupPath: string | undefined; @@ -117,23 +119,26 @@ export const adapter: ConnectAdapter = { "Codex picks up MCP servers on next launch. For the deeper plugin install, run: codex plugin marketplace add rohitg00/agentmemory && codex plugin add agentmemory@agentmemory", ); - if (opts.withHooks) { - const hookResult = installCodexHooks(opts); - if (hookResult.kind === "skipped") { - p.log.warn( - `Codex hooks fallback skipped: ${hookResult.reason}. MCP wiring still applied.`, - ); - } - } + const hooks = runCodexHooks(opts, " MCP wiring still applied."); return { kind: "installed", mutatedPath: CODEX_TOML, ...(backupPath !== undefined && { backupPath }), + ...(hooks && { hooks }), }; }, }; +function runCodexHooks(opts: ConnectOptions, suffix: string): HookState | undefined { + if (!opts.withHooks) return undefined; + const hookResult = installCodexHooks(opts); + if (hookResult.kind === "skipped") { + p.log.warn(`Codex hooks fallback skipped: ${hookResult.reason}.${suffix}`); + } + return hookState(hookResult); +} + function installCodexHooks(opts: ConnectOptions): ConnectResult { let pluginRoot: string; try { diff --git a/src/cli/connect/dsh.ts b/src/cli/connect/dsh.ts index 48391858c5..8c9e01f2f7 100644 --- a/src/cli/connect/dsh.ts +++ b/src/cli/connect/dsh.ts @@ -116,6 +116,7 @@ export const adapter: ConnectAdapter = { const hooks = managedEntries(existing, HOOKS_MARKER); const pluginPath = wantHooks ? join(dirname(findPluginRoot()), "dist", "integrations", "dsh.mjs") : ""; const hooksReady = hooks.length === 1 && hooks[0].get("name") === pluginPath && existsSync(pluginPath); + const hookState = wantHooks || hooks.length > 0 ? { hooks: "installed" as const } : {}; if (wantHooks && !opts.force && hooks.some(entry => entry.get("name") === "@deepseek-ai/dsh-hooks-claude-code")) { throw new Error("Legacy DSH hooks bridge found. Run agentmemory connect dsh --with-hooks --force to replace it with the bundled native plugin. Existing manifest files will be preserved."); @@ -123,14 +124,14 @@ export const adapter: ConnectAdapter = { if (hasMcp && (!wantHooks || hooksReady) && !opts.force) { logAlreadyWired(this.displayName, configPath); - return { kind: "already-wired", mutatedPath: configPath }; + return { kind: "already-wired", mutatedPath: configPath, ...hookState }; } if (opts.dryRun) { p.log.info( `[dry-run] Would update the agentmemory mcp-client row${wantHooks ? " and the bundled capture plugin" : ""} in ${configPath}`, ); - return { kind: "installed", mutatedPath: configPath }; + return { kind: "installed", mutatedPath: configPath, ...hookState }; } if (wantHooks && !existsSync(pluginPath)) { @@ -162,6 +163,6 @@ export const adapter: ConnectAdapter = { } logInstalled(this.displayName, configPath); - return { kind: "installed", mutatedPath: configPath, backupPath }; + return { kind: "installed", mutatedPath: configPath, backupPath, ...hookState }; }, }; diff --git a/src/cli/connect/json-mcp-adapter.ts b/src/cli/connect/json-mcp-adapter.ts index d968f73e45..5709fc0ac2 100644 --- a/src/cli/connect/json-mcp-adapter.ts +++ b/src/cli/connect/json-mcp-adapter.ts @@ -1,7 +1,8 @@ import { existsSync, mkdirSync } from "node:fs"; import { dirname } from "node:path"; import * as p from "@clack/prompts"; -import type { AutoCapture, ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; +import type { AutoCapture, ConnectAdapter, ConnectOptions, ConnectResult, HookState } from "./types.js"; +import { hookState } from "./capture-notice.js"; import { AGENTMEMORY_MCP_BLOCK, backupFile, @@ -48,6 +49,14 @@ export function createJsonMcpAdapter( config: JsonMcpAdapterConfig, ): ConnectAdapter { const wrapperKey = config.wrapperKey ?? "mcpServers"; + const runHooks = (opts: ConnectOptions, suffix: string): HookState | undefined => { + if (!opts.withHooks || !config.installHooks) return undefined; + const hookResult = config.installHooks(opts); + if (hookResult.kind === "skipped") { + p.log.warn(`${config.displayName} hooks skipped: ${hookResult.reason}.${suffix}`); + } + return hookState(hookResult); + }; const autoCapture: AutoCapture | undefined = config.autoCapture ?? (config.installHooks ? "with-hooks" : undefined); return { @@ -74,30 +83,16 @@ export function createJsonMcpAdapter( const alreadyHas = entryMatches(servers["agentmemory"]); if (alreadyHas && !opts.force) { logAlreadyWired(config.displayName, config.configPath); - if (opts.withHooks && config.installHooks) { - const hookResult = config.installHooks(opts); - if (hookResult.kind === "skipped") { - p.log.warn( - `${config.displayName} hooks skipped: ${hookResult.reason}.`, - ); - } - } - return { kind: "already-wired", mutatedPath: config.configPath }; + const hooks = runHooks(opts, ""); + return { kind: "already-wired", mutatedPath: config.configPath, ...(hooks && { hooks }) }; } if (opts.dryRun) { p.log.info( `[dry-run] Would ${alreadyHas ? "overwrite" : "add"} ${wrapperKey}.agentmemory in ${config.configPath}`, ); - if (opts.withHooks && config.installHooks) { - const hookResult = config.installHooks(opts); - if (hookResult.kind === "skipped") { - p.log.warn( - `${config.displayName} hooks skipped: ${hookResult.reason}.`, - ); - } - } - return { kind: "installed", mutatedPath: config.configPath }; + const hooks = runHooks(opts, ""); + return { kind: "installed", mutatedPath: config.configPath, ...(hooks && { hooks }) }; } let backupPath: string | undefined; @@ -128,19 +123,13 @@ export function createJsonMcpAdapter( logInstalled(config.displayName, config.configPath); - if (opts.withHooks && config.installHooks) { - const hookResult = config.installHooks(opts); - if (hookResult.kind === "skipped") { - p.log.warn( - `${config.displayName} hooks skipped: ${hookResult.reason}. MCP wiring still applied.`, - ); - } - } + const hooks = runHooks(opts, " MCP wiring still applied."); return { kind: "installed", mutatedPath: config.configPath, ...(backupPath !== undefined && { backupPath }), + ...(hooks && { hooks }), }; }, }; diff --git a/src/cli/connect/types.ts b/src/cli/connect/types.ts index 2bd9511642..6862367a66 100644 --- a/src/cli/connect/types.ts +++ b/src/cli/connect/types.ts @@ -35,8 +35,10 @@ export type ConnectAdapter = { install(opts: ConnectOptions): Promise; }; +export type HookState = "installed" | "skipped"; + export type ConnectResult = - | { kind: "installed"; mutatedPath?: string; backupPath?: string } - | { kind: "already-wired"; mutatedPath?: string } + | { kind: "installed"; mutatedPath?: string; backupPath?: string; hooks?: HookState } + | { kind: "already-wired"; mutatedPath?: string; hooks?: HookState } | { kind: "stub"; reason: string } | { kind: "skipped"; reason: string }; diff --git a/src/functions/status.ts b/src/functions/status.ts index f73401256a..8af328f605 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -487,7 +487,7 @@ export function evaluateStatus(input: StatusInputs): StatusReport { }); } problems.push(...captureProblems(input.capture ?? null, input.now, input.ports.rest)); - if (input.index.sessions === 0 && !captureActivity(input.capture ?? null)) { + if (hookCaptureMissing(input.index.sessions, input.capture)) { problems.push({ level: "warn", code: "no-hook-capture", ...NO_HOOK_CAPTURE }); } @@ -564,8 +564,11 @@ export const NO_HOOK_CAPTURE = { fix: "Install the agent's hooks: rerun npx @agentmemory/agentmemory connect --with-hooks, or install the agentmemory plugin for that agent. If you only just connected an agent, run one session and check again.", }; -function captureActivity(capture: CaptureStatus | null): boolean { - if (!capture) return false; +export function hookCaptureMissing(sessions: number | null, capture: CaptureStatus | null | undefined): boolean { + return sessions === 0 && !!capture && !captureActivity(capture); +} + +function captureActivity(capture: CaptureStatus): boolean { const inbox = capture.inbox; const queued = inbox ? inbox.pending + inbox.retrying + inbox.dead : 0; const spooled = capture.spool.reduce((n, s) => n + s.records, 0); diff --git a/test/codex-connect-hooks.test.ts b/test/codex-connect-hooks.test.ts index 6871ff5ed1..e3fc0c81df 100644 --- a/test/codex-connect-hooks.test.ts +++ b/test/codex-connect-hooks.test.ts @@ -1,4 +1,4 @@ -import { describe, it, expect } from "vitest"; +import { afterEach, beforeEach, describe, it, expect, vi } from "vitest"; import { copyFileSync, writeFileSync, @@ -6,6 +6,7 @@ import { mkdirSync, mkdtempSync, rmSync, + existsSync, } from "node:fs"; import { join, resolve } from "node:path"; import { tmpdir } from "node:os"; @@ -165,3 +166,32 @@ describe("buildMergedHooks file round-trip", () => { } }); }); + +describe("connect codex --with-hooks on an already-wired config", () => { + let home: string; + + beforeEach(() => { + home = mkdtempSync(join(tmpdir(), "am-codex-wired-")); + vi.stubEnv("HOME", home); + vi.stubEnv("USERPROFILE", home); + vi.resetModules(); + }); + + afterEach(() => { + vi.unstubAllEnvs(); + vi.resetModules(); + rmSync(home, { recursive: true, force: true }); + }); + + it("installs the requested hooks and reports them before returning already-wired", async () => { + const { adapter } = await import("../src/cli/connect/codex.js"); + expect(await adapter.install({ dryRun: false, force: false })).toMatchObject({ kind: "installed" }); + const hooksPath = join(home, ".codex", "hooks.json"); + expect(existsSync(hooksPath)).toBe(false); + + const result = await adapter.install({ dryRun: false, force: false, withHooks: true }); + expect(result).toMatchObject({ kind: "already-wired", hooks: "installed" }); + const hooks = JSON.parse(readFileSync(hooksPath, "utf-8")) as HookManifest; + expect(Object.keys(hooks.hooks)).toContain("SessionStart"); + }); +}); diff --git a/test/connect-capture-notice.test.ts b/test/connect-capture-notice.test.ts index 70c749f1c0..61f4102ed9 100644 --- a/test/connect-capture-notice.test.ts +++ b/test/connect-capture-notice.test.ts @@ -34,9 +34,19 @@ describe("mcpOnlyCaptureNotice", () => { expect(notice).toBe("Antigravity: MCP only. Nothing is captured automatically. Rerun with --with-hooks to capture sessions automatically."); }); - it("stays quiet once hooks were requested for an adapter that installs them", () => { - expect(mcpOnlyCaptureNotice({ displayName: "Droid", autoCapture: "with-hooks" }, { withHooks: true }, installed)).toBeNull(); - expect(mcpOnlyCaptureNotice({ displayName: "Codex CLI", autoCapture: "plugin-or-with-hooks" }, { withHooks: true }, installed)).toBeNull(); + it("stays quiet once the adapter reports its hooks as installed", () => { + const withHooks = { kind: "installed", hooks: "installed" } as const; + expect(mcpOnlyCaptureNotice({ displayName: "Droid", autoCapture: "with-hooks" }, { withHooks: true }, withHooks)).toBeNull(); + expect(mcpOnlyCaptureNotice({ displayName: "Codex CLI", autoCapture: "plugin-or-with-hooks" }, { withHooks: true }, { kind: "already-wired", hooks: "installed" })).toBeNull(); + expect(mcpOnlyCaptureNotice({ displayName: "DSH", autoCapture: "with-hooks" }, { withHooks: false }, withHooks)).toBeNull(); + }); + + it("still warns when --with-hooks was passed but the hooks were not installed", () => { + for (const result of [installed, { kind: "installed", hooks: "skipped" } as const, { kind: "already-wired", hooks: "skipped" } as const]) { + expect(mcpOnlyCaptureNotice({ displayName: "Codex CLI", autoCapture: "plugin-or-with-hooks" }, { withHooks: true }, result)).toBe( + "Codex CLI: MCP only. Nothing is captured automatically because the hooks were not installed. Fix the problem reported above, then rerun with --with-hooks.", + ); + } }); it("points plugin-based agents at their plugin", () => { @@ -103,7 +113,12 @@ describe("runAdapter capture notice", () => { }); it("does not print it when --with-hooks installed the hooks", async () => { - await runAdapter(fake({ autoCapture: "with-hooks" }), { dryRun: true, force: false, withHooks: true, guidelines: false }); + await runAdapter(fake({ autoCapture: "with-hooks", install: async () => ({ kind: "installed", hooks: "installed" }) }), { dryRun: true, force: false, withHooks: true, guidelines: false }); expect(log.warn).not.toHaveBeenCalled(); }); + + it("prints it when --with-hooks was passed but the adapter skipped the hooks", async () => { + await runAdapter(fake({ autoCapture: "with-hooks", install: async () => ({ kind: "already-wired", hooks: "skipped" }) }), { dryRun: true, force: false, withHooks: true, guidelines: false }); + expect(log.warn).toHaveBeenCalledWith(expect.stringContaining("because the hooks were not installed")); + }); }); diff --git a/test/status.test.ts b/test/status.test.ts index 6f7995d9ae..44fbca9e85 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -117,8 +117,18 @@ describe("evaluateStatus", () => { expect(problem?.fix).toMatch(/Restart agentmemory/); }); + const idleCapture = { + policy: { maxAttempts: 5, retryIntervalMs: 10_000, dedupRetentionHours: 168, inboxMax: 10_000, deadMax: 1000, eventsMax: 100_000 }, + inbox: { pending: 0, retrying: 0, dead: 0, oldestAcceptedAt: null, nextAttemptAt: null, lastError: null }, + sinceStart: { accepted: 0, completed: 0, duplicates: 0, retried: 0, recovered: 0, deadLettered: 0, rejected: 0, pruned: 0 }, + lastSweepAt: null, + lastPruneAt: null, + lastBootDrain: null, + spool: [], + } as unknown as NonNullable; + it("warns when no hook has ever reached the server", () => { - const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 } })); + const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 }, capture: idleCapture })); expect(codes(report)).toEqual(["no-hook-capture"]); expect(report.status).toBe("warn"); const problem = report.problems[0]; @@ -128,22 +138,20 @@ describe("evaluateStatus", () => { }); it("skips the no-hook warning while hook captures are in flight or the session count is unknown", () => { - const capture = { - policy: { maxAttempts: 5, retryIntervalMs: 10_000, dedupRetentionHours: 168, inboxMax: 10_000, deadMax: 1000, eventsMax: 100_000 }, - inbox: { pending: 0, retrying: 0, dead: 0, oldestAcceptedAt: null, nextAttemptAt: null, lastError: null }, - sinceStart: { accepted: 0, completed: 0, duplicates: 0, retried: 0, recovered: 0, deadLettered: 0, rejected: 0, pruned: 0 }, - lastSweepAt: null, - lastPruneAt: null, - lastBootDrain: null, - spool: [], - } as unknown as NonNullable; + const capture = idleCapture; const empty = { ...inputs().index, sessions: 0 }; expect(codes(evaluateStatus(inputs({ index: empty, capture })))).toContain("no-hook-capture"); const accepted = { ...capture, sinceStart: { ...capture.sinceStart, accepted: 2 } }; expect(codes(evaluateStatus(inputs({ index: empty, capture: accepted })))).not.toContain("no-hook-capture"); const pending = { ...capture, inbox: { ...capture.inbox!, pending: 1 } }; expect(codes(evaluateStatus(inputs({ index: empty, capture: pending })))).not.toContain("no-hook-capture"); - expect(codes(evaluateStatus(inputs({ index: { ...empty, sessions: null } })))).not.toContain("no-hook-capture"); + expect(codes(evaluateStatus(inputs({ index: { ...empty, sessions: null }, capture })))).not.toContain("no-hook-capture"); + }); + + it("does not diagnose missing hooks when the capture check is unavailable", () => { + const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 }, capture: null })); + expect(codes(report)).toContain("capture-check-unavailable"); + expect(codes(report)).not.toContain("no-hook-capture"); }); it("notes when the index check timed out instead of claiming the index is fine", () => { From 64ba162429a4edaeaf2c6a6663a603b9e7fd4026 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 11 Nov 2026 19:28:56 +0530 Subject: [PATCH 4/7] fix(cli): tighten the no-hook capture checks A DSH hook row whose plugin file is gone no longer counts as installed. The plugin-or-with-hooks notice keeps the plugin option when hooks fail. The status check skips the diagnosis when the capture inbox is unreadable and says capture was not observed yet instead of claiming it is off. The CLI counts sessions across all agents and types the capture response. Signed-off-by: Rohit Ghumare --- src/cli.ts | 12 +++++++++--- src/cli/connect/capture-notice.ts | 5 ++++- src/cli/connect/dsh.ts | 6 +++++- src/functions/status.ts | 6 +++--- test/connect-capture-notice.test.ts | 5 ++++- test/connect-dsh.test.ts | 15 +++++++++++++++ test/status.test.ts | 9 ++++++++- 7 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index bb0091299f..da9f14f0ed 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -105,6 +105,7 @@ import { assertComposePortsFree, composeCall, composeRegistryFailureMessage, com import { COMPOSE_WORKER_VERSIONS, composeDownTimeoutMs, composeNamespace } from "./cli/compose-project.js"; import { legacyDockerStateMessage, type LegacyDockerEngineState } from "./cli/legacy-docker-state.js"; import { NO_HOOK_CAPTURE, hookCaptureMissing } from "./functions/status.js"; +import type { CaptureStatus } from "./functions/capture.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); const args = process.argv.slice(2); @@ -1975,9 +1976,14 @@ async function runStatus() { } p.note(lines.join("\n"), "agentmemory"); if (Array.isArray(sessionsRes?.sessions) && sessions === 0) { - const capture = (await apiFetch(base, "capture?limit=1"))?.capture; - const known = capture && typeof capture === "object" && capture.sinceStart && Array.isArray(capture.spool); - if (known && hookCaptureMissing(0, capture)) { + const [allSessions, captureRes] = await Promise.all([ + apiFetch<{ sessions?: unknown }>(base, "sessions?agentId=*&limit=1"), + apiFetch<{ capture?: CaptureStatus | null }>(base, "capture?limit=1"), + ]); + const noSessions = Array.isArray(allSessions?.sessions) && allSessions.sessions.length === 0; + const capture = captureRes?.capture; + const known = !!capture && typeof capture === "object" && !!capture.sinceStart && Array.isArray(capture.spool); + if (noSessions && known && hookCaptureMissing(0, capture)) { p.log.warn(`${NO_HOOK_CAPTURE.message}\n${NO_HOOK_CAPTURE.fix}`); } } diff --git a/src/cli/connect/capture-notice.ts b/src/cli/connect/capture-notice.ts index 080db6fa55..1bab0af935 100644 --- a/src/cli/connect/capture-notice.ts +++ b/src/cli/connect/capture-notice.ts @@ -13,9 +13,12 @@ export function mcpOnlyCaptureNotice( const mode = adapter.autoCapture; if (mode === "built-in" || result.hooks === "installed") return null; const lead = `${adapter.displayName}: MCP only. Nothing is captured automatically`; - if (opts.withHooks && (mode === "with-hooks" || mode === "plugin-or-with-hooks")) { + if (opts.withHooks && mode === "with-hooks") { return `${lead} because the hooks were not installed. Fix the problem reported above, then rerun with --with-hooks.`; } + if (opts.withHooks && mode === "plugin-or-with-hooks") { + return `${adapter.displayName}: MCP only. The hooks were not installed, so nothing is captured automatically unless the agentmemory plugin is installed. Fix the problem reported above and rerun with --with-hooks, or install the plugin.`; + } switch (mode) { case "with-hooks": return `${lead}. Rerun with --with-hooks to capture sessions automatically.`; diff --git a/src/cli/connect/dsh.ts b/src/cli/connect/dsh.ts index 8c9e01f2f7..a097380513 100644 --- a/src/cli/connect/dsh.ts +++ b/src/cli/connect/dsh.ts @@ -116,7 +116,11 @@ export const adapter: ConnectAdapter = { const hooks = managedEntries(existing, HOOKS_MARKER); const pluginPath = wantHooks ? join(dirname(findPluginRoot()), "dist", "integrations", "dsh.mjs") : ""; const hooksReady = hooks.length === 1 && hooks[0].get("name") === pluginPath && existsSync(pluginPath); - const hookState = wantHooks || hooks.length > 0 ? { hooks: "installed" as const } : {}; + const hooksUsable = hooks.some((entry) => { + const name = String(entry.get("name")); + return name === "@deepseek-ai/dsh-hooks-claude-code" || existsSync(name); + }); + const hookState = wantHooks || hooksUsable ? { hooks: "installed" as const } : {}; if (wantHooks && !opts.force && hooks.some(entry => entry.get("name") === "@deepseek-ai/dsh-hooks-claude-code")) { throw new Error("Legacy DSH hooks bridge found. Run agentmemory connect dsh --with-hooks --force to replace it with the bundled native plugin. Existing manifest files will be preserved."); diff --git a/src/functions/status.ts b/src/functions/status.ts index 8af328f605..c46bf1cbad 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -560,12 +560,12 @@ export function captureRestBase(restPort: number | null): string { export const NO_HOOK_CAPTURE = { message: - "No hook has reached this server yet: there are no sessions, so nothing is captured automatically. An agent connected with MCP only stores observations only when it calls memory_save.", - fix: "Install the agent's hooks: rerun npx @agentmemory/agentmemory connect --with-hooks, or install the agentmemory plugin for that agent. If you only just connected an agent, run one session and check again.", + "No capture has been observed yet: there are no sessions and no hook events. An agent connected with MCP only stores observations only when it calls memory_save.", + fix: "Run one agent session, then check again. If there are still no sessions, install the agent's hooks: rerun npx @agentmemory/agentmemory connect --with-hooks, or install the agentmemory plugin for that agent.", }; export function hookCaptureMissing(sessions: number | null, capture: CaptureStatus | null | undefined): boolean { - return sessions === 0 && !!capture && !captureActivity(capture); + return sessions === 0 && !!capture?.inbox && !captureActivity(capture); } function captureActivity(capture: CaptureStatus): boolean { diff --git a/test/connect-capture-notice.test.ts b/test/connect-capture-notice.test.ts index 61f4102ed9..a2da9c6d58 100644 --- a/test/connect-capture-notice.test.ts +++ b/test/connect-capture-notice.test.ts @@ -43,8 +43,11 @@ describe("mcpOnlyCaptureNotice", () => { it("still warns when --with-hooks was passed but the hooks were not installed", () => { for (const result of [installed, { kind: "installed", hooks: "skipped" } as const, { kind: "already-wired", hooks: "skipped" } as const]) { + expect(mcpOnlyCaptureNotice({ displayName: "Droid", autoCapture: "with-hooks" }, { withHooks: true }, result)).toBe( + "Droid: MCP only. Nothing is captured automatically because the hooks were not installed. Fix the problem reported above, then rerun with --with-hooks.", + ); expect(mcpOnlyCaptureNotice({ displayName: "Codex CLI", autoCapture: "plugin-or-with-hooks" }, { withHooks: true }, result)).toBe( - "Codex CLI: MCP only. Nothing is captured automatically because the hooks were not installed. Fix the problem reported above, then rerun with --with-hooks.", + "Codex CLI: MCP only. The hooks were not installed, so nothing is captured automatically unless the agentmemory plugin is installed. Fix the problem reported above and rerun with --with-hooks, or install the plugin.", ); } }); diff --git a/test/connect-dsh.test.ts b/test/connect-dsh.test.ts index e222b64d6c..ea7ccc6467 100644 --- a/test/connect-dsh.test.ts +++ b/test/connect-dsh.test.ts @@ -354,12 +354,27 @@ describe("connect: DeepSeek Harness", () => { expect(readFileSync(configPath, "utf-8")).toBe(existing); }); + it("does not report a hooks row whose plugin file is gone as installed", async () => { + const hooks = await import("../src/cli/connect/codex-hooks.js"); + vi.spyOn(hooks, "findPluginRoot").mockReturnValue(join(home, "install", "plugin")); + const { adapter } = await import("../src/cli/connect/dsh.js"); + await adapter.install({ dryRun: false, force: false }); + const configPath = join(home, ".dsh", "cordis.patch.yml"); + const rows = parseDocument(readFileSync(configPath, "utf-8")).toJS(); + rows.push({ insert: [{ id: "agentmemory-hooks", name: join(home, "install", "dist", "integrations", "dsh.mjs") }] }); + writeFileSync(configPath, JSON.stringify(rows)); + const result = await adapter.install({ dryRun: false, force: false }); + expect(result.kind).toBe("already-wired"); + expect(result.hooks).toBeUndefined(); + }); + it("MCP-only install after --with-hooks keeps the hooks row intact", async () => { mkdirSync(join(home, ".dsh"), { recursive: true }); const { adapter } = await import("../src/cli/connect/dsh.js"); await adapter.install({ dryRun: false, force: false, withHooks: true }); const result = await adapter.install({ dryRun: false, force: false }); expect(result.kind).toBe("already-wired"); + expect(result.hooks).toBe("installed"); const patch = readFileSync(join(home, ".dsh", "cordis.patch.yml"), "utf-8"); expect(patch).toContain("id: agentmemory-hooks"); expect(patch).toContain("serverName: agentmemory"); diff --git a/test/status.test.ts b/test/status.test.ts index 44fbca9e85..dd5da318f9 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -132,7 +132,8 @@ describe("evaluateStatus", () => { expect(codes(report)).toEqual(["no-hook-capture"]); expect(report.status).toBe("warn"); const problem = report.problems[0]; - expect(problem.message).toMatch(/nothing is captured automatically/); + expect(problem.message).toMatch(/No capture has been observed yet/); + expect(problem.fix).toMatch(/^Run one agent session/); expect(problem.message).toMatch(/memory_save/); expect(problem.fix).toMatch(/--with-hooks/); }); @@ -154,6 +155,12 @@ describe("evaluateStatus", () => { expect(codes(report)).not.toContain("no-hook-capture"); }); + it("does not diagnose missing hooks when the capture inbox could not be read", () => { + const capture = { ...idleCapture, inbox: null }; + const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 }, capture })); + expect(codes(report)).not.toContain("no-hook-capture"); + }); + it("notes when the index check timed out instead of claiming the index is fine", () => { const report = evaluateStatus(inputs({ index: { ...inputs().index, missingObservations: null, sessions: null } })); expect(codes(report)).toEqual(["index-check-unavailable"]); From 2a8700703f0d0647e2f3c727680984df3750e202 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 11 Nov 2026 20:23:39 +0530 Subject: [PATCH 5/7] fix(status): treat unreadable capture state as unknown An unreadable capture inbox now reports capture-check-unavailable. The spool summary flags read errors other than a missing file, and the no-hook diagnosis is skipped while the spool cannot be read. A legacy DSH bridge row counts as installed only while its manifest exists. The no-hook message separates memories from observations and only offers hooks or a plugin for agents that support them. Signed-off-by: Rohit Ghumare --- src/capture/spool.ts | 14 ++++++++++++-- src/cli/connect/dsh.ts | 6 ++++-- src/functions/status.ts | 10 +++++----- test/capture-spool.test.ts | 10 +++++++++- test/connect-dsh.test.ts | 13 +++++++++++++ test/status.test.ts | 11 ++++++++++- 6 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/capture/spool.ts b/src/capture/spool.ts index e1e0f6c26a..7f1a0e2ea1 100644 --- a/src/capture/spool.ts +++ b/src/capture/spool.ts @@ -85,6 +85,7 @@ export interface SpoolSummary { maxBytes: number; maxAgeHours: number; stats: SpoolStats; + unreadable?: boolean; } export type SendOutcome = "delivered" | "duplicate" | "rejected" | "retry"; @@ -648,12 +649,18 @@ export function spoolSummary(url: string, options: { policy?: SpoolPolicy; dir?: let bytes = 0; let oldestAt: string | null = null; const files: string[] = []; + let unreadable = false; + const noteError = (err: unknown) => { + if ((err as NodeJS.ErrnoException)?.code !== "ENOENT") unreadable = true; + }; if (existsSync(paths.file)) files.push(paths.file); try { for (const entry of readdirSync(paths.dir)) { if (entry.startsWith(`${paths.name}.draining-`) && entry.endsWith(".jsonl")) files.push(join(paths.dir, entry)); } - } catch {} + } catch (err) { + noteError(err); + } for (const file of files) { try { const text = readFileSync(file, "utf-8"); @@ -662,7 +669,9 @@ export function spoolSummary(url: string, options: { policy?: SpoolPolicy; dir?: records++; if (!oldestAt || rec.spooledAt < oldestAt) oldestAt = rec.spooledAt; } - } catch {} + } catch (err) { + noteError(err); + } } let retained = 0; let retainedBytes = 0; @@ -684,5 +693,6 @@ export function spoolSummary(url: string, options: { policy?: SpoolPolicy; dir?: maxBytes: policy.maxBytes, maxAgeHours: Math.round(policy.maxAgeMs / 3600_000), stats: readSpoolStats(paths), + ...(unreadable ? { unreadable: true } : {}), }; } diff --git a/src/cli/connect/dsh.ts b/src/cli/connect/dsh.ts index a097380513..6f00ff4c8f 100644 --- a/src/cli/connect/dsh.ts +++ b/src/cli/connect/dsh.ts @@ -1,5 +1,5 @@ import { existsSync, mkdirSync, readFileSync } from "node:fs"; -import { dirname, join } from "node:path"; +import { dirname, join, resolve } from "node:path"; import * as p from "@clack/prompts"; import { isMap, isSeq, parseDocument, type YAMLMap } from "yaml"; import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; @@ -118,7 +118,9 @@ export const adapter: ConnectAdapter = { const hooksReady = hooks.length === 1 && hooks[0].get("name") === pluginPath && existsSync(pluginPath); const hooksUsable = hooks.some((entry) => { const name = String(entry.get("name")); - return name === "@deepseek-ai/dsh-hooks-claude-code" || existsSync(name); + if (name !== "@deepseek-ai/dsh-hooks-claude-code") return existsSync(name); + const manifest = entry.getIn(["config", "configPath"]); + return typeof manifest === "string" && manifest.length > 0 && existsSync(resolve(home, manifest)); }); const hookState = wantHooks || hooksUsable ? { hooks: "installed" as const } : {}; diff --git a/src/functions/status.ts b/src/functions/status.ts index c46bf1cbad..e47cf50e29 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -478,11 +478,11 @@ export function evaluateStatus(input: StatusInputs): StatusReport { }); } - if (input.capture === null) { + if (input.capture === null || input.capture?.inbox === null) { problems.push({ level: "info", code: "capture-check-unavailable", - message: "The capture inbox did not answer in time, so capture was not checked.", + message: "The capture inbox could not be read in time, so capture was not checked.", fix: "The check runs again on the next status request. If it keeps timing out, the state store is overloaded: check the server log.", }); } @@ -560,12 +560,12 @@ export function captureRestBase(restPort: number | null): string { export const NO_HOOK_CAPTURE = { message: - "No capture has been observed yet: there are no sessions and no hook events. An agent connected with MCP only stores observations only when it calls memory_save.", - fix: "Run one agent session, then check again. If there are still no sessions, install the agent's hooks: rerun npx @agentmemory/agentmemory connect --with-hooks, or install the agentmemory plugin for that agent.", + "No capture has been observed yet: there are no sessions and no hook events. An agent connected with MCP only records no session observations; it saves long-term memories only when it calls memory_save.", + fix: "Run one agent session, then check again. If there are still no sessions and the agent supports hooks or an agentmemory plugin, rerun npx @agentmemory/agentmemory connect --with-hooks or install the plugin. Agents without either stay MCP only and keep memories only through memory_save.", }; export function hookCaptureMissing(sessions: number | null, capture: CaptureStatus | null | undefined): boolean { - return sessions === 0 && !!capture?.inbox && !captureActivity(capture); + return sessions === 0 && !!capture?.inbox && !capture.spool.some((s) => s.unreadable) && !captureActivity(capture); } function captureActivity(capture: CaptureStatus): boolean { diff --git a/test/capture-spool.test.ts b/test/capture-spool.test.ts index 7deed3393a..238bdf8554 100644 --- a/test/capture-spool.test.ts +++ b/test/capture-spool.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, beforeEach } from "vitest"; -import { mkdtempSync, readFileSync, readdirSync, statSync, writeFileSync, existsSync } from "node:fs"; +import { mkdirSync, mkdtempSync, readFileSync, readdirSync, statSync, writeFileSync, existsSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { @@ -96,6 +96,14 @@ describe("capture spool", () => { expect(summary.stats.lastDropReason).toBe("full"); }); + it("flags a spool it cannot read instead of reporting it empty", () => { + expect(spoolSummary(URL, { dir: join(dir, "missing"), policy }).unreadable).toBeUndefined(); + mkdirSync(spoolPaths(URL, dir).file, { recursive: true }); + const summary = spoolSummary(URL, { dir, policy }); + expect(summary.records).toBe(0); + expect(summary.unreadable).toBe(true); + }); + it("does nothing when the spool is disabled", () => { const r = appendSpool(URL, "evc_eeeeeeeeeeee", body("off"), "unreachable", { dir, policy: { ...policy, enabled: false } }); expect(r).toEqual({ spooled: false, dropped: "disabled" }); diff --git a/test/connect-dsh.test.ts b/test/connect-dsh.test.ts index ea7ccc6467..e512952472 100644 --- a/test/connect-dsh.test.ts +++ b/test/connect-dsh.test.ts @@ -368,6 +368,19 @@ describe("connect: DeepSeek Harness", () => { expect(result.hooks).toBeUndefined(); }); + it("counts a legacy bridge row as installed only while its manifest exists", async () => { + const { adapter } = await import("../src/cli/connect/dsh.js"); + await adapter.install({ dryRun: false, force: false }); + const dir = join(home, ".dsh"); + const configPath = join(dir, "cordis.patch.yml"); + const rows = parseDocument(readFileSync(configPath, "utf-8")).toJS(); + rows.push({ insert: [{ id: "agentmemory-hooks", name: "@deepseek-ai/dsh-hooks-claude-code", config: { configPath: "agentmemory.hooks.json" } }] }); + writeFileSync(configPath, JSON.stringify(rows)); + expect((await adapter.install({ dryRun: false, force: false })).hooks).toBeUndefined(); + writeFileSync(join(dir, "agentmemory.hooks.json"), "{}"); + expect((await adapter.install({ dryRun: false, force: false })).hooks).toBe("installed"); + }); + it("MCP-only install after --with-hooks keeps the hooks row intact", async () => { mkdirSync(join(home, ".dsh"), { recursive: true }); const { adapter } = await import("../src/cli/connect/dsh.js"); diff --git a/test/status.test.ts b/test/status.test.ts index dd5da318f9..a993d1e6d3 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -134,7 +134,8 @@ describe("evaluateStatus", () => { const problem = report.problems[0]; expect(problem.message).toMatch(/No capture has been observed yet/); expect(problem.fix).toMatch(/^Run one agent session/); - expect(problem.message).toMatch(/memory_save/); + expect(problem.message).toMatch(/long-term memories only when it calls memory_save/); + expect(problem.fix).toMatch(/supports hooks or an agentmemory plugin/); expect(problem.fix).toMatch(/--with-hooks/); }); @@ -158,6 +159,14 @@ describe("evaluateStatus", () => { it("does not diagnose missing hooks when the capture inbox could not be read", () => { const capture = { ...idleCapture, inbox: null }; const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 }, capture })); + expect(codes(report)).toContain("capture-check-unavailable"); + expect(codes(report)).not.toContain("no-hook-capture"); + expect(report.status).not.toBe("ok"); + }); + + it("does not diagnose missing hooks when the capture spool could not be read", () => { + const spool = [{ records: 0, unreadable: true, stats: { dropped: 0, lastDropAt: null } }] as unknown as NonNullable["spool"]; + const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 }, capture: { ...idleCapture, spool } })); expect(codes(report)).not.toContain("no-hook-capture"); }); From 036d8f0259efc4b446fb733b9c967aaa00e83488 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 11 Nov 2026 21:06:03 +0530 Subject: [PATCH 6/7] fix(status): report an unreadable spool as an unchecked capture An unreadable spool now adds capture-check-unavailable, so status cannot report that every check passed. The spool summary reads the primary file directly, so an access error is not taken for an empty spool. A legacy DSH bridge row no longer counts as installed hooks; the notice points those users at the bundled plugin through --with-hooks. Signed-off-by: Rohit Ghumare --- src/capture/spool.ts | 2 +- src/cli/connect/dsh.ts | 6 ++---- src/functions/status.ts | 4 ++-- test/connect-dsh.test.ts | 5 ++--- test/status.test.ts | 2 ++ 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/capture/spool.ts b/src/capture/spool.ts index 7f1a0e2ea1..ab7e571421 100644 --- a/src/capture/spool.ts +++ b/src/capture/spool.ts @@ -653,7 +653,7 @@ export function spoolSummary(url: string, options: { policy?: SpoolPolicy; dir?: const noteError = (err: unknown) => { if ((err as NodeJS.ErrnoException)?.code !== "ENOENT") unreadable = true; }; - if (existsSync(paths.file)) files.push(paths.file); + files.push(paths.file); try { for (const entry of readdirSync(paths.dir)) { if (entry.startsWith(`${paths.name}.draining-`) && entry.endsWith(".jsonl")) files.push(join(paths.dir, entry)); diff --git a/src/cli/connect/dsh.ts b/src/cli/connect/dsh.ts index 6f00ff4c8f..91fcb02da4 100644 --- a/src/cli/connect/dsh.ts +++ b/src/cli/connect/dsh.ts @@ -1,5 +1,5 @@ import { existsSync, mkdirSync, readFileSync } from "node:fs"; -import { dirname, join, resolve } from "node:path"; +import { dirname, join } from "node:path"; import * as p from "@clack/prompts"; import { isMap, isSeq, parseDocument, type YAMLMap } from "yaml"; import type { ConnectAdapter, ConnectOptions, ConnectResult } from "./types.js"; @@ -118,9 +118,7 @@ export const adapter: ConnectAdapter = { const hooksReady = hooks.length === 1 && hooks[0].get("name") === pluginPath && existsSync(pluginPath); const hooksUsable = hooks.some((entry) => { const name = String(entry.get("name")); - if (name !== "@deepseek-ai/dsh-hooks-claude-code") return existsSync(name); - const manifest = entry.getIn(["config", "configPath"]); - return typeof manifest === "string" && manifest.length > 0 && existsSync(resolve(home, manifest)); + return name !== "@deepseek-ai/dsh-hooks-claude-code" && existsSync(name); }); const hookState = wantHooks || hooksUsable ? { hooks: "installed" as const } : {}; diff --git a/src/functions/status.ts b/src/functions/status.ts index e47cf50e29..fb57a88fbf 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -478,11 +478,11 @@ export function evaluateStatus(input: StatusInputs): StatusReport { }); } - if (input.capture === null || input.capture?.inbox === null) { + if (input.capture === null || input.capture?.inbox === null || input.capture?.spool.some((s) => s.unreadable)) { problems.push({ level: "info", code: "capture-check-unavailable", - message: "The capture inbox could not be read in time, so capture was not checked.", + message: "The capture inbox or spool could not be read, so capture was not checked.", fix: "The check runs again on the next status request. If it keeps timing out, the state store is overloaded: check the server log.", }); } diff --git a/test/connect-dsh.test.ts b/test/connect-dsh.test.ts index e512952472..7d33e53f3d 100644 --- a/test/connect-dsh.test.ts +++ b/test/connect-dsh.test.ts @@ -368,7 +368,7 @@ describe("connect: DeepSeek Harness", () => { expect(result.hooks).toBeUndefined(); }); - it("counts a legacy bridge row as installed only while its manifest exists", async () => { + it("does not count a legacy bridge row as installed hooks", async () => { const { adapter } = await import("../src/cli/connect/dsh.js"); await adapter.install({ dryRun: false, force: false }); const dir = join(home, ".dsh"); @@ -376,9 +376,8 @@ describe("connect: DeepSeek Harness", () => { const rows = parseDocument(readFileSync(configPath, "utf-8")).toJS(); rows.push({ insert: [{ id: "agentmemory-hooks", name: "@deepseek-ai/dsh-hooks-claude-code", config: { configPath: "agentmemory.hooks.json" } }] }); writeFileSync(configPath, JSON.stringify(rows)); - expect((await adapter.install({ dryRun: false, force: false })).hooks).toBeUndefined(); writeFileSync(join(dir, "agentmemory.hooks.json"), "{}"); - expect((await adapter.install({ dryRun: false, force: false })).hooks).toBe("installed"); + expect((await adapter.install({ dryRun: false, force: false })).hooks).toBeUndefined(); }); it("MCP-only install after --with-hooks keeps the hooks row intact", async () => { diff --git a/test/status.test.ts b/test/status.test.ts index a993d1e6d3..acd740de7e 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -167,7 +167,9 @@ describe("evaluateStatus", () => { it("does not diagnose missing hooks when the capture spool could not be read", () => { const spool = [{ records: 0, unreadable: true, stats: { dropped: 0, lastDropAt: null } }] as unknown as NonNullable["spool"]; const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 }, capture: { ...idleCapture, spool } })); + expect(codes(report)).toContain("capture-check-unavailable"); expect(codes(report)).not.toContain("no-hook-capture"); + expect(report.status).not.toBe("ok"); }); it("notes when the index check timed out instead of claiming the index is fine", () => { From 8b4073c5ded94efc12ed5bff19f266bcd9f55805 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 11 Nov 2026 21:49:48 +0530 Subject: [PATCH 7/7] fix(status): name the unreadable spool path in the capture check fix When a spool cannot be read, the capture-check-unavailable fix now names each spool path and asks the user to check that agentmemory can read it. Signed-off-by: Rohit Ghumare --- src/functions/status.ts | 8 ++++++-- test/status.test.ts | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/functions/status.ts b/src/functions/status.ts index fb57a88fbf..09b15bdfa1 100644 --- a/src/functions/status.ts +++ b/src/functions/status.ts @@ -478,12 +478,16 @@ export function evaluateStatus(input: StatusInputs): StatusReport { }); } - if (input.capture === null || input.capture?.inbox === null || input.capture?.spool.some((s) => s.unreadable)) { + const unreadableSpools = (input.capture?.spool ?? []).filter((s) => s.unreadable).map((s) => s.path); + if (input.capture === null || input.capture?.inbox === null || unreadableSpools.length > 0) { + const spoolFix = unreadableSpools.length > 0 + ? ` Check that the agentmemory process can read ${unreadableSpools.join(", ")} and its folder.` + : ""; problems.push({ level: "info", code: "capture-check-unavailable", message: "The capture inbox or spool could not be read, so capture was not checked.", - fix: "The check runs again on the next status request. If it keeps timing out, the state store is overloaded: check the server log.", + fix: `The check runs again on the next status request. If it keeps timing out, the state store is overloaded: check the server log.${spoolFix}`, }); } problems.push(...captureProblems(input.capture ?? null, input.now, input.ports.rest)); diff --git a/test/status.test.ts b/test/status.test.ts index acd740de7e..6f815b3eec 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -165,11 +165,12 @@ describe("evaluateStatus", () => { }); it("does not diagnose missing hooks when the capture spool could not be read", () => { - const spool = [{ records: 0, unreadable: true, stats: { dropped: 0, lastDropAt: null } }] as unknown as NonNullable["spool"]; + const spool = [{ path: "/tmp/spool/x.jsonl", records: 0, unreadable: true, stats: { dropped: 0, lastDropAt: null } }] as unknown as NonNullable["spool"]; const report = evaluateStatus(inputs({ index: { ...inputs().index, sessions: 0 }, capture: { ...idleCapture, spool } })); expect(codes(report)).toContain("capture-check-unavailable"); expect(codes(report)).not.toContain("no-hook-capture"); expect(report.status).not.toBe("ok"); + expect(report.problems.find((p) => p.code === "capture-check-unavailable")?.fix).toContain("can read /tmp/spool/x.jsonl"); }); it("notes when the index check timed out instead of claiming the index is fine", () => {