Compare commits

..
Author SHA1 Message Date
Peter Steinberger 21ed547bfc fix: add session-memory test/docs tweak (#1464) (thanks @alfranli123) 2026-01-22 21:40:00 +00:00
Al 773dad256e fix(session-memory): suppress user-visible confirmation message
The session-memory hook saves session context to memory files when /new is run,
which is useful internal housekeeping. However, the confirmation message that
was displayed to users (showing the file path) leaked implementation details.

This change removes the user-visible message while keeping the console.log
for debugging purposes. The hook continues to save session context silently.
2026-01-22 15:22:20 -05:00
4 changed files with 47 additions and 5 deletions

No files matched your search

+1
View File
@@ -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
+1 -1
View File
@@ -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 `<workspace>/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
@@ -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<string, unknown> = {
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");
});
});
+2 -4
View File
@@ -160,11 +160,9 @@ const saveSessionToMemory: HookHandler = async (event) => {
await fs.writeFile(memoryFilePath, entry, "utf-8");
console.log("[session-memory] Memory file written successfully");
// Send confirmation message to user with filename
// Log completion (but don't send user-visible confirmation - it's internal housekeeping)
const relPath = memoryFilePath.replace(os.homedir(), "~");
const confirmMsg = `💾 Session context saved to memory before reset.\n📄 ${relPath}`;
event.messages.push(confirmMsg);
console.log("[session-memory] Confirmation message queued:", confirmMsg);
console.log(`[session-memory] Session context saved to ${relPath}`);
} catch (err) {
console.error(
"[session-memory] Failed to save session memory:",