Switch Project Context Instantly with In-Session Directory Changes
Move between project directories without losing your AI chat history.
Use the '/cd' command to switch working directories within an active AI session to maintain conversation context while moving across files.
The Scenario
You are debugging a microservice and realize the bug actually lies in a shared library located in a different directory on your machine.
Before & after
You would have to close your terminal session, navigate to the new folder, and restart the AI tool, losing your conversation history. This process takes 5–10 minutes.
Type '/cd' followed by the new path directly in your chat; the AI immediately refreshes its file context and system prompts for the new folder. This takes less than 1 minute.
The Prompt
/cd [PATH_TO_YOUR_NEW_DIRECTORY]
The /cd command migrates session files and refreshes the 'context' (what the AI 'sees' in the file tree) without needing to wipe the conversation or reboot the client.
Source
Qwen Code Blog: AI Coding Updates and Guides | Qwen Code Docs"/cd switches the current session’s working directory without exiting the CLI, session files auto-migrate to the new workspace, system/directory context auto-refreshes"
