switching-projects

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Switch Project

切换项目

Use this skill when the user wants to switch to a different project, open another codebase, or move the current conversation to a different workspace root.
当用户想要切换到另一个项目、打开其他代码库,或是将当前对话切换到不同的工作区根目录时,可使用此技能。

How It Works

工作原理

Cursor has a built-in MCP server called
cursor-app-control
with a tool called
move_agent_to_root
that changes the agent's active workspace directory. This lets you switch projects mid-conversation without opening a new window.
Cursor内置了一个名为
cursor-app-control
的MCP服务器,其中包含一个名为
move_agent_to_root
的工具,可更改Agent的活动工作区目录。这让你无需打开新窗口,就能在对话过程中切换项目。

Steps

操作步骤

  1. Ask or infer the target project — if the user says "switch to my-app", search for it. Common project locations:
    • ~/Documents/development/
    • ~/projects/
    • ~/code/
    • ~/repos/
    List directories in the likely parent folder to find the project:
    bash
    ls ~/Documents/development/
    If ambiguous, ask the user which project they mean.
  2. Switch the workspace — call the
    cursor-app-control
    MCP tool:
    Tool: move_agent_to_root
    Arguments: { "rootPath": "/Users/<username>/Documents/development/<project-name>" }
    This updates the visible workspace, file tree, and default working directory for all subsequent commands.
  3. Orient in the new project — after switching, briefly describe what you see:
    • Read the project's
      package.json
      ,
      README.md
      , or equivalent to understand the stack.
    • Run
      git status
      to show the current branch and state.
    • List the top-level directory structure.
  1. 询问或推断目标项目 —— 如果用户说“切换到my-app”,请搜索该项目。常见的项目位置:
    • ~/Documents/development/
    • ~/projects/
    • ~/code/
    • ~/repos/
    列出可能的父文件夹中的目录以找到目标项目:
    bash
    ls ~/Documents/development/
    如果存在歧义,请询问用户具体指的是哪个项目。
  2. 切换工作区 —— 调用
    cursor-app-control
    MCP工具:
    Tool: move_agent_to_root
    Arguments: { "rootPath": "/Users/<username>/Documents/development/<project-name>" }
    此操作会更新可见的工作区、文件树以及后续所有命令的默认工作目录。
  3. 适应新项目 —— 切换完成后,简要描述你看到的内容:
    • 读取项目的
      package.json
      README.md
      或同类文件以了解技术栈。
    • 运行
      git status
      以显示当前分支和状态。
    • 列出顶层目录结构。

Creating a New Project

创建新项目并切换

If the user wants to start a new project and switch to it:
  1. Call
    create_project
    with the desired path — this creates the directory and initializes a git repo.
  2. Call
    move_agent_to_root
    to switch into it.
  3. Begin scaffolding.
如果用户想要创建新项目并切换到该项目:
  1. 使用指定路径调用
    create_project
    —— 此操作会创建目录并初始化git仓库。
  2. 调用
    move_agent_to_root
    切换到该项目。
  3. 开始搭建项目框架。

Notes

注意事项

  • This only works if the
    cursor-app-control
    MCP server is enabled.
  • The switch happens in the current conversation — no new window is opened.
  • All file paths in subsequent tool calls will resolve relative to the new root.
  • You can switch back to the original project the same way.
  • 仅当
    cursor-app-control
    MCP服务器启用时,此功能才可使用。
  • 切换操作在当前对话中进行 —— 无需打开新窗口。
  • 后续工具调用中的所有文件路径都将相对于新的根目录解析。
  • 你可以用同样的方式切换回原项目。