Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions plugin/hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
{
"description": "Claude-mem memory system hooks",
"hooks": {
"Setup": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; \"$_R/scripts/setup.sh\"",
"timeout": 300
}
]
}
],
"SessionStart": [
{
"matcher": "startup|clear|compact",
Expand All @@ -22,11 +10,6 @@
"command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; node \"$_R/scripts/smart-install.js\"",
"timeout": 300
},
{
"type": "command",
"command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" start",
"timeout": 60
},
{
"type": "command",
"command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code context",
Expand Down
4 changes: 2 additions & 2 deletions plugin/scripts/bun-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ function collectStdin() {
resolve(null);
});

// Safety: if no data arrives within 5s, proceed without stdin
// Safety: if no data arrives within 500ms, proceed without stdin
setTimeout(() => {
process.stdin.removeAllListeners();
process.stdin.pause();
resolve(chunks.length > 0 ? Buffer.concat(chunks) : null);
}, 5000);
}, 500);
});
}

Expand Down
4 changes: 1 addition & 3 deletions src/servers/mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,7 @@ async function main() {
setTimeout(async () => {
const workerAvailable = await verifyWorkerConnection();
if (!workerAvailable) {
logger.error('SYSTEM', 'Worker not available', undefined, {});
logger.error('SYSTEM', 'Tools will fail until Worker is started');
logger.error('SYSTEM', 'Start Worker with: npm run worker:restart');
logger.info('SYSTEM', 'Worker not yet available, will connect when ready', undefined, {});
} else {
logger.info('SYSTEM', 'Worker available', undefined, {});
}
Expand Down
4 changes: 2 additions & 2 deletions src/services/infrastructure/ProcessManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export async function aggressiveStartupCleanup(): Promise<void> {

for (const proc of processList) {
const pid = proc.ProcessId;
if (!Number.isInteger(pid) || pid <= 0 || pid === currentPid) continue;
if (!Number.isInteger(pid) || pid <= 0 || pid === currentPid || pid === process.ppid) continue;

const commandLine = proc.CommandLine || '';
const isAggressive = AGGRESSIVE_CLEANUP_PATTERNS.some(p => commandLine.includes(p));
Expand Down Expand Up @@ -518,7 +518,7 @@ export async function aggressiveStartupCleanup(): Promise<void> {
const etime = match[2];
const command = match[3];

if (!Number.isInteger(pid) || pid <= 0 || pid === currentPid) continue;
if (!Number.isInteger(pid) || pid <= 0 || pid === currentPid || pid === process.ppid) continue;

const isAggressive = AGGRESSIVE_CLEANUP_PATTERNS.some(p => command.includes(p));

Expand Down
6 changes: 2 additions & 4 deletions src/services/worker-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1164,10 +1164,8 @@ async function main() {
// sandbox kills. Instead, ensureWorkerStarted() spawns a fully detached
// daemon (detached: true, stdio: 'ignore', child.unref()) that survives
// the hook process's exit and is invisible to Claude Code's sandbox.
const workerReady = await ensureWorkerStarted(port);
if (!workerReady) {
logger.warn('SYSTEM', 'Worker failed to start before hook, handler will proceed gracefully');
}
await ensureWorkerStarted(port) || logger.warn("SYSTEM", "Worker failed to start...");
await waitForReadiness(port, getPlatformTimeout(HOOK_TIMEOUTS.READINESS_WAIT)) || logger.warn("SYSTEM", "Worker readiness timed out before hook, proceeding anyway");

const { hookCommand } = await import('../cli/hook-command.js');
await hookCommand(platform, event);
Expand Down