claude-code - 💡(How to fix) Fix Feature request: native defaultWorkingDirectory / cwd setting in settings.json [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55639Fetched 2026-05-03 04:48:14
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Long-running projects in fixed directories regularly hit a friction pattern: a substantial fraction of all Bash tool calls end up prefixed with cd "/full/path/to/project" && <cmd> because shell state doesn't persist across Bash calls and Claude can't safely assume the cwd is the project root.

In one project we measured this across 30 days / 1,113 Bash calls — 458 of them (41%) cd-prefixed. Daily rate has increased over time as the project deepens.

Root Cause

Long-running projects in fixed directories regularly hit a friction pattern: a substantial fraction of all Bash tool calls end up prefixed with cd "/full/path/to/project" && <cmd> because shell state doesn't persist across Bash calls and Claude can't safely assume the cwd is the project root.

Fix Action

Fix / Workaround

Workarounds tried and rejected

Workaround we're accepting

RAW_BUFFERClick to expand / collapse

Summary

Long-running projects in fixed directories regularly hit a friction pattern: a substantial fraction of all Bash tool calls end up prefixed with cd "/full/path/to/project" && <cmd> because shell state doesn't persist across Bash calls and Claude can't safely assume the cwd is the project root.

In one project we measured this across 30 days / 1,113 Bash calls — 458 of them (41%) cd-prefixed. Daily rate has increased over time as the project deepens.

Ask

Support a defaultWorkingDirectory (or similarly-named) directive in .claude/settings.json / .claude/settings.local.json that becomes the default cwd for all Bash tool invocations in that session.

Should be:

  • Inheritable to subagents (with override per-call possible)
  • Project-scoped (.claude/settings.local.json) preferred for project-specific cwds
  • User-scoped (~/.claude/settings.json) also OK as a fallback default

Workarounds tried and rejected

  • PreToolUse hook on Bash that mutates the command — runs after Claude generates the command, so we'd be rewriting the command string in flight. Hacky, and could confuse subagents that legitimately want different cwds.
  • Discipline note ("prefer absolute paths over cd") — tried twice across two monthly workflow reviews in our project. Doesn't take. Discipline doesn't hold against real ergonomic friction.

Workaround we're accepting

Just accepting the token-cost friction. It's not breakage, just inefficiency. But a native setting would compound nicely across long-lived projects in fixed directories.

extent analysis

TL;DR

Implementing a defaultWorkingDirectory directive in .claude/settings.json or .claude/settings.local.json could simplify Bash tool calls by setting a default cwd.

Guidance

  • Consider adding a defaultWorkingDirectory setting to .claude/settings.local.json for project-specific cwd, allowing for inheritance and override per-call.
  • Evaluate the feasibility of implementing this setting at the user level (~/.claude/settings.json) as a fallback default.
  • Assess the potential impact of this change on subagents and their ability to override the default cwd.
  • Investigate how this setting could be integrated with existing PreToolUse hooks to avoid command string rewriting.

Example

No code snippet is provided as the issue does not contain sufficient technical details to generate a concrete example.

Notes

The proposed solution relies on the assumption that adding a defaultWorkingDirectory setting is technically feasible and aligns with the existing architecture of Claude.

Recommendation

Apply workaround: Implement the proposed defaultWorkingDirectory setting to simplify Bash tool calls and reduce friction in long-running projects. This approach addresses the root cause of the issue and provides a more ergonomic solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Feature request: native defaultWorkingDirectory / cwd setting in settings.json [1 participants]