Release v4.3.3: Configurable session display and first-time setup UX

Improvements:
- Made session display count configurable (DISPLAY_SESSION_COUNT = 8)
- Added first-time setup detection with helpful user messaging
- Improved UX: First install message clarifies Plugin Hook Error display
- Cleaned up code comments

Technical changes:
- Updated src/hooks/context-hook.ts (configurable session count)
- Updated src/hooks/user-message-hook.ts (first-time setup detection)
- Rebuilt plugin/scripts/context-hook.js
- Rebuilt plugin/scripts/user-message-hook.js
- Bumped version to 4.3.3 in all metadata files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2025-10-27 01:22:47 -04:00
parent d69a95bd29
commit 3bbacb8fa4
8 changed files with 89 additions and 21 deletions
+9 -6
View File
@@ -1,6 +1,6 @@
/**
* Context Hook - SessionStart
* Consolidated entry point + logic (no try-catch bullshit)
* Consolidated entry point + logic
*/
import path from 'path';
@@ -8,6 +8,9 @@ import { stdin } from 'process';
import { SessionStore } from '../services/sqlite/SessionStore.js';
import { ensureWorkerRunning } from '../shared/worker-utils.js';
// Configuration: Number of sessions to display in context
const DISPLAY_SESSION_COUNT = 8;
export interface SessionStartInput {
session_id?: string;
transcript_path?: string;
@@ -128,14 +131,14 @@ function contextHook(input?: SessionStartInput, useColors: boolean = false, useI
const db = new SessionStore();
// Get last 4 summaries (use 4th for offset calculation)
// Get last N summaries (use N+1 for offset calculation)
const recentSummaries = db.db.prepare(`
SELECT id, sdk_session_id, request, completed, next_steps, created_at, created_at_epoch
FROM session_summaries
WHERE project = ?
ORDER BY created_at_epoch DESC
LIMIT 4
`).all(project) as Array<{ id: number; sdk_session_id: string; request: string | null; completed: string | null; next_steps: string | null; created_at: string; created_at_epoch: number }>;
LIMIT ?
`).all(project, DISPLAY_SESSION_COUNT + 1) as Array<{ id: number; sdk_session_id: string; request: string | null; completed: string | null; next_steps: string | null; created_at: string; created_at_epoch: number }>;
if (recentSummaries.length === 0) {
db.close();
@@ -145,8 +148,8 @@ function contextHook(input?: SessionStartInput, useColors: boolean = false, useI
return `# [${project}] recent context\n\nNo previous sessions found for this project yet.`;
}
// Extract unique session IDs from first 3 summaries
const displaySummaries = recentSummaries.slice(0, 3);
// Extract unique session IDs from first N summaries
const displaySummaries = recentSummaries.slice(0, DISPLAY_SESSION_COUNT);
const sessionIds = [...new Set(displaySummaries.map(s => s.sdk_session_id))];
// Get all observations from these sessions
+29
View File
@@ -9,6 +9,35 @@
import { execSync } from "child_process";
import { join } from "path";
import { homedir } from "os";
import { existsSync } from "fs";
// Check if node_modules exists - if not, this is first run
const pluginDir = join(homedir(), '.claude', 'plugins', 'marketplaces', 'thedotmack');
const nodeModulesPath = join(pluginDir, 'node_modules');
if (!existsSync(nodeModulesPath)) {
// First-time installation - dependencies not yet installed
console.error(`
---
🎉 Note: This appears under Plugin Hook Error, but it's not an error. That's the only option for
user messages in Claude Code UI until a better method is provided.
---
⚠️ Claude-Mem: First-Time Setup
Dependencies have been installed in the background. This only happens once.
💡 TIPS:
• Memories will start generating while you work
• Use /init to write or update your CLAUDE.md for better project context
• Try /clear after one session to see what context looks like
Thank you for installing Claude-Mem!
This message was not added to your startup context, so you can continue working as normal.
`);
process.exit(3);
}
try {
// Cross-platform path to context-hook.js in the installed plugin