Skip to content

Fix worktree sessions fragmenting project identity#142

Merged
gvonness-apolitical merged 2 commits intomainfrom
fix/worktree-path-resolution
Feb 25, 2026
Merged

Fix worktree sessions fragmenting project identity#142
gvonness-apolitical merged 2 commits intomainfrom
fix/worktree-path-resolution

Conversation

@gvonness-apolitical
Copy link
Contributor

Summary

  • Claude Code v2.1.47+ worktree isolation passes worktree paths (e.g., /tmp/claude-worktree-abc123/) as cwd, causing sessions to be tagged with the worktree name instead of the real project name
  • New src/utils/project-path.ts resolves worktree paths to main repo via git worktree list --porcelain (500ms timeout) with .git file parsing fallback; skips submodules
  • All entry points updated: hook dispatcher, claudemd-generator, session reader, ingestion, hook-utils
  • Version bumped to 0.8.2

Test plan

  • 11 new unit tests for resolveCanonicalProjectPath (normal repo, worktree via git command, .git file fallback, submodule guard, caching, error cases)
  • Integration test creating a real git repo + worktree
  • Updated assertions in hook.test.ts and session-reader.test.ts
  • 2066/2066 tests passing
  • Manual: create a git worktree, run npx causantic hook session-start with worktree cwd — verify slug matches main repo
  • Manual: run with normal cwd — no behavior change
  • Manual: claudemd-generator from worktree writes CLAUDE.md to worktree dir (not main repo)

Claude Code v2.1.47+ passes worktree paths as cwd in hook stdin,
causing sessions to be tagged as e.g. 'claude-worktree-abc123'
instead of the real project name. All entry points now resolve
worktree paths back to the main repository via git worktree list
with a .git file parsing fallback.

Bump version to 0.8.2.
@gvonness-apolitical gvonness-apolitical merged commit 4c026ff into main Feb 25, 2026
3 checks passed
@gvonness-apolitical gvonness-apolitical deleted the fix/worktree-path-resolution branch February 25, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant