`cwd` in ClaudeCodeOptions does not seem to be honored at all
Update
This is now ok when I use opus for some reason.
Using this code from the examples and docs. The cwd is completely ignored and random paths are picked. Even with bypassPermissions enabled
async def main():
messages: list[Message] = []
async for message in query(
prompt = prompt,
options = ClaudeCodeOptions(
cwd = Path("/path/to/app"),
system_prompt = "You are a helpful assistant",
allowed_tools = ['Task', 'Agent', 'Bash', 'Glob', 'Grep', 'LS', 'exit_plan_mode', 'Read', 'Edit', 'MultiEdit', 'Write', 'NotebookRead', 'NotebookEdit', 'WebFetch', 'TodoRead', 'TodoWrite'],
permission_mode = "bypassPermissions",
continue_conversation=True,
max_turns = 10,
),
):
messages.append(message)
print(messages)
anyio.run(main)
Me too. when I set "/path/to/app", it becomes "/private/path/to/app"
Me too. when I set
"/path/to/app", it becomes"/private/path/to/app"
I figured out that Mac's symlink works in that way when I use /tmp/... folder. My issue was another one.
same,must specify in prompt
Found it works find with gemini-2.5-pro,lol
Same issue here. Not only it does not respect the cwd option, it tries to perform tasks in other directories, which is dangerous! Thank god it runs into permissions issues!
Gently ping @ltawfik , any update on this? It still writes files to /tmp randomly even if I set a cwd