Skip to content

tracer: a Desktop worktree session is indexed, so replay finds it - #57

Open
AsemDevs wants to merge 1 commit into
proxify-dev:mainfrom
AsemDevs:fix/tracer-index-worktree-sessions
Open

AsemDevs wants to merge 1 commit into
proxify-dev:mainfrom
AsemDevs:fix/tracer-index-worktree-sessions

Conversation

@AsemDevs

@AsemDevs AsemDevs commented Nov 19, 2026 •

Copy link
Copy Markdown

Problem

tracer sessions replay finds nothing for a Claude Desktop session that runs in a git worktree, while
tracer sessions show reads the same session fine:

$ tracer sessions replay 1a2b3c4d
No interactions matched. Filters: session=1a2b3c4d-…

These sessions are never indexed. The Stop hook is meant to keep the index current for every session, worktrees
included (tracer sessions counts a worktree as part of its project), but it indexes the main checkout's transcript
folder, and a worktree session's transcript is stored under the worktree's own folder.

Cause: the hook takes the folder from $CLAUDE_PROJECT_DIR, then its own cwd. In a Desktop worktree session both
name the main checkout (/src/app), as
documented,
while the transcript is filed under the worktree's project folder in ~/.claude/projects. The hook's stdin input does carry the session's transcript_path.

It is easy to miss: nothing says the session was skipped, and a plain tracer trace index from the main checkout
does not reach it either. Only tracer trace index --session <id>, run for each missing session, fills the gap.

Change

  • tracer index takes an optional --transcript PATH. When the path is a transcript inside the Claude projects
    folder, the engine indexes that transcript's folder first, then the project as before, in the same run.
  • The Stop hook passes its transcript_path to the one tracer index it already starts. A session outside a
    worktree is indexed with the same result as before; missing or unusable input falls back to today's invocation.
  • A session with a copy in both folders keeps today's precedence: the extra pass skips files the project folder
    also holds.
  • The README documents the flag and the index skill the extra pass; the hook's docstring no longer claims a writer lock.

After: tracer sessions replay 1a2b3c4d shows the session's dialogue.

Testing

  • tests/test_index_hook.py: the hook passes transcript_path on, and unusable input falls back to today's
    command. tests/test_indexer_regressions.py: the index contents for a worktree session, an unchanged plain
    session, invalid paths, duplicate sessions, and a failed extra pass that still indexes the project. Every new case
    fails on main. uv run pytest -q: 368 passed, 8 skipped (358 passed on main).
  • Checked on a live Claude Desktop worktree session: the session was indexed and replay showed the dialogue.
  • Not checked on Windows.

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