Claude Corner

Claude Code Can't See the Shared Library Next to Your Repo? Add the Folder With /add-dir.

By ยท 11 Nov 2026

A developer seen from behind at a honey maple desk looks at a landscape monitor with four tilted blank tiles around an empty center against an ice pink wall, with a blank keyboard on the desk.

At a glance

  • Give Claude Code a second folder with --add-dir at launch or /add-dir in a running session.
  • With either of those, the folder's skills, commands and subagents load, but its CLAUDE.md and hooks do not.
  • Save the folder in permissions.additionalDirectories when you need it every day. That key grants file access only.

Your app lives in one repo and the shared library it calls sits next to it. Claude can see only the folder you launched in, so add the library as a second working directory. This is not Copilot CLI's own /add-dir, which we covered in Copilot CLI /add-dir and sandbox policy.

Why it matters

The permissions docs list three ways to extend access: --add-dir at startup, /add-dir during a session, and additionalDirectories in settings. Files in an added folder follow your project's permission rules, so reads need no prompt and edits follow your permission mode. Additional directories grant file access, not configuration.

How to add a second folder to Claude Code

We built these steps from Anthropic's docs and have not run them in a live session.

  1. Run claude --version. Prefixed skill names in step 5 need v2.1.309 or later. At about 6:02 AM ET Wednesday, npm stable was v2.1.311.
  2. For one session, start from your project with claude --add-dir ../shared-lib. The CLI reference example can pass two folders at once.
  3. Type /add-dir and a partial path, then press Tab to accept a suggestion. If Claude is still responding, the commands page says you confirm the folder right away, after which Claude's next tool call in the same turn can reach it.
  4. Know what loaded. The docs say the added folder's skills, commands and subagents load, but from its settings only enabledPlugins and extraKnownMarketplaces apply. Its CLAUDE.md loads only with an environment variable the memory docs describe. Hooks load from your current working directory, not from the added folder. Our habit, not a documented rule: ask Claude to read the library's CLAUDE.md before it edits there.
  5. If both folders have a verify skill, the skills docs say /verify runs your project's copy and the added folder's copy runs under its folder name, as /shared-lib:verify.
  6. To keep the folder every session, add it to permissions.additionalDirectories. That key grants file access only and loads no skills. Run the script from the repo root and add .claude/settings.local.json to .gitignore. The script writes that file only if it is missing. Otherwise add the key by hand. Shared .claude/settings.json waits for the workspace trust dialog. .claude/settings.local.json applies without it unless git tracks that file or .claude is a symlink.
# We have not run this script end to end on every platform.
# Writes .claude/settings.local.json only if missing. Will not overwrite an existing settings file.

claude --version

mkdir -p .claude
if [ ! -e .claude/settings.local.json ]; then
  cat > .claude/settings.local.json <<'JSON'
{
  "permissions": {
    "additionalDirectories": ["../shared-lib/"]
  }
}
JSON
else
  echo "settings.local.json already exists. Add additionalDirectories by hand."
fi

# Optional one session start, left commented:
# claude --add-dir ../shared-lib

Gotchas

  • Most network shares are refused. On Windows, map the share to a drive letter and pass it with --add-dir at launch.
  • Adding is not moving. /cd moves the session to a new primary folder and applies its settings and hooks. /add-dir keeps your project as home.
  • Only skills live reload. Restart after you change the added folder's commands or agents.

Sources:

Recommended AI prompt

Copy this paragraph into ChatGPT, Claude, Gemini, Grok, or whatever AI you use.

Prompt

I use Claude Code on an app repo with a shared library in a sibling folder, and I want both in one session. Using only Anthropic's Claude Code docs, explain how the launch flag, the slash command and the additionalDirectories setting differ, which library configuration loads in each case, and a short checklist to confirm access. Ask which operating system I use before suggesting steps.