[BUG] "Clear Context" No longer removes old context fully
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?
I executed a /clear command immediately preceding a query regarding an issue (as I've done numerous times before), and despite the clear, was at nearly 80% context usage nearly immediately. When I asked Claude about why I would be suddenly at such a high level, the response is below - of which I would have expected points 2 & 3 to have not been included (ie the insight report and the associated plan):
A few things stacked up even after the clear:
System prompt is never cleared — CLAUDE.md plus the three @-referenced docs (collaboration.md, architecture.md, dev-standards.md) are injected on every turn. They're substantial.
The /insights skill output was carried forward — the system-reminder marked it as "skill invoked earlier in this session" and re-injected a large JSON payload into this conversation even though you had cleared. That alone was probably several thousand tokens.
The previous plan file content — plan mode injected the old plan (the long one covering items #1 and #38) via system-reminder at the start of the turn.
The Explore agent response was verbose — it returned full file contents for five files in one block.
Multiple file reads — dependencies.py, invoices.py, auth.py, test_pdf_endpoint.py all read into context in addition to the agent output.
The /clear clears your conversation history but the runtime continues re-injecting system-level context (CLAUDE.md, memory, skill state, active plan) on every turn. The practical fix for future sessions: after finishing a large workflow like the BACKLOG run, start a genuinely fresh session rather than clearing mid-session, which avoids the carried-over skill/plan reminders.
What Should Happen?
Clear should reset the context instead of maintaining old context (that's what compact is for).
Error Messages/Logs
Steps to Reproduce
- run /insights
- run following to generate BACKLOG.md:
Spawn 6 parallel audit subagents over my repo, each with a single focus: (1) tenant_id isolation correctness, (2) circuit breaker and decorator ordering across the codebase, (3) test coverage gaps in service layer, (4) DB migration safety, (5) frontend/backend contract drift, (6) dead code and unused exports. Each agent writes findings to audits/<name>.md with severity, file:line refs, and a suggested fix. Then a synthesis agent merges them into BACKLOG.md ranked by risk × effort, with auto-drafted implementation prompts I can paste back to you. - have Claude Code address the issues one at a time from the BACKLOG.md (mine was ~46 items)
- manually compact along the way
- once finished run clear
- ask Claude to investigate an issue, see the context is not actually reset
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.78
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗