notab

Tab/space normalization for AI editors

Go File Recovery GitHub

Replaces tabs with spaces so AI agents can read and edit files. Inverse mode converts leading spaces back to tabs for Makefiles and Go files.

Features

  • Convert tabs to spaces (configurable width)
  • Inverse mode: spaces back to tabs for Makefiles/Go
  • Reports replacements and lines affected
  • MCP server and CLI modes

Install

go install github.com/hegner123/notab@latest

The Problem: AI agents can't edit files with tabs

# Claude Code's Edit tool uses exact string matching.
# When a file uses tabs, the agent sees them as whitespace
# but can't reproduce the exact tab characters in edits.
#
# Result: Edit fails with "old_string not found"
# because the spaces in the edit don't match the tabs in the file.

Solution

$ notab --cli --file /path/to/problematic.go --spaces 4

Output

{"file":"/path/to/problematic.go","replacements":47,"lines_affected":23,"direction":"tabs_to_spaces"}

Comparison

MetricValue
UnblocksAI agents that can't edit tabbed files
Round-trip safeConvert to spaces, edit, convert back to tabs