brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: /cd moves a Claude Code session to another folder and keeps the conversation

Claude
~/tips/tip-claude-cd-move-session

/cd ../api-server

Switches the session's working directory and loads that project's settings, without starting over.

You start in the frontend repository, and halfway through it turns out the real work is in the API next door. Quitting means losing the context you built up.

/cd ../api-server

This moves the session to a new primary working directory. The conversation stays. Type part of a path to get suggestions, and Tab accepts one.

The move is more than a change of folder. Claude Code loads the new directory’s CLAUDE.md and applies its project configuration: settings with their permission rules and hooks, .mcp.json servers, skills, subagents and env values. The previous project’s MCP servers are disconnected. If you have never worked in the new folder, you get the trust prompt first, with a list of what its settings would switch on. Decline and the session stays where it was.

Later, claude --resume from the new directory finds the session there.

How it differs from /add-dir: that one only adds file access to a second folder and keeps the first project in charge. /cd really switches project, which I think is the right choice when the focus has moved for good.

One leftover to know about: env values from the old directory’s settings stay in effect, with the new ones on top. Older versions before v2.1.246 didn’t apply the new settings until you resumed, so update if it seems to ignore them.

Further reading: Move the session to another directory, Commands: /cd

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link