[BUG] New Claude Code agents created in wrong directory

Resolved 💬 3 comments Opened Sep 13, 2025 by lnedry Closed Sep 13, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

New agents are created in the wrong directory when the current working directory is not the project root.

What Should Happen?

Agents should always be created in .claude/agents/ relative to project root

Error Messages/Logs

Steps to Reproduce

Claude Code had been working on some files in a subdirectory before I decided to create a new agent. The working directoy did not change when I ran /agents.

a. Navigate to a subdirectory (like /views)
b. Create a new agent using /agents command
c. Choose location as Project (.claude/agents)
d. Generate with Claude
e. Agent file gets created in wrong location relative to current directory instead of project root

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.113 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Workaround: Navigate to project root before creating agents

View original on GitHub ↗

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