diff --git a/CHANGELOG.md b/CHANGELOG.md index 489f15890..654ef9384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Docs: https://docs.clawd.bot ### Fixes - Control UI: ignore bootstrap identity placeholder text for avatar values and fall back to the default avatar. https://docs.clawd.bot/cli/agents https://docs.clawd.bot/web/control-ui +- Hooks: suppress session-memory confirmation output. (#1464) Thanks @alfranli123. ## 2026.1.21 diff --git a/src/hooks/bundled/session-memory/HOOK.md b/src/hooks/bundled/session-memory/HOOK.md index cc3eab0a2..89519f710 100644 --- a/src/hooks/bundled/session-memory/HOOK.md +++ b/src/hooks/bundled/session-memory/HOOK.md @@ -26,7 +26,7 @@ When you run `/new` to start a fresh session: 2. **Extracts conversation** - Reads the last 15 lines of conversation from the session 3. **Generates descriptive slug** - Uses LLM to create a meaningful filename slug based on conversation content 4. **Saves to memory** - Creates a new file at `/memory/YYYY-MM-DD-slug.md` -5. **Sends confirmation** - Notifies you with the file path +5. **Logs completion** - Writes the file path to logs (no user-visible confirmation) ## Output Format diff --git a/src/hooks/bundled/session-memory/handler.test.ts b/src/hooks/bundled/session-memory/handler.test.ts new file mode 100644 index 000000000..4d40fc36c --- /dev/null +++ b/src/hooks/bundled/session-memory/handler.test.ts @@ -0,0 +1,43 @@ +import fs from "node:fs/promises"; +import path from "node:path"; + +import { describe, expect, it } from "vitest"; + +import handler from "./handler.js"; +import { createHookEvent } from "../../hooks.js"; +import type { ClawdbotConfig } from "../../../config/config.js"; +import { makeTempWorkspace } from "../../../test-helpers/workspace.js"; + +describe("session-memory hook", () => { + it("writes a memory entry without queuing a user confirmation", async () => { + const workspaceDir = await makeTempWorkspace("clawdbot-session-memory-"); + const cfg: ClawdbotConfig = { + agents: { + defaults: { + workspace: workspaceDir, + }, + }, + }; + const context: Record = { + cfg, + sessionEntry: { + sessionId: "session-123", + sessionFile: "", + }, + commandSource: "test", + }; + + const event = createHookEvent("command", "new", "agent:main:main", context); + await handler(event); + + expect(event.messages).toEqual([]); + + const memoryDir = path.join(workspaceDir, "memory"); + const files = await fs.readdir(memoryDir); + expect(files).toHaveLength(1); + + const entry = await fs.readFile(path.join(memoryDir, files[0] ?? ""), "utf-8"); + expect(entry).toContain("Session Key"); + expect(entry).toContain("session-123"); + }); +});