[BUG] Context Compaction Generates Fabricated Pending Tasks Leading to Unintended Action Initiation

Resolved 💬 2 comments Opened May 14, 2026 by TechTraveler Closed Jun 12, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When context compaction occurs mid-session, the compaction summary (itself model-generated) can convert unrequested audit findings into fabricated pending tasks. When paired with the continuation prompt instruction to "resume directly without asking questions," this causes the model to initiate actions based on work the user never requested. In sessions with elevated or pre-authorized permissions, this failure chain would execute without any safeguard.

What Should Happen?

The compaction summary should distinguish between:

  • Findings from a completed audit (informational, no action authorized)
  • Tasks explicitly requested by the user (action authorized)

Error Messages/Logs

Steps to Reproduce

This occurred in a long multi-task session. The session included:

  1. A broad script audit — model reviewed ~95 PowerShell scripts and produced a written findings report, noting various categories of issues including scripts using the deprecated AzureAD PowerShell module.
  2. User requested specific follow-on work based on that audit:
  • Move 4 scripts with exposed credentials to a new folder → completed
  • Rewrite MSOnline-dependent scripts to Microsoft Graph SDK equivalents → completed
  1. Session shifted focus entirely to a different script (Set-Autologon.ps1) — redesigned and rewritten over many exchanges.
  2. Session ended with a reflective conversational exchange. No new work was queued.
  3. Context compaction occurred.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.141

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

bug-report-compaction-task-hallucination.md

Claude VSCode.log.log

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗