[Bug] Read tool line-number prefix causes Claude to write short-wrapped lines in Edit replacements
Description
The Read tool displays file content with a line-number prefix (e.g., 1152→), which adds ~8 characters of visual width. When Claude then writes replacement text via the Edit tool, it calibrates line width to what it sees (including the prefix), producing lines wrapped at ~55-60 characters instead of the intended 72.
Impact
This is systematic. In a single session editing two IETF Internet-Draft files (kramdown-rfc markdown, 72-char line limit), Claude produced 739 short-wrapped lines in one file and 808 in another, across 12 PRs and 50+ Edit operations. Every replacement string was 8-15 characters too narrow.
Reproduction
- Open a file with 72-char wrapped prose
- Use Read to view a section
- Use Edit to replace a paragraph with new text
- Check line widths with awk
- Observe: replacement text is wrapped at ~55-65 chars, not 72
Expected behavior
Claude should produce replacement text at the correct target width regardless of the Read tool display prefix. Options:
- Make the line-number prefix visually distinct enough that width calibration is not affected (e.g., use a fixed narrow format)
- Strip the prefix from the context provided to the model for Edit operations
- Include metadata telling the model the prefix width so it can compensate
Workaround
A PostToolUse hook that runs a reflow script after every Edit to a target file. This fixes the output but adds latency and complexity.
Environment
- Claude Code 2.1.80
- macOS Darwin 25.3.0
- File type: kramdown-rfc markdown (.md)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗