[FEATURE]
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
<head></head><h1 style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">[FEATURE] Claude Code should preserve Xcode undo history (Cmd-Z) when editing files</h1><h2 style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Summary</h2><p style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Claude Code CLI writes files directly to disk, which destroys Xcode's in-memory undo stack. When Xcode detects an external file modification, it reloads the file and Cmd-Z no longer works. This forces developers into slower recovery workflows (<code>ccundo</code>,<span class="Apple-converted-space"> </span><code>git checkout</code>,<span class="Apple-converted-space"> </span><code>/rewind</code>) instead of the native IDE undo they rely on.</p><p style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">ChatGPT's "Work with Apps" feature solves this by using the macOS Accessibility API to edit through Xcode's editor buffer, preserving full Cmd-Z undo history. Claude Code has no equivalent mechanism.</p><h2 style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Current State</h2>
Workflow | Opus 4.6 | Cmd-Z Undo | Billing
-- | -- | -- | --
Claude Code CLI (Max subscription) | ✅ | ❌ | Included
Claude Code CLI + Xcode MCP bridge (Max subscription) | ✅ | ❌ | Included
Xcode native Coding Intelligence (Max subscription login) | ❌ Sonnet 4 only | ✅ | Included
Xcode + Anthropic API key | ✅ | ✅ | Pay-per-token (separate from subscription)
ChatGPT "Work with Apps" + Xcode | ✅ (GPT models) | ✅ | Included in ChatGPT subscription
<p style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">There is no path to<span class="Apple-converted-space"> </span><strong>Opus 4.6 + Cmd-Z undo in Xcode</strong><span class="Apple-converted-space"> </span>without paying additional API charges on top of a Max subscription.</p><h2 style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Problem</h2><ol style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><li><p><strong>Destructive undo history</strong>: Claude Code's filesystem writes clobber Xcode's undo stack. Developers cannot incrementally revert AI-suggested changes using the standard IDE workflow.</p></li><li><p><strong>Model restriction in Xcode native integration</strong>: The Xcode Coding Intelligence integration (via subscription login) only exposes Sonnet 4, not Opus 4.6, even for Max subscribers. Opus 4.6 is available in Claude Code CLI under the same subscription.</p></li><li><p><strong>Workaround tax</strong>: The only way to get Opus 4.6 in Xcode with undo is to add an Anthropic API key as a custom model provider, which incurs pay-per-token charges ($5/$25 per MTok for Opus 4.6) on top of the Max subscription fee.</p></li><li><p><strong>Competitive gap</strong>: ChatGPT's macOS app uses the Accessibility API to edit inside Xcode's text buffer natively. This preserves Cmd-Z, requires no extra billing, and provides a smoother developer experience.</p></li></ol><h2 style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Proposed Solutions (any of the following)</h2><ol style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><li><p><strong>Accessibility API support</strong>: Edit files through Xcode's editor buffer (via macOS Accessibility API) instead of direct filesystem writes, preserving native undo history.</p></li><li><p><strong>Expose Opus 4.6 in Xcode native integration</strong>: Allow Max subscribers to select Opus 4.6 (not just Sonnet 4) in Xcode's Coding Intelligence settings when logged in with their Claude account.</p></li><li><p><strong>MCP bridge editor-aware writes</strong>: When connected to Xcode via MCP bridge, route file edits through Xcode's editing tools rather than filesystem writes.</p></li></ol><h2 style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Environment</h2><ul style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><li><strong>Plan</strong>: Claude Max ($200/month)</li><li><strong>Tool</strong>: Claude Code CLI (latest) + Xcode 26.3</li><li><strong>Platform</strong>: macOS</li><li><strong>Current workarounds</strong>:<span class="Apple-converted-space"> </span><code>ccundo</code><span class="Apple-converted-space"> </span>(third-party),<span class="Apple-converted-space"> </span><code>/rewind</code>,<span class="Apple-converted-space"> </span><code>git checkout</code></li></ul><h2 style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Related Issues</h2><ul style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><li><a href="https://github.com/anthropics/claude-code/issues/22003">#22003</a><span class="Apple-converted-space"> </span>— Xcode Core Data model corruption from external file changes</li><li><a href="https://github.com/anthropics/claude-code/issues/15520">#15520</a><span class="Apple-converted-space"> </span>— Feature request for native Claude Code extension for Xcode</li><li><a href="https://github.com/anthropics/claude-code/issues/29521">#29521</a><span class="Apple-converted-space"> </span>— VS Code undo restores code but not conversation state</li></ul># [FEATURE] Claude Code should preserve Xcode undo history (Cmd-Z) when editing files
Summary
Claude Code CLI writes files directly to disk, which destroys Xcode's in-memory undo stack. When Xcode detects an external file modification, it reloads the file and Cmd-Z no longer works. This forces developers into slower recovery workflows (ccundo, git checkout, /rewind) instead of the native IDE undo they rely on.
ChatGPT's "Work with Apps" feature solves this by using the macOS Accessibility API to edit through Xcode's editor buffer, preserving full Cmd-Z undo history. Claude Code has no equivalent mechanism.
Current State
| Workflow | Opus 4.6 | Cmd-Z Undo | Billing |
|---|---|---|---|
| Claude Code CLI (Max subscription) | ✅ | ❌ | Included |
| Claude Code CLI + Xcode MCP bridge (Max subscription) | ✅ | ❌ | Included |
| Xcode native Coding Intelligence (Max subscription login) | ❌ Sonnet 4 only | ✅ | Included |
| Xcode + Anthropic API key | ✅ | ✅ | Pay-per-token (separate from subscription) |
| ChatGPT "Work with Apps" + Xcode | ✅ (GPT models) | ✅ | Included in ChatGPT subscription |
There is no path to Opus 4.6 + Cmd-Z undo in Xcode without paying additional API charges on top of a Max subscription.
Problem
- Destructive undo history: Claude Code's filesystem writes clobber Xcode's undo stack. Developers cannot incrementally revert AI-suggested changes using the standard IDE workflow.
- Model restriction in Xcode native integration: The Xcode Coding Intelligence integration (via subscription login) only exposes Sonnet 4, not Opus 4.6, even for Max subscribers. Opus 4.6 is available in Claude Code CLI under the same subscription.
- Workaround tax: The only way to get Opus 4.6 in Xcode with undo is to add an Anthropic API key as a custom model provider, which incurs pay-per-token charges ($5/$25 per MTok for Opus 4.6) on top of the Max subscription fee.
- Competitive gap: ChatGPT's macOS app uses the Accessibility API to edit inside Xcode's text buffer natively. This preserves Cmd-Z, requires no extra billing, and provides a smoother developer experience.
Proposed Solutions (any of the following)
- Accessibility API support: Edit files through Xcode's editor buffer (via macOS Accessibility API) instead of direct filesystem writes, preserving native undo history.
- Expose Opus 4.6 in Xcode native integration: Allow Max subscribers to select Opus 4.6 (not just Sonnet 4) in Xcode's Coding Intelligence settings when logged in with their Claude account.
- MCP bridge editor-aware writes: When connected to Xcode via MCP bridge, route file edits through Xcode's editing tools rather than filesystem writes.
Environment
- Plan: Claude Max ($200/month)
- Tool: Claude Code CLI (latest) + Xcode 26.3
- Platform: macOS
- Current workarounds:
ccundo(third-party),/rewind,git checkout
Related Issues
- [#22003](https://github.com/anthropics/claude-code/issues/22003) — Xcode Core Data model corruption from external file changes
- [#15520](https://github.com/anthropics/claude-code/issues/15520) — Feature request for native Claude Code extension for Xcode
- [#29521](https://github.com/anthropics/claude-code/issues/29521) — VS Code undo restores code but not conversation state
Proposed Solution
Equivalent to ChatGPT, using accessibility API
Alternative Solutions
_No response_
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗