Skip to main content
Switching between projects can break your workflow, especially when each one has its own codebase and issue history. This recipe shows how to use Persistent Contexts and Session Management to switch between projects instantly and in an organized way.

The Problem

You work on two projects: Project A (a Go API) and Project B (a React frontend). One moment you are debugging a bug in the API; the next, you need to implement a new feature in the frontend. Keeping the conversation history and file context separate for each is a challenge.

Ingredients

  • Two or more project directories on your machine.

The Workflow

The strategy is to create a Context for each project’s codebase and a Session for each task’s conversation history.
1

Create Persistent Contexts for Each Project

First, let’s create “snapshots” of the codebases. We will do this once for each project.Navigate to the Project A folder:
Now, navigate to the Project B folder:
What did we do? We created two persistent contexts. Now, ChatCLI “knows” the structure of these two projects and we can refer to them by name (project-a-api, project-b-frontend) at any time, from anywhere on your system.
2

Start Working on Project A

Let’s begin debugging the bug in the API.
  1. Load (or create) a conversation session:
    (If the session does not exist, it will be created when you save.)
  2. Attach the project context:
Now, your prompt will indicate that the session and context are active. You can start asking questions about the API code, and ChatCLI will automatically send the relevant files to the AI.
3

Switch to Project B

Your lead asks you to pause the debug and work on a new feature in the frontend.
  1. Save the current session: All your debug history will be preserved.
  2. Detach the old context:
  3. Load the session and context for Project B:
Done! In seconds, you have completely switched environments. Your conversation history is now about the frontend feature, and the AI has all of Project B’s code as context.
4

Returning to Project A

Frontend task completed? Going back to the API debug is just as simple.
Result: You created a workflow where you can switch between complex projects in seconds, preserving both your conversation history and the complete codebase context, without ever needing to resend a single file manually.