Try free

Last updated 13 October 2026

Delete specific Claude Code session data

Identifying the need to remove session history

You are working on a complex feature and notice the agent is making the same mistakes repeatedly. Every time you provide a new prompt, the agent pulls from the previous context window, which is now full of incorrect assumptions and discarded code snippets. This bloat slows down the response time and leads to hallucinations. You need to wipe the specific history of this interaction so the agent can start with a fresh perspective on your codebase without losing your global configuration.

Privacy is another significant driver for cleaning up session data. You might have accidentally entered sensitive information like a temporary API key or a private server address into the terminal. Even if you delete that information from your source files, it remains in the session logs on your local machine. To keep your development environment secure, you must find and remove these specific records. Simply closing the terminal window is not enough because the tool is designed to remember your progress for future work.

A cluttered history also makes it difficult to find the work that actually matters. When you use the resume features of the command line agent, a long list of old and irrelevant sessions can obscure the project you are currently focused on. Cleaning up these records ensures that when you look at your session history, you only see active and meaningful tasks. This reduces the mental load of navigating your project and helps you stay focused on the current sprint.

Using the resume command to audit your history

Before you can delete specific data, you need to identify which sessions are stored on your machine. Run the command claude --resume or the shorter version claude -r to see a list of your previous interactions. This command opens an interactive menu that shows you the sessions associated with your folders. You can see the names of the projects and the timestamps of when the last exchanges occurred. This is your primary tool for auditing what the agent has saved.

The resume list provides a clear map of your local session data. By reviewing this list, you can identify which sessions are no longer useful or contain data that you want to purge. If you see a session from a project you finished weeks ago, that is a prime candidate for removal. Knowing exactly what is stored allows you to be precise in your cleanup rather than blindly deleting your entire configuration folder and losing your custom preferences.

If you want to continue the very last session you worked on in a specific folder, you would use claude --continue or claude -c. However, for the purpose of cleaning up, the resume list is more helpful because it shows the broader history across different tasks. Take note of the session names or the order they appear in. While the tool does not currently offer a direct slash command to delete an entry from this list, identifying the sessions is the first step in manual cleanup.

Clearing context within an active session

If your goal is to stay within your current folder but start the conversation over, use the /clear command. This command wipes the current conversation history from the active session. The agent will no longer remember the previous prompts or the files it just read during this specific run. This is the most effective way to handle a session that has gone off the rails without needing to exit the terminal and navigate the file system.

The /clear command is a soft reset. It does not delete the session files from your hard drive, but it clears the context window that the agent uses to generate answers. This is useful when you have finished one part of a task and want to move to the next part without the agent being confused by the code you just wrote. It keeps your current session ID active but gives you a blank slate for your next prompt.

You can also use the /compact command if you want to save space without a total reset. This command summarizes the session so far and removes the full text of early exchanges. This is a form of data management that keeps the essential progress of your work while getting rid of the bulk. It is an excellent middle ground when you want to keep the agent aware of your goals but need to free up its memory for new file reads and complex edits.

Navigating the hidden storage directory

To perform a hard deletion of session data, you must go to the directory where the tool stores its persistent information. On most systems, this is located in your home directory under a folder named .claude. This is a hidden folder, so you may need to enable the viewing of hidden files in your file manager or use the terminal to list it. Inside this folder, you will find the configuration and history that the agent references every time you start a new task.

The ~/.claude/ directory contains the settings.json file which holds your global preferences. It also contains the records of your sessions. If you want to remove all traces of a session so it no longer appears in the resume list, you must find the specific file or subdirectory associated with that session and delete it manually. We do not have a specific command to automate this deletion yet, so manual intervention in the file system is the standard procedure.

Be careful when deleting files in ~/.claude/ to ensure you do not remove your login state or global settings. Look for files that are clearly marked as history or logs. If you are unsure which file belongs to which session, you can check the modification dates on the files. The file that was changed most recently likely corresponds to the session you just exited. Deleting these files will permanently remove that data from your local environment.

Managing project level configuration files

In addition to the global directory, each project has its own .claude folder in the repository root. This folder contains a settings.json file and potentially a settings.local.json file. These files govern how the agent behaves in that specific project, including permissions for tools like Read, Edit, and Write. If a session is behaving poorly because of a local setting, you can delete these files to reset the project behavior to the default state.

The settings.local.json file is particularly important because it is intended for your own untracked overrides. It is usually ignored by your version control system. If you have been experimenting with different permission modes like bypassPermissions or acceptEdits, these choices might be saved here. Deleting this file is a safe way to clean up your local environment without affecting the settings that other developers on your team are using in the main settings.json file.

When you remove the local .claude folder from a project, you are effectively telling the agent to treat the folder as a brand-new project the next time you run the claude command. This is a powerful way to clear out any project-specific baggage. It ensures that the agent will not rely on old tool permissions or specific project-level configurations that might be hindering your current development work.

Visualizing sessions with adhdTerminal

Managing dozens of different sessions across multiple projects can become overwhelming in a standard terminal. This is where adhdTerminal provides a cleaner alternative. It is a native app for macOS and Windows, made by MINDBALANCER OU in Estonia, and it is not affiliated with Anthropic. It runs many Claude Code sessions side by side, with each one appearing as a tile on a wall. This visual layout makes it much easier to see which sessions are active and which ones can be closed.

Each tile in adhdTerminal has a color, a number, and a name. It shows you the last exchanges of the conversation and whether the session is working, waiting for you, or idle. If you have a session that is no longer useful, you can simply remove the tile. Because the tiles reopen in the same place after a restart and resume the same session, you have a persistent and organized view of your work. This eliminates the need to constantly use the resume command to figure out where you left off.

The app costs 99 dollars once, and one key allows you to run it on one computer at a time. It also includes a free iPhone app that mirrors your wall of tiles over an end-to-end encrypted link. You can check the status of a long-running task or even send the next prompt from your phone. This level of visibility makes session management intuitive, as you can see exactly which tasks are cluttering your environment and clean them up with a single click.

Updating project instructions in markdown files

Sometimes what feels like a session data problem is actually an issue with your project instructions. The CLAUDE.md file sits in your repo root and holds specific instructions for the agent. If this file contains outdated information, the agent will continue to make mistakes regardless of how many times you clear the session. Check the root CLAUDE.md and any similar files in subdirectories to ensure they reflect your current coding standards.

The agent also looks for a global CLAUDE.md file in your ~/.claude/ directory. This file applies to every project you work on. If you notice a persistent bad habit in the agent's behavior across different repositories, the global instructions are likely the cause. Editing or deleting this file is a key part of cleaning up the 'memory' of how you want the agent to work. It is often more effective than clearing individual session caches.

By keeping these markdown files clean, you ensure that every new session starts with the correct rules. The agent uses these files to understand your preferred tools, like whether it should use Grep or Glob to find files, or how it should format its TodoWrite entries. Removing old or conflicting instructions from these files is a vital step in maintaining a high-quality development environment.

Verifying environment health with the doctor command

After you have manually deleted session files or modified your configuration, it is a good idea to verify the integrity of your installation. Run claude doctor to perform a self-check. This command will look for issues with your settings and ensure that the tool can still access the necessary directories. It is a safety measure that prevents you from accidentally breaking the tool while trying to clean up your data.

The doctor command checks for permissions and version health. If you have deleted something vital by mistake, this command will often flag the missing component. It can also help you identify if there are conflicting settings between your user-level ~/.claude/settings.json and your project-level .claude/settings.json. Resolving these conflicts is part of the cleanup process to ensure a predictable experience.

If the doctor command reports errors after your cleanup, you might need to run claude update to ensure you have the latest version of the tool. Sometimes, clearing out old data can reveal bugs that were hidden by cached configurations. Updating ensures that the agent is using the most recent logic for handling sessions and tool calls, which can prevent the very context bloat you were trying to solve in the first place.

Final steps for a clean development environment

To maintain a clean environment long-term, get into the habit of using /logout and /login occasionally. This can refresh your session tokens and clear out temporary data that might not be caught by a simple /clear command. It also ensures that your connection to the backend is fresh. This is particularly important if you frequently switch between different permission modes or use multiple MCP servers configured in your .mcp.json file.

Managing subagents and custom slash commands is the final piece of the puzzle. Custom commands are stored as markdown files in .claude/commands, and subagents live in .claude/agents. If you find that the agent is using outdated custom logic, check these directories and remove any files that are no longer relevant. These files persist across sessions, so they can be a hidden source of old data that affects your current work.

Using adhdTerminal can help you keep track of these custom agents and commands by giving them their own dedicated tiles. When you are done with a specific custom agent task, you can close the tile and delete the corresponding markdown file to keep your environment lean. This proactive approach to session and instruction management ensures that your command line coding agent remains a sharp and effective tool for your daily development work.

Questions people ask

Can I delete a single session directly from the resume list?

There is currently no specific slash command or flag to delete a single session entry from the list shown by claude --resume. You must navigate to the ~/.claude/ directory in your file system and manually remove the history files. Identifying the correct file usually requires checking the timestamp to match it with the session you wish to remove.

Does the /clear command delete files from my hard drive?

No, the /clear command only wipes the conversation history from the current active context window. The physical record of the session still exists in your local storage and will appear in the resume list. Use this command when you want to start a fresh conversation with the agent without changing your project or exiting the terminal.

What happens if I delete the .claude/settings.json file in a project?

Deleting the project-level settings.json file will cause the agent to revert to your global settings found in ~/.claude/settings.json. This is a safe way to reset tool permissions and other project-specific behaviors if the agent has become restricted or is acting unexpectedly. The agent will recreate a default settings file the next time you run a command in that folder.

Read next

More on when it goes wrong·All posts