Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

nested-config-guard

A SessionStart hook for Claude Code that warns when you launch a session from inside ~/.claude/, preventing the creation of a nested ~/.claude/.claude/ config directory.

See claude-code#37517 for background.

Install

Requires jq.

git clone https://github.com/anthropics/nested-config-guard.git
cd nested-config-guard
chmod +x install.sh nested-config-guard.sh
./install.sh

This adds a SessionStart hook to ~/.claude/settings.json that runs the guard script each time Claude Code starts.

Manual install

Add the following to ~/.claude/settings.json:

{
  "hooks": {
    "SessionStart": [
      {
        "command": "bash /path/to/nested-config-guard.sh"
      }
    ]
  }
}

What it does

When Claude Code starts, the hook checks if the current working directory is ~/.claude/ or a subdirectory of it. If so, it prints a warning to stderr suggesting you switch to a project directory first.

Uninstall

Remove the SessionStart hook entry from ~/.claude/settings.json.