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.
Auto Session State
BetaBeta introduces session-state.cjs — a hook that automatically persists and restores session progress across compactions and restarts.
- • State saved to .claude/session-state/.last-state.md
- • Auto-loads on SessionStart (startup or after compact)
- • Auto-saves on Stop and SubagentStop events
- • State includes: last active plan, todo items, subagent outputs, branch/commit status
- • Archives old state — rotates after 10 sessions
- • Fail-open design: non-blocking if hook errors
Beta auto-persists session state. Manual recovery (/resume, /export) still works as fallback.
Warning: Google Account Bans
Google is actively banning accounts using Antigravity/Gemini OAuth with third-party tools (OpenCode, CLIProxy-based tools like CCS, AntigravityManager, etc.). Using these tools may violate Google's ToS and result in permanent loss of access to Google services. Use GLM or Kimi as safer alternatives.
Understanding Sessions
Every conversation with Claude Code creates a session with a unique ID. Sessions are stored locally per project.
~/.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
Session Sharing
ImportantDefault Claude, API profiles, and CLIProxy share session storage. CCS sub-accounts have separate isolated sessions.
- • Default Claude ↔ API profiles (GLM, Kimi)
- • API profiles ↔ CLIProxy (gemini, codex, agy)
- • Default Claude ↔ CLIProxy
- • All stored at ~/.claude/projects/{project}/
- • 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
Option 2: Copy session .jsonl file to target config directory (e.g., ~/.claude/projects/{project}/ → ~/.ccs/instances/{name}/projects/{project}/).
Resume Sessions
Default Claude, API profiles (GLM, Kimi), and CLIProxy (gemini, codex, agy) can /resume each other. See Session Sharing above for details.
> /resume > /resume 74f292c0-49fa-41c0-a2d8-dd2c3ef9c4be ccs glm --resume ccs agy --resume 74f292c0-49fa-41c0-a2d8-dd2c3ef9c4be
Export Context
For Bloated SessionsWhen your session context is too large (100K+ tokens), /resume just moves the problem. Use /export to start fresh with only the essential context.
Use /export when context is bloated, OR when switching to/from CCS sub-account (isolated).
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.
Pro Tips
Power UserAdvanced tricks for seamless session recovery when you need them most.
# 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"
# 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
# Inside your current session, when you hit rate limit: /login # Select a different Claude sub-account # Then type "continue" to resume your work continue
# When token consumption is high, % usage nearing limit: /compact keep the original plan, user's request, key changes & todo tasks # ⚠️ Avoid using /compact without specific instructions: /compact # ❌ Important info may be lost!
Emergency Recovery Checklist
Bookmark this. When things go wrong mid-task, follow these steps:
DON'T PANIC
Your work isn't lost. Sessions are saved locally.
ASSESS CONTEXT SIZE
Check if session is bloated (slow responses = likely bloated)
IF CONTEXT HEALTHY → /RESUME
Use /resume (Default Claude, API profiles, CLIProxy all share sessions)
IF CONTEXT BLOATED → /EXPORT
Export and start fresh
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.