[FEATURE] Configurable scratch directory outside project root with @ file suggestions

Resolved 💬 4 comments Opened Apr 3, 2026 by keksa Closed May 12, 2026

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

My workflow involves a gitignored _work/ scratch directory at the project root for session-specific files: WIP specs, handoff documents, Slack/Zendesk/Jira dumps, customer log archives, etc. This directory is intentionally not committed - it's personal and ephemeral, not relevant to the rest of the team.

This works adequately in the root repo, but breaks completely when using git worktrees.

When I switch to a worktree, the _work/ directory doesn't follow (it's gitignored and not part of the tree), so @_work/my-notes.md stops resolving. The workaround of @../../../_work/ is painful to type and impossible to autocomplete meaningfully.

I explored a few escapes:

  • Custom create worktree hook with symlinks/junctions - when the worktree is deleted, it takes the original _work/ with it. Hardlinks would avoid this but require administrator privileges on Windows, which is a non-starter.
  • Moving _work/ outside the project root + additionalDirectories - the directory is accessible, but @ file suggestions either don't work at all or require typing the full system path (e.g., @C:/dev/_work/notes.md), which defeats the purpose.

The core problem: there is no way to configure a persistent, path-relative alias for a directory outside the project root that works consistently across both root and worktree contexts with @ file autocompletion.

Proposed Solution

Allow configuring one or more named scratch directories in .claude/settings.json (or equivalent) that:

  1. Point to an absolute path or a path relative to the main repo root (not the worktree)
  2. Are surfaced in @ file suggestions under a short alias, e.g. @scratch/
  3. Work identically whether you're in the root or any worktree

Example config:

{
  "scratchDirectories": {
    "scratch": "/home/user/dev/_work"
  }
}

This would let me type @scratch/feature-notes.md with full autocompletion from any worktree context, pointing at the same stable directory regardless of where the worktree is checked out.

Alternative Solutions

  • Enabling "show gitignored files" in @ suggestions - works in the root (I have it enabled), does nothing for worktrees. Minor noise increase, not a real solution.
  • Symlink/junction via create worktree hook - worktree deletion destroys the original directory. Hardlinks require admin on Windows.
  • additionalDirectories config - grants filesystem access but no @ shorthand; full absolute path required.
  • Manual @../../../_work/ - fragile, non-autocomplete-able, depth varies per worktree location.

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

  1. I'm investigating a customer-reported bug. I have _work/tickets/TICKET-123/ containing a Zendesk dump, log archives, and my own WIP notes.
  2. I start a worktree for the fix branch: claude -w fix/TICKET-123
  3. In the worktree session, I want to load context: @scratch/tickets/TICKET-123/zendesk.md
  4. Autocompletion kicks in, I load the file, Claude has full context without me copying files or typing absolute paths.
  5. When the worktree is deleted, _work/ is untouched.

Currently, step 3 and 4 are either impossible or require full absolute path typing with no suggestions.

Additional Context

  • OS: Windows (primary), but the problem is platform-agnostic - the symlink/hardlink escape hatch is just particularly bad on Windows.
  • The git worktree integration is already a Claude Code feature, which makes this gap more noticeable - worktrees are a first-class workflow but the file context experience doesn't carry over.
  • A simple alias-to-absolute-path mapping would likely cover the majority of use cases without requiring complex virtual filesystem logic.

View original on GitHub ↗

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