anthropics / anthropics/claude-code
/clear and "Clear conversation" create a new empty session instead of clearing the current one
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
### What's Wrong?
Environment:
Claude Code version: 2.1.246 (extension cache also shows 2.1.273 present)
Platform: macOS (darwin-arm64)
Interface: VS Code extension, Session Manager sidebar UI
Expected behavior:
The current session's conversation history is cleared/truncated in place, keeping the same session active with an empty context (so token/context usage actually resets).
### What Should Happen?
Actual behavior:
A brand new session is created (new session ID, often inheriting the old session's custom title), while the original session remains fully intact and un-cleared underneath. The new session's .jsonl transcript contains only boilerplate:
### Error Messages/Logs
```shell
```
### Steps to Reproduce
Steps to reproduce:
Open an existing session with conversation history in the VS Code Claude Code panel
Either type /clear and submit, or select "Clear conversation" from the / command autocomplete panel
Observe the sidebar's session list
### Claude Model
Sonnet (default)
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.246
### Platform
Other
### Operating System
macOS
### Terminal/Shell
VS Code integrated terminal
### Additional Information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the behavior in the VS Code Claude Code panel, using both the /clear command and the "Clear conversation" entry in command autocomplete. Trace the Session Manager's clear-conversation entry point and inspect the resulting session ID and .jsonl transcript; done means the existing session is emptied in place, its context usage resets, and no new session is created.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, vscode
- Domain
- developer-experience, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100