Claude Code v2.1.248: Restricted Mode, Cache TTL, and Session Fixes
Claude Code v2.1.248 shipped with a new restricted execution mode, per-agent cache TTL configuration, and a batch of stability fixes for prompt caching and session management.
Restricted Mode
You can now run Claude Code with --restricted (or set CLAUDE_CODE_RESTRICTED=1). This removes all built-in tools that execute commands or code, plus WebFetch unless explicitly named in --tools. File operations stay inside the working directory, bypassPermissions is refused, and user/project/local settings files are ignored. This is useful for untrusted code reviews or CI environments.
Cache TTL Per Agent
You can now set a prompt-cache TTL in agent frontmatter via experimental.cacheTtl: "5m" or "1h". This applies when no subagent TTL is configured, giving you finer control over cache expiration for specific agents.
Self-Hosted Runner and Settings Diagnostics
The claude self-hosted-runner command gains a --client-label flag (or SELF_HOSTED_RUNNER_CLIENT_LABEL) to override the default label (hostname). Startup now warns if server-managed settings fail to load, and /doctor and /status explain the failure reason. Also, /usage-credits lets Enterprise members request higher limits from admins (AWS Marketplace, self-serve, trials).
Cross-Session Messaging
Added SendMessage and ListAgents for cross-session messaging on the same machine, now supported on Bedrock, Vertex, Foundry, and when telemetry is disabled.
Key Fixes
- Prompt-cache misses in long sessions (roughly hourly) caused by tool re-rendering after OAuth refresh — fixed.
- ScheduleWakeup tool definition changing on overage, causing cache misses on
--resume— fixed. - Desktop/Cowork sessions disappearing after 30 days — fixed; new
desktopSessionCleanupPeriodDayssetting caps the exemption. - Login loop when another process held the token refresh lock — now returns a retryable error.
- Windows: agents list now responds to keyboard after detaching or in win32-input-mode.
- /login with
ANTHROPIC_API_KEYset falls back to API-key sign-in instead of failing with OAuth. - Model names in
/modelrender as code (e.g.,[1m]literal). - Agents skip workspace trust prompt when
CIis set — fixed to show it. - Agent view no longer resurrects stale background sessions; stopped sessions show as stopped.
- Duplicate processes on resumed sessions — prevented.
- Deletion of sessions with merged-but-unpushed branches — allowed.
- Invalid hook answers now show hook name and schema error.
- Invalid JSON from hooks reported as errors, not silently treated as text.
/mcplists connector entries under actual scope, and MCP servers withheadersHelperre-run helper on 401 instead of OAuth fallback.
📖 Read the full source: GitHub Claude-Code
👀 See Also

Analysis of 413K AI Agent Runs Reveals What Makes Them Succeed
An analysis of 413,278 AI software engineering agent runs from the CoderForge-Preview dataset shows that human software engineering best practices often harm agent performance. The data reveals specific patterns that separate successful from failing runs on the same problems.

Anthropic's New Claude Subscription Credits: Agent SDK and claude -p Get Separate Capped Pool Starting June 15
Starting June 15, Claude subscribers get a separate monthly credit for Agent SDK and claude -p usage: $200/mo for Max 20x, $100 for Max 5x, $20 for Pro. Usage stops when credit depletes unless extra billing is opted in. Interactive Claude Code and chat remain on the subscription pool.

Teaching Claude Why: Anthropic's Approach to Eliminating Agentic Misalignment
Anthropic significantly reduced agentic misalignment (e.g., blackmail) in Claude models by training on reasons and principles rather than just demonstrations, achieving perfect scores since Claude Haiku 4.5.

Apple Offers Free Private Cloud Compute to Indie Developers with Under 2M Downloads
Apple announced at WWDC 2026 that developers with fewer than 2 million first-time App Store downloads can use its Foundation Models in Private Cloud Compute with no cloud API cost. The framework also gains image input and support for server models.