zsh-safe

Reviewed at commit 0f299c4 New version, not yet reviewed

Lets Bash commands written for bash run under zsh: unmatched globs, leading =, and a missing timeout

Made by
HolyGrail
What we checked

Makes the zsh shells Claude Code starts treat unmatched globs and a leading = as plain text, like bash does, by pointing ZDOTDIR at a small startup file that hands your own settings back first. When a command fails because timeout is missing, it adds a hint for Claude to the result. It rewrites no commands, makes no network calls and stores nothing.

Review details

Static review of the source at the pinned commit; not run. Registers session.start (sets the environment variables ZSH_SAFE_DIR, ZSH_SAFE_ZDOTDIR and ZDOTDIR through $.env.set, keeping the person's own ZDOTDIR value so a reload does not overwrite it) and tool.call for Bash (after the call, if the result is an error matching a 'timeout: command not found' pattern, appends one fixed hint string to the result context; the command itself is never changed). The zdotdir/.zshenv file (not part of the TypeScript bundle, read from the repository) restores or unsets ZDOTDIR, sources the person's own .zshenv from the original location, then runs setopt nonomatch noequals and unsetopt null_glob csh_null_glob. It applies to every zsh Claude Code starts afterwards, including zsh scripts started from settings hooks, and ZDOTDIR is not reset on uninstall until Claude Code restarts (disclosed in the README). No file writes, network, process spawning or model calls.

What it uses
  • Reads your prompts: no
  • Sees tool calls: yes
  • Blocks or changes tool calls: no
  • Reads or writes files: yes
  • Runs programs on your machine: no
  • Calls the model (uses tokens): no
  • Sends data over the network: no
  • Stores data: no
  • Shows something on screen: no
Hooked events
Made this mod? Add a badge to your README

modsforClaude badge for zsh-safe

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/zsh-safe.svg)](https://modsforclaude.com/mods/zsh-safe/)

← All mods