๊ฐ€์ž… ํ›„ ์ดˆ๋Œ€ ๋งํฌ๋ฅผ ๊ณต์œ ํ•˜๋ฉด ๋™์˜์ƒ ์žฌ์ƒ ๋ฐ ์ดˆ๋Œ€ ๋ณด์ƒ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
๊ฐ€์ž… May 2026
286 ํŒ”๋กœ์ž‰ ์ค‘    470 ํŒฌ
# Useful but Little-Known Features of Claude Agent SDK ๐ŸŒ Grant your agent access to files outside the working directory with the additionalDirectories option. Essential for monorepos, shared libraries, and any project spanning multiple directory trees. ๐Ÿ“Œ Title: Granting Access Beyond the Working Directory ๐Ÿ”— URL: ๐Ÿงฉ Overview `additionalDirectories` is a `query()` option that allows agents to access paths outside the working directory (cwd). By default, agents can only operate on files within cwd. When you specify additional directories, the agent gains read/write access to files in those paths as well. In `acceptEdits` permission mode, edits within additional directories are also auto-approved. This is especially useful for monorepo packages, shared libraries, or cross-project workflows. ๐Ÿ›  Usage Pass `add_dirs` (TypeScript: `additionalDirectories`) in the query options. ```python from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage # Grant access to multiple monorepo packages async for message in query( prompt="Update the shared utility functions and fix the imports in the web app", options=ClaudeAgentOptions( add_dirs=[ "/path/to/monorepo/packages/shared-utils", "/path/to/monorepo/packages/web-app", ], permission_mode="acceptEdits", # Auto-approve edits in additional dirs too allowed_tools=["Read", "Edit", "Write", "Grep", "Glob"], ), ): if isinstance(message, ResultMessage) and message.subtype == "success": print(message.result) # Access a shared library alongside the main project async for message in query( prompt="Check the shared library API and update our integration code", options=ClaudeAgentOptions( add_dirs=[ "/path/to/shared-library", ], allowed_tools=["Read", "Edit", "Grep", "Glob"], ), ): if isinstance(message, ResultMessage) and message.subtype == "success": print(message.result) ``` ๐Ÿ— Integration into Production Systems - In monorepo setups, list related package paths in `add_dirs` to enable cross-package changes with dependency awareness - Combined with `acceptEdits` mode, file edits (Edit, Write) and filesystem operations (mkdir, rm, mv, cp) in additional directories are auto-approved - Writes to protected paths still prompt even when included in additional directories ๐Ÿ’ก Use Cases ๐Ÿ“ฆ Monorepo development: modify shared packages and individual apps simultaneously ๐Ÿ“š Shared library reference: read external library source to verify correct API usage while coding ๐Ÿ”ง Centralized config management: access and update configuration directories outside the project โš ๏ธ Caveats - Access to paths outside both cwd and additional directories remains blocked or prompted - `bypassPermissions` mode approves all paths regardless of `add_dirs` settings - This expands the agent's security boundary โ€” specify only the minimum necessary paths - `acceptEdits` auto-approval is scoped to cwd and additional directories only โœจ additionalDirectories enables agents to work seamlessly across multiple directory trees, making cross-project and monorepo workflows practical. #ClaudeAgentSDK# #AIAgent#
๋” ๋ณด๊ธฐ