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

  1. Open your terminal.
  2. Navigate to the hidden Claude directory: `cd ~/.claude`
  3. Locate your active session log file.
  4. Open the log file in a text editor.
  5. Delete all lines except for the very first line (the header).
  6. 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, 17 April 2026: Aims to let developers restart Claude Code in a fresh session state when hitting session-level usage thresholds.

Related

  • Boris Cherny's Claude Code Setup

    Battle-tested Claude Code workflow tips directly from the tool's creator

  • Claude Code

    Agentic command-line tool that navigates, edits, and debugs codebases directly

  • Kisuke

    Mobile and cross-platform IDE with terminal, browser devtools, and AI agents.

  • Awesome DESIGN.md

    Curated collection of plain-text design systems extracted from popular tech websites.

  • Google Antigravity

    Agentic development platform and IDE for running autonomous coding agents.

  • Mole

    Open-source macOS command-line toolkit for disk cleanup, uninstallation, and system monitoring

Updated