{"version":"2.1.277","anchor":"cd-directory-move-gains-a-fresh-session-reset-path-for","canonical_anchor":"cd-directory-move-gains-a-fresh-session-reset-path-for","heading":"set_cwd (\/cd) can now re-anchor a fresh session's start-of-session state","tier":"use","area":"Directory Change","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.277\/e\/cd-directory-move-gains-a-fresh-session-reset-path-for","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.277","markdown":"### set_cwd (\/cd) can now re-anchor a fresh session's start-of-session state\n\nChanging directory before any turn has run now fully re-derives session start state instead of just appending a notice\n\n**Unclear.** The gate `tengu_cd_command` has not been read for this release, so nothing can be said about whether this path is switched on for any account.\n\n**What**\n\n- The directory-move implementation behind `\/cd` and the headless `set_cwd` control request now takes `freshSession`\/`confirmFresh` options; when a session is fresh (no turns have run yet) and confirmed, changing directory fully re-derives start-of-session state \u2014 session_start hooks, memory, hook caches, and more \u2014 instead of just injecting a \"directory changed\" notice into context.\n\n- The `set_cwd` tool's description was expanded to explain this: before any turn has run, the move re-anchors the whole session as if it had started in the new directory, with no move notice shown; after a turn has run, prior context is preserved and the move is appended as a notice instead.\n\n- The control-request handler for `set_cwd` now computes whether the session is fresh (no messages dequeued, no assistant message in history) and threads that through as `freshSession`\/`confirmFresh`. A new `fresh_session` telemetry field is recorded on the `tengu_cd_command` event.\n\n**Why**\n\nPreviously, moving directories early in a session could leave stale start-of-session state, such as hooks or memory loaded from the old directory. Now Claude Code recognizes when nothing has happened yet and fully re-initializes as if the session had started in the new directory.\n\n- Area: Directory Change\n- Names: `\/cd`\n- Tier: Use it now\n- Useful: 3\/5\n- Signal: 3\/5"}