claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Add a simple slash command to display the CURRENT working folder

Open slyfox1186 opened this issue 1 year ago • 4 comments

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 sometimes can get confused as to the directory that it is currently in and you have to ask it to check this.

Proposed Solution

Add a simple slash command to display the CURRENT working folder that CLAUDE has moved itself to. Sometimes it is not where it thinks it is and this would be a FAST way to know which full path DIR it is located in.

Simply add /pwd to have Claude reorient itself regarding it's working directory.

Alternative Solutions

No response

Priority

Low - Nice to have

Feature Category

File operations

Use Case Example

Claude tries to perform a command. It fails repeatedly because it doesn't realize that it's in the wrong directory.

Additional Context

No response

slyfox1186 avatar Sep 20 '25 08:09 slyfox1186

Hey

That's a good point. It can definitely be frustrating when the agent seems to lose track of its current working directory (CWD).

While there isn't a /pwd command specifically, I think there are a couple of existing features that solve this problem pretty well. I use them myself and they're super helpful.

1. The /status Command

For a quick, one-off check, the /status command should give you what you're looking for. It shows account and system statuses, which includes the current CWD.

2. The Customizable Status Line (Permanent Solution)

For something more permanent, you might want to check out the customizable status line. You can configure a script that runs in the background and displays the full path of the current directory at the bottom of the UI at all times. It's kind of like setting up a custom shell prompt (PS1).

You have two ways to set this up:

Automatic Setup with /statusline

This is the easiest way. When you run the command, Claude will start an interactive setup process:

  1. Run /statusline in the Claude Code prompt.
  2. Claude will offer to create a status line script for you. It might suggest a default, like reproducing your terminal's prompt.
  3. You can then just tell it what you want. For example, you could reply with:

    "Just show the full path of the current working directory, prefixed with a folder emoji."

  4. Claude will generate the necessary script and configuration and then ask for your permission to save the files (usually ~/.claude/statusline.sh and ~/.claude/settings.json).
  5. Once you approve, the new status line will appear at the bottom of the interface immediately.

Manual Setup

If you prefer to create the files yourself, you can do that too.

  1. Create a script, for example ~/.claude/statusline.sh:

    #!/bin/bash
    # Read session info from stdin
    input=$(cat)
    
    # Extract the current working directory using jq
    CURRENT_DIR=$(echo "$input" | jq -r '.workspace.current_dir')
    
    echo "📁 $CURRENT_DIR"
    

    Make sure to make it executable: chmod +x ~/.claude/statusline.sh

  2. Then, add this to your user settings (~/.claude/settings.json):

    {
      "statusLine": {
        "type": "command",
        "command": "~/.claude/statusline.sh"
      }
    }
    

After setting this up, you'll always see the full path of the current working directory at the bottom of your Claude Code session. I find it really helps with context.

Hope this helps you out!

coygeek avatar Sep 20 '25 16:09 coygeek

I just use !pwd in cases I forget where I am. :)

MarcelKarras avatar Sep 20 '25 17:09 MarcelKarras

Yep, /status or !pwd should do the trick.

bcherny avatar Oct 05 '25 05:10 bcherny

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Oct 12 '25 14:10 github-actions[bot]