[FEATURE] Detect Jujutsu (.jj/) repositories in environment metadata

Resolved 💬 2 comments Opened Jul 6, 2026 by lukasmalkmus Closed Jul 7, 2026

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 planned after going stale
  • #41435 — closed as duplicate of #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

  1. User opens Claude Code in a jj colocated repository.
  2. System prompt reports Is a git repository: true, no mention of jj.
  3. User asks "what VCS does this project use?"
  4. Model answers "Git" based on the metadata.
  5. Subsequent VCS operations default to git commands.
  6. 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.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗