Skip to content

feat: isolate chat sessions by workspace directory #9936

@shanevcantwell

Description

@shanevcantwell

Problem

Chat sessions are stored globally in ~/.continue/sessions/ with no filtering by workspace. This causes several UX issues:

  1. Fresh window loads wrong session: Opening a project shows the last active session from any project, not the last session for this project
  2. History shows all projects: No way to filter sessions to current workspace
  3. Multi-window confusion: Sessions from different workspaces appear interleaved

This affects VS Code, IntelliJ, and CLI.

Current Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                        ~/.continue/sessions/                         │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐     │
│  │ {uuid1}.json    │  │ {uuid2}.json    │  │ sessions.json   │     │
│  │ workspaceDir: A │  │ workspaceDir: B │  │ [metadata...]   │     │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘     │
└─────────────────────────────────────────────────────────────────────┘
                              ▲
                              │ All windows read/write same store
        ┌─────────────────────┼─────────────────────┐
        │                     │                     │
┌───────┴───────┐     ┌───────┴───────┐     ┌───────┴───────┐
│ VS Code Win 1 │     │ VS Code Win 2 │     │ IntelliJ Win  │
│ workspace: A  │     │ workspace: B  │     │ workspace: C  │
└───────────────┘     └───────────────┘     └───────────────┘
        │                     │                     │
        └─────────────────────┴─────────────────────┘
                              │
                    All see ALL sessions
                    (no filtering by workspace)

Key Insight

workspaceDirectory is already saved in every session - it's just never used for filtering.

Proposed Solution

Filter sessions by workspaceDirectory by default, with optional "show all" toggle.

Scope Estimate

Layer Files Functions/Types
Protocol core/protocol/core.ts ListHistoryOptions - add workspaceDirectory?: string
Core history core/util/history.ts HistoryManager.list() - add filter logic
Core handler core/core.ts history/list handler - pass workspace
GUI thunks gui/src/redux/thunks/session.ts refreshSessionMetadata - include workspace
GUI components gui/src/components/History/index.tsx Add "show all" toggle
CLI session extensions/cli/src/session.ts listSessions() - add filter param
Total ~6 files ~8 functions

Implementation Outline

1. Protocol - Add optional filter:

export interface ListHistoryOptions {
  offset?: number;
  limit?: number;
  workspaceDirectory?: string;  // NEW
}

2. Core - Filter when provided:

if (options.workspaceDirectory) {
  sessions = sessions.filter(s => 
    s.workspaceDirectory === options.workspaceDirectory
  );
}

3. GUI - Pass current workspace:

workspaceDirectory: window.workspacePaths?.[0]

4. History page - Toggle: "Show sessions from all projects"

Risk Assessment

Risk Mitigation
Multi-root workspaces Use first folder (matches current save behavior)
No folder open Fall back to showing all sessions
Breaking change Default filtered; toggle provides escape hatch
Migration None needed - existing sessions have workspaceDirectory

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:chatRelates to chat interfacekind:enhancementIndicates a new feature request, imrovement, or extension

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions