# CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR

> It goes back to the start folder after each Bash command.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1

## Think of it like

It is like you go back to your desk after each errand.

## Definition

CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR sends Claude Code back to the folder it started in. It does this after each Bash command. Without it, a cd in one command carries over to the next. That is how a later command can run in the wrong folder.

## Example

Claude ran cd into a subfolder, and Emma's next test run failed there. She sets this, and each command starts at the top.

## Example code

```bash
export CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1
claude
```

Every command starts in the project folder.

## Why it matters

A command in the wrong folder can build, test or delete the wrong files.

## Common mistake

Thinking it blocks cd. The cd still works inside its own command.

## Three principles

- **Back after each command.** To the start.
- **cd does not carry.** To the next.
- **Main session.** Bash and PowerShell.

## Related terms

- [Bash Tool](https://learn.benibix.com/term/ai/bash-tool)
- [CLAUDE_ENV_FILE](https://learn.benibix.com/term/ai/claude-env-file-variable)

---

Source: https://learn.benibix.com/term/ai/claude-bash-maintain-project-working-dir-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
