Skip to content

fix(docs): correct Replace-mode write guidance for Claude Code (#1091) - #1118

Closed
andig wants to merge 1 commit into
yvgude:mainfrom
andig:fix/1091-replace-mode-write-docs
Closed

fix(docs): correct Replace-mode write guidance for Claude Code (#1091)#1118
andig wants to merge 1 commit into
yvgude:mainfrom
andig:fix/1091-replace-mode-write-docs

Conversation

@andig

@andig andig commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #1091.

Problem

The Claude Code CLAUDE.md Replace-mode block says:

Write and Delete — use native tools normally.

Under Replace mode native Read/Grep/Glob are denied. Claude Code's native Edit gates on a prior native Read of the same path, so Edit is unreachable; and native Write to an existing file is rejected (File has been modified since read) because ctx_read does not satisfy the harness read-precondition. Net: Edit never works and Write only works for brand-new files — ctx_patch is the real edit path.

Fix

  • Rewrite the Replace-mode block line to state ctx_patch is the edit path, native Edit needs a prior native Read (denied), native Write only for brand-new files, op=create for new files, Delete native.
  • Bump the shared block version lean-ctx-claude-v6 -> v7 so existing CLAUDE.md blocks are rewritten on next setup/doctor (the staleness check keys off the version tag).
  • Smoke test updated to assert v7.

The MCP block is unchanged — native Read -> Edit works there. Other harnesses are intentionally left alone: their read-before-write semantics differ (Pi's replace template already documents that native edit/write stay available).

Test

cargo test --test setup_ci_smoke — 5 passed.

🤖 Generated with Claude Code

…e#1091)

The Claude Code CLAUDE.md Replace-mode block said "Write and Delete — use
native tools normally", but under Replace mode native Read/Grep/Glob are
denied, and Claude Code's native Edit gates on a prior native Read of the
same path — so Edit is unreachable, and native Write only succeeds for
brand-new files. ctx_patch is the actual edit path.

Correct the block to say so, and bump the shared block version v6 -> v7
so existing CLAUDE.md blocks get rewritten on next setup/doctor. The MCP
block is unchanged (native Read -> Edit works there). Other harnesses are
left as-is: their read-before-write semantics differ (e.g. Pi's native
edit/write stay available).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yvgude

yvgude commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Cherry-picked to main as de4097b. Thank you for the contribution!

@yvgude yvgude closed this Jul 21, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctx_read does not satisfy the read-precondition for native Edit/Write

2 participants