claude-code - 💡(How to fix) Fix [BUG] /clear command doesnt work and it opens a new chat with the name of "/clear" [3 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53316Fetched 2026-04-26 05:18:52
View on GitHub
Comments
3
Participants
4
Timeline
8
Reactions
0
Timeline (top)
labeled ×4commented ×3cross-referenced ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Typing /clear in the chat input does not clear the current conversation. Instead, it opens a new session with "/clear" as the session name. The original conversation remains unchanged and the session list accumulates multiple entries titled "/clear".

What Should Happen?

The /clear command should clear the current conversation context within the active session, not create a new one.

Error Messages/Logs

Steps to Reproduce

  1. Open an active Claude Code session in the VSCode extension
  2. Type /clear in the chat input and press Enter
  3. Instead of clearing the conversation, a new session is created named "/clear"
  4. Repeating this creates multiple sessions all named "/clear" in the session history

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.113

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

<img width="1277" height="497" alt="Image" src="https://github.com/user-attachments/assets/6a1a34f7-410f-4dd7-9037-83fb421d61b8" /> <img width="538" height="421" alt="Image" src="https://github.com/user-attachments/assets/03cf22db-a5c5-4378-badb-e2ae0b66a72b" />

extent analysis

TL;DR

The /clear command in the chat input should be handled as a special command to clear the conversation context instead of being treated as a session name.

Guidance

  • Review the code handling the /clear command to ensure it correctly interprets the command and clears the conversation context.
  • Verify that the command handler is properly registered and executed when the /clear command is entered.
  • Check the session management logic to prevent creating a new session when the /clear command is received.
  • Test the fix by repeating the steps to reproduce the issue and confirming that the conversation context is cleared as expected.

Notes

The provided images do not offer additional technical insight into the issue, and without access to the codebase, a precise fix cannot be provided. The guidance is based on the assumption that the issue lies in the command handling and session management logic.

Recommendation

Apply a workaround by modifying the command handler to correctly interpret the /clear command, as this is likely a bug in the current version (2.1.113) that was not present in a previous version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] /clear command doesnt work and it opens a new chat with the name of "/clear" [3 comments, 4 participants]