[BUG] After EnterWorktree, the compaction summary's "read the full transcript at:" path names a project dir built from the worktree cwd, which doesn't exist
Version: 2.1.296, macOS. Seen in two compactions in the same session. Not yet re-tested on 2.1.299.
What happens. A session started in ~/Dev/<repo> and then entered a worktree with EnterWorktree (~/Dev/<repo>-worktrees/<name>). After that, the transcript kept being written to the original project directory:
~/.claude/projects/-Users-<user>-Dev-<repo>/<session-id>.jsonl
When the session compacted later, the summary's "read the full transcript at:" line pointed somewhere else:
~/.claude/projects/-Users-<user>-Dev-<repo>-worktrees-<name>/<session-id>.jsonl
That directory does not exist. The compact_boundary record's cwd is the worktree path, and the bad pointer is exactly that path converted to a project-directory name. So the pointer looks like it is built from the current cwd instead of from where the transcript is actually being written. I'm inferring this from the matching strings; I haven't read the source.
Expected. The pointer names the file the session is actually writing.
Impact. The pointer is the summary's own route back to detail that compaction dropped. After a worktree entry it points nowhere, and nothing reports that. A model that follows it gets a missing-file error. A tool that globs for it finds nothing and can read that as "no transcript".
Repro.
- Start an interactive session in a git repo.
- Have Claude call
EnterWorktreeto create or enter a worktree. - Let the conversation compact. Both of my cases were idle compactions; I haven't tested manual
/compactor context-pressure auto-compaction. - Compare the path in the summary's "read the full transcript at:" line with
ls ~/.claude/projects/.
Evidence.
- Session
d70875b3-bd76-4952-a325-74d991e44d27. EnterWorktreeat 2026-10-11T05:23:58Z.compact_boundaryrecords at 2026-10-11T06:54:26Z and 20:00:04Z, bothversion: 2.1.296and both followed by the "Compacted while idle" notice.- Both summaries carry the same nonexistent path.
Related. #96619 is the same pointer problem for subagents: it names the parent's file instead of the subagent's own. #84209 is about session history being orphaned when a session ends inside an EnterWorktree worktree.