What Changed — Critical Fixes and New Monitoring
The Claude Agent SDK TypeScript just released v0.2.86, bringing Claude Code to version 2.1.86. This isn't just another incremental update—it fixes a critical bug that was breaking workflows and adds essential monitoring tools.
The most important fix: /compact was failing with "context exceeded" errors when conversations grew so large that the compact request itself couldn't fit. This was a frustrating edge case that could derail long sessions. Now it's resolved.
New monitoring capability: Added getContextUsage() control method that returns a breakdown of context window usage by category. This is the first native way to see exactly how your tokens are being allocated.
Edit reliability improvement: The SDK now includes seed_read_state control subtype to seed readFileState with {path, mtime} data. This ensures Edit operations continue working even after the original Read has been removed from context—crucial for maintaining file consistency in long-running sessions.
What It Means For Your Daily Workflow
/compact Now Works in All Scenarios
Previously, if you had a massive conversation and tried to compact it, the compact request itself could exceed context limits, causing the entire operation to fail. This forced manual cleanup or session restarts. Now /compact handles these edge cases gracefully.
When to use it: Continue using /compact regularly to manage token usage, but now you can be confident it won't fail on large sessions. This follows Anthropic's ongoing focus on improving Claude Code's reliability for complex, long-running tasks—a trend we've seen accelerate since their March 2026 Auto Mode release.
Monitor Your Token Allocation
The new getContextUsage() method gives you visibility into how Claude Code is using your context window:
// Example usage in your Claude Code integration
const usage = await claudeAgent.getContextUsage();
console.log(usage);
// Returns breakdown like:
// {
// totalTokens: 120000,
// conversationHistory: 45000,
// fileContents: 35000,
// systemPrompt: 15000,
// toolResults: 25000
// }
Why this matters: You can now identify what's consuming your context. Is it file contents? Conversation history? Tool results? This data lets you optimize your workflow—maybe you need more aggressive file pruning, or shorter conversation summaries.
More Reliable File Editing
The seed_read_state fix addresses a subtle but important issue: when Claude reads a file, makes changes elsewhere, then returns to edit that original file, it needs to know the file's state hasn't changed. Previously, if the original Read was compacted out of context, edits could fail or create conflicts.
Practical impact: Your file editing workflows are now more robust, especially when working across multiple files or in sessions that span hours.
Try It Now — Update and Configure
Update the SDK
# Update to the latest version
npm install @anthropic-ai/claude-agent-sdk@0.2.86
# or
pnpm add @anthropic-ai/claude-agent-sdk@0.2.86
Enable Session State Events (Optional)
If you're building integrations that need to track session state changes:
# Set this environment variable to receive session_state_changed events
export CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS=1
Note: These events are now opt-in to reduce overhead for most users.
Other Notable Improvements
- Terminal fixes: Ctrl+C and Ctrl+D now work correctly after quitting in Ghostty, Kitty, WezTerm, and other terminals supporting the Kitty keyboard protocol
- Performance: Reduced UI stutter when compaction triggers, improved scroll performance with large transcripts
- MCP improvements: One headers helper can now serve multiple servers using
CLAUDE_CODE_MCP_SERVER_NAMEandCLAUDE_CODE_MCP_SERVER_URLenvironment variables - Hook optimization: Added conditional
iffield for hooks using permission rule syntax (e.g.,Bash(git *)) to filter when they run, reducing process spawning overhead
When You'll Notice the Difference
- Long refactoring sessions: When you've been working for hours and
/compactpreviously failed - Memory-intensive tasks: When you need to monitor why you're hitting context limits
- Multi-file projects: When editing files that were read much earlier in the session
- Integration development: When building tools on top of Claude Code that need session state visibility
This update continues Anthropic's pattern of addressing real workflow pain points—not just adding features, but fixing what breaks. The /compact fix alone makes this a must-update for power users.




