Context compaction loses intra-session work memory — agent forgets actions performed earlier in the same active session
Bug Description
After context compaction occurs mid-session, Claude Code loses memory of actions it performed earlier in the same active session. This is not about cross-session memory — the session was never closed. The compaction happened while the conversation was ongoing.
Impact
This causes real work loss and confusion:
- The agent confidently claims it does not remember performing an action
- The user must re-explain work that was already done
- Trust in the agent's reliability is severely damaged
- Time is wasted re-doing or re-verifying completed steps
Steps to Reproduce
- Start a long Claude Code session with multiple tool calls (file writes, git operations, browser automation, etc.)
- Continue the session until context compaction is triggered automatically
- Ask the agent about something it did earlier in the same session (e.g. "did you save that file?", "what files did you back up?")
- Observe: the agent either denies doing it, or says it "cannot find evidence" of the action
Expected Behavior
Within a single active session, Claude Code should retain full memory of all actions it took — regardless of context compaction. The compaction summary should faithfully capture what was done, including file paths, git operations, and any artifacts created.
Actual Behavior
The compaction summary is incomplete or omits specific actions. The agent then treats unmentioned actions as if they never happened — even when the user explicitly states they occurred in the same session.
Example (this session, 2026-07-08)
The agent wrote backup files to the filesystem earlier in the session. After compaction, when asked "where did you save the backed-up files?", the agent searched the filesystem repeatedly and could not find them — even though it had created them. The user had to paste the earlier conversation back into the chat to prove it happened.
Severity
Critical — this undermines the fundamental reliability of the agent for professional use. An agent that forgets its own actions within a single session cannot be trusted for consequential tasks.
Environment
- Claude Code CLI (Windows 11 Enterprise)
- Model: claude-sonnet-4-6 via AWS Bedrock (eu-central-1)
- Session length: several hours, multiple context compactions