by shigemk2

当面は技術的なことしか書かない

claude cli上のconversationを削除する方法

ない gemini-cliにはコマンドがあるのにね…

clearしてファイル直接消すしかない…

There is no built-in command like /delete-conversation to remove a single conversation from your history. However, you can manually delete the conversation file from your local system.

Here’s a breakdown of how conversations are stored and how you can remove one:

Conversation Storage: Claude Code stores each conversation session as a separate .jsonl file on your local machine. These files are typically located in a path ~/.claude/projects/.

Finding the Conversation:

Run claude --resume or claude -r. This will display an interactive list of your recent conversations, showing the start time and initial prompt. Use this list to identify the specific conversation you want to delete. Note its details (e.g., date, initial prompt). Deleting the File:

Navigate to the conversation storage directory (e.g., ~/.claude/projects/ and its subdirectories). Locate the .jsonl file that corresponds to the conversation you want to remove. The file will have a unique session ID as its name (e.g., 00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl). You may need to inspect the contents of the files to match them to the conversation from the --resume list. Delete the file using a standard command like rm .jsonl. In summary, the process is:

Use claude --resume to identify the conversation. Navigate to your local conversation history directory (~/.claude/projects/). Manually find and delete the corresponding .jsonl file. Note: The /clear command only clears the history of the current active session, and the cleanupPeriodDays setting in settings.json automatically purges conversations older than a certain number of days, but neither allows for deleting a specific, single conversation.

github.com