Chat History Search & Branching Conversations

Hey Cursor team,

I’ve got a couple of ideas that I think could make the chat experience in Cursor even better:

  1. Cross-Chat History Search
    It would be super handy if chats could search through other chats to reference past info without having to copy and paste. This would make it way easier to keep track of conversations across different topics without repeating the same questions or instructions.
  2. Branching Conversations with Selective History Inheritance
    It would be awesome to have branching conversations. If I start a new branch from an existing chat, the new branch should inherit the history of the parent chat — but anything in the branch would stay separate from the original chat. This way, I could explore different ideas without messing up the main thread or losing context.It would be great if there were options to:
  • Choose whether the branch gets all the history or just part of it.
  • Decide if the branch should be able to search through parent chat history dynamically or just inherit a snapshot.

These features would make Cursor feel more like a collaborative workspace, especially for experimenting with multiple ideas at the same time. It would make it easier to try out different solutions without losing track of how each one evolved.

Looking forward to hearing your thoughts!

8 Likes

I would really like to have branching conversations. Let me pick any point in the conversation and fork it out into a new chat.

I find that I often have a really good context built, with the agent being very productive, and I have to go down a bit of a rabbit hole to fix a bug or look into an edge case. When I’m finished with that rabbit hole, the context is often ruined - the agent is confused because it has too much in context. I really want to be able to go back to the point right before I started down the rabbit hole in order to retain the high-quality context I was working in. Additionally, the added context of the rabbit hole is usually not relevant to the main thread I’m working on.

I suggest adding a fork button on each agent message (next to “restore checkpoint” and “copy message”). This will create a new chat, with an exact copy of the chat context up to that point. This would allow me to branch any chat or agent session as needed.

4 Likes

similar request on Reddit - link

1 Like

I agree, wholeheartedly. Cursor wrote a thesis on the topic for me:

# Cursor Feature Request: Forked Command Execution / Command Isolation Mode

## Title

Support forked chat execution for custom commands to preserve conversation context

## Problem Statement

Custom commands that perform complex multi-step operations generate substantial conversation noise (terminal output, file operations, user prompts) that clutters the main conversation thread and consumes token budget. This creates friction between:

1. **Design discussions** - High-level conversations about features, architecture, problem-solving

2. **Operational commands** - Multi-step workflows like commits, builds, refactoring, testing

**Current Behavior:**

When executing a custom command like `/commit` in an active conversation:

- All git commands, file reads, diffs, and prompts are added to conversation history

- Previous design discussion context is pushed out of view

- Token budget consumed by operational details rather than design thinking

- Difficult to resume prior conversation after command completes

**Example:** A `/commit` command may generate 50+ tool calls and 15K+ tokens of operational output, which interrupts and obscures the design conversation that led to those changes.

## Proposed Solution

Add capability for custom commands to execute in a **forked chat window** that:

1. **Clones relevant context** from the parent conversation (configurable depth)

2. **Executes the command** in an isolated chat session

3. **Preserves parent chat** without adding operational noise

4. **Optionally returns** summary results to parent chat upon completion

### Command Metadata Enhancement

```yaml

-–

description: Perform a multi-step commit operation

requires_tools:

  • run_terminal_cmd

  • read_file

  • write

  • search_replace

execution_mode: forked # NEW: run in forked chat window

context_depth: 50 # NEW: clone last N messages for context

return_summary: true # NEW: post completion summary to parent chat

-–

```

### User Experience Flow

1. User types `/commit` in a design discussion chat

2. Cursor opens new temporary chat window in background or side panel

3. New chat contains:

  • Last 50 messages from parent chat (for context)

  • Execution of `/commit` command with all its operational details

4. User interacts with `/commit` prompts in the forked chat

5. Upon completion, forked chat either:

  • Closes automatically and posts brief summary to parent chat, OR

  • Remains available as “Command Execution History” for review

6. Parent chat continues cleanly without operational clutter

### Alternative UI Approaches

**Option A: Side Panel Execution**

- Command runs in collapsible side panel

- Parent chat remains visible and usable

- Side panel shows all operational details

- Summary posted to parent on completion

**Option B: Background Execution**

- Command runs entirely in background

- Progress indicator in parent chat

- Click to expand operational details if needed

- Summary posted to parent on completion

**Option C: Tab-Based Execution**

- New chat tab created automatically

- Tab labeled with command name and timestamp

- Tabs persist in session for review

- Summary posted to parent on completion

## Use Cases

### 1. Multi-Step Git Workflows

**Command:** `/commit` (validate, stage, generate summary, update changelog, commit, tag)

**Why fork:** 30+ tool calls, diffs, git output clutters design conversation

**Context needs:** Recent changes discussed, feature intent, design decisions

### 2. Comprehensive Testing

**Command:** `/run-all-tests` (unit, integration, e2e with verbose output)

**Why fork:** Test output very verbose, parent chat focused on feature development

**Context needs:** What changed, why, which tests are expected to pass/fail

### 3. Large-Scale Refactoring

**Command:** `/refactor-module` (analyze dependencies, update files, verify, test)

**Why fork:** Many file operations, validation steps, but design discussion should continue

**Context needs:** Refactoring goals, architectural constraints, style guidelines

### 4. Build and Deployment

**Command:** `/deploy-to-staging` (build, test, deploy, verify)

**Why fork:** Long-running with progress output, main chat used for monitoring discussions

**Context needs:** What’s being deployed, expected behavior, rollback criteria

### 5. Code Generation from Specs

**Command:** `/generate-api` (read spec, generate code, tests, docs)

**Why fork:** Many file creations/edits, parent chat discussing API design

**Context needs:** API requirements, design decisions, integration points

## Benefits

### For Users

1. **Cleaner conversations** - Design discussions not interrupted by operational details

2. **Better context preservation** - Can continue design thinking while operations run

3. **Token efficiency** - Parent chat tokens spent on design, not git command output

4. **Audit trail** - Command execution history preserved separately for review

5. **Reduced cognitive load** - Don’t have to mentally filter operational noise

### For Custom Command Developers

1. **Freedom to be thorough** - Commands can validate, log, explain without cluttering

2. **Better error reporting** - Can show detailed diagnostics without overwhelming user

3. **Interactive workflows** - Multi-prompt operations don’t fragment parent conversation

4. **Quality summaries** - Can access parent context to write meaningful change descriptions

### For Cursor Platform

1. **Differentiation** - Sophisticated workflow capability competitors may not have

2. **Enterprise appeal** - Complex workflows crucial for regulated development

3. **Token optimization** - More efficient use of API quota

4. **Workflow enablement** - Unlocks new categories of custom commands

## Implementation Considerations

### Context Cloning

- Allow configuration of how much context to clone (N messages, time window, or manual selection)

- Consider token limits when cloning context

- Provide option to clone “summary only” vs. full messages

### Chat Lifecycle

- Auto-close after successful completion (configurable)

- Keep on error for debugging

- Provide “Command History” view to review past forked executions

- Limit number of simultaneous forked chats

### Parent-Child Communication

- Summary format (plain text, structured data, markdown)

- Ability to ask parent chat for additional context mid-execution

- Error propagation from child to parent

### Security/Privacy

- Ensure forked chats have same permissions as parent

- Workspace scope maintained

- File access restrictions preserved

## Alternatives Considered

### 1. Manual Chat Management (Current)

**Status:** Available now

**Process:** User manually opens new chat, provides context, runs command

**Drawbacks:** Manual overhead, context not automatically preserved, friction

### 2. Collapsed Output Sections

**Status:** Could be implemented without forked execution

**Process:** Command output collapsed by default, expandable

**Drawbacks:** Still in conversation history consuming tokens, less clean separation

### 3. External Script Orchestration

**Status:** Possible with custom tooling

**Process:** Script manages multiple Cursor CLI sessions

**Drawbacks:** Complex, requires Cursor CLI support, fragile, poor UX

### 4. Post-Execution Cleanup

**Status:** Could be attempted with AI instruction

**Process:** Command deletes its own conversation history after completion

**Drawbacks:** Probably not technically feasible, loses audit trail

## Similar Features in Other Tools

- **Jupyter Notebooks:** Separate execution context from narrative

- **IDE Background Tasks:** Build/test runs in separate panel

- **GitHub Actions:** Detailed logs separate from PR discussion

- **Slack Threads:** Operations happen in threads, summaries in main channel

## Success Criteria

Feature is successful if:

1. Users can run complex commands without cluttering design conversations

2. Commands can access parent conversation context for better summaries

3. Token usage reduced for parent chat by 50-80% during command execution

4. Command execution history is preserved and reviewable

5. Minimal additional clicks/friction compared to current inline execution

6. Works seamlessly with existing custom command system

## Priority Assessment

**Impact:** High - Addresses significant friction in custom command workflows

**Effort:** Medium-High - Requires chat management architecture, UI changes

**Adoption:** High - Benefits all users who create/use complex custom commands

**Differentiation:** High - Unique workflow capability

## Requested By

User developing medical device software with rigorous change tracking and documentation requirements. Custom `/commit` command performs comprehensive git workflow with automatic changelog generation but creates conversation noise that disrupts design discussions.

-–

**Submitted:** [Date]

**Category:** Custom Commands / Workflow Enhancement

**Affected Components:** Chat UI, Custom Command Execution, Context Management

Agree, branching is my #1 feature request for cursor, using it for hours every day.

I have great context for a huge rewrite I’m doing and now I have to choose if I use cursor to solve a problem or if I do it myself. It would be faster and easier with cursor if I could automatically re-use all my context on the architectural decisions of the rewrite, but I don’t want to poison that context with irrelevant small fixes, so I just don’t use cursor for them :frowning: