---
name: tmp-path-windows
description: /tmp resolves to different directories in Git Bash vs Write tool on Windows; use .claude/tmp/ instead
applies-to: all
---

# /tmp Path Mismatch on Windows

## The problem

On Windows, `/tmp` resolves to two different real directories depending on which tool accesses it:

| Tool | /tmp resolves to |
|------|-----------------|
| Git Bash / curl | `%LOCALAPPDATA%\Temp\` (e.g., `C:\Users\Howard\AppData\Local\Temp\`) |
| Claude Code Write tool | `C:\tmp\` |

These are different directories. If you write a file with the Write tool to `/tmp/payload.json` and then read it back with curl in a Bash command, curl reads a stale file from a previous session — or a completely different file.

## Incident that established this rule

2026-05-01: The Write tool created `/tmp/comment_payload.json` in `C:\tmp\`. curl read `/tmp/comment_payload.json` from `%LOCALAPPDATA%\Temp\` — a stale payload from the previous day's Cascades session. The wrong comment (containing Karen Rossini / ALDOCS content) was posted to a Sombra ticket. The comment could not be deleted via the Syncro API.

## The fix: use .claude/tmp/ or heredocs

**Option 1 — Heredoc (preferred for JSON payloads):**

```bash
curl -s -X POST "${URL}" -H "Content-Type: application/json" --data-binary @- <<'JSON'
{"key": "value", "other": "data"}
JSON
```

No file involved — no path ambiguity. Use `<<'JSON'` for static content and `<<JSON` when you need shell variable interpolation.

**Option 2 — .claude/tmp/ directory:**

Both the Write tool and Git Bash agree on the absolute Windows path when you use the repo-relative temp directory:

```
D:/claudetools/.claude/tmp/
```

Write files there using the Write tool, then read them in Bash with `D:/claudetools/.claude/tmp/filename`. Forward slashes work in Git Bash.

```bash
# After writing with Write tool to D:/claudetools/.claude/tmp/payload.json
curl -s -X POST "${URL}" -H "Content-Type: application/json" \
  -d @D:/claudetools/.claude/tmp/payload.json
```

**Option 3 — Python urllib (no file at all):**

```bash
py -c "
import urllib.request, json
data = json.dumps({'key': 'value'}).encode()
req = urllib.request.Request('$URL', data=data, headers={'Content-Type': 'application/json'})
print(urllib.request.urlopen(req).status)
"
```

## Applies to

Any workflow where the Write tool creates a file that is subsequently read by a Bash command on Windows. This includes:
- Syncro API payloads
- PowerShell script files (use .claude/tmp/ or the Write tool with an absolute path)
- Any temp file exchange between Write tool and Bash tool
