Skip to content

Feature Request: Stable Project IDs to Preserve Chat History Across Different Locations #6618

@VooDisss

Description

@VooDisss

Title: Feature Request: Stable Project IDs to Preserve Chat History Across Different Locations

What specific problem does this solve?

Currently, RooCode's chat history is indexed and retrieved based on the absolute file path of the project's root folder. If a user:

  • Moves a project folder to a new location (e.g., from C:\dev\ to D:\archives\).
  • Renames the root folder.
  • Clones the same project to a different directory.

RooCode treats it as a brand new project, and the entire existing chat history becomes inaccessible. This leads to user frustration, a sense of data loss, and breaks the continuity of the AI-assisted workflow. Users expect their project-specific data to remain with the project, regardless of its location on their filesystem.

Additional context (optional)

Proposed Solution

We propose an optional, file-based project identification system.

3.1. The Project ID File

  • Name: .rooprojectid
  • Location: In the root directory of the user's project.
  • Format: A simple, plain text file containing a unique identifier string (e.g., a UUID).
  • Behavior: If this file is present, RooCode will use its content as the primary key for retrieving chat history. If the file is absent, the system will fall back to the current method of using the absolute file path to maintain backward compatibility.

3.2. ID Generation and Feature Discovery

  • Manual Generation: A new command will be added to the VSCode Command Palette: "Roo Code: Generate Project ID". Executing this will create the .rooprojectid file in the current workspace's root.
  • Automatic Generation: An opt-in setting will be added to the RooCode extension settings: "Roo Code: Automatically Create Project IDs for New Projects". When enabled, a .rooprojectid file will be generated automatically for any project that doesn't have one.
  • User Notification: To encourage adoption, a non-intrusive notification will appear in the status bar for 15 seconds when a project without a .rooprojectid file is opened.

3.3. Migrating Existing Projects

  • When a user generates a project ID for a project that already has a chat history (linked by its file path), RooCode will automatically perform a one-time migration. It will associate the existing path-based history with the newly generated project ID, ensuring a seamless transition with no loss of data.

3.4. Core Logic: Handling Moved or Copied Projects
This is the central use case this feature solves.

  • Detection: RooCode will detect when it opens a folder at a new file path that contains a .rooprojectid with an ID it already has on record (but associated with a different path).
  • User Prompt: Upon detection, a modal dialog will prompt the user for their intent with two clear options:
    • Button 1: This is a new, separate project. Start a fresh chat history.
      • Action: RooCode will generate a new, unique ID for this project folder, breaking the link to the old project's history.
    • Button 2: This is the same project, just moved. Link my existing chat history.
      • Action: RooCode will update its internal records to associate the existing chat history with this new file path, effectively "moving" the project history.

3.5. Scope Limitations (Non-Goals)

  • No Nested Lookups: RooCode will only look for the .rooprojectid file in the root of the opened workspace. It will not search through parent directories.

User Benefits

  • Project Portability: Users can freely move and reorganize their projects without fear of data loss.
  • Improved User Trust: Ensures that valuable chat history—a core asset of the extension—is durable and persistent.
  • Seamless Workflow: Prevents jarring interruptions where a user opens a familiar project only to find its history gone.

High-Level Implementation Plan

This feature can be implemented in three sprints, focusing on building the core logic first, then the user-facing features, and finally the edge-case handling for moved projects. Before proceeding to coding - investigate the codebase for relevant files to this topic by using codebase_search. For each sprint - have to switch to orchestrator mode and make a subtask which will be assigned to complete the sprint and after the sprint is complete and has been criticized and revised to be implemented correctly - use tool attempt_complete. The sprints below are just high-level suggestions and may not be entirely correct, but just a base to give guidance for roomote.

Sprint 1: Core Project ID Logic & Foundational Commands

Goal: Establish the backbone of the project ID system and provide a manual way for users to opt-in.

  • Task 1.1: Implement Project ID Utility

    • Description: Create a utility function getProjectId(workspaceRoot: string): string | null that reads the .rooprojectid file from the project's root. It should handle file-not-found errors gracefully by returning null.
    • Affected Files: A new utility file, likely in src/utils/.
  • Task 1.2: Modify History Key Generation

    • Description: Modify the core logic that generates the storage key for chat history. The new logic should be: const storageKey = getProjectId(workspace.uri.fsPath) ?? workspace.uri.fsPath;. This will prioritize the project ID and fall back to the absolute path.
    • Affected Files: Primarily src/core/task-persistence/taskMetadata.ts and any other locations where the workspace path is used as a unique identifier for storage.
  • Task 1.3: Create "Generate Project ID" Command

    • Description: Implement the "Roo Code: Generate Project ID" command. This command will generate a UUID, write it to a .rooprojectid file in the current workspace root, and display a confirmation message.
    • Affected Files: src/extension.ts (to register the command), and a new command handler file.

Sprint 2: User-Facing Features & Seamless Migration

Goal: Improve feature discoverability and handle the migration of existing projects smoothly.

  • Task 2.1: Implement Automatic ID Generation Setting

    • Description: Add a new configuration setting in package.json: "roo-code.autoGenerateProjectId". When this setting is enabled, the extension should automatically run the "Generate Project ID" logic for any opened project that lacks a .rooprojectid file.
    • Affected Files: package.json, src/core/config/, and the extension activation logic.
  • Task 2.2: Implement Status Bar Notification

    • Description: Create a temporary status bar item that appears for 15 seconds when a project without a .rooprojectid is opened, prompting the user to generate one.
    • Affected Files: src/extension.ts or a new UI manager class.
  • Task 2.3: Implement History Migration Logic

    • Description: When a project ID is generated, check if chat history exists for the current absolute path. If so, update the storage records to associate that history with the new project ID. This is a critical one-time operation to prevent data loss for existing users.
    • Affected Files: The "Generate Project ID" command handler and the storage management logic.

Sprint 3: Handling Moved & Copied Projects

Goal: Address the core use case of project portability by intelligently handling projects with existing IDs in new locations.

  • Task 3.1: Implement Project Move/Copy Detection

    • Description: On project load, if a .rooprojectid is found, query the storage system to see if that ID is already associated with a different file path.
    • Affected Files: Extension activation logic.
  • Task 3.2: Implement User Intent Prompt

    • Description: If a moved/copied project is detected, display a modal dialog with two options: "This is a new, separate project. Start a fresh chat history." and "This is the same project, just moved. Link my existing chat history."
    • Affected Files: A new UI component for the modal dialog.
  • Task 3.3: Implement History Linking/Breaking Logic

    • Description:
      • If the user chooses "new project," generate a new UUID and overwrite the existing .rooprojectid file.
      • If the user chooses "same project," update the storage system to associate the existing history with the new file path.
    • Affected Files: The handler for the new modal dialog.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Needs ApprovalReady to move forward, but waiting on maintainer or team sign-off.enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions