Skip to content

feat: add configurable working directory and Claude data path#91

Open
heman22union wants to merge 1 commit into
heytcass:mainfrom
heman22union:feature/configurable-paths
Open

feat: add configurable working directory and Claude data path#91
heman22union wants to merge 1 commit into
heytcass:mainfrom
heman22union:feature/configurable-paths

Conversation

@heman22union

Copy link
Copy Markdown

Summary

Three new options, all backwards-compatible (defaults preserve existing behaviour):

  • working_directory — directory Claude starts in (default /config). Useful if your work lives in a subdirectory like /config/ai_repo.
  • prompt_working_directory — when true, prompts you to confirm or change the working directory on every session open, showing the last-used path as the default.
  • claude_data_path — relocate ~/.claude session/config data out of /data (container-only, not visible to ha filesystem or over SMB) into a user-specified path such as /config/.claude. Makes sessions accessible over SMB and portable across HA migrations or reinstalls.

Adds scripts/pick-working-dir.sh which handles the interactive directory prompt and persists the last choice to $ANTHROPIC_HOME/last-working-dir.

Motivation

Currently the addon stores all Claude data under /data, which is the container's private persistent volume. This means session history and project files are invisible over SMB and lost if you migrate or reinstall HA. Moving data to /config solves both problems.

Test notes

Tested on 2.2.x with claude_data_path: /config/.claude and working_directory: /config/ai_repo. A few things discovered during testing worth noting for reviewers:

  • All environment variables (HOME, XDG_*, ANTHROPIC_*) are derived from claude_data_path so they stay consistent — no hardcoded /data paths remain
  • The last-working-dir state file is stored under $ANTHROPIC_HOME so it persists across restarts when claude_data_path points to /config

Test plan

  • Addon starts normally with no options set (defaults to /config, uses /data for Claude data)
  • Setting working_directory: /config/ai_repo lands Claude in that directory on open
  • Enabling prompt_working_directory: true shows prompt; Enter confirms last-used dir; choice persists across restarts
  • Setting claude_data_path: /config/.claude creates directory structure there and Claude stores sessions/config under it
  • Sessions and auth survive addon restart when claude_data_path is under /config
  • Existing auth files still migrate correctly when claude_data_path is set

- working_directory: set where Claude starts (default /config)
- prompt_working_directory: prompt user to confirm/change dir on each open
- claude_data_path: move ~/.claude data out of /data into a user-specified
  path (e.g. /config/.claude-data) so sessions are accessible over SMB
  and survive HA migrations
- adds pick-working-dir.sh script for the interactive dir prompt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant