Summary
When the Claude CLI session underlying a conversation rotates (due to gateway restart, context compaction, or session timeout), the new Claude CLI process has no knowledge of the prior conversation. From the user's perspective, the AI has gone blank mid-conversation.
Behaviour
- User sends a message → Claude CLI session A handles it and responds
- For any reason, session A ends (gateway restarts, compaction fires, timeout, etc.)
- User sends a follow-up message → Claude CLI session B is spawned fresh
- Session B has no awareness of anything discussed in session A
The session transcript IS persisted to disk (.openclaw/agents/main/sessions/<session-id>.jsonl and ~/.claude/projects/.../<session-id>.jsonl), but it is not replayed into the new session on resume.
Root Cause
OpenClaw continues sessions using --continue <session-id>. When the process for that session has exited, a new CLI session is started. The new session begins with only the system prompt and no conversation history.
The contextPruning settings (ttl, keepLastAssistants) do not address this — they govern in-session pruning, not cross-session continuity.
Proposed Fix
On session resume (when the Claude CLI process for a session key no longer exists), OpenClaw should replay the recent transcript from disk into the new session before routing the user's message. A configurable resumeHistoryMessages limit (e.g. last N messages or last X tokens) would allow this without blowing up context on long conversations.
Observed Impact
- User messages are answered without context of prior exchange
- AI asks for clarification on things already established
- Trust and usability degraded, especially for multi-turn workflows
Environment
- OpenClaw version: 2026.5.2
- Session mode:
dmScope: per-peer
- Context pruning:
cache-ttl, ttl 24h, keepLastAssistants 20
- Claude CLI model: claude-sonnet-4-6 via OAuth
Summary
When the Claude CLI session underlying a conversation rotates (due to gateway restart, context compaction, or session timeout), the new Claude CLI process has no knowledge of the prior conversation. From the user's perspective, the AI has gone blank mid-conversation.
Behaviour
The session transcript IS persisted to disk (
.openclaw/agents/main/sessions/<session-id>.jsonland~/.claude/projects/.../<session-id>.jsonl), but it is not replayed into the new session on resume.Root Cause
OpenClaw continues sessions using
--continue <session-id>. When the process for that session has exited, a new CLI session is started. The new session begins with only the system prompt and no conversation history.The
contextPruningsettings (ttl, keepLastAssistants) do not address this — they govern in-session pruning, not cross-session continuity.Proposed Fix
On session resume (when the Claude CLI process for a session key no longer exists), OpenClaw should replay the recent transcript from disk into the new session before routing the user's message. A configurable
resumeHistoryMessageslimit (e.g. last N messages or last X tokens) would allow this without blowing up context on long conversations.Observed Impact
Environment
dmScope: per-peercache-ttl, ttl 24h, keepLastAssistants 20