Skip to content

Windows: getProjectId() fails due to backslash path separators #6

Description

@silvioduka

Bug

On Windows, the getProjectId() function in all three hook files uses cwd.split('/').pop() which doesn't work because Windows uses backslash (\) as path separator.

Affected files:

  • hooks/claude/session-start.ts
  • hooks/claude/user-prompt.ts
  • hooks/claude/curation.ts

Current code:

function getProjectId(cwd: string): string {
  return cwd.split('/').pop() || 'default'
}

Example: When cwd is E:\Code\claude-toolkit, split('/') returns ['E:\Code\claude-toolkit'] — the entire path as one element. So pop() returns the full path instead of just claude-toolkit.

Fix: Use path.basename() which handles both / and \:

function getProjectId(cwd: string): string {
  return require('path').basename(cwd) || 'default'
}

Impact: Memory hooks silently send wrong project IDs on Windows, so memories are never stored/retrieved correctly. The memory server shows 0 memories for projects even after multiple sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions