Discovered: How to bypass Claude Code conversation limits by manipulating session logs

Reddit Discussion • r/ClaudeAI

TL;DR: git init in ~/.claude/, delete old log lines (skip line 1), restart Claude Code = infinite conversation

⚠️ Use at your own risk - always backup with git first

Found an interesting workaround when hitting Claude Code conversation limits. The session logs can be edited to continue conversations indefinitely.

The Discovery: Claude Code stores conversation history in log files. When you hit the conversation limit, you can actually delete the beginning of the log file and continue the conversation.

Steps:

  1. Setup git backup (CRITICAL)

    cd ~/.claude/
    git init
    git add .
    git commit -m "backup before log manipulation"
  2. Find your session ID

    • In Claude Code, type /session

    • Copy the session ID

  3. Locate the session log

    cd ~/.claude/
    # Find your session file using the ID
  4. Edit the session file

    • Open in VSCode (Cmd+P to quick open if on Mac)

    • IMPORTANT: Disable word wrap (Opt+Z for Mac) for clarity

    • DO NOT touch the first line

    • Delete lines from the beginning (after line 1) to free up space

  5. Restart the conversation

    • Close Claude Code

    • Reopen Claude Code

    • Continue sending messages - the conversation continues!

Why this works: The conversation limit is based on the total size of the session log. By removing old messages from the beginning (keeping the header intact), you free up space for new messages.

Risks:

  • Loss of context from deleted messages

  • Potential data corruption if done incorrectly

  • That's why git backup is ESSENTIAL

Pro tip: When context changes significantly, it's better to just start a new conversation. But if you're stuck and need to continue, this is your escape hatch.


Found this while debugging session issues. Use responsibly!

And also i tried different solution for it, but not good as expected for now @yemreak/claude-compact

Last updated

Was this helpful?