Development · Tip
Reset Claude Code Session Limits
Terminal workaround to clear Claude Code CLI session state and limits
This is a command-line trick to clear session history and local limits in Anthropic's Claude Code CLI. By trimming the active session log file inside the hidden Claude directory, users can start a clean session without losing their base configuration.
How it works
- Open your terminal.
- Navigate to the hidden Claude directory: `cd ~/.claude`
- Locate your active session log file.
- Open the log file in a text editor.
- Delete all lines except for the very first line (the header).
- Save the file and restart Claude Code to initiate a fresh session.
What it's for
- Clear accumulated context when hitting local session limits in Claude Code
- Reset Claude Code CLI to a fresh session state without reinstalling
- Purge long conversation history in terminal AI sessions
Key points
- Navigate to the hidden directory: cd ~/.claude
- Identify and open the active session log file in a text editor
- Delete all session lines except for the initial header row
- Save the file to preserve the session structure while clearing history
- Restart Claude Code to launch into an empty session state
Pricing
Free
Details
- Type
- Tip
- Category
- Development
- Topic
- CLI Utilities
- Platforms
- Command line, macOS, Linux
- For
- Developers using Anthropic's Claude Code CLI tool
- Tags
- claude, claude code, cli, terminal, ai coding, workaround
Why it was saved
- @technerdpeter: Aims to let developers restart Claude Code in a fresh session state when hitting session-level usage thresholds.
Related
Battle-tested Claude Code workflow tips directly from the tool's creator
Agentic command-line tool that navigates, edits, and debugs codebases directly
Mobile and cross-platform IDE with terminal, browser devtools, and AI agents.
Curated collection of plain-text design systems extracted from popular tech websites.
Agentic development platform and IDE for running autonomous coding agents.
Open-source macOS command-line toolkit for disk cleanup, uninstallation, and system monitoring
Updated