diff --git a/src/tools/crud.ts b/src/tools/crud.ts index 3198291..800b51e 100644 --- a/src/tools/crud.ts +++ b/src/tools/crud.ts @@ -14,7 +14,7 @@ import * as os from 'os'; /** * Get current session ID from environment or cache file */ -function getSessionId(): string { +export function getSessionId(): string { // Check environment first if (process.env.CLAUDE_SESSION_ID) { return process.env.CLAUDE_SESSION_ID; diff --git a/src/tools/session-docs.ts b/src/tools/session-docs.ts index 57f1817..da94656 100644 --- a/src/tools/session-docs.ts +++ b/src/tools/session-docs.ts @@ -3,6 +3,7 @@ import { query, queryOne, execute } from '../db.js'; import { getEmbedding, formatEmbedding } from '../embeddings.js'; +import { getSessionId } from './crud.js'; // ============================================================================ // SESSION NOTES @@ -32,7 +33,8 @@ interface SessionNote { * Auto-generates embedding for semantic search */ export async function sessionNoteAdd(args: SessionNoteAddArgs): Promise { - const { session_id, note_type, content } = args; + const { session_id: providedSessionId, note_type, content } = args; + const session_id = providedSessionId || getSessionId(); // Generate embedding for semantic search const embedding = await getEmbedding(content);