[MODEL] Agents/scales recursively search parent directories - no option to disable

Resolved 💬 4 comments Opened Jan 20, 2026 by longlyTourist Closed Feb 27, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude accessed files outside the working directory

What You Asked Claude to Do

When launching Claude Code CLI from a subdirectory, agents and skills automatically search upward through parent directories. This causes unintended behavior when a child project wants to use its own isolated resources.

Directory Structure:
D:\02workspace\myplat
├── .claude/
│ ├── agents/
│ │ └── requirement-analyzer.md
│ └── CLAUDE.md (nearly empty)
└── Team
└── ProductManager
├── .claude/
│ ├── skills/
│ │ ├── requirement-recorder/
│ │ └── requirement-designer/
│ └── CLAUDE.md (configures to call requirement-analyzer)
└── settings.json

How I start Claude Code:
```bash
# Launch Claude Code CLI from ProductManager directory
cd D:\02workspace\myplat\Team\ProductManager
claude

In my case:

  • Current directory: D:\02workspace\myplat\Team\ProductManager
  • The CLAUDE.md in this directory is configured to call requirement-analyzer skill
  • This directory only has skills/requirement-recorder and skills/requirement-designer
  • The system automatically searched up and found agents/requirement-analyzer.md in the parent directory D:\02workspace\myplat\.claude\
  • This triggered the wrong agent instead of using the local skills

What Claude Actually Did

The system silently searches upward through parent directories and uses resources found there, without any warning or configuration option to prevent this behavior.

Expected Behavior

I would expect:

  1. An error message when the configured resource doesn't exist in the current project's .claude/ directory
  2. OR a configuration option to disable parent directory search, such as:
  • disableParentSearch: true
  • resourceDiscovery.scope: "local"
  1. Explicit opt-in for parent directory resource sharing, not automatic discovery

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

  1. Create nested directory structure:
  • Parent: D:\02workspace\myplat\.claude\agents\requirement-analyzer.md
  • Parent: `D:\02workspace\myplat\.claude\CLAUDE.md is empty
  • Child: D:\02workspace\myplat\Team\ProductManager\.claude\skills\requirement-recorder\
  1. In child directory's CLAUDE.md, configure to call requirement-analyzer skill (not agent)
  1. Launch Claude Code CLI from child directory:

```bash
cd D:\02workspace\myplat\Team\ProductManager
claude

  1. Trigger a call to requirement-analyzer. (send message as: "I want to build a .... system/ add .... functions")
  2. Observe that it uses parent directory's agent, not the local skill or send me back the error message

Claude Model

Sonnet

Relevant Conversation

Impact

High - Significant unwanted changes

Claude Code Version

2.0.76

Platform

Anthropic API

Additional Context

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗