Session Recovery & Resume

Never lose progress when switching models

Hit a rate limit? Model error? Learn how to resume sessions, export context, and seamlessly continue your work.

1

Understanding Sessions

Every conversation with Claude Code creates a session with a unique ID. Sessions are stored locally per project.

File path:
~/.claude/history.jsonl
# Find your session ID from history
cat ~/.claude/history.jsonl | tail -5

# Look for sessionId in the JSON object
# Example output:
{"display":"/clear","timestamp":1765163522956,"project":"...","sessionId":"74f292c0-49fa-41c0-a2d8-dd2c3ef9c4be"}

# Sessions are stored per-project in:
# ~/.claude/projects/{project-path-encoded}/{session-id}.jsonl
Key Insight
Sessions are project-based. Default Claude, API profiles, and CLIProxy share sessions. Only CCS sub-accounts are isolated.
2

Session Sharing

Important

Default Claude, API profiles, and CLIProxy share session storage. CCS sub-accounts have separate isolated sessions.

βœ… SHARED Sessions (Switch Freely)
  • β€’ Default Claude ↔ API profiles (GLM, Kimi)
  • β€’ API profiles ↔ CLIProxy (gemini, codex, agy)
  • β€’ Default Claude ↔ CLIProxy
  • β€’ All stored at ~/.claude/projects/{project}/
❌ ISOLATED Sessions
  • β€’ CCS sub-accounts (work, personal,...)
  • β€’ Each instance has separate folder: ~/.ccs/instances/{name}/
  • β€’ Cannot switch to other sub-accounts
  • β€’ Cannot switch to Default Claude/API profiles/CLIProxy
Why?
Default Claude, API profiles, and CLIProxy all use ~/.claude/. CCS sub-accounts override CLAUDE_CONFIG_DIR to ~/.ccs/instances/{name}/ so sessions are completely isolated.
Workarounds (For CCS Sub-accounts)
Option 1: Use /export before switching, then paste key context in new session.
Option 2: Copy session .jsonl file to target config directory (e.g., ~/.claude/projects/{project}/ β†’ ~/.ccs/instances/{name}/projects/{project}/).
3

Resume Sessions

Default Claude, API profiles (GLM, Kimi), and CLIProxy (gemini, codex, agy) can /resume each other. See Session Sharing above for details.

Option 1: Interactive resume
Shows recent sessions list to pick from
> /resume
Option 2: Specific session ID
Resume with specific session ID
> /resume 74f292c0-49fa-41c0-a2d8-dd2c3ef9c4be
Option 3: Command line
Resume directly when starting CCS
ccs glm --resume
ccs agy --resume 74f292c0-49fa-41c0-a2d8-dd2c3ef9c4be
Seamless Continuation
All context from the previous session is restored. Continue exactly where you left off.
4

Export Context

For Bloated Sessions

When your session context is too large (100K+ tokens), /resume just moves the problem. Use /export to start fresh with only the essential context.

Context Bloated
Session > 100K tokens, /resume just moves the problem
Fresh Start
Keep only essential context, discard noise
Share Externally
Teammates, documentation, backup
Step 1: Export β€” Export current conversation to a text file
/export # Creates conversation.txt in current dir /export ~/backup/session # Custom path
Step 2: Start Fresh β€” Start a new session with a cheaper provider
ccs glm
Step 3: Paste Context β€” Manually transfer the essential context
> "Here's my previous context: [paste key parts of export]" > "Continue implementing the auth handler"
When to Use Which?
Use /resume when context is healthy (Default Claude, API profiles, CLIProxy all share sessions).
Use /export when context is bloated, OR when switching to/from CCS sub-account (isolated).
5

Model Fallback Strategies

Set up multiple terminals with providers ready. Default Claude, API profiles, CLIProxy can /resume each other. Only CCS sub-accounts are isolated.

Setup Multiple terminals ready
# Terminal 1: ccs work (Claude - primary) # Terminal 2: ccs agy (Antigravity - backup) # Terminal 3: ccs glm (GLM - cost-optimized)
Decision Logic When Claude hits limit:
# Context healthy? β†’ /resume in another terminal # Context bloated? β†’ /export, then fresh session
Quick Switch Resume with full context
ccs glm --resume
Claude
Primary: Complex tasks
Antigravity
Backup: Full Claude power
GLM
81% cheaper: Implementation
6

Pro Tips

Power User

Advanced tricks for seamless session recovery when you need them most.

/rename for easy resume
Give your session a memorable name instead of using UUID
# During your session, rename it:
/rename auth-feature

# Later resume by name OR UUID (both work):
/resume auth-feature # βœ… Easy to remember
/resume 74f292c0...  # βœ… Still works

# Or run directly from terminal:
ccs glm/agy "/resume auth-feature"
--continue trick
Auto-continue last session when kicked out unexpectedly
# If you got kicked out of a session for any reason:
ccs glm/agy/work --continue continue

# This automatically resumes and continues your last session
/login account switch
Switch Claude accounts when one hits rate limit
# Inside your current session, when you hit rate limit:
/login

# Select a different Claude sub-account
# Then type "continue" to resume your work
continue
Multiple Claude Accounts
If you have multiple Claude sub-accounts, you can rotate between them when hitting rate limits. Use /login to switch accounts within the same session (context stays in memory). Note: CCS sub-accounts have separate sessions, cannot /resume from another terminal.

Emergency Recovery Checklist

Bookmark this. When things go wrong mid-task, follow these steps:

1

DON'T PANIC

Your work isn't lost. Sessions are saved locally.

2

ASSESS CONTEXT SIZE

Check if session is bloated (slow responses = likely bloated)

3

IF CONTEXT HEALTHY β†’ /RESUME

Use /resume (Default Claude, API profiles, CLIProxy all share sessions)

ccs glm --resume # Or inside Claude Code: /resume
4

IF CONTEXT BLOATED β†’ /EXPORT

Export and start fresh

/export ~/backup/session.txt ccs glm > "Context from previous session: [paste key parts]"
5

CONTINUE WORKING!

You're back in action.

Save 80%+ on Costs

Start complex tasks with Claude, then /resume with GLM (API profile) for routine implementation at 81% lower cost.

No Downtime

Don't let rate limits stop your flow. /resume in a compatible provider and continue working.