[FEATURE] Detect Jujutsu (.jj/) repositories in environment metadata
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Claude Code's environment metadata includes Is a git repository: true/false based on .git/ detection. There is no equivalent for Jujutsu (.jj/) repositories.
In colocated jj+git repos (both .jj/ and .git/ present), the environment reports only Is a git repository: true. The model treats this as authoritative system context and defaults to git commands, even when users have configured CLAUDE.md instructions, SessionStart hooks, and PreToolUse guards directing it to use jj.
User-injected additionalContext from hooks cannot reliably override built-in environment metadata because the model treats system-level context as more authoritative.
Proposed Solution
Detect .jj/ directories alongside .git/ when populating the environment metadata section of the system prompt:
.jj/only (non-colocated):Is a jj repository: true.jj/+.git/(colocated):Is a jj repository: true(or similar, indicating colocated setup).git/only:Is a git repository: true(unchanged)
This would let the model correctly identify the primary VCS without users needing to fight the built-in metadata with hooks.
Alternative Solutions
- SessionStart hooks injecting
additionalContextstating "this is a jj repo" (partially works, but the built-in metadata contradicts it) - PreToolUse hooks that block mutating git commands in
.jj/directories (works for enforcement, but the model still thinks in git terms) - Project-level CLAUDE.md with explicit jj instructions (per-repo, doesn't scale)
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
- User opens Claude Code in a jj colocated repository
- System prompt says
Is a git repository: truewith no mention of jj - User asks "tell me what VCS this project uses"
- Model answers "Git" because that's what the environment metadata reports
- Subsequent version control operations default to git commands
- User's hooks and rules have to fight uphill against the model's initial understanding
Additional Context
- Related: #30985 (same problem for Sapling SCM
.sl/detection) - Related: #4091 (model ignoring jj instructions, likely caused by this metadata issue)
- Related: #27466 (
--worktreefails on jj colocated repos due to detached HEAD) - Jujutsu is growing in adoption; colocated repos (
.jj/+.git/) are the default setup
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗