{
  "markdown": "# claude-tab-fix\n\n<p align=\"center\">\n  <img src=\"logo.png\" alt=\"claude-tab-fix logo\" width=\"256\"/>\n</p>\n\nA Claude Code hook that warns Claude about tab-indented files — preventing silent Edit failures and mixed-indentation corruption.\n\n## Problem\n\nClaude Code's `Read` tool formats output as `N\\t<line content>`, using a tab as the line-number separator. For tab-indented files this is visually identical to the file's own indentation — Claude cannot distinguish the separator tab from content tabs, so it often produces `old_string` with wrong indentation.\n\nClaude Code also validates `old_string` against the file **before** calling PreToolUse hooks. This means hooks cannot fix indentation mismatches automatically — they can only warn Claude so it corrects itself.\n\n## Installation\n\n### prebuilt\n\ngo to the right side of this website and look for releases for a bin/exe download. download that. Save the exe in a place where it is safe from deletion, and set PATH to point to this folder. \n\n## via go\n\n```sh\ngo install github.com/WithHolm/claude-tab-fix@latest\n```\n\n### build from source\n\n```sh\ngit clone https://github.com/WithHolm/claude-tab-fix\ncd claude-tab-fix\nmake install\n```\n\n## Setup\n\n### As a plugin (recommended)\n\nInstall the binary first, then install the plugin so Claude Code picks up the hook automatically:\n\n```sh\n# 1. Install the binary\ngo install github.com/WithHolm/claude-tab-fix@latest\n\n# 2. Install the plugin\n/plugin marketplace add WithHolm/claude-tab-fix\n/plugin install claude-tab-fix@WithHolm/claude-tab-fix\n```\n\nThe plugin registers both hooks for you — no manual config editing needed.\n\n### Manually\n\nInstall the binary, then add the hooks to your Claude Code settings.\n\n**Per-project** — commit `.claude/settings.json` to your repo so anyone who clones it gets the hooks automatically:\n\n```json\n{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [{ \"type\": \"command\", \"command\": \"claude-tab-fix\" }]\n      },\n      {\n        \"matcher\": \"Write\",\n        \"hooks\": [{ \"type\": \"command\", \"command\": \"claude-tab-fix\" }]\n      }\n    ],\n    \"PostToolUse\": [\n      {\n        \"matcher\": \"Read\",\n        \"hooks\": [{ \"type\": \"command\", \"command\": \"claude-tab-fix\" }]\n      }\n    ]\n  }\n}\n```\n\n**Globally** — add the same block to `~/.claude/settings.json` to enable it for every project on your machine.\n\nIf the binary is not on your `PATH`, use the full path: `$(go env GOPATH)/bin/claude-tab-fix`.\n\n## Nice Tip\n\nAdd explicit deny for the different commands claude normally uses for edit in the claude settings. the file for your current porject should be in `<project root>/.claude/settings.json` (or `settings.local.json`) or in your `home/.claude...`\n\nfor linux the folling commands are recomended (just remove the python3 if you do any python work..)\n``` json\n  \"deny\": [\n    \"Bash(sed:*)\",\n    \"Bash(awk:*)\",\n    \"Bash(tr:*)\",\n    \"Bash(xargs:*)\",\n    \"Bash(python3:*)\"\n  ],\n```\n\n**missing info from windows.. if anyone have any info here, please open a pr or write a issue and il add it..** \n\n\nwhen combined with the added context this tool gives (\"hey claude, please remember that the read tool is kinda borked...\") it forces claude to fall back into the edit path instead of using any other edit tools:\n![hey](example.png)\n\n\n\n## How it works\n\n**PostToolUse / Read** — after every `Read` call on a tab-indented file, the hook injects a context note reminding Claude that the `N\\t` line-number prefix is a separator tab, not part of the file content. Claude uses this information to construct correct `old_string` with proper tab indentation.\n\n**PreToolUse / Bash** — before `sed`, `awk`, `perl`, or `python` commands that target a tab-indented file, the hook warns Claude to use the `Edit` tool instead, since shell commands bypass indentation awareness.\n\n**PreToolUse / Write** — before overwriting a tab-indented file, the hook checks whether the new content uses a different indent style. If writing spaces to a tab file (or vice versa), it warns that the result will have mixed indentation and strongly suggests using `Edit` instead.\n\n## Edge cases handled\n\n| Situation | Behaviour |\n|---|---|\n| File doesn't exist | Pass through |\n| Binary file | Pass through |\n| File uses spaces | Pass through (no warning needed) |\n| `Bash` on non-file-edit command (`go test`, etc.) | Pass through |\n| `Write` with matching indent style | Pass through |\n| `Read` on non-tab file | Pass through |\n\nThe hook fires on `Read` (PostToolUse), `Bash`, and `Write` (PreToolUse). A `CLAUDE.md` file is included in the release archive; placing it in your project root reinforces tab-awareness at session start.\n\n## Development\n\n```sh\nmake build   # build ./claude-tab-fix binary\nmake fmt     # run gofmt\nmake install # go install\ngo test ./...\n```\n",
  "bytes": 4795,
  "sha": "070d98b8993f30a91bfe6d1d053f41d9c48c0dd9cb839cc3106d05d8a9d50106",
  "repo_slug": "withholm/claude-tab-fix",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_withholm_claude_tab_fix_claude_tab_fix_6664877c/readme"
}