[FEATURE] Support starting Claude Code without a working directory (detached/global mode)

Resolved 💬 2 comments Opened Mar 12, 2026 by alber70g Closed Apr 9, 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

Claude Code currently requires a working directory context when launched. It is tightly coupled to the directory from which it is invoked, scanning for git roots, loading project-level CLAUDE.md files, and associating the session with that directory.

This makes it impossible to use Claude Code for tasks that are not tied to a specific project — for example:

  • Quick general-purpose queries or scripting tasks
  • Writing a one-off script without wanting Claude to scan a surrounding codebase
  • Automation pipelines that invoke Claude from unpredictable or irrelevant directories
  • Using Claude as a general assistant from a shell alias or global keybinding, regardless of $CWD

Proposed Solution

Add a --no-directory flag (or equivalent, e.g. --detached, --global) that starts Claude Code without anchoring to the current working directory:

claude --no-directory
claude --detached

When this flag is active, Claude Code would:

  • Skip project root detection and git scanning
  • Not load any project-level CLAUDE.md or .claude/ config
  • Still load user-level config from ~/.claude/
  • Use a neutral working directory (e.g. $HOME) or no directory at all
  • Not associate the session with any project in session history

Use Cases

  1. General assistant usage — launch Claude from a global hotkey or shell alias without caring about $CWD
  2. Automation & scripting — invoke Claude in CI/CD or scripts that run from system directories
  3. Cross-project tasks — ask Claude questions unrelated to any single project
  4. Avoiding unintended project context — prevent Claude from picking up a large project's CLAUDE.md when you just want a quick answer

Alternative Solutions

  • claude --dir ~ partially works today but still anchors to a directory and may scan it
  • Manually cd-ing to a temp directory is a workaround but cumbersome

Priority

Low - Nice to have

Feature Category

CLI commands and flags

Related Issues

  • #750[Feature Request] change initial directory ("cd" isn't enough) — closed as not planned
  • #23241[Feature Request] Support resuming Claude sessions from different directories — closed as duplicate
  • #15075[BUG] "claude" + directory option does not set the start directory — bug about directory flag not applying correctly
  • #23601Claude Code hangs indefinitely on startup in non-git directories — highlights how directory-awareness is baked into core startup
  • #23195[BUG] Claude Code exits immediately in non-git directories — same area; shows the fragility of directory-coupled startup

View original on GitHub ↗

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