[FEATURE] Detect Jujutsu (.jj/) repositories in environment metadata
Problem
Claude Code's environment metadata detects .git/ repositories but has no equivalent detection for Jujutsu (.jj/). In colocated jj+git repositories (both .jj/ and .git/ present), the environment only reports Is a git repository: true, so the model defaults to git commands even when CLAUDE.md, SessionStart hooks, and PreToolUse guards direct it to use jj.
The root cause is authority, not documentation. User-injected additionalContext from hooks cannot reliably override built-in environment metadata, because the model treats the system-level Is a git repository: true line as more authoritative than anything a hook appends. A single accurate line in the metadata fixes what layers of user configuration currently fight.
Prior issues (both expired to inactivity, not rejected)
This is a refile of two closed requests for the same feature, neither of which was declined on the merits:
- #43594 — closed as
not plannedafter goingstale - #41435 — closed as
duplicateof #43594
Both simply timed out. Opening a fresh, current issue rather than commenting on a closed one.
Proposed solution
Detect .jj/ alongside .git/ when populating environment metadata:
.jj/only (non-colocated) →Is a jj repository: true.jj/+.git/(colocated) →Is a jj repository: true(colocated setup).git/only →Is a git repository: true(unchanged)
The check is a directory-existence test that mirrors the existing .git/ detection, walking up from cwd the same way.
Use case
- User opens Claude Code in a jj colocated repository.
- System prompt reports
Is a git repository: true, no mention of jj. - User asks "what VCS does this project use?"
- Model answers "Git" based on the metadata.
- Subsequent VCS operations default to git commands.
- The user's hooks and CLAUDE.md have to fight the model's initial understanding for the rest of the session.
Related open work
jj/worktree support is an active area, which is further reason to get the base detection right:
- #40120 — search and @-file autocomplete docs omit jj/Sapling metadata exclusions
- #66503 — EnterWorktree refuses hook-created (non-git) worktrees
- #62590 — @-file references resolve to parent git root instead of cwd inside a jj workspace
Priority
Medium. Small, self-contained change with outsized impact on every jj user's session.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗