Skip to content

[Question] plugin with worktress #56

Closed

Description

@KrzysztofKasprowicz

How do the plugin work if claude code uses worktrees? Does it correctly resolves .remember directory always from root workspace, not a worktree path?

Activity

  1. dewet22 commented on Jun 11, 2026

    @dewet22

    I ran into this tonight, so I can answer from observation: it doesn't — the plugin derives everything from CLAUDE_PROJECT_DIR, which Claude Code sets to the worktree path for worktree sessions. The result is a parallel .remember/ inside the worktree (handoff, daily files, logs) that's deleted along with it on cleanup, while the main checkout's memory never sees that session.

    The fix I'd suggest is resolving the memory root through git's common dir in resolve-paths.sh — something like:

    _common="$(git -C "$PROJECT_DIR" rev-parse --path-format=absolute --git-common-dir 2>/dev/null)"
    _gitdir="$(git -C "$PROJECT_DIR" rev-parse --path-format=absolute --git-dir 2>/dev/null)"
    if [ -n "$_common" ] && [ "$_common" != "$_gitdir" ]; then
        _memory_root="$(dirname "$_common")"   # the main checkout
    fi

    One subtlety: only REMEMBER_DIR should be redirected, not PROJECT_DIR itself — the session-recovery feature looks up transcripts under the slug Claude Code computed from the worktree path, so rewriting PROJECT_DIR wholesale would break recovery for worktree sessions. Non-git projects are unaffected (the rev-parse fails and everything behaves as today).

    In the meantime I'm working around it with a user-level SessionStart hook that emits a corrected === HANDOFF === block when the session starts inside a worktree — that rescues the handoff file, though not the daily/log files. Happy to put a PR together if this approach sounds right to the maintainers.

  2. added a commit that references this issue on Sep 25, 2026
  3. added 2 commits that reference this issue on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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