docs(claude): derive project from cwd, not the zellij tab - #3
Merged
Conversation
Tabs are no longer renamed per project (they read "Tab #1") and a single pane now hosts many concurrent sessions, so ZELLIJ_PANE_ID is not unique and /tmp/claude-pane-* is deleted by whichever session exits first. The tab-detection ladder therefore resolved to nothing, and claude-projects.conf went with it. cwd is already resolved by the launcher, so it is the answer. Replaces the detection ladder and re-keys the downstream steps (memory load, bootstrap, continuation-prompt isolation) on cwd, including deriving the project from the repo root so worktrees don't read as their own projects. Also documents ~/.claude/sessions/<pid>.json as the SSOT for concurrent sessions, and scopes the "check what else is running" advice to semantic collisions (same bug, same migration timestamp) since _claude_autoworktree_enter already handles file-level isolation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The session-start instructions told every agent to detect the current project by reading the zellij tab name. That mechanism is dead:
/tmp/claude-pane-0currently contains the literal stringTab #1, which matches nothing in~/.config/claude-projects.conf.ZELLIJ_PANE_IDis no longer unique — every session in a pane reads the same file._agent_post_launchdeletes/tmp/claude-pane-$ZELLIJ_PANE_IDon exit, so the first session to finish removes the identity file out from under its still-running siblings.Net effect: the detection ladder resolved to nothing, then fell through to guessing.
What changed
cwdis already resolved by the launcher, so it is the answer — no detection needed. This:cwd, and marks tab detection +claude-projects.confexplicitly retired so no future agent revives them.~/dev/orangecat/.claude/worktrees/foocorrectly reads asOrangeCatrather thanfoo. This one is load-bearing now that auto-worktree puts most sessions inside a worktree.~/.claude/sessions/<pid>.jsonas the SSOT for what is running concurrently, with a testedjqone-liner._claude_autoworktree_enteralready isolates files, so the residual risk is semantic collision. Both instances that bit this fleet were semantic — two sessions fixing the same bug (orangecat #498/#499) and two sessions picking the same migration timestamp (20260731110000).Verification
Every claim checked against the live machine rather than recalled: the pane file's contents, the two
claude()definitions in.bashrc,_agent_pre_launch/_agent_post_launch,_claude_autoworktree_enter, and the 7 live session JSONs. Thejqone-liner was run before being written into the docs.Markdown-only; no behavior change beyond the instructions themselves.